aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2010-08-20 19:36:04 +0100
committerJustin Clark-Casey (justincc)2010-08-20 19:36:04 +0100
commit5155915de136d75a305ab83c0685c78444d63d22 (patch)
treee2423377553fd8966ea6d9b4eba4c3126b3fe538 /OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs
parentSome code cleanup for console command "create region". (diff)
parentMerge branch 'master' of ssh://diva@opensimulator.org/var/git/opensim (diff)
downloadopensim-SC_OLD-5155915de136d75a305ab83c0685c78444d63d22.zip
opensim-SC_OLD-5155915de136d75a305ab83c0685c78444d63d22.tar.gz
opensim-SC_OLD-5155915de136d75a305ab83c0685c78444d63d22.tar.bz2
opensim-SC_OLD-5155915de136d75a305ab83c0685c78444d63d22.tar.xz
Merge branch 'master' of ssh://opensimulator.org/var/git/opensim
Diffstat (limited to 'OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs')
-rw-r--r--OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs56
1 files changed, 48 insertions, 8 deletions
diff --git a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs
index 4a356e2..eaa0d33 100644
--- a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs
+++ b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs
@@ -46,6 +46,7 @@ using OpenSim.Region.CoreModules.ServiceConnectorsOut.Authentication;
46using OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory; 46using OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory;
47using OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid; 47using OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid;
48using OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts; 48using OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts;
49using OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence;
49using OpenSim.Services.Interfaces; 50using OpenSim.Services.Interfaces;
50using OpenSim.Tests.Common.Mock; 51using OpenSim.Tests.Common.Mock;
51 52
@@ -63,6 +64,7 @@ namespace OpenSim.Tests.Common.Setup
63 private static ISharedRegionModule m_inventoryService = null; 64 private static ISharedRegionModule m_inventoryService = null;
64 private static ISharedRegionModule m_gridService = null; 65 private static ISharedRegionModule m_gridService = null;
65 private static ISharedRegionModule m_userAccountService = null; 66 private static ISharedRegionModule m_userAccountService = null;
67 private static ISharedRegionModule m_presenceService = null;
66 68
67 /// <summary> 69 /// <summary>
68 /// Set up a test scene 70 /// Set up a test scene
@@ -180,7 +182,7 @@ namespace OpenSim.Tests.Common.Setup
180 else 182 else
181 StartAssetService(testScene, false); 183 StartAssetService(testScene, false);
182 184
183 // For now, always started a 'real' authenication service 185 // For now, always started a 'real' authentication service
184 StartAuthenticationService(testScene, true); 186 StartAuthenticationService(testScene, true);
185 187
186 if (realServices.Contains("inventory")) 188 if (realServices.Contains("inventory"))
@@ -188,10 +190,9 @@ namespace OpenSim.Tests.Common.Setup
188 else 190 else
189 StartInventoryService(testScene, false); 191 StartInventoryService(testScene, false);
190 192
191 if (realServices.Contains("grid")) 193 StartGridService(testScene, true);
192 StartGridService(testScene, true);
193
194 StartUserAccountService(testScene); 194 StartUserAccountService(testScene);
195 StartPresenceService(testScene);
195 } 196 }
196 // If not, make sure the shared module gets references to this new scene 197 // If not, make sure the shared module gets references to this new scene
197 else 198 else
@@ -202,11 +203,15 @@ namespace OpenSim.Tests.Common.Setup
202 m_inventoryService.RegionLoaded(testScene); 203 m_inventoryService.RegionLoaded(testScene);
203 m_userAccountService.AddRegion(testScene); 204 m_userAccountService.AddRegion(testScene);
204 m_userAccountService.RegionLoaded(testScene); 205 m_userAccountService.RegionLoaded(testScene);
206 m_presenceService.AddRegion(testScene);
207 m_presenceService.RegionLoaded(testScene);
208
205 } 209 }
206 210
207 m_inventoryService.PostInitialise(); 211 m_inventoryService.PostInitialise();
208 m_assetService.PostInitialise(); 212 m_assetService.PostInitialise();
209 m_userAccountService.PostInitialise(); 213 m_userAccountService.PostInitialise();
214 m_presenceService.PostInitialise();
210 testScene.RegionInfo.EstateSettings.EstateOwner = UUID.Random(); 215 testScene.RegionInfo.EstateSettings.EstateOwner = UUID.Random();
211 testScene.SetModuleInterfaces(); 216 testScene.SetModuleInterfaces();
212 217
@@ -225,7 +230,11 @@ namespace OpenSim.Tests.Common.Setup
225 m_inventoryService = null; 230 m_inventoryService = null;
226 m_gridService = null; 231 m_gridService = null;
227 m_userAccountService = null; 232 m_userAccountService = null;
228 233 m_presenceService = null;
234
235 testScene.RegionInfo.EstateSettings = new EstateSettings();
236 testScene.LoginsDisabled = false;
237
229 return testScene; 238 return testScene;
230 } 239 }
231 240
@@ -337,6 +346,32 @@ namespace OpenSim.Tests.Common.Setup
337 } 346 }
338 347
339 /// <summary> 348 /// <summary>
349 /// Start a presence service
350 /// </summary>
351 /// <param name="testScene"></param>
352 private static void StartPresenceService(Scene testScene)
353 {
354 IConfigSource config = new IniConfigSource();
355 config.AddConfig("Modules");
356 config.AddConfig("PresenceService");
357 config.Configs["Modules"].Set("PresenceServices", "LocalPresenceServicesConnector");
358 config.Configs["PresenceService"].Set("StorageProvider", "OpenSim.Data.Null.dll");
359 config.Configs["PresenceService"].Set(
360 "LocalServiceModule", "OpenSim.Services.PresenceService.dll:PresenceService");
361
362 if (m_presenceService == null)
363 {
364 ISharedRegionModule presenceService = new LocalPresenceServicesConnector();
365 presenceService.Initialise(config);
366 m_presenceService = presenceService;
367 }
368
369 m_presenceService.AddRegion(testScene);
370 m_presenceService.RegionLoaded(testScene);
371 testScene.AddRegionModule(m_presenceService.Name, m_presenceService);
372 }
373
374 /// <summary>
340 /// Setup modules for a scene using their default settings. 375 /// Setup modules for a scene using their default settings.
341 /// </summary> 376 /// </summary>
342 /// <param name="scene"></param> 377 /// <param name="scene"></param>
@@ -446,9 +481,14 @@ namespace OpenSim.Tests.Common.Setup
446 { 481 {
447 string reason; 482 string reason;
448 483
449 // We emulate the proper login sequence here by doing things in three stages 484 // We emulate the proper login sequence here by doing things in four stages
485
486 // Stage 0: log the presence
487 scene.PresenceService.LoginAgent(agentData.AgentID.ToString(), agentData.SessionID, agentData.SecureSessionID);
488
450 // Stage 1: simulate login by telling the scene to expect a new user connection 489 // Stage 1: simulate login by telling the scene to expect a new user connection
451 scene.NewUserConnection(agentData, (uint)TeleportFlags.ViaLogin, out reason); 490 if (!scene.NewUserConnection(agentData, (uint)TeleportFlags.ViaLogin, out reason))
491 Console.WriteLine("NewUserConnection failed: " + reason);
452 492
453 // Stage 2: add the new client as a child agent to the scene 493 // Stage 2: add the new client as a child agent to the scene
454 TestClient client = new TestClient(agentData, scene); 494 TestClient client = new TestClient(agentData, scene);
@@ -459,7 +499,7 @@ namespace OpenSim.Tests.Common.Setup
459 //scene.AgentCrossing(agentData.AgentID, new Vector3(90, 90, 90), false); OBSOLETE 499 //scene.AgentCrossing(agentData.AgentID, new Vector3(90, 90, 90), false); OBSOLETE
460 500
461 ScenePresence scp = scene.GetScenePresence(agentData.AgentID); 501 ScenePresence scp = scene.GetScenePresence(agentData.AgentID);
462 scp.MakeRootAgent(new Vector3(90,90,90), true); 502 scp.MakeRootAgent(new Vector3(90, 90, 90), true);
463 503
464 return client; 504 return client;
465 } 505 }