From abfb7bd2cf0e5fdb0a4acbd0b1af71622b4c1307 Mon Sep 17 00:00:00 2001
From: Justin Clarke Casey
Date: Fri, 28 Nov 2008 17:41:45 +0000
Subject: * test: Separate out async deletion methods to test delete and take
copy separately. * The take copy test doesn't currently actually test the
take
---
.../Environment/Scenes/Tests/SceneObjectTests.cs | 37 +++++++++++++++-------
.../Environment/Scenes/Tests/SceneTestUtils.cs | 18 +++++++++++
2 files changed, 44 insertions(+), 11 deletions(-)
(limited to 'OpenSim/Region/Environment/Scenes/Tests')
diff --git a/OpenSim/Region/Environment/Scenes/Tests/SceneObjectTests.cs b/OpenSim/Region/Environment/Scenes/Tests/SceneObjectTests.cs
index babdee6..a6e4d4e 100644
--- a/OpenSim/Region/Environment/Scenes/Tests/SceneObjectTests.cs
+++ b/OpenSim/Region/Environment/Scenes/Tests/SceneObjectTests.cs
@@ -84,12 +84,12 @@ namespace OpenSim.Region.Environment.Scenes.Tests
SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId);
Assert.That(retrievedPart, Is.Null);
}
-
+
///
- /// Test deleting an object to user inventory
+ /// Test deleting an object asynchronously
///
[Test]
- public void TestDeleteSceneObjectToUserInventory()
+ public void TestDeleteSceneObjectAsync()
{
UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000001");
@@ -101,6 +101,28 @@ namespace OpenSim.Region.Environment.Scenes.Tests
SceneObjectPart part = SceneTestUtils.AddSceneObject(scene);
+ IClientAPI client = SceneTestUtils.AddRootAgent(scene, agentId);
+ scene.DeRezObject(client, part.LocalId, UUID.Zero, DeRezAction.Delete, UUID.Zero);
+
+ SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId);
+ Assert.That(retrievedPart, Is.Not.Null);
+
+ sogd.InventoryDeQueueAndDelete();
+ SceneObjectPart retrievedPart2 = scene.GetSceneObjectPart(part.LocalId);
+ Assert.That(retrievedPart2, Is.Null);
+ }
+
+ ///
+ /// Test deleting an object asynchronously to user inventory. Doesn't yet do what it says on the tin.
+ ///
+ [Test]
+ public void TestDeleteSceneObjectAsyncToUserInventory()
+ {
+ UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000001");
+
+ TestScene scene = SceneTestUtils.SetupScene();
+ SceneObjectPart part = SceneTestUtils.AddSceneObject(scene);
+
((LocalUserServices)scene.CommsManager.UserService).AddPlugin(new TestUserDataPlugin());
((LocalInventoryService)scene.CommsManager.InventoryService).AddPlugin(new TestInventoryDataPlugin());
@@ -110,14 +132,7 @@ namespace OpenSim.Region.Environment.Scenes.Tests
Is.EqualTo(agentId));
IClientAPI client = SceneTestUtils.AddRootAgent(scene, agentId);
- scene.DeRezObject(client, part.LocalId, UUID.Zero, DeRezAction.Return, UUID.Zero);
-
- SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId);
- Assert.That(retrievedPart, Is.Not.Null);
-
- sogd.InventoryDeQueueAndDelete();
- SceneObjectPart retrievedPart2 = scene.GetSceneObjectPart(part.LocalId);
- Assert.That(retrievedPart2, Is.Null);
+ SceneTestUtils.DeleteSceneObjectAsync(scene, part, DeRezAction.TakeCopy, client);
CachedUserInfo userInfo = scene.CommsManager.UserProfileCacheService.GetUserDetails(agentId);
Assert.That(userInfo, Is.Not.Null);
diff --git a/OpenSim/Region/Environment/Scenes/Tests/SceneTestUtils.cs b/OpenSim/Region/Environment/Scenes/Tests/SceneTestUtils.cs
index 2589368..51be872 100644
--- a/OpenSim/Region/Environment/Scenes/Tests/SceneTestUtils.cs
+++ b/OpenSim/Region/Environment/Scenes/Tests/SceneTestUtils.cs
@@ -116,5 +116,23 @@ namespace OpenSim.Region.Environment.Scenes.Tests
return part;
}
+
+ ///
+ /// Delete a scene object asynchronously
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static void DeleteSceneObjectAsync(
+ TestScene scene, SceneObjectPart part, DeRezAction action, IClientAPI client)
+ {
+ // Turn off the timer on the async sog deleter - we'll crank it by hand within a unit test
+ AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter;
+ sogd.Enabled = false;
+
+ scene.DeRezObject(client, part.LocalId, UUID.Zero, action, UUID.Zero);
+ sogd.InventoryDeQueueAndDelete();
+ }
}
}
--
cgit v1.1