From e55f6d47e91556b7778744877eb7bbdb949d3dba Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Mon, 6 Sep 2010 23:28:52 +0100
Subject: 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
---
.../Scenes/Tests/SceneObjectLinkingTests.cs | 49 ++++++++++++++++++----
1 file changed, 40 insertions(+), 9 deletions(-)
(limited to 'OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs')
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs
index bddb285..93409fa 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs
@@ -268,7 +268,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
public void TestNewSceneObjectLinkPersistence()
{
TestHelper.InMethod();
- log4net.Config.XmlConfigurator.Configure();
+ //log4net.Config.XmlConfigurator.Configure();
TestScene scene = SceneSetupHelpers.SetupScene();
@@ -301,14 +301,45 @@ namespace OpenSim.Region.Framework.Scenes.Tests
}
///
- /// 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
///
-// [Test]
-// public void TestDelinkPersistence()
-// {
-// TestHelper.InMethod();
-//
-// Scene scene = SceneSetupHelpers.SetupScene();
-// }
+ //[Test]
+ public void TestDelinkPersistence()
+ {
+ TestHelper.InMethod();
+ //log4net.Config.XmlConfigurator.Configure();
+
+ 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 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));
+ }
}
}
\ No newline at end of file
--
cgit v1.1