aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJustin Clarke Casey2009-01-16 21:56:13 +0000
committerJustin Clarke Casey2009-01-16 21:56:13 +0000
commiteca6442bae4093019bd221e87413c74c77c4ff5d (patch)
treee62245b1cf2a5f0afdde443fba38c2b62d401100
parent* minor: Future archiver test stub (diff)
downloadopensim-SC-eca6442bae4093019bd221e87413c74c77c4ff5d.zip
opensim-SC-eca6442bae4093019bd221e87413c74c77c4ff5d.tar.gz
opensim-SC-eca6442bae4093019bd221e87413c74c77c4ff5d.tar.bz2
opensim-SC-eca6442bae4093019bd221e87413c74c77c4ff5d.tar.xz
* Rig up enough infrastructure to actually perform a successful 'standalone' teleport unit test with checks that the scene presence disappeared from sceneA and appeared in
sceneB * However, I'm not convinced that the actual process in the test completely reflects reality, and a lot of stuff had to be rigged up (which should get resolved over time)
-rw-r--r--OpenSim/Framework/ConfigurationMember.cs2
-rw-r--r--OpenSim/Framework/IClientAPI.cs7
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs4
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/Tests/PacketHandlerTests.cs5
-rw-r--r--OpenSim/Region/Environment/Modules/Agent/TextureSender/Tests/TextureSenderTests.cs2
-rw-r--r--OpenSim/Region/Environment/Modules/Communications/Local/LocalInterregionComms.cs9
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs11
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs4
-rw-r--r--OpenSim/Region/Environment/Scenes/ScenePresence.cs6
-rw-r--r--OpenSim/Region/Environment/Scenes/Tests/ScenePresenceTests.cs2
-rw-r--r--OpenSim/Region/Environment/Scenes/Tests/SceneTestUtils.cs2
-rw-r--r--OpenSim/Region/Environment/Scenes/Tests/StandaloneTeleportTests.cs10
-rw-r--r--OpenSim/Tests/Common/Mock/TestClient.cs79
-rw-r--r--prebuild.xml1
14 files changed, 104 insertions, 40 deletions
diff --git a/OpenSim/Framework/ConfigurationMember.cs b/OpenSim/Framework/ConfigurationMember.cs
index 7a5e6b2..b54aafb 100644
--- a/OpenSim/Framework/ConfigurationMember.cs
+++ b/OpenSim/Framework/ConfigurationMember.cs
@@ -179,7 +179,7 @@ namespace OpenSim.Framework
179 return; 179 return;
180 } 180 }
181 181
182 m_log.Info("[CONFIG]: Calling Configuration Load Function..."); 182 //m_log.Debug("[CONFIG]: Calling Configuration Load Function...");
183 loadFunction(); 183 loadFunction();
184 184
185 if (configurationOptions.Count <= 0) 185 if (configurationOptions.Count <= 0)
diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs
index 0d44abd..63c09fe 100644
--- a/OpenSim/Framework/IClientAPI.cs
+++ b/OpenSim/Framework/IClientAPI.cs
@@ -814,7 +814,12 @@ namespace OpenSim.Framework
814 void SendWindData(Vector2[] windSpeeds); 814 void SendWindData(Vector2[] windSpeeds);
815 815
816 void MoveAgentIntoRegion(RegionInfo regInfo, Vector3 pos, Vector3 look); 816 void MoveAgentIntoRegion(RegionInfo regInfo, Vector3 pos, Vector3 look);
817 void InformClientOfNeighbour(ulong neighbourHandle, IPEndPoint neighbourExternalEndPoint); 817 void InformClientOfNeighbour(ulong neighbourHandle, IPEndPoint neighbourExternalEndPoint);
818
819 /// <summary>
820 /// Return circuit information for this client.
821 /// </summary>
822 /// <returns></returns>
818 AgentCircuitData RequestClientInfo(); 823 AgentCircuitData RequestClientInfo();
819 824
820 void CrossRegion(ulong newRegionHandle, Vector3 pos, Vector3 lookAt, IPEndPoint newRegionExternalEndPoint, 825 void CrossRegion(ulong newRegionHandle, Vector3 pos, Vector3 lookAt, IPEndPoint newRegionExternalEndPoint,
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index 30f6f0f..146bc63 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -1366,10 +1366,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1366 OutPacket(enablesimpacket, ThrottleOutPacketType.Task); 1366 OutPacket(enablesimpacket, ThrottleOutPacketType.Task);
1367 } 1367 }
1368 1368
1369 /// <summary>
1370 ///
1371 /// </summary>
1372 /// <returns></returns>
1373 public AgentCircuitData RequestClientInfo() 1369 public AgentCircuitData RequestClientInfo()
1374 { 1370 {
1375 AgentCircuitData agentData = new AgentCircuitData(); 1371 AgentCircuitData agentData = new AgentCircuitData();
diff --git a/OpenSim/Region/ClientStack/LindenUDP/Tests/PacketHandlerTests.cs b/OpenSim/Region/ClientStack/LindenUDP/Tests/PacketHandlerTests.cs
index 62e6e96..d421f82 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/Tests/PacketHandlerTests.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/Tests/PacketHandlerTests.cs
@@ -64,9 +64,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
64 TestLLUDPServer testLLUDPServer; 64 TestLLUDPServer testLLUDPServer;
65 TestLLPacketServer testLLPacketServer; 65 TestLLPacketServer testLLPacketServer;
66 AgentCircuitManager acm; 66 AgentCircuitManager acm;
67 SetupStack(new MockScene(), out testLLUDPServer, out testLLPacketServer, out acm); 67 IScene scene = new MockScene();
68 SetupStack(scene, out testLLUDPServer, out testLLPacketServer, out acm);
68 69
69 TestClient testClient = new TestClient(agent); 70 TestClient testClient = new TestClient(agent, scene);
70 71
71 ILLPacketHandler packetHandler 72 ILLPacketHandler packetHandler
72 = new LLPacketHandler(testClient, testLLPacketServer, new ClientStackUserSettings()); 73 = new LLPacketHandler(testClient, testLLPacketServer, new ClientStackUserSettings());
diff --git a/OpenSim/Region/Environment/Modules/Agent/TextureSender/Tests/TextureSenderTests.cs b/OpenSim/Region/Environment/Modules/Agent/TextureSender/Tests/TextureSenderTests.cs
index 42a4e91..cfac868 100644
--- a/OpenSim/Region/Environment/Modules/Agent/TextureSender/Tests/TextureSenderTests.cs
+++ b/OpenSim/Region/Environment/Modules/Agent/TextureSender/Tests/TextureSenderTests.cs
@@ -61,7 +61,7 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureSender
61 agent.InventoryFolder = UUID.Zero; 61 agent.InventoryFolder = UUID.Zero;
62 agent.startpos = Vector3.Zero; 62 agent.startpos = Vector3.Zero;
63 agent.CapsPath = "http://wibble.com"; 63 agent.CapsPath = "http://wibble.com";
64 client = new TestClient(agent); 64 client = new TestClient(agent, null);
65 ts = new TextureSender(client, 0, 0); 65 ts = new TextureSender(client, 0, 0);
66 testsize = random.Next(5000,15000); 66 testsize = random.Next(5000,15000);
67 npackets = CalculateNumPackets(testsize); 67 npackets = CalculateNumPackets(testsize);
diff --git a/OpenSim/Region/Environment/Modules/Communications/Local/LocalInterregionComms.cs b/OpenSim/Region/Environment/Modules/Communications/Local/LocalInterregionComms.cs
index 5fcb4bc..62f6df0 100644
--- a/OpenSim/Region/Environment/Modules/Communications/Local/LocalInterregionComms.cs
+++ b/OpenSim/Region/Environment/Modules/Communications/Local/LocalInterregionComms.cs
@@ -128,6 +128,7 @@ namespace OpenSim.Region.Environment.Modules.Communications.Local
128 return true; 128 return true;
129 } 129 }
130 } 130 }
131
131// m_log.DebugFormat("[LOCAL COMMS]: Did not find region {0} for SendCreateChildAgent", regionHandle); 132// m_log.DebugFormat("[LOCAL COMMS]: Did not find region {0} for SendCreateChildAgent", regionHandle);
132 return false; 133 return false;
133 } 134 }
@@ -138,12 +139,16 @@ namespace OpenSim.Region.Environment.Modules.Communications.Local
138 { 139 {
139 if (s.RegionInfo.RegionHandle == regionHandle) 140 if (s.RegionInfo.RegionHandle == regionHandle)
140 { 141 {
141 //m_log.Debug("[LOCAL COMMS]: Found region to send ChildAgentUpdate"); 142 //m_log.DebugFormat(
143 // "[LOCAL COMMS]: Found region {0} {1} to send ChildAgentUpdate",
144 // s.RegionInfo.RegionName, regionHandle);
145
142 s.IncomingChildAgentDataUpdate(cAgentData); 146 s.IncomingChildAgentDataUpdate(cAgentData);
143 return true; 147 return true;
144 } 148 }
145 } 149 }
146 //m_log.Debug("[LOCAL COMMS]: region not found for ChildAgentUpdate"); 150
151// m_log.DebugFormat("[LOCAL COMMS]: Did not find region {0} for ChildAgentUpdate", regionHandle);
147 return false; 152 return false;
148 } 153 }
149 154
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index 9c3aa96..8a9d295 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -2777,7 +2777,7 @@ namespace OpenSim.Region.Environment.Scenes
2777 2777
2778 // Don't disable this log message - it's too helpful 2778 // Don't disable this log message - it's too helpful
2779 m_log.DebugFormat( 2779 m_log.DebugFormat(
2780 "[CONNECTION BEGIN]: Scene {0} told of incoming client {1} {2} {3} (circuit code {4})", 2780 "[CONNECTION BEGIN]: Region {0} told of incoming client {1} {2} {3} (circuit code {4})",
2781 RegionInfo.RegionName, agent.firstname, agent.lastname, agent.AgentID, agent.circuitcode); 2781 RegionInfo.RegionName, agent.firstname, agent.lastname, agent.AgentID, agent.circuitcode);
2782 2782
2783 if (m_regInfo.EstateSettings.IsBanned(agent.AgentID)) 2783 if (m_regInfo.EstateSettings.IsBanned(agent.AgentID))
@@ -2977,13 +2977,16 @@ namespace OpenSim.Region.Environment.Scenes
2977 2977
2978 public virtual bool IncomingChildAgentDataUpdate(AgentData cAgentData) 2978 public virtual bool IncomingChildAgentDataUpdate(AgentData cAgentData)
2979 { 2979 {
2980 //Console.WriteLine(" XXX Scene IncomingChildAgentDataUpdate FULL in " + RegionInfo.RegionName); 2980// m_log.DebugFormat(
2981// "[SCENE]: Incoming child agent update for {0} in {1}", cAgentData.AgentID, RegionInfo.RegionName);
2982
2981 ScenePresence childAgentUpdate = GetScenePresence(cAgentData.AgentID); 2983 ScenePresence childAgentUpdate = GetScenePresence(cAgentData.AgentID);
2982 if (childAgentUpdate != null) 2984 if (childAgentUpdate != null)
2983 { 2985 {
2984 childAgentUpdate.ChildAgentDataUpdate(cAgentData); 2986 childAgentUpdate.ChildAgentDataUpdate(cAgentData);
2985 return true; 2987 return true;
2986 } 2988 }
2989
2987 return false; 2990 return false;
2988 } 2991 }
2989 2992
@@ -3030,6 +3033,8 @@ namespace OpenSim.Region.Environment.Scenes
3030 /// <param name="agentID"></param> 3033 /// <param name="agentID"></param>
3031 public bool IncomingCloseAgent(UUID agentID) 3034 public bool IncomingCloseAgent(UUID agentID)
3032 { 3035 {
3036 //m_log.DebugFormat("[SCENE]: Processing incoming close agent for {0}", agentID);
3037
3033 ScenePresence presence = m_sceneGraph.GetScenePresence(agentID); 3038 ScenePresence presence = m_sceneGraph.GetScenePresence(agentID);
3034 if (presence != null) 3039 if (presence != null)
3035 { 3040 {
@@ -3056,9 +3061,11 @@ namespace OpenSim.Region.Environment.Scenes
3056 else 3061 else
3057 presence.ControllingClient.SendShutdownConnectionNotice(); 3062 presence.ControllingClient.SendShutdownConnectionNotice();
3058 } 3063 }
3064
3059 presence.ControllingClient.Close(true); 3065 presence.ControllingClient.Close(true);
3060 return true; 3066 return true;
3061 } 3067 }
3068
3062 // Agent not here 3069 // Agent not here
3063 return false; 3070 return false;
3064 } 3071 }
diff --git a/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs
index 65e62ef..a46fa0b 100644
--- a/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs
@@ -758,6 +758,7 @@ namespace OpenSim.Region.Environment.Scenes
758 // both regions 758 // both regions
759 if (avatar.ParentID != (uint)0) 759 if (avatar.ParentID != (uint)0)
760 avatar.StandUp(); 760 avatar.StandUp();
761
761 if (!avatar.ValidateAttachments()) 762 if (!avatar.ValidateAttachments())
762 { 763 {
763 avatar.ControllingClient.SendTeleportFailed("Inconsistent attachment state"); 764 avatar.ControllingClient.SendTeleportFailed("Inconsistent attachment state");
@@ -772,13 +773,13 @@ namespace OpenSim.Region.Environment.Scenes
772 // once we reach here... 773 // once we reach here...
773 //avatar.Scene.RemoveCapsHandler(avatar.UUID); 774 //avatar.Scene.RemoveCapsHandler(avatar.UUID);
774 775
775
776 string capsPath = String.Empty; 776 string capsPath = String.Empty;
777 AgentCircuitData agentCircuit = avatar.ControllingClient.RequestClientInfo(); 777 AgentCircuitData agentCircuit = avatar.ControllingClient.RequestClientInfo();
778 agentCircuit.BaseFolder = UUID.Zero; 778 agentCircuit.BaseFolder = UUID.Zero;
779 agentCircuit.InventoryFolder = UUID.Zero; 779 agentCircuit.InventoryFolder = UUID.Zero;
780 agentCircuit.startpos = position; 780 agentCircuit.startpos = position;
781 agentCircuit.child = true; 781 agentCircuit.child = true;
782
782 if (Util.IsOutsideView(oldRegionX, newRegionX, oldRegionY, newRegionY)) 783 if (Util.IsOutsideView(oldRegionX, newRegionX, oldRegionY, newRegionY))
783 { 784 {
784 // brand new agent, let's create a new caps seed 785 // brand new agent, let's create a new caps seed
@@ -871,7 +872,6 @@ namespace OpenSim.Region.Environment.Scenes
871 teleportFlags, capsPath); 872 teleportFlags, capsPath);
872 } 873 }
873 874
874
875 // TeleportFinish makes the client send CompleteMovementIntoRegion (at the destination), which 875 // TeleportFinish makes the client send CompleteMovementIntoRegion (at the destination), which
876 // trigers a whole shebang of things there, including MakeRoot. So let's wait for confirmation 876 // trigers a whole shebang of things there, including MakeRoot. So let's wait for confirmation
877 // that the client contacted the destination before we send the attachments and close things here. 877 // that the client contacted the destination before we send the attachments and close things here.
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
index bdb0836..77d5b93 100644
--- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
@@ -1017,9 +1017,12 @@ namespace OpenSim.Region.Environment.Scenes
1017 1017
1018 if ((m_callbackURI != null) && !m_callbackURI.Equals("")) 1018 if ((m_callbackURI != null) && !m_callbackURI.Equals(""))
1019 { 1019 {
1020 //m_log.DebugFormat("Found callback URI {0}", m_callbackURI);
1020 Scene.SendReleaseAgent(m_rootRegionHandle, UUID, m_callbackURI); 1021 Scene.SendReleaseAgent(m_rootRegionHandle, UUID, m_callbackURI);
1021 m_callbackURI = null; 1022 m_callbackURI = null;
1022 } 1023 }
1024
1025 //m_log.DebugFormat("Completed movement");
1023 } 1026 }
1024 } 1027 }
1025 1028
@@ -2594,7 +2597,6 @@ namespace OpenSim.Region.Environment.Scenes
2594 /// </summary> 2597 /// </summary>
2595 public void ChildAgentDataUpdate(AgentPosition cAgentData, uint tRegionX, uint tRegionY, uint rRegionX, uint rRegionY) 2598 public void ChildAgentDataUpdate(AgentPosition cAgentData, uint tRegionX, uint tRegionY, uint rRegionX, uint rRegionY)
2596 { 2599 {
2597 //
2598 if (!IsChildAgent) 2600 if (!IsChildAgent)
2599 return; 2601 return;
2600 2602
@@ -2615,7 +2617,6 @@ namespace OpenSim.Region.Environment.Scenes
2615 if ((cAgentData.Throttles != null) && cAgentData.Throttles.Length > 0) 2617 if ((cAgentData.Throttles != null) && cAgentData.Throttles.Length > 0)
2616 ControllingClient.SetChildAgentThrottle(cAgentData.Throttles); 2618 ControllingClient.SetChildAgentThrottle(cAgentData.Throttles);
2617 2619
2618
2619 // Sends out the objects in the user's draw distance if m_sendTasksToChild is true. 2620 // Sends out the objects in the user's draw distance if m_sendTasksToChild is true.
2620 if (m_scene.m_seeIntoRegionFromNeighbor) 2621 if (m_scene.m_seeIntoRegionFromNeighbor)
2621 m_pendingObjects = null; 2622 m_pendingObjects = null;
@@ -2662,7 +2663,6 @@ namespace OpenSim.Region.Environment.Scenes
2662 cAgent.ControlFlags |= (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY; 2663 cAgent.ControlFlags |= (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY;
2663 } 2664 }
2664 2665
2665
2666 cAgent.GodLevel = (byte)m_godlevel; 2666 cAgent.GodLevel = (byte)m_godlevel;
2667 cAgent.AlwaysRun = m_setAlwaysRun; 2667 cAgent.AlwaysRun = m_setAlwaysRun;
2668 2668
diff --git a/OpenSim/Region/Environment/Scenes/Tests/ScenePresenceTests.cs b/OpenSim/Region/Environment/Scenes/Tests/ScenePresenceTests.cs
index 548fea9..5ce78a3 100644
--- a/OpenSim/Region/Environment/Scenes/Tests/ScenePresenceTests.cs
+++ b/OpenSim/Region/Environment/Scenes/Tests/ScenePresenceTests.cs
@@ -63,7 +63,7 @@ namespace OpenSim.Region.Environment.Scenes.Tests
63 agent.CapsPath = "http://wibble.com"; 63 agent.CapsPath = "http://wibble.com";
64 64
65 scene.NewUserConnection(agent); 65 scene.NewUserConnection(agent);
66 scene.AddNewClient(new TestClient(agent)); 66 scene.AddNewClient(new TestClient(agent, scene));
67 67
68 ScenePresence presence = scene.GetScenePresence(agentId); 68 ScenePresence presence = scene.GetScenePresence(agentId);
69 69
diff --git a/OpenSim/Region/Environment/Scenes/Tests/SceneTestUtils.cs b/OpenSim/Region/Environment/Scenes/Tests/SceneTestUtils.cs
index 3c4049d..5fa897c 100644
--- a/OpenSim/Region/Environment/Scenes/Tests/SceneTestUtils.cs
+++ b/OpenSim/Region/Environment/Scenes/Tests/SceneTestUtils.cs
@@ -118,7 +118,7 @@ namespace OpenSim.Region.Environment.Scenes.Tests
118 scene.NewUserConnection(agent); 118 scene.NewUserConnection(agent);
119 119
120 // Stage 2: add the new client as a child agent to the scene 120 // Stage 2: add the new client as a child agent to the scene
121 TestClient client = new TestClient(agent); 121 TestClient client = new TestClient(agent, scene);
122 scene.AddNewClient(client); 122 scene.AddNewClient(client);
123 123
124 // Stage 3: Invoke agent crossing, which converts the child agent into a root agent (with appearance, 124 // Stage 3: Invoke agent crossing, which converts the child agent into a root agent (with appearance,
diff --git a/OpenSim/Region/Environment/Scenes/Tests/StandaloneTeleportTests.cs b/OpenSim/Region/Environment/Scenes/Tests/StandaloneTeleportTests.cs
index a3d116d..d7342de 100644
--- a/OpenSim/Region/Environment/Scenes/Tests/StandaloneTeleportTests.cs
+++ b/OpenSim/Region/Environment/Scenes/Tests/StandaloneTeleportTests.cs
@@ -27,6 +27,7 @@
27 27
28using Nini.Config; 28using Nini.Config;
29using NUnit.Framework; 29using NUnit.Framework;
30using NUnit.Framework.SyntaxHelpers;
30using OpenMetaverse; 31using OpenMetaverse;
31using OpenSim.Framework; 32using OpenSim.Framework;
32using OpenSim.Framework.Communications; 33using OpenSim.Framework.Communications;
@@ -77,9 +78,14 @@ namespace OpenSim.Region.Environment.Scenes.Tests
77 78
78 TestClient client = SceneTestUtils.AddRootAgent(sceneA, agentId); 79 TestClient client = SceneTestUtils.AddRootAgent(sceneA, agentId);
79 80
80 client.Teleport(sceneB.RegionInfo.RegionHandle, new Vector3(100, 100, 100), new Vector3(40, 40, 40)); 81 // FIXME: This is a hack to get the test working - really the normal OpenSim mechanisms should be used.
82 client.TeleportTargetScene = sceneB;
81 83
82 // TODO: Check that everything is as it should be 84 client.Teleport(sceneB.RegionInfo.RegionHandle, new Vector3(100, 100, 100), new Vector3(40, 40, 40));
85 Assert.That(sceneB.GetScenePresence(agentId), Is.Not.Null, "Client does not have an agent in sceneB");
86 Assert.That(sceneA.GetScenePresence(agentId), Is.Null, "Client still had an agent in sceneA");
87
88 // TODO: Check that more of everything is as it should be
83 89
84 // TODO: test what happens if we try to teleport to a region that doesn't exist 90 // TODO: test what happens if we try to teleport to a region that doesn't exist
85 } 91 }
diff --git a/OpenSim/Tests/Common/Mock/TestClient.cs b/OpenSim/Tests/Common/Mock/TestClient.cs
index 5b3b27b..6254272 100644
--- a/OpenSim/Tests/Common/Mock/TestClient.cs
+++ b/OpenSim/Tests/Common/Mock/TestClient.cs
@@ -28,6 +28,8 @@
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Net; 30using System.Net;
31using System.Reflection;
32using log4net;
31using OpenMetaverse; 33using OpenMetaverse;
32using OpenMetaverse.Packets; 34using OpenMetaverse.Packets;
33using OpenSim.Framework; 35using OpenSim.Framework;
@@ -37,11 +39,18 @@ namespace OpenSim.Tests.Common.Mock
37{ 39{
38 public class TestClient : IClientAPI 40 public class TestClient : IClientAPI
39 { 41 {
40 private Scene m_scene; 42 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
41 43
42 // Mock testing variables 44 // Mock testing variables
43 public List<ImageDataPacket> sentdatapkt = new List<ImageDataPacket>(); 45 public List<ImageDataPacket> sentdatapkt = new List<ImageDataPacket>();
44 public List<ImagePacketPacket> sentpktpkt = new List<ImagePacketPacket>(); 46 public List<ImagePacketPacket> sentpktpkt = new List<ImagePacketPacket>();
47
48 // TODO: This is a really nasty (and temporary) means of telling the test client which scene to invoke setup
49 // methods on when a teleport is requested
50 public Scene TeleportTargetScene;
51 private TestClient TeleportSceneClient;
52
53 private IScene m_scene;
45 54
46// disable warning: public events, part of the public API 55// disable warning: public events, part of the public API
47#pragma warning disable 67 56#pragma warning disable 67
@@ -259,7 +268,7 @@ namespace OpenSim.Tests.Common.Mock
259 /// <value> 268 /// <value>
260 /// This agent's UUID 269 /// This agent's UUID
261 /// </value> 270 /// </value>
262 private UUID myID; 271 private UUID m_agentId;
263 272
264 private Vector3 startPos = new Vector3(128, 128, 2); 273 private Vector3 startPos = new Vector3(128, 128, 2);
265 274
@@ -271,7 +280,7 @@ namespace OpenSim.Tests.Common.Mock
271 280
272 public virtual UUID AgentId 281 public virtual UUID AgentId
273 { 282 {
274 get { return myID; } 283 get { return m_agentId; }
275 } 284 }
276 285
277 public UUID SessionId 286 public UUID SessionId
@@ -359,11 +368,14 @@ namespace OpenSim.Tests.Common.Mock
359 /// Constructor 368 /// Constructor
360 /// </summary> 369 /// </summary>
361 /// <param name="agentData"></param> 370 /// <param name="agentData"></param>
362 public TestClient(AgentCircuitData agentData) 371 /// <param name="scene"></param>
372 public TestClient(AgentCircuitData agentData, IScene scene)
363 { 373 {
364 myID = agentData.AgentID; 374 m_agentId = agentData.AgentID;
365 m_firstName = agentData.firstname; 375 m_firstName = agentData.firstname;
366 m_lastName = agentData.lastname; 376 m_lastName = agentData.lastname;
377 m_circuitCode = agentData.circuitcode;
378 m_scene = scene;
367 } 379 }
368 380
369 /// <summary> 381 /// <summary>
@@ -376,6 +388,11 @@ namespace OpenSim.Tests.Common.Mock
376 { 388 {
377 OnTeleportLocationRequest(this, regionHandle, position, lookAt, 16); 389 OnTeleportLocationRequest(this, regionHandle, position, lookAt, 16);
378 } 390 }
391
392 public void CompleteMovement()
393 {
394 OnCompleteMovementToRegion();
395 }
379 396
380 public virtual void ActivateGesture(UUID assetId, UUID gestureId) 397 public virtual void ActivateGesture(UUID assetId, UUID gestureId)
381 { 398 {
@@ -465,14 +482,48 @@ namespace OpenSim.Tests.Common.Mock
465 { 482 {
466 } 483 }
467 484
485 public virtual AgentCircuitData RequestClientInfo()
486 {
487 AgentCircuitData agentData = new AgentCircuitData();
488 agentData.AgentID = AgentId;
489 agentData.SessionID = UUID.Zero;
490 agentData.SecureSessionID = UUID.Zero;
491 agentData.circuitcode = m_circuitCode;
492 agentData.child = false;
493 agentData.firstname = m_firstName;
494 agentData.lastname = m_lastName;
495 agentData.CapsPath = m_scene.GetCapsPath(m_agentId);
496 agentData.ChildrenCapSeeds = new Dictionary<ulong,string>(m_scene.GetChildrenSeeds(m_agentId));
497
498 return agentData;
499 }
500
468 public virtual void InformClientOfNeighbour(ulong neighbourHandle, IPEndPoint neighbourExternalEndPoint) 501 public virtual void InformClientOfNeighbour(ulong neighbourHandle, IPEndPoint neighbourExternalEndPoint)
469 { 502 {
503 m_log.DebugFormat("[TEST CLIENT]: Processing inform client of neighbour");
504
505 // In response to this message, we are going to make a teleport to the scene we've previous been told
506 // about by test code (this needs to be improved).
507 AgentCircuitData newAgent = RequestClientInfo();
508
509 // Stage 2: add the new client as a child agent to the scene
510 TeleportSceneClient = new TestClient(newAgent, TeleportTargetScene);
511 TeleportTargetScene.AddNewClient(TeleportSceneClient);
512 }
513
514 public virtual void SendRegionTeleport(ulong regionHandle, byte simAccess, IPEndPoint regionExternalEndPoint,
515 uint locationID, uint flags, string capsURL)
516 {
517 m_log.DebugFormat("[TEST CLIENT]: Received SendRegionTeleport");
518
519 TeleportSceneClient.CompleteMovement();
520 //TeleportTargetScene.AgentCrossing(newAgent.AgentID, new Vector3(90, 90, 90), false);
470 } 521 }
471 522
472 public virtual AgentCircuitData RequestClientInfo() 523 public virtual void SendTeleportFailed(string reason)
473 { 524 {
474 return new AgentCircuitData(); 525 m_log.DebugFormat("[TEST CLIENT]: Teleport failed with reason {0}", reason);
475 } 526 }
476 527
477 public virtual void CrossRegion(ulong newRegionHandle, Vector3 pos, Vector3 lookAt, 528 public virtual void CrossRegion(ulong newRegionHandle, Vector3 pos, Vector3 lookAt,
478 IPEndPoint newRegionExternalEndPoint, string capsURL) 529 IPEndPoint newRegionExternalEndPoint, string capsURL)
@@ -487,15 +538,6 @@ namespace OpenSim.Tests.Common.Mock
487 { 538 {
488 } 539 }
489 540
490 public virtual void SendRegionTeleport(ulong regionHandle, byte simAccess, IPEndPoint regionExternalEndPoint,
491 uint locationID, uint flags, string capsURL)
492 {
493 }
494
495 public virtual void SendTeleportFailed(string reason)
496 {
497 }
498
499 public virtual void SendTeleportLocationStart() 541 public virtual void SendTeleportLocationStart()
500 { 542 {
501 } 543 }
@@ -788,6 +830,7 @@ namespace OpenSim.Tests.Common.Mock
788 830
789 public void Close(bool ShutdownCircuit) 831 public void Close(bool ShutdownCircuit)
790 { 832 {
833 m_scene.RemoveClient(AgentId);
791 } 834 }
792 835
793 public void Start() 836 public void Start()
diff --git a/prebuild.xml b/prebuild.xml
index 71898e4..895bb71 100644
--- a/prebuild.xml
+++ b/prebuild.xml
@@ -2461,6 +2461,7 @@
2461 <Reference name="System.Drawing"/> 2461 <Reference name="System.Drawing"/>
2462 <Reference name="System.Xml"/> 2462 <Reference name="System.Xml"/>
2463 <Reference name="System.Data"/> 2463 <Reference name="System.Data"/>
2464 <Reference name="log4net.dll"/>
2464 <Reference name="Nini.dll" /> 2465 <Reference name="Nini.dll" />
2465 <Reference name="nunit.framework.dll" /> 2466 <Reference name="nunit.framework.dll" />
2466 <Reference name="OpenMetaverse.dll"/> 2467 <Reference name="OpenMetaverse.dll"/>