aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Tests/Common/Mock
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2012-05-01 23:14:12 +0100
committerJustin Clark-Casey (justincc)2012-05-01 23:14:12 +0100
commit9d2e1c67a8969e4769006c7347505b58a7827b3f (patch)
tree1fb6d412e2d8a753e1b59af46f6ada0a45556e75 /OpenSim/Tests/Common/Mock
parentMove max teleport distance check down into etm.DoTeleport() since this should... (diff)
downloadopensim-SC_OLD-9d2e1c67a8969e4769006c7347505b58a7827b3f.zip
opensim-SC_OLD-9d2e1c67a8969e4769006c7347505b58a7827b3f.tar.gz
opensim-SC_OLD-9d2e1c67a8969e4769006c7347505b58a7827b3f.tar.bz2
opensim-SC_OLD-9d2e1c67a8969e4769006c7347505b58a7827b3f.tar.xz
Add regression test for teleporting between neighbouring regions on the same simulator
This adds a non-advertised wait_for_callback option in [EntityTransfer]. Default is always true. Teleport tests disable the wait for callback from the destination region in order to run within a single thread.
Diffstat (limited to 'OpenSim/Tests/Common/Mock')
-rw-r--r--OpenSim/Tests/Common/Mock/TestClient.cs39
1 files changed, 33 insertions, 6 deletions
diff --git a/OpenSim/Tests/Common/Mock/TestClient.cs b/OpenSim/Tests/Common/Mock/TestClient.cs
index cb9840e..36049a1 100644
--- a/OpenSim/Tests/Common/Mock/TestClient.cs
+++ b/OpenSim/Tests/Common/Mock/TestClient.cs
@@ -46,12 +46,10 @@ namespace OpenSim.Tests.Common.Mock
46 46
47 EventWaitHandle wh = new EventWaitHandle (false, EventResetMode.AutoReset, "Crossing"); 47 EventWaitHandle wh = new EventWaitHandle (false, EventResetMode.AutoReset, "Crossing");
48 48
49 // TODO: This is a really nasty (and temporary) means of telling the test client which scene to invoke setup
50 // methods on when a teleport is requested
51 public Scene TeleportTargetScene;
52 private TestClient TeleportSceneClient; 49 private TestClient TeleportSceneClient;
53 50
54 private Scene m_scene; 51 private Scene m_scene;
52 private SceneManager m_sceneManager;
55 53
56 // Properties so that we can get at received data for test purposes 54 // Properties so that we can get at received data for test purposes
57 public List<UUID> ReceivedOfflineNotifications { get; private set; } 55 public List<UUID> ReceivedOfflineNotifications { get; private set; }
@@ -432,15 +430,29 @@ namespace OpenSim.Tests.Common.Mock
432 /// <summary> 430 /// <summary>
433 /// Constructor 431 /// Constructor
434 /// </summary> 432 /// </summary>
433 /// <remarks>
434 /// Can be used for a test where there is only one region or where there are multiple regions that are not
435 /// neighbours and where no teleporting takes place. In other situations, the constructor that takes in a
436 /// scene manager should be used.
437 /// </remarks>
435 /// <param name="agentData"></param> 438 /// <param name="agentData"></param>
436 /// <param name="scene"></param> 439 /// <param name="scene"></param>
437 public TestClient(AgentCircuitData agentData, Scene scene) 440 public TestClient(AgentCircuitData agentData, Scene scene) : this(agentData, scene, null) {}
441
442 /// <summary>
443 /// Constructor
444 /// </summary>
445 /// <param name="agentData"></param>
446 /// <param name="scene"></param>
447 /// <param name="sceneManager"></param>
448 public TestClient(AgentCircuitData agentData, Scene scene, SceneManager sceneManager)
438 { 449 {
439 m_agentId = agentData.AgentID; 450 m_agentId = agentData.AgentID;
440 m_firstName = agentData.firstname; 451 m_firstName = agentData.firstname;
441 m_lastName = agentData.lastname; 452 m_lastName = agentData.lastname;
442 m_circuitCode = agentData.circuitcode; 453 m_circuitCode = agentData.circuitcode;
443 m_scene = scene; 454 m_scene = scene;
455 m_sceneManager = sceneManager;
444 SessionId = agentData.SessionID; 456 SessionId = agentData.SessionID;
445 SecureSessionId = agentData.SecureSessionID; 457 SecureSessionId = agentData.SecureSessionID;
446 CapsSeedUrl = agentData.CapsPath; 458 CapsSeedUrl = agentData.CapsPath;
@@ -590,8 +602,16 @@ namespace OpenSim.Tests.Common.Mock
590 AgentCircuitData newAgent = RequestClientInfo(); 602 AgentCircuitData newAgent = RequestClientInfo();
591 603
592 // Stage 2: add the new client as a child agent to the scene 604 // Stage 2: add the new client as a child agent to the scene
593 TeleportSceneClient = new TestClient(newAgent, TeleportTargetScene); 605 uint x, y;
594 TeleportTargetScene.AddNewClient(TeleportSceneClient, PresenceType.User); 606 Utils.LongToUInts(neighbourHandle, out x, out y);
607 x /= Constants.RegionSize;
608 y /= Constants.RegionSize;
609
610 Scene neighbourScene;
611 m_sceneManager.TryGetScene(x, y, out neighbourScene);
612
613 TeleportSceneClient = new TestClient(newAgent, neighbourScene, m_sceneManager);
614 neighbourScene.AddNewClient(TeleportSceneClient, PresenceType.User);
595 } 615 }
596 616
597 public virtual void SendRegionTeleport(ulong regionHandle, byte simAccess, IPEndPoint regionExternalEndPoint, 617 public virtual void SendRegionTeleport(ulong regionHandle, byte simAccess, IPEndPoint regionExternalEndPoint,
@@ -601,6 +621,13 @@ namespace OpenSim.Tests.Common.Mock
601 621
602 CapsSeedUrl = capsURL; 622 CapsSeedUrl = capsURL;
603 623
624 // We don't do this here so that the source region can complete processing first in a single-threaded
625 // regression test scenario. The test itself will have to call CompleteTeleportClientSide() after a teleport
626 // CompleteTeleportClientSide();
627 }
628
629 public void CompleteTeleportClientSide()
630 {
604 TeleportSceneClient.CompleteMovement(); 631 TeleportSceneClient.CompleteMovement();
605 //TeleportTargetScene.AgentCrossing(newAgent.AgentID, new Vector3(90, 90, 90), false); 632 //TeleportTargetScene.AgentCrossing(newAgent.AgentID, new Vector3(90, 90, 90), false);
606 } 633 }