aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Tests/Common/Mock
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Tests/Common/Mock/TestClient.cs39
-rw-r--r--OpenSim/Tests/Common/Mock/TestLandChannel.cs17
2 files changed, 43 insertions, 13 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 }
diff --git a/OpenSim/Tests/Common/Mock/TestLandChannel.cs b/OpenSim/Tests/Common/Mock/TestLandChannel.cs
index 0e4dfb9..4b4d52d 100644
--- a/OpenSim/Tests/Common/Mock/TestLandChannel.cs
+++ b/OpenSim/Tests/Common/Mock/TestLandChannel.cs
@@ -46,6 +46,14 @@ namespace OpenSim.Tests.Common.Mock
46 { 46 {
47 m_scene = scene; 47 m_scene = scene;
48 m_parcels = new List<ILandObject>(); 48 m_parcels = new List<ILandObject>();
49 SetupDefaultParcel();
50 }
51
52 private void SetupDefaultParcel()
53 {
54 ILandObject obj = new LandObject(UUID.Zero, false, m_scene);
55 obj.LandData.Name = "Your Parcel";
56 m_parcels.Add(obj);
49 } 57 }
50 58
51 public List<ILandObject> ParcelsNearPoint(Vector3 position) 59 public List<ILandObject> ParcelsNearPoint(Vector3 position)
@@ -63,11 +71,7 @@ namespace OpenSim.Tests.Common.Mock
63 m_parcels.Clear(); 71 m_parcels.Clear();
64 72
65 if (setupDefaultParcel) 73 if (setupDefaultParcel)
66 { 74 SetupDefaultParcel();
67 ILandObject obj = new LandObject(UUID.Zero, false, m_scene);
68 obj.LandData.Name = "Your Parcel";
69 m_parcels.Add(obj);
70 }
71 } 75 }
72 76
73 protected ILandObject GetNoLand() 77 protected ILandObject GetNoLand()
@@ -102,6 +106,5 @@ namespace OpenSim.Tests.Common.Mock
102 106
103 public void Join(int start_x, int start_y, int end_x, int end_y, UUID attempting_user_id) {} 107 public void Join(int start_x, int start_y, int end_x, int end_y, UUID attempting_user_id) {}
104 public void Subdivide(int start_x, int start_y, int end_x, int end_y, UUID attempting_user_id) {} 108 public void Subdivide(int start_x, int start_y, int end_x, int end_y, UUID attempting_user_id) {}
105
106 } 109 }
107} 110} \ No newline at end of file