aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Tests
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2013-03-20 23:01:16 +0000
committerJustin Clark-Casey (justincc)2013-03-20 23:01:16 +0000
commit36651bed71ce1011c376078943a4fef7e8a9ada6 (patch)
tree61ca34a4595fa0d43990e29fa60e2f7962ca5189 /OpenSim/Tests
parentInsert a short delay on the simulator side rezzing of attachments in order to... (diff)
downloadopensim-SC_OLD-36651bed71ce1011c376078943a4fef7e8a9ada6.zip
opensim-SC_OLD-36651bed71ce1011c376078943a4fef7e8a9ada6.tar.gz
opensim-SC_OLD-36651bed71ce1011c376078943a4fef7e8a9ada6.tar.bz2
opensim-SC_OLD-36651bed71ce1011c376078943a4fef7e8a9ada6.tar.xz
On the later forms of teleport failure, tell the user if this was because viewer couldn't/didn't connect with destination or if destination didn't signal teleport completion.
Also adds regression test for the case where the viewer couldn't connect with the destination region. Also refactoring of regression test support code associated with entity transfer in order to make this test possible and the code less obscure.
Diffstat (limited to 'OpenSim/Tests')
-rw-r--r--OpenSim/Tests/Common/Helpers/SceneHelpers.cs37
-rw-r--r--OpenSim/Tests/Common/Mock/TestClient.cs29
2 files changed, 35 insertions, 31 deletions
diff --git a/OpenSim/Tests/Common/Helpers/SceneHelpers.cs b/OpenSim/Tests/Common/Helpers/SceneHelpers.cs
index dc20f13..bdd9093 100644
--- a/OpenSim/Tests/Common/Helpers/SceneHelpers.cs
+++ b/OpenSim/Tests/Common/Helpers/SceneHelpers.cs
@@ -532,6 +532,31 @@ namespace OpenSim.Tests.Common
532 /// <returns></returns> 532 /// <returns></returns>
533 public static ScenePresence AddScenePresence(Scene scene, AgentCircuitData agentData, SceneManager sceneManager) 533 public static ScenePresence AddScenePresence(Scene scene, AgentCircuitData agentData, SceneManager sceneManager)
534 { 534 {
535 return AddScenePresence(scene, new TestClient(agentData, scene, sceneManager), agentData, sceneManager);
536 }
537
538 /// <summary>
539 /// Add a root agent.
540 /// </summary>
541 /// <remarks>
542 /// This function
543 ///
544 /// 1) Tells the scene that an agent is coming. Normally, the login service (local if standalone, from the
545 /// userserver if grid) would give initial login data back to the client and separately tell the scene that the
546 /// agent was coming.
547 ///
548 /// 2) Connects the agent with the scene
549 ///
550 /// This function performs actions equivalent with notifying the scene that an agent is
551 /// coming and then actually connecting the agent to the scene. The one step missed out is the very first
552 /// </remarks>
553 /// <param name="scene"></param>
554 /// <param name="agentData"></param>
555 /// <param name="sceneManager"></param>
556 /// <returns></returns>
557 public static ScenePresence AddScenePresence(
558 Scene scene, IClientAPI client, AgentCircuitData agentData, SceneManager sceneManager)
559 {
535 // We emulate the proper login sequence here by doing things in four stages 560 // We emulate the proper login sequence here by doing things in four stages
536 561
537 // Stage 0: login 562 // Stage 0: login
@@ -541,7 +566,7 @@ namespace OpenSim.Tests.Common
541 lpsc.m_PresenceService.LoginAgent(agentData.AgentID.ToString(), agentData.SessionID, agentData.SecureSessionID); 566 lpsc.m_PresenceService.LoginAgent(agentData.AgentID.ToString(), agentData.SessionID, agentData.SecureSessionID);
542 567
543 // Stages 1 & 2 568 // Stages 1 & 2
544 ScenePresence sp = IntroduceClientToScene(scene, sceneManager, agentData, TeleportFlags.ViaLogin); 569 ScenePresence sp = IntroduceClientToScene(scene, client, agentData, TeleportFlags.ViaLogin);
545 570
546 // Stage 3: Complete the entrance into the region. This converts the child agent into a root agent. 571 // Stage 3: Complete the entrance into the region. This converts the child agent into a root agent.
547 sp.CompleteMovement(sp.ControllingClient, true); 572 sp.CompleteMovement(sp.ControllingClient, true);
@@ -558,11 +583,11 @@ namespace OpenSim.Tests.Common
558 /// neighbours and where no teleporting takes place. 583 /// neighbours and where no teleporting takes place.
559 /// </param> 584 /// </param>
560 /// <param name='scene'></param> 585 /// <param name='scene'></param>
561 /// <param name='sceneManager></param> 586 /// <param name='testClient'></param>
562 /// <param name='agentData'></param> 587 /// <param name='agentData'></param>
563 /// <param name='tf'></param> 588 /// <param name='tf'></param>
564 private static ScenePresence IntroduceClientToScene( 589 private static ScenePresence IntroduceClientToScene(
565 Scene scene, SceneManager sceneManager, AgentCircuitData agentData, TeleportFlags tf) 590 Scene scene, IClientAPI client, AgentCircuitData agentData, TeleportFlags tf)
566 { 591 {
567 string reason; 592 string reason;
568 593
@@ -571,10 +596,9 @@ namespace OpenSim.Tests.Common
571 Console.WriteLine("NewUserConnection failed: " + reason); 596 Console.WriteLine("NewUserConnection failed: " + reason);
572 597
573 // Stage 2: add the new client as a child agent to the scene 598 // Stage 2: add the new client as a child agent to the scene
574 TestClient client = new TestClient(agentData, scene, sceneManager);
575 scene.AddNewClient(client, PresenceType.User); 599 scene.AddNewClient(client, PresenceType.User);
576 600
577 return scene.GetScenePresence(agentData.AgentID); 601 return scene.GetScenePresence(client.AgentId);
578 } 602 }
579 603
580 public static ScenePresence AddChildScenePresence(Scene scene, UUID agentId) 604 public static ScenePresence AddChildScenePresence(Scene scene, UUID agentId)
@@ -583,7 +607,8 @@ namespace OpenSim.Tests.Common
583 acd.child = true; 607 acd.child = true;
584 608
585 // XXX: ViaLogin may not be correct for child agents 609 // XXX: ViaLogin may not be correct for child agents
586 return IntroduceClientToScene(scene, null, acd, TeleportFlags.ViaLogin); 610 TestClient client = new TestClient(acd, scene, null);
611 return IntroduceClientToScene(scene, client, acd, TeleportFlags.ViaLogin);
587 } 612 }
588 613
589 /// <summary> 614 /// <summary>
diff --git a/OpenSim/Tests/Common/Mock/TestClient.cs b/OpenSim/Tests/Common/Mock/TestClient.cs
index a448cc5..2d4fef1 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,7 +58,9 @@ 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.
63 public event Action<RegionInfo, Vector3, Vector3> OnReceivedMoveAgentIntoRegion; 62 public event Action<RegionInfo, Vector3, Vector3> OnReceivedMoveAgentIntoRegion;
63 public event Action<ulong, IPEndPoint> OnTestClientInformClientOfNeighbour;
64 64
65// disable warning: public events, part of the public API 65// disable warning: public events, part of the public API
66#pragma warning disable 67 66#pragma warning disable 67
@@ -595,23 +595,8 @@ namespace OpenSim.Tests.Common.Mock
595 595
596 public virtual void InformClientOfNeighbour(ulong neighbourHandle, IPEndPoint neighbourExternalEndPoint) 596 public virtual void InformClientOfNeighbour(ulong neighbourHandle, IPEndPoint neighbourExternalEndPoint)
597 { 597 {
598 m_log.DebugFormat("[TEST CLIENT]: Processing inform client of neighbour"); 598 if (OnTestClientInformClientOfNeighbour != null)
599 599 OnTestClientInformClientOfNeighbour(neighbourHandle, neighbourExternalEndPoint);
600 // In response to this message, we are going to make a teleport to the scene we've previous been told
601 // about by test code (this needs to be improved).
602 AgentCircuitData newAgent = RequestClientInfo();
603
604 // Stage 2: add the new client as a child agent to the scene
605 uint x, y;
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);
615 } 600 }
616 601
617 public virtual void SendRegionTeleport(ulong regionHandle, byte simAccess, IPEndPoint regionExternalEndPoint, 602 public virtual void SendRegionTeleport(ulong regionHandle, byte simAccess, IPEndPoint regionExternalEndPoint,
@@ -626,12 +611,6 @@ namespace OpenSim.Tests.Common.Mock
626 // CompleteTeleportClientSide(); 611 // CompleteTeleportClientSide();
627 } 612 }
628 613
629 public void CompleteTeleportClientSide()
630 {
631 TeleportSceneClient.CompleteMovement();
632 //TeleportTargetScene.AgentCrossing(newAgent.AgentID, new Vector3(90, 90, 90), false);
633 }
634
635 public virtual void SendTeleportFailed(string reason) 614 public virtual void SendTeleportFailed(string reason)
636 { 615 {
637 m_log.DebugFormat("[TEST CLIENT]: Teleport failed with reason {0}", reason); 616 m_log.DebugFormat("[TEST CLIENT]: Teleport failed with reason {0}", reason);