From 093adb2113d748f28554393cc8a6fe53502126dc Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Thu, 15 Jan 2009 21:27:55 +0000 Subject: * Add new unit test for simple teleport in a standalone. * Does not yet check results. --- OpenSim/Region/Environment/Scenes/Scene.cs | 4 ++- .../Scenes/SceneCommunicationService.cs | 2 +- OpenSim/Region/Environment/Scenes/ScenePresence.cs | 2 -- .../Environment/Scenes/Tests/EntityManagerTests.cs | 4 +-- .../Environment/Scenes/Tests/SceneTestUtils.cs | 32 ++++++++++++++++------ 5 files changed, 30 insertions(+), 14 deletions(-) (limited to 'OpenSim/Region/Environment/Scenes') 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 remoteClient.SendTeleportFailed("The region '" + regionName + "' could not be found."); return; } + RequestTeleportLocation(remoteClient, regionInfo.RegionHandle, position, lookat, teleportFlags); } @@ -3149,7 +3150,8 @@ namespace OpenSim.Region.Environment.Scenes if (m_scenePresences.ContainsKey(remoteClient.AgentId)) sp = m_scenePresences[remoteClient.AgentId]; } - if (sp!= null) + + if (sp != null) { m_sceneGridService.RequestTeleportToLocation(sp, regionHandle, 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 position, avatar.Name, avatar.UUID, emergencyPos); position = emergencyPos; } + // TODO: Get proper AVG Height float localAVHeight = 1.56f; float posZLimit = (float)avatar.Scene.GetLandHeight((int)position.X, (int)position.Y); @@ -713,7 +714,6 @@ namespace OpenSim.Region.Environment.Scenes // Only send this if the event queue is null if (eq == null) avatar.ControllingClient.SendTeleportLocationStart(); - avatar.ControllingClient.SendLocalTeleport(position, lookAt, teleportFlags); 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; using OpenSim.Region.Physics.Manager; using OSD = OpenMetaverse.StructuredData.OSD; - namespace OpenSim.Region.Environment.Scenes { enum ScriptControlled : uint @@ -2757,7 +2756,6 @@ namespace OpenSim.Region.Environment.Scenes static ScenePresence() { - Primitive.TextureEntry textu = AvatarAppearance.GetDefaultTexture(); DefaultTexture = textu.ToBytes(); } 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 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -using NUnit.Framework.SyntaxHelpers; using System; using System.Threading; using System.Text; using System.Collections.Generic; using Nini.Config; using NUnit.Framework; +using NUnit.Framework.SyntaxHelpers; +using OpenMetaverse; using OpenSim.Framework; using OpenSim.Framework.Communications; using OpenSim.Region.Environment.Scenes; -using OpenMetaverse; namespace OpenSim.Region.Environment.Scenes.Tests { 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 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +using System.Net; using Nini.Config; using OpenMetaverse; using OpenSim.Framework; @@ -32,6 +33,7 @@ using OpenSim.Framework.Communications; using OpenSim.Framework.Communications.Cache; using OpenSim.Framework.Servers; using OpenSim.Region.Physics.Manager; +using OpenSim.Region.Environment; using OpenSim.Region.Environment.Scenes; using OpenSim.Tests.Common.Mock; @@ -48,18 +50,31 @@ namespace OpenSim.Region.Environment.Scenes.Tests /// public static TestScene SetupScene() { - RegionInfo regInfo = new RegionInfo(1000, 1000, null, null); - regInfo.RegionName = "Unit test region"; - regInfo.ExternalHostName = "1.2.3.4"; + return SetupScene("Unit test region", UUID.Random(), 1000, 1000, new TestCommunicationsManager()); + } + + /// + /// Set up a test scene + /// + /// Name of the region + /// ID of the region + /// X co-ordinate of the region + /// Y co-ordinate of the region + /// This should be the same if simulating two scenes within a standalone + /// + public static TestScene SetupScene(string name, UUID id, uint x, uint y, CommunicationsManager cm) + { + RegionInfo regInfo = new RegionInfo(x, y, new IPEndPoint(IPAddress.Loopback, 9000), "127.0.0.1"); + regInfo.RegionName = name; + regInfo.RegionID = id; AgentCircuitManager acm = new AgentCircuitManager(); - CommunicationsManager cm = new TestCommunicationsManager(); SceneCommunicationService scs = new SceneCommunicationService(cm); SQLAssetServer assetService = new SQLAssetServer(new TestAssetDataPlugin()); AssetCache ac = new AssetCache(assetService); - StorageManager sm = new OpenSim.Region.Environment.StorageManager("OpenSim.Data.Null.dll", "", ""); + StorageManager sm = new StorageManager("OpenSim.Data.Null.dll", "", ""); IConfigSource configSource = new IniConfigSource(); TestScene testScene = new TestScene( @@ -70,7 +85,8 @@ namespace OpenSim.Region.Environment.Scenes.Tests PhysicsPluginManager physicsPluginManager = new PhysicsPluginManager(); physicsPluginManager.LoadPluginsFromAssembly("Physics/OpenSim.Region.Physics.BasicPhysicsPlugin.dll"); - testScene.PhysicsScene = physicsPluginManager.GetPhysicsScene("basicphysics", "ZeroMesher", configSource, "test"); + testScene.PhysicsScene + = physicsPluginManager.GetPhysicsScene("basicphysics", "ZeroMesher", configSource, "test"); return testScene; } @@ -81,7 +97,7 @@ namespace OpenSim.Region.Environment.Scenes.Tests /// /// /// - public static IClientAPI AddRootAgent(Scene scene, UUID agentId) + public static TestClient AddRootAgent(Scene scene, UUID agentId) { string firstName = "testfirstname"; @@ -102,7 +118,7 @@ namespace OpenSim.Region.Environment.Scenes.Tests scene.NewUserConnection(agent); // Stage 2: add the new client as a child agent to the scene - IClientAPI client = new TestClient(agent); + TestClient client = new TestClient(agent); scene.AddNewClient(client); // Stage 3: Invoke agent crossing, which converts the child agent into a root agent (with appearance, -- cgit v1.1