aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorSean Dague2008-10-01 15:41:36 +0000
committerSean Dague2008-10-01 15:41:36 +0000
commitd0099271948e6c908a11da0158ca3471d2afb568 (patch)
tree20b31fe040ba2acd1ffd4eea9557c8099a2cccdf
parentAdd a user server XMLRPC method to set the MOTD and the minimum GodLevel (diff)
downloadopensim-SC-d0099271948e6c908a11da0158ca3471d2afb568.zip
opensim-SC-d0099271948e6c908a11da0158ca3471d2afb568.tar.gz
opensim-SC-d0099271948e6c908a11da0158ca3471d2afb568.tar.bz2
opensim-SC-d0099271948e6c908a11da0158ca3471d2afb568.tar.xz
add delete prim tests. Found and fixed bugs where region
is not respected by sqlite or mysql drivers so that deleting and object in a region actually deletes that object from any region.
-rw-r--r--OpenSim/Data/MySQL/MySQLRegionData.cs4
-rw-r--r--OpenSim/Data/SQLite/SQLiteRegionData.cs2
-rw-r--r--OpenSim/Data/Tests/BasicRegionTest.cs49
3 files changed, 47 insertions, 8 deletions
diff --git a/OpenSim/Data/MySQL/MySQLRegionData.cs b/OpenSim/Data/MySQL/MySQLRegionData.cs
index e6a9686..0e8ca68 100644
--- a/OpenSim/Data/MySQL/MySQLRegionData.cs
+++ b/OpenSim/Data/MySQL/MySQLRegionData.cs
@@ -333,7 +333,7 @@ namespace OpenSim.Data.MySQL
333 DataTable prims = m_primTable; 333 DataTable prims = m_primTable;
334 DataTable shapes = m_shapeTable; 334 DataTable shapes = m_shapeTable;
335 335
336 string selectExp = "SceneGroupID = '" + Util.ToRawUuidString(obj) + "'"; 336 string selectExp = "SceneGroupID = '" + Util.ToRawUuidString(obj) + "' and RegionUUID = '" + Util.ToRawUuidString(regionUUID) + "'";
337 lock (m_dataSet) 337 lock (m_dataSet)
338 { 338 {
339 DataRow[] primRows = prims.Select(selectExp); 339 DataRow[] primRows = prims.Select(selectExp);
@@ -347,7 +347,7 @@ namespace OpenSim.Data.MySQL
347 shapeRow.Delete(); 347 shapeRow.Delete();
348 } 348 }
349 349
350 RemoveItems(uuid); 350 RemoveItems(uuid);
351 351
352 // Remove prim row 352 // Remove prim row
353 row.Delete(); 353 row.Delete();
diff --git a/OpenSim/Data/SQLite/SQLiteRegionData.cs b/OpenSim/Data/SQLite/SQLiteRegionData.cs
index 74715c0..bc64ba0 100644
--- a/OpenSim/Data/SQLite/SQLiteRegionData.cs
+++ b/OpenSim/Data/SQLite/SQLiteRegionData.cs
@@ -348,7 +348,7 @@ namespace OpenSim.Data.SQLite
348 DataTable prims = ds.Tables["prims"]; 348 DataTable prims = ds.Tables["prims"];
349 DataTable shapes = ds.Tables["primshapes"]; 349 DataTable shapes = ds.Tables["primshapes"];
350 350
351 string selectExp = "SceneGroupID = '" + Util.ToRawUuidString(obj) + "'"; 351 string selectExp = "SceneGroupID = '" + Util.ToRawUuidString(obj) + "' and RegionUUID = '" + Util.ToRawUuidString(regionUUID) + "'";
352 lock (ds) 352 lock (ds)
353 { 353 {
354 DataRow[] primRows = prims.Select(selectExp); 354 DataRow[] primRows = prims.Select(selectExp);
diff --git a/OpenSim/Data/Tests/BasicRegionTest.cs b/OpenSim/Data/Tests/BasicRegionTest.cs
index 9c3b651..548a242 100644
--- a/OpenSim/Data/Tests/BasicRegionTest.cs
+++ b/OpenSim/Data/Tests/BasicRegionTest.cs
@@ -42,6 +42,9 @@ namespace OpenSim.Data.Tests
42 public IRegionDataStore db; 42 public IRegionDataStore db;
43 public UUID region1; 43 public UUID region1;
44 public UUID region2; 44 public UUID region2;
45 public UUID prim1;
46 public UUID prim2;
47 public UUID prim3;
45 public double height1; 48 public double height1;
46 public double height2; 49 public double height2;
47 50
@@ -57,10 +60,22 @@ namespace OpenSim.Data.Tests
57 } 60 }
58 61
59 region1 = UUID.Random(); 62 region1 = UUID.Random();
63 prim1 = UUID.Random();
64 prim2 = UUID.Random();
65 prim3 = UUID.Random();
60 height1 = 20; 66 height1 = 20;
61 height2 = 100; 67 height2 = 100;
62 } 68 }
63 69
70 // Test Plan
71 // Prims
72 // - empty test - 001
73 // - store / retrieve basic prims (most minimal we can make) - 010, 011
74 // - update existing prims, make sure it sticks - 012
75 // - add inventory items to prims make - 013
76 // - remove inventory items make sure it sticks - 014
77 // - remove prim, make sure it sticks - 020
78
64 [Test] 79 [Test]
65 public void T001_LoadEmpty() 80 public void T001_LoadEmpty()
66 { 81 {
@@ -78,8 +93,8 @@ namespace OpenSim.Data.Tests
78 [Test] 93 [Test]
79 public void T010_StoreSimpleObject() 94 public void T010_StoreSimpleObject()
80 { 95 {
81 SceneObjectGroup sog = NewSOG("object1"); 96 SceneObjectGroup sog = NewSOG("object1", prim1);
82 SceneObjectGroup sog2 = NewSOG("object2"); 97 SceneObjectGroup sog2 = NewSOG("object2", prim2);
83 98
84 // in case the objects don't store 99 // in case the objects don't store
85 try 100 try
@@ -133,6 +148,29 @@ namespace OpenSim.Data.Tests
133 } 148 }
134 149
135 [Test] 150 [Test]
151 public void T013_PrimInventory()
152 {
153
154 }
155
156 [Test]
157 public void T021_RemoveObjectWrongRegion()
158 {
159 db.RemoveObject(prim1, UUID.Random());
160 SceneObjectGroup sog = FindSOG("object1", region1);
161 Assert.That(sog, Is.Not.Null);
162 }
163
164 [Test]
165 public void T022_RemoveObject()
166 {
167 db.RemoveObject(prim1, region1);
168 SceneObjectGroup sog = FindSOG("object1", region1);
169 Assert.That(sog, Is.Null);
170 }
171
172
173 [Test]
136 public void T100_DefaultRegionInfo() 174 public void T100_DefaultRegionInfo()
137 { 175 {
138 RegionSettings r1 = db.LoadRegionSettings(region1); 176 RegionSettings r1 = db.LoadRegionSettings(region1);
@@ -246,9 +284,8 @@ namespace OpenSim.Data.Tests
246 // causes the application to crash at the database layer because of null values 284 // causes the application to crash at the database layer because of null values
247 // in NOT NULL fields 285 // in NOT NULL fields
248 // 286 //
249 private SceneObjectGroup NewSOG(string name) 287 private SceneObjectGroup NewSOG(string name, UUID uuid)
250 { 288 {
251 SceneObjectGroup sog = new SceneObjectGroup();
252 SceneObjectPart sop = new SceneObjectPart(); 289 SceneObjectPart sop = new SceneObjectPart();
253 sop.LocalId = 1; 290 sop.LocalId = 1;
254 sop.Name = name; 291 sop.Name = name;
@@ -256,8 +293,10 @@ namespace OpenSim.Data.Tests
256 sop.Text = ""; 293 sop.Text = "";
257 sop.SitName = ""; 294 sop.SitName = "";
258 sop.TouchName = ""; 295 sop.TouchName = "";
259 sop.UUID = UUID.Random(); 296 sop.UUID = uuid;
260 sop.Shape = PrimitiveBaseShape.Default; 297 sop.Shape = PrimitiveBaseShape.Default;
298
299 SceneObjectGroup sog = new SceneObjectGroup();
261 sog.AddPart(sop); 300 sog.AddPart(sop);
262 sog.RootPart = sop; 301 sog.RootPart = sop;
263 302