diff options
Diffstat (limited to 'OpenSim/Tests/Common/Mock')
-rw-r--r-- | OpenSim/Tests/Common/Mock/TestClient.cs | 39 |
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 | } |