aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs78
1 files changed, 75 insertions, 3 deletions
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.