* test: Separate out async deletion methods to test delete and take copy separately.

* The take copy test doesn't currently actually test the take
0.6.1-post-fixes
Justin Clarke Casey 2008-11-28 17:41:45 +00:00
parent df9b0e9e11
commit abfb7bd2cf
2 changed files with 44 additions and 11 deletions

View File

@ -86,10 +86,10 @@ namespace OpenSim.Region.Environment.Scenes.Tests
}
/// <summary>
/// Test deleting an object to user inventory
/// Test deleting an object asynchronously
/// </summary>
[Test]
public void TestDeleteSceneObjectToUserInventory()
public void TestDeleteSceneObjectAsync()
{
UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000001");
@ -101,6 +101,28 @@ namespace OpenSim.Region.Environment.Scenes.Tests
SceneObjectPart part = SceneTestUtils.AddSceneObject(scene);
IClientAPI client = SceneTestUtils.AddRootAgent(scene, agentId);
scene.DeRezObject(client, part.LocalId, UUID.Zero, DeRezAction.Delete, UUID.Zero);
SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId);
Assert.That(retrievedPart, Is.Not.Null);
sogd.InventoryDeQueueAndDelete();
SceneObjectPart retrievedPart2 = scene.GetSceneObjectPart(part.LocalId);
Assert.That(retrievedPart2, Is.Null);
}
/// <summary>
/// Test deleting an object asynchronously to user inventory. Doesn't yet do what it says on the tin.
/// </summary>
[Test]
public void TestDeleteSceneObjectAsyncToUserInventory()
{
UUID agentId = UUID.Parse("00000000-0000-0000-0000-000000000001");
TestScene scene = SceneTestUtils.SetupScene();
SceneObjectPart part = SceneTestUtils.AddSceneObject(scene);
((LocalUserServices)scene.CommsManager.UserService).AddPlugin(new TestUserDataPlugin());
((LocalInventoryService)scene.CommsManager.InventoryService).AddPlugin(new TestInventoryDataPlugin());
@ -110,14 +132,7 @@ namespace OpenSim.Region.Environment.Scenes.Tests
Is.EqualTo(agentId));
IClientAPI client = SceneTestUtils.AddRootAgent(scene, agentId);
scene.DeRezObject(client, part.LocalId, UUID.Zero, DeRezAction.Return, UUID.Zero);
SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId);
Assert.That(retrievedPart, Is.Not.Null);
sogd.InventoryDeQueueAndDelete();
SceneObjectPart retrievedPart2 = scene.GetSceneObjectPart(part.LocalId);
Assert.That(retrievedPart2, Is.Null);
SceneTestUtils.DeleteSceneObjectAsync(scene, part, DeRezAction.TakeCopy, client);
CachedUserInfo userInfo = scene.CommsManager.UserProfileCacheService.GetUserDetails(agentId);
Assert.That(userInfo, Is.Not.Null);

View File

@ -116,5 +116,23 @@ namespace OpenSim.Region.Environment.Scenes.Tests
return part;
}
/// <summary>
/// Delete a scene object asynchronously
/// </summary>
/// <param name="scene"></param>
/// <param name="part"></param>
/// <param name="action"></param>
/// <param name="client"></param>
public static void DeleteSceneObjectAsync(
TestScene scene, SceneObjectPart part, DeRezAction action, IClientAPI client)
{
// Turn off the timer on the async sog deleter - we'll crank it by hand within a unit test
AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter;
sogd.Enabled = false;
scene.DeRezObject(client, part.LocalId, UUID.Zero, action, UUID.Zero);
sogd.InventoryDeQueueAndDelete();
}
}
}