diff options
Diffstat (limited to 'OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs')
-rw-r--r-- | OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs | 37 |
1 files changed, 30 insertions, 7 deletions
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> |