* Add some caps seed capability path checking to the simple non neighbours standalone region teleport test
parent
28ddc38deb
commit
884009ed33
|
@ -99,40 +99,73 @@ namespace OpenSim.Region.Environment.Scenes.Tests
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Add a root agent
|
||||
/// Generate some standard agent connection data.
|
||||
/// </summary>
|
||||
/// <param name="scene"></param>
|
||||
/// <param name="agentId"></param>
|
||||
/// <returns></returns>
|
||||
public static TestClient AddRootAgent(Scene scene, UUID agentId)
|
||||
/// <returns></returns>
|
||||
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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Add a root agent where the details of the agent connection (apart from the id) are unimportant for the test
|
||||
/// </summary>
|
||||
/// <param name="scene"></param>
|
||||
/// <param name="agentId"></param>
|
||||
/// <returns></returns>
|
||||
public static TestClient AddRootAgent(Scene scene, UUID agentId)
|
||||
{
|
||||
return AddRootAgent(scene, GenerateAgentData(agentId));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Add a root agent.
|
||||
/// </summary>
|
||||
///
|
||||
/// 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
|
||||
///
|
||||
/// <param name="scene"></param>
|
||||
/// <param name="agentData"></param>
|
||||
/// <returns></returns>
|
||||
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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -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<ICapabilitiesModule>();
|
||||
|
||||
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<ICapabilitiesModule>();
|
||||
|
||||
// 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
|
||||
|
|
|
@ -270,6 +270,11 @@ namespace OpenSim.Tests.Common.Mock
|
|||
/// This agent's UUID
|
||||
/// </value>
|
||||
private UUID m_agentId;
|
||||
|
||||
/// <value>
|
||||
/// The last caps seed url that this client was given.
|
||||
/// </value>
|
||||
public string CapsSeedUrl;
|
||||
|
||||
private Vector3 startPos = new Vector3(128, 128, 2);
|
||||
|
||||
|
@ -377,6 +382,7 @@ namespace OpenSim.Tests.Common.Mock
|
|||
m_lastName = agentData.lastname;
|
||||
m_circuitCode = agentData.circuitcode;
|
||||
m_scene = scene;
|
||||
CapsSeedUrl = agentData.CapsPath;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -496,7 +502,7 @@ namespace OpenSim.Tests.Common.Mock
|
|||
|
||||
ICapabilitiesModule capsModule = m_scene.RequestModuleInterface<ICapabilitiesModule>();
|
||||
agentData.CapsPath = capsModule.GetCapsPath(m_agentId);
|
||||
agentData.ChildrenCapSeeds = new Dictionary<ulong,string>(capsModule.GetChildrenSeeds(m_agentId));
|
||||
agentData.ChildrenCapSeeds = new Dictionary<ulong, string>(capsModule.GetChildrenSeeds(m_agentId));
|
||||
|
||||
return agentData;
|
||||
}
|
||||
|
@ -519,6 +525,8 @@ namespace OpenSim.Tests.Common.Mock
|
|||
{
|
||||
m_log.DebugFormat("[TEST CLIENT]: Received SendRegionTeleport");
|
||||
|
||||
CapsSeedUrl = capsURL;
|
||||
|
||||
TeleportSceneClient.CompleteMovement();
|
||||
//TeleportTargetScene.AgentCrossing(newAgent.AgentID, new Vector3(90, 90, 90), false);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue