From f5d3145bea75fe2c84f49685031443c6826ffae7 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 17 Aug 2013 00:24:56 +0100 Subject: Add ScenePresenceTeleportTests.TestSameSimulatorIsolatedRegionsV2() regression test for v2 transfers. Also adjusts names of teleport setup helpers in EntityTransferHelpers --- .../Tests/Common/Helpers/EntityTransferHelpers.cs | 43 ++++++++++++++++++++-- 1 file changed, 40 insertions(+), 3 deletions(-) (limited to 'OpenSim/Tests/Common') 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; using System.Net; using System.Reflection; using System.Text; +using System.Threading; using log4net; using Nini.Config; using NUnit.Framework; @@ -59,7 +60,8 @@ namespace OpenSim.Tests.Common /// A list that will be populated with any TestClients set up in response to /// being informed about a destination region. /// - public static void SetUpInformClientOfNeighbour(TestClient tc, List neighbourTcs) + public static void SetupInformClientOfNeighbourTriggersNeighbourClientCreate( + TestClient tc, List neighbourTcs) { // XXX: Confusingly, this is also used for non-neighbour notification (as in teleports that do not use the // event queue). @@ -75,8 +77,6 @@ namespace OpenSim.Tests.Common "[TEST CLIENT]: Processing inform client of neighbour located at {0},{1} at {2}", x, y, neighbourExternalEndPoint); - // In response to this message, we are going to make a teleport to the scene we've previous been told - // about by test code (this needs to be improved). AgentCircuitData newAgent = tc.RequestClientInfo(); Scene neighbourScene; @@ -87,5 +87,42 @@ namespace OpenSim.Tests.Common neighbourScene.AddNewClient(neighbourTc, PresenceType.User); }; } + + /// + /// Set up correct handling of the InformClientOfNeighbour call from the source region that triggers the + /// viewer to setup a connection with the destination region. + /// + /// + /// + /// A list that will be populated with any TestClients set up in response to + /// being informed about a destination region. + /// + public static void SetupSendRegionTeleportTriggersDestinationClientCreateAndCompleteMovement( + TestClient client, List destinationClients) + { + client.OnTestClientSendRegionTeleport + += (regionHandle, simAccess, regionExternalEndPoint, locationID, flags, capsURL) => + { + uint x, y; + Utils.LongToUInts(regionHandle, out x, out y); + x /= Constants.RegionSize; + y /= Constants.RegionSize; + + m_log.DebugFormat( + "[TEST CLIENT]: Processing send region teleport for destination at {0},{1} at {2}", + x, y, regionExternalEndPoint); + + AgentCircuitData newAgent = client.RequestClientInfo(); + + Scene destinationScene; + SceneManager.Instance.TryGetScene(x, y, out destinationScene); + + TestClient destinationClient = new TestClient(newAgent, destinationScene); + destinationClients.Add(destinationClient); + destinationScene.AddNewClient(destinationClient, PresenceType.User); + + ThreadPool.UnsafeQueueUserWorkItem(o => destinationClient.CompleteMovement(), null); + }; + } } } \ No newline at end of file -- cgit v1.1