diff options
Diffstat (limited to 'OpenSim/Region')
4 files changed, 150 insertions, 40 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs index 4cd03da..c8c594d 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs | |||
@@ -829,7 +829,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
829 | sceneB, config, new CapabilitiesModule(), etmB, attModB, new BasicInventoryAccessModule()); | 829 | sceneB, config, new CapabilitiesModule(), etmB, attModB, new BasicInventoryAccessModule()); |
830 | 830 | ||
831 | UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(sceneA, 0x1); | 831 | UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(sceneA, 0x1); |
832 | ScenePresence beforeTeleportSp = SceneHelpers.AddScenePresence(sceneA, ua1.PrincipalID, sh.SceneManager); | 832 | |
833 | AgentCircuitData acd = SceneHelpers.GenerateAgentData(ua1.PrincipalID); | ||
834 | TestClient tc = new TestClient(acd, sceneA, sh.SceneManager); | ||
835 | List<TestClient> destinationTestClients = new List<TestClient>(); | ||
836 | EntityTransferHelpers.SetUpInformClientOfNeighbour(tc, destinationTestClients); | ||
837 | |||
838 | ScenePresence beforeTeleportSp = SceneHelpers.AddScenePresence(sceneA, tc, acd, sh.SceneManager); | ||
833 | beforeTeleportSp.AbsolutePosition = new Vector3(30, 31, 32); | 839 | beforeTeleportSp.AbsolutePosition = new Vector3(30, 31, 32); |
834 | 840 | ||
835 | InventoryItemBase attItem = CreateAttachmentItem(sceneA, ua1.PrincipalID, "att", 0x10, 0x20); | 841 | InventoryItemBase attItem = CreateAttachmentItem(sceneA, ua1.PrincipalID, "att", 0x10, 0x20); |
@@ -848,7 +854,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
848 | teleportLookAt, | 854 | teleportLookAt, |
849 | (uint)TeleportFlags.ViaLocation); | 855 | (uint)TeleportFlags.ViaLocation); |
850 | 856 | ||
851 | ((TestClient)beforeTeleportSp.ControllingClient).CompleteTeleportClientSide(); | 857 | destinationTestClients[0].CompleteMovement(); |
852 | 858 | ||
853 | // Check attachments have made it into sceneB | 859 | // Check attachments have made it into sceneB |
854 | ScenePresence afterTeleportSceneBSp = sceneB.GetScenePresence(ua1.PrincipalID); | 860 | ScenePresence afterTeleportSceneBSp = sceneB.GetScenePresence(ua1.PrincipalID); |
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 9b1b69a..58a6654 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | |||
@@ -517,12 +517,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
517 | "[ENTITY TRANSFER MODULE]: Failed validation of all attachments for teleport of {0} from {1} to {2}. Continuing.", | 517 | "[ENTITY TRANSFER MODULE]: Failed validation of all attachments for teleport of {0} from {1} to {2}. Continuing.", |
518 | sp.Name, sp.Scene.RegionInfo.RegionName, finalDestination.RegionName); | 518 | sp.Name, sp.Scene.RegionInfo.RegionName, finalDestination.RegionName); |
519 | 519 | ||
520 | // if (!sp.ValidateAttachments()) | ||
521 | // { | ||
522 | // sp.ControllingClient.SendTeleportFailed("Inconsistent attachment state"); | ||
523 | // return; | ||
524 | // } | ||
525 | |||
526 | string reason; | 520 | string reason; |
527 | string version; | 521 | string version; |
528 | if (!Scene.SimulationService.QueryAccess( | 522 | if (!Scene.SimulationService.QueryAccess( |
@@ -583,6 +577,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
583 | } | 577 | } |
584 | 578 | ||
585 | // Let's create an agent there if one doesn't exist yet. | 579 | // Let's create an agent there if one doesn't exist yet. |
580 | // NOTE: logout will always be false for a non-HG teleport. | ||
586 | bool logout = false; | 581 | bool logout = false; |
587 | if (!CreateAgent(sp, reg, finalDestination, agentCircuit, teleportFlags, out reason, out logout)) | 582 | if (!CreateAgent(sp, reg, finalDestination, agentCircuit, teleportFlags, out reason, out logout)) |
588 | { | 583 | { |
@@ -625,11 +620,13 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
625 | 620 | ||
626 | if (m_eqModule != null) | 621 | if (m_eqModule != null) |
627 | { | 622 | { |
623 | // The EnableSimulator message makes the client establish a connection with the destination | ||
624 | // simulator by sending the initial UseCircuitCode UDP packet to the destination containing the | ||
625 | // correct circuit code. | ||
628 | m_eqModule.EnableSimulator(destinationHandle, endPoint, sp.UUID); | 626 | m_eqModule.EnableSimulator(destinationHandle, endPoint, sp.UUID); |
629 | 627 | ||
630 | // ES makes the client send a UseCircuitCode message to the destination, | 628 | // XXX: Is this wait necessary? We will always end up waiting on UpdateAgent for the destination |
631 | // which triggers a bunch of things there. | 629 | // simulator to confirm that it has established communication with the viewer. |
632 | // So let's wait | ||
633 | Thread.Sleep(200); | 630 | Thread.Sleep(200); |
634 | 631 | ||
635 | // At least on LL 3.3.4 for teleports between different regions on the same simulator this appears | 632 | // At least on LL 3.3.4 for teleports between different regions on the same simulator this appears |
@@ -640,6 +637,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
640 | } | 637 | } |
641 | else | 638 | else |
642 | { | 639 | { |
640 | // XXX: This is a little misleading since we're information the client of its avatar destination, | ||
641 | // which may or may not be a neighbour region of the source region. This path is probably little | ||
642 | // used anyway (with EQ being the one used). But it is currently being used for test code. | ||
643 | sp.ControllingClient.InformClientOfNeighbour(destinationHandle, endPoint); | 643 | sp.ControllingClient.InformClientOfNeighbour(destinationHandle, endPoint); |
644 | } | 644 | } |
645 | } | 645 | } |
@@ -657,14 +657,17 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
657 | 657 | ||
658 | //sp.ControllingClient.SendTeleportProgress(teleportFlags, "Updating agent..."); | 658 | //sp.ControllingClient.SendTeleportProgress(teleportFlags, "Updating agent..."); |
659 | 659 | ||
660 | // A common teleport failure occurs when we can send CreateAgent to the | ||
661 | // destination region but the viewer cannot establish the connection (e.g. due to network issues between | ||
662 | // the viewer and the destination). In this case, UpdateAgent timesout after 10 seconds, although then | ||
663 | // there's a further 10 second wait whilst we attempt to tell the destination to delete the agent in Fail(). | ||
660 | if (!UpdateAgent(reg, finalDestination, agent, sp)) | 664 | if (!UpdateAgent(reg, finalDestination, agent, sp)) |
661 | { | 665 | { |
662 | // Region doesn't take it | ||
663 | m_log.WarnFormat( | 666 | m_log.WarnFormat( |
664 | "[ENTITY TRANSFER MODULE]: UpdateAgent failed on teleport of {0} to {1} from {2}. Returning avatar to source region.", | 667 | "[ENTITY TRANSFER MODULE]: UpdateAgent failed on teleport of {0} to {1} from {2}. Keeping avatar in source region.", |
665 | sp.Name, finalDestination.RegionName, sp.Scene.RegionInfo.RegionName); | 668 | sp.Name, finalDestination.RegionName, sp.Scene.RegionInfo.RegionName); |
666 | 669 | ||
667 | Fail(sp, finalDestination, logout); | 670 | Fail(sp, finalDestination, logout, "Connection between viewer and destination region could not be established."); |
668 | return; | 671 | return; |
669 | } | 672 | } |
670 | 673 | ||
@@ -705,7 +708,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
705 | "[ENTITY TRANSFER MODULE]: Teleport of {0} to {1} from {2} failed due to no callback from destination region. Returning avatar to source region.", | 708 | "[ENTITY TRANSFER MODULE]: Teleport of {0} to {1} from {2} failed due to no callback from destination region. Returning avatar to source region.", |
706 | sp.Name, finalDestination.RegionName, sp.Scene.RegionInfo.RegionName); | 709 | sp.Name, finalDestination.RegionName, sp.Scene.RegionInfo.RegionName); |
707 | 710 | ||
708 | Fail(sp, finalDestination, logout); | 711 | Fail(sp, finalDestination, logout, "Destination region did not signal teleport completion."); |
709 | return; | 712 | return; |
710 | } | 713 | } |
711 | 714 | ||
@@ -788,12 +791,15 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
788 | /// <param name='sp'></param> | 791 | /// <param name='sp'></param> |
789 | /// <param name='finalDestination'></param> | 792 | /// <param name='finalDestination'></param> |
790 | /// <param name='logout'></param> | 793 | /// <param name='logout'></param> |
791 | protected virtual void Fail(ScenePresence sp, GridRegion finalDestination, bool logout) | 794 | /// <param name='reason'>Human readable reason for teleport failure. Will be sent to client.</param> |
795 | protected virtual void Fail(ScenePresence sp, GridRegion finalDestination, bool logout, string reason) | ||
792 | { | 796 | { |
793 | CleanupAbortedInterRegionTeleport(sp, finalDestination); | 797 | CleanupAbortedInterRegionTeleport(sp, finalDestination); |
794 | 798 | ||
795 | sp.ControllingClient.SendTeleportFailed( | 799 | sp.ControllingClient.SendTeleportFailed( |
796 | string.Format("Problems connecting to destination {0}", finalDestination.RegionName)); | 800 | string.Format( |
801 | "Problems connecting to destination {0}, reason: {1}", finalDestination.RegionName, reason)); | ||
802 | |||
797 | sp.Scene.EventManager.TriggerTeleportFail(sp.ControllingClient, logout); | 803 | sp.Scene.EventManager.TriggerTeleportFail(sp.ControllingClient, logout); |
798 | } | 804 | } |
799 | 805 | ||
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceCrossingTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceCrossingTests.cs index 81a2fcc..b67b8b9 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceCrossingTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceCrossingTests.cs | |||
@@ -66,7 +66,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
66 | public void TestCrossOnSameSimulator() | 66 | public void TestCrossOnSameSimulator() |
67 | { | 67 | { |
68 | TestHelpers.InMethod(); | 68 | TestHelpers.InMethod(); |
69 | // TestHelpers.EnableLogging(); | 69 | TestHelpers.EnableLogging(); |
70 | 70 | ||
71 | UUID userId = TestHelpers.ParseTail(0x1); | 71 | UUID userId = TestHelpers.ParseTail(0x1); |
72 | 72 | ||
@@ -94,7 +94,12 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
94 | // SceneHelpers.SetupSceneModules(sceneA, config, new CapabilitiesModule(), etmA, eqmA); | 94 | // SceneHelpers.SetupSceneModules(sceneA, config, new CapabilitiesModule(), etmA, eqmA); |
95 | SceneHelpers.SetupSceneModules(sceneB, config, new CapabilitiesModule(), etmB); | 95 | SceneHelpers.SetupSceneModules(sceneB, config, new CapabilitiesModule(), etmB); |
96 | 96 | ||
97 | ScenePresence originalSp = SceneHelpers.AddScenePresence(sceneA, userId, sh.SceneManager); | 97 | AgentCircuitData acd = SceneHelpers.GenerateAgentData(userId); |
98 | TestClient tc = new TestClient(acd, sceneA, sh.SceneManager); | ||
99 | List<TestClient> destinationTestClients = new List<TestClient>(); | ||
100 | EntityTransferHelpers.SetUpInformClientOfNeighbour(tc, destinationTestClients); | ||
101 | |||
102 | ScenePresence originalSp = SceneHelpers.AddScenePresence(sceneA, tc, acd, sh.SceneManager); | ||
98 | originalSp.AbsolutePosition = new Vector3(128, 32, 10); | 103 | originalSp.AbsolutePosition = new Vector3(128, 32, 10); |
99 | 104 | ||
100 | // originalSp.Flying = true; | 105 | // originalSp.Flying = true; |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs index 8dd1f3d..d6bc313 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs | |||
@@ -26,7 +26,10 @@ | |||
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; | ||
30 | using Nini.Config; | 33 | using Nini.Config; |
31 | using NUnit.Framework; | 34 | using NUnit.Framework; |
32 | using OpenMetaverse; | 35 | using OpenMetaverse; |
@@ -40,8 +43,6 @@ 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; | 45 | using OpenSim.Tests.Common.Mock; |
43 | using System.IO; | ||
44 | using System.Text; | ||
45 | 46 | ||
46 | namespace OpenSim.Region.Framework.Scenes.Tests | 47 | namespace OpenSim.Region.Framework.Scenes.Tests |
47 | { | 48 | { |
@@ -68,7 +69,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
68 | } | 69 | } |
69 | 70 | ||
70 | [Test] | 71 | [Test] |
71 | public void TestSameRegionTeleport() | 72 | public void TestSameRegion() |
72 | { | 73 | { |
73 | TestHelpers.InMethod(); | 74 | TestHelpers.InMethod(); |
74 | // log4net.Config.XmlConfigurator.Configure(); | 75 | // log4net.Config.XmlConfigurator.Configure(); |
@@ -106,10 +107,10 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
106 | } | 107 | } |
107 | 108 | ||
108 | [Test] | 109 | [Test] |
109 | public void TestSameSimulatorSeparatedRegionsTeleport() | 110 | public void TestSameSimulatorSeparatedRegions() |
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 | ||
@@ -141,9 +142,8 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
141 | ScenePresence sp = SceneHelpers.AddScenePresence(sceneA, userId, sh.SceneManager); | 142 | ScenePresence sp = SceneHelpers.AddScenePresence(sceneA, userId, sh.SceneManager); |
142 | sp.AbsolutePosition = new Vector3(30, 31, 32); | 143 | sp.AbsolutePosition = new Vector3(30, 31, 32); |
143 | 144 | ||
144 | // XXX: A very nasty hack to tell the client about the destination scene without having to crank the whole | 145 | List<TestClient> destinationTestClients = new List<TestClient>(); |
145 | // UDP stack (?) | 146 | EntityTransferHelpers.SetUpInformClientOfNeighbour((TestClient)sp.ControllingClient, destinationTestClients); |
146 | // ((TestClient)sp.ControllingClient).TeleportTargetScene = sceneB; | ||
147 | 147 | ||
148 | sceneA.RequestTeleportLocation( | 148 | sceneA.RequestTeleportLocation( |
149 | sp.ControllingClient, | 149 | sp.ControllingClient, |
@@ -152,7 +152,10 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
152 | teleportLookAt, | 152 | teleportLookAt, |
153 | (uint)TeleportFlags.ViaLocation); | 153 | (uint)TeleportFlags.ViaLocation); |
154 | 154 | ||
155 | ((TestClient)sp.ControllingClient).CompleteTeleportClientSide(); | 155 | // SetupInformClientOfNeighbour() will have handled the callback into the target scene to setup the child |
156 | // agent. This call will now complete the movement of the user into the destination and upgrade the agent | ||
157 | // from child to root. | ||
158 | destinationTestClients[0].CompleteMovement(); | ||
156 | 159 | ||
157 | Assert.That(sceneA.GetScenePresence(userId), Is.Null); | 160 | Assert.That(sceneA.GetScenePresence(userId), Is.Null); |
158 | 161 | ||
@@ -177,7 +180,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
177 | /// Test teleport procedures when the target simulator returns false when queried about access. | 180 | /// Test teleport procedures when the target simulator returns false when queried about access. |
178 | /// </summary> | 181 | /// </summary> |
179 | [Test] | 182 | [Test] |
180 | public void TestSameSimulatorSeparatedRegionsQueryAccessFails() | 183 | public void TestSameSimulatorSeparatedRegions_DeniedOnQueryAccess() |
181 | { | 184 | { |
182 | TestHelpers.InMethod(); | 185 | TestHelpers.InMethod(); |
183 | // TestHelpers.EnableLogging(); | 186 | // TestHelpers.EnableLogging(); |
@@ -261,7 +264,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
261 | /// Test teleport procedures when the target simulator create agent step is refused. | 264 | /// Test teleport procedures when the target simulator create agent step is refused. |
262 | /// </summary> | 265 | /// </summary> |
263 | [Test] | 266 | [Test] |
264 | public void TestSameSimulatorSeparatedRegionsCreateAgentFails() | 267 | public void TestSameSimulatorSeparatedRegions_DeniedOnCreateAgent() |
265 | { | 268 | { |
266 | TestHelpers.InMethod(); | 269 | TestHelpers.InMethod(); |
267 | // TestHelpers.EnableLogging(); | 270 | // TestHelpers.EnableLogging(); |
@@ -333,13 +336,101 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
333 | // TestHelpers.DisableLogging(); | 336 | // TestHelpers.DisableLogging(); |
334 | } | 337 | } |
335 | 338 | ||
339 | /// <summary> | ||
340 | /// Test teleport when the destination region does not process (or does not receive) the connection attempt | ||
341 | /// from the viewer. | ||
342 | /// </summary> | ||
343 | /// <remarks> | ||
344 | /// This could be quite a common case where the source region can connect to a remove destination region | ||
345 | /// (for CreateAgent) but the viewer cannot reach the destination region due to network issues. | ||
346 | /// </remarks> | ||
336 | [Test] | 347 | [Test] |
337 | public void TestSameSimulatorNeighbouringRegionsTeleport() | 348 | public void TestSameSimulatorSeparatedRegions_DestinationDidNotProcessViewerConnection() |
338 | { | 349 | { |
339 | TestHelpers.InMethod(); | 350 | TestHelpers.InMethod(); |
340 | // TestHelpers.EnableLogging(); | 351 | // TestHelpers.EnableLogging(); |
341 | 352 | ||
342 | UUID userId = TestHelpers.ParseTail(0x1); | 353 | UUID userId = TestHelpers.ParseTail(0x1); |
354 | Vector3 preTeleportPosition = new Vector3(30, 31, 32); | ||
355 | |||
356 | EntityTransferModule etmA = new EntityTransferModule(); | ||
357 | EntityTransferModule etmB = new EntityTransferModule(); | ||
358 | |||
359 | LocalSimulationConnectorModule lscm = new LocalSimulationConnectorModule(); | ||
360 | |||
361 | IConfigSource config = new IniConfigSource(); | ||
362 | config.AddConfig("Modules"); | ||
363 | config.Configs["Modules"].Set("EntityTransferModule", etmA.Name); | ||
364 | config.Configs["Modules"].Set("SimulationServices", lscm.Name); | ||
365 | |||
366 | config.AddConfig("EntityTransfer"); | ||
367 | |||
368 | // In order to run a single threaded regression test we do not want the entity transfer module waiting | ||
369 | // for a callback from the destination scene before removing its avatar data. | ||
370 | config.Configs["EntityTransfer"].Set("wait_for_callback", false); | ||
371 | |||
372 | // config.AddConfig("Startup"); | ||
373 | // config.Configs["Startup"].Set("serverside_object_permissions", true); | ||
374 | |||
375 | SceneHelpers sh = new SceneHelpers(); | ||
376 | TestScene sceneA = sh.SetupScene("sceneA", TestHelpers.ParseTail(0x100), 1000, 1000); | ||
377 | TestScene sceneB = sh.SetupScene("sceneB", TestHelpers.ParseTail(0x200), 1002, 1000); | ||
378 | |||
379 | SceneHelpers.SetupSceneModules(sceneA, config, etmA ); | ||
380 | |||
381 | // We need to set up the permisions module on scene B so that our later use of agent limit to deny | ||
382 | // QueryAccess won't succeed anyway because administrators are always allowed in and the default | ||
383 | // IsAdministrator if no permissions module is present is true. | ||
384 | SceneHelpers.SetupSceneModules(sceneB, config, new object[] { new PermissionsModule(), etmB }); | ||
385 | |||
386 | // Shared scene modules | ||
387 | SceneHelpers.SetupSceneModules(new Scene[] { sceneA, sceneB }, config, lscm); | ||
388 | |||
389 | Vector3 teleportPosition = new Vector3(10, 11, 12); | ||
390 | Vector3 teleportLookAt = new Vector3(20, 21, 22); | ||
391 | |||
392 | ScenePresence sp = SceneHelpers.AddScenePresence(sceneA, userId, sh.SceneManager); | ||
393 | sp.AbsolutePosition = preTeleportPosition; | ||
394 | |||
395 | sceneA.RequestTeleportLocation( | ||
396 | sp.ControllingClient, | ||
397 | sceneB.RegionInfo.RegionHandle, | ||
398 | teleportPosition, | ||
399 | teleportLookAt, | ||
400 | (uint)TeleportFlags.ViaLocation); | ||
401 | |||
402 | // FIXME: Not setting up InformClientOfNeighbour on the TestClient means that it does not initiate | ||
403 | // communication with the destination region. But this is a very non-obvious way of doing it - really we | ||
404 | // should be forced to expicitly set this up. | ||
405 | |||
406 | Assert.That(sceneB.GetScenePresence(userId), Is.Null); | ||
407 | |||
408 | ScenePresence sceneASp = sceneA.GetScenePresence(userId); | ||
409 | Assert.That(sceneASp, Is.Not.Null); | ||
410 | Assert.That(sceneASp.Scene.RegionInfo.RegionName, Is.EqualTo(sceneA.RegionInfo.RegionName)); | ||
411 | Assert.That(sceneASp.AbsolutePosition, Is.EqualTo(preTeleportPosition)); | ||
412 | |||
413 | Assert.That(sceneA.GetRootAgentCount(), Is.EqualTo(1)); | ||
414 | Assert.That(sceneA.GetChildAgentCount(), Is.EqualTo(0)); | ||
415 | Assert.That(sceneB.GetRootAgentCount(), Is.EqualTo(0)); | ||
416 | Assert.That(sceneB.GetChildAgentCount(), Is.EqualTo(0)); | ||
417 | |||
418 | // TODO: Add assertions to check correct circuit details in both scenes. | ||
419 | |||
420 | // Lookat is sent to the client only - sp.Lookat does not yield the same thing (calculation from camera | ||
421 | // position instead). | ||
422 | // Assert.That(sp.Lookat, Is.EqualTo(teleportLookAt)); | ||
423 | |||
424 | // TestHelpers.DisableLogging(); | ||
425 | } | ||
426 | |||
427 | [Test] | ||
428 | public void TestSameSimulatorNeighbouringRegions() | ||
429 | { | ||
430 | TestHelpers.InMethod(); | ||
431 | TestHelpers.EnableLogging(); | ||
432 | |||
433 | UUID userId = TestHelpers.ParseTail(0x1); | ||
343 | 434 | ||
344 | EntityTransferModule etmA = new EntityTransferModule(); | 435 | EntityTransferModule etmA = new EntityTransferModule(); |
345 | EntityTransferModule etmB = new EntityTransferModule(); | 436 | EntityTransferModule etmB = new EntityTransferModule(); |
@@ -366,10 +457,14 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
366 | Vector3 teleportPosition = new Vector3(10, 11, 12); | 457 | Vector3 teleportPosition = new Vector3(10, 11, 12); |
367 | Vector3 teleportLookAt = new Vector3(20, 21, 22); | 458 | Vector3 teleportLookAt = new Vector3(20, 21, 22); |
368 | 459 | ||
369 | ScenePresence originalSp = SceneHelpers.AddScenePresence(sceneA, userId, sh.SceneManager); | 460 | AgentCircuitData acd = SceneHelpers.GenerateAgentData(userId); |
370 | originalSp.AbsolutePosition = new Vector3(30, 31, 32); | 461 | TestClient tc = new TestClient(acd, sceneA, sh.SceneManager); |
462 | List<TestClient> destinationTestClients = new List<TestClient>(); | ||
463 | EntityTransferHelpers.SetUpInformClientOfNeighbour(tc, destinationTestClients); | ||
464 | |||
465 | ScenePresence beforeSceneASp = SceneHelpers.AddScenePresence(sceneA, tc, acd, sh.SceneManager); | ||
466 | beforeSceneASp.AbsolutePosition = new Vector3(30, 31, 32); | ||
371 | 467 | ||
372 | ScenePresence beforeSceneASp = sceneA.GetScenePresence(userId); | ||
373 | Assert.That(beforeSceneASp, Is.Not.Null); | 468 | Assert.That(beforeSceneASp, Is.Not.Null); |
374 | Assert.That(beforeSceneASp.IsChildAgent, Is.False); | 469 | Assert.That(beforeSceneASp.IsChildAgent, Is.False); |
375 | 470 | ||
@@ -377,10 +472,8 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
377 | Assert.That(beforeSceneBSp, Is.Not.Null); | 472 | Assert.That(beforeSceneBSp, Is.Not.Null); |
378 | Assert.That(beforeSceneBSp.IsChildAgent, Is.True); | 473 | Assert.That(beforeSceneBSp.IsChildAgent, Is.True); |
379 | 474 | ||
380 | // XXX: A very nasty hack to tell the client about the destination scene without having to crank the whole | 475 | // In this case, we will not receieve a second InformClientOfNeighbour since the viewer already knows |
381 | // UDP stack (?) | 476 | // about the neighbour region it is teleporting to. |
382 | // ((TestClient)beforeSceneASp.ControllingClient).TeleportTargetScene = sceneB; | ||
383 | |||
384 | sceneA.RequestTeleportLocation( | 477 | sceneA.RequestTeleportLocation( |
385 | beforeSceneASp.ControllingClient, | 478 | beforeSceneASp.ControllingClient, |
386 | sceneB.RegionInfo.RegionHandle, | 479 | sceneB.RegionInfo.RegionHandle, |
@@ -388,7 +481,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
388 | teleportLookAt, | 481 | teleportLookAt, |
389 | (uint)TeleportFlags.ViaLocation); | 482 | (uint)TeleportFlags.ViaLocation); |
390 | 483 | ||
391 | ((TestClient)beforeSceneASp.ControllingClient).CompleteTeleportClientSide(); | 484 | destinationTestClients[0].CompleteMovement(); |
392 | 485 | ||
393 | ScenePresence afterSceneASp = sceneA.GetScenePresence(userId); | 486 | ScenePresence afterSceneASp = sceneA.GetScenePresence(userId); |
394 | Assert.That(afterSceneASp, Is.Not.Null); | 487 | Assert.That(afterSceneASp, Is.Not.Null); |