From 57ab79e3312d9856a3534a1e2343b45c6cf74ac6 Mon Sep 17 00:00:00 2001 From: Sean Dague Date: Thu, 26 Feb 2009 21:29:16 +0000 Subject: * Update ScenePresenceTests to reflect current REST communication workflow. * Fixed an issue with AssetCache where it would break unit tests randomly. From: Arthur Rodrigo S Valadares --- OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs | 113 ++++++++++++------------ 1 file changed, 58 insertions(+), 55 deletions(-) (limited to 'OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs') diff --git a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs index b52c081..bcc9426 100644 --- a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs +++ b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs @@ -40,12 +40,12 @@ using OpenSim.Region.CoreModules.Agent.Capabilities; using OpenSim.Tests.Common.Mock; namespace OpenSim.Tests.Common.Setup -{ +{ /// /// Helpers for setting up scenes. /// public class SceneSetupHelpers - { + { /// /// Set up a test scene /// @@ -54,7 +54,7 @@ namespace OpenSim.Tests.Common.Setup { return SetupScene("Unit test region", UUID.Random(), 1000, 1000, new TestCommunicationsManager()); } - + /// /// Set up a test scene /// @@ -69,32 +69,32 @@ namespace OpenSim.Tests.Common.Setup 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(); SceneCommunicationService scs = new SceneCommunicationService(cm); - - StorageManager sm = new StorageManager("OpenSim.Data.Null.dll", "", ""); + + StorageManager sm = new StorageManager("OpenSim.Data.Null.dll", "", ""); IConfigSource configSource = new IniConfigSource(); - + TestScene testScene = new TestScene( regInfo, acm, cm, scs, sm, null, false, false, false, configSource, null); - + IRegionModule capsModule = new CapabilitiesModule(); capsModule.Initialise(testScene, new IniConfigSource()); - testScene.AddModule(capsModule.Name, capsModule); - testScene.SetModuleInterfaces(); - + testScene.AddModule(capsModule.Name, capsModule); + testScene.SetModuleInterfaces(); + testScene.LandChannel = new TestLandChannel(); testScene.LoadWorldMap(); - + 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; - } - + } + /// /// Setup modules for a scene using their default settings. /// @@ -102,9 +102,9 @@ namespace OpenSim.Tests.Common.Setup /// public static void SetupSceneModules(Scene scene, params IRegionModule[] modules) { - SetupSceneModules(scene, null, modules); - } - + SetupSceneModules(scene, null, modules); + } + /// /// Setup modules for a scene. /// @@ -115,13 +115,13 @@ namespace OpenSim.Tests.Common.Setup { foreach (IRegionModule module in modules) { - module.Initialise(scene, config); + module.Initialise(scene, config); scene.AddModule(module.Name, module); } - - scene.SetModuleInterfaces(); + + scene.SetModuleInterfaces(); } - + /// /// Generate some standard agent connection data. /// @@ -130,7 +130,7 @@ namespace OpenSim.Tests.Common.Setup public static AgentCircuitData GenerateAgentData(UUID agentId) { string firstName = "testfirstname"; - + AgentCircuitData agentData = new AgentCircuitData(); agentData.AgentID = agentId; agentData.firstname = firstName; @@ -142,10 +142,10 @@ namespace OpenSim.Tests.Common.Setup agentData.InventoryFolder = UUID.Zero; agentData.startpos = Vector3.Zero; agentData.CapsPath = "http://wibble.com"; - + return agentData; } - + /// /// Add a root agent where the details of the agent connection (apart from the id) are unimportant for the test /// @@ -153,55 +153,58 @@ namespace OpenSim.Tests.Common.Setup /// /// public static TestClient AddRootAgent(Scene scene, UUID agentId) - { - return AddRootAgent(scene, GenerateAgentData(agentId)); - } - + { + return AddRootAgent(scene, GenerateAgentData(agentId)); + } + /// - /// Add a root agent. + /// Add a root agent. /// - /// + /// /// This function - /// + /// /// 1) Tells the scene that an agent is coming. Normally, the login service (local if standalone, from the /// userserver if grid) would give initial login data back to the client and separately tell the scene that the /// agent was coming. - /// + /// /// 2) Connects the agent with the scene - /// + /// /// This function performs actions equivalent with notifying the scene that an agent is /// coming and then actually connecting the agent to the scene. The one step missed out is the very first - /// + /// /// /// - /// + /// public static TestClient AddRootAgent(Scene scene, AgentCircuitData agentData) - { - // We emulate the proper login sequence here by doing things in three stages + { + // We emulate the proper login sequence here by doing things in three stages // Stage 1: simulate login by telling the scene to expect a new user connection scene.NewUserConnection(agentData); - + // Stage 2: add the new client as a child agent to the scene TestClient client = new TestClient(agentData, scene); scene.AddNewClient(client); - + // Stage 3: Invoke agent crossing, which converts the child agent into a root agent (with appearance, // inventory, etc.) - scene.AgentCrossing(agentData.AgentID, new Vector3(90, 90, 90), false); - - return client; + //scene.AgentCrossing(agentData.AgentID, new Vector3(90, 90, 90), false); OBSOLETE + + ScenePresence scp = scene.GetScenePresence(agentData.AgentID); + scp.MakeRootAgent(new Vector3(90,90,90), true); + + return client; } /// /// Add a test object /// /// - /// + /// public static SceneObjectPart AddSceneObject(Scene scene) { return AddSceneObject(scene, "Test Object"); } - + /// /// Add a test object /// @@ -209,19 +212,19 @@ namespace OpenSim.Tests.Common.Setup /// /// public static SceneObjectPart AddSceneObject(Scene scene, string name) - { - SceneObjectPart part + { + SceneObjectPart part = new SceneObjectPart(UUID.Zero, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero); part.Name = name; - - //part.UpdatePrimFlags(false, false, true); - //part.ObjectFlags |= (uint)PrimFlags.Phantom; + + //part.UpdatePrimFlags(false, false, true); + //part.ObjectFlags |= (uint)PrimFlags.Phantom; scene.AddNewSceneObject(new SceneObjectGroup(part), false); - + return part; } - + /// /// Delete a scene object asynchronously /// @@ -238,7 +241,7 @@ namespace OpenSim.Tests.Common.Setup sogd.Enabled = false; scene.DeRezObject(client, part.LocalId, UUID.Zero, action, destinationId); - sogd.InventoryDeQueueAndDelete(); + sogd.InventoryDeQueueAndDelete(); } } } -- cgit v1.1