aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2010-09-06 23:00:24 +0100
committerJustin Clark-Casey (justincc)2010-09-06 23:00:24 +0100
commit953b7f491798e97b7b36808e716975b22d80114b (patch)
treeca42d90b890b05457b6a9fd736929382911c85cd /OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs
parentReflect the ParcelPropertiesUpdateRequest into Scene.EventManager, because (diff)
downloadopensim-SC-953b7f491798e97b7b36808e716975b22d80114b.zip
opensim-SC-953b7f491798e97b7b36808e716975b22d80114b.tar.gz
opensim-SC-953b7f491798e97b7b36808e716975b22d80114b.tar.bz2
opensim-SC-953b7f491798e97b7b36808e716975b22d80114b.tar.xz
Add test to check persistence of newly added pre-linked objects
Added a MockRegionDataPlugin to do in-memory persistence for tests since adding this to OpenSim.Data.Null.NullDataStore doesn't seem appropriate NullDataStore can do nothing because OpenSim only ever retrieve region objects from the database on startup. Adding an in-memory store here would be unecessary overhead.
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs53
1 files changed, 51 insertions, 2 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs
index 0b7608d..bfed204 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs
@@ -26,13 +26,13 @@
26 */ 26 */
27 27
28using System; 28using System;
29using System.Collections.Generic;
29using System.Reflection; 30using System.Reflection;
30using NUnit.Framework; 31using NUnit.Framework;
31using NUnit.Framework.SyntaxHelpers; 32using NUnit.Framework.SyntaxHelpers;
32using OpenMetaverse; 33using OpenMetaverse;
33using OpenSim.Framework; 34using OpenSim.Framework;
34using OpenSim.Framework.Communications; 35using OpenSim.Framework.Communications;
35
36using OpenSim.Region.Framework.Scenes; 36using OpenSim.Region.Framework.Scenes;
37using OpenSim.Tests.Common; 37using OpenSim.Tests.Common;
38using OpenSim.Tests.Common.Mock; 38using OpenSim.Tests.Common.Mock;
@@ -260,5 +260,54 @@ namespace OpenSim.Region.Framework.Scenes.Tests
260 && (part4.RotationOffset.W - compareQuaternion.W < 0.00003), 260 && (part4.RotationOffset.W - compareQuaternion.W < 0.00003),
261 "Badness 3"); 261 "Badness 3");
262 } 262 }
263
264 /// <summary>
265 /// Test that a new scene object which is already linked is correctly persisted to the persistence layer.
266 /// </summary>
267 [Test]
268 public void TestNewSceneObjectLinkPersistence()
269 {
270 TestHelper.InMethod();
271 log4net.Config.XmlConfigurator.Configure();
272
273 TestScene scene = SceneSetupHelpers.SetupScene();
274
275 string rootPartName = "rootpart";
276 UUID rootPartUuid = new UUID("00000000-0000-0000-0000-000000000001");
277 string linkPartName = "linkpart";
278 UUID linkPartUuid = new UUID("00000000-0000-0000-0001-000000000000");
279
280 SceneObjectPart rootPart
281 = new SceneObjectPart(UUID.Zero, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero)
282 { Name = rootPartName, UUID = rootPartUuid };
283 SceneObjectPart linkPart
284 = new SceneObjectPart(UUID.Zero, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero)
285 { Name = linkPartName, UUID = linkPartUuid };
286
287 SceneObjectGroup sog = new SceneObjectGroup(rootPart);
288 sog.AddPart(linkPart);
289 scene.AddNewSceneObject(sog, true);
290
291 // In a test, we have to crank the backup handle manually. Normally this would be done by the timer invoked
292 // scene backup thread.
293 scene.Backup(true);
294
295 List<SceneObjectGroup> storedObjects = scene.StorageManager.DataStore.LoadObjects(scene.RegionInfo.RegionID);
296 Assert.That(storedObjects.Count, Is.EqualTo(1));
297 Assert.That(storedObjects[0].Children.Count, Is.EqualTo(2));
298 Assert.That(storedObjects[0].RootPart.UUID, Is.EqualTo(rootPartUuid));
299 // TODO: assertion for child prim
300 }
301
302 /// <summary>
303 /// Test that a delink is correctly persisted to the database
304 /// </summary>
305// [Test]
306// public void TestDelinkPersistence()
307// {
308// TestHelper.InMethod();
309//
310// Scene scene = SceneSetupHelpers.SetupScene();
311// }
263 } 312 }
264} 313} \ No newline at end of file