aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Tests
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2010-03-12 19:31:14 +0000
committerJustin Clark-Casey (justincc)2010-03-12 19:31:14 +0000
commitf2de50bb14bd8215ea98c79c79aabe1e6b4f2780 (patch)
treea234ef918308290b8d9db829f392ce646b7f2c06 /OpenSim/Tests
parentMerge branch 'master' of ssh://justincc@opensimulator.org/var/git/opensim (diff)
downloadopensim-SC_OLD-f2de50bb14bd8215ea98c79c79aabe1e6b4f2780.zip
opensim-SC_OLD-f2de50bb14bd8215ea98c79c79aabe1e6b4f2780.tar.gz
opensim-SC_OLD-f2de50bb14bd8215ea98c79c79aabe1e6b4f2780.tar.bz2
opensim-SC_OLD-f2de50bb14bd8215ea98c79c79aabe1e6b4f2780.tar.xz
Fix tests broken in 88771aeed3d45e60a18aa9a810eeb37b8e5def12
Adds MockUserAccountService and connects it up Stops services being carried over between tests since this leads to hard to find bugs Improves information and error reporting when loading plugins
Diffstat (limited to 'OpenSim/Tests')
-rw-r--r--OpenSim/Tests/Common/Mock/MockUserAccountService.cs45
-rw-r--r--OpenSim/Tests/Common/Mock/TestScene.cs4
-rw-r--r--OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs34
3 files changed, 74 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..f5d758a
--- /dev/null
+++ b/OpenSim/Tests/Common/Mock/MockUserAccountService.cs
@@ -0,0 +1,45 @@
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 public MockUserAccountService(IConfigSource config) {}
38
39 public UserAccount GetUserAccount(UUID scopeID, UUID userID) { return new UserAccount(); }
40 public UserAccount GetUserAccount(UUID scopeID, string FirstName, string LastName) { return new UserAccount(); }
41 public UserAccount GetUserAccount(UUID scopeID, string Email) { return new UserAccount(); }
42 public List<UserAccount> GetUserAccounts(UUID scopeID, string query) { return new List<UserAccount>(); }
43 public bool StoreUserAccount(UserAccount data) { return true; }
44 }
45} \ 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..ab3e7cb 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,11 @@ 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 m_assetService = null;
219 m_inventoryService = null;
220 m_gridService = null;
221 m_userAccountService = null;
212 222
213 return testScene; 223 return testScene;
214 } 224 }
@@ -273,6 +283,11 @@ namespace OpenSim.Tests.Common.Setup
273 //testScene.AddRegionModule(m_gridService.Name, m_gridService); 283 //testScene.AddRegionModule(m_gridService.Name, m_gridService);
274 } 284 }
275 285
286 /// <summary>
287 /// Start a user account service, whether real or mock
288 /// </summary>
289 /// <param name="testScene"></param>
290 /// <param name="real">Starts a real service if true, a mock service if not</param>
276 private static void StartUserAccountService(Scene testScene, bool real) 291 private static void StartUserAccountService(Scene testScene, bool real)
277 { 292 {
278 IConfigSource config = new IniConfigSource(); 293 IConfigSource config = new IniConfigSource();
@@ -280,8 +295,14 @@ namespace OpenSim.Tests.Common.Setup
280 config.AddConfig("UserAccountService"); 295 config.AddConfig("UserAccountService");
281 config.Configs["Modules"].Set("UserAccountServices", "LocalUserAccountServicesConnector"); 296 config.Configs["Modules"].Set("UserAccountServices", "LocalUserAccountServicesConnector");
282 config.Configs["UserAccountService"].Set("StorageProvider", "OpenSim.Data.Null.dll"); 297 config.Configs["UserAccountService"].Set("StorageProvider", "OpenSim.Data.Null.dll");
298
283 if (real) 299 if (real)
284 config.Configs["UserAccountService"].Set("LocalServiceModule", "OpenSim.Services.UserAccountService.dll:UserAccountService"); 300 config.Configs["UserAccountService"].Set(
301 "LocalServiceModule", "OpenSim.Services.UserAccountService.dll:UserAccountService");
302 else
303 config.Configs["UserAccountService"].Set(
304 "LocalServiceModule", "OpenSim.Tests.Common.dll:MockUserAccountService");
305
285 if (m_userAccountService == null) 306 if (m_userAccountService == null)
286 { 307 {
287 ISharedRegionModule userAccountService = new LocalUserAccountServicesConnector(); 308 ISharedRegionModule userAccountService = new LocalUserAccountServicesConnector();
@@ -292,10 +313,9 @@ namespace OpenSim.Tests.Common.Setup
292 // config.Configs["GridService"].Set("LocalServiceModule", "OpenSim.Tests.Common.dll:TestGridService"); 313 // config.Configs["GridService"].Set("LocalServiceModule", "OpenSim.Tests.Common.dll:TestGridService");
293 m_userAccountService.AddRegion(testScene); 314 m_userAccountService.AddRegion(testScene);
294 m_userAccountService.RegionLoaded(testScene); 315 m_userAccountService.RegionLoaded(testScene);
295 //testScene.AddRegionModule(m_gridService.Name, m_gridService); 316 testScene.AddRegionModule(m_userAccountService.Name, m_userAccountService);
296 } 317 }
297 318
298
299 /// <summary> 319 /// <summary>
300 /// Setup modules for a scene using their default settings. 320 /// Setup modules for a scene using their default settings.
301 /// </summary> 321 /// </summary>