aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Tests/Common/Mock/TestClient.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Tests/Common/Mock/TestClient.cs')
-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 b2c824c..8cea476f 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; }
@@ -435,15 +433,29 @@ namespace OpenSim.Tests.Common.Mock
435 /// <summary> 433 /// <summary>
436 /// Constructor 434 /// Constructor
437 /// </summary> 435 /// </summary>
436 /// <remarks>
437 /// Can be used for a test where there is only one region or where there are multiple regions that are not
438 /// neighbours and where no teleporting takes place. In other situations, the constructor that takes in a
439 /// scene manager should be used.
440 /// </remarks>
438 /// <param name="agentData"></param> 441 /// <param name="agentData"></param>
439 /// <param name="scene"></param> 442 /// <param name="scene"></param>
440 public TestClient(AgentCircuitData agentData, Scene scene) 443 public TestClient(AgentCircuitData agentData, Scene scene) : this(agentData, scene, null) {}
444
445 /// <summary>
446 /// Constructor
447 /// </summary>
448 /// <param name="agentData"></param>
449 /// <param name="scene"></param>
450 /// <param name="sceneManager"></param>
451 public TestClient(AgentCircuitData agentData, Scene scene, SceneManager sceneManager)
441 { 452 {
442 m_agentId = agentData.AgentID; 453 m_agentId = agentData.AgentID;
443 m_firstName = agentData.firstname; 454 m_firstName = agentData.firstname;
444 m_lastName = agentData.lastname; 455 m_lastName = agentData.lastname;
445 m_circuitCode = agentData.circuitcode; 456 m_circuitCode = agentData.circuitcode;
446 m_scene = scene; 457 m_scene = scene;
458 m_sceneManager = sceneManager;
447 SessionId = agentData.SessionID; 459 SessionId = agentData.SessionID;
448 SecureSessionId = agentData.SecureSessionID; 460 SecureSessionId = agentData.SecureSessionID;
449 CapsSeedUrl = agentData.CapsPath; 461 CapsSeedUrl = agentData.CapsPath;
@@ -593,8 +605,16 @@ namespace OpenSim.Tests.Common.Mock
593 AgentCircuitData newAgent = RequestClientInfo(); 605 AgentCircuitData newAgent = RequestClientInfo();
594 606
595 // Stage 2: add the new client as a child agent to the scene 607 // Stage 2: add the new client as a child agent to the scene
596 TeleportSceneClient = new TestClient(newAgent, TeleportTargetScene); 608 uint x, y;
597 TeleportTargetScene.AddNewClient(TeleportSceneClient, PresenceType.User); 609 Utils.LongToUInts(neighbourHandle, out x, out y);
610 x /= Constants.RegionSize;
611 y /= Constants.RegionSize;
612
613 Scene neighbourScene;
614 m_sceneManager.TryGetScene(x, y, out neighbourScene);
615
616 TeleportSceneClient = new TestClient(newAgent, neighbourScene, m_sceneManager);
617 neighbourScene.AddNewClient(TeleportSceneClient, PresenceType.User);
598 } 618 }
599 619
600 public virtual void SendRegionTeleport(ulong regionHandle, byte simAccess, IPEndPoint regionExternalEndPoint, 620 public virtual void SendRegionTeleport(ulong regionHandle, byte simAccess, IPEndPoint regionExternalEndPoint,
@@ -604,6 +624,13 @@ namespace OpenSim.Tests.Common.Mock
604 624
605 CapsSeedUrl = capsURL; 625 CapsSeedUrl = capsURL;
606 626
627 // We don't do this here so that the source region can complete processing first in a single-threaded
628 // regression test scenario. The test itself will have to call CompleteTeleportClientSide() after a teleport
629 // CompleteTeleportClientSide();
630 }
631
632 public void CompleteTeleportClientSide()
633 {
607 TeleportSceneClient.CompleteMovement(); 634 TeleportSceneClient.CompleteMovement();
608 //TeleportTargetScene.AgentCrossing(newAgent.AgentID, new Vector3(90, 90, 90), false); 635 //TeleportTargetScene.AgentCrossing(newAgent.AgentID, new Vector3(90, 90, 90), false);
609 } 636 }