From 840be97e40179c17d57e1943555643b57f47ae5a Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Fri, 26 Jul 2013 20:52:30 +0100
Subject: Fix failure in TestCreateDuplicateRootScenePresence().
This is a test setup failure since code paths when adding a duplicate root scene presence now require the EntityTransferModule to be present.
Test fixed by adding this module to test setup
---
.../Framework/Scenes/Tests/ScenePresenceAgentTests.cs | 13 +++++++++++++
1 file changed, 13 insertions(+)
(limited to 'OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs')
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs
index bbfbbfc..bbe34d2 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs
@@ -119,7 +119,20 @@ namespace OpenSim.Region.Framework.Scenes.Tests
UUID spUuid = TestHelpers.ParseTail(0x1);
+ // The etm is only invoked by this test to check whether an agent is still in transit if there is a dupe
+ EntityTransferModule etm = new EntityTransferModule();
+
+ IConfigSource config = new IniConfigSource();
+ IConfig modulesConfig = config.AddConfig("Modules");
+ modulesConfig.Set("EntityTransferModule", etm.Name);
+ 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.
+ entityTransferConfig.Set("wait_for_callback", false);
+
TestScene scene = new SceneHelpers().SetupScene();
+ SceneHelpers.SetupSceneModules(scene, config, etm);
SceneHelpers.AddScenePresence(scene, spUuid);
SceneHelpers.AddScenePresence(scene, spUuid);
--
cgit v1.1
From b16bc7b01ca0691758e66f85238d657f02271082 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Fri, 27 Sep 2013 19:14:21 +0100
Subject: refactor: rename Scene.IncomingCloseAgent() to CloseAgent() in order
to make it clear that all non-clientstack callers should be using this rather
than RemoveClient() in order to step through the ScenePresence state machine
properly.
Adds IScene.CloseAgent() to replace RemoveClient()
---
OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
(limited to 'OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs')
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs
index bbe34d2..e25bcb7 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs
@@ -146,7 +146,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
}
[Test]
- public void TestCloseAgent()
+ public void TestCloseClient()
{
TestHelpers.InMethod();
// TestHelpers.EnableLogging();
@@ -154,7 +154,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
TestScene scene = new SceneHelpers().SetupScene();
ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1));
- scene.IncomingCloseAgent(sp.UUID, false);
+ scene.CloseAgent(sp.UUID, false);
Assert.That(scene.GetScenePresence(sp.UUID), Is.Null);
Assert.That(scene.AuthenticateHandler.GetAgentCircuitData(sp.UUID), Is.Null);
--
cgit v1.1
From 2cd95fac736cc99b1a2ad661e4a03810225ffaca Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Fri, 27 Sep 2013 22:27:39 +0100
Subject: refactor: Rename Scene.AddNewClient() to AddNewAgent() to make it
obvious in the code that this is symmetric with CloseAgent()
---
OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
(limited to 'OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs')
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs
index e25bcb7..d1aeaee 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs
@@ -200,7 +200,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
// *** This is the second stage, where the client established a child agent/scene presence using the
// circuit code given to the scene in stage 1 ***
TestClient client = new TestClient(acd, scene);
- scene.AddNewClient(client, PresenceType.User);
+ scene.AddNewAgent(client, PresenceType.User);
Assert.That(scene.AuthenticateHandler.GetAgentCircuitData(agentId), Is.Not.Null);
Assert.That(scene.AuthenticateHandler.GetAgentCircuits().Count, Is.EqualTo(1));
@@ -279,7 +279,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
// string reason;
// scene.NewUserConnection(agent, (uint)TeleportFlags.ViaLogin, out reason);
// testclient = new TestClient(agent, scene);
-// scene.AddNewClient(testclient);
+// scene.AddNewAgent(testclient);
//
// ScenePresence presence = scene.GetScenePresence(agent1);
//
--
cgit v1.1
From 3ffd90496a366f2b64eb8daadf63a2b6ee05ad7a Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Thu, 16 Jan 2014 20:23:31 +0000
Subject: Prevent duplicate invocations or race dontision in
SP.CompleteMovement()
This can happen under poor network conditions if a viewer repeats the message send
If this happens, physics actors can get orphaned, which unecessarily raises physics frame times
---
.../Scenes/Tests/ScenePresenceAgentTests.cs | 92 +++++++++-------------
1 file changed, 39 insertions(+), 53 deletions(-)
(limited to 'OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs')
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs
index d1aeaee..1ff1329 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs
@@ -111,6 +111,45 @@ namespace OpenSim.Region.Framework.Scenes.Tests
Assert.That(scene.GetScenePresences().Count, Is.EqualTo(1));
}
+ ///
+ /// Test that duplicate complete movement calls are ignored.
+ ///
+ ///
+ /// If duplicate calls are not ignored then there is a risk of race conditions or other unexpected effects.
+ ///
+ [Test]
+ public void TestDupeCompleteMovementCalls()
+ {
+ TestHelpers.InMethod();
+// TestHelpers.EnableLogging();
+
+ UUID spUuid = TestHelpers.ParseTail(0x1);
+
+ TestScene scene = new SceneHelpers().SetupScene();
+
+ int makeRootAgentEvents = 0;
+ scene.EventManager.OnMakeRootAgent += spi => makeRootAgentEvents++;
+
+ ScenePresence sp = SceneHelpers.AddScenePresence(scene, spUuid);
+
+ Assert.That(makeRootAgentEvents, Is.EqualTo(1));
+
+ // Normally these would be invoked by a CompleteMovement message coming in to the UDP stack. But for
+ // convenience, here we will invoke it manually.
+ sp.CompleteMovement(sp.ControllingClient, true);
+
+ Assert.That(makeRootAgentEvents, Is.EqualTo(1));
+
+ // Check rest of exepcted parameters.
+ Assert.That(scene.AuthenticateHandler.GetAgentCircuitData(spUuid), Is.Not.Null);
+ Assert.That(scene.AuthenticateHandler.GetAgentCircuits().Count, Is.EqualTo(1));
+
+ Assert.That(sp.IsChildAgent, Is.False);
+ Assert.That(sp.UUID, Is.EqualTo(spUuid));
+
+ Assert.That(scene.GetScenePresences().Count, Is.EqualTo(1));
+ }
+
[Test]
public void TestCreateDuplicateRootScenePresence()
{
@@ -249,58 +288,5 @@ namespace OpenSim.Region.Framework.Scenes.Tests
// Assert.That(childPresence, Is.Not.Null);
// Assert.That(childPresence.IsChildAgent, Is.True);
}
-
-// ///
-// /// Test adding a root agent to a scene. Doesn't yet actually complete crossing the agent into the scene.
-// ///
-// [Test]
-// public void T010_TestAddRootAgent()
-// {
-// TestHelpers.InMethod();
-//
-// string firstName = "testfirstname";
-//
-// AgentCircuitData agent = new AgentCircuitData();
-// agent.AgentID = agent1;
-// agent.firstname = firstName;
-// agent.lastname = "testlastname";
-// agent.SessionID = UUID.Random();
-// agent.SecureSessionID = UUID.Random();
-// agent.circuitcode = 123;
-// agent.BaseFolder = UUID.Zero;
-// agent.InventoryFolder = UUID.Zero;
-// agent.startpos = Vector3.Zero;
-// agent.CapsPath = GetRandomCapsObjectPath();
-// agent.ChildrenCapSeeds = new Dictionary();
-// agent.child = true;
-//
-// scene.PresenceService.LoginAgent(agent.AgentID.ToString(), agent.SessionID, agent.SecureSessionID);
-//
-// string reason;
-// scene.NewUserConnection(agent, (uint)TeleportFlags.ViaLogin, out reason);
-// testclient = new TestClient(agent, scene);
-// scene.AddNewAgent(testclient);
-//
-// ScenePresence presence = scene.GetScenePresence(agent1);
-//
-// Assert.That(presence, Is.Not.Null, "presence is null");
-// Assert.That(presence.Firstname, Is.EqualTo(firstName), "First name not same");
-// acd1 = agent;
-// }
-//
-// ///
-// /// Test removing an uncrossed root agent from a scene.
-// ///
-// [Test]
-// public void T011_TestRemoveRootAgent()
-// {
-// TestHelpers.InMethod();
-//
-// scene.RemoveClient(agent1);
-//
-// ScenePresence presence = scene.GetScenePresence(agent1);
-//
-// Assert.That(presence, Is.Null, "presence is not null");
-// }
}
}
\ No newline at end of file
--
cgit v1.1