Combine TestDeleteSceneObjectAsync() with TestDeRezSceneObject() as they are functionally identical.
Move TestDeleteSceneObjectAsync() and TestDeleteSceneObjectAsyncToUserInventory() from SceneObjectBasicTests -> SceneObjectDeRezTests0.7.4-extended
parent
3a297c7fe6
commit
b5ecc31096
|
@ -34,7 +34,6 @@ using NUnit.Framework;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using OpenSim.Framework.Communications;
|
using OpenSim.Framework.Communications;
|
||||||
using OpenSim.Region.CoreModules.Framework.InventoryAccess;
|
|
||||||
using OpenSim.Region.Framework.Scenes;
|
using OpenSim.Region.Framework.Scenes;
|
||||||
using OpenSim.Services.Interfaces;
|
using OpenSim.Services.Interfaces;
|
||||||
using OpenSim.Tests.Common;
|
using OpenSim.Tests.Common;
|
||||||
|
@ -184,6 +183,10 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Test deleting an object from a scene.
|
/// Test deleting an object from a scene.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// This is the most basic form of delete. For all more sophisticated forms of derez (done asynchrnously
|
||||||
|
/// and where object can be taken to user inventory, etc.), see SceneObjectDeRezTests.
|
||||||
|
/// </remarks>
|
||||||
[Test]
|
[Test]
|
||||||
public void TestDeleteSceneObject()
|
public void TestDeleteSceneObject()
|
||||||
{
|
{
|
||||||
|
@ -202,103 +205,6 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||||
Assert.That(retrievedPart, Is.Null);
|
Assert.That(retrievedPart, Is.Null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Test deleting an object asynchronously
|
|
||||||
/// </summary>
|
|
||||||
[Test]
|
|
||||||
public void TestDeleteSceneObjectAsync()
|
|
||||||
{
|
|
||||||
TestHelpers.InMethod();
|
|
||||||
//log4net.Config.XmlConfigurator.Configure();
|
|
||||||
|
|
||||||
UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000001");
|
|
||||||
|
|
||||||
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);
|
|
||||||
|
|
||||||
IClientAPI client = SceneHelpers.AddScenePresence(scene, agentId).ControllingClient;
|
|
||||||
scene.DeRezObjects(client, new System.Collections.Generic.List<uint>() { so.LocalId }, UUID.Zero, DeRezAction.Delete, UUID.Zero);
|
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Test deleting an object asynchronously to user inventory.
|
|
||||||
/// </summary>
|
|
||||||
[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();
|
|
||||||
|
|
||||||
IConfigSource configSource = new IniConfigSource();
|
|
||||||
IConfig config = configSource.AddConfig("Modules");
|
|
||||||
config.Set("InventoryAccessModule", "BasicInventoryAccessModule");
|
|
||||||
SceneHelpers.SetupSceneModules(
|
|
||||||
scene, configSource, new object[] { new BasicInventoryAccessModule() });
|
|
||||||
|
|
||||||
SceneHelpers.SetupSceneModules(scene, new object[] { });
|
|
||||||
|
|
||||||
// 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);
|
|
||||||
|
|
||||||
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>
|
/// <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
|
||||||
/// in a scene and is useful if one wants to supply a UUID directly rather than use the one generated by
|
/// in a scene and is useful if one wants to supply a UUID directly rather than use the one generated by
|
||||||
|
|
|
@ -33,19 +33,21 @@ using NUnit.Framework;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using OpenSim.Framework.Communications;
|
using OpenSim.Framework.Communications;
|
||||||
|
using OpenSim.Region.CoreModules.Framework.InventoryAccess;
|
||||||
using OpenSim.Region.CoreModules.World.Permissions;
|
using OpenSim.Region.CoreModules.World.Permissions;
|
||||||
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;
|
||||||
|
|
||||||
namespace OpenSim.Region.Framework.Scenes.Tests
|
namespace OpenSim.Region.Framework.Scenes.Tests
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Tests derez of scene objects by users.
|
/// Tests derez of scene objects.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <remarks>
|
/// <remarks>
|
||||||
/// This is at a level above the SceneObjectBasicTests, which act on the scene directly.
|
/// This is at a level above the SceneObjectBasicTests, which act on the scene directly.
|
||||||
/// TODO: These tests are very incomplete - they only test for a few conditions.
|
/// TODO: These tests are incomplete - need to test more kinds of derez (e.g. return object).
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
[TestFixture]
|
[TestFixture]
|
||||||
public class SceneObjectDeRezTests : OpenSimTestCase
|
public class SceneObjectDeRezTests : OpenSimTestCase
|
||||||
|
@ -76,14 +78,20 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||||
= new SceneObjectPart(userId, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero);
|
= new SceneObjectPart(userId, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero);
|
||||||
part.Name = "obj1";
|
part.Name = "obj1";
|
||||||
scene.AddNewSceneObject(new SceneObjectGroup(part), false);
|
scene.AddNewSceneObject(new SceneObjectGroup(part), false);
|
||||||
|
|
||||||
List<uint> localIds = new List<uint>();
|
List<uint> localIds = new List<uint>();
|
||||||
localIds.Add(part.LocalId);
|
localIds.Add(part.LocalId);
|
||||||
|
|
||||||
scene.DeRezObjects(client, localIds, UUID.Zero, DeRezAction.Delete, UUID.Zero);
|
scene.DeRezObjects(client, localIds, UUID.Zero, DeRezAction.Delete, UUID.Zero);
|
||||||
|
|
||||||
|
// Check that object isn't deleted until we crank the sogd handle.
|
||||||
|
SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId);
|
||||||
|
Assert.That(retrievedPart, Is.Not.Null);
|
||||||
|
Assert.That(retrievedPart.ParentGroup.IsDeleted, Is.False);
|
||||||
|
|
||||||
sogd.InventoryDeQueueAndDelete();
|
sogd.InventoryDeQueueAndDelete();
|
||||||
|
|
||||||
SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId);
|
SceneObjectPart retrievedPart2 = scene.GetSceneObjectPart(part.LocalId);
|
||||||
Assert.That(retrievedPart, Is.Null);
|
Assert.That(retrievedPart2, Is.Null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -125,5 +133,66 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||||
SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId);
|
SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId);
|
||||||
Assert.That(retrievedPart.UUID, Is.EqualTo(part.UUID));
|
Assert.That(retrievedPart.UUID, Is.EqualTo(part.UUID));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test deleting an object asynchronously to user inventory.
|
||||||
|
/// </summary>
|
||||||
|
[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();
|
||||||
|
|
||||||
|
IConfigSource configSource = new IniConfigSource();
|
||||||
|
IConfig config = configSource.AddConfig("Modules");
|
||||||
|
config.Set("InventoryAccessModule", "BasicInventoryAccessModule");
|
||||||
|
SceneHelpers.SetupSceneModules(
|
||||||
|
scene, configSource, new object[] { new BasicInventoryAccessModule() });
|
||||||
|
|
||||||
|
SceneHelpers.SetupSceneModules(scene, new object[] { });
|
||||||
|
|
||||||
|
// 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);
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -48,8 +48,10 @@ namespace OpenSim.Region.Framework.Scenes.Tests
|
||||||
UUID m_ownerId = TestHelpers.ParseTail(0x1);
|
UUID m_ownerId = TestHelpers.ParseTail(0x1);
|
||||||
|
|
||||||
[SetUp]
|
[SetUp]
|
||||||
public void SetUp()
|
public override void SetUp()
|
||||||
{
|
{
|
||||||
|
base.SetUp();
|
||||||
|
|
||||||
m_scene = new SceneHelpers().SetupScene();
|
m_scene = new SceneHelpers().SetupScene();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue