aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs')
-rw-r--r--OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs93
1 files changed, 40 insertions, 53 deletions
diff --git a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs
index 08cc7c5..2aeafc8 100644
--- a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs
+++ b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs
@@ -59,19 +59,14 @@ namespace OpenSim.Tests.Common.Setup
59 { 59 {
60 // These static variables in order to allow regions to be linked by shared modules and same 60 // These static variables in order to allow regions to be linked by shared modules and same
61 // CommunicationsManager. 61 // CommunicationsManager.
62 private static ISharedRegionModule m_assetService = null;
63// private static ISharedRegionModule m_authenticationService = null;
64 private static ISharedRegionModule m_inventoryService = null; 62 private static ISharedRegionModule m_inventoryService = null;
65 private static ISharedRegionModule m_gridService = null;
66 private static ISharedRegionModule m_userAccountService = null;
67 private static ISharedRegionModule m_presenceService = null;
68 63
69 /// <summary> 64 /// <summary>
70 /// Set up a test scene 65 /// Set up a test scene
71 /// </summary> 66 /// </summary>
72 /// 67 /// <remarks>
73 /// Automatically starts service threads, as would the normal runtime. 68 /// Automatically starts service threads, as would the normal runtime.
74 /// 69 /// </remarks>
75 /// <returns></returns> 70 /// <returns></returns>
76 public static TestScene SetupScene() 71 public static TestScene SetupScene()
77 { 72 {
@@ -156,10 +151,7 @@ namespace OpenSim.Tests.Common.Setup
156 testScene.AddModule(godsModule.Name, godsModule); 151 testScene.AddModule(godsModule.Name, godsModule);
157 realServices = realServices.ToLower(); 152 realServices = realServices.ToLower();
158 153
159 if (realServices.Contains("asset")) 154 LocalAssetServicesConnector assetService = StartAssetService(testScene, realServices.Contains("asset"));
160 StartAssetService(testScene, true);
161 else
162 StartAssetService(testScene, false);
163 155
164 // For now, always started a 'real' authentication service 156 // For now, always started a 'real' authentication service
165 StartAuthenticationService(testScene, true); 157 StartAuthenticationService(testScene, true);
@@ -169,14 +161,15 @@ namespace OpenSim.Tests.Common.Setup
169 else 161 else
170 StartInventoryService(testScene, false); 162 StartInventoryService(testScene, false);
171 163
172 StartGridService(testScene, true); 164 StartGridService(testScene, true);
173 StartUserAccountService(testScene); 165 LocalUserAccountServicesConnector userAccountService = StartUserAccountService(testScene);
174 StartPresenceService(testScene); 166 LocalPresenceServicesConnector presenceService = StartPresenceService(testScene);
175 167
176 m_inventoryService.PostInitialise(); 168 m_inventoryService.PostInitialise();
177 m_assetService.PostInitialise(); 169 assetService.PostInitialise();
178 m_userAccountService.PostInitialise(); 170 userAccountService.PostInitialise();
179 m_presenceService.PostInitialise(); 171 presenceService.PostInitialise();
172
180 testScene.RegionInfo.EstateSettings.EstateOwner = UUID.Random(); 173 testScene.RegionInfo.EstateSettings.EstateOwner = UUID.Random();
181 testScene.SetModuleInterfaces(); 174 testScene.SetModuleInterfaces();
182 175
@@ -191,11 +184,7 @@ namespace OpenSim.Tests.Common.Setup
191 // It's really not a good idea to use static variables as they carry over between tests, leading to 184 // It's really not a good idea to use static variables as they carry over between tests, leading to
192 // problems that are extremely hard to debug. Really, these static fields need to be eliminated - 185 // problems that are extremely hard to debug. Really, these static fields need to be eliminated -
193 // tests using multiple regions that need to share modules need to find another solution. 186 // tests using multiple regions that need to share modules need to find another solution.
194 m_assetService = null;
195 m_inventoryService = null; 187 m_inventoryService = null;
196 m_gridService = null;
197 m_userAccountService = null;
198 m_presenceService = null;
199 188
200 testScene.RegionInfo.EstateSettings = new EstateSettings(); 189 testScene.RegionInfo.EstateSettings = new EstateSettings();
201 testScene.LoginsDisabled = false; 190 testScene.LoginsDisabled = false;
@@ -203,9 +192,9 @@ namespace OpenSim.Tests.Common.Setup
203 return testScene; 192 return testScene;
204 } 193 }
205 194
206 private static void StartAssetService(Scene testScene, bool real) 195 private static LocalAssetServicesConnector StartAssetService(Scene testScene, bool real)
207 { 196 {
208 ISharedRegionModule assetService = new LocalAssetServicesConnector(); 197 LocalAssetServicesConnector assetService = new LocalAssetServicesConnector();
209 IConfigSource config = new IniConfigSource(); 198 IConfigSource config = new IniConfigSource();
210 config.AddConfig("Modules"); 199 config.AddConfig("Modules");
211 config.AddConfig("AssetService"); 200 config.AddConfig("AssetService");
@@ -219,7 +208,8 @@ namespace OpenSim.Tests.Common.Setup
219 assetService.AddRegion(testScene); 208 assetService.AddRegion(testScene);
220 assetService.RegionLoaded(testScene); 209 assetService.RegionLoaded(testScene);
221 testScene.AddRegionModule(assetService.Name, assetService); 210 testScene.AddRegionModule(assetService.Name, assetService);
222 m_assetService = assetService; 211
212 return assetService;
223 } 213 }
224 214
225 private static void StartAuthenticationService(Scene testScene, bool real) 215 private static void StartAuthenticationService(Scene testScene, bool real)
@@ -268,7 +258,7 @@ namespace OpenSim.Tests.Common.Setup
268 m_inventoryService = inventoryService; 258 m_inventoryService = inventoryService;
269 } 259 }
270 260
271 private static void StartGridService(Scene testScene, bool real) 261 private static LocalGridServicesConnector StartGridService(Scene testScene, bool real)
272 { 262 {
273 IConfigSource config = new IniConfigSource(); 263 IConfigSource config = new IniConfigSource();
274 config.AddConfig("Modules"); 264 config.AddConfig("Modules");
@@ -277,24 +267,25 @@ namespace OpenSim.Tests.Common.Setup
277 config.Configs["GridService"].Set("StorageProvider", "OpenSim.Data.Null.dll:NullRegionData"); 267 config.Configs["GridService"].Set("StorageProvider", "OpenSim.Data.Null.dll:NullRegionData");
278 if (real) 268 if (real)
279 config.Configs["GridService"].Set("LocalServiceModule", "OpenSim.Services.GridService.dll:GridService"); 269 config.Configs["GridService"].Set("LocalServiceModule", "OpenSim.Services.GridService.dll:GridService");
280 if (m_gridService == null) 270
281 { 271 LocalGridServicesConnector gridService = new LocalGridServicesConnector();
282 ISharedRegionModule gridService = new LocalGridServicesConnector(); 272 gridService.Initialise(config);
283 gridService.Initialise(config); 273
284 m_gridService = gridService;
285 }
286 //else 274 //else
287 // config.Configs["GridService"].Set("LocalServiceModule", "OpenSim.Tests.Common.dll:TestGridService"); 275 // config.Configs["GridService"].Set("LocalServiceModule", "OpenSim.Tests.Common.dll:TestGridService");
288 m_gridService.AddRegion(testScene); 276 gridService.AddRegion(testScene);
289 m_gridService.RegionLoaded(testScene); 277 gridService.RegionLoaded(testScene);
290 //testScene.AddRegionModule(m_gridService.Name, m_gridService); 278 //testScene.AddRegionModule(m_gridService.Name, m_gridService);
279
280 return gridService;
291 } 281 }
292 282
293 /// <summary> 283 /// <summary>
294 /// Start a user account service 284 /// Start a user account service
295 /// </summary> 285 /// </summary>
296 /// <param name="testScene"></param> 286 /// <param name="testScene"></param>
297 private static void StartUserAccountService(Scene testScene) 287 /// <returns></returns>
288 private static LocalUserAccountServicesConnector StartUserAccountService(Scene testScene)
298 { 289 {
299 IConfigSource config = new IniConfigSource(); 290 IConfigSource config = new IniConfigSource();
300 config.AddConfig("Modules"); 291 config.AddConfig("Modules");
@@ -304,23 +295,21 @@ namespace OpenSim.Tests.Common.Setup
304 config.Configs["UserAccountService"].Set( 295 config.Configs["UserAccountService"].Set(
305 "LocalServiceModule", "OpenSim.Services.UserAccountService.dll:UserAccountService"); 296 "LocalServiceModule", "OpenSim.Services.UserAccountService.dll:UserAccountService");
306 297
307// if (m_userAccountService == null) 298 LocalUserAccountServicesConnector userAccountService = new LocalUserAccountServicesConnector();
308// { 299 userAccountService.Initialise(config);
309 ISharedRegionModule userAccountService = new LocalUserAccountServicesConnector();
310 userAccountService.Initialise(config);
311 m_userAccountService = userAccountService;
312// }
313 300
314 m_userAccountService.AddRegion(testScene); 301 userAccountService.AddRegion(testScene);
315 m_userAccountService.RegionLoaded(testScene); 302 userAccountService.RegionLoaded(testScene);
316 testScene.AddRegionModule(m_userAccountService.Name, m_userAccountService); 303 testScene.AddRegionModule(userAccountService.Name, userAccountService);
304
305 return userAccountService;
317 } 306 }
318 307
319 /// <summary> 308 /// <summary>
320 /// Start a presence service 309 /// Start a presence service
321 /// </summary> 310 /// </summary>
322 /// <param name="testScene"></param> 311 /// <param name="testScene"></param>
323 private static void StartPresenceService(Scene testScene) 312 private static LocalPresenceServicesConnector StartPresenceService(Scene testScene)
324 { 313 {
325 IConfigSource config = new IniConfigSource(); 314 IConfigSource config = new IniConfigSource();
326 config.AddConfig("Modules"); 315 config.AddConfig("Modules");
@@ -330,16 +319,14 @@ namespace OpenSim.Tests.Common.Setup
330 config.Configs["PresenceService"].Set( 319 config.Configs["PresenceService"].Set(
331 "LocalServiceModule", "OpenSim.Services.PresenceService.dll:PresenceService"); 320 "LocalServiceModule", "OpenSim.Services.PresenceService.dll:PresenceService");
332 321
333 if (m_presenceService == null) 322 LocalPresenceServicesConnector presenceService = new LocalPresenceServicesConnector();
334 { 323 presenceService.Initialise(config);
335 ISharedRegionModule presenceService = new LocalPresenceServicesConnector();
336 presenceService.Initialise(config);
337 m_presenceService = presenceService;
338 }
339 324
340 m_presenceService.AddRegion(testScene); 325 presenceService.AddRegion(testScene);
341 m_presenceService.RegionLoaded(testScene); 326 presenceService.RegionLoaded(testScene);
342 testScene.AddRegionModule(m_presenceService.Name, m_presenceService); 327 testScene.AddRegionModule(presenceService.Name, presenceService);
328
329 return presenceService;
343 } 330 }
344 331
345 /// <summary> 332 /// <summary>