aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/Tests
diff options
context:
space:
mode:
authorAlexRa2010-05-17 15:54:43 +0300
committerAlexRa2010-05-23 11:47:39 +0300
commit7f70ae0ebd686507bc15ac6fc7eeb75ed0b9b64a (patch)
tree8e9893cf02218f72888d5cdb12f8bb8a21cc5698 /OpenSim/Data/Tests
parentAdded generic base classes for testing database services (diff)
downloadopensim-SC_OLD-7f70ae0ebd686507bc15ac6fc7eeb75ed0b9b64a.zip
opensim-SC_OLD-7f70ae0ebd686507bc15ac6fc7eeb75ed0b9b64a.tar.gz
opensim-SC_OLD-7f70ae0ebd686507bc15ac6fc7eeb75ed0b9b64a.tar.bz2
opensim-SC_OLD-7f70ae0ebd686507bc15ac6fc7eeb75ed0b9b64a.tar.xz
All data tests made DBMS-independent
Diffstat (limited to 'OpenSim/Data/Tests')
-rw-r--r--OpenSim/Data/Tests/EstateTests.cs (renamed from OpenSim/Data/Tests/BasicEstateTest.cs)51
-rw-r--r--OpenSim/Data/Tests/InventoryTests.cs (renamed from OpenSim/Data/Tests/BasicInventoryTest.cs)94
-rw-r--r--OpenSim/Data/Tests/RegionTests.cs (renamed from OpenSim/Data/Tests/BasicRegionTest.cs)101
3 files changed, 159 insertions, 87 deletions
diff --git a/OpenSim/Data/Tests/BasicEstateTest.cs b/OpenSim/Data/Tests/EstateTests.cs
index d14d405..7f13925 100644
--- a/OpenSim/Data/Tests/BasicEstateTest.cs
+++ b/OpenSim/Data/Tests/EstateTests.cs
@@ -35,13 +35,31 @@ using OpenSim.Region.Framework.Interfaces;
35using System.Text; 35using System.Text;
36using log4net; 36using log4net;
37using System.Reflection; 37using System.Reflection;
38using System.Data.Common;
39
40
41// DBMS-specific:
42using MySql.Data.MySqlClient;
43using OpenSim.Data.MySQL;
44
45using System.Data.SqlClient;
46using OpenSim.Data.MSSQL;
47
48using Mono.Data.Sqlite;
49using OpenSim.Data.SQLite;
50
38 51
39namespace OpenSim.Data.Tests 52namespace OpenSim.Data.Tests
40{ 53{
41 public class BasicEstateTest 54 [TestFixture(typeof(MySqlConnection), typeof(MySQLEstateStore), Description = "Estate store tests (MySQL)")]
55 [TestFixture(typeof(SqlConnection), typeof(MSSQLEstateStore), Description = "Estate store tests (MS SQL Server)")]
56 [TestFixture(typeof(SqliteConnection), typeof(SQLiteEstateStore), Description = "Estate store tests (SQLite)")]
57
58 public class EstateTests<TConn, TEstateStore> : BasicDataServiceTest<TConn, TEstateStore>
59 where TConn : DbConnection, new()
60 where TEstateStore : class, IEstateDataStore, new()
42 { 61 {
43 public IEstateDataStore db; 62 public IEstateDataStore db;
44 public IRegionDataStore regionDb;
45 63
46 public static UUID REGION_ID = new UUID("250d214e-1c7e-4f9b-a488-87c5e53feed7"); 64 public static UUID REGION_ID = new UUID("250d214e-1c7e-4f9b-a488-87c5e53feed7");
47 65
@@ -54,9 +72,34 @@ namespace OpenSim.Data.Tests
54 public static UUID GROUP_ID_1 = new UUID("250d214e-1c7e-4f9b-a488-87c5e53feed5"); 72 public static UUID GROUP_ID_1 = new UUID("250d214e-1c7e-4f9b-a488-87c5e53feed5");
55 public static UUID GROUP_ID_2 = new UUID("250d214e-1c7e-4f9b-a488-87c5e53feed6"); 73 public static UUID GROUP_ID_2 = new UUID("250d214e-1c7e-4f9b-a488-87c5e53feed6");
56 74
57 public void SuperInit() 75 protected override void InitService(object service)
76 {
77 db = (IEstateDataStore)service;
78 db.Initialise(m_connStr);
79 ClearDB();
80 }
81
82 private void ClearDB()
58 { 83 {
59 OpenSim.Tests.Common.TestLogging.LogToConsole(); 84 // if a new table is added, it has to be dropped here
85 ExecuteSql("delete from migrations where name='EstateStore';");
86
87 DropTables(
88 "prims",
89 "primshapes",
90 "primitems",
91 "terrain",
92 "land",
93 "landaccesslist",
94 "regionban",
95 "regionsettings",
96 "estate_managers",
97 "estate_groups",
98 "estate_users",
99 "estateban",
100 "estate_settings",
101 "estate_map"
102 );
60 } 103 }
61 104
62 #region 0Tests 105 #region 0Tests
diff --git a/OpenSim/Data/Tests/BasicInventoryTest.cs b/OpenSim/Data/Tests/InventoryTests.cs
index 900186b..876dcf9 100644
--- a/OpenSim/Data/Tests/BasicInventoryTest.cs
+++ b/OpenSim/Data/Tests/InventoryTests.cs
@@ -33,62 +33,70 @@ using OpenMetaverse;
33using OpenSim.Framework; 33using OpenSim.Framework;
34using log4net; 34using log4net;
35using System.Reflection; 35using System.Reflection;
36using System.Data.Common;
37
38// DBMS-specific:
39using MySql.Data.MySqlClient;
40using OpenSim.Data.MySQL;
41
42using System.Data.SqlClient;
43using OpenSim.Data.MSSQL;
44
45using Mono.Data.Sqlite;
46using OpenSim.Data.SQLite;
36 47
37namespace OpenSim.Data.Tests 48namespace OpenSim.Data.Tests
38{ 49{
39 public class BasicInventoryTest 50 [TestFixture(typeof(MySqlConnection), typeof(MySQLInventoryData), Description = "Inventory store tests (MySQL)")]
51 [TestFixture(typeof(SqlConnection), typeof(MSSQLInventoryData), Description = "Inventory store tests (MS SQL Server)")]
52 [TestFixture(typeof(SqliteConnection), typeof(SQLiteInventoryStore), Description = "Inventory store tests (SQLite)")]
53
54 public class InventoryTests<TConn, TInvStore> : BasicDataServiceTest<TConn, TInvStore>
55 where TConn : DbConnection, new()
56 where TInvStore : class, IInventoryDataPlugin, new()
40 { 57 {
41 //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
42 public IInventoryDataPlugin db; 58 public IInventoryDataPlugin db;
59
43 public UUID zero = UUID.Zero; 60 public UUID zero = UUID.Zero;
44 61
45 public UUID folder1; 62 public UUID folder1 = UUID.Random();
46 public UUID folder2; 63 public UUID folder2 = UUID.Random();
47 public UUID folder3; 64 public UUID folder3 = UUID.Random();
48 public UUID owner1; 65 public UUID owner1 = UUID.Random();
49 public UUID owner2; 66 public UUID owner2 = UUID.Random();
50 public UUID owner3; 67 public UUID owner3 = UUID.Random();
51 68
52 public UUID item1; 69 public UUID item1 = UUID.Random();
53 public UUID item2; 70 public UUID item2 = UUID.Random();
54 public UUID item3; 71 public UUID item3 = UUID.Random();
55 public UUID asset1; 72 public UUID asset1 = UUID.Random();
56 public UUID asset2; 73 public UUID asset2 = UUID.Random();
57 public UUID asset3; 74 public UUID asset3 = UUID.Random();
58 75
59 public string name1; 76 public string name1;
60 public string name2; 77 public string name2 = "First Level folder";
61 public string name3; 78 public string name3 = "First Level folder 2";
62 public string niname1; 79 public string niname1 = "My Shirt";
63 public string iname1; 80 public string iname1 = "Shirt";
64 public string iname2; 81 public string iname2 = "Text Board";
65 public string iname3; 82 public string iname3 = "No Pants Barrel";
66 83
67 public void SuperInit() 84 public InventoryTests(string conn) : base(conn)
68 { 85 {
69 OpenSim.Tests.Common.TestLogging.LogToConsole();
70
71 folder1 = UUID.Random();
72 folder2 = UUID.Random();
73 folder3 = UUID.Random();
74 owner1 = UUID.Random();
75 owner2 = UUID.Random();
76 owner3 = UUID.Random();
77 item1 = UUID.Random();
78 item2 = UUID.Random();
79 item3 = UUID.Random();
80 asset1 = UUID.Random();
81 asset2 = UUID.Random();
82 asset3 = UUID.Random();
83
84 name1 = "Root Folder for " + owner1.ToString(); 86 name1 = "Root Folder for " + owner1.ToString();
85 name2 = "First Level folder"; 87 }
86 name3 = "First Level folder 2";
87 niname1 = "My Shirt";
88 iname1 = "Shirt";
89 iname2 = "Text Board";
90 iname3 = "No Pants Barrel";
91 88
89 protected override void InitService(object service)
90 {
91 db = (IInventoryDataPlugin)service;
92 db.Initialise(m_connStr);
93 ClearDB();
94 }
95
96 private void ClearDB()
97 {
98 DropTables("inventoryitems", "inventoryfolders");
99 ExecuteSql("delete from migrations where name='Inventory'");
92 } 100 }
93 101
94 [Test] 102 [Test]
diff --git a/OpenSim/Data/Tests/BasicRegionTest.cs b/OpenSim/Data/Tests/RegionTests.cs
index dfbf522..2a97368 100644
--- a/OpenSim/Data/Tests/BasicRegionTest.cs
+++ b/OpenSim/Data/Tests/RegionTests.cs
@@ -38,59 +38,80 @@ using OpenSim.Region.Framework.Interfaces;
38using OpenSim.Region.Framework.Scenes; 38using OpenSim.Region.Framework.Scenes;
39using log4net; 39using log4net;
40using System.Reflection; 40using System.Reflection;
41using System.Data.Common;
42
43// DBMS-specific:
44using MySql.Data.MySqlClient;
45using OpenSim.Data.MySQL;
46
47using System.Data.SqlClient;
48using OpenSim.Data.MSSQL;
49
50using Mono.Data.Sqlite;
51using OpenSim.Data.SQLite;
41 52
42namespace OpenSim.Data.Tests 53namespace OpenSim.Data.Tests
43{ 54{
44 public class BasicRegionTest 55 [TestFixture(typeof(MySqlConnection), typeof(MySqlRegionData), Description = "Region store tests (MySQL)")]
56 [TestFixture(typeof(SqlConnection), typeof(MSSQLRegionData), Description = "Region store tests (MS SQL Server)")]
57 [TestFixture(typeof(SqliteConnection), typeof(SQLiteRegionData), Description = "Region store tests (SQLite)")]
58
59 public class RegionTests<TConn, TRegStore> : BasicDataServiceTest<TConn, TRegStore>
60 where TConn : DbConnection, new()
61 where TRegStore : class, IRegionDataStore, new()
45 { 62 {
46 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
47 public IRegionDataStore db; 63 public IRegionDataStore db;
48 public UUID zero = UUID.Zero; 64 public UUID zero = UUID.Zero;
49 public UUID region1; 65 public UUID region1 = UUID.Random();
50 public UUID region2; 66 public UUID region2 = UUID.Random();
51 public UUID region3; 67 public UUID region3 = UUID.Random();
52 public UUID region4; 68 public UUID region4 = UUID.Random();
53 public UUID prim1; 69 public UUID prim1 = UUID.Random();
54 public UUID prim2; 70 public UUID prim2 = UUID.Random();
55 public UUID prim3; 71 public UUID prim3 = UUID.Random();
56 public UUID prim4; 72 public UUID prim4 = UUID.Random();
57 public UUID prim5; 73 public UUID prim5 = UUID.Random();
58 public UUID prim6; 74 public UUID prim6 = UUID.Random();
59 public UUID item1; 75 public UUID item1 = UUID.Random();
60 public UUID item2; 76 public UUID item2 = UUID.Random();
61 public UUID item3; 77 public UUID item3 = UUID.Random();
62 78
63 public static Random random; 79 public static Random random = new Random();
64 80
65 public string itemname1 = "item1"; 81 public string itemname1 = "item1";
66 82
67 public uint localID; 83 public uint localID = 1;
68 84
69 public double height1; 85 public double height1 = 20;
70 public double height2; 86 public double height2 = 100;
71 87
72 public void SuperInit() 88
89 protected override void InitService(object service)
90 {
91 db = (IRegionDataStore)service;
92 db.Initialise(m_connStr);
93 ClearDB();
94 }
95
96
97 private void ClearDB()
73 { 98 {
74 OpenSim.Tests.Common.TestLogging.LogToConsole(); 99 // if a new table is added, it has to be dropped here
75 100 ExecuteSql("delete from migrations where name='RegionStore';");
76 region1 = UUID.Random(); 101
77 region3 = UUID.Random(); 102 DropTables(
78 region4 = UUID.Random(); 103 "prims",
79 prim1 = UUID.Random(); 104 "primshapes",
80 prim2 = UUID.Random(); 105 "primitems",
81 prim3 = UUID.Random(); 106 "terrain",
82 prim4 = UUID.Random(); 107 "land",
83 prim5 = UUID.Random(); 108 "landaccesslist",
84 prim6 = UUID.Random(); 109 "regionban",
85 item1 = UUID.Random(); 110 "regionsettings"
86 item2 = UUID.Random(); 111 );
87 item3 = UUID.Random();
88 random = new Random();
89 localID = 1;
90 height1 = 20;
91 height2 = 100;
92 } 112 }
93 113
114
94 // Test Plan 115 // Test Plan
95 // Prims 116 // Prims
96 // - empty test - 001 117 // - empty test - 001