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.cs33
1 files changed, 8 insertions, 25 deletions
diff --git a/OpenSim/Tests/Common/Mock/TestClient.cs b/OpenSim/Tests/Common/Mock/TestClient.cs
index 2714429..4a1380d 100644
--- a/OpenSim/Tests/Common/Mock/TestClient.cs
+++ b/OpenSim/Tests/Common/Mock/TestClient.cs
@@ -46,8 +46,6 @@ 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 private TestClient TeleportSceneClient;
50
51 private Scene m_scene; 49 private Scene m_scene;
52 private SceneManager m_sceneManager; 50 private SceneManager m_sceneManager;
53 51
@@ -60,6 +58,10 @@ namespace OpenSim.Tests.Common.Mock
60 public List<ImagePacketPacket> SentImagePacketPackets { get; private set; } 58 public List<ImagePacketPacket> SentImagePacketPackets { get; private set; }
61 public List<ImageNotInDatabasePacket> SentImageNotInDatabasePackets { get; private set; } 59 public List<ImageNotInDatabasePacket> SentImageNotInDatabasePackets { get; private set; }
62 60
61 // Test client specific events - for use by tests to implement some IClientAPI behaviour.
62 public event Action<RegionInfo, Vector3, Vector3> OnReceivedMoveAgentIntoRegion;
63 public event Action<ulong, IPEndPoint> OnTestClientInformClientOfNeighbour;
64
63// disable warning: public events, part of the public API 65// disable warning: public events, part of the public API
64#pragma warning disable 67 66#pragma warning disable 67
65 67
@@ -575,6 +577,8 @@ namespace OpenSim.Tests.Common.Mock
575 577
576 public virtual void MoveAgentIntoRegion(RegionInfo regInfo, Vector3 pos, Vector3 look) 578 public virtual void MoveAgentIntoRegion(RegionInfo regInfo, Vector3 pos, Vector3 look)
577 { 579 {
580 if (OnReceivedMoveAgentIntoRegion != null)
581 OnReceivedMoveAgentIntoRegion(regInfo, pos, look);
578 } 582 }
579 583
580 public virtual AgentCircuitData RequestClientInfo() 584 public virtual AgentCircuitData RequestClientInfo()
@@ -600,23 +604,8 @@ namespace OpenSim.Tests.Common.Mock
600 604
601 public virtual void InformClientOfNeighbour(ulong neighbourHandle, IPEndPoint neighbourExternalEndPoint) 605 public virtual void InformClientOfNeighbour(ulong neighbourHandle, IPEndPoint neighbourExternalEndPoint)
602 { 606 {
603 m_log.DebugFormat("[TEST CLIENT]: Processing inform client of neighbour"); 607 if (OnTestClientInformClientOfNeighbour != null)
604 608 OnTestClientInformClientOfNeighbour(neighbourHandle, neighbourExternalEndPoint);
605 // In response to this message, we are going to make a teleport to the scene we've previous been told
606 // about by test code (this needs to be improved).
607 AgentCircuitData newAgent = RequestClientInfo();
608
609 // Stage 2: add the new client as a child agent to the scene
610 uint x, y;
611 Utils.LongToUInts(neighbourHandle, out x, out y);
612 x /= Constants.RegionSize;
613 y /= Constants.RegionSize;
614
615 Scene neighbourScene;
616 m_sceneManager.TryGetScene(x, y, out neighbourScene);
617
618 TeleportSceneClient = new TestClient(newAgent, neighbourScene, m_sceneManager);
619 neighbourScene.AddNewClient(TeleportSceneClient, PresenceType.User);
620 } 609 }
621 610
622 public virtual void SendRegionTeleport(ulong regionHandle, byte simAccess, IPEndPoint regionExternalEndPoint, 611 public virtual void SendRegionTeleport(ulong regionHandle, byte simAccess, IPEndPoint regionExternalEndPoint,
@@ -631,12 +620,6 @@ namespace OpenSim.Tests.Common.Mock
631 // CompleteTeleportClientSide(); 620 // CompleteTeleportClientSide();
632 } 621 }
633 622
634 public void CompleteTeleportClientSide()
635 {
636 TeleportSceneClient.CompleteMovement();
637 //TeleportTargetScene.AgentCrossing(newAgent.AgentID, new Vector3(90, 90, 90), false);
638 }
639
640 public virtual void SendTeleportFailed(string reason) 623 public virtual void SendTeleportFailed(string reason)
641 { 624 {
642 m_log.DebugFormat("[TEST CLIENT]: Teleport failed with reason {0}", reason); 625 m_log.DebugFormat("[TEST CLIENT]: Teleport failed with reason {0}", reason);