* Rig up enough infrastructure to actually perform a successful 'standalone' teleport unit test with checks that the scene presence disappeared from sceneA and appeared in

sceneB
* However, I'm not convinced that the actual process in the test completely reflects reality, and a lot of stuff had to be rigged up (which should get resolved over time)
0.6.2-post-fixes
Justin Clarke Casey 2009-01-16 21:56:13 +00:00
parent bee9efa30e
commit eca6442bae
14 changed files with 106 additions and 42 deletions

View File

@ -179,7 +179,7 @@ namespace OpenSim.Framework
return;
}
m_log.Info("[CONFIG]: Calling Configuration Load Function...");
//m_log.Debug("[CONFIG]: Calling Configuration Load Function...");
loadFunction();
if (configurationOptions.Count <= 0)

View File

@ -814,7 +814,12 @@ namespace OpenSim.Framework
void SendWindData(Vector2[] windSpeeds);
void MoveAgentIntoRegion(RegionInfo regInfo, Vector3 pos, Vector3 look);
void InformClientOfNeighbour(ulong neighbourHandle, IPEndPoint neighbourExternalEndPoint);
void InformClientOfNeighbour(ulong neighbourHandle, IPEndPoint neighbourExternalEndPoint);
/// <summary>
/// Return circuit information for this client.
/// </summary>
/// <returns></returns>
AgentCircuitData RequestClientInfo();
void CrossRegion(ulong newRegionHandle, Vector3 pos, Vector3 lookAt, IPEndPoint newRegionExternalEndPoint,

View File

@ -1366,10 +1366,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
OutPacket(enablesimpacket, ThrottleOutPacketType.Task);
}
/// <summary>
///
/// </summary>
/// <returns></returns>
public AgentCircuitData RequestClientInfo()
{
AgentCircuitData agentData = new AgentCircuitData();

View File

@ -64,9 +64,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP.Tests
TestLLUDPServer testLLUDPServer;
TestLLPacketServer testLLPacketServer;
AgentCircuitManager acm;
SetupStack(new MockScene(), out testLLUDPServer, out testLLPacketServer, out acm);
IScene scene = new MockScene();
SetupStack(scene, out testLLUDPServer, out testLLPacketServer, out acm);
TestClient testClient = new TestClient(agent);
TestClient testClient = new TestClient(agent, scene);
ILLPacketHandler packetHandler
= new LLPacketHandler(testClient, testLLPacketServer, new ClientStackUserSettings());

View File

@ -61,7 +61,7 @@ namespace OpenSim.Region.Environment.Modules.Agent.TextureSender
agent.InventoryFolder = UUID.Zero;
agent.startpos = Vector3.Zero;
agent.CapsPath = "http://wibble.com";
client = new TestClient(agent);
client = new TestClient(agent, null);
ts = new TextureSender(client, 0, 0);
testsize = random.Next(5000,15000);
npackets = CalculateNumPackets(testsize);

View File

@ -128,6 +128,7 @@ namespace OpenSim.Region.Environment.Modules.Communications.Local
return true;
}
}
// m_log.DebugFormat("[LOCAL COMMS]: Did not find region {0} for SendCreateChildAgent", regionHandle);
return false;
}
@ -138,12 +139,16 @@ namespace OpenSim.Region.Environment.Modules.Communications.Local
{
if (s.RegionInfo.RegionHandle == regionHandle)
{
//m_log.Debug("[LOCAL COMMS]: Found region to send ChildAgentUpdate");
//m_log.DebugFormat(
// "[LOCAL COMMS]: Found region {0} {1} to send ChildAgentUpdate",
// s.RegionInfo.RegionName, regionHandle);
s.IncomingChildAgentDataUpdate(cAgentData);
return true;
}
}
//m_log.Debug("[LOCAL COMMS]: region not found for ChildAgentUpdate");
// m_log.DebugFormat("[LOCAL COMMS]: Did not find region {0} for ChildAgentUpdate", regionHandle);
return false;
}

View File

@ -2777,7 +2777,7 @@ namespace OpenSim.Region.Environment.Scenes
// Don't disable this log message - it's too helpful
m_log.DebugFormat(
"[CONNECTION BEGIN]: Scene {0} told of incoming client {1} {2} {3} (circuit code {4})",
"[CONNECTION BEGIN]: Region {0} told of incoming client {1} {2} {3} (circuit code {4})",
RegionInfo.RegionName, agent.firstname, agent.lastname, agent.AgentID, agent.circuitcode);
if (m_regInfo.EstateSettings.IsBanned(agent.AgentID))
@ -2977,13 +2977,16 @@ namespace OpenSim.Region.Environment.Scenes
public virtual bool IncomingChildAgentDataUpdate(AgentData cAgentData)
{
//Console.WriteLine(" XXX Scene IncomingChildAgentDataUpdate FULL in " + RegionInfo.RegionName);
// m_log.DebugFormat(
// "[SCENE]: Incoming child agent update for {0} in {1}", cAgentData.AgentID, RegionInfo.RegionName);
ScenePresence childAgentUpdate = GetScenePresence(cAgentData.AgentID);
if (childAgentUpdate != null)
{
childAgentUpdate.ChildAgentDataUpdate(cAgentData);
return true;
}
return false;
}
@ -3030,6 +3033,8 @@ namespace OpenSim.Region.Environment.Scenes
/// <param name="agentID"></param>
public bool IncomingCloseAgent(UUID agentID)
{
//m_log.DebugFormat("[SCENE]: Processing incoming close agent for {0}", agentID);
ScenePresence presence = m_sceneGraph.GetScenePresence(agentID);
if (presence != null)
{
@ -3056,9 +3061,11 @@ namespace OpenSim.Region.Environment.Scenes
else
presence.ControllingClient.SendShutdownConnectionNotice();
}
presence.ControllingClient.Close(true);
return true;
}
// Agent not here
return false;
}

View File

@ -758,6 +758,7 @@ namespace OpenSim.Region.Environment.Scenes
// both regions
if (avatar.ParentID != (uint)0)
avatar.StandUp();
if (!avatar.ValidateAttachments())
{
avatar.ControllingClient.SendTeleportFailed("Inconsistent attachment state");
@ -772,13 +773,13 @@ namespace OpenSim.Region.Environment.Scenes
// once we reach here...
//avatar.Scene.RemoveCapsHandler(avatar.UUID);
string capsPath = String.Empty;
AgentCircuitData agentCircuit = avatar.ControllingClient.RequestClientInfo();
agentCircuit.BaseFolder = UUID.Zero;
agentCircuit.InventoryFolder = UUID.Zero;
agentCircuit.startpos = position;
agentCircuit.child = true;
if (Util.IsOutsideView(oldRegionX, newRegionX, oldRegionY, newRegionY))
{
// brand new agent, let's create a new caps seed
@ -871,7 +872,6 @@ namespace OpenSim.Region.Environment.Scenes
teleportFlags, capsPath);
}
// TeleportFinish makes the client send CompleteMovementIntoRegion (at the destination), which
// trigers a whole shebang of things there, including MakeRoot. So let's wait for confirmation
// that the client contacted the destination before we send the attachments and close things here.

View File

@ -1017,9 +1017,12 @@ namespace OpenSim.Region.Environment.Scenes
if ((m_callbackURI != null) && !m_callbackURI.Equals(""))
{
//m_log.DebugFormat("Found callback URI {0}", m_callbackURI);
Scene.SendReleaseAgent(m_rootRegionHandle, UUID, m_callbackURI);
m_callbackURI = null;
}
//m_log.DebugFormat("Completed movement");
}
}
@ -2594,7 +2597,6 @@ namespace OpenSim.Region.Environment.Scenes
/// </summary>
public void ChildAgentDataUpdate(AgentPosition cAgentData, uint tRegionX, uint tRegionY, uint rRegionX, uint rRegionY)
{
//
if (!IsChildAgent)
return;
@ -2615,7 +2617,6 @@ namespace OpenSim.Region.Environment.Scenes
if ((cAgentData.Throttles != null) && cAgentData.Throttles.Length > 0)
ControllingClient.SetChildAgentThrottle(cAgentData.Throttles);
// Sends out the objects in the user's draw distance if m_sendTasksToChild is true.
if (m_scene.m_seeIntoRegionFromNeighbor)
m_pendingObjects = null;
@ -2662,7 +2663,6 @@ namespace OpenSim.Region.Environment.Scenes
cAgent.ControlFlags |= (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY;
}
cAgent.GodLevel = (byte)m_godlevel;
cAgent.AlwaysRun = m_setAlwaysRun;

View File

@ -63,7 +63,7 @@ namespace OpenSim.Region.Environment.Scenes.Tests
agent.CapsPath = "http://wibble.com";
scene.NewUserConnection(agent);
scene.AddNewClient(new TestClient(agent));
scene.AddNewClient(new TestClient(agent, scene));
ScenePresence presence = scene.GetScenePresence(agentId);

View File

@ -118,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
TestClient client = new TestClient(agent);
TestClient client = new TestClient(agent, scene);
scene.AddNewClient(client);
// Stage 3: Invoke agent crossing, which converts the child agent into a root agent (with appearance,

View File

@ -27,6 +27,7 @@
using Nini.Config;
using NUnit.Framework;
using NUnit.Framework.SyntaxHelpers;
using OpenMetaverse;
using OpenSim.Framework;
using OpenSim.Framework.Communications;
@ -77,9 +78,14 @@ namespace OpenSim.Region.Environment.Scenes.Tests
TestClient client = SceneTestUtils.AddRootAgent(sceneA, agentId);
client.Teleport(sceneB.RegionInfo.RegionHandle, new Vector3(100, 100, 100), new Vector3(40, 40, 40));
// FIXME: This is a hack to get the test working - really the normal OpenSim mechanisms should be used.
client.TeleportTargetScene = sceneB;
// TODO: Check that everything is as it should be
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");
// 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
}

View File

@ -28,6 +28,8 @@
using System;
using System.Collections.Generic;
using System.Net;
using System.Reflection;
using log4net;
using OpenMetaverse;
using OpenMetaverse.Packets;
using OpenSim.Framework;
@ -37,11 +39,18 @@ namespace OpenSim.Tests.Common.Mock
{
public class TestClient : IClientAPI
{
private Scene m_scene;
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
// Mock testing variables
public List<ImageDataPacket> sentdatapkt = new List<ImageDataPacket>();
public List<ImagePacketPacket> sentpktpkt = new List<ImagePacketPacket>();
// TODO: This is a really nasty (and temporary) means of telling the test client which scene to invoke setup
// methods on when a teleport is requested
public Scene TeleportTargetScene;
private TestClient TeleportSceneClient;
private IScene m_scene;
// disable warning: public events, part of the public API
#pragma warning disable 67
@ -259,7 +268,7 @@ namespace OpenSim.Tests.Common.Mock
/// <value>
/// This agent's UUID
/// </value>
private UUID myID;
private UUID m_agentId;
private Vector3 startPos = new Vector3(128, 128, 2);
@ -271,7 +280,7 @@ namespace OpenSim.Tests.Common.Mock
public virtual UUID AgentId
{
get { return myID; }
get { return m_agentId; }
}
public UUID SessionId
@ -359,11 +368,14 @@ namespace OpenSim.Tests.Common.Mock
/// Constructor
/// </summary>
/// <param name="agentData"></param>
public TestClient(AgentCircuitData agentData)
/// <param name="scene"></param>
public TestClient(AgentCircuitData agentData, IScene scene)
{
myID = agentData.AgentID;
m_agentId = agentData.AgentID;
m_firstName = agentData.firstname;
m_lastName = agentData.lastname;
m_circuitCode = agentData.circuitcode;
m_scene = scene;
}
/// <summary>
@ -376,6 +388,11 @@ namespace OpenSim.Tests.Common.Mock
{
OnTeleportLocationRequest(this, regionHandle, position, lookAt, 16);
}
public void CompleteMovement()
{
OnCompleteMovementToRegion();
}
public virtual void ActivateGesture(UUID assetId, UUID gestureId)
{
@ -465,14 +482,48 @@ namespace OpenSim.Tests.Common.Mock
{
}
public virtual void InformClientOfNeighbour(ulong neighbourHandle, IPEndPoint neighbourExternalEndPoint)
{
}
public virtual AgentCircuitData RequestClientInfo()
{
return new AgentCircuitData();
AgentCircuitData agentData = new AgentCircuitData();
agentData.AgentID = AgentId;
agentData.SessionID = UUID.Zero;
agentData.SecureSessionID = UUID.Zero;
agentData.circuitcode = m_circuitCode;
agentData.child = false;
agentData.firstname = m_firstName;
agentData.lastname = m_lastName;
agentData.CapsPath = m_scene.GetCapsPath(m_agentId);
agentData.ChildrenCapSeeds = new Dictionary<ulong,string>(m_scene.GetChildrenSeeds(m_agentId));
return agentData;
}
public virtual void InformClientOfNeighbour(ulong neighbourHandle, IPEndPoint neighbourExternalEndPoint)
{
m_log.DebugFormat("[TEST CLIENT]: Processing inform client of neighbour");
// In response to this message, we are going to make a teleport to the scene we've previous been told
// about by test code (this needs to be improved).
AgentCircuitData newAgent = RequestClientInfo();
// Stage 2: add the new client as a child agent to the scene
TeleportSceneClient = new TestClient(newAgent, TeleportTargetScene);
TeleportTargetScene.AddNewClient(TeleportSceneClient);
}
public virtual void SendRegionTeleport(ulong regionHandle, byte simAccess, IPEndPoint regionExternalEndPoint,
uint locationID, uint flags, string capsURL)
{
m_log.DebugFormat("[TEST CLIENT]: Received SendRegionTeleport");
TeleportSceneClient.CompleteMovement();
//TeleportTargetScene.AgentCrossing(newAgent.AgentID, new Vector3(90, 90, 90), false);
}
public virtual void SendTeleportFailed(string reason)
{
m_log.DebugFormat("[TEST CLIENT]: Teleport failed with reason {0}", reason);
}
public virtual void CrossRegion(ulong newRegionHandle, Vector3 pos, Vector3 lookAt,
IPEndPoint newRegionExternalEndPoint, string capsURL)
@ -487,15 +538,6 @@ namespace OpenSim.Tests.Common.Mock
{
}
public virtual void SendRegionTeleport(ulong regionHandle, byte simAccess, IPEndPoint regionExternalEndPoint,
uint locationID, uint flags, string capsURL)
{
}
public virtual void SendTeleportFailed(string reason)
{
}
public virtual void SendTeleportLocationStart()
{
}
@ -788,6 +830,7 @@ namespace OpenSim.Tests.Common.Mock
public void Close(bool ShutdownCircuit)
{
m_scene.RemoveClient(AgentId);
}
public void Start()

View File

@ -2461,6 +2461,7 @@
<Reference name="System.Drawing"/>
<Reference name="System.Xml"/>
<Reference name="System.Data"/>
<Reference name="log4net.dll"/>
<Reference name="Nini.dll" />
<Reference name="nunit.framework.dll" />
<Reference name="OpenMetaverse.dll"/>