Add test that checks correct persistence when an unlink is quickly followed by deletion of a linked part

This test is temporarily not running since it currently fails due to a bug in this area
viewer-2-initial-appearance
Justin Clark-Casey (justincc) 2010-09-06 23:28:52 +01:00
parent ab875b32c1
commit e55f6d47e9
1 changed files with 40 additions and 9 deletions

View File

@ -268,7 +268,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
public void TestNewSceneObjectLinkPersistence() public void TestNewSceneObjectLinkPersistence()
{ {
TestHelper.InMethod(); TestHelper.InMethod();
log4net.Config.XmlConfigurator.Configure(); //log4net.Config.XmlConfigurator.Configure();
TestScene scene = SceneSetupHelpers.SetupScene(); TestScene scene = SceneSetupHelpers.SetupScene();
@ -301,14 +301,45 @@ namespace OpenSim.Region.Framework.Scenes.Tests
} }
/// <summary> /// <summary>
/// Test that a delink is correctly persisted to the database /// Test that a delink of a previously linked object is correctly persisted to the database
/// </summary> /// </summary>
// [Test] //[Test]
// public void TestDelinkPersistence() public void TestDelinkPersistence()
// { {
// TestHelper.InMethod(); TestHelper.InMethod();
// //log4net.Config.XmlConfigurator.Configure();
// Scene scene = SceneSetupHelpers.SetupScene();
// } TestScene scene = SceneSetupHelpers.SetupScene();
string rootPartName = "rootpart";
UUID rootPartUuid = new UUID("00000000-0000-0000-0000-000000000001");
string linkPartName = "linkpart";
UUID linkPartUuid = new UUID("00000000-0000-0000-0001-000000000000");
SceneObjectPart rootPart
= new SceneObjectPart(UUID.Zero, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero)
{ Name = rootPartName, UUID = rootPartUuid };
SceneObjectPart linkPart
= new SceneObjectPart(UUID.Zero, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero)
{ Name = linkPartName, UUID = linkPartUuid };
SceneObjectGroup sog = new SceneObjectGroup(rootPart);
sog.AddPart(linkPart);
scene.AddNewSceneObject(sog, true);
// In a test, we have to crank the backup handle manually. Normally this would be done by the timer invoked
// scene backup thread.
scene.Backup(true);
// These changes should occur immediately without waiting for a backup pass
SceneObjectGroup groupToDelete = sog.DelinkFromGroup(linkPart, false);
scene.DeleteSceneObject(groupToDelete, false);
List<SceneObjectGroup> storedObjects = scene.StorageManager.DataStore.LoadObjects(scene.RegionInfo.RegionID);
Assert.That(storedObjects.Count, Is.EqualTo(1));
Assert.That(storedObjects[0].Children.Count, Is.EqualTo(1));
Assert.That(storedObjects[0].Children.ContainsKey(rootPartUuid));
}
} }
} }