aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs15
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs90
2 files changed, 70 insertions, 35 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index b23ddb4..ad40d6b 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -1909,8 +1909,19 @@ namespace OpenSim.Region.Framework.Scenes
1909 } 1909 }
1910 } 1910 }
1911 1911
1912 public virtual void DeRezObjects(IClientAPI remoteClient, List<uint> localIDs, 1912 /// <summary>
1913 UUID groupID, DeRezAction action, UUID destinationID) 1913 /// Derez one or more objects from the scene.
1914 /// </summary>
1915 /// <remarks>
1916 /// Won't actually remove the scene object in the case where the object is being copied to a user inventory.
1917 /// </remarks>
1918 /// <param name='remoteClient'>Client requesting derez</param>
1919 /// <param name='localIDs'>Local ids of root parts of objects to delete.</param>
1920 /// <param name='groupID'>Not currently used. Here because the client passes this to us.</param>
1921 /// <param name='action'>DeRezAction</param>
1922 /// <param name='destinationID'>User folder ID to place derezzed object</param>
1923 public virtual void DeRezObjects(
1924 IClientAPI remoteClient, List<uint> localIDs, UUID groupID, DeRezAction action, UUID destinationID)
1914 { 1925 {
1915 // First, see of we can perform the requested action and 1926 // First, see of we can perform the requested action and
1916 // build a list of eligible objects 1927 // build a list of eligible objects
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs
index 3398a53..5b334c6 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs
@@ -26,6 +26,7 @@
26 */ 26 */
27 27
28using System; 28using System;
29using System.Collections.Generic;
29using System.Reflection; 30using System.Reflection;
30using System.Threading; 31using System.Threading;
31using NUnit.Framework; 32using NUnit.Framework;
@@ -33,6 +34,7 @@ using OpenMetaverse;
33using OpenSim.Framework; 34using OpenSim.Framework;
34using OpenSim.Framework.Communications; 35using OpenSim.Framework.Communications;
35using OpenSim.Region.Framework.Scenes; 36using OpenSim.Region.Framework.Scenes;
37using OpenSim.Services.Interfaces;
36using OpenSim.Tests.Common; 38using OpenSim.Tests.Common;
37using OpenSim.Tests.Common.Mock; 39using OpenSim.Tests.Common.Mock;
38 40
@@ -42,7 +44,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
42 /// Basic scene object tests (create, read and delete but not update). 44 /// Basic scene object tests (create, read and delete but not update).
43 /// </summary> 45 /// </summary>
44 [TestFixture] 46 [TestFixture]
45 public class SceneObjectBasicTests 47 public class SceneObjectBasicTests : OpenSimTestCase
46 { 48 {
47// [TearDown] 49// [TearDown]
48// public void TearDown() 50// public void TearDown()
@@ -237,38 +239,60 @@ namespace OpenSim.Region.Framework.Scenes.Tests
237 /// <summary> 239 /// <summary>
238 /// Test deleting an object asynchronously to user inventory. 240 /// Test deleting an object asynchronously to user inventory.
239 /// </summary> 241 /// </summary>
240 //[Test] 242// [Test]
241 //public void TestDeleteSceneObjectAsyncToUserInventory() 243 public void TestDeleteSceneObjectAsyncToUserInventory()
242 //{ 244 {
243 // TestHelper.InMethod(); 245 TestHelpers.InMethod();
244 // //log4net.Config.XmlConfigurator.Configure(); 246 TestHelpers.EnableLogging();
245 247
246 // UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000001"); 248 UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000001");
247 // string myObjectName = "Fred"; 249 string myObjectName = "Fred";
248 250
249 // TestScene scene = SceneSetupHelpers.SetupScene(); 251 TestScene scene = new SceneHelpers().SetupScene();
250 // SceneObjectPart part = SceneSetupHelpers.AddSceneObject(scene, myObjectName); 252
251 253 // Turn off the timer on the async sog deleter - we'll crank it by hand for this test.
252 // Assert.That( 254 AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter;
253 // scene.CommsManager.UserAdminService.AddUser( 255 sogd.Enabled = false;
254 // "Bob", "Hoskins", "test", "test@test.com", 1000, 1000, agentId), 256
255 // Is.EqualTo(agentId)); 257 SceneObjectGroup so = SceneHelpers.AddSceneObject(scene, myObjectName, agentId);
256 258
257 // IClientAPI client = SceneSetupHelpers.AddRootAgent(scene, agentId); 259// Assert.That(
258 260// scene.CommsManager.UserAdminService.AddUser(
259 // CachedUserInfo userInfo = scene.CommsManager.UserProfileCacheService.GetUserDetails(agentId); 261// "Bob", "Hoskins", "test", "test@test.com", 1000, 1000, agentId),
260 // Assert.That(userInfo, Is.Not.Null); 262// Is.EqualTo(agentId));
261 // Assert.That(userInfo.RootFolder, Is.Not.Null); 263
262 264 UserAccount ua = UserAccountHelpers.CreateUserWithInventory(scene, agentId);
263 // SceneSetupHelpers.DeleteSceneObjectAsync(scene, part, DeRezAction.Take, userInfo.RootFolder.ID, client); 265 InventoryFolderBase folder1
264 266 = UserInventoryHelpers.CreateInventoryFolder(scene.InventoryService, ua.PrincipalID, "folder1");
265 // // Check that we now have the taken part in our inventory 267
266 // Assert.That(myObjectName, Is.EqualTo(userInfo.RootFolder.FindItemByPath(myObjectName).Name)); 268 IClientAPI client = SceneHelpers.AddScenePresence(scene, agentId).ControllingClient;
267 269 scene.DeRezObjects(client, new List<uint>() { so.LocalId }, UUID.Zero, DeRezAction.Take, folder1.ID);
268 // // Check that the taken part has actually disappeared 270
269 // SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId); 271 SceneObjectPart retrievedPart = scene.GetSceneObjectPart(so.LocalId);
270 // Assert.That(retrievedPart, Is.Null); 272
271 //} 273 Assert.That(retrievedPart, Is.Not.Null);
274 Assert.That(so.IsDeleted, Is.False);
275
276 sogd.InventoryDeQueueAndDelete();
277
278 Assert.That(so.IsDeleted, Is.True);
279
280 SceneObjectPart retrievedPart2 = scene.GetSceneObjectPart(so.LocalId);
281 Assert.That(retrievedPart2, Is.Null);
282
283// SceneSetupHelpers.DeleteSceneObjectAsync(scene, part, DeRezAction.Take, userInfo.RootFolder.ID, client);
284
285 InventoryItemBase retrievedItem
286 = UserInventoryHelpers.GetInventoryItem(
287 scene.InventoryService, ua.PrincipalID, "folder1/" + myObjectName);
288
289 // Check that we now have the taken part in our inventory
290 Assert.That(retrievedItem, Is.Not.Null);
291
292 // Check that the taken part has actually disappeared
293// SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId);
294// Assert.That(retrievedPart, Is.Null);
295 }
272 296
273 /// <summary> 297 /// <summary>
274 /// Changing a scene object uuid changes the root part uuid. This is a valid operation if the object is not 298 /// Changing a scene object uuid changes the root part uuid. This is a valid operation if the object is not