aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJustin Clarke Casey2008-11-28 17:41:45 +0000
committerJustin Clarke Casey2008-11-28 17:41:45 +0000
commitabfb7bd2cf0e5fdb0a4acbd0b1af71622b4c1307 (patch)
tree67895fb7b163e272c9f7ac206815baa7d37c8bf1
parent* refactor: Replace derez destiation magic numbers with an enumeration (diff)
downloadopensim-SC_OLD-abfb7bd2cf0e5fdb0a4acbd0b1af71622b4c1307.zip
opensim-SC_OLD-abfb7bd2cf0e5fdb0a4acbd0b1af71622b4c1307.tar.gz
opensim-SC_OLD-abfb7bd2cf0e5fdb0a4acbd0b1af71622b4c1307.tar.bz2
opensim-SC_OLD-abfb7bd2cf0e5fdb0a4acbd0b1af71622b4c1307.tar.xz
* test: Separate out async deletion methods to test delete and take copy separately.
* The take copy test doesn't currently actually test the take
-rw-r--r--OpenSim/Region/Environment/Scenes/Tests/SceneObjectTests.cs37
-rw-r--r--OpenSim/Region/Environment/Scenes/Tests/SceneTestUtils.cs18
2 files changed, 44 insertions, 11 deletions
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
84 SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId); 84 SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId);
85 Assert.That(retrievedPart, Is.Null); 85 Assert.That(retrievedPart, Is.Null);
86 } 86 }
87 87
88 /// <summary> 88 /// <summary>
89 /// Test deleting an object to user inventory 89 /// Test deleting an object asynchronously
90 /// </summary> 90 /// </summary>
91 [Test] 91 [Test]
92 public void TestDeleteSceneObjectToUserInventory() 92 public void TestDeleteSceneObjectAsync()
93 { 93 {
94 UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000001"); 94 UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000001");
95 95
@@ -101,6 +101,28 @@ namespace OpenSim.Region.Environment.Scenes.Tests
101 101
102 SceneObjectPart part = SceneTestUtils.AddSceneObject(scene); 102 SceneObjectPart part = SceneTestUtils.AddSceneObject(scene);
103 103
104 IClientAPI client = SceneTestUtils.AddRootAgent(scene, agentId);
105 scene.DeRezObject(client, part.LocalId, UUID.Zero, DeRezAction.Delete, UUID.Zero);
106
107 SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId);
108 Assert.That(retrievedPart, Is.Not.Null);
109
110 sogd.InventoryDeQueueAndDelete();
111 SceneObjectPart retrievedPart2 = scene.GetSceneObjectPart(part.LocalId);
112 Assert.That(retrievedPart2, Is.Null);
113 }
114
115 /// <summary>
116 /// Test deleting an object asynchronously to user inventory. Doesn't yet do what it says on the tin.
117 /// </summary>
118 [Test]
119 public void TestDeleteSceneObjectAsyncToUserInventory()
120 {
121 UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000001");
122
123 TestScene scene = SceneTestUtils.SetupScene();
124 SceneObjectPart part = SceneTestUtils.AddSceneObject(scene);
125
104 ((LocalUserServices)scene.CommsManager.UserService).AddPlugin(new TestUserDataPlugin()); 126 ((LocalUserServices)scene.CommsManager.UserService).AddPlugin(new TestUserDataPlugin());
105 ((LocalInventoryService)scene.CommsManager.InventoryService).AddPlugin(new TestInventoryDataPlugin()); 127 ((LocalInventoryService)scene.CommsManager.InventoryService).AddPlugin(new TestInventoryDataPlugin());
106 128
@@ -110,14 +132,7 @@ namespace OpenSim.Region.Environment.Scenes.Tests
110 Is.EqualTo(agentId)); 132 Is.EqualTo(agentId));
111 133
112 IClientAPI client = SceneTestUtils.AddRootAgent(scene, agentId); 134 IClientAPI client = SceneTestUtils.AddRootAgent(scene, agentId);
113 scene.DeRezObject(client, part.LocalId, UUID.Zero, DeRezAction.Return, UUID.Zero); 135 SceneTestUtils.DeleteSceneObjectAsync(scene, part, DeRezAction.TakeCopy, client);
114
115 SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId);
116 Assert.That(retrievedPart, Is.Not.Null);
117
118 sogd.InventoryDeQueueAndDelete();
119 SceneObjectPart retrievedPart2 = scene.GetSceneObjectPart(part.LocalId);
120 Assert.That(retrievedPart2, Is.Null);
121 136
122 CachedUserInfo userInfo = scene.CommsManager.UserProfileCacheService.GetUserDetails(agentId); 137 CachedUserInfo userInfo = scene.CommsManager.UserProfileCacheService.GetUserDetails(agentId);
123 Assert.That(userInfo, Is.Not.Null); 138 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
116 116
117 return part; 117 return part;
118 } 118 }
119
120 /// <summary>
121 /// Delete a scene object asynchronously
122 /// </summary>
123 /// <param name="scene"></param>
124 /// <param name="part"></param>
125 /// <param name="action"></param>
126 /// <param name="client"></param>
127 public static void DeleteSceneObjectAsync(
128 TestScene scene, SceneObjectPart part, DeRezAction action, IClientAPI client)
129 {
130 // Turn off the timer on the async sog deleter - we'll crank it by hand within a unit test
131 AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter;
132 sogd.Enabled = false;
133
134 scene.DeRezObject(client, part.LocalId, UUID.Zero, action, UUID.Zero);
135 sogd.InventoryDeQueueAndDelete();
136 }
119 } 137 }
120} 138}