29 using System.Collections.Generic;
33 using System.Threading;
35 using NUnit.Framework;
37 using OpenSim.Framework;
38 using OpenSim.Framework.Servers;
39 using OpenSim.Region.Framework.Interfaces;
40 using OpenSim.Region.CoreModules.Framework;
41 using OpenSim.Region.CoreModules.Framework.EntityTransfer;
42 using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation;
43 using OpenSim.Region.CoreModules.World.Permissions;
44 using OpenSim.Tests.Common;
46 namespace OpenSim.
Region.Framework.Scenes.Tests
58 Util.FireAndForgetMethod = FireAndForgetMethod.RegressionTest;
67 Util.FireAndForgetMethod = Util.DefaultFireAndForgetMethod;
73 TestHelpers.InMethod();
78 IConfigSource config =
new IniConfigSource();
79 config.AddConfig(
"Modules");
81 config.Configs[
"Modules"].Set(
"EntityTransferModule", etm.Name);
84 SceneHelpers.SetupSceneModules(scene, config, etm);
86 Vector3 teleportPosition =
new Vector3(10, 11, 12);
87 Vector3 teleportLookAt =
new Vector3(20, 21, 22);
89 ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1));
90 sp.AbsolutePosition =
new Vector3(30, 31, 32);
91 scene.RequestTeleportLocation(
93 scene.RegionInfo.RegionHandle,
98 Assert.That(sp.AbsolutePosition, Is.EqualTo(teleportPosition));
100 Assert.That(scene.GetRootAgentCount(), Is.EqualTo(1));
101 Assert.That(scene.GetChildAgentCount(), Is.EqualTo(0));
187 TestHelpers.InMethod();
190 UUID userId = TestHelpers.ParseTail(0x1);
196 IConfigSource config =
new IniConfigSource();
197 IConfig modulesConfig = config.AddConfig(
"Modules");
198 modulesConfig.Set(
"EntityTransferModule", etmA.Name);
199 modulesConfig.Set(
"SimulationServices", lscm.Name);
202 TestScene sceneA = sh.SetupScene(
"sceneA", TestHelpers.ParseTail(0x100), 1000, 1000);
203 TestScene sceneB = sh.SetupScene(
"sceneB", TestHelpers.ParseTail(0x200), 1002, 1000);
205 SceneHelpers.SetupSceneModules(sceneA, config, etmA);
206 SceneHelpers.SetupSceneModules(sceneB, config, etmB);
207 SceneHelpers.SetupSceneModules(
new Scene[] { sceneA, sceneB }, config, lscm);
209 Vector3 teleportPosition =
new Vector3(10, 11, 12);
210 Vector3 teleportLookAt =
new Vector3(20, 21, 22);
212 ScenePresence sp = SceneHelpers.AddScenePresence(sceneA, userId);
213 sp.AbsolutePosition =
new Vector3(30, 31, 32);
215 List<TestClient> destinationTestClients =
new List<TestClient>();
216 EntityTransferHelpers.SetupSendRegionTeleportTriggersDestinationClientCreateAndCompleteMovement(
219 sceneA.RequestTeleportLocation(
220 sp.ControllingClient,
221 sceneB.RegionInfo.RegionHandle,
226 Assert.That(sceneA.GetScenePresence(userId), Is.Null);
229 Assert.That(sceneBSp, Is.Not.Null);
230 Assert.That(sceneBSp.Scene.RegionInfo.RegionName, Is.EqualTo(sceneB.RegionInfo.RegionName));
231 Assert.That(sceneBSp.AbsolutePosition, Is.EqualTo(teleportPosition));
233 Assert.That(sceneA.GetRootAgentCount(), Is.EqualTo(0));
234 Assert.That(sceneA.GetChildAgentCount(), Is.EqualTo(0));
235 Assert.That(sceneB.GetRootAgentCount(), Is.EqualTo(1));
236 Assert.That(sceneB.GetChildAgentCount(), Is.EqualTo(0));
251 TestHelpers.InMethod();
254 UUID userId = TestHelpers.ParseTail(0x1);
255 Vector3 preTeleportPosition =
new Vector3(30, 31, 32);
262 IConfigSource config =
new IniConfigSource();
263 config.AddConfig(
"Modules");
264 config.Configs[
"Modules"].Set(
"EntityTransferModule", etmA.Name);
265 config.Configs[
"Modules"].Set(
"SimulationServices", lscm.Name);
267 config.AddConfig(
"EntityTransfer");
271 config.Configs[
"EntityTransfer"].Set(
"wait_for_callback",
false);
273 config.AddConfig(
"Startup");
274 config.Configs[
"Startup"].Set(
"serverside_object_permissions",
true);
277 TestScene sceneA = sh.SetupScene(
"sceneA", TestHelpers.ParseTail(0x100), 1000, 1000);
278 TestScene sceneB = sh.SetupScene(
"sceneB", TestHelpers.ParseTail(0x200), 1002, 1000);
280 SceneHelpers.SetupSceneModules(sceneA, config, etmA );
288 SceneHelpers.SetupSceneModules(
new Scene[] { sceneA, sceneB }, config, lscm);
290 Vector3 teleportPosition =
new Vector3(10, 11, 12);
291 Vector3 teleportLookAt =
new Vector3(20, 21, 22);
293 ScenePresence sp = SceneHelpers.AddScenePresence(sceneA, userId);
294 sp.AbsolutePosition = preTeleportPosition;
297 sceneB.RegionInfo.RegionSettings.AgentLimit = 0;
299 sceneA.RequestTeleportLocation(
300 sp.ControllingClient,
301 sceneB.RegionInfo.RegionHandle,
308 Assert.That(sceneB.GetScenePresence(userId), Is.Null);
311 Assert.That(sceneASp, Is.Not.Null);
312 Assert.That(sceneASp.Scene.RegionInfo.RegionName, Is.EqualTo(sceneA.RegionInfo.RegionName));
313 Assert.That(sceneASp.AbsolutePosition, Is.EqualTo(preTeleportPosition));
315 Assert.That(sceneA.GetRootAgentCount(), Is.EqualTo(1));
316 Assert.That(sceneA.GetChildAgentCount(), Is.EqualTo(0));
317 Assert.That(sceneB.GetRootAgentCount(), Is.EqualTo(0));
318 Assert.That(sceneB.GetChildAgentCount(), Is.EqualTo(0));
335 TestHelpers.InMethod();
338 UUID userId = TestHelpers.ParseTail(0x1);
339 Vector3 preTeleportPosition =
new Vector3(30, 31, 32);
345 IConfigSource config =
new IniConfigSource();
346 config.AddConfig(
"Modules");
347 config.Configs[
"Modules"].Set(
"EntityTransferModule", etmA.Name);
348 config.Configs[
"Modules"].Set(
"SimulationServices", lscm.Name);
350 config.AddConfig(
"EntityTransfer");
354 config.Configs[
"EntityTransfer"].Set(
"wait_for_callback",
false);
357 TestScene sceneA = sh.SetupScene(
"sceneA", TestHelpers.ParseTail(0x100), 1000, 1000);
358 TestScene sceneB = sh.SetupScene(
"sceneB", TestHelpers.ParseTail(0x200), 1002, 1000);
360 SceneHelpers.SetupSceneModules(sceneA, config, etmA);
361 SceneHelpers.SetupSceneModules(sceneB, config, etmB);
364 SceneHelpers.SetupSceneModules(
new Scene[] { sceneA, sceneB }, config, lscm);
366 Vector3 teleportPosition =
new Vector3(10, 11, 12);
367 Vector3 teleportLookAt =
new Vector3(20, 21, 22);
369 ScenePresence sp = SceneHelpers.AddScenePresence(sceneA, userId);
370 sp.AbsolutePosition = preTeleportPosition;
373 sceneB.LoginsEnabled =
false;
375 sceneA.RequestTeleportLocation(
376 sp.ControllingClient,
377 sceneB.RegionInfo.RegionHandle,
384 Assert.That(sceneB.GetScenePresence(userId), Is.Null);
387 Assert.That(sceneASp, Is.Not.Null);
388 Assert.That(sceneASp.Scene.RegionInfo.RegionName, Is.EqualTo(sceneA.RegionInfo.RegionName));
389 Assert.That(sceneASp.AbsolutePosition, Is.EqualTo(preTeleportPosition));
391 Assert.That(sceneA.GetRootAgentCount(), Is.EqualTo(1));
392 Assert.That(sceneA.GetChildAgentCount(), Is.EqualTo(0));
393 Assert.That(sceneB.GetRootAgentCount(), Is.EqualTo(0));
394 Assert.That(sceneB.GetChildAgentCount(), Is.EqualTo(0));
416 TestHelpers.InMethod();
419 UUID userId = TestHelpers.ParseTail(0x1);
420 Vector3 preTeleportPosition =
new Vector3(30, 31, 32);
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);
432 config.AddConfig(
"EntityTransfer");
436 config.Configs[
"EntityTransfer"].Set(
"wait_for_callback",
false);
442 TestScene sceneA = sh.SetupScene(
"sceneA", TestHelpers.ParseTail(0x100), 1000, 1000);
443 TestScene sceneB = sh.SetupScene(
"sceneB", TestHelpers.ParseTail(0x200), 1002, 1000);
445 SceneHelpers.SetupSceneModules(sceneA, config, etmA );
453 SceneHelpers.SetupSceneModules(
new Scene[] { sceneA, sceneB }, config, lscm);
455 Vector3 teleportPosition =
new Vector3(10, 11, 12);
456 Vector3 teleportLookAt =
new Vector3(20, 21, 22);
458 ScenePresence sp = SceneHelpers.AddScenePresence(sceneA, userId);
459 sp.AbsolutePosition = preTeleportPosition;
461 sceneA.RequestTeleportLocation(
462 sp.ControllingClient,
463 sceneB.RegionInfo.RegionHandle,
472 Assert.That(sceneB.GetScenePresence(userId), Is.Null);
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));
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));
584 TestHelpers.InMethod();
587 UUID userId = TestHelpers.ParseTail(0x1);
593 IConfigSource config =
new IniConfigSource();
594 IConfig modulesConfig = config.AddConfig(
"Modules");
595 modulesConfig.Set(
"EntityTransferModule", etmA.Name);
596 modulesConfig.Set(
"SimulationServices", lscm.Name);
599 TestScene sceneA = sh.SetupScene(
"sceneA", TestHelpers.ParseTail(0x100), 1000, 1000);
600 TestScene sceneB = sh.SetupScene(
"sceneB", TestHelpers.ParseTail(0x200), 1001, 1000);
602 SceneHelpers.SetupSceneModules(
new Scene[] { sceneA, sceneB }, config, lscm);
606 Vector3 teleportPosition =
new Vector3(10, 11, 12);
607 Vector3 teleportLookAt =
new Vector3(20, 21, 22);
611 List<TestClient> destinationTestClients =
new List<TestClient>();
612 EntityTransferHelpers.SetupInformClientOfNeighbourTriggersNeighbourClientCreate(tc, destinationTestClients);
614 ScenePresence beforeSceneASp = SceneHelpers.AddScenePresence(sceneA, tc, acd);
615 beforeSceneASp.AbsolutePosition =
new Vector3(30, 31, 32);
617 Assert.That(beforeSceneASp, Is.Not.Null);
618 Assert.That(beforeSceneASp.IsChildAgent, Is.False);
620 ScenePresence beforeSceneBSp = sceneB.GetScenePresence(userId);
621 Assert.That(beforeSceneBSp, Is.Not.Null);
622 Assert.That(beforeSceneBSp.IsChildAgent, Is.True);
630 tc.OnTestClientSendRegionTeleport
631 += (regionHandle, simAccess, regionExternalEndPoint, locationID, flags, capsURL)
632 => ThreadPool.UnsafeQueueUserWorkItem(o => destinationTestClients[0].CompleteMovement(), null);
634 sceneA.RequestTeleportLocation(
635 beforeSceneASp.ControllingClient,
636 sceneB.RegionInfo.RegionHandle,
641 ScenePresence afterSceneASp = sceneA.GetScenePresence(userId);
642 Assert.That(afterSceneASp, Is.Not.Null);
643 Assert.That(afterSceneASp.IsChildAgent, Is.True);
645 ScenePresence afterSceneBSp = sceneB.GetScenePresence(userId);
646 Assert.That(afterSceneBSp, Is.Not.Null);
647 Assert.That(afterSceneBSp.IsChildAgent, Is.False);
648 Assert.That(afterSceneBSp.Scene.RegionInfo.RegionName, Is.EqualTo(sceneB.RegionInfo.RegionName));
649 Assert.That(afterSceneBSp.AbsolutePosition, Is.EqualTo(teleportPosition));
651 Assert.That(sceneA.GetRootAgentCount(), Is.EqualTo(0));
652 Assert.That(sceneA.GetChildAgentCount(), Is.EqualTo(1));
653 Assert.That(sceneB.GetRootAgentCount(), Is.EqualTo(1));
654 Assert.That(sceneB.GetChildAgentCount(), Is.EqualTo(0));
IClientAPI ControllingClient
OpenSim.Framework.Constants.TeleportFlags TeleportFlags
void TestSameSimulatorIsolatedRegions_DestinationDidNotProcessViewerConnection()
Test teleport when the destination region does not process (or does not receive) the connection attem...
void TestSameSimulatorIsolatedRegions_DeniedOnQueryAccess()
Test teleport procedures when the target simulator returns false when queried about access...
void TestSameSimulatorNeighbouringRegionsV2()
Circuit data for an agent. Connection information shared between regions that accept UDP connections ...
void TestSameSimulatorIsolatedRegions_DeniedOnCreateAgent()
Test teleport procedures when the target simulator create agent step is refused.
Helpers for setting up scenes.
Teleport tests in a standalone OpenSim
void TestSameSimulatorIsolatedRegionsV2()