aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Tests/Common/Mock
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Tests/Common/Mock')
-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 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 }
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