Uncomment SceneObjectBasicTests.TestDeleteSceneObjectAsyncToUserInventory() and make it compile again
Not currently in test suite since not yet working. Also add method doc to Scene.DeRezObjects()0.7.4-extended
parent
72e0c77f91
commit
a5fdfd6343
|
@ -1909,8 +1909,19 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void DeRezObjects(IClientAPI remoteClient, List<uint> localIDs,
|
/// <summary>
|
||||||
UUID groupID, DeRezAction action, UUID destinationID)
|
/// 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
|
// First, see of we can perform the requested action and
|
||||||
// build a list of eligible objects
|
// build a list of eligible objects
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
|
@ -33,6 +34,7 @@ using OpenMetaverse;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using OpenSim.Framework.Communications;
|
using OpenSim.Framework.Communications;
|
||||||
using OpenSim.Region.Framework.Scenes;
|
using OpenSim.Region.Framework.Scenes;
|
||||||
|
using OpenSim.Services.Interfaces;
|
||||||
using OpenSim.Tests.Common;
|
using OpenSim.Tests.Common;
|
||||||
using OpenSim.Tests.Common.Mock;
|
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).
|
/// Basic scene object tests (create, read and delete but not update).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[TestFixture]
|
[TestFixture]
|
||||||
public class SceneObjectBasicTests
|
public class SceneObjectBasicTests : OpenSimTestCase
|
||||||
{
|
{
|
||||||
// [TearDown]
|
// [TearDown]
|
||||||
// public void TearDown()
|
// public void TearDown()
|
||||||
|
@ -237,38 +239,60 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Test deleting an object asynchronously to user inventory.
|
/// Test deleting an object asynchronously to user inventory.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
//[Test]
|
// [Test]
|
||||||
//public void TestDeleteSceneObjectAsyncToUserInventory()
|
public void TestDeleteSceneObjectAsyncToUserInventory()
|
||||||
//{
|
{
|
||||||
// TestHelper.InMethod();
|
TestHelpers.InMethod();
|
||||||
// //log4net.Config.XmlConfigurator.Configure();
|
TestHelpers.EnableLogging();
|
||||||
|
|
||||||
// UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000001");
|
UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000001");
|
||||||
// string myObjectName = "Fred";
|
string myObjectName = "Fred";
|
||||||
|
|
||||||
// TestScene scene = SceneSetupHelpers.SetupScene();
|
TestScene scene = new SceneHelpers().SetupScene();
|
||||||
// SceneObjectPart part = SceneSetupHelpers.AddSceneObject(scene, myObjectName);
|
|
||||||
|
|
||||||
// Assert.That(
|
// Turn off the timer on the async sog deleter - we'll crank it by hand for this test.
|
||||||
// scene.CommsManager.UserAdminService.AddUser(
|
AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter;
|
||||||
// "Bob", "Hoskins", "test", "test@test.com", 1000, 1000, agentId),
|
sogd.Enabled = false;
|
||||||
// Is.EqualTo(agentId));
|
|
||||||
|
|
||||||
// IClientAPI client = SceneSetupHelpers.AddRootAgent(scene, agentId);
|
SceneObjectGroup so = SceneHelpers.AddSceneObject(scene, myObjectName, agentId);
|
||||||
|
|
||||||
// CachedUserInfo userInfo = scene.CommsManager.UserProfileCacheService.GetUserDetails(agentId);
|
// Assert.That(
|
||||||
// Assert.That(userInfo, Is.Not.Null);
|
// scene.CommsManager.UserAdminService.AddUser(
|
||||||
// Assert.That(userInfo.RootFolder, Is.Not.Null);
|
// "Bob", "Hoskins", "test", "test@test.com", 1000, 1000, agentId),
|
||||||
|
// Is.EqualTo(agentId));
|
||||||
|
|
||||||
// SceneSetupHelpers.DeleteSceneObjectAsync(scene, part, DeRezAction.Take, userInfo.RootFolder.ID, client);
|
UserAccount ua = UserAccountHelpers.CreateUserWithInventory(scene, agentId);
|
||||||
|
InventoryFolderBase folder1
|
||||||
|
= UserInventoryHelpers.CreateInventoryFolder(scene.InventoryService, ua.PrincipalID, "folder1");
|
||||||
|
|
||||||
// // Check that we now have the taken part in our inventory
|
IClientAPI client = SceneHelpers.AddScenePresence(scene, agentId).ControllingClient;
|
||||||
// Assert.That(myObjectName, Is.EqualTo(userInfo.RootFolder.FindItemByPath(myObjectName).Name));
|
scene.DeRezObjects(client, new List<uint>() { so.LocalId }, UUID.Zero, DeRezAction.Take, folder1.ID);
|
||||||
|
|
||||||
// // Check that the taken part has actually disappeared
|
SceneObjectPart retrievedPart = scene.GetSceneObjectPart(so.LocalId);
|
||||||
// SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId);
|
|
||||||
// Assert.That(retrievedPart, Is.Null);
|
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>
|
/// <summary>
|
||||||
/// Changing a scene object uuid changes the root part uuid. This is a valid operation if the object is not
|
/// Changing a scene object uuid changes the root part uuid. This is a valid operation if the object is not
|
||||||
|
|
Loading…
Reference in New Issue