aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Tests/Common/Helpers/SceneHelpers.cs
diff options
context:
space:
mode:
authorMelanie2011-12-05 17:10:51 +0000
committerMelanie2011-12-05 17:10:51 +0000
commit5ab536a1e92a9a50212cbc8e301ef9ac611fe9dc (patch)
tree537b010672277073530cf013434fa046aabfec7e /OpenSim/Tests/Common/Helpers/SceneHelpers.cs
parentStrip CR from http responses and limit them to 2048 chars (diff)
parentHG: Added HEAD method to Helo service. This is the preferred method, but its ... (diff)
downloadopensim-SC-5ab536a1e92a9a50212cbc8e301ef9ac611fe9dc.zip
opensim-SC-5ab536a1e92a9a50212cbc8e301ef9ac611fe9dc.tar.gz
opensim-SC-5ab536a1e92a9a50212cbc8e301ef9ac611fe9dc.tar.bz2
opensim-SC-5ab536a1e92a9a50212cbc8e301ef9ac611fe9dc.tar.xz
Merge branch 'master' into bigmerge
Conflicts: OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs OpenSim/Region/Framework/Scenes/ScenePresence.cs
Diffstat (limited to 'OpenSim/Tests/Common/Helpers/SceneHelpers.cs')
-rw-r--r--OpenSim/Tests/Common/Helpers/SceneHelpers.cs38
1 files changed, 28 insertions, 10 deletions
diff --git a/OpenSim/Tests/Common/Helpers/SceneHelpers.cs b/OpenSim/Tests/Common/Helpers/SceneHelpers.cs
index d358ae8..a25eb66 100644
--- a/OpenSim/Tests/Common/Helpers/SceneHelpers.cs
+++ b/OpenSim/Tests/Common/Helpers/SceneHelpers.cs
@@ -49,6 +49,7 @@ using OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts;
49using OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence; 49using OpenSim.Region.CoreModules.ServiceConnectorsOut.Presence;
50using OpenSim.Services.Interfaces; 50using OpenSim.Services.Interfaces;
51using OpenSim.Tests.Common.Mock; 51using OpenSim.Tests.Common.Mock;
52using GridRegion = OpenSim.Services.Interfaces.GridRegion;
52 53
53namespace OpenSim.Tests.Common 54namespace OpenSim.Tests.Common
54{ 55{
@@ -139,6 +140,7 @@ namespace OpenSim.Tests.Common
139 140
140 testScene.RegionInfo.EstateSettings = new EstateSettings(); 141 testScene.RegionInfo.EstateSettings = new EstateSettings();
141 testScene.LoginsDisabled = false; 142 testScene.LoginsDisabled = false;
143 testScene.RegisterRegionWithGrid();
142 144
143 return testScene; 145 return testScene;
144 } 146 }
@@ -222,6 +224,7 @@ namespace OpenSim.Tests.Common
222 config.Configs["Modules"].Set("GridServices", "LocalGridServicesConnector"); 224 config.Configs["Modules"].Set("GridServices", "LocalGridServicesConnector");
223 config.Configs["GridService"].Set("StorageProvider", "OpenSim.Data.Null.dll:NullRegionData"); 225 config.Configs["GridService"].Set("StorageProvider", "OpenSim.Data.Null.dll:NullRegionData");
224 config.Configs["GridService"].Set("LocalServiceModule", "OpenSim.Services.GridService.dll:GridService"); 226 config.Configs["GridService"].Set("LocalServiceModule", "OpenSim.Services.GridService.dll:GridService");
227 config.Configs["GridService"].Set("ConnectionString", "!static");
225 228
226 LocalGridServicesConnector gridService = new LocalGridServicesConnector(); 229 LocalGridServicesConnector gridService = new LocalGridServicesConnector();
227 gridService.Initialise(config); 230 gridService.Initialise(config);
@@ -393,27 +396,42 @@ namespace OpenSim.Tests.Common
393 /// <returns></returns> 396 /// <returns></returns>
394 public static ScenePresence AddScenePresence(Scene scene, AgentCircuitData agentData) 397 public static ScenePresence AddScenePresence(Scene scene, AgentCircuitData agentData)
395 { 398 {
396 string reason;
397
398 // We emulate the proper login sequence here by doing things in four stages 399 // We emulate the proper login sequence here by doing things in four stages
399 400
400 // Stage 0: log the presence 401 // Stage 0: login
401 scene.PresenceService.LoginAgent(agentData.AgentID.ToString(), agentData.SessionID, agentData.SecureSessionID); 402 scene.PresenceService.LoginAgent(agentData.AgentID.ToString(), agentData.SessionID, agentData.SecureSessionID);
402 403
403 // Stage 1: simulate login by telling the scene to expect a new user connection 404 // Stages 1 & 2
404 if (!scene.NewUserConnection(agentData, (uint)TeleportFlags.ViaLogin, out reason)) 405 ScenePresence sp = IntroduceClientToScene(scene, agentData, TeleportFlags.ViaLogin);
406
407 // Stage 3: Complete the entrance into the region. This converts the child agent into a root agent.
408 sp.CompleteMovement(sp.ControllingClient, true);
409
410 return sp;
411 }
412
413 private static ScenePresence IntroduceClientToScene(Scene scene, AgentCircuitData agentData, TeleportFlags tf)
414 {
415 string reason;
416
417 // Stage 1: tell the scene to expect a new user connection
418 if (!scene.NewUserConnection(agentData, (uint)tf, out reason))
405 Console.WriteLine("NewUserConnection failed: " + reason); 419 Console.WriteLine("NewUserConnection failed: " + reason);
406 420
407 // Stage 2: add the new client as a child agent to the scene 421 // Stage 2: add the new client as a child agent to the scene
408 TestClient client = new TestClient(agentData, scene); 422 TestClient client = new TestClient(agentData, scene);
409 scene.AddNewClient(client, PresenceType.User); 423 scene.AddNewClient(client, PresenceType.User);
410 424
411 // Stage 3: Complete the entrance into the region. This converts the child agent into a root agent. 425 return scene.GetScenePresence(agentData.AgentID);
412 ScenePresence scp = scene.GetScenePresence(agentData.AgentID); 426 }
413 scp.CompleteMovement(client, true); 427
414 //scp.MakeRootAgent(new Vector3(90, 90, 90), true); 428 public static ScenePresence AddChildScenePresence(Scene scene, UUID agentId)
429 {
430 AgentCircuitData acd = GenerateAgentData(agentId);
431 acd.child = true;
415 432
416 return scp; 433 // XXX: ViaLogin may not be correct for child agents
434 return IntroduceClientToScene(scene, acd, TeleportFlags.ViaLogin);
417 } 435 }
418 436
419 /// <summary> 437 /// <summary>