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