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.
---
.../CoreModules/World/Land/LandManagementModule.cs | 29 +++++----
.../CoreModules/World/Land/PrimCountModule.cs | 23 +++++--
.../World/Land/Tests/PrimCountModuleTests.cs | 75 ++++++++++++++++++++++
3 files changed, 108 insertions(+), 19 deletions(-)
create mode 100644 OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs
(limited to 'OpenSim/Region/CoreModules')
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
index 98ba8c3..514be4f 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
@@ -306,6 +306,9 @@ namespace OpenSim.Region.CoreModules.World.Land
/// The parcel created.
protected ILandObject CreateDefaultParcel()
{
+// m_log.DebugFormat(
+// "[LAND MANAGEMENT MODULE]: Creating default parcel for region {0}", m_scene.RegionInfo.RegionName);
+
ILandObject fullSimParcel = new LandObject(UUID.Zero, false, m_scene);
fullSimParcel.SetLandBitmap(fullSimParcel.GetSquareLandBitmap(0, 0, (int)Constants.RegionSize, (int)Constants.RegionSize));
fullSimParcel.LandData.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner;
@@ -579,7 +582,7 @@ namespace OpenSim.Region.CoreModules.World.Land
}
else
{
- m_log.WarnFormat("[LAND]: Invalid local land ID {0}", landLocalID);
+ m_log.WarnFormat("[LAND MANAGEMENT MODULE]: Invalid local land ID {0}", landLocalID);
}
}
@@ -630,7 +633,7 @@ namespace OpenSim.Region.CoreModules.World.Land
{
if (m_landIDList[x, y] == local_id)
{
- m_log.WarnFormat("[LAND]: Not removing land object {0}; still being used at {1}, {2}",
+ m_log.WarnFormat("[LAND MANAGEMENT MODULE]: Not removing land object {0}; still being used at {1}, {2}",
local_id, x, y);
return;
//throw new Exception("Could not remove land object. Still being used at " + x + ", " + y);
@@ -1198,7 +1201,7 @@ namespace OpenSim.Region.CoreModules.World.Land
}
else
{
- m_log.WarnFormat("[PARCEL]: Invalid land object {0} passed for parcel object owner request", local_id);
+ m_log.WarnFormat("[LAND MANAGEMENT MODULE]: Invalid land object {0} passed for parcel object owner request", local_id);
}
}
@@ -1426,7 +1429,7 @@ namespace OpenSim.Region.CoreModules.World.Land
{
IClientAPI client;
if (! m_scene.TryGetClient(agentID, out client)) {
- m_log.WarnFormat("[LAND] unable to retrieve IClientAPI for {0}", agentID.ToString());
+ m_log.WarnFormat("[LAND MANAGEMENT MODULE]: Unable to retrieve IClientAPI for {0}", agentID);
return LLSDHelpers.SerialiseLLSDReply(new LLSDEmpty());
}
@@ -1475,7 +1478,7 @@ namespace OpenSim.Region.CoreModules.World.Land
}
else
{
- m_log.WarnFormat("[LAND] unable to find parcelID {0}", parcelID);
+ m_log.WarnFormat("[LAND MANAGEMENT MODULE]: Unable to find parcelID {0}", parcelID);
}
return LLSDHelpers.SerialiseLLSDReply(new LLSDEmpty());
}
@@ -1533,17 +1536,17 @@ namespace OpenSim.Region.CoreModules.World.Land
}
catch (LLSD.LLSDParseException e)
{
- m_log.ErrorFormat("[LAND] Fetch error: {0}", e.Message);
- m_log.ErrorFormat("[LAND] ... in request {0}", request);
+ m_log.ErrorFormat("[LAND MANAGEMENT MODULE]: Fetch error: {0}", e.Message);
+ m_log.ErrorFormat("[LAND MANAGEMENT MODULE]: ... in request {0}", request);
}
- catch(InvalidCastException)
+ catch (InvalidCastException)
{
- m_log.ErrorFormat("[LAND] Wrong type in request {0}", request);
+ m_log.ErrorFormat("[LAND MANAGEMENT MODULE]: Wrong type in request {0}", request);
}
LLSDRemoteParcelResponse response = new LLSDRemoteParcelResponse();
response.parcel_id = parcelID;
- m_log.DebugFormat("[LAND] got parcelID {0}", parcelID);
+ m_log.DebugFormat("[LAND MANAGEMENT MODULE]: Got parcelID {0}", parcelID);
return LLSDHelpers.SerialiseLLSDReply(response);
}
@@ -1564,7 +1567,7 @@ namespace OpenSim.Region.CoreModules.World.Land
ExtendedLandData extLandData = new ExtendedLandData();
Util.ParseFakeParcelID(parcel, out extLandData.RegionHandle,
out extLandData.X, out extLandData.Y);
- m_log.DebugFormat("[LAND] got parcelinfo request for regionHandle {0}, x/y {1}/{2}",
+ m_log.DebugFormat("[LAND MANAGEMENT MODULE]: Got parcelinfo request for regionHandle {0}, x/y {1}/{2}",
extLandData.RegionHandle, extLandData.X, extLandData.Y);
// for this region or for somewhere else?
@@ -1605,7 +1608,7 @@ namespace OpenSim.Region.CoreModules.World.Land
info = m_scene.GridService.GetRegionByPosition(m_scene.RegionInfo.ScopeID, (int)x, (int)y);
}
// we need to transfer the fake parcelID, not the one in landData, so the viewer can match it to the landmark.
- m_log.DebugFormat("[LAND] got parcelinfo for parcel {0} in region {1}; sending...",
+ m_log.DebugFormat("[LAND MANAGEMENT MODULE]: got parcelinfo for parcel {0} in region {1}; sending...",
data.LandData.Name, data.RegionHandle);
// HACK for now
RegionInfo r = new RegionInfo();
@@ -1616,7 +1619,7 @@ namespace OpenSim.Region.CoreModules.World.Land
remoteClient.SendParcelInfo(r, data.LandData, parcelID, data.X, data.Y);
}
else
- m_log.Debug("[LAND] got no parcelinfo; not sending");
+ m_log.Debug("[LAND MANAGEMENT MODULE]: got no parcelinfo; not sending");
}
public void setParcelOtherCleanTime(IClientAPI remoteClient, int localID, int otherCleanTime)
diff --git a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs
index 34ef67f..c71264c 100644
--- a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs
+++ b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs
@@ -51,8 +51,8 @@ namespace OpenSim.Region.CoreModules.World.Land
public class PrimCountModule : IPrimCountModule, INonSharedRegionModule
{
- private static readonly ILog m_log =
- LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
+// private static readonly ILog m_log =
+// LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private Scene m_Scene;
private Dictionary m_PrimCounts =
@@ -64,10 +64,16 @@ namespace OpenSim.Region.CoreModules.World.Land
private Dictionary m_ParcelCounts =
new Dictionary();
- // For now, a simple simwide taint to get this up. Later parcel based
- // taint to allow recounting a parcel if only ownership has changed
- // without recounting the whole sim.
+
+ ///
+ /// For now, a simple simwide taint to get this up. Later parcel based
+ /// taint to allow recounting a parcel if only ownership has changed
+ /// without recounting the whole sim.
+ ///
+ /// We start out tainted so that the first get call resets the various prim counts.
+ ///
private bool m_Tainted = true;
+
private Object m_TaintLock = new Object();
public Type ReplaceableInterface
@@ -156,6 +162,8 @@ namespace OpenSim.Region.CoreModules.World.Land
// NOTE: Call under Taint Lock
private void AddObject(SceneObjectGroup obj)
{
+// m_log.DebugFormat("[PRIM COUNT MODULE]: Adding object {0} to prim count", obj.Name);
+
if (obj.IsAttachment)
return;
if (((obj.RootPart.Flags & PrimFlags.TemporaryOnRez) != 0))
@@ -299,18 +307,21 @@ namespace OpenSim.Region.CoreModules.World.Land
// NOTE: This method MUST be called while holding the taint lock!
private void Recount()
{
+// m_log.DebugFormat("[PRIM COUNT MODULE]: Recounting prims on {0}", m_Scene.RegionInfo.RegionName);
+
m_OwnerMap.Clear();
m_SimwideCounts.Clear();
m_ParcelCounts.Clear();
List land = m_Scene.LandChannel.AllParcels();
-
+
foreach (ILandObject l in land)
{
LandData landData = l.LandData;
m_OwnerMap[landData.GlobalID] = landData.OwnerID;
m_SimwideCounts[landData.OwnerID] = 0;
+// m_log.DebugFormat("[PRIM COUNT MODULE]: Adding parcel count for {0}", landData.GlobalID);
m_ParcelCounts[landData.GlobalID] = new ParcelCounts();
}
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/LandManagementModule.cs | 4 ++++
OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs | 10 ++++++++--
.../CoreModules/World/Land/Tests/PrimCountModuleTests.cs | 2 ++
3 files changed, 14 insertions(+), 2 deletions(-)
(limited to 'OpenSim/Region/CoreModules')
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
index 514be4f..4d887a8 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
@@ -854,6 +854,10 @@ namespace OpenSim.Region.CoreModules.World.Land
public void EventManagerOnParcelPrimCountUpdate()
{
+// m_log.DebugFormat(
+// "[LAND MANAGEMENT MODULE]: Triggered EventManagerOnParcelPrimCountUpdate() for {0}",
+// m_scene.RegionInfo.RegionName);
+
ResetAllLandPrimCounts();
EntityBase[] entities = m_scene.Entities.GetEntities();
foreach (EntityBase obj in entities)
diff --git a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs
index c71264c..5371aaf 100644
--- a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs
+++ b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs
@@ -89,8 +89,7 @@ namespace OpenSim.Region.CoreModules.World.Land
{
m_Scene = scene;
- m_Scene.EventManager.OnParcelPrimCountAdd +=
- OnParcelPrimCountAdd;
+ m_Scene.EventManager.OnObjectAddedToScene += OnParcelPrimCountAdd;
m_Scene.EventManager.OnObjectBeingRemovedFromScene +=
OnObjectBeingRemovedFromScene;
m_Scene.EventManager.OnParcelPrimCountTainted +=
@@ -116,6 +115,7 @@ namespace OpenSim.Region.CoreModules.World.Land
private void OnParcelPrimCountAdd(SceneObjectGroup obj)
{
+ Console.WriteLine("WIBBLE");
// If we're tainted already, don't bother to add. The next
// access will cause a recount anyway
lock (m_TaintLock)
@@ -172,6 +172,10 @@ namespace OpenSim.Region.CoreModules.World.Land
Vector3 pos = obj.AbsolutePosition;
ILandObject landObject = m_Scene.LandChannel.GetLandObject(pos.X, pos.Y);
LandData landData = landObject.LandData;
+
+// m_log.DebugFormat(
+// "[PRIM COUNT MODULE]: Object {0} is owned by {1} over land owned by {2}",
+// obj.Name, obj.OwnerID, landData.OwnerID);
ParcelCounts parcelCounts;
if (m_ParcelCounts.TryGetValue(landData.GlobalID, out parcelCounts))
@@ -228,6 +232,8 @@ namespace OpenSim.Region.CoreModules.World.Land
public int GetOwnerCount(UUID parcelID)
{
+// m_log.DebugFormat("[PRIM COUNT MODULE]: GetOwnerCount for {0}", parcelID);
+
lock (m_TaintLock)
{
if (m_Tainted)
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 67cafbd33aeb1038f22aa775cbde96b4c89dd770 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Wed, 23 Mar 2011 21:54:02 +0000
Subject: remove a rogue Console.WriteLine() from the last commit.
---
OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs | 1 -
1 file changed, 1 deletion(-)
(limited to 'OpenSim/Region/CoreModules')
diff --git a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs
index 5371aaf..46c7eed 100644
--- a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs
+++ b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs
@@ -115,7 +115,6 @@ namespace OpenSim.Region.CoreModules.World.Land
private void OnParcelPrimCountAdd(SceneObjectGroup obj)
{
- Console.WriteLine("WIBBLE");
// If we're tainted already, don't bother to add. The next
// access will cause a recount anyway
lock (m_TaintLock)
--
cgit v1.1
From 08c3cd6b369e2bb8dfa08709c2ffddaea4cdbaa5 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Wed, 23 Mar 2011 22:04:14 +0000
Subject: Add method doc to the Get*() methods on PrimCountModule
---
.../CoreModules/World/Land/PrimCountModule.cs | 27 ++++++++++++++++++++++
1 file changed, 27 insertions(+)
(limited to 'OpenSim/Region/CoreModules')
diff --git a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs
index 46c7eed..ae85798 100644
--- a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs
+++ b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs
@@ -229,6 +229,12 @@ namespace OpenSim.Region.CoreModules.World.Land
return primCounts;
}
+
+ ///
+ /// Get the number of prims on the parcel that are owned by the parcel owner.
+ ///
+ ///
+ ///
public int GetOwnerCount(UUID parcelID)
{
// m_log.DebugFormat("[PRIM COUNT MODULE]: GetOwnerCount for {0}", parcelID);
@@ -245,6 +251,11 @@ namespace OpenSim.Region.CoreModules.World.Land
return 0;
}
+ ///
+ /// Get the number of prims on the parcel that have been set to the group that owns the parcel.
+ ///
+ ///
+ ///
public int GetGroupCount(UUID parcelID)
{
lock (m_TaintLock)
@@ -259,6 +270,11 @@ namespace OpenSim.Region.CoreModules.World.Land
return 0;
}
+ ///
+ /// Get the number of prims on the parcel that are not owned by the parcel owner or set to the parcel group.
+ ///
+ ///
+ ///
public int GetOthersCount(UUID parcelID)
{
lock (m_TaintLock)
@@ -273,6 +289,11 @@ namespace OpenSim.Region.CoreModules.World.Land
return 0;
}
+ ///
+ /// Get the number of prims that are in the entire simulator for the owner of this parcel.
+ ///
+ ///
+ ///
public int GetSimulatorCount(UUID parcelID)
{
lock (m_TaintLock)
@@ -291,6 +312,12 @@ namespace OpenSim.Region.CoreModules.World.Land
return 0;
}
+ ///
+ /// Get the number of prims that a particular user owns on this parcel.
+ ///
+ ///
+ ///
+ ///
public int GetUserCount(UUID parcelID, UUID userID)
{
lock (m_TaintLock)
--
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')
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')
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')
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')
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')
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')
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')
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
---
.../CoreModules/World/Land/LandManagementModule.cs | 12 ++++-
.../Region/CoreModules/World/Land/LandObject.cs | 4 +-
.../CoreModules/World/Land/PrimCountModule.cs | 2 +
.../World/Land/Tests/PrimCountModuleTests.cs | 60 ++++++++++++----------
4 files changed, 47 insertions(+), 31 deletions(-)
(limited to 'OpenSim/Region/CoreModules')
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
index 4d887a8..d0727d9 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
@@ -72,6 +72,7 @@ namespace OpenSim.Region.CoreModules.World.Land
protected Commander m_commander = new Commander("land");
protected IUserManagement m_userManager;
+ protected IPrimCountModule m_primCountModule;
// Minimum for parcels to work is 64m even if we don't actually use them.
#pragma warning disable 0429
@@ -147,6 +148,7 @@ namespace OpenSim.Region.CoreModules.World.Land
public void RegionLoaded(Scene scene)
{
m_userManager = m_scene.RequestModuleInterface();
+ m_primCountModule = m_scene.RequestModuleInterface();
}
public void RemoveRegion(Scene scene)
@@ -309,10 +311,11 @@ namespace OpenSim.Region.CoreModules.World.Land
// m_log.DebugFormat(
// "[LAND MANAGEMENT MODULE]: Creating default parcel for region {0}", m_scene.RegionInfo.RegionName);
- ILandObject fullSimParcel = new LandObject(UUID.Zero, false, m_scene);
+ ILandObject fullSimParcel = new LandObject(UUID.Zero, false, m_scene);
fullSimParcel.SetLandBitmap(fullSimParcel.GetSquareLandBitmap(0, 0, (int)Constants.RegionSize, (int)Constants.RegionSize));
fullSimParcel.LandData.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner;
fullSimParcel.LandData.ClaimDate = Util.UnixTimeSinceEpoch();
+
return AddLandObject(fullSimParcel);
}
@@ -593,6 +596,11 @@ namespace OpenSim.Region.CoreModules.World.Land
public ILandObject AddLandObject(ILandObject land)
{
ILandObject new_land = land.Copy();
+
+ // Only now can we add the prim counts to the land object - we rely on the global ID which is generated
+ // as a random UUID inside LandData initialization
+ if (m_primCountModule != null)
+ new_land.PrimCounts = m_primCountModule.GetPrimCounts(new_land.LandData.GlobalID);
lock (m_landList)
{
@@ -1368,7 +1376,7 @@ namespace OpenSim.Region.CoreModules.World.Land
{
ILandObject new_land = new LandObject(data.OwnerID, data.IsGroupOwned, m_scene);
new_land.LandData = data.Copy();
- new_land.SetLandBitmapFromByteArray();
+ new_land.SetLandBitmapFromByteArray();
AddLandObject(new_land);
}
diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs
index 46c15ed..749bb3d 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs
@@ -51,7 +51,7 @@ namespace OpenSim.Region.CoreModules.World.Land
private int m_lastSeqId = 0;
- protected LandData m_landData = new LandData();
+ protected LandData m_landData = new LandData();
protected Scene m_scene;
protected List primsOverMe = new List();
protected Dictionary m_listTransactions = new Dictionary();
@@ -79,6 +79,8 @@ namespace OpenSim.Region.CoreModules.World.Land
set { m_landData = value; }
}
+
+ public IPrimCounts PrimCounts { get; set; }
public UUID RegionUUID
{
diff --git a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs
index ae85798..9fd347e 100644
--- a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs
+++ b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs
@@ -88,6 +88,8 @@ namespace OpenSim.Region.CoreModules.World.Land
public void AddRegion(Scene scene)
{
m_Scene = scene;
+
+ m_Scene.RegisterModuleInterface(this);
m_Scene.EventManager.OnObjectAddedToScene += OnParcelPrimCountAdd;
m_Scene.EventManager.OnObjectBeingRemovedFromScene +=
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