diff options
author | Justin Clark-Casey (justincc) | 2012-11-24 03:49:23 +0000 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2012-11-24 03:49:23 +0000 |
commit | 02db8b9adbfd69d117bc54288473f5240de46918 (patch) | |
tree | 9cbe64bb15ea8cea642ae5af48f3fb33904dc922 /OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs | |
parent | Fix regression TestDeleteSceneObjectAsyncToUserInventory by adding a BasicInv... (diff) | |
download | opensim-SC-02db8b9adbfd69d117bc54288473f5240de46918.zip opensim-SC-02db8b9adbfd69d117bc54288473f5240de46918.tar.gz opensim-SC-02db8b9adbfd69d117bc54288473f5240de46918.tar.bz2 opensim-SC-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/Scenes/Tests/SceneObjectBasicTests.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs | 104 |
1 files changed, 5 insertions, 99 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; | |||
34 | using OpenMetaverse; | 34 | using OpenMetaverse; |
35 | using OpenSim.Framework; | 35 | using OpenSim.Framework; |
36 | using OpenSim.Framework.Communications; | 36 | using OpenSim.Framework.Communications; |
37 | using OpenSim.Region.CoreModules.Framework.InventoryAccess; | ||
38 | using OpenSim.Region.Framework.Scenes; | 37 | using OpenSim.Region.Framework.Scenes; |
39 | using OpenSim.Services.Interfaces; | 38 | using OpenSim.Services.Interfaces; |
40 | using OpenSim.Tests.Common; | 39 | using 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 |