diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs | 83 |
1 files changed, 9 insertions, 74 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs index 3398a53..a07d64c 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs | |||
@@ -26,13 +26,16 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | ||
29 | using System.Reflection; | 30 | using System.Reflection; |
30 | using System.Threading; | 31 | using System.Threading; |
32 | using Nini.Config; | ||
31 | using NUnit.Framework; | 33 | using NUnit.Framework; |
32 | using OpenMetaverse; | 34 | using OpenMetaverse; |
33 | using OpenSim.Framework; | 35 | using OpenSim.Framework; |
34 | using OpenSim.Framework.Communications; | 36 | using OpenSim.Framework.Communications; |
35 | using OpenSim.Region.Framework.Scenes; | 37 | using OpenSim.Region.Framework.Scenes; |
38 | using OpenSim.Services.Interfaces; | ||
36 | using OpenSim.Tests.Common; | 39 | using OpenSim.Tests.Common; |
37 | using OpenSim.Tests.Common.Mock; | 40 | using OpenSim.Tests.Common.Mock; |
38 | 41 | ||
@@ -42,7 +45,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
42 | /// Basic scene object tests (create, read and delete but not update). | 45 | /// Basic scene object tests (create, read and delete but not update). |
43 | /// </summary> | 46 | /// </summary> |
44 | [TestFixture] | 47 | [TestFixture] |
45 | public class SceneObjectBasicTests | 48 | public class SceneObjectBasicTests : OpenSimTestCase |
46 | { | 49 | { |
47 | // [TearDown] | 50 | // [TearDown] |
48 | // public void TearDown() | 51 | // public void TearDown() |
@@ -180,6 +183,10 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
180 | /// <summary> | 183 | /// <summary> |
181 | /// Test deleting an object from a scene. | 184 | /// Test deleting an object from a scene. |
182 | /// </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> | ||
183 | [Test] | 190 | [Test] |
184 | public void TestDeleteSceneObject() | 191 | public void TestDeleteSceneObject() |
185 | { | 192 | { |
@@ -199,78 +206,6 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
199 | } | 206 | } |
200 | 207 | ||
201 | /// <summary> | 208 | /// <summary> |
202 | /// Test deleting an object asynchronously | ||
203 | /// </summary> | ||
204 | [Test] | ||
205 | public void TestDeleteSceneObjectAsync() | ||
206 | { | ||
207 | TestHelpers.InMethod(); | ||
208 | //log4net.Config.XmlConfigurator.Configure(); | ||
209 | |||
210 | UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000001"); | ||
211 | |||
212 | TestScene scene = new SceneHelpers().SetupScene(); | ||
213 | |||
214 | // Turn off the timer on the async sog deleter - we'll crank it by hand for this test. | ||
215 | AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter; | ||
216 | sogd.Enabled = false; | ||
217 | |||
218 | SceneObjectGroup so = SceneHelpers.AddSceneObject(scene); | ||
219 | |||
220 | IClientAPI client = SceneHelpers.AddScenePresence(scene, agentId).ControllingClient; | ||
221 | scene.DeRezObjects(client, new System.Collections.Generic.List<uint>() { so.LocalId }, UUID.Zero, DeRezAction.Delete, UUID.Zero); | ||
222 | |||
223 | SceneObjectPart retrievedPart = scene.GetSceneObjectPart(so.LocalId); | ||
224 | |||
225 | Assert.That(retrievedPart, Is.Not.Null); | ||
226 | |||
227 | Assert.That(so.IsDeleted, Is.False); | ||
228 | |||
229 | sogd.InventoryDeQueueAndDelete(); | ||
230 | |||
231 | Assert.That(so.IsDeleted, Is.True); | ||
232 | |||
233 | SceneObjectPart retrievedPart2 = scene.GetSceneObjectPart(so.LocalId); | ||
234 | Assert.That(retrievedPart2, Is.Null); | ||
235 | } | ||
236 | |||
237 | /// <summary> | ||
238 | /// Test deleting an object asynchronously to user inventory. | ||
239 | /// </summary> | ||
240 | //[Test] | ||
241 | //public void TestDeleteSceneObjectAsyncToUserInventory() | ||
242 | //{ | ||
243 | // TestHelper.InMethod(); | ||
244 | // //log4net.Config.XmlConfigurator.Configure(); | ||
245 | |||
246 | // UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000001"); | ||
247 | // string myObjectName = "Fred"; | ||
248 | |||
249 | // TestScene scene = SceneSetupHelpers.SetupScene(); | ||
250 | // SceneObjectPart part = SceneSetupHelpers.AddSceneObject(scene, myObjectName); | ||
251 | |||
252 | // Assert.That( | ||
253 | // scene.CommsManager.UserAdminService.AddUser( | ||
254 | // "Bob", "Hoskins", "test", "test@test.com", 1000, 1000, agentId), | ||
255 | // Is.EqualTo(agentId)); | ||
256 | |||
257 | // IClientAPI client = SceneSetupHelpers.AddRootAgent(scene, agentId); | ||
258 | |||
259 | // CachedUserInfo userInfo = scene.CommsManager.UserProfileCacheService.GetUserDetails(agentId); | ||
260 | // Assert.That(userInfo, Is.Not.Null); | ||
261 | // Assert.That(userInfo.RootFolder, Is.Not.Null); | ||
262 | |||
263 | // SceneSetupHelpers.DeleteSceneObjectAsync(scene, part, DeRezAction.Take, userInfo.RootFolder.ID, client); | ||
264 | |||
265 | // // Check that we now have the taken part in our inventory | ||
266 | // Assert.That(myObjectName, Is.EqualTo(userInfo.RootFolder.FindItemByPath(myObjectName).Name)); | ||
267 | |||
268 | // // Check that the taken part has actually disappeared | ||
269 | // SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId); | ||
270 | // Assert.That(retrievedPart, Is.Null); | ||
271 | //} | ||
272 | |||
273 | /// <summary> | ||
274 | /// 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 |
275 | /// 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 |
276 | /// OpenSim. | 211 | /// OpenSim. |
@@ -305,4 +240,4 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
305 | Assert.That(sog.Parts.Length, Is.EqualTo(2)); | 240 | Assert.That(sog.Parts.Length, Is.EqualTo(2)); |
306 | } | 241 | } |
307 | } | 242 | } |
308 | } | 243 | } \ No newline at end of file |