diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs | 478 |
1 files changed, 352 insertions, 126 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs index bebc10c..a407f01 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs | |||
@@ -34,10 +34,14 @@ using OpenSim.Framework; | |||
34 | using OpenSim.Framework.Communications; | 34 | using OpenSim.Framework.Communications; |
35 | using OpenSim.Framework.Servers; | 35 | using OpenSim.Framework.Servers; |
36 | using OpenSim.Region.Framework.Interfaces; | 36 | using OpenSim.Region.Framework.Interfaces; |
37 | using OpenSim.Region.CoreModules.Framework; | ||
38 | using OpenSim.Region.CoreModules.Framework.EntityTransfer; | ||
37 | using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; | 39 | using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; |
40 | using OpenSim.Region.CoreModules.World.Permissions; | ||
38 | using OpenSim.Tests.Common; | 41 | using OpenSim.Tests.Common; |
39 | using OpenSim.Tests.Common.Mock; | 42 | using OpenSim.Tests.Common.Mock; |
40 | using System.Threading; | 43 | using System.IO; |
44 | using System.Text; | ||
41 | 45 | ||
42 | namespace OpenSim.Region.Framework.Scenes.Tests | 46 | namespace OpenSim.Region.Framework.Scenes.Tests |
43 | { | 47 | { |
@@ -47,145 +51,367 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
47 | [TestFixture] | 51 | [TestFixture] |
48 | public class ScenePresenceTeleportTests | 52 | public class ScenePresenceTeleportTests |
49 | { | 53 | { |
50 | /// <summary> | 54 | [TestFixtureSetUp] |
51 | /// Test a teleport between two regions that are not neighbours and do not share any neighbours in common. | 55 | public void FixtureInit() |
52 | /// </summary> | 56 | { |
53 | /// Does not yet do what is says on the tin. | 57 | // Don't allow tests to be bamboozled by asynchronous events. Execute everything on the same thread. |
54 | /// Commenting for now | 58 | Util.FireAndForgetMethod = FireAndForgetMethod.RegressionTest; |
55 | //[Test, LongRunning] | 59 | } |
56 | public void TestSimpleNotNeighboursTeleport() | 60 | |
61 | [TestFixtureTearDown] | ||
62 | public void TearDown() | ||
63 | { | ||
64 | // We must set this back afterwards, otherwise later tests will fail since they're expecting multiple | ||
65 | // threads. Possibly, later tests should be rewritten so none of them require async stuff (which regression | ||
66 | // tests really shouldn't). | ||
67 | Util.FireAndForgetMethod = Util.DefaultFireAndForgetMethod; | ||
68 | } | ||
69 | |||
70 | [Test] | ||
71 | public void TestSameRegionTeleport() | ||
57 | { | 72 | { |
58 | TestHelpers.InMethod(); | 73 | TestHelpers.InMethod(); |
59 | ThreadRunResults results = new ThreadRunResults(); | 74 | // log4net.Config.XmlConfigurator.Configure(); |
60 | results.Result = false; | 75 | |
61 | results.Message = "Test did not run"; | 76 | EntityTransferModule etm = new EntityTransferModule(); |
62 | TestRunning testClass = new TestRunning(results); | 77 | |
78 | IConfigSource config = new IniConfigSource(); | ||
79 | config.AddConfig("Modules"); | ||
80 | // Not strictly necessary since FriendsModule assumes it is the default (!) | ||
81 | config.Configs["Modules"].Set("EntityTransferModule", etm.Name); | ||
82 | |||
83 | TestScene scene = new SceneHelpers().SetupScene("sceneA", TestHelpers.ParseTail(0x100), 1000, 1000); | ||
84 | SceneHelpers.SetupSceneModules(scene, config, etm); | ||
85 | |||
86 | Vector3 teleportPosition = new Vector3(10, 11, 12); | ||
87 | Vector3 teleportLookAt = new Vector3(20, 21, 22); | ||
88 | |||
89 | ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1)); | ||
90 | sp.AbsolutePosition = new Vector3(30, 31, 32); | ||
91 | scene.RequestTeleportLocation( | ||
92 | sp.ControllingClient, | ||
93 | scene.RegionInfo.RegionHandle, | ||
94 | teleportPosition, | ||
95 | teleportLookAt, | ||
96 | (uint)TeleportFlags.ViaLocation); | ||
63 | 97 | ||
64 | Thread testThread = new Thread(testClass.run); | 98 | Assert.That(sp.AbsolutePosition, Is.EqualTo(teleportPosition)); |
65 | 99 | ||
66 | // Seems kind of redundant to start a thread and then join it, however.. We need to protect against | 100 | Assert.That(scene.GetRootAgentCount(), Is.EqualTo(1)); |
67 | // A thread abort exception in the simulator code. | 101 | Assert.That(scene.GetChildAgentCount(), Is.EqualTo(0)); |
68 | testThread.Start(); | ||
69 | testThread.Join(); | ||
70 | 102 | ||
71 | Assert.That(testClass.results.Result, Is.EqualTo(true), testClass.results.Message); | 103 | // Lookat is sent to the client only - sp.Lookat does not yield the same thing (calculation from camera |
72 | // Console.WriteLine("Beginning test {0}", MethodBase.GetCurrentMethod()); | 104 | // position instead). |
105 | // Assert.That(sp.Lookat, Is.EqualTo(teleportLookAt)); | ||
73 | } | 106 | } |
74 | 107 | ||
75 | [TearDown] | 108 | [Test] |
76 | public void TearDown() | 109 | public void TestSameSimulatorSeparatedRegionsTeleport() |
77 | { | 110 | { |
78 | try | 111 | TestHelpers.InMethod(); |
79 | { | 112 | // log4net.Config.XmlConfigurator.Configure(); |
80 | if (MainServer.Instance != null) MainServer.Instance.Stop(); | 113 | |
81 | } | 114 | UUID userId = TestHelpers.ParseTail(0x1); |
82 | catch (NullReferenceException) | 115 | |
83 | { } | 116 | EntityTransferModule etmA = new EntityTransferModule(); |
117 | EntityTransferModule etmB = new EntityTransferModule(); | ||
118 | LocalSimulationConnectorModule lscm = new LocalSimulationConnectorModule(); | ||
119 | |||
120 | IConfigSource config = new IniConfigSource(); | ||
121 | IConfig modulesConfig = config.AddConfig("Modules"); | ||
122 | modulesConfig.Set("EntityTransferModule", etmA.Name); | ||
123 | modulesConfig.Set("SimulationServices", lscm.Name); | ||
124 | IConfig entityTransferConfig = config.AddConfig("EntityTransfer"); | ||
125 | |||
126 | // In order to run a single threaded regression test we do not want the entity transfer module waiting | ||
127 | // for a callback from the destination scene before removing its avatar data. | ||
128 | entityTransferConfig.Set("wait_for_callback", false); | ||
129 | |||
130 | SceneHelpers sh = new SceneHelpers(); | ||
131 | TestScene sceneA = sh.SetupScene("sceneA", TestHelpers.ParseTail(0x100), 1000, 1000); | ||
132 | TestScene sceneB = sh.SetupScene("sceneB", TestHelpers.ParseTail(0x200), 1002, 1000); | ||
133 | |||
134 | SceneHelpers.SetupSceneModules(sceneA, config, etmA); | ||
135 | SceneHelpers.SetupSceneModules(sceneB, config, etmB); | ||
136 | SceneHelpers.SetupSceneModules(new Scene[] { sceneA, sceneB }, config, lscm); | ||
137 | |||
138 | Vector3 teleportPosition = new Vector3(10, 11, 12); | ||
139 | Vector3 teleportLookAt = new Vector3(20, 21, 22); | ||
140 | |||
141 | ScenePresence sp = SceneHelpers.AddScenePresence(sceneA, userId, sh.SceneManager); | ||
142 | sp.AbsolutePosition = new Vector3(30, 31, 32); | ||
143 | |||
144 | // XXX: A very nasty hack to tell the client about the destination scene without having to crank the whole | ||
145 | // UDP stack (?) | ||
146 | // ((TestClient)sp.ControllingClient).TeleportTargetScene = sceneB; | ||
147 | |||
148 | sceneA.RequestTeleportLocation( | ||
149 | sp.ControllingClient, | ||
150 | sceneB.RegionInfo.RegionHandle, | ||
151 | teleportPosition, | ||
152 | teleportLookAt, | ||
153 | (uint)TeleportFlags.ViaLocation); | ||
154 | |||
155 | ((TestClient)sp.ControllingClient).CompleteTeleportClientSide(); | ||
156 | |||
157 | Assert.That(sceneA.GetScenePresence(userId), Is.Null); | ||
158 | |||
159 | ScenePresence sceneBSp = sceneB.GetScenePresence(userId); | ||
160 | Assert.That(sceneBSp, Is.Not.Null); | ||
161 | Assert.That(sceneBSp.Scene.RegionInfo.RegionName, Is.EqualTo(sceneB.RegionInfo.RegionName)); | ||
162 | Assert.That(sceneBSp.AbsolutePosition, Is.EqualTo(teleportPosition)); | ||
163 | |||
164 | Assert.That(sceneA.GetRootAgentCount(), Is.EqualTo(0)); | ||
165 | Assert.That(sceneA.GetChildAgentCount(), Is.EqualTo(0)); | ||
166 | Assert.That(sceneB.GetRootAgentCount(), Is.EqualTo(1)); | ||
167 | Assert.That(sceneB.GetChildAgentCount(), Is.EqualTo(0)); | ||
168 | |||
169 | // TODO: Add assertions to check correct circuit details in both scenes. | ||
170 | |||
171 | // Lookat is sent to the client only - sp.Lookat does not yield the same thing (calculation from camera | ||
172 | // position instead). | ||
173 | // Assert.That(sp.Lookat, Is.EqualTo(teleportLookAt)); | ||
84 | } | 174 | } |
85 | 175 | ||
86 | } | 176 | /// <summary> |
177 | /// Test teleport procedures when the target simulator returns false when queried about access. | ||
178 | /// </summary> | ||
179 | [Test] | ||
180 | public void TestSameSimulatorSeparatedRegionsQueryAccessFails() | ||
181 | { | ||
182 | TestHelpers.InMethod(); | ||
183 | // TestHelpers.EnableLogging(); | ||
87 | 184 | ||
88 | public class ThreadRunResults | 185 | UUID userId = TestHelpers.ParseTail(0x1); |
89 | { | 186 | Vector3 preTeleportPosition = new Vector3(30, 31, 32); |
90 | public bool Result = false; | ||
91 | public string Message = string.Empty; | ||
92 | } | ||
93 | 187 | ||
94 | public class TestRunning | 188 | EntityTransferModule etmA = new EntityTransferModule(); |
95 | { | 189 | EntityTransferModule etmB = new EntityTransferModule(); |
96 | public ThreadRunResults results; | 190 | |
97 | public TestRunning(ThreadRunResults t) | 191 | LocalSimulationConnectorModule lscm = new LocalSimulationConnectorModule(); |
192 | |||
193 | IConfigSource config = new IniConfigSource(); | ||
194 | config.AddConfig("Modules"); | ||
195 | config.Configs["Modules"].Set("EntityTransferModule", etmA.Name); | ||
196 | config.Configs["Modules"].Set("SimulationServices", lscm.Name); | ||
197 | |||
198 | config.AddConfig("EntityTransfer"); | ||
199 | |||
200 | // In order to run a single threaded regression test we do not want the entity transfer module waiting | ||
201 | // for a callback from the destination scene before removing its avatar data. | ||
202 | config.Configs["EntityTransfer"].Set("wait_for_callback", false); | ||
203 | |||
204 | config.AddConfig("Startup"); | ||
205 | config.Configs["Startup"].Set("serverside_object_permissions", true); | ||
206 | |||
207 | SceneHelpers sh = new SceneHelpers(); | ||
208 | TestScene sceneA = sh.SetupScene("sceneA", TestHelpers.ParseTail(0x100), 1000, 1000); | ||
209 | TestScene sceneB = sh.SetupScene("sceneB", TestHelpers.ParseTail(0x200), 1002, 1000); | ||
210 | |||
211 | SceneHelpers.SetupSceneModules(sceneA, config, etmA ); | ||
212 | |||
213 | // We need to set up the permisions module on scene B so that our later use of agent limit to deny | ||
214 | // QueryAccess won't succeed anyway because administrators are always allowed in and the default | ||
215 | // IsAdministrator if no permissions module is present is true. | ||
216 | SceneHelpers.SetupSceneModules(sceneB, config, new object[] { new PermissionsModule(), etmB }); | ||
217 | |||
218 | // Shared scene modules | ||
219 | SceneHelpers.SetupSceneModules(new Scene[] { sceneA, sceneB }, config, lscm); | ||
220 | |||
221 | Vector3 teleportPosition = new Vector3(10, 11, 12); | ||
222 | Vector3 teleportLookAt = new Vector3(20, 21, 22); | ||
223 | |||
224 | ScenePresence sp = SceneHelpers.AddScenePresence(sceneA, userId, sh.SceneManager); | ||
225 | sp.AbsolutePosition = preTeleportPosition; | ||
226 | |||
227 | // Make sceneB return false on query access | ||
228 | sceneB.RegionInfo.RegionSettings.AgentLimit = 0; | ||
229 | |||
230 | sceneA.RequestTeleportLocation( | ||
231 | sp.ControllingClient, | ||
232 | sceneB.RegionInfo.RegionHandle, | ||
233 | teleportPosition, | ||
234 | teleportLookAt, | ||
235 | (uint)TeleportFlags.ViaLocation); | ||
236 | |||
237 | // ((TestClient)sp.ControllingClient).CompleteTeleportClientSide(); | ||
238 | |||
239 | Assert.That(sceneB.GetScenePresence(userId), Is.Null); | ||
240 | |||
241 | ScenePresence sceneASp = sceneA.GetScenePresence(userId); | ||
242 | Assert.That(sceneASp, Is.Not.Null); | ||
243 | Assert.That(sceneASp.Scene.RegionInfo.RegionName, Is.EqualTo(sceneA.RegionInfo.RegionName)); | ||
244 | Assert.That(sceneASp.AbsolutePosition, Is.EqualTo(preTeleportPosition)); | ||
245 | |||
246 | Assert.That(sceneA.GetRootAgentCount(), Is.EqualTo(1)); | ||
247 | Assert.That(sceneA.GetChildAgentCount(), Is.EqualTo(0)); | ||
248 | Assert.That(sceneB.GetRootAgentCount(), Is.EqualTo(0)); | ||
249 | Assert.That(sceneB.GetChildAgentCount(), Is.EqualTo(0)); | ||
250 | |||
251 | // TODO: Add assertions to check correct circuit details in both scenes. | ||
252 | |||
253 | // Lookat is sent to the client only - sp.Lookat does not yield the same thing (calculation from camera | ||
254 | // position instead). | ||
255 | // Assert.That(sp.Lookat, Is.EqualTo(teleportLookAt)); | ||
256 | |||
257 | // TestHelpers.DisableLogging(); | ||
258 | } | ||
259 | |||
260 | /// <summary> | ||
261 | /// Test teleport procedures when the target simulator create agent step is refused. | ||
262 | /// </summary> | ||
263 | [Test] | ||
264 | public void TestSameSimulatorSeparatedRegionsCreateAgentFails() | ||
98 | { | 265 | { |
99 | results = t; | 266 | TestHelpers.InMethod(); |
267 | // TestHelpers.EnableLogging(); | ||
268 | |||
269 | UUID userId = TestHelpers.ParseTail(0x1); | ||
270 | Vector3 preTeleportPosition = new Vector3(30, 31, 32); | ||
271 | |||
272 | EntityTransferModule etmA = new EntityTransferModule(); | ||
273 | EntityTransferModule etmB = new EntityTransferModule(); | ||
274 | LocalSimulationConnectorModule lscm = new LocalSimulationConnectorModule(); | ||
275 | |||
276 | IConfigSource config = new IniConfigSource(); | ||
277 | config.AddConfig("Modules"); | ||
278 | config.Configs["Modules"].Set("EntityTransferModule", etmA.Name); | ||
279 | config.Configs["Modules"].Set("SimulationServices", lscm.Name); | ||
280 | |||
281 | config.AddConfig("EntityTransfer"); | ||
282 | |||
283 | // In order to run a single threaded regression test we do not want the entity transfer module waiting | ||
284 | // for a callback from the destination scene before removing its avatar data. | ||
285 | config.Configs["EntityTransfer"].Set("wait_for_callback", false); | ||
286 | |||
287 | SceneHelpers sh = new SceneHelpers(); | ||
288 | TestScene sceneA = sh.SetupScene("sceneA", TestHelpers.ParseTail(0x100), 1000, 1000); | ||
289 | TestScene sceneB = sh.SetupScene("sceneB", TestHelpers.ParseTail(0x200), 1002, 1000); | ||
290 | |||
291 | SceneHelpers.SetupSceneModules(sceneA, config, etmA); | ||
292 | SceneHelpers.SetupSceneModules(sceneB, config, etmB); | ||
293 | |||
294 | // Shared scene modules | ||
295 | SceneHelpers.SetupSceneModules(new Scene[] { sceneA, sceneB }, config, lscm); | ||
296 | |||
297 | Vector3 teleportPosition = new Vector3(10, 11, 12); | ||
298 | Vector3 teleportLookAt = new Vector3(20, 21, 22); | ||
299 | |||
300 | ScenePresence sp = SceneHelpers.AddScenePresence(sceneA, userId, sh.SceneManager); | ||
301 | sp.AbsolutePosition = preTeleportPosition; | ||
302 | |||
303 | // Make sceneB refuse CreateAgent | ||
304 | sceneB.LoginsDisabled = true; | ||
305 | |||
306 | sceneA.RequestTeleportLocation( | ||
307 | sp.ControllingClient, | ||
308 | sceneB.RegionInfo.RegionHandle, | ||
309 | teleportPosition, | ||
310 | teleportLookAt, | ||
311 | (uint)TeleportFlags.ViaLocation); | ||
312 | |||
313 | // ((TestClient)sp.ControllingClient).CompleteTeleportClientSide(); | ||
314 | |||
315 | Assert.That(sceneB.GetScenePresence(userId), Is.Null); | ||
316 | |||
317 | ScenePresence sceneASp = sceneA.GetScenePresence(userId); | ||
318 | Assert.That(sceneASp, Is.Not.Null); | ||
319 | Assert.That(sceneASp.Scene.RegionInfo.RegionName, Is.EqualTo(sceneA.RegionInfo.RegionName)); | ||
320 | Assert.That(sceneASp.AbsolutePosition, Is.EqualTo(preTeleportPosition)); | ||
321 | |||
322 | Assert.That(sceneA.GetRootAgentCount(), Is.EqualTo(1)); | ||
323 | Assert.That(sceneA.GetChildAgentCount(), Is.EqualTo(0)); | ||
324 | Assert.That(sceneB.GetRootAgentCount(), Is.EqualTo(0)); | ||
325 | Assert.That(sceneB.GetChildAgentCount(), Is.EqualTo(0)); | ||
326 | |||
327 | // TODO: Add assertions to check correct circuit details in both scenes. | ||
328 | |||
329 | // Lookat is sent to the client only - sp.Lookat does not yield the same thing (calculation from camera | ||
330 | // position instead). | ||
331 | // Assert.That(sp.Lookat, Is.EqualTo(teleportLookAt)); | ||
332 | |||
333 | // TestHelpers.DisableLogging(); | ||
100 | } | 334 | } |
101 | public void run(object o) | 335 | |
336 | [Test] | ||
337 | public void TestSameSimulatorNeighbouringRegionsTeleport() | ||
102 | { | 338 | { |
103 | 339 | TestHelpers.InMethod(); | |
104 | //results.Result = true; | 340 | // TestHelpers.EnableLogging(); |
105 | log4net.Config.XmlConfigurator.Configure(); | 341 | |
106 | 342 | UUID userId = TestHelpers.ParseTail(0x1); | |
107 | UUID sceneAId = UUID.Parse("00000000-0000-0000-0000-000000000100"); | 343 | |
108 | UUID sceneBId = UUID.Parse("00000000-0000-0000-0000-000000000200"); | 344 | EntityTransferModule etmA = new EntityTransferModule(); |
109 | 345 | EntityTransferModule etmB = new EntityTransferModule(); | |
110 | // shared module | 346 | LocalSimulationConnectorModule lscm = new LocalSimulationConnectorModule(); |
111 | ISharedRegionModule interregionComms = new LocalSimulationConnectorModule(); | 347 | |
112 | 348 | IConfigSource config = new IniConfigSource(); | |
113 | 349 | IConfig modulesConfig = config.AddConfig("Modules"); | |
114 | Scene sceneB = SceneHelpers.SetupScene("sceneB", sceneBId, 1010, 1010); | 350 | modulesConfig.Set("EntityTransferModule", etmA.Name); |
115 | SceneHelpers.SetupSceneModules(sceneB, new IniConfigSource(), interregionComms); | 351 | modulesConfig.Set("SimulationServices", lscm.Name); |
116 | sceneB.RegisterRegionWithGrid(); | 352 | IConfig entityTransferConfig = config.AddConfig("EntityTransfer"); |
117 | 353 | ||
118 | Scene sceneA = SceneHelpers.SetupScene("sceneA", sceneAId, 1000, 1000); | 354 | // In order to run a single threaded regression test we do not want the entity transfer module waiting |
119 | SceneHelpers.SetupSceneModules(sceneA, new IniConfigSource(), interregionComms); | 355 | // for a callback from the destination scene before removing its avatar data. |
120 | sceneA.RegisterRegionWithGrid(); | 356 | entityTransferConfig.Set("wait_for_callback", false); |
121 | 357 | ||
122 | UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000041"); | 358 | SceneHelpers sh = new SceneHelpers(); |
123 | TestClient client = (TestClient)SceneHelpers.AddScenePresence(sceneA, agentId).ControllingClient; | 359 | TestScene sceneA = sh.SetupScene("sceneA", TestHelpers.ParseTail(0x100), 1000, 1000); |
124 | 360 | TestScene sceneB = sh.SetupScene("sceneB", TestHelpers.ParseTail(0x200), 1001, 1000); | |
125 | ICapabilitiesModule sceneACapsModule = sceneA.RequestModuleInterface<ICapabilitiesModule>(); | 361 | |
126 | 362 | SceneHelpers.SetupSceneModules(new Scene[] { sceneA, sceneB }, config, lscm); | |
127 | results.Result = (sceneACapsModule.GetCapsPath(agentId) == client.CapsSeedUrl); | 363 | SceneHelpers.SetupSceneModules(sceneA, config, new CapabilitiesModule(), etmA); |
128 | 364 | SceneHelpers.SetupSceneModules(sceneB, config, new CapabilitiesModule(), etmB); | |
129 | if (!results.Result) | 365 | |
130 | { | 366 | Vector3 teleportPosition = new Vector3(10, 11, 12); |
131 | results.Message = "Incorrect caps object path set up in sceneA"; | 367 | Vector3 teleportLookAt = new Vector3(20, 21, 22); |
132 | return; | 368 | |
133 | } | 369 | ScenePresence originalSp = SceneHelpers.AddScenePresence(sceneA, userId, sh.SceneManager); |
134 | 370 | originalSp.AbsolutePosition = new Vector3(30, 31, 32); | |
135 | /* | 371 | |
136 | Assert.That( | 372 | ScenePresence beforeSceneASp = sceneA.GetScenePresence(userId); |
137 | sceneACapsModule.GetCapsPath(agentId), | 373 | Assert.That(beforeSceneASp, Is.Not.Null); |
138 | Is.EqualTo(client.CapsSeedUrl), | 374 | Assert.That(beforeSceneASp.IsChildAgent, Is.False); |
139 | "Incorrect caps object path set up in sceneA"); | 375 | |
140 | */ | 376 | ScenePresence beforeSceneBSp = sceneB.GetScenePresence(userId); |
141 | // FIXME: This is a hack to get the test working - really the normal OpenSim mechanisms should be used. | 377 | Assert.That(beforeSceneBSp, Is.Not.Null); |
142 | 378 | Assert.That(beforeSceneBSp.IsChildAgent, Is.True); | |
143 | 379 | ||
144 | client.TeleportTargetScene = sceneB; | 380 | // XXX: A very nasty hack to tell the client about the destination scene without having to crank the whole |
145 | client.Teleport(sceneB.RegionInfo.RegionHandle, new Vector3(100, 100, 100), new Vector3(40, 40, 40)); | 381 | // UDP stack (?) |
146 | 382 | // ((TestClient)beforeSceneASp.ControllingClient).TeleportTargetScene = sceneB; | |
147 | results.Result = (sceneB.GetScenePresence(agentId) != null); | 383 | |
148 | if (!results.Result) | 384 | sceneA.RequestTeleportLocation( |
149 | { | 385 | beforeSceneASp.ControllingClient, |
150 | results.Message = "Client does not have an agent in sceneB"; | 386 | sceneB.RegionInfo.RegionHandle, |
151 | return; | 387 | teleportPosition, |
152 | } | 388 | teleportLookAt, |
153 | 389 | (uint)TeleportFlags.ViaLocation); | |
154 | //Assert.That(sceneB.GetScenePresence(agentId), Is.Not.Null, "Client does not have an agent in sceneB"); | 390 | |
155 | 391 | ((TestClient)beforeSceneASp.ControllingClient).CompleteTeleportClientSide(); | |
156 | //Assert.That(sceneA.GetScenePresence(agentId), Is.Null, "Client still had an agent in sceneA"); | 392 | |
157 | 393 | ScenePresence afterSceneASp = sceneA.GetScenePresence(userId); | |
158 | results.Result = (sceneA.GetScenePresence(agentId) == null); | 394 | Assert.That(afterSceneASp, Is.Not.Null); |
159 | if (!results.Result) | 395 | Assert.That(afterSceneASp.IsChildAgent, Is.True); |
160 | { | 396 | |
161 | results.Message = "Client still had an agent in sceneA"; | 397 | ScenePresence afterSceneBSp = sceneB.GetScenePresence(userId); |
162 | return; | 398 | Assert.That(afterSceneBSp, Is.Not.Null); |
163 | } | 399 | Assert.That(afterSceneBSp.IsChildAgent, Is.False); |
164 | 400 | Assert.That(afterSceneBSp.Scene.RegionInfo.RegionName, Is.EqualTo(sceneB.RegionInfo.RegionName)); | |
165 | ICapabilitiesModule sceneBCapsModule = sceneB.RequestModuleInterface<ICapabilitiesModule>(); | 401 | Assert.That(afterSceneBSp.AbsolutePosition, Is.EqualTo(teleportPosition)); |
166 | 402 | ||
167 | 403 | Assert.That(sceneA.GetRootAgentCount(), Is.EqualTo(0)); | |
168 | results.Result = ("http://" + sceneB.RegionInfo.ExternalHostName + ":" + sceneB.RegionInfo.HttpPort + | 404 | Assert.That(sceneA.GetChildAgentCount(), Is.EqualTo(1)); |
169 | "/CAPS/" + sceneBCapsModule.GetCapsPath(agentId) + "0000/" == client.CapsSeedUrl); | 405 | Assert.That(sceneB.GetRootAgentCount(), Is.EqualTo(1)); |
170 | if (!results.Result) | 406 | Assert.That(sceneB.GetChildAgentCount(), Is.EqualTo(0)); |
171 | { | 407 | |
172 | results.Message = "Incorrect caps object path set up in sceneB"; | 408 | // TODO: Add assertions to check correct circuit details in both scenes. |
173 | return; | 409 | |
174 | } | 410 | // Lookat is sent to the client only - sp.Lookat does not yield the same thing (calculation from camera |
175 | 411 | // position instead). | |
176 | // Temporary assertion - caps url construction should at least be doable through a method. | 412 | // Assert.That(sp.Lookat, Is.EqualTo(teleportLookAt)); |
177 | /* | 413 | |
178 | Assert.That( | 414 | // TestHelpers.DisableLogging(); |
179 | "http://" + sceneB.RegionInfo.ExternalHostName + ":" + sceneB.RegionInfo.HttpPort + "/CAPS/" + sceneBCapsModule.GetCapsPath(agentId) + "0000/", | ||
180 | Is.EqualTo(client.CapsSeedUrl), | ||
181 | "Incorrect caps object path set up in sceneB"); | ||
182 | */ | ||
183 | // This assertion will currently fail since we don't remove the caps paths when no longer needed | ||
184 | //Assert.That(sceneACapsModule.GetCapsPath(agentId), Is.Null, "sceneA still had a caps object path"); | ||
185 | |||
186 | // TODO: Check that more of everything is as it should be | ||
187 | |||
188 | // TODO: test what happens if we try to teleport to a region that doesn't exist | ||
189 | } | 415 | } |
190 | } | 416 | } |
191 | } | 417 | } \ No newline at end of file |