Deal with possible race in TestAddNeighborRegion in ScenePresenceTests

arthursv
Teravus Ovares (Dan Olivares) 2009-08-13 23:06:29 -04:00
parent 02f55ff9bd
commit 6ece8d86e0
1 changed files with 24 additions and 0 deletions

View File

@ -147,7 +147,13 @@ namespace OpenSim.Region.Framework.Scenes.Tests
TestHelper.InMethod(); TestHelper.InMethod();
string reason; string reason;
if (acd1 == null)
fixNullPresence();
scene.NewUserConnection(acd1, out reason); scene.NewUserConnection(acd1, out reason);
if (testclient == null)
testclient = new TestClient(acd1, scene);
scene.AddNewClient(testclient); scene.AddNewClient(testclient);
ScenePresence presence = scene.GetScenePresence(agent1); ScenePresence presence = scene.GetScenePresence(agent1);
@ -162,6 +168,24 @@ namespace OpenSim.Region.Framework.Scenes.Tests
Assert.That(neighbours.Count, Is.EqualTo(2)); Assert.That(neighbours.Count, Is.EqualTo(2));
} }
public void fixNullPresence()
{
string firstName = "testfirstname";
AgentCircuitData agent = new AgentCircuitData();
agent.AgentID = agent1;
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 = GetRandomCapsObjectPath();
acd1 = agent;
}
[Test] [Test]
public void T013_TestRemoveNeighbourRegion() public void T013_TestRemoveNeighbourRegion()