From 89b7c64b6f491c4f703bb8fe28987ee5e3d5c50f Mon Sep 17 00:00:00 2001 From: AlexRa Date: Sun, 23 May 2010 11:31:19 +0300 Subject: Various minor changes in the data tests --- OpenSim/Data/Tests/AssetTests.cs | 8 ++++++++ OpenSim/Data/Tests/BasicDataServiceTest.cs | 3 ++- OpenSim/Data/Tests/EstateTests.cs | 11 +---------- OpenSim/Data/Tests/InventoryTests.cs | 8 +++++--- OpenSim/Data/Tests/RegionTests.cs | 4 ++-- 5 files changed, 18 insertions(+), 16 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Data/Tests/AssetTests.cs b/OpenSim/Data/Tests/AssetTests.cs index d228c1f..d771053 100644 --- a/OpenSim/Data/Tests/AssetTests.cs +++ b/OpenSim/Data/Tests/AssetTests.cs @@ -106,10 +106,18 @@ namespace OpenSim.Data.Tests protected override void InitService(object service) { + ClearDB(); m_db = (TAssetData)service; m_db.Initialise(m_connStr); } + private void ClearDB() + { + DropTables("assets"); + ResetMigrations("AssetStore"); + } + + [Test] public void T001_LoadEmpty() { diff --git a/OpenSim/Data/Tests/BasicDataServiceTest.cs b/OpenSim/Data/Tests/BasicDataServiceTest.cs index e91a45d..4c7cf28 100644 --- a/OpenSim/Data/Tests/BasicDataServiceTest.cs +++ b/OpenSim/Data/Tests/BasicDataServiceTest.cs @@ -183,9 +183,10 @@ namespace OpenSim.Data.Tests lst += ", " + s; } + string sCond = stores.Length > 1 ? ("in (" + lst + ")") : ("=" + lst); try { - ExecuteSql("DELETE FROM `migrations` where name in (" + lst + ");"); + ExecuteSql("DELETE FROM migrations where name " + sCond); } catch { diff --git a/OpenSim/Data/Tests/EstateTests.cs b/OpenSim/Data/Tests/EstateTests.cs index 2da010d..d6eed3d 100644 --- a/OpenSim/Data/Tests/EstateTests.cs +++ b/OpenSim/Data/Tests/EstateTests.cs @@ -108,17 +108,7 @@ namespace OpenSim.Data.Tests private void ClearDB() { // if a new table is added, it has to be dropped here - ExecuteSql("delete from migrations where name='EstateStore';"); - DropTables( - "prims", - "primshapes", - "primitems", - "terrain", - "land", - "landaccesslist", - "regionban", - "regionsettings", "estate_managers", "estate_groups", "estate_users", @@ -126,6 +116,7 @@ namespace OpenSim.Data.Tests "estate_settings", "estate_map" ); + ResetMigrations("EstateStore"); } #region 0Tests diff --git a/OpenSim/Data/Tests/InventoryTests.cs b/OpenSim/Data/Tests/InventoryTests.cs index 93e1eba..c22e26c 100644 --- a/OpenSim/Data/Tests/InventoryTests.cs +++ b/OpenSim/Data/Tests/InventoryTests.cs @@ -123,7 +123,7 @@ namespace OpenSim.Data.Tests private void ClearDB() { DropTables("inventoryitems", "inventoryfolders"); - ExecuteSql("delete from migrations where name='Inventory'"); + ResetMigrations("InventoryStore"); } [Test] @@ -194,8 +194,10 @@ namespace OpenSim.Data.Tests [Test] public void T013_FolderHierarchy() { - Assert.That(db.getFolderHierarchy(zero).Count, Is.EqualTo(0), "Assert.That(db.getFolderHierarchy(zero).Count, Is.EqualTo(0))"); - Assert.That(db.getFolderHierarchy(folder1).Count, Is.EqualTo(2), "Assert.That(db.getFolderHierarchy(folder1).Count, Is.EqualTo(2))"); + int n = db.getFolderHierarchy(zero).Count; // (for dbg - easier to see what's returned) + Assert.That(n, Is.EqualTo(0), "Assert.That(db.getFolderHierarchy(zero).Count, Is.EqualTo(0))"); + n = db.getFolderHierarchy(folder1).Count; + Assert.That(n, Is.EqualTo(2), "Assert.That(db.getFolderHierarchy(folder1).Count, Is.EqualTo(2))"); Assert.That(db.getFolderHierarchy(folder2).Count, Is.EqualTo(0), "Assert.That(db.getFolderHierarchy(folder2).Count, Is.EqualTo(0))"); Assert.That(db.getFolderHierarchy(folder3).Count, Is.EqualTo(0), "Assert.That(db.getFolderHierarchy(folder3).Count, Is.EqualTo(0))"); Assert.That(db.getFolderHierarchy(UUID.Random()).Count, Is.EqualTo(0), "Assert.That(db.getFolderHierarchy(UUID.Random()).Count, Is.EqualTo(0))"); diff --git a/OpenSim/Data/Tests/RegionTests.cs b/OpenSim/Data/Tests/RegionTests.cs index 5ac2dd0..1f654d3 100644 --- a/OpenSim/Data/Tests/RegionTests.cs +++ b/OpenSim/Data/Tests/RegionTests.cs @@ -118,8 +118,8 @@ namespace OpenSim.Data.Tests m_rebuildDB = rebuild; } - public RegionTests() : this("", false) { } - public RegionTests(string conn) : this(conn, false) {} + public RegionTests() : this("", true) { } + public RegionTests(string conn) : this(conn, true) {} public RegionTests(bool rebuild): this("", rebuild) {} -- cgit v1.1