All data tests made DBMS-independent
parent
91ad1f4ee7
commit
7f70ae0ebd
|
@ -37,7 +37,7 @@ using OpenSim.Region.Framework.Interfaces;
|
|||
|
||||
namespace OpenSim.Data.MSSQL
|
||||
{
|
||||
public class MSSQLEstateData : IEstateDataStore
|
||||
public class MSSQLEstateStore : IEstateDataStore
|
||||
{
|
||||
private const string _migrationStore = "EstateStore";
|
||||
|
||||
|
|
|
@ -1,116 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using NUnit.Framework;
|
||||
using OpenSim.Data.Tests;
|
||||
using log4net;
|
||||
using System.Reflection;
|
||||
using OpenSim.Tests.Common;
|
||||
using MySql.Data.MySqlClient;
|
||||
|
||||
|
||||
namespace OpenSim.Data.MySQL.Tests
|
||||
{
|
||||
[TestFixture, DatabaseTest]
|
||||
public class MySQLEstateTest : BasicEstateTest
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
public string file;
|
||||
public string connect = "Server=localhost;Port=3306;Database=opensim-nunit;User ID=opensim-nunit;Password=opensim-nunit;Pooling=false;";
|
||||
|
||||
[TestFixtureSetUp]
|
||||
public void Init()
|
||||
{
|
||||
SuperInit();
|
||||
// If we manage to connect to the database with the user
|
||||
// and password above it is our test database, and run
|
||||
// these tests. If anything goes wrong, ignore these
|
||||
// tests.
|
||||
try
|
||||
{
|
||||
// clear db incase to ensure we are in a clean state
|
||||
ClearDB();
|
||||
|
||||
regionDb = new MySQLDataStore();
|
||||
regionDb.Initialise(connect);
|
||||
db = new MySQLEstateStore();
|
||||
db.Initialise(connect);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.Error("Exception {0}", e);
|
||||
Assert.Ignore();
|
||||
}
|
||||
}
|
||||
|
||||
[TestFixtureTearDown]
|
||||
public void Cleanup()
|
||||
{
|
||||
if (regionDb != null)
|
||||
{
|
||||
regionDb.Dispose();
|
||||
}
|
||||
ClearDB();
|
||||
}
|
||||
|
||||
private void ClearDB()
|
||||
{
|
||||
// if a new table is added, it has to be dropped here
|
||||
ExecuteSql("drop table if exists migrations");
|
||||
ExecuteSql("drop table if exists prims");
|
||||
ExecuteSql("drop table if exists primshapes");
|
||||
ExecuteSql("drop table if exists primitems");
|
||||
ExecuteSql("drop table if exists terrain");
|
||||
ExecuteSql("drop table if exists land");
|
||||
ExecuteSql("drop table if exists landaccesslist");
|
||||
ExecuteSql("drop table if exists regionban");
|
||||
ExecuteSql("drop table if exists regionsettings");
|
||||
ExecuteSql("drop table if exists estate_managers");
|
||||
ExecuteSql("drop table if exists estate_groups");
|
||||
ExecuteSql("drop table if exists estate_users");
|
||||
ExecuteSql("drop table if exists estateban");
|
||||
ExecuteSql("drop table if exists estate_settings");
|
||||
ExecuteSql("drop table if exists estate_map");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Execute a MySqlCommand
|
||||
/// </summary>
|
||||
/// <param name="sql">sql string to execute</param>
|
||||
private void ExecuteSql(string sql)
|
||||
{
|
||||
using (MySqlConnection dbcon = new MySqlConnection(connect))
|
||||
{
|
||||
dbcon.Open();
|
||||
|
||||
MySqlCommand cmd = new MySqlCommand(sql, dbcon);
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,99 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using NUnit.Framework;
|
||||
using OpenSim.Data.Tests;
|
||||
using log4net;
|
||||
using System.Reflection;
|
||||
using OpenSim.Tests.Common;
|
||||
using MySql.Data.MySqlClient;
|
||||
|
||||
|
||||
namespace OpenSim.Data.MySQL.Tests
|
||||
{
|
||||
[TestFixture, DatabaseTest]
|
||||
public class MySQLInventoryTest : BasicInventoryTest
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
public string file;
|
||||
public string connect = "Server=localhost;Port=3306;Database=opensim-nunit;User ID=opensim-nunit;Password=opensim-nunit;Pooling=false;";
|
||||
|
||||
[TestFixtureSetUp]
|
||||
public void Init()
|
||||
{
|
||||
SuperInit();
|
||||
// If we manage to connect to the database with the user
|
||||
// and password above it is our test database, and run
|
||||
// these tests. If anything goes wrong, ignore these
|
||||
// tests.
|
||||
try
|
||||
{
|
||||
DropTables();
|
||||
db = new MySQLInventoryData();
|
||||
db.Initialise(connect);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.Error("Exception {0}", e);
|
||||
Assert.Ignore();
|
||||
}
|
||||
}
|
||||
|
||||
[TestFixtureTearDown]
|
||||
public void Cleanup()
|
||||
{
|
||||
if (db != null)
|
||||
{
|
||||
db.Dispose();
|
||||
}
|
||||
DropTables();
|
||||
}
|
||||
|
||||
private void DropTables()
|
||||
{
|
||||
ExecuteSql("drop table IF EXISTS inventoryitems");
|
||||
ExecuteSql("drop table IF EXISTS inventoryfolders");
|
||||
ExecuteSql("drop table IF EXISTS migrations");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Execute a MySqlCommand
|
||||
/// </summary>
|
||||
/// <param name="sql">sql string to execute</param>
|
||||
private void ExecuteSql(string sql)
|
||||
{
|
||||
using (MySqlConnection dbcon = new MySqlConnection(connect))
|
||||
{
|
||||
dbcon.Open();
|
||||
|
||||
MySqlCommand cmd = new MySqlCommand(sql, dbcon);
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,112 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using NUnit.Framework;
|
||||
using OpenSim.Data.Tests;
|
||||
using log4net;
|
||||
using System.Reflection;
|
||||
using OpenSim.Tests.Common;
|
||||
using MySql.Data.MySqlClient;
|
||||
|
||||
namespace OpenSim.Data.MySQL.Tests
|
||||
{
|
||||
[TestFixture, DatabaseTest]
|
||||
public class MySQLRegionTest : BasicRegionTest
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
public string file;
|
||||
public string connect = "Server=localhost;Port=3306;Database=opensim-nunit;User ID=opensim-nunit;Password=opensim-nunit;Pooling=false;";
|
||||
|
||||
[TestFixtureSetUp]
|
||||
public void Init()
|
||||
{
|
||||
SuperInit();
|
||||
// If we manage to connect to the database with the user
|
||||
// and password above it is our test database, and run
|
||||
// these tests. If anything goes wrong, ignore these
|
||||
// tests.
|
||||
try
|
||||
{
|
||||
// this is important in case a previous run ended badly
|
||||
ClearDB();
|
||||
|
||||
db = new MySQLDataStore();
|
||||
db.Initialise(connect);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.Error("Exception {0}", e);
|
||||
Assert.Ignore();
|
||||
}
|
||||
}
|
||||
|
||||
[TestFixtureTearDown]
|
||||
public void Cleanup()
|
||||
{
|
||||
if (db != null)
|
||||
{
|
||||
db.Dispose();
|
||||
}
|
||||
ClearDB();
|
||||
}
|
||||
|
||||
private void ClearDB()
|
||||
{
|
||||
ExecuteSql("drop table if exists migrations");
|
||||
ExecuteSql("drop table if exists prims");
|
||||
ExecuteSql("drop table if exists primshapes");
|
||||
ExecuteSql("drop table if exists primitems");
|
||||
ExecuteSql("drop table if exists terrain");
|
||||
ExecuteSql("drop table if exists land");
|
||||
ExecuteSql("drop table if exists landaccesslist");
|
||||
ExecuteSql("drop table if exists regionban");
|
||||
ExecuteSql("drop table if exists regionsettings");
|
||||
ExecuteSql("drop table if exists estate_managers");
|
||||
ExecuteSql("drop table if exists estate_groups");
|
||||
ExecuteSql("drop table if exists estate_users");
|
||||
ExecuteSql("drop table if exists estateban");
|
||||
ExecuteSql("drop table if exists estate_settings");
|
||||
ExecuteSql("drop table if exists estate_map");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Execute a MySqlCommand
|
||||
/// </summary>
|
||||
/// <param name="sql">sql string to execute</param>
|
||||
private void ExecuteSql(string sql)
|
||||
{
|
||||
using (MySqlConnection dbcon = new MySqlConnection(connect))
|
||||
{
|
||||
dbcon.Open();
|
||||
|
||||
MySqlCommand cmd = new MySqlCommand(sql, dbcon);
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,65 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System.IO;
|
||||
using NUnit.Framework;
|
||||
using OpenSim.Data.Tests;
|
||||
using OpenSim.Tests.Common;
|
||||
|
||||
namespace OpenSim.Data.SQLite.Tests
|
||||
{
|
||||
[TestFixture, DatabaseTest]
|
||||
public class SQLiteEstateTest : BasicEstateTest
|
||||
{
|
||||
public string file = "regiontest.db";
|
||||
public string connect;
|
||||
|
||||
[TestFixtureSetUp]
|
||||
public void Init()
|
||||
{
|
||||
// SQLite doesn't work on power or z linux
|
||||
if (Directory.Exists("/proc/ppc64") || Directory.Exists("/proc/dasd"))
|
||||
{
|
||||
Assert.Ignore();
|
||||
}
|
||||
|
||||
SuperInit();
|
||||
file = Path.GetTempFileName() + ".db";
|
||||
connect = "URI=file:" + file + ",version=3";
|
||||
db = new SQLiteEstateStore();
|
||||
db.Initialise(connect);
|
||||
regionDb = new SQLiteRegionData();
|
||||
regionDb.Initialise(connect);
|
||||
}
|
||||
|
||||
[TestFixtureTearDown]
|
||||
public void Cleanup()
|
||||
{
|
||||
regionDb.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,66 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System.IO;
|
||||
using NUnit.Framework;
|
||||
using OpenSim.Data.Tests;
|
||||
using OpenSim.Tests.Common;
|
||||
|
||||
namespace OpenSim.Data.SQLite.Tests
|
||||
{
|
||||
[TestFixture, DatabaseTest]
|
||||
public class SQLiteInventoryTest : BasicInventoryTest
|
||||
{
|
||||
public string file;
|
||||
public string connect;
|
||||
|
||||
[TestFixtureSetUp]
|
||||
public void Init()
|
||||
{
|
||||
// SQLite doesn't work on power or z linux
|
||||
if (Directory.Exists("/proc/ppc64") || Directory.Exists("/proc/dasd"))
|
||||
{
|
||||
Assert.Ignore();
|
||||
}
|
||||
|
||||
SuperInit();
|
||||
|
||||
file = Path.GetTempFileName() + ".db";
|
||||
connect = "URI=file:" + file + ",version=3";
|
||||
|
||||
db = new SQLiteInventoryStore();
|
||||
db.Initialise(connect);
|
||||
}
|
||||
|
||||
[TestFixtureTearDown]
|
||||
public void Cleanup()
|
||||
{
|
||||
db.Dispose();
|
||||
File.Delete(file);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,64 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System.IO;
|
||||
using NUnit.Framework;
|
||||
using OpenSim.Data.Tests;
|
||||
using OpenSim.Tests.Common;
|
||||
|
||||
namespace OpenSim.Data.SQLite.Tests
|
||||
{
|
||||
[TestFixture, DatabaseTest]
|
||||
public class SQLiteRegionTest : BasicRegionTest
|
||||
{
|
||||
public string file = "regiontest.db";
|
||||
public string connect;
|
||||
|
||||
[TestFixtureSetUp]
|
||||
public void Init()
|
||||
{
|
||||
// SQLite doesn't work on power or z linux
|
||||
if (Directory.Exists("/proc/ppc64") || Directory.Exists("/proc/dasd"))
|
||||
{
|
||||
Assert.Ignore();
|
||||
}
|
||||
|
||||
SuperInit();
|
||||
file = Path.GetTempFileName() + ".db";
|
||||
connect = "URI=file:" + file + ",version=3";
|
||||
db = new SQLiteRegionData();
|
||||
db.Initialise(connect);
|
||||
}
|
||||
|
||||
[TestFixtureTearDown]
|
||||
public void Cleanup()
|
||||
{
|
||||
db.Dispose();
|
||||
File.Delete(file);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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
|
Loading…
Reference in New Issue