From b34743e5fe6b0783caa62c014ff86e2ec76c8184 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Tue, 22 Mar 2011 23:47:36 +0000
Subject: Add an initial confidence-building TestAddObject() for prim counts.
---
.../World/Land/Tests/PrimCountModuleTests.cs | 75 ++++++++++++++++++++++
1 file changed, 75 insertions(+)
create mode 100644 OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs
(limited to 'OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs')
diff --git a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs
new file mode 100644
index 0000000..402965f
--- /dev/null
+++ b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) Contributors, http://opensimulator.org/
+ * See CONTRIBUTORS.TXT for a full list of copyright holders.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of the OpenSimulator Project nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+using System;
+using System.Collections.Generic;
+using System.Reflection;
+using log4net.Config;
+using NUnit.Framework;
+using OpenMetaverse;
+using OpenMetaverse.Assets;
+using OpenSim.Framework;
+using OpenSim.Region.Framework.Interfaces;
+using OpenSim.Region.Framework.Scenes;
+using OpenSim.Tests.Common;
+using OpenSim.Tests.Common.Mock;
+using OpenSim.Tests.Common.Setup;
+
+namespace OpenSim.Region.CoreModules.World.Land.Tests
+{
+ [TestFixture]
+ public class PrimCountModuleTests
+ {
+ [Test]
+ public void TestAddObject()
+ {
+ TestHelper.InMethod();
+// log4net.Config.XmlConfigurator.Configure();
+
+ PrimCountModule pcm = new PrimCountModule();
+ LandManagementModule lmm = new LandManagementModule();
+ Scene scene = SceneSetupHelpers.SetupScene();
+ SceneSetupHelpers.SetupSceneModules(scene, lmm, pcm);
+
+ ILandObject lo = new LandObject(UUID.Zero, false, scene);
+ lo.SetLandBitmap(lo.GetSquareLandBitmap(0, 0, (int)Constants.RegionSize, (int)Constants.RegionSize));
+ lmm.AddLandObject(lo);
+ //scene.loadAllLandObjectsFromStorage(scene.RegionInfo.originRegionID);
+
+ string objName = "obj1";
+ UUID objUuid = new UUID("00000000-0000-0000-0000-000000000001");
+
+ SceneObjectPart part
+ = new SceneObjectPart(UUID.Zero, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero)
+ { Name = objName, UUID = objUuid };
+
+ scene.AddNewSceneObject(new SceneObjectGroup(part), false);
+
+ Assert.That(pcm.GetOwnerCount(lo.LandData.GlobalID), Is.EqualTo(1));
+ }
+ }
+}
\ No newline at end of file
--
cgit v1.1
From d011896341d09ce6c10a801264e663b6a19f0b48 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Wed, 23 Mar 2011 21:50:56 +0000
Subject: Add generic EventManager.OnObjectAddedToScene and get PrimCountModule
to listen for that rather than EventManager.OnParcelPrimCountAdd
OnParcelPrimCountAdd had the wrong semantics for the PrimCountModule - it was invoked for every entity in the scene, not just new ones, which would screw up the untainted count.
Extend automated test for this scenario.
---
OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs | 2 ++
1 file changed, 2 insertions(+)
(limited to 'OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs')
diff --git a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs
index 402965f..fd332ed 100644
--- a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs
+++ b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs
@@ -67,6 +67,8 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests
= new SceneObjectPart(UUID.Zero, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero)
{ Name = objName, UUID = objUuid };
+ Assert.That(pcm.GetOwnerCount(lo.LandData.GlobalID), Is.EqualTo(0));
+
scene.AddNewSceneObject(new SceneObjectGroup(part), false);
Assert.That(pcm.GetOwnerCount(lo.LandData.GlobalID), Is.EqualTo(1));
--
cgit v1.1
From 654aa7abeb497e024c87e2ef8d610ba3ca512c3e Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Wed, 23 Mar 2011 22:12:20 +0000
Subject: Extend simple PCM add object test to check all counts
---
.../CoreModules/World/Land/Tests/PrimCountModuleTests.cs | 11 +++++++++++
1 file changed, 11 insertions(+)
(limited to 'OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs')
diff --git a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs
index fd332ed..88c814e 100644
--- a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs
+++ b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs
@@ -55,6 +55,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests
Scene scene = SceneSetupHelpers.SetupScene();
SceneSetupHelpers.SetupSceneModules(scene, lmm, pcm);
+ UUID dummyUserId = new UUID("99999999-9999-9999-9999-999999999999");
ILandObject lo = new LandObject(UUID.Zero, false, scene);
lo.SetLandBitmap(lo.GetSquareLandBitmap(0, 0, (int)Constants.RegionSize, (int)Constants.RegionSize));
lmm.AddLandObject(lo);
@@ -68,10 +69,20 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests
{ Name = objName, UUID = objUuid };
Assert.That(pcm.GetOwnerCount(lo.LandData.GlobalID), Is.EqualTo(0));
+ Assert.That(pcm.GetGroupCount(lo.LandData.GlobalID), Is.EqualTo(0));
+ Assert.That(pcm.GetOthersCount(lo.LandData.GlobalID), Is.EqualTo(0));
+ Assert.That(pcm.GetUserCount(lo.LandData.GlobalID, UUID.Zero), Is.EqualTo(0));
+ Assert.That(pcm.GetUserCount(lo.LandData.GlobalID, dummyUserId), Is.EqualTo(0));
+ Assert.That(pcm.GetSimulatorCount(lo.LandData.GlobalID), Is.EqualTo(0));
scene.AddNewSceneObject(new SceneObjectGroup(part), false);
Assert.That(pcm.GetOwnerCount(lo.LandData.GlobalID), Is.EqualTo(1));
+ Assert.That(pcm.GetGroupCount(lo.LandData.GlobalID), Is.EqualTo(0));
+ Assert.That(pcm.GetOthersCount(lo.LandData.GlobalID), Is.EqualTo(0));
+ Assert.That(pcm.GetUserCount(lo.LandData.GlobalID, UUID.Zero), Is.EqualTo(1));
+ Assert.That(pcm.GetUserCount(lo.LandData.GlobalID, dummyUserId), Is.EqualTo(0));
+ Assert.That(pcm.GetSimulatorCount(lo.LandData.GlobalID), Is.EqualTo(1));
}
}
}
\ No newline at end of file
--
cgit v1.1
From f1f4985ab6fc98daf2263f72397fe7db79b20ecd Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Wed, 23 Mar 2011 22:14:04 +0000
Subject: user a non UUID.Zero user in pcm test to avoid any special treatment
of UUID.Zero
---
.../Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
(limited to 'OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs')
diff --git a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs
index 88c814e..639d781 100644
--- a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs
+++ b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs
@@ -55,8 +55,9 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests
Scene scene = SceneSetupHelpers.SetupScene();
SceneSetupHelpers.SetupSceneModules(scene, lmm, pcm);
+ UUID userId = new UUID("00000000-0000-0000-0000-000000000010");
UUID dummyUserId = new UUID("99999999-9999-9999-9999-999999999999");
- ILandObject lo = new LandObject(UUID.Zero, false, scene);
+ ILandObject lo = new LandObject(userId, false, scene);
lo.SetLandBitmap(lo.GetSquareLandBitmap(0, 0, (int)Constants.RegionSize, (int)Constants.RegionSize));
lmm.AddLandObject(lo);
//scene.loadAllLandObjectsFromStorage(scene.RegionInfo.originRegionID);
@@ -65,13 +66,13 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests
UUID objUuid = new UUID("00000000-0000-0000-0000-000000000001");
SceneObjectPart part
- = new SceneObjectPart(UUID.Zero, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero)
+ = new SceneObjectPart(userId, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero)
{ Name = objName, UUID = objUuid };
Assert.That(pcm.GetOwnerCount(lo.LandData.GlobalID), Is.EqualTo(0));
Assert.That(pcm.GetGroupCount(lo.LandData.GlobalID), Is.EqualTo(0));
Assert.That(pcm.GetOthersCount(lo.LandData.GlobalID), Is.EqualTo(0));
- Assert.That(pcm.GetUserCount(lo.LandData.GlobalID, UUID.Zero), Is.EqualTo(0));
+ Assert.That(pcm.GetUserCount(lo.LandData.GlobalID, userId), Is.EqualTo(0));
Assert.That(pcm.GetUserCount(lo.LandData.GlobalID, dummyUserId), Is.EqualTo(0));
Assert.That(pcm.GetSimulatorCount(lo.LandData.GlobalID), Is.EqualTo(0));
@@ -80,7 +81,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests
Assert.That(pcm.GetOwnerCount(lo.LandData.GlobalID), Is.EqualTo(1));
Assert.That(pcm.GetGroupCount(lo.LandData.GlobalID), Is.EqualTo(0));
Assert.That(pcm.GetOthersCount(lo.LandData.GlobalID), Is.EqualTo(0));
- Assert.That(pcm.GetUserCount(lo.LandData.GlobalID, UUID.Zero), Is.EqualTo(1));
+ Assert.That(pcm.GetUserCount(lo.LandData.GlobalID, userId), Is.EqualTo(1));
Assert.That(pcm.GetUserCount(lo.LandData.GlobalID, dummyUserId), Is.EqualTo(0));
Assert.That(pcm.GetSimulatorCount(lo.LandData.GlobalID), Is.EqualTo(1));
}
--
cgit v1.1
From 88673c86a4b9cde729c62fbdc92b8c9076c54230 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Wed, 23 Mar 2011 22:17:47 +0000
Subject: use a 3 part object for the pcm test rather than a 1 part, for
improved test coverage
---
.../World/Land/Tests/PrimCountModuleTests.cs | 24 +++++++++++++---------
1 file changed, 14 insertions(+), 10 deletions(-)
(limited to 'OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs')
diff --git a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs
index 639d781..8c1b6a3 100644
--- a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs
+++ b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs
@@ -61,13 +61,17 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests
lo.SetLandBitmap(lo.GetSquareLandBitmap(0, 0, (int)Constants.RegionSize, (int)Constants.RegionSize));
lmm.AddLandObject(lo);
//scene.loadAllLandObjectsFromStorage(scene.RegionInfo.originRegionID);
-
- string objName = "obj1";
- UUID objUuid = new UUID("00000000-0000-0000-0000-000000000001");
-
- SceneObjectPart part
+
+ SceneObjectPart part1
= new SceneObjectPart(userId, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero)
- { Name = objName, UUID = objUuid };
+ { Name = "obj1", UUID = new UUID("00000000-0000-0000-0000-000000000001") };
+ SceneObjectGroup sog = new SceneObjectGroup(part1);
+ sog.AddPart(
+ new SceneObjectPart(userId, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero)
+ { Name = "obj2", UUID = new UUID("00000000-0000-0000-0000-000000000002") });
+ sog.AddPart(
+ new SceneObjectPart(userId, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero)
+ { Name = "obj3", UUID = new UUID("00000000-0000-0000-0000-000000000003") });
Assert.That(pcm.GetOwnerCount(lo.LandData.GlobalID), Is.EqualTo(0));
Assert.That(pcm.GetGroupCount(lo.LandData.GlobalID), Is.EqualTo(0));
@@ -76,14 +80,14 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests
Assert.That(pcm.GetUserCount(lo.LandData.GlobalID, dummyUserId), Is.EqualTo(0));
Assert.That(pcm.GetSimulatorCount(lo.LandData.GlobalID), Is.EqualTo(0));
- scene.AddNewSceneObject(new SceneObjectGroup(part), false);
+ scene.AddNewSceneObject(sog, false);
- Assert.That(pcm.GetOwnerCount(lo.LandData.GlobalID), Is.EqualTo(1));
+ Assert.That(pcm.GetOwnerCount(lo.LandData.GlobalID), Is.EqualTo(3));
Assert.That(pcm.GetGroupCount(lo.LandData.GlobalID), Is.EqualTo(0));
Assert.That(pcm.GetOthersCount(lo.LandData.GlobalID), Is.EqualTo(0));
- Assert.That(pcm.GetUserCount(lo.LandData.GlobalID, userId), Is.EqualTo(1));
+ Assert.That(pcm.GetUserCount(lo.LandData.GlobalID, userId), Is.EqualTo(3));
Assert.That(pcm.GetUserCount(lo.LandData.GlobalID, dummyUserId), Is.EqualTo(0));
- Assert.That(pcm.GetSimulatorCount(lo.LandData.GlobalID), Is.EqualTo(1));
+ Assert.That(pcm.GetSimulatorCount(lo.LandData.GlobalID), Is.EqualTo(3));
}
}
}
\ No newline at end of file
--
cgit v1.1
From de88227bc486788197b3a7c842c8b60f82b0a29b Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Wed, 23 Mar 2011 22:29:27 +0000
Subject: refactor: simplify part of AddSceneObject() test setup by moving sog
construction into SceneSetupHelpers.CreateSceneObject()
---
.../CoreModules/World/Land/Tests/PrimCountModuleTests.cs | 11 +----------
1 file changed, 1 insertion(+), 10 deletions(-)
(limited to 'OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs')
diff --git a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs
index 8c1b6a3..72f74fa 100644
--- a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs
+++ b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs
@@ -62,16 +62,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests
lmm.AddLandObject(lo);
//scene.loadAllLandObjectsFromStorage(scene.RegionInfo.originRegionID);
- SceneObjectPart part1
- = new SceneObjectPart(userId, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero)
- { Name = "obj1", UUID = new UUID("00000000-0000-0000-0000-000000000001") };
- SceneObjectGroup sog = new SceneObjectGroup(part1);
- sog.AddPart(
- new SceneObjectPart(userId, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero)
- { Name = "obj2", UUID = new UUID("00000000-0000-0000-0000-000000000002") });
- sog.AddPart(
- new SceneObjectPart(userId, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero)
- { Name = "obj3", UUID = new UUID("00000000-0000-0000-0000-000000000003") });
+ SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, userId);
Assert.That(pcm.GetOwnerCount(lo.LandData.GlobalID), Is.EqualTo(0));
Assert.That(pcm.GetGroupCount(lo.LandData.GlobalID), Is.EqualTo(0));
--
cgit v1.1
From ebbe3afaf15fa07f4a8d1c2db8795065b852ec8d Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Wed, 23 Mar 2011 23:14:55 +0000
Subject: Add PrimCountModuleTests.TestRemoveOwnerObject().
Also adds SceneSetupHelpers methods to easily create sogs with different part UUIDs
---
.../World/Land/Tests/PrimCountModuleTests.cs | 39 +++++++++++++++++++++-
1 file changed, 38 insertions(+), 1 deletion(-)
(limited to 'OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs')
diff --git a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs
index 72f74fa..e6b8627 100644
--- a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs
+++ b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs
@@ -44,8 +44,11 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests
[TestFixture]
public class PrimCountModuleTests
{
+ ///
+ /// Test count after a parcel owner owned object is added.
+ ///
[Test]
- public void TestAddObject()
+ public void TestAddOwnerObject()
{
TestHelper.InMethod();
// log4net.Config.XmlConfigurator.Configure();
@@ -80,5 +83,39 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests
Assert.That(pcm.GetUserCount(lo.LandData.GlobalID, dummyUserId), Is.EqualTo(0));
Assert.That(pcm.GetSimulatorCount(lo.LandData.GlobalID), Is.EqualTo(3));
}
+
+ ///
+ /// Test count after a parcel owner owned object is removed.
+ ///
+ [Test]
+ public void TestRemoveOwnerObject()
+ {
+ TestHelper.InMethod();
+// log4net.Config.XmlConfigurator.Configure();
+
+ PrimCountModule pcm = new PrimCountModule();
+ LandManagementModule lmm = new LandManagementModule();
+ Scene scene = SceneSetupHelpers.SetupScene();
+ SceneSetupHelpers.SetupSceneModules(scene, lmm, pcm);
+
+ UUID userId = new UUID("00000000-0000-0000-0000-000000000010");
+ UUID dummyUserId = new UUID("99999999-9999-9999-9999-999999999999");
+ ILandObject lo = new LandObject(userId, false, scene);
+ lo.SetLandBitmap(lo.GetSquareLandBitmap(0, 0, (int)Constants.RegionSize, (int)Constants.RegionSize));
+ lmm.AddLandObject(lo);
+ //scene.loadAllLandObjectsFromStorage(scene.RegionInfo.originRegionID);
+
+ scene.AddNewSceneObject(SceneSetupHelpers.CreateSceneObject(1, userId, 0x1), false);
+ SceneObjectGroup sogToDelete = SceneSetupHelpers.CreateSceneObject(3, userId, 0x10);
+ scene.AddNewSceneObject(sogToDelete, false);
+ scene.DeleteSceneObject(sogToDelete, false);
+
+ Assert.That(pcm.GetOwnerCount(lo.LandData.GlobalID), Is.EqualTo(1));
+ Assert.That(pcm.GetGroupCount(lo.LandData.GlobalID), Is.EqualTo(0));
+ Assert.That(pcm.GetOthersCount(lo.LandData.GlobalID), Is.EqualTo(0));
+ Assert.That(pcm.GetUserCount(lo.LandData.GlobalID, userId), Is.EqualTo(1));
+ Assert.That(pcm.GetUserCount(lo.LandData.GlobalID, dummyUserId), Is.EqualTo(0));
+ Assert.That(pcm.GetSimulatorCount(lo.LandData.GlobalID), Is.EqualTo(1));
+ }
}
}
\ No newline at end of file
--
cgit v1.1
From f001aab8aa5f3ceebe259ff89673c7757b16c637 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Wed, 23 Mar 2011 23:19:15 +0000
Subject: extend TestAddOwnerObject() to add a second object
---
.../World/Land/Tests/PrimCountModuleTests.cs | 18 ++++++++++++++----
1 file changed, 14 insertions(+), 4 deletions(-)
(limited to 'OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs')
diff --git a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs
index e6b8627..a0e7e4c 100644
--- a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs
+++ b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs
@@ -58,15 +58,13 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests
Scene scene = SceneSetupHelpers.SetupScene();
SceneSetupHelpers.SetupSceneModules(scene, lmm, pcm);
- UUID userId = new UUID("00000000-0000-0000-0000-000000000010");
+ UUID userId = new UUID("00000000-0000-0000-0000-100000000000");
UUID dummyUserId = new UUID("99999999-9999-9999-9999-999999999999");
ILandObject lo = new LandObject(userId, false, scene);
lo.SetLandBitmap(lo.GetSquareLandBitmap(0, 0, (int)Constants.RegionSize, (int)Constants.RegionSize));
lmm.AddLandObject(lo);
//scene.loadAllLandObjectsFromStorage(scene.RegionInfo.originRegionID);
-
- SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, userId);
-
+
Assert.That(pcm.GetOwnerCount(lo.LandData.GlobalID), Is.EqualTo(0));
Assert.That(pcm.GetGroupCount(lo.LandData.GlobalID), Is.EqualTo(0));
Assert.That(pcm.GetOthersCount(lo.LandData.GlobalID), Is.EqualTo(0));
@@ -74,6 +72,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests
Assert.That(pcm.GetUserCount(lo.LandData.GlobalID, dummyUserId), Is.EqualTo(0));
Assert.That(pcm.GetSimulatorCount(lo.LandData.GlobalID), Is.EqualTo(0));
+ SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, userId, 0x01);
scene.AddNewSceneObject(sog, false);
Assert.That(pcm.GetOwnerCount(lo.LandData.GlobalID), Is.EqualTo(3));
@@ -82,6 +81,17 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests
Assert.That(pcm.GetUserCount(lo.LandData.GlobalID, userId), Is.EqualTo(3));
Assert.That(pcm.GetUserCount(lo.LandData.GlobalID, dummyUserId), Is.EqualTo(0));
Assert.That(pcm.GetSimulatorCount(lo.LandData.GlobalID), Is.EqualTo(3));
+
+ // Add a second object and retest
+ SceneObjectGroup sog2 = SceneSetupHelpers.CreateSceneObject(2, userId, 0x10);
+ scene.AddNewSceneObject(sog2, false);
+
+ Assert.That(pcm.GetOwnerCount(lo.LandData.GlobalID), Is.EqualTo(5));
+ Assert.That(pcm.GetGroupCount(lo.LandData.GlobalID), Is.EqualTo(0));
+ Assert.That(pcm.GetOthersCount(lo.LandData.GlobalID), Is.EqualTo(0));
+ Assert.That(pcm.GetUserCount(lo.LandData.GlobalID, userId), Is.EqualTo(5));
+ Assert.That(pcm.GetUserCount(lo.LandData.GlobalID, dummyUserId), Is.EqualTo(0));
+ Assert.That(pcm.GetSimulatorCount(lo.LandData.GlobalID), Is.EqualTo(5));
}
///
--
cgit v1.1
From eaa37d15f26adda05cbcc44404b586551d86e983 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Wed, 23 Mar 2011 23:28:10 +0000
Subject: factor out common test setup code in PCM tests
---
.../World/Land/Tests/PrimCountModuleTests.cs | 110 ++++++++++-----------
1 file changed, 53 insertions(+), 57 deletions(-)
(limited to 'OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs')
diff --git a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs
index a0e7e4c..45e579e 100644
--- a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs
+++ b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs
@@ -44,6 +44,26 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests
[TestFixture]
public class PrimCountModuleTests
{
+ protected UUID m_userId = new UUID("00000000-0000-0000-0000-100000000000");
+ protected UUID m_dummyUserId = new UUID("99999999-9999-9999-9999-999999999999");
+ protected TestScene m_scene;
+ protected PrimCountModule m_pcm;
+ protected ILandObject m_lo;
+
+ [SetUp]
+ public void SetUp()
+ {
+ m_pcm = new PrimCountModule();
+ LandManagementModule lmm = new LandManagementModule();
+ m_scene = SceneSetupHelpers.SetupScene();
+ SceneSetupHelpers.SetupSceneModules(m_scene, lmm, m_pcm);
+
+ m_lo = new LandObject(m_userId, false, m_scene);
+ m_lo.SetLandBitmap(m_lo.GetSquareLandBitmap(0, 0, (int)Constants.RegionSize, (int)Constants.RegionSize));
+ lmm.AddLandObject(m_lo);
+ //scene.loadAllLandObjectsFromStorage(scene.RegionInfo.originRegionID);
+ }
+
///
/// Test count after a parcel owner owned object is added.
///
@@ -51,47 +71,35 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests
public void TestAddOwnerObject()
{
TestHelper.InMethod();
-// log4net.Config.XmlConfigurator.Configure();
-
- PrimCountModule pcm = new PrimCountModule();
- LandManagementModule lmm = new LandManagementModule();
- Scene scene = SceneSetupHelpers.SetupScene();
- SceneSetupHelpers.SetupSceneModules(scene, lmm, pcm);
-
- UUID userId = new UUID("00000000-0000-0000-0000-100000000000");
- UUID dummyUserId = new UUID("99999999-9999-9999-9999-999999999999");
- ILandObject lo = new LandObject(userId, false, scene);
- lo.SetLandBitmap(lo.GetSquareLandBitmap(0, 0, (int)Constants.RegionSize, (int)Constants.RegionSize));
- lmm.AddLandObject(lo);
- //scene.loadAllLandObjectsFromStorage(scene.RegionInfo.originRegionID);
+// log4net.Config.XmlConfigurator.Configure();
- Assert.That(pcm.GetOwnerCount(lo.LandData.GlobalID), Is.EqualTo(0));
- Assert.That(pcm.GetGroupCount(lo.LandData.GlobalID), Is.EqualTo(0));
- Assert.That(pcm.GetOthersCount(lo.LandData.GlobalID), Is.EqualTo(0));
- Assert.That(pcm.GetUserCount(lo.LandData.GlobalID, userId), Is.EqualTo(0));
- Assert.That(pcm.GetUserCount(lo.LandData.GlobalID, dummyUserId), Is.EqualTo(0));
- Assert.That(pcm.GetSimulatorCount(lo.LandData.GlobalID), Is.EqualTo(0));
+ Assert.That(m_pcm.GetOwnerCount(m_lo.LandData.GlobalID), Is.EqualTo(0));
+ Assert.That(m_pcm.GetGroupCount(m_lo.LandData.GlobalID), Is.EqualTo(0));
+ Assert.That(m_pcm.GetOthersCount(m_lo.LandData.GlobalID), Is.EqualTo(0));
+ Assert.That(m_pcm.GetUserCount(m_lo.LandData.GlobalID, m_userId), Is.EqualTo(0));
+ Assert.That(m_pcm.GetUserCount(m_lo.LandData.GlobalID, m_dummyUserId), Is.EqualTo(0));
+ Assert.That(m_pcm.GetSimulatorCount(m_lo.LandData.GlobalID), Is.EqualTo(0));
- SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, userId, 0x01);
- scene.AddNewSceneObject(sog, false);
+ SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_userId, 0x01);
+ m_scene.AddNewSceneObject(sog, false);
- Assert.That(pcm.GetOwnerCount(lo.LandData.GlobalID), Is.EqualTo(3));
- Assert.That(pcm.GetGroupCount(lo.LandData.GlobalID), Is.EqualTo(0));
- Assert.That(pcm.GetOthersCount(lo.LandData.GlobalID), Is.EqualTo(0));
- Assert.That(pcm.GetUserCount(lo.LandData.GlobalID, userId), Is.EqualTo(3));
- Assert.That(pcm.GetUserCount(lo.LandData.GlobalID, dummyUserId), Is.EqualTo(0));
- Assert.That(pcm.GetSimulatorCount(lo.LandData.GlobalID), Is.EqualTo(3));
+ Assert.That(m_pcm.GetOwnerCount(m_lo.LandData.GlobalID), Is.EqualTo(3));
+ Assert.That(m_pcm.GetGroupCount(m_lo.LandData.GlobalID), Is.EqualTo(0));
+ Assert.That(m_pcm.GetOthersCount(m_lo.LandData.GlobalID), Is.EqualTo(0));
+ Assert.That(m_pcm.GetUserCount(m_lo.LandData.GlobalID, m_userId), Is.EqualTo(3));
+ Assert.That(m_pcm.GetUserCount(m_lo.LandData.GlobalID, m_dummyUserId), Is.EqualTo(0));
+ Assert.That(m_pcm.GetSimulatorCount(m_lo.LandData.GlobalID), Is.EqualTo(3));
// Add a second object and retest
- SceneObjectGroup sog2 = SceneSetupHelpers.CreateSceneObject(2, userId, 0x10);
- scene.AddNewSceneObject(sog2, false);
+ SceneObjectGroup sog2 = SceneSetupHelpers.CreateSceneObject(2, m_userId, 0x10);
+ m_scene.AddNewSceneObject(sog2, false);
- Assert.That(pcm.GetOwnerCount(lo.LandData.GlobalID), Is.EqualTo(5));
- Assert.That(pcm.GetGroupCount(lo.LandData.GlobalID), Is.EqualTo(0));
- Assert.That(pcm.GetOthersCount(lo.LandData.GlobalID), Is.EqualTo(0));
- Assert.That(pcm.GetUserCount(lo.LandData.GlobalID, userId), Is.EqualTo(5));
- Assert.That(pcm.GetUserCount(lo.LandData.GlobalID, dummyUserId), Is.EqualTo(0));
- Assert.That(pcm.GetSimulatorCount(lo.LandData.GlobalID), Is.EqualTo(5));
+ Assert.That(m_pcm.GetOwnerCount(m_lo.LandData.GlobalID), Is.EqualTo(5));
+ Assert.That(m_pcm.GetGroupCount(m_lo.LandData.GlobalID), Is.EqualTo(0));
+ Assert.That(m_pcm.GetOthersCount(m_lo.LandData.GlobalID), Is.EqualTo(0));
+ Assert.That(m_pcm.GetUserCount(m_lo.LandData.GlobalID, m_userId), Is.EqualTo(5));
+ Assert.That(m_pcm.GetUserCount(m_lo.LandData.GlobalID, m_dummyUserId), Is.EqualTo(0));
+ Assert.That(m_pcm.GetSimulatorCount(m_lo.LandData.GlobalID), Is.EqualTo(5));
}
///
@@ -103,29 +111,17 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests
TestHelper.InMethod();
// log4net.Config.XmlConfigurator.Configure();
- PrimCountModule pcm = new PrimCountModule();
- LandManagementModule lmm = new LandManagementModule();
- Scene scene = SceneSetupHelpers.SetupScene();
- SceneSetupHelpers.SetupSceneModules(scene, lmm, pcm);
-
- UUID userId = new UUID("00000000-0000-0000-0000-000000000010");
- UUID dummyUserId = new UUID("99999999-9999-9999-9999-999999999999");
- ILandObject lo = new LandObject(userId, false, scene);
- lo.SetLandBitmap(lo.GetSquareLandBitmap(0, 0, (int)Constants.RegionSize, (int)Constants.RegionSize));
- lmm.AddLandObject(lo);
- //scene.loadAllLandObjectsFromStorage(scene.RegionInfo.originRegionID);
-
- scene.AddNewSceneObject(SceneSetupHelpers.CreateSceneObject(1, userId, 0x1), false);
- SceneObjectGroup sogToDelete = SceneSetupHelpers.CreateSceneObject(3, userId, 0x10);
- scene.AddNewSceneObject(sogToDelete, false);
- scene.DeleteSceneObject(sogToDelete, false);
+ m_scene.AddNewSceneObject(SceneSetupHelpers.CreateSceneObject(1, m_userId, 0x1), false);
+ SceneObjectGroup sogToDelete = SceneSetupHelpers.CreateSceneObject(3, m_userId, 0x10);
+ m_scene.AddNewSceneObject(sogToDelete, false);
+ m_scene.DeleteSceneObject(sogToDelete, false);
- Assert.That(pcm.GetOwnerCount(lo.LandData.GlobalID), Is.EqualTo(1));
- Assert.That(pcm.GetGroupCount(lo.LandData.GlobalID), Is.EqualTo(0));
- Assert.That(pcm.GetOthersCount(lo.LandData.GlobalID), Is.EqualTo(0));
- Assert.That(pcm.GetUserCount(lo.LandData.GlobalID, userId), Is.EqualTo(1));
- Assert.That(pcm.GetUserCount(lo.LandData.GlobalID, dummyUserId), Is.EqualTo(0));
- Assert.That(pcm.GetSimulatorCount(lo.LandData.GlobalID), Is.EqualTo(1));
+ Assert.That(m_pcm.GetOwnerCount(m_lo.LandData.GlobalID), Is.EqualTo(1));
+ Assert.That(m_pcm.GetGroupCount(m_lo.LandData.GlobalID), Is.EqualTo(0));
+ Assert.That(m_pcm.GetOthersCount(m_lo.LandData.GlobalID), Is.EqualTo(0));
+ Assert.That(m_pcm.GetUserCount(m_lo.LandData.GlobalID, m_userId), Is.EqualTo(1));
+ Assert.That(m_pcm.GetUserCount(m_lo.LandData.GlobalID, m_dummyUserId), Is.EqualTo(0));
+ Assert.That(m_pcm.GetSimulatorCount(m_lo.LandData.GlobalID), Is.EqualTo(1));
}
}
}
\ No newline at end of file
--
cgit v1.1
From 7f5019b0f23959ca049f87b596bc2bd47725eb0d Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Fri, 25 Mar 2011 21:47:54 +0000
Subject: Add ILandObject.IPrimCounts for the new prim count module.
Not functional yet, but tests now act against this object rather than interrogating the module directly
---
.../World/Land/Tests/PrimCountModuleTests.cs | 60 ++++++++++++----------
1 file changed, 32 insertions(+), 28 deletions(-)
(limited to 'OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs')
diff --git a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs
index 45e579e..c9d393f 100644
--- a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs
+++ b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs
@@ -58,9 +58,9 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests
m_scene = SceneSetupHelpers.SetupScene();
SceneSetupHelpers.SetupSceneModules(m_scene, lmm, m_pcm);
- m_lo = new LandObject(m_userId, false, m_scene);
- m_lo.SetLandBitmap(m_lo.GetSquareLandBitmap(0, 0, (int)Constants.RegionSize, (int)Constants.RegionSize));
- lmm.AddLandObject(m_lo);
+ ILandObject lo = new LandObject(m_userId, false, m_scene);
+ lo.SetLandBitmap(lo.GetSquareLandBitmap(0, 0, (int)Constants.RegionSize, (int)Constants.RegionSize));
+ m_lo = lmm.AddLandObject(lo);
//scene.loadAllLandObjectsFromStorage(scene.RegionInfo.originRegionID);
}
@@ -72,34 +72,36 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests
{
TestHelper.InMethod();
// log4net.Config.XmlConfigurator.Configure();
-
- Assert.That(m_pcm.GetOwnerCount(m_lo.LandData.GlobalID), Is.EqualTo(0));
- Assert.That(m_pcm.GetGroupCount(m_lo.LandData.GlobalID), Is.EqualTo(0));
- Assert.That(m_pcm.GetOthersCount(m_lo.LandData.GlobalID), Is.EqualTo(0));
- Assert.That(m_pcm.GetUserCount(m_lo.LandData.GlobalID, m_userId), Is.EqualTo(0));
- Assert.That(m_pcm.GetUserCount(m_lo.LandData.GlobalID, m_dummyUserId), Is.EqualTo(0));
- Assert.That(m_pcm.GetSimulatorCount(m_lo.LandData.GlobalID), Is.EqualTo(0));
+
+ IPrimCounts pc = m_lo.PrimCounts;
+
+ Assert.That(pc.Owner, Is.EqualTo(0));
+ Assert.That(pc.Group, Is.EqualTo(0));
+ Assert.That(pc.Others, Is.EqualTo(0));
+ Assert.That(pc.Users[m_userId], Is.EqualTo(0));
+ Assert.That(pc.Users[m_dummyUserId], Is.EqualTo(0));
+ Assert.That(pc.Simulator, Is.EqualTo(0));
SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_userId, 0x01);
m_scene.AddNewSceneObject(sog, false);
- Assert.That(m_pcm.GetOwnerCount(m_lo.LandData.GlobalID), Is.EqualTo(3));
- Assert.That(m_pcm.GetGroupCount(m_lo.LandData.GlobalID), Is.EqualTo(0));
- Assert.That(m_pcm.GetOthersCount(m_lo.LandData.GlobalID), Is.EqualTo(0));
- Assert.That(m_pcm.GetUserCount(m_lo.LandData.GlobalID, m_userId), Is.EqualTo(3));
- Assert.That(m_pcm.GetUserCount(m_lo.LandData.GlobalID, m_dummyUserId), Is.EqualTo(0));
- Assert.That(m_pcm.GetSimulatorCount(m_lo.LandData.GlobalID), Is.EqualTo(3));
+ Assert.That(pc.Owner, Is.EqualTo(3));
+ Assert.That(pc.Group, Is.EqualTo(0));
+ Assert.That(pc.Others, Is.EqualTo(0));
+ Assert.That(pc.Users[m_userId], Is.EqualTo(3));
+ Assert.That(pc.Users[m_dummyUserId], Is.EqualTo(0));
+ Assert.That(pc.Simulator, Is.EqualTo(3));
// Add a second object and retest
SceneObjectGroup sog2 = SceneSetupHelpers.CreateSceneObject(2, m_userId, 0x10);
m_scene.AddNewSceneObject(sog2, false);
- Assert.That(m_pcm.GetOwnerCount(m_lo.LandData.GlobalID), Is.EqualTo(5));
- Assert.That(m_pcm.GetGroupCount(m_lo.LandData.GlobalID), Is.EqualTo(0));
- Assert.That(m_pcm.GetOthersCount(m_lo.LandData.GlobalID), Is.EqualTo(0));
- Assert.That(m_pcm.GetUserCount(m_lo.LandData.GlobalID, m_userId), Is.EqualTo(5));
- Assert.That(m_pcm.GetUserCount(m_lo.LandData.GlobalID, m_dummyUserId), Is.EqualTo(0));
- Assert.That(m_pcm.GetSimulatorCount(m_lo.LandData.GlobalID), Is.EqualTo(5));
+ Assert.That(pc.Owner, Is.EqualTo(5));
+ Assert.That(pc.Group, Is.EqualTo(0));
+ Assert.That(pc.Others, Is.EqualTo(0));
+ Assert.That(pc.Users[m_userId], Is.EqualTo(5));
+ Assert.That(pc.Users[m_dummyUserId], Is.EqualTo(0));
+ Assert.That(pc.Simulator, Is.EqualTo(5));
}
///
@@ -111,17 +113,19 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests
TestHelper.InMethod();
// log4net.Config.XmlConfigurator.Configure();
+ IPrimCounts pc = m_lo.PrimCounts;
+
m_scene.AddNewSceneObject(SceneSetupHelpers.CreateSceneObject(1, m_userId, 0x1), false);
SceneObjectGroup sogToDelete = SceneSetupHelpers.CreateSceneObject(3, m_userId, 0x10);
m_scene.AddNewSceneObject(sogToDelete, false);
m_scene.DeleteSceneObject(sogToDelete, false);
- Assert.That(m_pcm.GetOwnerCount(m_lo.LandData.GlobalID), Is.EqualTo(1));
- Assert.That(m_pcm.GetGroupCount(m_lo.LandData.GlobalID), Is.EqualTo(0));
- Assert.That(m_pcm.GetOthersCount(m_lo.LandData.GlobalID), Is.EqualTo(0));
- Assert.That(m_pcm.GetUserCount(m_lo.LandData.GlobalID, m_userId), Is.EqualTo(1));
- Assert.That(m_pcm.GetUserCount(m_lo.LandData.GlobalID, m_dummyUserId), Is.EqualTo(0));
- Assert.That(m_pcm.GetSimulatorCount(m_lo.LandData.GlobalID), Is.EqualTo(1));
+ Assert.That(pc.Owner, Is.EqualTo(1));
+ Assert.That(pc.Group, Is.EqualTo(0));
+ Assert.That(pc.Others, Is.EqualTo(0));
+ Assert.That(pc.Users[m_userId], Is.EqualTo(1));
+ Assert.That(pc.Users[m_dummyUserId], Is.EqualTo(0));
+ Assert.That(pc.Simulator, Is.EqualTo(1));
}
}
}
\ No newline at end of file
--
cgit v1.1