aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Tests/Common/Helpers/EntityTransferHelpers.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Tests/Common/Helpers/EntityTransferHelpers.cs')
-rw-r--r--OpenSim/Tests/Common/Helpers/EntityTransferHelpers.cs45
1 files changed, 41 insertions, 4 deletions
diff --git a/OpenSim/Tests/Common/Helpers/EntityTransferHelpers.cs b/OpenSim/Tests/Common/Helpers/EntityTransferHelpers.cs
index 6cc7ff2..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,17 +77,52 @@ 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;
83 SceneManager.Instance.TryGetScene(x, y, out neighbourScene); 83 SceneManager.Instance.TryGetScene(x, y, out neighbourScene);
84 84
85 TestClient neighbourTc = new TestClient(newAgent, neighbourScene, SceneManager.Instance); 85 TestClient neighbourTc = new TestClient(newAgent, neighbourScene);
86 neighbourTcs.Add(neighbourTc); 86 neighbourTcs.Add(neighbourTc);
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