aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Tests/Common
diff options
context:
space:
mode:
authorMelanie2010-03-15 17:23:35 +0000
committerMelanie2010-03-15 17:23:35 +0000
commitd3f33acc1a6a385ee19814286fe27cb5e48c1551 (patch)
tree07795e74a637ca63d96b5ee06950b8c1a7a99489 /OpenSim/Tests/Common
parentMerge branch 'careminster' into careminster-presence-refactor (diff)
parentflip UVs for profile faces (diff)
downloadopensim-SC-d3f33acc1a6a385ee19814286fe27cb5e48c1551.zip
opensim-SC-d3f33acc1a6a385ee19814286fe27cb5e48c1551.tar.gz
opensim-SC-d3f33acc1a6a385ee19814286fe27cb5e48c1551.tar.bz2
opensim-SC-d3f33acc1a6a385ee19814286fe27cb5e48c1551.tar.xz
Merge branch 'master' into careminster-presence-refactor
Diffstat (limited to 'OpenSim/Tests/Common')
-rw-r--r--OpenSim/Tests/Common/Mock/MockUserAccountService.cs46
-rw-r--r--OpenSim/Tests/Common/Mock/TestScene.cs4
-rw-r--r--OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs37
3 files changed, 78 insertions, 9 deletions
diff --git a/OpenSim/Tests/Common/Mock/MockUserAccountService.cs b/OpenSim/Tests/Common/Mock/MockUserAccountService.cs
new file mode 100644
index 0000000..0769c7a
--- /dev/null
+++ b/OpenSim/Tests/Common/Mock/MockUserAccountService.cs
@@ -0,0 +1,46 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System.Collections.Generic;
29using Nini.Config;
30using OpenMetaverse;
31using OpenSim.Services.Interfaces;
32
33namespace OpenSim.Tests.Common.Mock
34{
35 public class MockUserAccountService : IUserAccountService
36 {
37
38 public MockUserAccountService(IConfigSource config) {}
39
40 public UserAccount GetUserAccount(UUID scopeID, UUID userID) { return new UserAccount(); }
41 public UserAccount GetUserAccount(UUID scopeID, string FirstName, string LastName) { return new UserAccount(); }
42 public UserAccount GetUserAccount(UUID scopeID, string Email) { return new UserAccount(); }
43 public List<UserAccount> GetUserAccounts(UUID scopeID, string query) { return new List<UserAccount>(); }
44 public bool StoreUserAccount(UserAccount data) { return true; }
45 }
46} \ No newline at end of file
diff --git a/OpenSim/Tests/Common/Mock/TestScene.cs b/OpenSim/Tests/Common/Mock/TestScene.cs
index 076cb7a..01f2c14 100644
--- a/OpenSim/Tests/Common/Mock/TestScene.cs
+++ b/OpenSim/Tests/Common/Mock/TestScene.cs
@@ -65,6 +65,6 @@ namespace OpenSim.Tests.Common.Mock
65 public AsyncSceneObjectGroupDeleter SceneObjectGroupDeleter 65 public AsyncSceneObjectGroupDeleter SceneObjectGroupDeleter
66 { 66 {
67 get { return m_asyncSceneObjectDeleter; } 67 get { return m_asyncSceneObjectDeleter; }
68 } 68 }
69 } 69 }
70} 70} \ No newline at end of file
diff --git a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs
index 9e718f6..864e2aa 100644
--- a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs
+++ b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs
@@ -128,7 +128,7 @@ namespace OpenSim.Tests.Common.Setup
128 /// <param name="realServices">Starts real inventory and asset services, as opposed to mock ones, if true</param> 128 /// <param name="realServices">Starts real inventory and asset services, as opposed to mock ones, if true</param>
129 /// <returns></returns> 129 /// <returns></returns>
130 public static TestScene SetupScene( 130 public static TestScene SetupScene(
131 string name, UUID id, uint x, uint y, String realServices) 131 string name, UUID id, uint x, uint y, String realServices)
132 { 132 {
133 bool newScene = false; 133 bool newScene = false;
134 134
@@ -179,15 +179,16 @@ namespace OpenSim.Tests.Common.Setup
179 StartAssetService(testScene, true); 179 StartAssetService(testScene, true);
180 else 180 else
181 StartAssetService(testScene, false); 181 StartAssetService(testScene, false);
182
182 if (realServices.Contains("inventory")) 183 if (realServices.Contains("inventory"))
183 StartInventoryService(testScene, true); 184 StartInventoryService(testScene, true);
184 else 185 else
185 StartInventoryService(testScene, false); 186 StartInventoryService(testScene, false);
187
186 if (realServices.Contains("grid")) 188 if (realServices.Contains("grid"))
187 StartGridService(testScene, true); 189 StartGridService(testScene, true);
188 if (realServices.Contains("useraccounts")) 190
189 StartUserAccountService(testScene, true); 191 StartUserAccountService(testScene, realServices.Contains("useraccounts"));
190
191 } 192 }
192 // If not, make sure the shared module gets references to this new scene 193 // If not, make sure the shared module gets references to this new scene
193 else 194 else
@@ -196,9 +197,13 @@ namespace OpenSim.Tests.Common.Setup
196 m_assetService.RegionLoaded(testScene); 197 m_assetService.RegionLoaded(testScene);
197 m_inventoryService.AddRegion(testScene); 198 m_inventoryService.AddRegion(testScene);
198 m_inventoryService.RegionLoaded(testScene); 199 m_inventoryService.RegionLoaded(testScene);
200 m_userAccountService.AddRegion(testScene);
201 m_userAccountService.RegionLoaded(testScene);
199 } 202 }
203
200 m_inventoryService.PostInitialise(); 204 m_inventoryService.PostInitialise();
201 m_assetService.PostInitialise(); 205 m_assetService.PostInitialise();
206 m_userAccountService.PostInitialise();
202 207
203 testScene.SetModuleInterfaces(); 208 testScene.SetModuleInterfaces();
204 209
@@ -209,6 +214,14 @@ namespace OpenSim.Tests.Common.Setup
209 physicsPluginManager.LoadPluginsFromAssembly("Physics/OpenSim.Region.Physics.BasicPhysicsPlugin.dll"); 214 physicsPluginManager.LoadPluginsFromAssembly("Physics/OpenSim.Region.Physics.BasicPhysicsPlugin.dll");
210 testScene.PhysicsScene 215 testScene.PhysicsScene
211 = physicsPluginManager.GetPhysicsScene("basicphysics", "ZeroMesher", new IniConfigSource(), "test"); 216 = physicsPluginManager.GetPhysicsScene("basicphysics", "ZeroMesher", new IniConfigSource(), "test");
217
218 // It's really not a good idea to use static variables as they carry over between tests, leading to
219 // problems that are extremely hard to debug. Really, these static fields need to be eliminated -
220 // tests using multiple regions that need to share modules need to find another solution.
221 m_assetService = null;
222 m_inventoryService = null;
223 m_gridService = null;
224 m_userAccountService = null;
212 225
213 return testScene; 226 return testScene;
214 } 227 }
@@ -273,6 +286,11 @@ namespace OpenSim.Tests.Common.Setup
273 //testScene.AddRegionModule(m_gridService.Name, m_gridService); 286 //testScene.AddRegionModule(m_gridService.Name, m_gridService);
274 } 287 }
275 288
289 /// <summary>
290 /// Start a user account service, whether real or mock
291 /// </summary>
292 /// <param name="testScene"></param>
293 /// <param name="real">Starts a real service if true, a mock service if not</param>
276 private static void StartUserAccountService(Scene testScene, bool real) 294 private static void StartUserAccountService(Scene testScene, bool real)
277 { 295 {
278 IConfigSource config = new IniConfigSource(); 296 IConfigSource config = new IniConfigSource();
@@ -280,8 +298,14 @@ namespace OpenSim.Tests.Common.Setup
280 config.AddConfig("UserAccountService"); 298 config.AddConfig("UserAccountService");
281 config.Configs["Modules"].Set("UserAccountServices", "LocalUserAccountServicesConnector"); 299 config.Configs["Modules"].Set("UserAccountServices", "LocalUserAccountServicesConnector");
282 config.Configs["UserAccountService"].Set("StorageProvider", "OpenSim.Data.Null.dll"); 300 config.Configs["UserAccountService"].Set("StorageProvider", "OpenSim.Data.Null.dll");
301
283 if (real) 302 if (real)
284 config.Configs["UserAccountService"].Set("LocalServiceModule", "OpenSim.Services.UserAccountService.dll:UserAccountService"); 303 config.Configs["UserAccountService"].Set(
304 "LocalServiceModule", "OpenSim.Services.UserAccountService.dll:UserAccountService");
305 else
306 config.Configs["UserAccountService"].Set(
307 "LocalServiceModule", "OpenSim.Tests.Common.dll:MockUserAccountService");
308
285 if (m_userAccountService == null) 309 if (m_userAccountService == null)
286 { 310 {
287 ISharedRegionModule userAccountService = new LocalUserAccountServicesConnector(); 311 ISharedRegionModule userAccountService = new LocalUserAccountServicesConnector();
@@ -292,10 +316,9 @@ namespace OpenSim.Tests.Common.Setup
292 // config.Configs["GridService"].Set("LocalServiceModule", "OpenSim.Tests.Common.dll:TestGridService"); 316 // config.Configs["GridService"].Set("LocalServiceModule", "OpenSim.Tests.Common.dll:TestGridService");
293 m_userAccountService.AddRegion(testScene); 317 m_userAccountService.AddRegion(testScene);
294 m_userAccountService.RegionLoaded(testScene); 318 m_userAccountService.RegionLoaded(testScene);
295 //testScene.AddRegionModule(m_gridService.Name, m_gridService); 319 testScene.AddRegionModule(m_userAccountService.Name, m_userAccountService);
296 } 320 }
297 321
298
299 /// <summary> 322 /// <summary>
300 /// Setup modules for a scene using their default settings. 323 /// Setup modules for a scene using their default settings.
301 /// </summary> 324 /// </summary>