aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2012-11-24 03:49:23 +0000
committerJustin Clark-Casey (justincc)2012-11-24 03:49:23 +0000
commit02db8b9adbfd69d117bc54288473f5240de46918 (patch)
tree9cbe64bb15ea8cea642ae5af48f3fb33904dc922 /OpenSim/Region/Framework
parentFix regression TestDeleteSceneObjectAsyncToUserInventory by adding a BasicInv... (diff)
downloadopensim-SC_OLD-02db8b9adbfd69d117bc54288473f5240de46918.zip
opensim-SC_OLD-02db8b9adbfd69d117bc54288473f5240de46918.tar.gz
opensim-SC_OLD-02db8b9adbfd69d117bc54288473f5240de46918.tar.bz2
opensim-SC_OLD-02db8b9adbfd69d117bc54288473f5240de46918.tar.xz
Combine TestDeleteSceneObjectAsync() with TestDeRezSceneObject() as they are functionally identical.
Move TestDeleteSceneObjectAsync() and TestDeleteSceneObjectAsyncToUserInventory() from SceneObjectBasicTests -> SceneObjectDeRezTests
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs104
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs81
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneObjectSpatialTests.cs4
3 files changed, 83 insertions, 106 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs
index 373094b..a07d64c 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs
@@ -34,7 +34,6 @@ using NUnit.Framework;
34using OpenMetaverse; 34using OpenMetaverse;
35using OpenSim.Framework; 35using OpenSim.Framework;
36using OpenSim.Framework.Communications; 36using OpenSim.Framework.Communications;
37using OpenSim.Region.CoreModules.Framework.InventoryAccess;
38using OpenSim.Region.Framework.Scenes; 37using OpenSim.Region.Framework.Scenes;
39using OpenSim.Services.Interfaces; 38using OpenSim.Services.Interfaces;
40using OpenSim.Tests.Common; 39using OpenSim.Tests.Common;
@@ -184,6 +183,10 @@ namespace OpenSim.Region.Framework.Scenes.Tests
184 /// <summary> 183 /// <summary>
185 /// Test deleting an object from a scene. 184 /// Test deleting an object from a scene.
186 /// </summary> 185 /// </summary>
186 /// <remarks>
187 /// This is the most basic form of delete. For all more sophisticated forms of derez (done asynchrnously
188 /// and where object can be taken to user inventory, etc.), see SceneObjectDeRezTests.
189 /// </remarks>
187 [Test] 190 [Test]
188 public void TestDeleteSceneObject() 191 public void TestDeleteSceneObject()
189 { 192 {
@@ -203,103 +206,6 @@ namespace OpenSim.Region.Framework.Scenes.Tests
203 } 206 }
204 207
205 /// <summary> 208 /// <summary>
206 /// Test deleting an object asynchronously
207 /// </summary>
208 [Test]
209 public void TestDeleteSceneObjectAsync()
210 {
211 TestHelpers.InMethod();
212 //log4net.Config.XmlConfigurator.Configure();
213
214 UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000001");
215
216 TestScene scene = new SceneHelpers().SetupScene();
217
218 // Turn off the timer on the async sog deleter - we'll crank it by hand for this test.
219 AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter;
220 sogd.Enabled = false;
221
222 SceneObjectGroup so = SceneHelpers.AddSceneObject(scene);
223
224 IClientAPI client = SceneHelpers.AddScenePresence(scene, agentId).ControllingClient;
225 scene.DeRezObjects(client, new System.Collections.Generic.List<uint>() { so.LocalId }, UUID.Zero, DeRezAction.Delete, UUID.Zero);
226
227 SceneObjectPart retrievedPart = scene.GetSceneObjectPart(so.LocalId);
228
229 Assert.That(retrievedPart, Is.Not.Null);
230
231 Assert.That(so.IsDeleted, Is.False);
232
233 sogd.InventoryDeQueueAndDelete();
234
235 Assert.That(so.IsDeleted, Is.True);
236
237 SceneObjectPart retrievedPart2 = scene.GetSceneObjectPart(so.LocalId);
238 Assert.That(retrievedPart2, Is.Null);
239 }
240
241 /// <summary>
242 /// Test deleting an object asynchronously to user inventory.
243 /// </summary>
244 [Test]
245 public void TestDeleteSceneObjectAsyncToUserInventory()
246 {
247 TestHelpers.InMethod();
248// TestHelpers.EnableLogging();
249
250 UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000001");
251 string myObjectName = "Fred";
252
253 TestScene scene = new SceneHelpers().SetupScene();
254
255 IConfigSource configSource = new IniConfigSource();
256 IConfig config = configSource.AddConfig("Modules");
257 config.Set("InventoryAccessModule", "BasicInventoryAccessModule");
258 SceneHelpers.SetupSceneModules(
259 scene, configSource, new object[] { new BasicInventoryAccessModule() });
260
261 SceneHelpers.SetupSceneModules(scene, new object[] { });
262
263 // Turn off the timer on the async sog deleter - we'll crank it by hand for this test.
264 AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter;
265 sogd.Enabled = false;
266
267 SceneObjectGroup so = SceneHelpers.AddSceneObject(scene, myObjectName, agentId);
268
269 UserAccount ua = UserAccountHelpers.CreateUserWithInventory(scene, agentId);
270 InventoryFolderBase folder1
271 = UserInventoryHelpers.CreateInventoryFolder(scene.InventoryService, ua.PrincipalID, "folder1");
272
273 IClientAPI client = SceneHelpers.AddScenePresence(scene, agentId).ControllingClient;
274 scene.DeRezObjects(client, new List<uint>() { so.LocalId }, UUID.Zero, DeRezAction.Take, folder1.ID);
275
276 SceneObjectPart retrievedPart = scene.GetSceneObjectPart(so.LocalId);
277
278 Assert.That(retrievedPart, Is.Not.Null);
279 Assert.That(so.IsDeleted, Is.False);
280
281 sogd.InventoryDeQueueAndDelete();
282
283 Assert.That(so.IsDeleted, Is.True);
284
285 SceneObjectPart retrievedPart2 = scene.GetSceneObjectPart(so.LocalId);
286 Assert.That(retrievedPart2, Is.Null);
287
288// SceneSetupHelpers.DeleteSceneObjectAsync(scene, part, DeRezAction.Take, userInfo.RootFolder.ID, client);
289
290 InventoryItemBase retrievedItem
291 = UserInventoryHelpers.GetInventoryItem(
292 scene.InventoryService, ua.PrincipalID, "folder1/" + myObjectName);
293
294 // Check that we now have the taken part in our inventory
295 Assert.That(retrievedItem, Is.Not.Null);
296
297 // Check that the taken part has actually disappeared
298// SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId);
299// Assert.That(retrievedPart, Is.Null);
300 }
301
302 /// <summary>
303 /// Changing a scene object uuid changes the root part uuid. This is a valid operation if the object is not 209 /// Changing a scene object uuid changes the root part uuid. This is a valid operation if the object is not
304 /// in a scene and is useful if one wants to supply a UUID directly rather than use the one generated by 210 /// in a scene and is useful if one wants to supply a UUID directly rather than use the one generated by
305 /// OpenSim. 211 /// OpenSim.
@@ -334,4 +240,4 @@ namespace OpenSim.Region.Framework.Scenes.Tests
334 Assert.That(sog.Parts.Length, Is.EqualTo(2)); 240 Assert.That(sog.Parts.Length, Is.EqualTo(2));
335 } 241 }
336 } 242 }
337} 243} \ No newline at end of file
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs
index 4f15791..c1522e7 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs
@@ -33,19 +33,21 @@ 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.InventoryAccess;
36using OpenSim.Region.CoreModules.World.Permissions; 37using OpenSim.Region.CoreModules.World.Permissions;
37using OpenSim.Region.Framework.Scenes; 38using OpenSim.Region.Framework.Scenes;
39using OpenSim.Services.Interfaces;
38using OpenSim.Tests.Common; 40using OpenSim.Tests.Common;
39using OpenSim.Tests.Common.Mock; 41using OpenSim.Tests.Common.Mock;
40 42
41namespace OpenSim.Region.Framework.Scenes.Tests 43namespace OpenSim.Region.Framework.Scenes.Tests
42{ 44{
43 /// <summary> 45 /// <summary>
44 /// Tests derez of scene objects by users. 46 /// Tests derez of scene objects.
45 /// </summary> 47 /// </summary>
46 /// <remarks> 48 /// <remarks>
47 /// This is at a level above the SceneObjectBasicTests, which act on the scene directly. 49 /// This is at a level above the SceneObjectBasicTests, which act on the scene directly.
48 /// TODO: These tests are very incomplete - they only test for a few conditions. 50 /// TODO: These tests are incomplete - need to test more kinds of derez (e.g. return object).
49 /// </remarks> 51 /// </remarks>
50 [TestFixture] 52 [TestFixture]
51 public class SceneObjectDeRezTests : OpenSimTestCase 53 public class SceneObjectDeRezTests : OpenSimTestCase
@@ -76,14 +78,20 @@ namespace OpenSim.Region.Framework.Scenes.Tests
76 = new SceneObjectPart(userId, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero); 78 = new SceneObjectPart(userId, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero);
77 part.Name = "obj1"; 79 part.Name = "obj1";
78 scene.AddNewSceneObject(new SceneObjectGroup(part), false); 80 scene.AddNewSceneObject(new SceneObjectGroup(part), false);
81
79 List<uint> localIds = new List<uint>(); 82 List<uint> localIds = new List<uint>();
80 localIds.Add(part.LocalId); 83 localIds.Add(part.LocalId);
81
82 scene.DeRezObjects(client, localIds, UUID.Zero, DeRezAction.Delete, UUID.Zero); 84 scene.DeRezObjects(client, localIds, UUID.Zero, DeRezAction.Delete, UUID.Zero);
85
86 // Check that object isn't deleted until we crank the sogd handle.
87 SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId);
88 Assert.That(retrievedPart, Is.Not.Null);
89 Assert.That(retrievedPart.ParentGroup.IsDeleted, Is.False);
90
83 sogd.InventoryDeQueueAndDelete(); 91 sogd.InventoryDeQueueAndDelete();
84 92
85 SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId); 93 SceneObjectPart retrievedPart2 = scene.GetSceneObjectPart(part.LocalId);
86 Assert.That(retrievedPart, Is.Null); 94 Assert.That(retrievedPart2, Is.Null);
87 } 95 }
88 96
89 /// <summary> 97 /// <summary>
@@ -124,6 +132,67 @@ namespace OpenSim.Region.Framework.Scenes.Tests
124 // Object should still be in the scene. 132 // Object should still be in the scene.
125 SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId); 133 SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId);
126 Assert.That(retrievedPart.UUID, Is.EqualTo(part.UUID)); 134 Assert.That(retrievedPart.UUID, Is.EqualTo(part.UUID));
127 } 135 }
136
137 /// <summary>
138 /// Test deleting an object asynchronously to user inventory.
139 /// </summary>
140 [Test]
141 public void TestDeleteSceneObjectAsyncToUserInventory()
142 {
143 TestHelpers.InMethod();
144// TestHelpers.EnableLogging();
145
146 UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000001");
147 string myObjectName = "Fred";
148
149 TestScene scene = new SceneHelpers().SetupScene();
150
151 IConfigSource configSource = new IniConfigSource();
152 IConfig config = configSource.AddConfig("Modules");
153 config.Set("InventoryAccessModule", "BasicInventoryAccessModule");
154 SceneHelpers.SetupSceneModules(
155 scene, configSource, new object[] { new BasicInventoryAccessModule() });
156
157 SceneHelpers.SetupSceneModules(scene, new object[] { });
158
159 // Turn off the timer on the async sog deleter - we'll crank it by hand for this test.
160 AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter;
161 sogd.Enabled = false;
162
163 SceneObjectGroup so = SceneHelpers.AddSceneObject(scene, myObjectName, agentId);
164
165 UserAccount ua = UserAccountHelpers.CreateUserWithInventory(scene, agentId);
166 InventoryFolderBase folder1
167 = UserInventoryHelpers.CreateInventoryFolder(scene.InventoryService, ua.PrincipalID, "folder1");
168
169 IClientAPI client = SceneHelpers.AddScenePresence(scene, agentId).ControllingClient;
170 scene.DeRezObjects(client, new List<uint>() { so.LocalId }, UUID.Zero, DeRezAction.Take, folder1.ID);
171
172 SceneObjectPart retrievedPart = scene.GetSceneObjectPart(so.LocalId);
173
174 Assert.That(retrievedPart, Is.Not.Null);
175 Assert.That(so.IsDeleted, Is.False);
176
177 sogd.InventoryDeQueueAndDelete();
178
179 Assert.That(so.IsDeleted, Is.True);
180
181 SceneObjectPart retrievedPart2 = scene.GetSceneObjectPart(so.LocalId);
182 Assert.That(retrievedPart2, Is.Null);
183
184// SceneSetupHelpers.DeleteSceneObjectAsync(scene, part, DeRezAction.Take, userInfo.RootFolder.ID, client);
185
186 InventoryItemBase retrievedItem
187 = UserInventoryHelpers.GetInventoryItem(
188 scene.InventoryService, ua.PrincipalID, "folder1/" + myObjectName);
189
190 // Check that we now have the taken part in our inventory
191 Assert.That(retrievedItem, Is.Not.Null);
192
193 // Check that the taken part has actually disappeared
194// SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId);
195// Assert.That(retrievedPart, Is.Null);
196 }
128 } 197 }
129} \ No newline at end of file 198} \ No newline at end of file
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectSpatialTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectSpatialTests.cs
index 5cf62c2..abaa1d1 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectSpatialTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectSpatialTests.cs
@@ -48,8 +48,10 @@ namespace OpenSim.Region.Framework.Scenes.Tests
48 UUID m_ownerId = TestHelpers.ParseTail(0x1); 48 UUID m_ownerId = TestHelpers.ParseTail(0x1);
49 49
50 [SetUp] 50 [SetUp]
51 public void SetUp() 51 public override void SetUp()
52 { 52 {
53 base.SetUp();
54
53 m_scene = new SceneHelpers().SetupScene(); 55 m_scene = new SceneHelpers().SetupScene();
54 } 56 }
55 57