aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/World/Land
diff options
context:
space:
mode:
authorMelanie2011-04-03 14:16:28 +0100
committerMelanie2011-04-03 14:16:28 +0100
commit15e0b55e66b7906f4b45f4e0a8761d5c5315668c (patch)
treed4a8f9862f8daa8dbf383d3b20ad102aea138c71 /OpenSim/Region/CoreModules/World/Land
parentMerge branch 'careminster-presence-refactor' of ssh://melanie@3dhosting.de/va... (diff)
parentComment out some startup logging lines to make up for the one I added earlier... (diff)
downloadopensim-SC-15e0b55e66b7906f4b45f4e0a8761d5c5315668c.zip
opensim-SC-15e0b55e66b7906f4b45f4e0a8761d5c5315668c.tar.gz
opensim-SC-15e0b55e66b7906f4b45f4e0a8761d5c5315668c.tar.bz2
opensim-SC-15e0b55e66b7906f4b45f4e0a8761d5c5315668c.tar.xz
Merge branch 'master' into careminster-presence-refactor
Diffstat (limited to 'OpenSim/Region/CoreModules/World/Land')
-rw-r--r--OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs4
-rw-r--r--OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs142
2 files changed, 129 insertions, 17 deletions
diff --git a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs
index 854d1ca..2a9036d 100644
--- a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs
+++ b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs
@@ -205,7 +205,7 @@ namespace OpenSim.Region.CoreModules.World.Land
205 { 205 {
206 if (obj.OwnerID == landData.GroupID) 206 if (obj.OwnerID == landData.GroupID)
207 parcelCounts.Owner += partCount; 207 parcelCounts.Owner += partCount;
208 else if (obj.GroupID == landData.GroupID) 208 else if (landData.GroupID != UUID.Zero && obj.GroupID == landData.GroupID)
209 parcelCounts.Group += partCount; 209 parcelCounts.Group += partCount;
210 else 210 else
211 parcelCounts.Others += partCount; 211 parcelCounts.Others += partCount;
@@ -214,8 +214,6 @@ namespace OpenSim.Region.CoreModules.World.Land
214 { 214 {
215 if (obj.OwnerID == landData.OwnerID) 215 if (obj.OwnerID == landData.OwnerID)
216 parcelCounts.Owner += partCount; 216 parcelCounts.Owner += partCount;
217 else if (obj.GroupID == landData.GroupID)
218 parcelCounts.Group += partCount;
219 else 217 else
220 parcelCounts.Others += partCount; 218 parcelCounts.Others += partCount;
221 } 219 }
diff --git a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs
index 5a60f22..f006db2 100644
--- a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs
+++ b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs
@@ -45,7 +45,8 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests
45 public class PrimCountModuleTests 45 public class PrimCountModuleTests
46 { 46 {
47 protected UUID m_userId = new UUID("00000000-0000-0000-0000-100000000000"); 47 protected UUID m_userId = new UUID("00000000-0000-0000-0000-100000000000");
48 protected UUID m_dummyUserId = new UUID("99999999-9999-9999-9999-999999999999"); 48 protected UUID m_groupId = new UUID("00000000-0000-0000-8888-000000000000");
49 protected UUID m_otherUserId = new UUID("99999999-9999-9999-9999-999999999999");
49 protected TestScene m_scene; 50 protected TestScene m_scene;
50 protected PrimCountModule m_pcm; 51 protected PrimCountModule m_pcm;
51 protected ILandObject m_lo; 52 protected ILandObject m_lo;
@@ -65,14 +66,11 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests
65 } 66 }
66 67
67 /// <summary> 68 /// <summary>
68 /// Test count after a parcel owner owned object is added. 69 /// Test that counts before we do anything are correct.
69 /// </summary> 70 /// </summary>
70 [Test] 71 [Test]
71 public void TestAddOwnerObject() 72 public void TestInitialCounts()
72 { 73 {
73 TestHelper.InMethod();
74// log4net.Config.XmlConfigurator.Configure();
75
76 IPrimCounts pc = m_lo.PrimCounts; 74 IPrimCounts pc = m_lo.PrimCounts;
77 75
78 Assert.That(pc.Owner, Is.EqualTo(0)); 76 Assert.That(pc.Owner, Is.EqualTo(0));
@@ -81,8 +79,20 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests
81 Assert.That(pc.Total, Is.EqualTo(0)); 79 Assert.That(pc.Total, Is.EqualTo(0));
82 Assert.That(pc.Selected, Is.EqualTo(0)); 80 Assert.That(pc.Selected, Is.EqualTo(0));
83 Assert.That(pc.Users[m_userId], Is.EqualTo(0)); 81 Assert.That(pc.Users[m_userId], Is.EqualTo(0));
84 Assert.That(pc.Users[m_dummyUserId], Is.EqualTo(0)); 82 Assert.That(pc.Users[m_otherUserId], Is.EqualTo(0));
85 Assert.That(pc.Simulator, Is.EqualTo(0)); 83 Assert.That(pc.Simulator, Is.EqualTo(0));
84 }
85
86 /// <summary>
87 /// Test count after a parcel owner owned object is added.
88 /// </summary>
89 [Test]
90 public void TestAddOwnerObject()
91 {
92 TestHelper.InMethod();
93// log4net.Config.XmlConfigurator.Configure();
94
95 IPrimCounts pc = m_lo.PrimCounts;
86 96
87 SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_userId, 0x01); 97 SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_userId, 0x01);
88 m_scene.AddNewSceneObject(sog, false); 98 m_scene.AddNewSceneObject(sog, false);
@@ -93,7 +103,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests
93 Assert.That(pc.Total, Is.EqualTo(3)); 103 Assert.That(pc.Total, Is.EqualTo(3));
94 Assert.That(pc.Selected, Is.EqualTo(0)); 104 Assert.That(pc.Selected, Is.EqualTo(0));
95 Assert.That(pc.Users[m_userId], Is.EqualTo(3)); 105 Assert.That(pc.Users[m_userId], Is.EqualTo(3));
96 Assert.That(pc.Users[m_dummyUserId], Is.EqualTo(0)); 106 Assert.That(pc.Users[m_otherUserId], Is.EqualTo(0));
97 Assert.That(pc.Simulator, Is.EqualTo(3)); 107 Assert.That(pc.Simulator, Is.EqualTo(3));
98 108
99 // Add a second object and retest 109 // Add a second object and retest
@@ -106,7 +116,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests
106 Assert.That(pc.Total, Is.EqualTo(5)); 116 Assert.That(pc.Total, Is.EqualTo(5));
107 Assert.That(pc.Selected, Is.EqualTo(0)); 117 Assert.That(pc.Selected, Is.EqualTo(0));
108 Assert.That(pc.Users[m_userId], Is.EqualTo(5)); 118 Assert.That(pc.Users[m_userId], Is.EqualTo(5));
109 Assert.That(pc.Users[m_dummyUserId], Is.EqualTo(0)); 119 Assert.That(pc.Users[m_otherUserId], Is.EqualTo(0));
110 Assert.That(pc.Simulator, Is.EqualTo(5)); 120 Assert.That(pc.Simulator, Is.EqualTo(5));
111 } 121 }
112 122
@@ -131,7 +141,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests
131 Assert.That(pc.Total, Is.EqualTo(6)); 141 Assert.That(pc.Total, Is.EqualTo(6));
132 Assert.That(pc.Selected, Is.EqualTo(0)); 142 Assert.That(pc.Selected, Is.EqualTo(0));
133 Assert.That(pc.Users[m_userId], Is.EqualTo(6)); 143 Assert.That(pc.Users[m_userId], Is.EqualTo(6));
134 Assert.That(pc.Users[m_dummyUserId], Is.EqualTo(0)); 144 Assert.That(pc.Users[m_otherUserId], Is.EqualTo(0));
135 Assert.That(pc.Simulator, Is.EqualTo(6)); 145 Assert.That(pc.Simulator, Is.EqualTo(6));
136 } 146 }
137 147
@@ -157,9 +167,113 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests
157 Assert.That(pc.Total, Is.EqualTo(1)); 167 Assert.That(pc.Total, Is.EqualTo(1));
158 Assert.That(pc.Selected, Is.EqualTo(0)); 168 Assert.That(pc.Selected, Is.EqualTo(0));
159 Assert.That(pc.Users[m_userId], Is.EqualTo(1)); 169 Assert.That(pc.Users[m_userId], Is.EqualTo(1));
160 Assert.That(pc.Users[m_dummyUserId], Is.EqualTo(0)); 170 Assert.That(pc.Users[m_otherUserId], Is.EqualTo(0));
171 Assert.That(pc.Simulator, Is.EqualTo(1));
172 }
173
174 [Test]
175 public void TestAddGroupObject()
176 {
177 TestHelper.InMethod();
178// log4net.Config.XmlConfigurator.Configure();
179
180 m_lo.DeedToGroup(m_groupId);
181
182 IPrimCounts pc = m_lo.PrimCounts;
183
184 SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_otherUserId, 0x01);
185 sog.GroupID = m_groupId;
186 m_scene.AddNewSceneObject(sog, false);
187
188 Assert.That(pc.Owner, Is.EqualTo(0));
189 Assert.That(pc.Group, Is.EqualTo(3));
190 Assert.That(pc.Others, Is.EqualTo(0));
191 Assert.That(pc.Total, Is.EqualTo(3));
192 Assert.That(pc.Selected, Is.EqualTo(0));
193
194 // Is this desired behaviour? Not totally sure.
195 Assert.That(pc.Users[m_userId], Is.EqualTo(0));
196 Assert.That(pc.Users[m_groupId], Is.EqualTo(0));
197 Assert.That(pc.Users[m_otherUserId], Is.EqualTo(3));
198
199 Assert.That(pc.Simulator, Is.EqualTo(3));
200 }
201
202 /// <summary>
203 /// Test count after a parcel owner owned object is removed.
204 /// </summary>
205 [Test]
206 public void TestRemoveGroupObject()
207 {
208 TestHelper.InMethod();
209// log4net.Config.XmlConfigurator.Configure();
210
211 m_lo.DeedToGroup(m_groupId);
212
213 IPrimCounts pc = m_lo.PrimCounts;
214
215 SceneObjectGroup sogToKeep = SceneSetupHelpers.CreateSceneObject(1, m_userId, 0x1);
216 sogToKeep.GroupID = m_groupId;
217 m_scene.AddNewSceneObject(sogToKeep, false);
218
219 SceneObjectGroup sogToDelete = SceneSetupHelpers.CreateSceneObject(3, m_userId, 0x10);
220 m_scene.AddNewSceneObject(sogToDelete, false);
221 m_scene.DeleteSceneObject(sogToDelete, false);
222
223 Assert.That(pc.Owner, Is.EqualTo(0));
224 Assert.That(pc.Group, Is.EqualTo(1));
225 Assert.That(pc.Others, Is.EqualTo(0));
226 Assert.That(pc.Total, Is.EqualTo(1));
227 Assert.That(pc.Selected, Is.EqualTo(0));
228 Assert.That(pc.Users[m_userId], Is.EqualTo(1));
229 Assert.That(pc.Users[m_groupId], Is.EqualTo(0));
230 Assert.That(pc.Users[m_otherUserId], Is.EqualTo(0));
231 Assert.That(pc.Simulator, Is.EqualTo(1));
232 }
233
234 [Test]
235 public void TestAddOthersObject()
236 {
237 TestHelper.InMethod();
238// log4net.Config.XmlConfigurator.Configure();
239
240 IPrimCounts pc = m_lo.PrimCounts;
241
242 SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_otherUserId, 0x01);
243 m_scene.AddNewSceneObject(sog, false);
244
245 Assert.That(pc.Owner, Is.EqualTo(0));
246 Assert.That(pc.Group, Is.EqualTo(0));
247 Assert.That(pc.Others, Is.EqualTo(3));
248 Assert.That(pc.Total, Is.EqualTo(3));
249 Assert.That(pc.Selected, Is.EqualTo(0));
250 Assert.That(pc.Users[m_userId], Is.EqualTo(0));
251 Assert.That(pc.Users[m_otherUserId], Is.EqualTo(3));
252 Assert.That(pc.Simulator, Is.EqualTo(3));
253 }
254
255 [Test]
256 public void TestRemoveOthersObject()
257 {
258 TestHelper.InMethod();
259// log4net.Config.XmlConfigurator.Configure();
260
261 IPrimCounts pc = m_lo.PrimCounts;
262
263 m_scene.AddNewSceneObject(SceneSetupHelpers.CreateSceneObject(1, m_otherUserId, 0x1), false);
264 SceneObjectGroup sogToDelete = SceneSetupHelpers.CreateSceneObject(3, m_otherUserId, 0x10);
265 m_scene.AddNewSceneObject(sogToDelete, false);
266 m_scene.DeleteSceneObject(sogToDelete, false);
267
268 Assert.That(pc.Owner, Is.EqualTo(0));
269 Assert.That(pc.Group, Is.EqualTo(0));
270 Assert.That(pc.Others, Is.EqualTo(1));
271 Assert.That(pc.Total, Is.EqualTo(1));
272 Assert.That(pc.Selected, Is.EqualTo(0));
273 Assert.That(pc.Users[m_userId], Is.EqualTo(0));
274 Assert.That(pc.Users[m_otherUserId], Is.EqualTo(1));
161 Assert.That(pc.Simulator, Is.EqualTo(1)); 275 Assert.That(pc.Simulator, Is.EqualTo(1));
162 } 276 }
163 277
164 /// <summary> 278 /// <summary>
165 /// Test the count is correct after is has been tainted. 279 /// Test the count is correct after is has been tainted.
@@ -181,7 +295,7 @@ namespace OpenSim.Region.CoreModules.World.Land.Tests
181 Assert.That(pc.Total, Is.EqualTo(3)); 295 Assert.That(pc.Total, Is.EqualTo(3));
182 Assert.That(pc.Selected, Is.EqualTo(0)); 296 Assert.That(pc.Selected, Is.EqualTo(0));
183 Assert.That(pc.Users[m_userId], Is.EqualTo(3)); 297 Assert.That(pc.Users[m_userId], Is.EqualTo(3));
184 Assert.That(pc.Users[m_dummyUserId], Is.EqualTo(0)); 298 Assert.That(pc.Users[m_otherUserId], Is.EqualTo(0));
185 Assert.That(pc.Simulator, Is.EqualTo(3)); 299 Assert.That(pc.Simulator, Is.EqualTo(3));
186 } 300 }
187 } 301 }