mirror of
https://github.com/opensim/opensim.git
synced 2026-08-08 02:05:34 +08:00
All data tests made DBMS-independent
This commit is contained in:
@@ -35,13 +35,31 @@ using OpenSim.Region.Framework.Interfaces;
|
||||
using System.Text;
|
||||
using log4net;
|
||||
using System.Reflection;
|
||||
using System.Data.Common;
|
||||
|
||||
|
||||
// DBMS-specific:
|
||||
using MySql.Data.MySqlClient;
|
||||
using OpenSim.Data.MySQL;
|
||||
|
||||
using System.Data.SqlClient;
|
||||
using OpenSim.Data.MSSQL;
|
||||
|
||||
using Mono.Data.Sqlite;
|
||||
using OpenSim.Data.SQLite;
|
||||
|
||||
|
||||
namespace OpenSim.Data.Tests
|
||||
{
|
||||
public class BasicEstateTest
|
||||
[TestFixture(typeof(MySqlConnection), typeof(MySQLEstateStore), Description = "Estate store tests (MySQL)")]
|
||||
[TestFixture(typeof(SqlConnection), typeof(MSSQLEstateStore), Description = "Estate store tests (MS SQL Server)")]
|
||||
[TestFixture(typeof(SqliteConnection), typeof(SQLiteEstateStore), Description = "Estate store tests (SQLite)")]
|
||||
|
||||
public class EstateTests<TConn, TEstateStore> : BasicDataServiceTest<TConn, TEstateStore>
|
||||
where TConn : DbConnection, new()
|
||||
where TEstateStore : class, IEstateDataStore, new()
|
||||
{
|
||||
public IEstateDataStore db;
|
||||
public IRegionDataStore regionDb;
|
||||
|
||||
public static UUID REGION_ID = new UUID("250d214e-1c7e-4f9b-a488-87c5e53feed7");
|
||||
|
||||
@@ -54,9 +72,34 @@ namespace OpenSim.Data.Tests
|
||||
public static UUID GROUP_ID_1 = new UUID("250d214e-1c7e-4f9b-a488-87c5e53feed5");
|
||||
public static UUID GROUP_ID_2 = new UUID("250d214e-1c7e-4f9b-a488-87c5e53feed6");
|
||||
|
||||
public void SuperInit()
|
||||
protected override void InitService(object service)
|
||||
{
|
||||
OpenSim.Tests.Common.TestLogging.LogToConsole();
|
||||
db = (IEstateDataStore)service;
|
||||
db.Initialise(m_connStr);
|
||||
ClearDB();
|
||||
}
|
||||
|
||||
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",
|
||||
"estateban",
|
||||
"estate_settings",
|
||||
"estate_map"
|
||||
);
|
||||
}
|
||||
|
||||
#region 0Tests
|
||||
@@ -33,62 +33,70 @@ using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
using log4net;
|
||||
using System.Reflection;
|
||||
using System.Data.Common;
|
||||
|
||||
// DBMS-specific:
|
||||
using MySql.Data.MySqlClient;
|
||||
using OpenSim.Data.MySQL;
|
||||
|
||||
using System.Data.SqlClient;
|
||||
using OpenSim.Data.MSSQL;
|
||||
|
||||
using Mono.Data.Sqlite;
|
||||
using OpenSim.Data.SQLite;
|
||||
|
||||
namespace OpenSim.Data.Tests
|
||||
{
|
||||
public class BasicInventoryTest
|
||||
[TestFixture(typeof(MySqlConnection), typeof(MySQLInventoryData), Description = "Inventory store tests (MySQL)")]
|
||||
[TestFixture(typeof(SqlConnection), typeof(MSSQLInventoryData), Description = "Inventory store tests (MS SQL Server)")]
|
||||
[TestFixture(typeof(SqliteConnection), typeof(SQLiteInventoryStore), Description = "Inventory store tests (SQLite)")]
|
||||
|
||||
public class InventoryTests<TConn, TInvStore> : BasicDataServiceTest<TConn, TInvStore>
|
||||
where TConn : DbConnection, new()
|
||||
where TInvStore : class, IInventoryDataPlugin, new()
|
||||
{
|
||||
//private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
public IInventoryDataPlugin db;
|
||||
|
||||
public UUID zero = UUID.Zero;
|
||||
|
||||
public UUID folder1;
|
||||
public UUID folder2;
|
||||
public UUID folder3;
|
||||
public UUID owner1;
|
||||
public UUID owner2;
|
||||
public UUID owner3;
|
||||
public UUID folder1 = UUID.Random();
|
||||
public UUID folder2 = UUID.Random();
|
||||
public UUID folder3 = UUID.Random();
|
||||
public UUID owner1 = UUID.Random();
|
||||
public UUID owner2 = UUID.Random();
|
||||
public UUID owner3 = UUID.Random();
|
||||
|
||||
public UUID item1;
|
||||
public UUID item2;
|
||||
public UUID item3;
|
||||
public UUID asset1;
|
||||
public UUID asset2;
|
||||
public UUID asset3;
|
||||
public UUID item1 = UUID.Random();
|
||||
public UUID item2 = UUID.Random();
|
||||
public UUID item3 = UUID.Random();
|
||||
public UUID asset1 = UUID.Random();
|
||||
public UUID asset2 = UUID.Random();
|
||||
public UUID asset3 = UUID.Random();
|
||||
|
||||
public string name1;
|
||||
public string name2;
|
||||
public string name3;
|
||||
public string niname1;
|
||||
public string iname1;
|
||||
public string iname2;
|
||||
public string iname3;
|
||||
public string name2 = "First Level folder";
|
||||
public string name3 = "First Level folder 2";
|
||||
public string niname1 = "My Shirt";
|
||||
public string iname1 = "Shirt";
|
||||
public string iname2 = "Text Board";
|
||||
public string iname3 = "No Pants Barrel";
|
||||
|
||||
public void SuperInit()
|
||||
public InventoryTests(string conn) : base(conn)
|
||||
{
|
||||
OpenSim.Tests.Common.TestLogging.LogToConsole();
|
||||
|
||||
folder1 = UUID.Random();
|
||||
folder2 = UUID.Random();
|
||||
folder3 = UUID.Random();
|
||||
owner1 = UUID.Random();
|
||||
owner2 = UUID.Random();
|
||||
owner3 = UUID.Random();
|
||||
item1 = UUID.Random();
|
||||
item2 = UUID.Random();
|
||||
item3 = UUID.Random();
|
||||
asset1 = UUID.Random();
|
||||
asset2 = UUID.Random();
|
||||
asset3 = UUID.Random();
|
||||
|
||||
name1 = "Root Folder for " + owner1.ToString();
|
||||
name2 = "First Level folder";
|
||||
name3 = "First Level folder 2";
|
||||
niname1 = "My Shirt";
|
||||
iname1 = "Shirt";
|
||||
iname2 = "Text Board";
|
||||
iname3 = "No Pants Barrel";
|
||||
}
|
||||
|
||||
protected override void InitService(object service)
|
||||
{
|
||||
db = (IInventoryDataPlugin)service;
|
||||
db.Initialise(m_connStr);
|
||||
ClearDB();
|
||||
}
|
||||
|
||||
private void ClearDB()
|
||||
{
|
||||
DropTables("inventoryitems", "inventoryfolders");
|
||||
ExecuteSql("delete from migrations where name='Inventory'");
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -38,59 +38,80 @@ using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using log4net;
|
||||
using System.Reflection;
|
||||
using System.Data.Common;
|
||||
|
||||
// DBMS-specific:
|
||||
using MySql.Data.MySqlClient;
|
||||
using OpenSim.Data.MySQL;
|
||||
|
||||
using System.Data.SqlClient;
|
||||
using OpenSim.Data.MSSQL;
|
||||
|
||||
using Mono.Data.Sqlite;
|
||||
using OpenSim.Data.SQLite;
|
||||
|
||||
namespace OpenSim.Data.Tests
|
||||
{
|
||||
public class BasicRegionTest
|
||||
[TestFixture(typeof(MySqlConnection), typeof(MySqlRegionData), Description = "Region store tests (MySQL)")]
|
||||
[TestFixture(typeof(SqlConnection), typeof(MSSQLRegionData), Description = "Region store tests (MS SQL Server)")]
|
||||
[TestFixture(typeof(SqliteConnection), typeof(SQLiteRegionData), Description = "Region store tests (SQLite)")]
|
||||
|
||||
public class RegionTests<TConn, TRegStore> : BasicDataServiceTest<TConn, TRegStore>
|
||||
where TConn : DbConnection, new()
|
||||
where TRegStore : class, IRegionDataStore, new()
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
public IRegionDataStore db;
|
||||
public UUID zero = UUID.Zero;
|
||||
public UUID region1;
|
||||
public UUID region2;
|
||||
public UUID region3;
|
||||
public UUID region4;
|
||||
public UUID prim1;
|
||||
public UUID prim2;
|
||||
public UUID prim3;
|
||||
public UUID prim4;
|
||||
public UUID prim5;
|
||||
public UUID prim6;
|
||||
public UUID item1;
|
||||
public UUID item2;
|
||||
public UUID item3;
|
||||
public UUID region1 = UUID.Random();
|
||||
public UUID region2 = UUID.Random();
|
||||
public UUID region3 = UUID.Random();
|
||||
public UUID region4 = UUID.Random();
|
||||
public UUID prim1 = UUID.Random();
|
||||
public UUID prim2 = UUID.Random();
|
||||
public UUID prim3 = UUID.Random();
|
||||
public UUID prim4 = UUID.Random();
|
||||
public UUID prim5 = UUID.Random();
|
||||
public UUID prim6 = UUID.Random();
|
||||
public UUID item1 = UUID.Random();
|
||||
public UUID item2 = UUID.Random();
|
||||
public UUID item3 = UUID.Random();
|
||||
|
||||
public static Random random;
|
||||
public static Random random = new Random();
|
||||
|
||||
public string itemname1 = "item1";
|
||||
|
||||
public uint localID;
|
||||
|
||||
public double height1;
|
||||
public double height2;
|
||||
public uint localID = 1;
|
||||
|
||||
public void SuperInit()
|
||||
public double height1 = 20;
|
||||
public double height2 = 100;
|
||||
|
||||
|
||||
protected override void InitService(object service)
|
||||
{
|
||||
OpenSim.Tests.Common.TestLogging.LogToConsole();
|
||||
|
||||
region1 = UUID.Random();
|
||||
region3 = UUID.Random();
|
||||
region4 = UUID.Random();
|
||||
prim1 = UUID.Random();
|
||||
prim2 = UUID.Random();
|
||||
prim3 = UUID.Random();
|
||||
prim4 = UUID.Random();
|
||||
prim5 = UUID.Random();
|
||||
prim6 = UUID.Random();
|
||||
item1 = UUID.Random();
|
||||
item2 = UUID.Random();
|
||||
item3 = UUID.Random();
|
||||
random = new Random();
|
||||
localID = 1;
|
||||
height1 = 20;
|
||||
height2 = 100;
|
||||
db = (IRegionDataStore)service;
|
||||
db.Initialise(m_connStr);
|
||||
ClearDB();
|
||||
}
|
||||
|
||||
|
||||
private void ClearDB()
|
||||
{
|
||||
// if a new table is added, it has to be dropped here
|
||||
ExecuteSql("delete from migrations where name='RegionStore';");
|
||||
|
||||
DropTables(
|
||||
"prims",
|
||||
"primshapes",
|
||||
"primitems",
|
||||
"terrain",
|
||||
"land",
|
||||
"landaccesslist",
|
||||
"regionban",
|
||||
"regionsettings"
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// Test Plan
|
||||
// Prims
|
||||
// - empty test - 001
|
||||
Reference in New Issue
Block a user