aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2013-08-17 00:24:56 +0100
committerJustin Clark-Casey (justincc)2013-08-17 00:24:56 +0100
commitf5d3145bea75fe2c84f49685031443c6826ffae7 (patch)
tree929c59fbd7502a1ce55972766d69cd868521e102
parentAdd TestSameSimulatorNeighbouringRegionsV2() regression test for v2 entity tr... (diff)
downloadopensim-SC_OLD-f5d3145bea75fe2c84f49685031443c6826ffae7.zip
opensim-SC_OLD-f5d3145bea75fe2c84f49685031443c6826ffae7.tar.gz
opensim-SC_OLD-f5d3145bea75fe2c84f49685031443c6826ffae7.tar.bz2
opensim-SC_OLD-f5d3145bea75fe2c84f49685031443c6826ffae7.tar.xz
Add ScenePresenceTeleportTests.TestSameSimulatorIsolatedRegionsV2() regression test for v2 transfers.
Also adjusts names of teleport setup helpers in EntityTransferHelpers
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs4
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/ScenePresenceCrossingTests.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs68
-rw-r--r--OpenSim/Tests/Common/Helpers/EntityTransferHelpers.cs43
5 files changed, 109 insertions, 10 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs
index bdfef32..fd493fc 100644
--- a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs
@@ -844,7 +844,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
844 AgentCircuitData acd = SceneHelpers.GenerateAgentData(ua1.PrincipalID); 844 AgentCircuitData acd = SceneHelpers.GenerateAgentData(ua1.PrincipalID);
845 TestClient tc = new TestClient(acd, sceneA); 845 TestClient tc = new TestClient(acd, sceneA);
846 List<TestClient> destinationTestClients = new List<TestClient>(); 846 List<TestClient> destinationTestClients = new List<TestClient>();
847 EntityTransferHelpers.SetUpInformClientOfNeighbour(tc, destinationTestClients); 847 EntityTransferHelpers.SetupInformClientOfNeighbourTriggersNeighbourClientCreate(tc, destinationTestClients);
848 848
849 ScenePresence beforeTeleportSp = SceneHelpers.AddScenePresence(sceneA, tc, acd); 849 ScenePresence beforeTeleportSp = SceneHelpers.AddScenePresence(sceneA, tc, acd);
850 beforeTeleportSp.AbsolutePosition = new Vector3(30, 31, 32); 850 beforeTeleportSp.AbsolutePosition = new Vector3(30, 31, 32);
@@ -943,7 +943,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
943 AgentCircuitData acd = SceneHelpers.GenerateAgentData(ua1.PrincipalID); 943 AgentCircuitData acd = SceneHelpers.GenerateAgentData(ua1.PrincipalID);
944 TestClient tc = new TestClient(acd, sceneA); 944 TestClient tc = new TestClient(acd, sceneA);
945 List<TestClient> destinationTestClients = new List<TestClient>(); 945 List<TestClient> destinationTestClients = new List<TestClient>();
946 EntityTransferHelpers.SetUpInformClientOfNeighbour(tc, destinationTestClients); 946 EntityTransferHelpers.SetupInformClientOfNeighbourTriggersNeighbourClientCreate(tc, destinationTestClients);
947 947
948 ScenePresence beforeTeleportSp = SceneHelpers.AddScenePresence(sceneA, tc, acd); 948 ScenePresence beforeTeleportSp = SceneHelpers.AddScenePresence(sceneA, tc, acd);
949 beforeTeleportSp.AbsolutePosition = new Vector3(30, 31, 32); 949 beforeTeleportSp.AbsolutePosition = new Vector3(30, 31, 32);
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs
index d670dad..5b5fb92 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs
@@ -147,7 +147,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
147 AgentCircuitData acd = SceneHelpers.GenerateAgentData(uaB); 147 AgentCircuitData acd = SceneHelpers.GenerateAgentData(uaB);
148 TestClient clientB = new TestClient(acd, sceneB); 148 TestClient clientB = new TestClient(acd, sceneB);
149 List<TestClient> childClientsB = new List<TestClient>(); 149 List<TestClient> childClientsB = new List<TestClient>();
150 EntityTransferHelpers.SetUpInformClientOfNeighbour(clientB, childClientsB); 150 EntityTransferHelpers.SetupInformClientOfNeighbourTriggersNeighbourClientCreate(clientB, childClientsB);
151 151
152 SceneHelpers.AddScenePresence(sceneB, clientB, acd); 152 SceneHelpers.AddScenePresence(sceneB, clientB, acd);
153 153
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceCrossingTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceCrossingTests.cs
index 5df9aba..12a778b 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceCrossingTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceCrossingTests.cs
@@ -97,7 +97,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
97 AgentCircuitData acd = SceneHelpers.GenerateAgentData(userId); 97 AgentCircuitData acd = SceneHelpers.GenerateAgentData(userId);
98 TestClient tc = new TestClient(acd, sceneA); 98 TestClient tc = new TestClient(acd, sceneA);
99 List<TestClient> destinationTestClients = new List<TestClient>(); 99 List<TestClient> destinationTestClients = new List<TestClient>();
100 EntityTransferHelpers.SetUpInformClientOfNeighbour(tc, destinationTestClients); 100 EntityTransferHelpers.SetupInformClientOfNeighbourTriggersNeighbourClientCreate(tc, destinationTestClients);
101 101
102 ScenePresence originalSp = SceneHelpers.AddScenePresence(sceneA, tc, acd); 102 ScenePresence originalSp = SceneHelpers.AddScenePresence(sceneA, tc, acd);
103 originalSp.AbsolutePosition = new Vector3(128, 32, 10); 103 originalSp.AbsolutePosition = new Vector3(128, 32, 10);
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs
index 936c2c0..8c25dbc 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs
@@ -147,7 +147,8 @@ namespace OpenSim.Region.Framework.Scenes.Tests
147 sp.AbsolutePosition = new Vector3(30, 31, 32); 147 sp.AbsolutePosition = new Vector3(30, 31, 32);
148 148
149 List<TestClient> destinationTestClients = new List<TestClient>(); 149 List<TestClient> destinationTestClients = new List<TestClient>();
150 EntityTransferHelpers.SetUpInformClientOfNeighbour((TestClient)sp.ControllingClient, destinationTestClients); 150 EntityTransferHelpers.SetupInformClientOfNeighbourTriggersNeighbourClientCreate(
151 (TestClient)sp.ControllingClient, destinationTestClients);
151 152
152 sceneA.RequestTeleportLocation( 153 sceneA.RequestTeleportLocation(
153 sp.ControllingClient, 154 sp.ControllingClient,
@@ -180,6 +181,67 @@ namespace OpenSim.Region.Framework.Scenes.Tests
180// Assert.That(sp.Lookat, Is.EqualTo(teleportLookAt)); 181// Assert.That(sp.Lookat, Is.EqualTo(teleportLookAt));
181 } 182 }
182 183
184 [Test]
185 public void TestSameSimulatorIsolatedRegionsV2()
186 {
187 TestHelpers.InMethod();
188// TestHelpers.EnableLogging();
189
190 UUID userId = TestHelpers.ParseTail(0x1);
191
192 EntityTransferModule etmA = new EntityTransferModule();
193 EntityTransferModule etmB = new EntityTransferModule();
194 LocalSimulationConnectorModule lscm = new LocalSimulationConnectorModule();
195
196 IConfigSource config = new IniConfigSource();
197 IConfig modulesConfig = config.AddConfig("Modules");
198 modulesConfig.Set("EntityTransferModule", etmA.Name);
199 modulesConfig.Set("SimulationServices", lscm.Name);
200
201 SceneHelpers sh = new SceneHelpers();
202 TestScene sceneA = sh.SetupScene("sceneA", TestHelpers.ParseTail(0x100), 1000, 1000);
203 TestScene sceneB = sh.SetupScene("sceneB", TestHelpers.ParseTail(0x200), 1002, 1000);
204
205 SceneHelpers.SetupSceneModules(sceneA, config, etmA);
206 SceneHelpers.SetupSceneModules(sceneB, config, etmB);
207 SceneHelpers.SetupSceneModules(new Scene[] { sceneA, sceneB }, config, lscm);
208
209 Vector3 teleportPosition = new Vector3(10, 11, 12);
210 Vector3 teleportLookAt = new Vector3(20, 21, 22);
211
212 ScenePresence sp = SceneHelpers.AddScenePresence(sceneA, userId);
213 sp.AbsolutePosition = new Vector3(30, 31, 32);
214
215 List<TestClient> destinationTestClients = new List<TestClient>();
216 EntityTransferHelpers.SetupSendRegionTeleportTriggersDestinationClientCreateAndCompleteMovement(
217 (TestClient)sp.ControllingClient, destinationTestClients);
218
219 sceneA.RequestTeleportLocation(
220 sp.ControllingClient,
221 sceneB.RegionInfo.RegionHandle,
222 teleportPosition,
223 teleportLookAt,
224 (uint)TeleportFlags.ViaLocation);
225
226 Assert.That(sceneA.GetScenePresence(userId), Is.Null);
227
228 ScenePresence sceneBSp = sceneB.GetScenePresence(userId);
229 Assert.That(sceneBSp, Is.Not.Null);
230 Assert.That(sceneBSp.Scene.RegionInfo.RegionName, Is.EqualTo(sceneB.RegionInfo.RegionName));
231 Assert.That(sceneBSp.AbsolutePosition, Is.EqualTo(teleportPosition));
232
233 Assert.That(sceneA.GetRootAgentCount(), Is.EqualTo(0));
234 Assert.That(sceneA.GetChildAgentCount(), Is.EqualTo(0));
235 Assert.That(sceneB.GetRootAgentCount(), Is.EqualTo(1));
236 Assert.That(sceneB.GetChildAgentCount(), Is.EqualTo(0));
237
238 // TODO: Add assertions to check correct circuit details in both scenes.
239
240 // Lookat is sent to the client only - sp.Lookat does not yield the same thing (calculation from camera
241 // position instead).
242// Assert.That(sp.Lookat, Is.EqualTo(teleportLookAt));
243 }
244
183 /// <summary> 245 /// <summary>
184 /// Test teleport procedures when the target simulator returns false when queried about access. 246 /// Test teleport procedures when the target simulator returns false when queried about access.
185 /// </summary> 247 /// </summary>
@@ -467,7 +529,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
467 AgentCircuitData acd = SceneHelpers.GenerateAgentData(userId); 529 AgentCircuitData acd = SceneHelpers.GenerateAgentData(userId);
468 TestClient tc = new TestClient(acd, sceneA); 530 TestClient tc = new TestClient(acd, sceneA);
469 List<TestClient> destinationTestClients = new List<TestClient>(); 531 List<TestClient> destinationTestClients = new List<TestClient>();
470 EntityTransferHelpers.SetUpInformClientOfNeighbour(tc, destinationTestClients); 532 EntityTransferHelpers.SetupInformClientOfNeighbourTriggersNeighbourClientCreate(tc, destinationTestClients);
471 533
472 ScenePresence beforeSceneASp = SceneHelpers.AddScenePresence(sceneA, tc, acd); 534 ScenePresence beforeSceneASp = SceneHelpers.AddScenePresence(sceneA, tc, acd);
473 beforeSceneASp.AbsolutePosition = new Vector3(30, 31, 32); 535 beforeSceneASp.AbsolutePosition = new Vector3(30, 31, 32);
@@ -545,7 +607,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
545 AgentCircuitData acd = SceneHelpers.GenerateAgentData(userId); 607 AgentCircuitData acd = SceneHelpers.GenerateAgentData(userId);
546 TestClient tc = new TestClient(acd, sceneA); 608 TestClient tc = new TestClient(acd, sceneA);
547 List<TestClient> destinationTestClients = new List<TestClient>(); 609 List<TestClient> destinationTestClients = new List<TestClient>();
548 EntityTransferHelpers.SetUpInformClientOfNeighbour(tc, destinationTestClients); 610 EntityTransferHelpers.SetupInformClientOfNeighbourTriggersNeighbourClientCreate(tc, destinationTestClients);
549 611
550 ScenePresence beforeSceneASp = SceneHelpers.AddScenePresence(sceneA, tc, acd); 612 ScenePresence beforeSceneASp = SceneHelpers.AddScenePresence(sceneA, tc, acd);
551 beforeSceneASp.AbsolutePosition = new Vector3(30, 31, 32); 613 beforeSceneASp.AbsolutePosition = new Vector3(30, 31, 32);
diff --git a/OpenSim/Tests/Common/Helpers/EntityTransferHelpers.cs b/OpenSim/Tests/Common/Helpers/EntityTransferHelpers.cs
index 1b960b1..ff6608d 100644
--- a/OpenSim/Tests/Common/Helpers/EntityTransferHelpers.cs
+++ b/OpenSim/Tests/Common/Helpers/EntityTransferHelpers.cs
@@ -31,6 +31,7 @@ using System.IO;
31using System.Net; 31using System.Net;
32using System.Reflection; 32using System.Reflection;
33using System.Text; 33using System.Text;
34using System.Threading;
34using log4net; 35using log4net;
35using Nini.Config; 36using Nini.Config;
36using NUnit.Framework; 37using NUnit.Framework;
@@ -59,7 +60,8 @@ namespace OpenSim.Tests.Common
59 /// A list that will be populated with any TestClients set up in response to 60 /// A list that will be populated with any TestClients set up in response to
60 /// being informed about a destination region. 61 /// being informed about a destination region.
61 /// </param> 62 /// </param>
62 public static void SetUpInformClientOfNeighbour(TestClient tc, List<TestClient> neighbourTcs) 63 public static void SetupInformClientOfNeighbourTriggersNeighbourClientCreate(
64 TestClient tc, List<TestClient> neighbourTcs)
63 { 65 {
64 // XXX: Confusingly, this is also used for non-neighbour notification (as in teleports that do not use the 66 // XXX: Confusingly, this is also used for non-neighbour notification (as in teleports that do not use the
65 // event queue). 67 // event queue).
@@ -75,8 +77,6 @@ namespace OpenSim.Tests.Common
75 "[TEST CLIENT]: Processing inform client of neighbour located at {0},{1} at {2}", 77 "[TEST CLIENT]: Processing inform client of neighbour located at {0},{1} at {2}",
76 x, y, neighbourExternalEndPoint); 78 x, y, neighbourExternalEndPoint);
77 79
78 // In response to this message, we are going to make a teleport to the scene we've previous been told
79 // about by test code (this needs to be improved).
80 AgentCircuitData newAgent = tc.RequestClientInfo(); 80 AgentCircuitData newAgent = tc.RequestClientInfo();
81 81
82 Scene neighbourScene; 82 Scene neighbourScene;
@@ -87,5 +87,42 @@ namespace OpenSim.Tests.Common
87 neighbourScene.AddNewClient(neighbourTc, PresenceType.User); 87 neighbourScene.AddNewClient(neighbourTc, PresenceType.User);
88 }; 88 };
89 } 89 }
90
91 /// <summary>
92 /// Set up correct handling of the InformClientOfNeighbour call from the source region that triggers the
93 /// viewer to setup a connection with the destination region.
94 /// </summary>
95 /// <param name='tc'></param>
96 /// <param name='neighbourTcs'>
97 /// A list that will be populated with any TestClients set up in response to
98 /// being informed about a destination region.
99 /// </param>
100 public static void SetupSendRegionTeleportTriggersDestinationClientCreateAndCompleteMovement(
101 TestClient client, List<TestClient> destinationClients)
102 {
103 client.OnTestClientSendRegionTeleport
104 += (regionHandle, simAccess, regionExternalEndPoint, locationID, flags, capsURL) =>
105 {
106 uint x, y;
107 Utils.LongToUInts(regionHandle, out x, out y);
108 x /= Constants.RegionSize;
109 y /= Constants.RegionSize;
110
111 m_log.DebugFormat(
112 "[TEST CLIENT]: Processing send region teleport for destination at {0},{1} at {2}",
113 x, y, regionExternalEndPoint);
114
115 AgentCircuitData newAgent = client.RequestClientInfo();
116
117 Scene destinationScene;
118 SceneManager.Instance.TryGetScene(x, y, out destinationScene);
119
120 TestClient destinationClient = new TestClient(newAgent, destinationScene);
121 destinationClients.Add(destinationClient);
122 destinationScene.AddNewClient(destinationClient, PresenceType.User);
123
124 ThreadPool.UnsafeQueueUserWorkItem(o => destinationClient.CompleteMovement(), null);
125 };
126 }
90 } 127 }
91} \ No newline at end of file 128} \ No newline at end of file