From 884009ed33eab204588cc3978a46abff1098b832 Mon Sep 17 00:00:00 2001
From: Justin Clarke Casey
Date: Thu, 22 Jan 2009 19:46:31 +0000
Subject: * Add some caps seed capability path checking to the simple non
neighbours standalone region teleport test
---
.../Environment/Scenes/Tests/SceneTestUtils.cs | 71 ++++++++++++++++------
.../Scenes/Tests/StandaloneTeleportTests.cs | 25 ++++++--
2 files changed, 73 insertions(+), 23 deletions(-)
(limited to 'OpenSim/Region/Environment')
diff --git a/OpenSim/Region/Environment/Scenes/Tests/SceneTestUtils.cs b/OpenSim/Region/Environment/Scenes/Tests/SceneTestUtils.cs
index dee3914..6fa918a 100644
--- a/OpenSim/Region/Environment/Scenes/Tests/SceneTestUtils.cs
+++ b/OpenSim/Region/Environment/Scenes/Tests/SceneTestUtils.cs
@@ -99,40 +99,73 @@ namespace OpenSim.Region.Environment.Scenes.Tests
}
///
- /// Add a root agent
+ /// Generate some standard agent connection data.
///
- ///
///
- ///
- public static TestClient AddRootAgent(Scene scene, UUID agentId)
+ ///
+ public static AgentCircuitData GenerateAgentData(UUID agentId)
{
string firstName = "testfirstname";
- AgentCircuitData agent = new AgentCircuitData();
- agent.AgentID = agentId;
- agent.firstname = firstName;
- agent.lastname = "testlastname";
- agent.SessionID = UUID.Zero;
- agent.SecureSessionID = UUID.Zero;
- agent.circuitcode = 123;
- agent.BaseFolder = UUID.Zero;
- agent.InventoryFolder = UUID.Zero;
- agent.startpos = Vector3.Zero;
- agent.CapsPath = "http://wibble.com";
+ AgentCircuitData agentData = new AgentCircuitData();
+ agentData.AgentID = agentId;
+ agentData.firstname = firstName;
+ agentData.lastname = "testlastname";
+ agentData.SessionID = UUID.Zero;
+ agentData.SecureSessionID = UUID.Zero;
+ agentData.circuitcode = 123;
+ agentData.BaseFolder = UUID.Zero;
+ 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
+ ///
+ ///
+ ///
+ ///
+ public static TestClient AddRootAgent(Scene scene, UUID agentId)
+ {
+ return AddRootAgent(scene, GenerateAgentData(agentId));
+ }
+
+ ///
+ /// 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
// Stage 1: simulate login by telling the scene to expect a new user connection
- scene.NewUserConnection(agent);
+ scene.NewUserConnection(agentData);
// Stage 2: add the new client as a child agent to the scene
- TestClient client = new TestClient(agent, 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(agent.AgentID, new Vector3(90, 90, 90), false);
+ scene.AgentCrossing(agentData.AgentID, new Vector3(90, 90, 90), false);
- return client;
+ return client;
}
///
diff --git a/OpenSim/Region/Environment/Scenes/Tests/StandaloneTeleportTests.cs b/OpenSim/Region/Environment/Scenes/Tests/StandaloneTeleportTests.cs
index a61b9c2..3bc8467 100644
--- a/OpenSim/Region/Environment/Scenes/Tests/StandaloneTeleportTests.cs
+++ b/OpenSim/Region/Environment/Scenes/Tests/StandaloneTeleportTests.cs
@@ -74,17 +74,34 @@ namespace OpenSim.Region.Environment.Scenes.Tests
sceneB.SetModuleInterfaces();
sceneB.RegisterRegionWithGrid();
- UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000041");
-
+ UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000041");
TestClient client = SceneTestUtils.AddRootAgent(sceneA, agentId);
+
+ ICapabilitiesModule sceneACapsModule = sceneA.RequestModuleInterface();
+ Assert.That(
+ sceneACapsModule.GetCapsPath(agentId),
+ Is.EqualTo(client.CapsSeedUrl),
+ "Incorrect caps object path set up in sceneA");
+
// FIXME: This is a hack to get the test working - really the normal OpenSim mechanisms should be used.
- client.TeleportTargetScene = sceneB;
-
+ client.TeleportTargetScene = sceneB;
client.Teleport(sceneB.RegionInfo.RegionHandle, new Vector3(100, 100, 100), new Vector3(40, 40, 40));
+
Assert.That(sceneB.GetScenePresence(agentId), Is.Not.Null, "Client does not have an agent in sceneB");
Assert.That(sceneA.GetScenePresence(agentId), Is.Null, "Client still had an agent in sceneA");
+ ICapabilitiesModule sceneBCapsModule = sceneB.RequestModuleInterface();
+
+ // Temporary assertion - caps url construction should at least be doable through a method.
+ Assert.That(
+ "http://" + sceneB.RegionInfo.ExternalHostName + ":" + sceneB.RegionInfo.HttpPort + "/CAPS/" + sceneBCapsModule.GetCapsPath(agentId) + "0000/",
+ Is.EqualTo(client.CapsSeedUrl),
+ "Incorrect caps object path set up in sceneB");
+
+ // This assertion will currently fail since we don't remove the caps paths when no longer needed
+ //Assert.That(sceneACapsModule.GetCapsPath(agentId), Is.Null, "sceneA still had a caps object path");
+
// TODO: Check that more of everything is as it should be
// TODO: test what happens if we try to teleport to a region that doesn't exist
--
cgit v1.1