From 14f3ac144060491761a57137b99173e65252d806 Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Wed, 19 Nov 2008 20:13:51 +0000 Subject: [PATCH] * Add just enough to allow the scene presences test to establish a new user connection (though not yet an actual ScenePresence) --- .../Environment/Interfaces/ILandChannel.cs | 1 - .../Modules/World/Land/LandChannel.cs | 2 - .../Region/Environment/Scenes/SceneBase.cs | 3 ++ .../Scenes/Tests/ScenePresenceTests.cs | 5 +- .../Scenes/Tests/SceneTestUtils.cs | 15 ++++-- .../Scenes/Tests/TestLandChannel.cs | 52 +++++++++++++++++++ 6 files changed, 69 insertions(+), 9 deletions(-) create mode 100644 OpenSim/Region/Environment/Scenes/Tests/TestLandChannel.cs diff --git a/OpenSim/Region/Environment/Interfaces/ILandChannel.cs b/OpenSim/Region/Environment/Interfaces/ILandChannel.cs index 7da4d3cff7..a8a58ef19f 100644 --- a/OpenSim/Region/Environment/Interfaces/ILandChannel.cs +++ b/OpenSim/Region/Environment/Interfaces/ILandChannel.cs @@ -34,7 +34,6 @@ namespace OpenSim.Region.Environment.Interfaces { public interface ILandChannel { - List ParcelsNearPoint(Vector3 position); List AllParcels(); ILandObject GetLandObject(int x, int y); diff --git a/OpenSim/Region/Environment/Modules/World/Land/LandChannel.cs b/OpenSim/Region/Environment/Modules/World/Land/LandChannel.cs index 892d1aea2c..9de0181b96 100644 --- a/OpenSim/Region/Environment/Modules/World/Land/LandChannel.cs +++ b/OpenSim/Region/Environment/Modules/World/Land/LandChannel.cs @@ -95,7 +95,6 @@ namespace OpenSim.Region.Environment.Modules.World.Land public ILandObject GetLandObject(int x, int y) { - if (m_landManagementModule != null) { return m_landManagementModule.GetLandObject(x, y); @@ -185,6 +184,5 @@ namespace OpenSim.Region.Environment.Modules.World.Land } #endregion - } } diff --git a/OpenSim/Region/Environment/Scenes/SceneBase.cs b/OpenSim/Region/Environment/Scenes/SceneBase.cs index 67e23b5848..ee0f6b1a67 100644 --- a/OpenSim/Region/Environment/Scenes/SceneBase.cs +++ b/OpenSim/Region/Environment/Scenes/SceneBase.cs @@ -71,6 +71,9 @@ namespace OpenSim.Region.Environment.Scenes //public TerrainEngine Terrain; public ITerrainChannel Heightmap; + /// + /// Allows retrieval of land information for this scene. + /// public ILandChannel LandChannel; protected EventManager m_eventManager; diff --git a/OpenSim/Region/Environment/Scenes/Tests/ScenePresenceTests.cs b/OpenSim/Region/Environment/Scenes/Tests/ScenePresenceTests.cs index 39f357a8c2..4cab32a83e 100644 --- a/OpenSim/Region/Environment/Scenes/Tests/ScenePresenceTests.cs +++ b/OpenSim/Region/Environment/Scenes/Tests/ScenePresenceTests.cs @@ -57,8 +57,7 @@ namespace OpenSim.Region.Environment.Scenes.Tests [Test] public void TestAddRootAgent() { - // Scene scene = SceneTestUtils.SetupScene(); - SceneTestUtils.SetupScene(); + Scene scene = SceneTestUtils.SetupScene(); AgentCircuitData agent = new AgentCircuitData(); agent.AgentID = UUID.Zero; @@ -72,7 +71,7 @@ namespace OpenSim.Region.Environment.Scenes.Tests agent.startpos = Vector3.Zero; agent.CapsPath = "http://wibble.com"; - //scene.NewUserConnection(agent); + scene.NewUserConnection(agent); // There are going to be more parts to this. } diff --git a/OpenSim/Region/Environment/Scenes/Tests/SceneTestUtils.cs b/OpenSim/Region/Environment/Scenes/Tests/SceneTestUtils.cs index c20dacf1b7..26c148fa58 100644 --- a/OpenSim/Region/Environment/Scenes/Tests/SceneTestUtils.cs +++ b/OpenSim/Region/Environment/Scenes/Tests/SceneTestUtils.cs @@ -29,6 +29,7 @@ using Nini.Config; using OpenMetaverse; using OpenSim.Framework; using OpenSim.Framework.Communications; +using OpenSim.Framework.Servers; using OpenSim.Region.Environment.Scenes; namespace OpenSim.Region.Environment.Scenes.Tests @@ -41,19 +42,27 @@ namespace OpenSim.Region.Environment.Scenes.Tests /// /// Set up a test scene /// + /// public static TestScene SetupScene() { RegionInfo regInfo = new RegionInfo(1000, 1000, null, null); regInfo.RegionName = "Unit test region"; + regInfo.ExternalHostName = "1.2.3.4"; + AgentCircuitManager acm = new AgentCircuitManager(); - //CommunicationsManager cm = new CommunicationsManager(null, null, null, false, null); - CommunicationsManager cm = null; + CommunicationsManager cm = new CommunicationsManager(null, null, null, false, null); //SceneCommunicationService scs = new SceneCommunicationService(cm); SceneCommunicationService scs = null; StorageManager sm = new OpenSim.Region.Environment.StorageManager("OpenSim.Data.Null.dll", "", ""); + BaseHttpServer httpServer = new BaseHttpServer(666); IConfigSource configSource = new IniConfigSource(); - return new TestScene(regInfo, acm, cm, scs, null, sm, null, null, false, false, false, configSource, null); + TestScene testScene = new TestScene( + regInfo, acm, cm, scs, null, sm, httpServer, null, false, false, false, configSource, null); + + testScene.LandChannel = new TestLandChannel(); + + return testScene; } /// diff --git a/OpenSim/Region/Environment/Scenes/Tests/TestLandChannel.cs b/OpenSim/Region/Environment/Scenes/Tests/TestLandChannel.cs new file mode 100644 index 0000000000..2bc89749ad --- /dev/null +++ b/OpenSim/Region/Environment/Scenes/Tests/TestLandChannel.cs @@ -0,0 +1,52 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSim Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System.Collections.Generic; +using OpenMetaverse; +using OpenSim.Framework; +using OpenSim.Region.Environment.Interfaces; + +namespace OpenSim.Region.Environment.Scenes.Tests +{ + /// + /// Land channel for test purposes + /// + public class TestLandChannel : ILandChannel + { + public List ParcelsNearPoint(Vector3 position) { return null; } + public List AllParcels() { return null; } + public ILandObject GetLandObject(int x, int y) { return null; } + public ILandObject GetLandObject(float x, float y) { return null; } + public bool IsLandPrimCountTainted() { return false; } + public bool IsForcefulBansAllowed() { return false; } + public void UpdateLandObject(int localID, LandData data) {} + public void ReturnObjectsInParcel(int localID, uint returnType, UUID[] agentIDs, UUID[] taskIDs, IClientAPI remoteClient) {} + public void setParcelObjectMaxOverride(overrideParcelMaxPrimCountDelegate overrideDel) {} + public void setSimulatorObjectMaxOverride(overrideSimulatorMaxPrimCountDelegate overrideDel) {} + public void SetParcelOtherCleanTime(IClientAPI remoteClient, int localID, int otherCleanTime) {} + } +}