aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2013-05-09 18:02:19 +0100
committerJustin Clark-Casey (justincc)2013-05-09 18:02:19 +0100
commit2cb2f1d7e30fa583a9f43ddd6b420deb8e9b56bd (patch)
tree9987f2b312bed1e82d9f9c69bb0f2b5a7b341b6b
parentMerge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff)
downloadopensim-SC_OLD-2cb2f1d7e30fa583a9f43ddd6b420deb8e9b56bd.zip
opensim-SC_OLD-2cb2f1d7e30fa583a9f43ddd6b420deb8e9b56bd.tar.gz
opensim-SC_OLD-2cb2f1d7e30fa583a9f43ddd6b420deb8e9b56bd.tar.bz2
opensim-SC_OLD-2cb2f1d7e30fa583a9f43ddd6b420deb8e9b56bd.tar.xz
Fix issue where objects removed via llDie() would not disappear for users looking in from neighbouring sims.
This was because this particular code path (unlike user delete) only sent kills to root presences, for no apparent good reason. Added regression test for this case. This fixes http://opensimulator.org/mantis/view.php?id=6627
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs4
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs14
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs78
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/ScenePresenceCrossingTests.cs4
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs14
-rw-r--r--OpenSim/Tests/Common/Helpers/EntityTransferHelpers.cs2
-rw-r--r--OpenSim/Tests/Common/Helpers/SceneHelpers.cs54
-rw-r--r--OpenSim/Tests/Common/Mock/TestClient.cs20
8 files changed, 102 insertions, 88 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs
index 25444e5..508743c 100644
--- a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs
@@ -833,11 +833,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
833 UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(sceneA, 0x1); 833 UserAccount ua1 = UserAccountHelpers.CreateUserWithInventory(sceneA, 0x1);
834 834
835 AgentCircuitData acd = SceneHelpers.GenerateAgentData(ua1.PrincipalID); 835 AgentCircuitData acd = SceneHelpers.GenerateAgentData(ua1.PrincipalID);
836 TestClient tc = new TestClient(acd, sceneA, sh.SceneManager); 836 TestClient tc = new TestClient(acd, sceneA);
837 List<TestClient> destinationTestClients = new List<TestClient>(); 837 List<TestClient> destinationTestClients = new List<TestClient>();
838 EntityTransferHelpers.SetUpInformClientOfNeighbour(tc, destinationTestClients); 838 EntityTransferHelpers.SetUpInformClientOfNeighbour(tc, destinationTestClients);
839 839
840 ScenePresence beforeTeleportSp = SceneHelpers.AddScenePresence(sceneA, tc, acd, sh.SceneManager); 840 ScenePresence beforeTeleportSp = SceneHelpers.AddScenePresence(sceneA, tc, acd);
841 beforeTeleportSp.AbsolutePosition = new Vector3(30, 31, 32); 841 beforeTeleportSp.AbsolutePosition = new Vector3(30, 31, 32);
842 842
843 InventoryItemBase attItem = CreateAttachmentItem(sceneA, ua1.PrincipalID, "att", 0x10, 0x20); 843 InventoryItemBase attItem = CreateAttachmentItem(sceneA, ua1.PrincipalID, "att", 0x10, 0x20);
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 9e7a986..3b2f537 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -1221,11 +1221,11 @@ namespace OpenSim.Region.Framework.Scenes
1221 /// <summary> 1221 /// <summary>
1222 /// Delete this group from its scene. 1222 /// Delete this group from its scene.
1223 /// </summary> 1223 /// </summary>
1224 /// 1224 /// <remarks>
1225 /// This only handles the in-world consequences of deletion (e.g. any avatars sitting on it are forcibly stood 1225 /// This only handles the in-world consequences of deletion (e.g. any avatars sitting on it are forcibly stood
1226 /// up and all avatars receive notification of its removal. Removal of the scene object from database backup 1226 /// up and all avatars receive notification of its removal. Removal of the scene object from database backup
1227 /// must be handled by the caller. 1227 /// must be handled by the caller.
1228 /// 1228 /// </remarks>
1229 /// <param name="silent">If true then deletion is not broadcast to clients</param> 1229 /// <param name="silent">If true then deletion is not broadcast to clients</param>
1230 public void DeleteGroupFromScene(bool silent) 1230 public void DeleteGroupFromScene(bool silent)
1231 { 1231 {
@@ -1234,10 +1234,10 @@ namespace OpenSim.Region.Framework.Scenes
1234 { 1234 {
1235 SceneObjectPart part = parts[i]; 1235 SceneObjectPart part = parts[i];
1236 1236
1237 Scene.ForEachRootScenePresence(delegate(ScenePresence avatar) 1237 Scene.ForEachScenePresence(sp =>
1238 { 1238 {
1239 if (avatar.ParentID == LocalId) 1239 if (!sp.IsChildAgent && sp.ParentID == LocalId)
1240 avatar.StandUp(); 1240 sp.StandUp();
1241 1241
1242 if (!silent) 1242 if (!silent)
1243 { 1243 {
@@ -1245,9 +1245,9 @@ namespace OpenSim.Region.Framework.Scenes
1245 if (part == m_rootPart) 1245 if (part == m_rootPart)
1246 { 1246 {
1247 if (!IsAttachment 1247 if (!IsAttachment
1248 || AttachedAvatar == avatar.ControllingClient.AgentId 1248 || AttachedAvatar == sp.UUID
1249 || !HasPrivateAttachmentPoint) 1249 || !HasPrivateAttachmentPoint)
1250 avatar.ControllingClient.SendKillObject(m_regionHandle, new List<uint> { part.LocalId }); 1250 sp.ControllingClient.SendKillObject(m_regionHandle, new List<uint> { part.LocalId });
1251 } 1251 }
1252 } 1252 }
1253 }); 1253 });
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs
index bde15cd..f738ff1 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs
@@ -33,7 +33,9 @@ using NUnit.Framework;
33using OpenMetaverse; 33using OpenMetaverse;
34using OpenSim.Framework; 34using OpenSim.Framework;
35using OpenSim.Framework.Communications; 35using OpenSim.Framework.Communications;
36using OpenSim.Region.CoreModules.Framework.EntityTransfer;
36using OpenSim.Region.CoreModules.Framework.InventoryAccess; 37using OpenSim.Region.CoreModules.Framework.InventoryAccess;
38using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation;
37using OpenSim.Region.CoreModules.World.Permissions; 39using OpenSim.Region.CoreModules.World.Permissions;
38using OpenSim.Region.Framework.Scenes; 40using OpenSim.Region.Framework.Scenes;
39using OpenSim.Services.Interfaces; 41using OpenSim.Services.Interfaces;
@@ -52,6 +54,24 @@ namespace OpenSim.Region.Framework.Scenes.Tests
52 [TestFixture] 54 [TestFixture]
53 public class SceneObjectDeRezTests : OpenSimTestCase 55 public class SceneObjectDeRezTests : OpenSimTestCase
54 { 56 {
57 [TestFixtureSetUp]
58 public void FixtureInit()
59 {
60 // Don't allow tests to be bamboozled by asynchronous events. Execute everything on the same thread.
61 // This facility was added after the original async delete tests were written, so it may be possible now
62 // to not bother explicitly disabling their async (since everything will be running sync).
63 Util.FireAndForgetMethod = FireAndForgetMethod.RegressionTest;
64 }
65
66 [TestFixtureTearDown]
67 public void TearDown()
68 {
69 // We must set this back afterwards, otherwise later tests will fail since they're expecting multiple
70 // threads. Possibly, later tests should be rewritten so none of them require async stuff (which regression
71 // tests really shouldn't).
72 Util.FireAndForgetMethod = Util.DefaultFireAndForgetMethod;
73 }
74
55 /// <summary> 75 /// <summary>
56 /// Test deleting an object from a scene. 76 /// Test deleting an object from a scene.
57 /// </summary> 77 /// </summary>
@@ -63,7 +83,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
63 UUID userId = UUID.Parse("10000000-0000-0000-0000-000000000001"); 83 UUID userId = UUID.Parse("10000000-0000-0000-0000-000000000001");
64 84
65 TestScene scene = new SceneHelpers().SetupScene(); 85 TestScene scene = new SceneHelpers().SetupScene();
66 SceneHelpers.SetupSceneModules(scene, new object[] { new PermissionsModule() }); 86 SceneHelpers.SetupSceneModules(scene, new PermissionsModule());
67 IClientAPI client = SceneHelpers.AddScenePresence(scene, userId).ControllingClient; 87 IClientAPI client = SceneHelpers.AddScenePresence(scene, userId).ControllingClient;
68 88
69 // Turn off the timer on the async sog deleter - we'll crank it by hand for this test. 89 // Turn off the timer on the async sog deleter - we'll crank it by hand for this test.
@@ -87,7 +107,59 @@ namespace OpenSim.Region.Framework.Scenes.Tests
87 sogd.InventoryDeQueueAndDelete(); 107 sogd.InventoryDeQueueAndDelete();
88 108
89 SceneObjectPart retrievedPart2 = scene.GetSceneObjectPart(part.LocalId); 109 SceneObjectPart retrievedPart2 = scene.GetSceneObjectPart(part.LocalId);
90 Assert.That(retrievedPart2, Is.Null); 110 Assert.That(retrievedPart2, Is.Null);
111 }
112
113 /// <summary>
114 /// Test that child and root agents correctly receive KillObject notifications.
115 /// </summary>
116 [Test]
117 public void TestDeRezSceneObjectToAgents()
118 {
119 TestHelpers.InMethod();
120// TestHelpers.EnableLogging();
121
122 SceneHelpers sh = new SceneHelpers();
123 TestScene sceneA = sh.SetupScene("sceneA", TestHelpers.ParseTail(0x100), 1000, 1000);
124 TestScene sceneB = sh.SetupScene("sceneB", TestHelpers.ParseTail(0x200), 1000, 999);
125
126 // We need this so that the creation of the root client for userB in sceneB can trigger the creation of a child client in sceneA
127 LocalSimulationConnectorModule lscm = new LocalSimulationConnectorModule();
128 EntityTransferModule etmB = new EntityTransferModule();
129 IConfigSource config = new IniConfigSource();
130 IConfig modulesConfig = config.AddConfig("Modules");
131 modulesConfig.Set("EntityTransferModule", etmB.Name);
132 modulesConfig.Set("SimulationServices", lscm.Name);
133 SceneHelpers.SetupSceneModules(new Scene[] { sceneA, sceneB }, config, lscm);
134 SceneHelpers.SetupSceneModules(sceneB, config, etmB);
135
136 // We need this for derez
137 SceneHelpers.SetupSceneModules(sceneA, new PermissionsModule());
138
139 UserAccount uaA = UserAccountHelpers.CreateUserWithInventory(sceneA, "Andy", "AAA", 0x1, "");
140 UserAccount uaB = UserAccountHelpers.CreateUserWithInventory(sceneA, "Brian", "BBB", 0x2, "");
141
142 TestClient clientA = (TestClient)SceneHelpers.AddScenePresence(sceneA, uaA).ControllingClient;
143
144 // This is the more long-winded route we have to take to get a child client created for userB in sceneA
145 // rather than just calling AddScenePresence() as for userA
146 AgentCircuitData acd = SceneHelpers.GenerateAgentData(uaB);
147 TestClient clientB = new TestClient(acd, sceneB);
148 List<TestClient> childClientsB = new List<TestClient>();
149 EntityTransferHelpers.SetUpInformClientOfNeighbour(clientB, childClientsB);
150
151 SceneHelpers.AddScenePresence(sceneB, clientB, acd);
152
153 SceneObjectGroup so = SceneHelpers.AddSceneObject(sceneA);
154 uint soLocalId = so.LocalId;
155
156 sceneA.DeleteSceneObject(so, false);
157
158 Assert.That(clientA.ReceivedKills.Count, Is.EqualTo(1));
159 Assert.That(clientA.ReceivedKills[0], Is.EqualTo(soLocalId));
160
161 Assert.That(childClientsB[0].ReceivedKills.Count, Is.EqualTo(1));
162 Assert.That(childClientsB[0].ReceivedKills[0], Is.EqualTo(soLocalId));
91 } 163 }
92 164
93 /// <summary> 165 /// <summary>
@@ -106,7 +178,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
106 UUID objectOwnerId = UUID.Parse("20000000-0000-0000-0000-000000000001"); 178 UUID objectOwnerId = UUID.Parse("20000000-0000-0000-0000-000000000001");
107 179
108 TestScene scene = new SceneHelpers().SetupScene(); 180 TestScene scene = new SceneHelpers().SetupScene();
109 SceneHelpers.SetupSceneModules(scene, new object[] { new PermissionsModule() }); 181 SceneHelpers.SetupSceneModules(scene, new PermissionsModule());
110 IClientAPI client = SceneHelpers.AddScenePresence(scene, userId).ControllingClient; 182 IClientAPI client = SceneHelpers.AddScenePresence(scene, userId).ControllingClient;
111 183
112 // Turn off the timer on the async sog deleter - we'll crank it by hand for this test. 184 // Turn off the timer on the async sog deleter - we'll crank it by hand for this test.
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceCrossingTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceCrossingTests.cs
index 8775949..5a72239 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceCrossingTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceCrossingTests.cs
@@ -95,11 +95,11 @@ namespace OpenSim.Region.Framework.Scenes.Tests
95 SceneHelpers.SetupSceneModules(sceneB, config, new CapabilitiesModule(), etmB); 95 SceneHelpers.SetupSceneModules(sceneB, config, new CapabilitiesModule(), etmB);
96 96
97 AgentCircuitData acd = SceneHelpers.GenerateAgentData(userId); 97 AgentCircuitData acd = SceneHelpers.GenerateAgentData(userId);
98 TestClient tc = new TestClient(acd, sceneA, sh.SceneManager); 98 TestClient tc = new TestClient(acd, sceneA);
99 List<TestClient> destinationTestClients = new List<TestClient>(); 99 List<TestClient> destinationTestClients = new List<TestClient>();
100 EntityTransferHelpers.SetUpInformClientOfNeighbour(tc, destinationTestClients); 100 EntityTransferHelpers.SetUpInformClientOfNeighbour(tc, destinationTestClients);
101 101
102 ScenePresence originalSp = SceneHelpers.AddScenePresence(sceneA, tc, acd, sh.SceneManager); 102 ScenePresence originalSp = SceneHelpers.AddScenePresence(sceneA, tc, acd);
103 originalSp.AbsolutePosition = new Vector3(128, 32, 10); 103 originalSp.AbsolutePosition = new Vector3(128, 32, 10);
104 104
105// originalSp.Flying = true; 105// originalSp.Flying = true;
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs
index de4458d..297c66b 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs
@@ -139,7 +139,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
139 Vector3 teleportPosition = new Vector3(10, 11, 12); 139 Vector3 teleportPosition = new Vector3(10, 11, 12);
140 Vector3 teleportLookAt = new Vector3(20, 21, 22); 140 Vector3 teleportLookAt = new Vector3(20, 21, 22);
141 141
142 ScenePresence sp = SceneHelpers.AddScenePresence(sceneA, userId, sh.SceneManager); 142 ScenePresence sp = SceneHelpers.AddScenePresence(sceneA, userId);
143 sp.AbsolutePosition = new Vector3(30, 31, 32); 143 sp.AbsolutePosition = new Vector3(30, 31, 32);
144 144
145 List<TestClient> destinationTestClients = new List<TestClient>(); 145 List<TestClient> destinationTestClients = new List<TestClient>();
@@ -224,7 +224,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
224 Vector3 teleportPosition = new Vector3(10, 11, 12); 224 Vector3 teleportPosition = new Vector3(10, 11, 12);
225 Vector3 teleportLookAt = new Vector3(20, 21, 22); 225 Vector3 teleportLookAt = new Vector3(20, 21, 22);
226 226
227 ScenePresence sp = SceneHelpers.AddScenePresence(sceneA, userId, sh.SceneManager); 227 ScenePresence sp = SceneHelpers.AddScenePresence(sceneA, userId);
228 sp.AbsolutePosition = preTeleportPosition; 228 sp.AbsolutePosition = preTeleportPosition;
229 229
230 // Make sceneB return false on query access 230 // Make sceneB return false on query access
@@ -300,7 +300,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
300 Vector3 teleportPosition = new Vector3(10, 11, 12); 300 Vector3 teleportPosition = new Vector3(10, 11, 12);
301 Vector3 teleportLookAt = new Vector3(20, 21, 22); 301 Vector3 teleportLookAt = new Vector3(20, 21, 22);
302 302
303 ScenePresence sp = SceneHelpers.AddScenePresence(sceneA, userId, sh.SceneManager); 303 ScenePresence sp = SceneHelpers.AddScenePresence(sceneA, userId);
304 sp.AbsolutePosition = preTeleportPosition; 304 sp.AbsolutePosition = preTeleportPosition;
305 305
306 // Make sceneB refuse CreateAgent 306 // Make sceneB refuse CreateAgent
@@ -389,7 +389,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
389 Vector3 teleportPosition = new Vector3(10, 11, 12); 389 Vector3 teleportPosition = new Vector3(10, 11, 12);
390 Vector3 teleportLookAt = new Vector3(20, 21, 22); 390 Vector3 teleportLookAt = new Vector3(20, 21, 22);
391 391
392 ScenePresence sp = SceneHelpers.AddScenePresence(sceneA, userId, sh.SceneManager); 392 ScenePresence sp = SceneHelpers.AddScenePresence(sceneA, userId);
393 sp.AbsolutePosition = preTeleportPosition; 393 sp.AbsolutePosition = preTeleportPosition;
394 394
395 sceneA.RequestTeleportLocation( 395 sceneA.RequestTeleportLocation(
@@ -428,7 +428,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
428 public void TestSameSimulatorNeighbouringRegions() 428 public void TestSameSimulatorNeighbouringRegions()
429 { 429 {
430 TestHelpers.InMethod(); 430 TestHelpers.InMethod();
431 TestHelpers.EnableLogging(); 431// TestHelpers.EnableLogging();
432 432
433 UUID userId = TestHelpers.ParseTail(0x1); 433 UUID userId = TestHelpers.ParseTail(0x1);
434 434
@@ -458,11 +458,11 @@ namespace OpenSim.Region.Framework.Scenes.Tests
458 Vector3 teleportLookAt = new Vector3(20, 21, 22); 458 Vector3 teleportLookAt = new Vector3(20, 21, 22);
459 459
460 AgentCircuitData acd = SceneHelpers.GenerateAgentData(userId); 460 AgentCircuitData acd = SceneHelpers.GenerateAgentData(userId);
461 TestClient tc = new TestClient(acd, sceneA, sh.SceneManager); 461 TestClient tc = new TestClient(acd, sceneA);
462 List<TestClient> destinationTestClients = new List<TestClient>(); 462 List<TestClient> destinationTestClients = new List<TestClient>();
463 EntityTransferHelpers.SetUpInformClientOfNeighbour(tc, destinationTestClients); 463 EntityTransferHelpers.SetUpInformClientOfNeighbour(tc, destinationTestClients);
464 464
465 ScenePresence beforeSceneASp = SceneHelpers.AddScenePresence(sceneA, tc, acd, sh.SceneManager); 465 ScenePresence beforeSceneASp = SceneHelpers.AddScenePresence(sceneA, tc, acd);
466 beforeSceneASp.AbsolutePosition = new Vector3(30, 31, 32); 466 beforeSceneASp.AbsolutePosition = new Vector3(30, 31, 32);
467 467
468 Assert.That(beforeSceneASp, Is.Not.Null); 468 Assert.That(beforeSceneASp, Is.Not.Null);
diff --git a/OpenSim/Tests/Common/Helpers/EntityTransferHelpers.cs b/OpenSim/Tests/Common/Helpers/EntityTransferHelpers.cs
index 6cc7ff2..1b960b1 100644
--- a/OpenSim/Tests/Common/Helpers/EntityTransferHelpers.cs
+++ b/OpenSim/Tests/Common/Helpers/EntityTransferHelpers.cs
@@ -82,7 +82,7 @@ namespace OpenSim.Tests.Common
82 Scene neighbourScene; 82 Scene neighbourScene;
83 SceneManager.Instance.TryGetScene(x, y, out neighbourScene); 83 SceneManager.Instance.TryGetScene(x, y, out neighbourScene);
84 84
85 TestClient neighbourTc = new TestClient(newAgent, neighbourScene, SceneManager.Instance); 85 TestClient neighbourTc = new TestClient(newAgent, neighbourScene);
86 neighbourTcs.Add(neighbourTc); 86 neighbourTcs.Add(neighbourTc);
87 neighbourScene.AddNewClient(neighbourTc, PresenceType.User); 87 neighbourScene.AddNewClient(neighbourTc, PresenceType.User);
88 }; 88 };
diff --git a/OpenSim/Tests/Common/Helpers/SceneHelpers.cs b/OpenSim/Tests/Common/Helpers/SceneHelpers.cs
index bdd9093..d9bb85e 100644
--- a/OpenSim/Tests/Common/Helpers/SceneHelpers.cs
+++ b/OpenSim/Tests/Common/Helpers/SceneHelpers.cs
@@ -447,9 +447,6 @@ namespace OpenSim.Tests.Common
447 /// Add a root agent where the details of the agent connection (apart from the id) are unimportant for the test 447 /// Add a root agent where the details of the agent connection (apart from the id) are unimportant for the test
448 /// </summary> 448 /// </summary>
449 /// <remarks> 449 /// <remarks>
450 /// This can be used for tests where there is only one region or where there are multiple non-neighbour regions
451 /// and teleport doesn't take place.
452 ///
453 /// XXX: Use the version of this method that takes the UserAccount structure wherever possible - this will 450 /// XXX: Use the version of this method that takes the UserAccount structure wherever possible - this will
454 /// make the agent circuit data (e.g. first, lastname) consistent with the user account data. 451 /// make the agent circuit data (e.g. first, lastname) consistent with the user account data.
455 /// </remarks> 452 /// </remarks>
@@ -462,22 +459,6 @@ namespace OpenSim.Tests.Common
462 } 459 }
463 460
464 /// <summary> 461 /// <summary>
465 /// Add a root agent where the details of the agent connection (apart from the id) are unimportant for the test
466 /// </summary>
467 /// <remarks>
468 /// XXX: Use the version of this method that takes the UserAccount structure wherever possible - this will
469 /// make the agent circuit data (e.g. first, lastname) consistent with the user account data.
470 /// </remarks>
471 /// <param name="scene"></param>
472 /// <param name="agentId"></param>
473 /// <param name="sceneManager"></param>
474 /// <returns></returns>
475 public static ScenePresence AddScenePresence(Scene scene, UUID agentId, SceneManager sceneManager)
476 {
477 return AddScenePresence(scene, GenerateAgentData(agentId), sceneManager);
478 }
479
480 /// <summary>
481 /// Add a root agent. 462 /// Add a root agent.
482 /// </summary> 463 /// </summary>
483 /// <param name="scene"></param> 464 /// <param name="scene"></param>
@@ -508,31 +489,7 @@ namespace OpenSim.Tests.Common
508 /// <returns></returns> 489 /// <returns></returns>
509 public static ScenePresence AddScenePresence(Scene scene, AgentCircuitData agentData) 490 public static ScenePresence AddScenePresence(Scene scene, AgentCircuitData agentData)
510 { 491 {
511 return AddScenePresence(scene, agentData, null); 492 return AddScenePresence(scene, new TestClient(agentData, scene), agentData);
512 }
513
514 /// <summary>
515 /// Add a root agent.
516 /// </summary>
517 /// <remarks>
518 /// This function
519 ///
520 /// 1) Tells the scene that an agent is coming. Normally, the login service (local if standalone, from the
521 /// userserver if grid) would give initial login data back to the client and separately tell the scene that the
522 /// agent was coming.
523 ///
524 /// 2) Connects the agent with the scene
525 ///
526 /// This function performs actions equivalent with notifying the scene that an agent is
527 /// coming and then actually connecting the agent to the scene. The one step missed out is the very first
528 /// </remarks>
529 /// <param name="scene"></param>
530 /// <param name="agentData"></param>
531 /// <param name="sceneManager"></param>
532 /// <returns></returns>
533 public static ScenePresence AddScenePresence(Scene scene, AgentCircuitData agentData, SceneManager sceneManager)
534 {
535 return AddScenePresence(scene, new TestClient(agentData, scene, sceneManager), agentData, sceneManager);
536 } 493 }
537 494
538 /// <summary> 495 /// <summary>
@@ -552,10 +509,9 @@ namespace OpenSim.Tests.Common
552 /// </remarks> 509 /// </remarks>
553 /// <param name="scene"></param> 510 /// <param name="scene"></param>
554 /// <param name="agentData"></param> 511 /// <param name="agentData"></param>
555 /// <param name="sceneManager"></param>
556 /// <returns></returns> 512 /// <returns></returns>
557 public static ScenePresence AddScenePresence( 513 public static ScenePresence AddScenePresence(
558 Scene scene, IClientAPI client, AgentCircuitData agentData, SceneManager sceneManager) 514 Scene scene, IClientAPI client, AgentCircuitData agentData)
559 { 515 {
560 // We emulate the proper login sequence here by doing things in four stages 516 // We emulate the proper login sequence here by doing things in four stages
561 517
@@ -578,10 +534,6 @@ namespace OpenSim.Tests.Common
578 /// Introduce an agent into the scene by adding a new client. 534 /// Introduce an agent into the scene by adding a new client.
579 /// </summary> 535 /// </summary>
580 /// <returns>The scene presence added</returns> 536 /// <returns>The scene presence added</returns>
581 /// <param name='sceneManager'>
582 /// Scene manager. Can be null if there is only one region in the test or multiple regions that are not
583 /// neighbours and where no teleporting takes place.
584 /// </param>
585 /// <param name='scene'></param> 537 /// <param name='scene'></param>
586 /// <param name='testClient'></param> 538 /// <param name='testClient'></param>
587 /// <param name='agentData'></param> 539 /// <param name='agentData'></param>
@@ -607,7 +559,7 @@ namespace OpenSim.Tests.Common
607 acd.child = true; 559 acd.child = true;
608 560
609 // XXX: ViaLogin may not be correct for child agents 561 // XXX: ViaLogin may not be correct for child agents
610 TestClient client = new TestClient(acd, scene, null); 562 TestClient client = new TestClient(acd, scene);
611 return IntroduceClientToScene(scene, client, acd, TeleportFlags.ViaLogin); 563 return IntroduceClientToScene(scene, client, acd, TeleportFlags.ViaLogin);
612 } 564 }
613 565
diff --git a/OpenSim/Tests/Common/Mock/TestClient.cs b/OpenSim/Tests/Common/Mock/TestClient.cs
index 664ecb6..3f9690f 100644
--- a/OpenSim/Tests/Common/Mock/TestClient.cs
+++ b/OpenSim/Tests/Common/Mock/TestClient.cs
@@ -47,9 +47,9 @@ namespace OpenSim.Tests.Common.Mock
47 EventWaitHandle wh = new EventWaitHandle (false, EventResetMode.AutoReset, "Crossing"); 47 EventWaitHandle wh = new EventWaitHandle (false, EventResetMode.AutoReset, "Crossing");
48 48
49 private Scene m_scene; 49 private Scene m_scene;
50 private SceneManager m_sceneManager;
51 50
52 // Properties so that we can get at received data for test purposes 51 // Properties so that we can get at received data for test purposes
52 public List<uint> ReceivedKills { get; private set; }
53 public List<UUID> ReceivedOfflineNotifications { get; private set; } 53 public List<UUID> ReceivedOfflineNotifications { get; private set; }
54 public List<UUID> ReceivedOnlineNotifications { get; private set; } 54 public List<UUID> ReceivedOnlineNotifications { get; private set; }
55 public List<UUID> ReceivedFriendshipTerminations { get; private set; } 55 public List<UUID> ReceivedFriendshipTerminations { get; private set; }
@@ -434,33 +434,21 @@ namespace OpenSim.Tests.Common.Mock
434 /// <summary> 434 /// <summary>
435 /// Constructor 435 /// Constructor
436 /// </summary> 436 /// </summary>
437 /// <remarks>
438 /// Can be used for a test where there is only one region or where there are multiple regions that are not
439 /// neighbours and where no teleporting takes place. In other situations, the constructor that takes in a
440 /// scene manager should be used.
441 /// </remarks>
442 /// <param name="agentData"></param>
443 /// <param name="scene"></param>
444 public TestClient(AgentCircuitData agentData, Scene scene) : this(agentData, scene, null) {}
445
446 /// <summary>
447 /// Constructor
448 /// </summary>
449 /// <param name="agentData"></param> 437 /// <param name="agentData"></param>
450 /// <param name="scene"></param> 438 /// <param name="scene"></param>
451 /// <param name="sceneManager"></param> 439 /// <param name="sceneManager"></param>
452 public TestClient(AgentCircuitData agentData, Scene scene, SceneManager sceneManager) 440 public TestClient(AgentCircuitData agentData, Scene scene)
453 { 441 {
454 m_agentId = agentData.AgentID; 442 m_agentId = agentData.AgentID;
455 m_firstName = agentData.firstname; 443 m_firstName = agentData.firstname;
456 m_lastName = agentData.lastname; 444 m_lastName = agentData.lastname;
457 m_circuitCode = agentData.circuitcode; 445 m_circuitCode = agentData.circuitcode;
458 m_scene = scene; 446 m_scene = scene;
459 m_sceneManager = sceneManager;
460 SessionId = agentData.SessionID; 447 SessionId = agentData.SessionID;
461 SecureSessionId = agentData.SecureSessionID; 448 SecureSessionId = agentData.SecureSessionID;
462 CapsSeedUrl = agentData.CapsPath; 449 CapsSeedUrl = agentData.CapsPath;
463 450
451 ReceivedKills = new List<uint>();
464 ReceivedOfflineNotifications = new List<UUID>(); 452 ReceivedOfflineNotifications = new List<UUID>();
465 ReceivedOnlineNotifications = new List<UUID>(); 453 ReceivedOnlineNotifications = new List<UUID>();
466 ReceivedFriendshipTerminations = new List<UUID>(); 454 ReceivedFriendshipTerminations = new List<UUID>();
@@ -534,11 +522,13 @@ namespace OpenSim.Tests.Common.Mock
534 522
535 public virtual void SendKillObject(ulong regionHandle, List<uint> localID) 523 public virtual void SendKillObject(ulong regionHandle, List<uint> localID)
536 { 524 {
525 ReceivedKills.AddRange(localID);
537 } 526 }
538 527
539 public virtual void SetChildAgentThrottle(byte[] throttle) 528 public virtual void SetChildAgentThrottle(byte[] throttle)
540 { 529 {
541 } 530 }
531
542 public byte[] GetThrottlesPacked(float multiplier) 532 public byte[] GetThrottlesPacked(float multiplier)
543 { 533 {
544 return new byte[0]; 534 return new byte[0];