diff options
author | Justin Clarke Casey | 2009-01-15 21:27:55 +0000 |
---|---|---|
committer | Justin Clarke Casey | 2009-01-15 21:27:55 +0000 |
commit | 093adb2113d748f28554393cc8a6fe53502126dc (patch) | |
tree | 5565cca869b7a83845efc129f21e5f1219c16adf | |
parent | Small bit of refactoring related to the hypergrid link loading from xml files. (diff) | |
download | opensim-SC-093adb2113d748f28554393cc8a6fe53502126dc.zip opensim-SC-093adb2113d748f28554393cc8a6fe53502126dc.tar.gz opensim-SC-093adb2113d748f28554393cc8a6fe53502126dc.tar.bz2 opensim-SC-093adb2113d748f28554393cc8a6fe53502126dc.tar.xz |
* Add new unit test for simple teleport in a standalone.
* Does not yet check results.
10 files changed, 49 insertions, 20 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index ebbecb7..30f6f0f 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | |||
@@ -5824,6 +5824,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5824 | 5824 | ||
5825 | } | 5825 | } |
5826 | break; | 5826 | break; |
5827 | |||
5827 | case PacketType.TeleportLocationRequest: | 5828 | case PacketType.TeleportLocationRequest: |
5828 | TeleportLocationRequestPacket tpLocReq = (TeleportLocationRequestPacket)Pack; | 5829 | TeleportLocationRequestPacket tpLocReq = (TeleportLocationRequestPacket)Pack; |
5829 | // Console.WriteLine(tpLocReq.ToString()); | 5830 | // Console.WriteLine(tpLocReq.ToString()); |
diff --git a/OpenSim/Region/Communications/Local/LocalBackEndServices.cs b/OpenSim/Region/Communications/Local/LocalBackEndServices.cs index 552f8c3..6a3b80d 100644 --- a/OpenSim/Region/Communications/Local/LocalBackEndServices.cs +++ b/OpenSim/Region/Communications/Local/LocalBackEndServices.cs | |||
@@ -250,6 +250,7 @@ namespace OpenSim.Region.Communications.Local | |||
250 | { | 250 | { |
251 | return m_regionListeners[regionHandle].TriggerTellRegionToCloseChildConnection(agentID); | 251 | return m_regionListeners[regionHandle].TriggerTellRegionToCloseChildConnection(agentID); |
252 | } | 252 | } |
253 | |||
253 | return false; | 254 | return false; |
254 | } | 255 | } |
255 | 256 | ||
diff --git a/OpenSim/Region/Environment/Modules/Communications/Local/LocalInterregionComms.cs b/OpenSim/Region/Environment/Modules/Communications/Local/LocalInterregionComms.cs index efc5c39..5fcb4bc 100644 --- a/OpenSim/Region/Environment/Modules/Communications/Local/LocalInterregionComms.cs +++ b/OpenSim/Region/Environment/Modules/Communications/Local/LocalInterregionComms.cs | |||
@@ -75,7 +75,6 @@ namespace OpenSim.Region.Environment.Modules.Communications.Local | |||
75 | return; | 75 | return; |
76 | 76 | ||
77 | Init(scene); | 77 | Init(scene); |
78 | |||
79 | } | 78 | } |
80 | 79 | ||
81 | public void PostInitialise() | 80 | public void PostInitialise() |
@@ -119,17 +118,17 @@ namespace OpenSim.Region.Environment.Modules.Communications.Local | |||
119 | #region IInterregionComms | 118 | #region IInterregionComms |
120 | 119 | ||
121 | public bool SendCreateChildAgent(ulong regionHandle, AgentCircuitData aCircuit) | 120 | public bool SendCreateChildAgent(ulong regionHandle, AgentCircuitData aCircuit) |
122 | { | 121 | { |
123 | foreach (Scene s in m_sceneList) | 122 | foreach (Scene s in m_sceneList) |
124 | { | 123 | { |
125 | if (s.RegionInfo.RegionHandle == regionHandle) | 124 | if (s.RegionInfo.RegionHandle == regionHandle) |
126 | { | 125 | { |
127 | //m_log.Debug("[LOCAL COMMS]: Found region to send SendCreateChildAgent"); | 126 | // m_log.DebugFormat("[LOCAL COMMS]: Found region {0} to send SendCreateChildAgent", regionHandle); |
128 | s.NewUserConnection(aCircuit); | 127 | s.NewUserConnection(aCircuit); |
129 | return true; | 128 | return true; |
130 | } | 129 | } |
131 | } | 130 | } |
132 | //m_log.Debug("[LOCAL COMMS]: region not found for SendCreateChildAgent"); | 131 | // m_log.DebugFormat("[LOCAL COMMS]: Did not find region {0} for SendCreateChildAgent", regionHandle); |
133 | return false; | 132 | return false; |
134 | } | 133 | } |
135 | 134 | ||
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 94ca07c..fad90fa 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs | |||
@@ -3129,6 +3129,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
3129 | remoteClient.SendTeleportFailed("The region '" + regionName + "' could not be found."); | 3129 | remoteClient.SendTeleportFailed("The region '" + regionName + "' could not be found."); |
3130 | return; | 3130 | return; |
3131 | } | 3131 | } |
3132 | |||
3132 | RequestTeleportLocation(remoteClient, regionInfo.RegionHandle, position, lookat, teleportFlags); | 3133 | RequestTeleportLocation(remoteClient, regionInfo.RegionHandle, position, lookat, teleportFlags); |
3133 | } | 3134 | } |
3134 | 3135 | ||
@@ -3149,7 +3150,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
3149 | if (m_scenePresences.ContainsKey(remoteClient.AgentId)) | 3150 | if (m_scenePresences.ContainsKey(remoteClient.AgentId)) |
3150 | sp = m_scenePresences[remoteClient.AgentId]; | 3151 | sp = m_scenePresences[remoteClient.AgentId]; |
3151 | } | 3152 | } |
3152 | if (sp!= null) | 3153 | |
3154 | if (sp != null) | ||
3153 | { | 3155 | { |
3154 | m_sceneGridService.RequestTeleportToLocation(sp, regionHandle, | 3156 | m_sceneGridService.RequestTeleportToLocation(sp, regionHandle, |
3155 | position, lookAt, teleportFlags); | 3157 | position, lookAt, teleportFlags); |
diff --git a/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs index ab4e7d8..65e62ef 100644 --- a/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs +++ b/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs | |||
@@ -701,6 +701,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
701 | position, avatar.Name, avatar.UUID, emergencyPos); | 701 | position, avatar.Name, avatar.UUID, emergencyPos); |
702 | position = emergencyPos; | 702 | position = emergencyPos; |
703 | } | 703 | } |
704 | |||
704 | // TODO: Get proper AVG Height | 705 | // TODO: Get proper AVG Height |
705 | float localAVHeight = 1.56f; | 706 | float localAVHeight = 1.56f; |
706 | float posZLimit = (float)avatar.Scene.GetLandHeight((int)position.X, (int)position.Y); | 707 | float posZLimit = (float)avatar.Scene.GetLandHeight((int)position.X, (int)position.Y); |
@@ -713,7 +714,6 @@ namespace OpenSim.Region.Environment.Scenes | |||
713 | // Only send this if the event queue is null | 714 | // Only send this if the event queue is null |
714 | if (eq == null) | 715 | if (eq == null) |
715 | avatar.ControllingClient.SendTeleportLocationStart(); | 716 | avatar.ControllingClient.SendTeleportLocationStart(); |
716 | |||
717 | 717 | ||
718 | avatar.ControllingClient.SendLocalTeleport(position, lookAt, teleportFlags); | 718 | avatar.ControllingClient.SendLocalTeleport(position, lookAt, teleportFlags); |
719 | avatar.Teleport(position); | 719 | avatar.Teleport(position); |
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs index 00e5548..d2d8335 100644 --- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs | |||
@@ -42,7 +42,6 @@ using OpenSim.Region.Interfaces; | |||
42 | using OpenSim.Region.Physics.Manager; | 42 | using OpenSim.Region.Physics.Manager; |
43 | using OSD = OpenMetaverse.StructuredData.OSD; | 43 | using OSD = OpenMetaverse.StructuredData.OSD; |
44 | 44 | ||
45 | |||
46 | namespace OpenSim.Region.Environment.Scenes | 45 | namespace OpenSim.Region.Environment.Scenes |
47 | { | 46 | { |
48 | enum ScriptControlled : uint | 47 | enum ScriptControlled : uint |
@@ -2757,7 +2756,6 @@ namespace OpenSim.Region.Environment.Scenes | |||
2757 | 2756 | ||
2758 | static ScenePresence() | 2757 | static ScenePresence() |
2759 | { | 2758 | { |
2760 | |||
2761 | Primitive.TextureEntry textu = AvatarAppearance.GetDefaultTexture(); | 2759 | Primitive.TextureEntry textu = AvatarAppearance.GetDefaultTexture(); |
2762 | DefaultTexture = textu.ToBytes(); | 2760 | DefaultTexture = textu.ToBytes(); |
2763 | } | 2761 | } |
diff --git a/OpenSim/Region/Environment/Scenes/Tests/EntityManagerTests.cs b/OpenSim/Region/Environment/Scenes/Tests/EntityManagerTests.cs index 5923a2c..cc9cc03 100644 --- a/OpenSim/Region/Environment/Scenes/Tests/EntityManagerTests.cs +++ b/OpenSim/Region/Environment/Scenes/Tests/EntityManagerTests.cs | |||
@@ -25,17 +25,17 @@ | |||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | using NUnit.Framework.SyntaxHelpers; | ||
29 | using System; | 28 | using System; |
30 | using System.Threading; | 29 | using System.Threading; |
31 | using System.Text; | 30 | using System.Text; |
32 | using System.Collections.Generic; | 31 | using System.Collections.Generic; |
33 | using Nini.Config; | 32 | using Nini.Config; |
34 | using NUnit.Framework; | 33 | using NUnit.Framework; |
34 | using NUnit.Framework.SyntaxHelpers; | ||
35 | using OpenMetaverse; | ||
35 | using OpenSim.Framework; | 36 | using OpenSim.Framework; |
36 | using OpenSim.Framework.Communications; | 37 | using OpenSim.Framework.Communications; |
37 | using OpenSim.Region.Environment.Scenes; | 38 | using OpenSim.Region.Environment.Scenes; |
38 | using OpenMetaverse; | ||
39 | 39 | ||
40 | namespace OpenSim.Region.Environment.Scenes.Tests | 40 | namespace OpenSim.Region.Environment.Scenes.Tests |
41 | { | 41 | { |
diff --git a/OpenSim/Region/Environment/Scenes/Tests/SceneTestUtils.cs b/OpenSim/Region/Environment/Scenes/Tests/SceneTestUtils.cs index a9a9ecd..3c4049d 100644 --- a/OpenSim/Region/Environment/Scenes/Tests/SceneTestUtils.cs +++ b/OpenSim/Region/Environment/Scenes/Tests/SceneTestUtils.cs | |||
@@ -25,6 +25,7 @@ | |||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System.Net; | ||
28 | using Nini.Config; | 29 | using Nini.Config; |
29 | using OpenMetaverse; | 30 | using OpenMetaverse; |
30 | using OpenSim.Framework; | 31 | using OpenSim.Framework; |
@@ -32,6 +33,7 @@ using OpenSim.Framework.Communications; | |||
32 | using OpenSim.Framework.Communications.Cache; | 33 | using OpenSim.Framework.Communications.Cache; |
33 | using OpenSim.Framework.Servers; | 34 | using OpenSim.Framework.Servers; |
34 | using OpenSim.Region.Physics.Manager; | 35 | using OpenSim.Region.Physics.Manager; |
36 | using OpenSim.Region.Environment; | ||
35 | using OpenSim.Region.Environment.Scenes; | 37 | using OpenSim.Region.Environment.Scenes; |
36 | using OpenSim.Tests.Common.Mock; | 38 | using OpenSim.Tests.Common.Mock; |
37 | 39 | ||
@@ -48,18 +50,31 @@ namespace OpenSim.Region.Environment.Scenes.Tests | |||
48 | /// <returns></returns> | 50 | /// <returns></returns> |
49 | public static TestScene SetupScene() | 51 | public static TestScene SetupScene() |
50 | { | 52 | { |
51 | RegionInfo regInfo = new RegionInfo(1000, 1000, null, null); | 53 | return SetupScene("Unit test region", UUID.Random(), 1000, 1000, new TestCommunicationsManager()); |
52 | regInfo.RegionName = "Unit test region"; | 54 | } |
53 | regInfo.ExternalHostName = "1.2.3.4"; | 55 | |
56 | /// <summary> | ||
57 | /// Set up a test scene | ||
58 | /// </summary> | ||
59 | /// <param name="name">Name of the region</param> | ||
60 | /// <param name="id">ID of the region</param> | ||
61 | /// <param name="x">X co-ordinate of the region</param> | ||
62 | /// <param name="y">Y co-ordinate of the region</param> | ||
63 | /// <param name="cm">This should be the same if simulating two scenes within a standalone</param> | ||
64 | /// <returns></returns> | ||
65 | public static TestScene SetupScene(string name, UUID id, uint x, uint y, CommunicationsManager cm) | ||
66 | { | ||
67 | RegionInfo regInfo = new RegionInfo(x, y, new IPEndPoint(IPAddress.Loopback, 9000), "127.0.0.1"); | ||
68 | regInfo.RegionName = name; | ||
69 | regInfo.RegionID = id; | ||
54 | 70 | ||
55 | AgentCircuitManager acm = new AgentCircuitManager(); | 71 | AgentCircuitManager acm = new AgentCircuitManager(); |
56 | CommunicationsManager cm = new TestCommunicationsManager(); | ||
57 | SceneCommunicationService scs = new SceneCommunicationService(cm); | 72 | SceneCommunicationService scs = new SceneCommunicationService(cm); |
58 | 73 | ||
59 | SQLAssetServer assetService = new SQLAssetServer(new TestAssetDataPlugin()); | 74 | SQLAssetServer assetService = new SQLAssetServer(new TestAssetDataPlugin()); |
60 | AssetCache ac = new AssetCache(assetService); | 75 | AssetCache ac = new AssetCache(assetService); |
61 | 76 | ||
62 | StorageManager sm = new OpenSim.Region.Environment.StorageManager("OpenSim.Data.Null.dll", "", ""); | 77 | StorageManager sm = new StorageManager("OpenSim.Data.Null.dll", "", ""); |
63 | IConfigSource configSource = new IniConfigSource(); | 78 | IConfigSource configSource = new IniConfigSource(); |
64 | 79 | ||
65 | TestScene testScene = new TestScene( | 80 | TestScene testScene = new TestScene( |
@@ -70,7 +85,8 @@ namespace OpenSim.Region.Environment.Scenes.Tests | |||
70 | 85 | ||
71 | PhysicsPluginManager physicsPluginManager = new PhysicsPluginManager(); | 86 | PhysicsPluginManager physicsPluginManager = new PhysicsPluginManager(); |
72 | physicsPluginManager.LoadPluginsFromAssembly("Physics/OpenSim.Region.Physics.BasicPhysicsPlugin.dll"); | 87 | physicsPluginManager.LoadPluginsFromAssembly("Physics/OpenSim.Region.Physics.BasicPhysicsPlugin.dll"); |
73 | testScene.PhysicsScene = physicsPluginManager.GetPhysicsScene("basicphysics", "ZeroMesher", configSource, "test"); | 88 | testScene.PhysicsScene |
89 | = physicsPluginManager.GetPhysicsScene("basicphysics", "ZeroMesher", configSource, "test"); | ||
74 | 90 | ||
75 | return testScene; | 91 | return testScene; |
76 | } | 92 | } |
@@ -81,7 +97,7 @@ namespace OpenSim.Region.Environment.Scenes.Tests | |||
81 | /// <param name="scene"></param> | 97 | /// <param name="scene"></param> |
82 | /// <param name="agentId"></param> | 98 | /// <param name="agentId"></param> |
83 | /// <returns></returns> | 99 | /// <returns></returns> |
84 | public static IClientAPI AddRootAgent(Scene scene, UUID agentId) | 100 | public static TestClient AddRootAgent(Scene scene, UUID agentId) |
85 | { | 101 | { |
86 | string firstName = "testfirstname"; | 102 | string firstName = "testfirstname"; |
87 | 103 | ||
@@ -102,7 +118,7 @@ namespace OpenSim.Region.Environment.Scenes.Tests | |||
102 | scene.NewUserConnection(agent); | 118 | scene.NewUserConnection(agent); |
103 | 119 | ||
104 | // 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 |
105 | IClientAPI client = new TestClient(agent); | 121 | TestClient client = new TestClient(agent); |
106 | scene.AddNewClient(client); | 122 | scene.AddNewClient(client); |
107 | 123 | ||
108 | // 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/Tests/Common/Mock/TestClient.cs b/OpenSim/Tests/Common/Mock/TestClient.cs index 428f599..5b3b27b 100644 --- a/OpenSim/Tests/Common/Mock/TestClient.cs +++ b/OpenSim/Tests/Common/Mock/TestClient.cs | |||
@@ -365,6 +365,17 @@ namespace OpenSim.Tests.Common.Mock | |||
365 | m_firstName = agentData.firstname; | 365 | m_firstName = agentData.firstname; |
366 | m_lastName = agentData.lastname; | 366 | m_lastName = agentData.lastname; |
367 | } | 367 | } |
368 | |||
369 | /// <summary> | ||
370 | /// Attempt a teleport to the given region. | ||
371 | /// </summary> | ||
372 | /// <param name="regionHandle"></param> | ||
373 | /// <param name="position"></param> | ||
374 | /// <param name="lookAt"></param> | ||
375 | public void Teleport(ulong regionHandle, Vector3 position, Vector3 lookAt) | ||
376 | { | ||
377 | OnTeleportLocationRequest(this, regionHandle, position, lookAt, 16); | ||
378 | } | ||
368 | 379 | ||
369 | public virtual void ActivateGesture(UUID assetId, UUID gestureId) | 380 | public virtual void ActivateGesture(UUID assetId, UUID gestureId) |
370 | { | 381 | { |
diff --git a/OpenSim/Tests/Common/Mock/TestCommunicationsManager.cs b/OpenSim/Tests/Common/Mock/TestCommunicationsManager.cs index 738bc15..1663ac1 100644 --- a/OpenSim/Tests/Common/Mock/TestCommunicationsManager.cs +++ b/OpenSim/Tests/Common/Mock/TestCommunicationsManager.cs | |||
@@ -69,7 +69,8 @@ namespace OpenSim.Tests.Common.Mock | |||
69 | m_userAdminService = lus; | 69 | m_userAdminService = lus; |
70 | 70 | ||
71 | LocalBackEndServices gs = new LocalBackEndServices(); | 71 | LocalBackEndServices gs = new LocalBackEndServices(); |
72 | m_gridService = gs; | 72 | m_gridService = gs; |
73 | m_interRegion = gs; | ||
73 | } | 74 | } |
74 | } | 75 | } |
75 | } | 76 | } |