Uncomment SceneObjectBasicTests.TestDeleteSceneObjectAsyncToUserInventory() and make it compile again

Not currently in test suite since not yet working.
Also add method doc to Scene.DeRezObjects()
integration
Justin Clark-Casey (justincc) 2012-11-10 05:43:57 +00:00
parent 2540132a54
commit c94240ba5b
2 changed files with 70 additions and 35 deletions

View File

@ -1909,8 +1909,19 @@ namespace OpenSim.Region.Framework.Scenes
}
}
public virtual void DeRezObjects(IClientAPI remoteClient, List<uint> localIDs,
UUID groupID, DeRezAction action, UUID destinationID)
/// <summary>
/// Derez one or more objects from the scene.
/// </summary>
/// <remarks>
/// Won't actually remove the scene object in the case where the object is being copied to a user inventory.
/// </remarks>
/// <param name='remoteClient'>Client requesting derez</param>
/// <param name='localIDs'>Local ids of root parts of objects to delete.</param>
/// <param name='groupID'>Not currently used. Here because the client passes this to us.</param>
/// <param name='action'>DeRezAction</param>
/// <param name='destinationID'>User folder ID to place derezzed object</param>
public virtual void DeRezObjects(
IClientAPI remoteClient, List<uint> localIDs, UUID groupID, DeRezAction action, UUID destinationID)
{
// First, see of we can perform the requested action and
// build a list of eligible objects

View File

@ -26,6 +26,7 @@
*/
using System;
using System.Collections.Generic;
using System.Reflection;
using System.Threading;
using NUnit.Framework;
@ -33,6 +34,7 @@ using OpenMetaverse;
using OpenSim.Framework;
using OpenSim.Framework.Communications;
using OpenSim.Region.Framework.Scenes;
using OpenSim.Services.Interfaces;
using OpenSim.Tests.Common;
using OpenSim.Tests.Common.Mock;
@ -42,7 +44,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
/// Basic scene object tests (create, read and delete but not update).
/// </summary>
[TestFixture]
public class SceneObjectBasicTests
public class SceneObjectBasicTests : OpenSimTestCase
{
// [TearDown]
// public void TearDown()
@ -237,38 +239,60 @@ namespace OpenSim.Region.Framework.Scenes.Tests
/// <summary>
/// Test deleting an object asynchronously to user inventory.
/// </summary>
//[Test]
//public void TestDeleteSceneObjectAsyncToUserInventory()
//{
// TestHelper.InMethod();
// //log4net.Config.XmlConfigurator.Configure();
// UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000001");
// string myObjectName = "Fred";
// TestScene scene = SceneSetupHelpers.SetupScene();
// SceneObjectPart part = SceneSetupHelpers.AddSceneObject(scene, myObjectName);
// Assert.That(
// scene.CommsManager.UserAdminService.AddUser(
// "Bob", "Hoskins", "test", "test@test.com", 1000, 1000, agentId),
// Is.EqualTo(agentId));
// IClientAPI client = SceneSetupHelpers.AddRootAgent(scene, agentId);
// CachedUserInfo userInfo = scene.CommsManager.UserProfileCacheService.GetUserDetails(agentId);
// Assert.That(userInfo, Is.Not.Null);
// Assert.That(userInfo.RootFolder, Is.Not.Null);
// SceneSetupHelpers.DeleteSceneObjectAsync(scene, part, DeRezAction.Take, userInfo.RootFolder.ID, client);
// // Check that we now have the taken part in our inventory
// Assert.That(myObjectName, Is.EqualTo(userInfo.RootFolder.FindItemByPath(myObjectName).Name));
// // Check that the taken part has actually disappeared
// SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId);
// Assert.That(retrievedPart, Is.Null);
//}
// [Test]
public void TestDeleteSceneObjectAsyncToUserInventory()
{
TestHelpers.InMethod();
TestHelpers.EnableLogging();
UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000001");
string myObjectName = "Fred";
TestScene scene = new SceneHelpers().SetupScene();
// Turn off the timer on the async sog deleter - we'll crank it by hand for this test.
AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter;
sogd.Enabled = false;
SceneObjectGroup so = SceneHelpers.AddSceneObject(scene, myObjectName, agentId);
// Assert.That(
// scene.CommsManager.UserAdminService.AddUser(
// "Bob", "Hoskins", "test", "test@test.com", 1000, 1000, agentId),
// Is.EqualTo(agentId));
UserAccount ua = UserAccountHelpers.CreateUserWithInventory(scene, agentId);
InventoryFolderBase folder1
= UserInventoryHelpers.CreateInventoryFolder(scene.InventoryService, ua.PrincipalID, "folder1");
IClientAPI client = SceneHelpers.AddScenePresence(scene, agentId).ControllingClient;
scene.DeRezObjects(client, new List<uint>() { so.LocalId }, UUID.Zero, DeRezAction.Take, folder1.ID);
SceneObjectPart retrievedPart = scene.GetSceneObjectPart(so.LocalId);
Assert.That(retrievedPart, Is.Not.Null);
Assert.That(so.IsDeleted, Is.False);
sogd.InventoryDeQueueAndDelete();
Assert.That(so.IsDeleted, Is.True);
SceneObjectPart retrievedPart2 = scene.GetSceneObjectPart(so.LocalId);
Assert.That(retrievedPart2, Is.Null);
// SceneSetupHelpers.DeleteSceneObjectAsync(scene, part, DeRezAction.Take, userInfo.RootFolder.ID, client);
InventoryItemBase retrievedItem
= UserInventoryHelpers.GetInventoryItem(
scene.InventoryService, ua.PrincipalID, "folder1/" + myObjectName);
// Check that we now have the taken part in our inventory
Assert.That(retrievedItem, Is.Not.Null);
// Check that the taken part has actually disappeared
// SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId);
// Assert.That(retrievedPart, Is.Null);
}
/// <summary>
/// Changing a scene object uuid changes the root part uuid. This is a valid operation if the object is not