mirror of
https://github.com/opensim/opensim.git
synced 2026-08-05 17:05:55 +08:00
Add code for testing event queue messages recevied on region cross.
This is currently disabled pending an improvement in the test code to properly add avatars when an event queue module is present.
This commit is contained in:
@@ -1206,6 +1206,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
// region doesn't take it
|
||||
m_entityTransferStateMachine.UpdateInTransit(agent.UUID, AgentTransferState.CleaningUp);
|
||||
|
||||
m_log.WarnFormat(
|
||||
"[ENTITY TRANSFER MODULE]: Region {0} would not accept update for agent {1} on cross attempt. Returning to original region.",
|
||||
neighbourRegion.RegionName, agent.Name);
|
||||
|
||||
ReInstantiateScripts(agent);
|
||||
agent.AddToPhysicalScene(isFlying);
|
||||
|
||||
@@ -1225,6 +1229,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
||||
neighbourRegion.RegionHandle);
|
||||
return agent;
|
||||
}
|
||||
|
||||
// No turning back
|
||||
agent.IsChildAgent = true;
|
||||
|
||||
|
||||
@@ -219,12 +219,15 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
|
||||
{
|
||||
// m_log.DebugFormat(
|
||||
// "[LOCAL SIMULATION CONNECTOR]: Found region {0} {1} to send AgentUpdate",
|
||||
// s.RegionInfo.RegionName, destination.RegionHandle);
|
||||
// destination.RegionName, destination.RegionID);
|
||||
|
||||
return m_scenes[destination.RegionID].IncomingChildAgentDataUpdate(cAgentData);
|
||||
}
|
||||
|
||||
// m_log.DebugFormat("[LOCAL COMMS]: Did not find region {0} for ChildAgentUpdate", regionHandle);
|
||||
// m_log.DebugFormat(
|
||||
// "[LOCAL COMMS]: Did not find region {0} {1} for ChildAgentUpdate",
|
||||
// destination.RegionName, destination.RegionID);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -239,7 +242,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
|
||||
// note that we really don't need the GridRegion for this call
|
||||
foreach (Scene s in m_scenes.Values)
|
||||
{
|
||||
//m_log.Debug("[LOCAL COMMS]: Found region to send ChildAgentUpdate");
|
||||
// m_log.Debug("[LOCAL COMMS]: Found region to send ChildAgentUpdate");
|
||||
s.IncomingChildAgentDataUpdate(cAgentData);
|
||||
}
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using Nini.Config;
|
||||
using NUnit.Framework;
|
||||
@@ -65,10 +66,11 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||
public void TestCrossOnSameSimulator()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
TestHelpers.EnableLogging();
|
||||
// TestHelpers.EnableLogging();
|
||||
|
||||
UUID userId = TestHelpers.ParseTail(0x1);
|
||||
|
||||
// TestEventQueueGetModule eqmA = new TestEventQueueGetModule();
|
||||
EntityTransferModule etmA = new EntityTransferModule();
|
||||
EntityTransferModule etmB = new EntityTransferModule();
|
||||
LocalSimulationConnectorModule lscm = new LocalSimulationConnectorModule();
|
||||
@@ -77,7 +79,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||
IConfig modulesConfig = config.AddConfig("Modules");
|
||||
modulesConfig.Set("EntityTransferModule", etmA.Name);
|
||||
modulesConfig.Set("SimulationServices", lscm.Name);
|
||||
IConfig entityTransferConfig = config.AddConfig("EntityTransfer");
|
||||
// IConfig entityTransferConfig = config.AddConfig("EntityTransfer");
|
||||
|
||||
// In order to run a single threaded regression test we do not want the entity transfer module waiting
|
||||
// for a callback from the destination scene before removing its avatar data.
|
||||
@@ -89,6 +91,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||
|
||||
SceneHelpers.SetupSceneModules(new Scene[] { sceneA, sceneB }, config, lscm);
|
||||
SceneHelpers.SetupSceneModules(sceneA, config, new CapabilitiesModule(), etmA);
|
||||
// SceneHelpers.SetupSceneModules(sceneA, config, new CapabilitiesModule(), etmA, eqmA);
|
||||
SceneHelpers.SetupSceneModules(sceneB, config, new CapabilitiesModule(), etmB);
|
||||
|
||||
ScenePresence originalSp = SceneHelpers.AddScenePresence(sceneA, userId, sh.SceneManager);
|
||||
@@ -98,6 +101,8 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||
|
||||
// Console.WriteLine("First pos {0}", originalSp.AbsolutePosition);
|
||||
|
||||
// eqmA.ClearEvents();
|
||||
|
||||
AgentUpdateArgs moveArgs = new AgentUpdateArgs();
|
||||
//moveArgs.BodyRotation = Quaternion.CreateFromEulers(Vector3.Zero);
|
||||
moveArgs.BodyRotation = Quaternion.CreateFromEulers(new Vector3(0, 0, (float)-(Math.PI / 2)));
|
||||
@@ -117,6 +122,18 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||
// Console.WriteLine("Pos {0}", originalSp.AbsolutePosition);
|
||||
}
|
||||
|
||||
// Need to sort processing of EnableSimulator message on adding scene presences before we can test eqm
|
||||
// messages
|
||||
// Dictionary<UUID, List<TestEventQueueGetModule.Event>> eqmEvents = eqmA.Events;
|
||||
//
|
||||
// Assert.That(eqmEvents.Count, Is.EqualTo(1));
|
||||
// Assert.That(eqmEvents.ContainsKey(originalSp.UUID), Is.True);
|
||||
//
|
||||
// List<TestEventQueueGetModule.Event> spEqmEvents = eqmEvents[originalSp.UUID];
|
||||
//
|
||||
// Assert.That(spEqmEvents.Count, Is.EqualTo(1));
|
||||
// Assert.That(spEqmEvents[0].Name, Is.EqualTo("CrossRegion"));
|
||||
|
||||
// sceneA should now only have a child agent
|
||||
ScenePresence spAfterCrossSceneA = sceneA.GetScenePresence(originalSp.UUID);
|
||||
Assert.That(spAfterCrossSceneA.IsChildAgent, Is.True);
|
||||
@@ -128,12 +145,12 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||
|
||||
TestClient sceneBTc = ((TestClient)spAfterCrossSceneB.ControllingClient);
|
||||
|
||||
bool receivedCompleteMovement = false;
|
||||
sceneBTc.OnReceivedMoveAgentIntoRegion += (ri, pos, look) => receivedCompleteMovement = true;
|
||||
int agentMovementCompleteReceived = 0;
|
||||
sceneBTc.OnReceivedMoveAgentIntoRegion += (ri, pos, look) => agentMovementCompleteReceived++;
|
||||
|
||||
sceneBTc.CompleteMovement();
|
||||
|
||||
Assert.That(receivedCompleteMovement, Is.True);
|
||||
Assert.That(agentMovementCompleteReceived, Is.EqualTo(1));
|
||||
Assert.That(spAfterCrossSceneB.IsChildAgent, Is.False);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user