From 9456bb77fbf794bb6fc2808e6cfd69c9bb1d1326 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 9 Mar 2011 23:25:24 +0000 Subject: Upgrade nunit.framework.dll to version 2.5.9. Fix up tests appropriately. This version removes the NUnit.Framework.SyntaxHelpers namespace, so any modules with their own tests will need to delete this using statement. --- OpenSim/Data/Tests/RegionTests.cs | 11 ----------- 1 file changed, 11 deletions(-) (limited to 'OpenSim/Data/Tests/RegionTests.cs') diff --git a/OpenSim/Data/Tests/RegionTests.cs b/OpenSim/Data/Tests/RegionTests.cs index 23d498d..9598716 100644 --- a/OpenSim/Data/Tests/RegionTests.cs +++ b/OpenSim/Data/Tests/RegionTests.cs @@ -31,7 +31,6 @@ using System.Drawing; using System.Text; using log4net.Config; using NUnit.Framework; -using NUnit.Framework.SyntaxHelpers; using OpenMetaverse; using OpenSim.Framework; using OpenSim.Region.Framework.Interfaces; @@ -52,14 +51,6 @@ using OpenSim.Data.SQLite; namespace OpenSim.Data.Tests { -#if NUNIT25 - - [TestFixture(typeof(SqliteConnection), typeof(SQLiteRegionData), Description = "Region store tests (SQLite)")] - [TestFixture(typeof(MySqlConnection), typeof(MySqlRegionData), Description = "Region store tests (MySQL)")] - [TestFixture(typeof(SqlConnection), typeof(MSSQLRegionData), Description = "Region store tests (MS SQL Server)")] - -#else - [TestFixture(Description = "Region store tests (SQLite)")] public class SQLiteRegionTests : RegionTests { @@ -75,8 +66,6 @@ namespace OpenSim.Data.Tests { } -#endif - public class RegionTests : BasicDataServiceTest where TConn : DbConnection, new() where TRegStore : class, ISimulationDataStore, new() -- cgit v1.1 From 48c62eb51bdf475303ee3007354b98fd6fd4fc05 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 14 Mar 2011 23:17:15 +0000 Subject: Add current method output to all persistence level tests so that we can track where we are in the test suite --- OpenSim/Data/Tests/RegionTests.cs | 59 +++++++++++++++++++++++++++++++-------- 1 file changed, 48 insertions(+), 11 deletions(-) (limited to 'OpenSim/Data/Tests/RegionTests.cs') diff --git a/OpenSim/Data/Tests/RegionTests.cs b/OpenSim/Data/Tests/RegionTests.cs index 9598716..2dc177a 100644 --- a/OpenSim/Data/Tests/RegionTests.cs +++ b/OpenSim/Data/Tests/RegionTests.cs @@ -35,6 +35,7 @@ using OpenMetaverse; using OpenSim.Framework; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; +using OpenSim.Tests.Common; using log4net; using System.Reflection; using System.Data.Common; @@ -120,15 +121,18 @@ namespace OpenSim.Data.Tests string[] reg_tables = new string[] { "prims", "primshapes", "primitems", "terrain", "land", "landaccesslist", "regionban", "regionsettings" }; + if (m_rebuildDB) { DropTables(reg_tables); ResetMigrations("RegionStore"); - }else + } + else + { ClearTables(reg_tables); + } } - // Test Plan // Prims // - empty test - 001 @@ -147,6 +151,8 @@ namespace OpenSim.Data.Tests [Test] public void T001_LoadEmpty() { + TestHelper.InMethod(); + List objs = db.LoadObjects(region1); List objs3 = db.LoadObjects(region3); List land = db.LoadLandObjects(region1); @@ -163,6 +169,8 @@ namespace OpenSim.Data.Tests [Test] public void T010_StoreSimpleObject() { + TestHelper.InMethod(); + SceneObjectGroup sog = NewSOG("object1", prim1, region1); SceneObjectGroup sog2 = NewSOG("object2", prim2, region1); @@ -196,6 +204,8 @@ namespace OpenSim.Data.Tests [Test] public void T011_ObjectNames() { + TestHelper.InMethod(); + List objs = db.LoadObjects(region1); foreach (SceneObjectGroup sog in objs) { @@ -208,6 +218,8 @@ namespace OpenSim.Data.Tests [Test] public void T012_SceneParts() { + TestHelper.InMethod(); + UUID tmp0 = UUID.Random(); UUID tmp1 = UUID.Random(); UUID tmp2 = UUID.Random(); @@ -241,6 +253,8 @@ namespace OpenSim.Data.Tests [Test] public void T013_DatabasePersistency() { + TestHelper.InMethod(); + // Sets all ScenePart parameters, stores and retrieves them, then check for consistency with initial data // The commented Asserts are the ones that are unchangeable (when storing on the database, their "Set" values are ignored // The ObjectFlags is an exception, if it is entered incorrectly, the object IS REJECTED on the database silently. @@ -416,6 +430,8 @@ namespace OpenSim.Data.Tests [Test] public void T014_UpdateObject() { + TestHelper.InMethod(); + string text1 = "object1 text"; SceneObjectGroup sog = FindSOG("object1", region1); sog.RootPart.Text = text1; @@ -521,6 +537,8 @@ namespace OpenSim.Data.Tests [Test] public void T015_LargeSceneObjects() { + TestHelper.InMethod(); + UUID id = UUID.Random(); Dictionary mydic = new Dictionary(); SceneObjectGroup sog = NewSOG("Test SOG", id, region4); @@ -565,6 +583,8 @@ namespace OpenSim.Data.Tests //[Test] public void T016_RandomSogWithSceneParts() { + TestHelper.InMethod(); + PropertyScrambler scrambler = new PropertyScrambler() .DontScramble(x => x.UUID); @@ -631,15 +651,16 @@ namespace OpenSim.Data.Tests return sog; } - // NOTE: it is a bad practice to rely on some of the previous tests having been run before. // If the tests are run manually, one at a time, each starts with full class init (DB cleared). // Even when all tests are run, NUnit 2.5+ no longer guarantee a specific test order. // We shouldn't expect to find anything in the DB if we haven't put it there *in the same test*! - + [Test] public void T020_PrimInventoryEmpty() { + TestHelper.InMethod(); + SceneObjectGroup sog = GetMySOG("object1"); TaskInventoryItem t = sog.GetInventoryItem(sog.RootPart.LocalId, item1); Assert.That(t, Is.Null); @@ -659,10 +680,11 @@ namespace OpenSim.Data.Tests db.StorePrimInventory(sog.RootPart.UUID, list); } - [Test] public void T021_PrimInventoryBasic() { + TestHelper.InMethod(); + SceneObjectGroup sog = GetMySOG("object1"); InventoryItemBase i = NewItem(item1, zero, zero, itemname1, zero); @@ -690,20 +712,19 @@ namespace OpenSim.Data.Tests Assert.That(t2.Name, Is.EqualTo("My New Name"), "Assert.That(t.Name, Is.EqualTo(\"My New Name\"))"); // Removing inventory - List list = new List(); db.StorePrimInventory(prim1, list); sog = FindSOG("object1", region1); t = sog.GetInventoryItem(sog.RootPart.LocalId, item1); Assert.That(t, Is.Null); - } - [Test] public void T025_PrimInventoryPersistency() { + TestHelper.InMethod(); + InventoryItemBase i = new InventoryItemBase(); UUID id = UUID.Random(); i.ID = id; @@ -775,6 +796,8 @@ namespace OpenSim.Data.Tests [ExpectedException(typeof(ArgumentException))] public void T026_PrimInventoryMany() { + TestHelper.InMethod(); + UUID i1,i2,i3,i4; i1 = UUID.Random(); i2 = UUID.Random(); @@ -805,15 +828,18 @@ namespace OpenSim.Data.Tests [Test] public void T052_RemoveObject() { + TestHelper.InMethod(); + db.RemoveObject(prim1, region1); SceneObjectGroup sog = FindSOG("object1", region1); Assert.That(sog, Is.Null); } - [Test] public void T100_DefaultRegionInfo() { + TestHelper.InMethod(); + RegionSettings r1 = db.LoadRegionSettings(region1); Assert.That(r1.RegionUUID, Is.EqualTo(region1), "Assert.That(r1.RegionUUID, Is.EqualTo(region1))"); @@ -824,6 +850,8 @@ namespace OpenSim.Data.Tests [Test] public void T101_UpdateRegionInfo() { + TestHelper.InMethod(); + int agentlimit = random.Next(); double objectbonus = random.Next(); int maturity = random.Next(); @@ -922,13 +950,14 @@ namespace OpenSim.Data.Tests //Assert.That(r1a.TerrainImageID,Is.EqualTo(terimgid), "Assert.That(r1a.TerrainImageID,Is.EqualTo(terimgid))"); Assert.That(r1a.FixedSun,Is.True); Assert.That(r1a.SunPosition, Is.EqualTo(sunpos), "Assert.That(r1a.SunPosition, Is.EqualTo(sunpos))"); - Assert.That(r1a.Covenant, Is.EqualTo(cov), "Assert.That(r1a.Covenant, Is.EqualTo(cov))"); - + Assert.That(r1a.Covenant, Is.EqualTo(cov), "Assert.That(r1a.Covenant, Is.EqualTo(cov))"); } [Test] public void T300_NoTerrain() { + TestHelper.InMethod(); + Assert.That(db.LoadTerrain(zero), Is.Null); Assert.That(db.LoadTerrain(region1), Is.Null); Assert.That(db.LoadTerrain(region2), Is.Null); @@ -938,6 +967,8 @@ namespace OpenSim.Data.Tests [Test] public void T301_CreateTerrain() { + TestHelper.InMethod(); + double[,] t1 = GenTerrain(height1); db.StoreTerrain(t1, region1); @@ -950,6 +981,8 @@ namespace OpenSim.Data.Tests [Test] public void T302_FetchTerrain() { + TestHelper.InMethod(); + double[,] baseterrain1 = GenTerrain(height1); double[,] baseterrain2 = GenTerrain(height2); double[,] t1 = db.LoadTerrain(region1); @@ -960,6 +993,8 @@ namespace OpenSim.Data.Tests [Test] public void T303_UpdateTerrain() { + TestHelper.InMethod(); + double[,] baseterrain1 = GenTerrain(height1); double[,] baseterrain2 = GenTerrain(height2); db.StoreTerrain(baseterrain2, region1); @@ -972,6 +1007,8 @@ namespace OpenSim.Data.Tests [Test] public void T400_EmptyLand() { + TestHelper.InMethod(); + Assert.That(db.LoadLandObjects(zero).Count, Is.EqualTo(0), "Assert.That(db.LoadLandObjects(zero).Count, Is.EqualTo(0))"); Assert.That(db.LoadLandObjects(region1).Count, Is.EqualTo(0), "Assert.That(db.LoadLandObjects(region1).Count, Is.EqualTo(0))"); Assert.That(db.LoadLandObjects(region2).Count, Is.EqualTo(0), "Assert.That(db.LoadLandObjects(region2).Count, Is.EqualTo(0))"); -- cgit v1.1 From 8509678e483bc7b91721d25d822be0a21e4f7be9 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 14 Mar 2011 23:26:50 +0000 Subject: Add method doc to T015_LargeSceneObjects() and slightly clean up formatting. This test takes a considerable time on SQLite but should remain since it's testing storage and retrieval of a scene object with 31 parts. --- OpenSim/Data/Tests/RegionTests.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'OpenSim/Data/Tests/RegionTests.cs') diff --git a/OpenSim/Data/Tests/RegionTests.cs b/OpenSim/Data/Tests/RegionTests.cs index 2dc177a..edc9d84 100644 --- a/OpenSim/Data/Tests/RegionTests.cs +++ b/OpenSim/Data/Tests/RegionTests.cs @@ -533,7 +533,10 @@ namespace OpenSim.Data.Tests Assert.That(clickaction,Is.EqualTo(p.ClickAction), "Assert.That(clickaction,Is.EqualTo(p.ClickAction))"); Assert.That(scale,Is.EqualTo(p.Scale), "Assert.That(scale,Is.EqualTo(p.Scale))"); } - + + /// + /// Test storage and retrieval of a scene object with a large number of parts. + /// [Test] public void T015_LargeSceneObjects() { @@ -543,7 +546,7 @@ namespace OpenSim.Data.Tests Dictionary mydic = new Dictionary(); SceneObjectGroup sog = NewSOG("Test SOG", id, region4); mydic.Add(sog.RootPart.UUID,sog.RootPart); - for (int i=0;i<30;i++) + for (int i = 0; i < 30; i++) { UUID tmp = UUID.Random(); SceneObjectPart sop = NewSOP(("Test SOP " + i.ToString()),tmp); @@ -568,7 +571,7 @@ namespace OpenSim.Data.Tests SceneObjectGroup retsog = FindSOG("Test SOG", region4); SceneObjectPart[] parts = retsog.Parts; - for (int i=0;i<30;i++) + for (int i = 0; i < 30; i++) { SceneObjectPart cursop = mydic[parts[i].UUID]; Assert.That(cursop.GroupPosition,Is.EqualTo(parts[i].GroupPosition), "Assert.That(cursop.GroupPosition,Is.EqualTo(parts[i].GroupPosition))"); -- cgit v1.1 From 38c3be07b8e9c6a4cec312118bf908305af6495f Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 14 Mar 2011 23:32:44 +0000 Subject: when retrieving a sog in database tests, don't bother adding the scene since this isn't used --- OpenSim/Data/Tests/RegionTests.cs | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) (limited to 'OpenSim/Data/Tests/RegionTests.cs') diff --git a/OpenSim/Data/Tests/RegionTests.cs b/OpenSim/Data/Tests/RegionTests.cs index edc9d84..e049826 100644 --- a/OpenSim/Data/Tests/RegionTests.cs +++ b/OpenSim/Data/Tests/RegionTests.cs @@ -1047,25 +1047,12 @@ namespace OpenSim.Data.Tests return true; } - private SceneObjectGroup FindSOG(string name, UUID r) { List objs = db.LoadObjects(r); foreach (SceneObjectGroup sog in objs) - { - SceneObjectPart p = sog.RootPart; - if (p.Name == name) { - RegionInfo regionInfo = new RegionInfo(); - regionInfo.RegionID = r; - regionInfo.RegionLocX = 0; - regionInfo.RegionLocY = 0; - - Scene scene = new Scene(regionInfo); - sog.SetScene(scene); - + if (sog.Name == name) return sog; - } - } return null; } -- cgit v1.1 From fdcf910e00824ceb3db5166a2b3173c882ee059f Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 14 Mar 2011 23:35:03 +0000 Subject: Fix a bug in T015_LargeSceneObjects() where the large scene object was stored 31 times (1 time for each added part) instead of once at the end, even though only the largest 31 prim scene object was retrieved and tested. This considerably speeds up the test, when on sqlite it now only takes 2 seconds rather than 30+ --- OpenSim/Data/Tests/RegionTests.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'OpenSim/Data/Tests/RegionTests.cs') diff --git a/OpenSim/Data/Tests/RegionTests.cs b/OpenSim/Data/Tests/RegionTests.cs index e049826..44cf1ab 100644 --- a/OpenSim/Data/Tests/RegionTests.cs +++ b/OpenSim/Data/Tests/RegionTests.cs @@ -565,10 +565,11 @@ namespace OpenSim.Data.Tests sop.Acceleration = accel; mydic.Add(tmp,sop); - sog.AddPart(sop); - db.StoreObject(sog, region4); + sog.AddPart(sop); } + db.StoreObject(sog, region4); + SceneObjectGroup retsog = FindSOG("Test SOG", region4); SceneObjectPart[] parts = retsog.Parts; for (int i = 0; i < 30; i++) -- cgit v1.1