diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs | 302 |
1 files changed, 275 insertions, 27 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs index 8dd1f3d..443ec51 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs | |||
@@ -26,12 +26,15 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Reflection; | 29 | using System.Collections.Generic; |
30 | using System.IO; | ||
31 | using System.Net; | ||
32 | using System.Text; | ||
33 | using System.Threading; | ||
30 | using Nini.Config; | 34 | using Nini.Config; |
31 | using NUnit.Framework; | 35 | using NUnit.Framework; |
32 | using OpenMetaverse; | 36 | using OpenMetaverse; |
33 | using OpenSim.Framework; | 37 | using OpenSim.Framework; |
34 | using OpenSim.Framework.Communications; | ||
35 | using OpenSim.Framework.Servers; | 38 | using OpenSim.Framework.Servers; |
36 | using OpenSim.Region.Framework.Interfaces; | 39 | using OpenSim.Region.Framework.Interfaces; |
37 | using OpenSim.Region.CoreModules.Framework; | 40 | using OpenSim.Region.CoreModules.Framework; |
@@ -39,9 +42,6 @@ using OpenSim.Region.CoreModules.Framework.EntityTransfer; | |||
39 | using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; | 42 | using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; |
40 | using OpenSim.Region.CoreModules.World.Permissions; | 43 | using OpenSim.Region.CoreModules.World.Permissions; |
41 | using OpenSim.Tests.Common; | 44 | using OpenSim.Tests.Common; |
42 | using OpenSim.Tests.Common.Mock; | ||
43 | using System.IO; | ||
44 | using System.Text; | ||
45 | 45 | ||
46 | namespace OpenSim.Region.Framework.Scenes.Tests | 46 | namespace OpenSim.Region.Framework.Scenes.Tests |
47 | { | 47 | { |
@@ -68,7 +68,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
68 | } | 68 | } |
69 | 69 | ||
70 | [Test] | 70 | [Test] |
71 | public void TestSameRegionTeleport() | 71 | public void TestSameRegion() |
72 | { | 72 | { |
73 | TestHelpers.InMethod(); | 73 | TestHelpers.InMethod(); |
74 | // log4net.Config.XmlConfigurator.Configure(); | 74 | // log4net.Config.XmlConfigurator.Configure(); |
@@ -105,11 +105,12 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
105 | // Assert.That(sp.Lookat, Is.EqualTo(teleportLookAt)); | 105 | // Assert.That(sp.Lookat, Is.EqualTo(teleportLookAt)); |
106 | } | 106 | } |
107 | 107 | ||
108 | /* | ||
108 | [Test] | 109 | [Test] |
109 | public void TestSameSimulatorSeparatedRegionsTeleport() | 110 | public void TestSameSimulatorIsolatedRegionsV1() |
110 | { | 111 | { |
111 | TestHelpers.InMethod(); | 112 | TestHelpers.InMethod(); |
112 | // log4net.Config.XmlConfigurator.Configure(); | 113 | // TestHelpers.EnableLogging(); |
113 | 114 | ||
114 | UUID userId = TestHelpers.ParseTail(0x1); | 115 | UUID userId = TestHelpers.ParseTail(0x1); |
115 | 116 | ||
@@ -135,15 +136,18 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
135 | SceneHelpers.SetupSceneModules(sceneB, config, etmB); | 136 | SceneHelpers.SetupSceneModules(sceneB, config, etmB); |
136 | SceneHelpers.SetupSceneModules(new Scene[] { sceneA, sceneB }, config, lscm); | 137 | SceneHelpers.SetupSceneModules(new Scene[] { sceneA, sceneB }, config, lscm); |
137 | 138 | ||
139 | // FIXME: Hack - this is here temporarily to revert back to older entity transfer behaviour | ||
140 | lscm.ServiceVersion = 0.1f; | ||
141 | |||
138 | Vector3 teleportPosition = new Vector3(10, 11, 12); | 142 | Vector3 teleportPosition = new Vector3(10, 11, 12); |
139 | Vector3 teleportLookAt = new Vector3(20, 21, 22); | 143 | Vector3 teleportLookAt = new Vector3(20, 21, 22); |
140 | 144 | ||
141 | ScenePresence sp = SceneHelpers.AddScenePresence(sceneA, userId, sh.SceneManager); | 145 | ScenePresence sp = SceneHelpers.AddScenePresence(sceneA, userId); |
142 | sp.AbsolutePosition = new Vector3(30, 31, 32); | 146 | sp.AbsolutePosition = new Vector3(30, 31, 32); |
143 | 147 | ||
144 | // XXX: A very nasty hack to tell the client about the destination scene without having to crank the whole | 148 | List<TestClient> destinationTestClients = new List<TestClient>(); |
145 | // UDP stack (?) | 149 | EntityTransferHelpers.SetupInformClientOfNeighbourTriggersNeighbourClientCreate( |
146 | // ((TestClient)sp.ControllingClient).TeleportTargetScene = sceneB; | 150 | (TestClient)sp.ControllingClient, destinationTestClients); |
147 | 151 | ||
148 | sceneA.RequestTeleportLocation( | 152 | sceneA.RequestTeleportLocation( |
149 | sp.ControllingClient, | 153 | sp.ControllingClient, |
@@ -152,7 +156,72 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
152 | teleportLookAt, | 156 | teleportLookAt, |
153 | (uint)TeleportFlags.ViaLocation); | 157 | (uint)TeleportFlags.ViaLocation); |
154 | 158 | ||
155 | ((TestClient)sp.ControllingClient).CompleteTeleportClientSide(); | 159 | // SetupInformClientOfNeighbour() will have handled the callback into the target scene to setup the child |
160 | // agent. This call will now complete the movement of the user into the destination and upgrade the agent | ||
161 | // from child to root. | ||
162 | destinationTestClients[0].CompleteMovement(); | ||
163 | |||
164 | Assert.That(sceneA.GetScenePresence(userId), Is.Null); | ||
165 | |||
166 | ScenePresence sceneBSp = sceneB.GetScenePresence(userId); | ||
167 | Assert.That(sceneBSp, Is.Not.Null); | ||
168 | Assert.That(sceneBSp.Scene.RegionInfo.RegionName, Is.EqualTo(sceneB.RegionInfo.RegionName)); | ||
169 | Assert.That(sceneBSp.AbsolutePosition, Is.EqualTo(teleportPosition)); | ||
170 | |||
171 | Assert.That(sceneA.GetRootAgentCount(), Is.EqualTo(0)); | ||
172 | Assert.That(sceneA.GetChildAgentCount(), Is.EqualTo(0)); | ||
173 | Assert.That(sceneB.GetRootAgentCount(), Is.EqualTo(1)); | ||
174 | Assert.That(sceneB.GetChildAgentCount(), Is.EqualTo(0)); | ||
175 | |||
176 | // TODO: Add assertions to check correct circuit details in both scenes. | ||
177 | |||
178 | // Lookat is sent to the client only - sp.Lookat does not yield the same thing (calculation from camera | ||
179 | // position instead). | ||
180 | // Assert.That(sp.Lookat, Is.EqualTo(teleportLookAt)); | ||
181 | } | ||
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); | ||
156 | 225 | ||
157 | Assert.That(sceneA.GetScenePresence(userId), Is.Null); | 226 | Assert.That(sceneA.GetScenePresence(userId), Is.Null); |
158 | 227 | ||
@@ -177,7 +246,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
177 | /// 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. |
178 | /// </summary> | 247 | /// </summary> |
179 | [Test] | 248 | [Test] |
180 | public void TestSameSimulatorSeparatedRegionsQueryAccessFails() | 249 | public void TestSameSimulatorIsolatedRegions_DeniedOnQueryAccess() |
181 | { | 250 | { |
182 | TestHelpers.InMethod(); | 251 | TestHelpers.InMethod(); |
183 | // TestHelpers.EnableLogging(); | 252 | // TestHelpers.EnableLogging(); |
@@ -221,7 +290,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
221 | Vector3 teleportPosition = new Vector3(10, 11, 12); | 290 | Vector3 teleportPosition = new Vector3(10, 11, 12); |
222 | Vector3 teleportLookAt = new Vector3(20, 21, 22); | 291 | Vector3 teleportLookAt = new Vector3(20, 21, 22); |
223 | 292 | ||
224 | ScenePresence sp = SceneHelpers.AddScenePresence(sceneA, userId, sh.SceneManager); | 293 | ScenePresence sp = SceneHelpers.AddScenePresence(sceneA, userId); |
225 | sp.AbsolutePosition = preTeleportPosition; | 294 | sp.AbsolutePosition = preTeleportPosition; |
226 | 295 | ||
227 | // Make sceneB return false on query access | 296 | // Make sceneB return false on query access |
@@ -261,7 +330,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
261 | /// Test teleport procedures when the target simulator create agent step is refused. | 330 | /// Test teleport procedures when the target simulator create agent step is refused. |
262 | /// </summary> | 331 | /// </summary> |
263 | [Test] | 332 | [Test] |
264 | public void TestSameSimulatorSeparatedRegionsCreateAgentFails() | 333 | public void TestSameSimulatorIsolatedRegions_DeniedOnCreateAgent() |
265 | { | 334 | { |
266 | TestHelpers.InMethod(); | 335 | TestHelpers.InMethod(); |
267 | // TestHelpers.EnableLogging(); | 336 | // TestHelpers.EnableLogging(); |
@@ -297,7 +366,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
297 | Vector3 teleportPosition = new Vector3(10, 11, 12); | 366 | Vector3 teleportPosition = new Vector3(10, 11, 12); |
298 | Vector3 teleportLookAt = new Vector3(20, 21, 22); | 367 | Vector3 teleportLookAt = new Vector3(20, 21, 22); |
299 | 368 | ||
300 | ScenePresence sp = SceneHelpers.AddScenePresence(sceneA, userId, sh.SceneManager); | 369 | ScenePresence sp = SceneHelpers.AddScenePresence(sceneA, userId); |
301 | sp.AbsolutePosition = preTeleportPosition; | 370 | sp.AbsolutePosition = preTeleportPosition; |
302 | 371 | ||
303 | // Make sceneB refuse CreateAgent | 372 | // Make sceneB refuse CreateAgent |
@@ -333,8 +402,97 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
333 | // TestHelpers.DisableLogging(); | 402 | // TestHelpers.DisableLogging(); |
334 | } | 403 | } |
335 | 404 | ||
405 | /// <summary> | ||
406 | /// Test teleport when the destination region does not process (or does not receive) the connection attempt | ||
407 | /// from the viewer. | ||
408 | /// </summary> | ||
409 | /// <remarks> | ||
410 | /// This could be quite a common case where the source region can connect to a remove destination region | ||
411 | /// (for CreateAgent) but the viewer cannot reach the destination region due to network issues. | ||
412 | /// </remarks> | ||
336 | [Test] | 413 | [Test] |
337 | public void TestSameSimulatorNeighbouringRegionsTeleport() | 414 | public void TestSameSimulatorIsolatedRegions_DestinationDidNotProcessViewerConnection() |
415 | { | ||
416 | TestHelpers.InMethod(); | ||
417 | // TestHelpers.EnableLogging(); | ||
418 | |||
419 | UUID userId = TestHelpers.ParseTail(0x1); | ||
420 | Vector3 preTeleportPosition = new Vector3(30, 31, 32); | ||
421 | |||
422 | EntityTransferModule etmA = new EntityTransferModule(); | ||
423 | EntityTransferModule etmB = new EntityTransferModule(); | ||
424 | |||
425 | LocalSimulationConnectorModule lscm = new LocalSimulationConnectorModule(); | ||
426 | |||
427 | IConfigSource config = new IniConfigSource(); | ||
428 | config.AddConfig("Modules"); | ||
429 | config.Configs["Modules"].Set("EntityTransferModule", etmA.Name); | ||
430 | config.Configs["Modules"].Set("SimulationServices", lscm.Name); | ||
431 | |||
432 | config.AddConfig("EntityTransfer"); | ||
433 | |||
434 | // In order to run a single threaded regression test we do not want the entity transfer module waiting | ||
435 | // for a callback from the destination scene before removing its avatar data. | ||
436 | config.Configs["EntityTransfer"].Set("wait_for_callback", false); | ||
437 | |||
438 | // config.AddConfig("Startup"); | ||
439 | // config.Configs["Startup"].Set("serverside_object_permissions", true); | ||
440 | |||
441 | SceneHelpers sh = new SceneHelpers(); | ||
442 | TestScene sceneA = sh.SetupScene("sceneA", TestHelpers.ParseTail(0x100), 1000, 1000); | ||
443 | TestScene sceneB = sh.SetupScene("sceneB", TestHelpers.ParseTail(0x200), 1002, 1000); | ||
444 | |||
445 | SceneHelpers.SetupSceneModules(sceneA, config, etmA ); | ||
446 | |||
447 | // We need to set up the permisions module on scene B so that our later use of agent limit to deny | ||
448 | // QueryAccess won't succeed anyway because administrators are always allowed in and the default | ||
449 | // IsAdministrator if no permissions module is present is true. | ||
450 | SceneHelpers.SetupSceneModules(sceneB, config, new object[] { new PermissionsModule(), etmB }); | ||
451 | |||
452 | // Shared scene modules | ||
453 | SceneHelpers.SetupSceneModules(new Scene[] { sceneA, sceneB }, config, lscm); | ||
454 | |||
455 | Vector3 teleportPosition = new Vector3(10, 11, 12); | ||
456 | Vector3 teleportLookAt = new Vector3(20, 21, 22); | ||
457 | |||
458 | ScenePresence sp = SceneHelpers.AddScenePresence(sceneA, userId); | ||
459 | sp.AbsolutePosition = preTeleportPosition; | ||
460 | |||
461 | sceneA.RequestTeleportLocation( | ||
462 | sp.ControllingClient, | ||
463 | sceneB.RegionInfo.RegionHandle, | ||
464 | teleportPosition, | ||
465 | teleportLookAt, | ||
466 | (uint)TeleportFlags.ViaLocation); | ||
467 | |||
468 | // FIXME: Not setting up InformClientOfNeighbour on the TestClient means that it does not initiate | ||
469 | // communication with the destination region. But this is a very non-obvious way of doing it - really we | ||
470 | // should be forced to expicitly set this up. | ||
471 | |||
472 | Assert.That(sceneB.GetScenePresence(userId), Is.Null); | ||
473 | |||
474 | ScenePresence sceneASp = sceneA.GetScenePresence(userId); | ||
475 | Assert.That(sceneASp, Is.Not.Null); | ||
476 | Assert.That(sceneASp.Scene.RegionInfo.RegionName, Is.EqualTo(sceneA.RegionInfo.RegionName)); | ||
477 | Assert.That(sceneASp.AbsolutePosition, Is.EqualTo(preTeleportPosition)); | ||
478 | |||
479 | Assert.That(sceneA.GetRootAgentCount(), Is.EqualTo(1)); | ||
480 | Assert.That(sceneA.GetChildAgentCount(), Is.EqualTo(0)); | ||
481 | Assert.That(sceneB.GetRootAgentCount(), Is.EqualTo(0)); | ||
482 | Assert.That(sceneB.GetChildAgentCount(), Is.EqualTo(0)); | ||
483 | |||
484 | // TODO: Add assertions to check correct circuit details in both scenes. | ||
485 | |||
486 | // Lookat is sent to the client only - sp.Lookat does not yield the same thing (calculation from camera | ||
487 | // position instead). | ||
488 | // Assert.That(sp.Lookat, Is.EqualTo(teleportLookAt)); | ||
489 | |||
490 | // TestHelpers.DisableLogging(); | ||
491 | } | ||
492 | |||
493 | /* | ||
494 | [Test] | ||
495 | public void TestSameSimulatorNeighbouringRegionsV1() | ||
338 | { | 496 | { |
339 | TestHelpers.InMethod(); | 497 | TestHelpers.InMethod(); |
340 | // TestHelpers.EnableLogging(); | 498 | // TestHelpers.EnableLogging(); |
@@ -363,13 +521,20 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
363 | SceneHelpers.SetupSceneModules(sceneA, config, new CapabilitiesModule(), etmA); | 521 | SceneHelpers.SetupSceneModules(sceneA, config, new CapabilitiesModule(), etmA); |
364 | SceneHelpers.SetupSceneModules(sceneB, config, new CapabilitiesModule(), etmB); | 522 | SceneHelpers.SetupSceneModules(sceneB, config, new CapabilitiesModule(), etmB); |
365 | 523 | ||
524 | // FIXME: Hack - this is here temporarily to revert back to older entity transfer behaviour | ||
525 | lscm.ServiceVersion = 0.1f; | ||
526 | |||
366 | Vector3 teleportPosition = new Vector3(10, 11, 12); | 527 | Vector3 teleportPosition = new Vector3(10, 11, 12); |
367 | Vector3 teleportLookAt = new Vector3(20, 21, 22); | 528 | Vector3 teleportLookAt = new Vector3(20, 21, 22); |
368 | 529 | ||
369 | ScenePresence originalSp = SceneHelpers.AddScenePresence(sceneA, userId, sh.SceneManager); | 530 | AgentCircuitData acd = SceneHelpers.GenerateAgentData(userId); |
370 | originalSp.AbsolutePosition = new Vector3(30, 31, 32); | 531 | TestClient tc = new TestClient(acd, sceneA); |
532 | List<TestClient> destinationTestClients = new List<TestClient>(); | ||
533 | EntityTransferHelpers.SetupInformClientOfNeighbourTriggersNeighbourClientCreate(tc, destinationTestClients); | ||
534 | |||
535 | ScenePresence beforeSceneASp = SceneHelpers.AddScenePresence(sceneA, tc, acd); | ||
536 | beforeSceneASp.AbsolutePosition = new Vector3(30, 31, 32); | ||
371 | 537 | ||
372 | ScenePresence beforeSceneASp = sceneA.GetScenePresence(userId); | ||
373 | Assert.That(beforeSceneASp, Is.Not.Null); | 538 | Assert.That(beforeSceneASp, Is.Not.Null); |
374 | Assert.That(beforeSceneASp.IsChildAgent, Is.False); | 539 | Assert.That(beforeSceneASp.IsChildAgent, Is.False); |
375 | 540 | ||
@@ -377,10 +542,8 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
377 | Assert.That(beforeSceneBSp, Is.Not.Null); | 542 | Assert.That(beforeSceneBSp, Is.Not.Null); |
378 | Assert.That(beforeSceneBSp.IsChildAgent, Is.True); | 543 | Assert.That(beforeSceneBSp.IsChildAgent, Is.True); |
379 | 544 | ||
380 | // XXX: A very nasty hack to tell the client about the destination scene without having to crank the whole | 545 | // In this case, we will not receieve a second InformClientOfNeighbour since the viewer already knows |
381 | // UDP stack (?) | 546 | // about the neighbour region it is teleporting to. |
382 | // ((TestClient)beforeSceneASp.ControllingClient).TeleportTargetScene = sceneB; | ||
383 | |||
384 | sceneA.RequestTeleportLocation( | 547 | sceneA.RequestTeleportLocation( |
385 | beforeSceneASp.ControllingClient, | 548 | beforeSceneASp.ControllingClient, |
386 | sceneB.RegionInfo.RegionHandle, | 549 | sceneB.RegionInfo.RegionHandle, |
@@ -388,7 +551,92 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
388 | teleportLookAt, | 551 | teleportLookAt, |
389 | (uint)TeleportFlags.ViaLocation); | 552 | (uint)TeleportFlags.ViaLocation); |
390 | 553 | ||
391 | ((TestClient)beforeSceneASp.ControllingClient).CompleteTeleportClientSide(); | 554 | destinationTestClients[0].CompleteMovement(); |
555 | |||
556 | ScenePresence afterSceneASp = sceneA.GetScenePresence(userId); | ||
557 | Assert.That(afterSceneASp, Is.Not.Null); | ||
558 | Assert.That(afterSceneASp.IsChildAgent, Is.True); | ||
559 | |||
560 | ScenePresence afterSceneBSp = sceneB.GetScenePresence(userId); | ||
561 | Assert.That(afterSceneBSp, Is.Not.Null); | ||
562 | Assert.That(afterSceneBSp.IsChildAgent, Is.False); | ||
563 | Assert.That(afterSceneBSp.Scene.RegionInfo.RegionName, Is.EqualTo(sceneB.RegionInfo.RegionName)); | ||
564 | Assert.That(afterSceneBSp.AbsolutePosition, Is.EqualTo(teleportPosition)); | ||
565 | |||
566 | Assert.That(sceneA.GetRootAgentCount(), Is.EqualTo(0)); | ||
567 | Assert.That(sceneA.GetChildAgentCount(), Is.EqualTo(1)); | ||
568 | Assert.That(sceneB.GetRootAgentCount(), Is.EqualTo(1)); | ||
569 | Assert.That(sceneB.GetChildAgentCount(), Is.EqualTo(0)); | ||
570 | |||
571 | // TODO: Add assertions to check correct circuit details in both scenes. | ||
572 | |||
573 | // Lookat is sent to the client only - sp.Lookat does not yield the same thing (calculation from camera | ||
574 | // position instead). | ||
575 | // Assert.That(sp.Lookat, Is.EqualTo(teleportLookAt)); | ||
576 | |||
577 | // TestHelpers.DisableLogging(); | ||
578 | } | ||
579 | */ | ||
580 | |||
581 | [Test] | ||
582 | public void TestSameSimulatorNeighbouringRegionsV2() | ||
583 | { | ||
584 | TestHelpers.InMethod(); | ||
585 | // TestHelpers.EnableLogging(); | ||
586 | |||
587 | UUID userId = TestHelpers.ParseTail(0x1); | ||
588 | |||
589 | EntityTransferModule etmA = new EntityTransferModule(); | ||
590 | EntityTransferModule etmB = new EntityTransferModule(); | ||
591 | LocalSimulationConnectorModule lscm = new LocalSimulationConnectorModule(); | ||
592 | |||
593 | IConfigSource config = new IniConfigSource(); | ||
594 | IConfig modulesConfig = config.AddConfig("Modules"); | ||
595 | modulesConfig.Set("EntityTransferModule", etmA.Name); | ||
596 | modulesConfig.Set("SimulationServices", lscm.Name); | ||
597 | |||
598 | SceneHelpers sh = new SceneHelpers(); | ||
599 | TestScene sceneA = sh.SetupScene("sceneA", TestHelpers.ParseTail(0x100), 1000, 1000); | ||
600 | TestScene sceneB = sh.SetupScene("sceneB", TestHelpers.ParseTail(0x200), 1001, 1000); | ||
601 | |||
602 | SceneHelpers.SetupSceneModules(new Scene[] { sceneA, sceneB }, config, lscm); | ||
603 | SceneHelpers.SetupSceneModules(sceneA, config, new CapabilitiesModule(), etmA); | ||
604 | SceneHelpers.SetupSceneModules(sceneB, config, new CapabilitiesModule(), etmB); | ||
605 | |||
606 | Vector3 teleportPosition = new Vector3(10, 11, 12); | ||
607 | Vector3 teleportLookAt = new Vector3(20, 21, 22); | ||
608 | |||
609 | AgentCircuitData acd = SceneHelpers.GenerateAgentData(userId); | ||
610 | TestClient tc = new TestClient(acd, sceneA); | ||
611 | List<TestClient> destinationTestClients = new List<TestClient>(); | ||
612 | EntityTransferHelpers.SetupInformClientOfNeighbourTriggersNeighbourClientCreate(tc, destinationTestClients); | ||
613 | |||
614 | ScenePresence beforeSceneASp = SceneHelpers.AddScenePresence(sceneA, tc, acd); | ||
615 | beforeSceneASp.AbsolutePosition = new Vector3(30, 31, 32); | ||
616 | |||
617 | Assert.That(beforeSceneASp, Is.Not.Null); | ||
618 | Assert.That(beforeSceneASp.IsChildAgent, Is.False); | ||
619 | |||
620 | ScenePresence beforeSceneBSp = sceneB.GetScenePresence(userId); | ||
621 | Assert.That(beforeSceneBSp, Is.Not.Null); | ||
622 | Assert.That(beforeSceneBSp.IsChildAgent, Is.True); | ||
623 | |||
624 | // Here, we need to make clientA's receipt of SendRegionTeleport trigger clientB's CompleteMovement(). This | ||
625 | // is to operate the teleport V2 mechanism where the EntityTransferModule will first request the client to | ||
626 | // CompleteMovement to the region and then call UpdateAgent to the destination region to confirm the receipt | ||
627 | // Both these operations will occur on different threads and will wait for each other. | ||
628 | // We have to do this via ThreadPool directly since FireAndForget has been switched to sync for the V1 | ||
629 | // test protocol, where we are trying to avoid unpredictable async operations in regression tests. | ||
630 | tc.OnTestClientSendRegionTeleport | ||
631 | += (regionHandle, simAccess, regionExternalEndPoint, locationID, flags, capsURL) | ||
632 | => ThreadPool.UnsafeQueueUserWorkItem(o => destinationTestClients[0].CompleteMovement(), null); | ||
633 | |||
634 | sceneA.RequestTeleportLocation( | ||
635 | beforeSceneASp.ControllingClient, | ||
636 | sceneB.RegionInfo.RegionHandle, | ||
637 | teleportPosition, | ||
638 | teleportLookAt, | ||
639 | (uint)TeleportFlags.ViaLocation); | ||
392 | 640 | ||
393 | ScenePresence afterSceneASp = sceneA.GetScenePresence(userId); | 641 | ScenePresence afterSceneASp = sceneA.GetScenePresence(userId); |
394 | Assert.That(afterSceneASp, Is.Not.Null); | 642 | Assert.That(afterSceneASp, Is.Not.Null); |
@@ -414,4 +662,4 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
414 | // TestHelpers.DisableLogging(); | 662 | // TestHelpers.DisableLogging(); |
415 | } | 663 | } |
416 | } | 664 | } |
417 | } \ No newline at end of file | 665 | } |