diff --git a/OpenSim/Data/MySQL/MySQLRegionData.cs b/OpenSim/Data/MySQL/MySQLRegionData.cs index e6a9686404..0e8ca68e29 100644 --- a/OpenSim/Data/MySQL/MySQLRegionData.cs +++ b/OpenSim/Data/MySQL/MySQLRegionData.cs @@ -333,7 +333,7 @@ namespace OpenSim.Data.MySQL DataTable prims = m_primTable; DataTable shapes = m_shapeTable; - string selectExp = "SceneGroupID = '" + Util.ToRawUuidString(obj) + "'"; + string selectExp = "SceneGroupID = '" + Util.ToRawUuidString(obj) + "' and RegionUUID = '" + Util.ToRawUuidString(regionUUID) + "'"; lock (m_dataSet) { DataRow[] primRows = prims.Select(selectExp); @@ -347,7 +347,7 @@ namespace OpenSim.Data.MySQL shapeRow.Delete(); } - RemoveItems(uuid); + RemoveItems(uuid); // Remove prim row row.Delete(); diff --git a/OpenSim/Data/SQLite/SQLiteRegionData.cs b/OpenSim/Data/SQLite/SQLiteRegionData.cs index 74715c0d22..bc64ba068c 100644 --- a/OpenSim/Data/SQLite/SQLiteRegionData.cs +++ b/OpenSim/Data/SQLite/SQLiteRegionData.cs @@ -348,7 +348,7 @@ namespace OpenSim.Data.SQLite DataTable prims = ds.Tables["prims"]; DataTable shapes = ds.Tables["primshapes"]; - string selectExp = "SceneGroupID = '" + Util.ToRawUuidString(obj) + "'"; + string selectExp = "SceneGroupID = '" + Util.ToRawUuidString(obj) + "' and RegionUUID = '" + Util.ToRawUuidString(regionUUID) + "'"; lock (ds) { DataRow[] primRows = prims.Select(selectExp); diff --git a/OpenSim/Data/Tests/BasicRegionTest.cs b/OpenSim/Data/Tests/BasicRegionTest.cs index 9c3b6518ed..548a242055 100644 --- a/OpenSim/Data/Tests/BasicRegionTest.cs +++ b/OpenSim/Data/Tests/BasicRegionTest.cs @@ -42,6 +42,9 @@ namespace OpenSim.Data.Tests public IRegionDataStore db; public UUID region1; public UUID region2; + public UUID prim1; + public UUID prim2; + public UUID prim3; public double height1; public double height2; @@ -57,10 +60,22 @@ namespace OpenSim.Data.Tests } region1 = UUID.Random(); + prim1 = UUID.Random(); + prim2 = UUID.Random(); + prim3 = UUID.Random(); height1 = 20; height2 = 100; } + // Test Plan + // Prims + // - empty test - 001 + // - store / retrieve basic prims (most minimal we can make) - 010, 011 + // - update existing prims, make sure it sticks - 012 + // - add inventory items to prims make - 013 + // - remove inventory items make sure it sticks - 014 + // - remove prim, make sure it sticks - 020 + [Test] public void T001_LoadEmpty() { @@ -78,8 +93,8 @@ namespace OpenSim.Data.Tests [Test] public void T010_StoreSimpleObject() { - SceneObjectGroup sog = NewSOG("object1"); - SceneObjectGroup sog2 = NewSOG("object2"); + SceneObjectGroup sog = NewSOG("object1", prim1); + SceneObjectGroup sog2 = NewSOG("object2", prim2); // in case the objects don't store try @@ -132,6 +147,29 @@ namespace OpenSim.Data.Tests Assert.That(text, Is.EqualTo(sog.RootPart.Text)); } + [Test] + public void T013_PrimInventory() + { + + } + + [Test] + public void T021_RemoveObjectWrongRegion() + { + db.RemoveObject(prim1, UUID.Random()); + SceneObjectGroup sog = FindSOG("object1", region1); + Assert.That(sog, Is.Not.Null); + } + + [Test] + public void T022_RemoveObject() + { + db.RemoveObject(prim1, region1); + SceneObjectGroup sog = FindSOG("object1", region1); + Assert.That(sog, Is.Null); + } + + [Test] public void T100_DefaultRegionInfo() { @@ -246,9 +284,8 @@ namespace OpenSim.Data.Tests // causes the application to crash at the database layer because of null values // in NOT NULL fields // - private SceneObjectGroup NewSOG(string name) + private SceneObjectGroup NewSOG(string name, UUID uuid) { - SceneObjectGroup sog = new SceneObjectGroup(); SceneObjectPart sop = new SceneObjectPart(); sop.LocalId = 1; sop.Name = name; @@ -256,8 +293,10 @@ namespace OpenSim.Data.Tests sop.Text = ""; sop.SitName = ""; sop.TouchName = ""; - sop.UUID = UUID.Random(); + sop.UUID = uuid; sop.Shape = PrimitiveBaseShape.Default; + + SceneObjectGroup sog = new SceneObjectGroup(); sog.AddPart(sop); sog.RootPart = sop;