Merge branch 'unitests'

Signed-off-by: Melanie <melanie@t-data.com>
soprefactor
Melanie 2010-05-26 10:38:46 +01:00
commit 1c7f60ab49
35 changed files with 1155 additions and 1269 deletions

View File

@ -121,15 +121,16 @@ namespace OpenSim.Data.MSSQL
if (reader.Read())
{
AssetBase asset = new AssetBase(
new UUID((Guid)reader["id"]),
DBGuid.FromDB(reader["id"]),
(string)reader["name"],
Convert.ToSByte(reader["assetType"]),
String.Empty
reader["creatorid"].ToString()
);
// Region Main
asset.Description = (string)reader["description"];
asset.Local = Convert.ToBoolean(reader["local"]);
asset.Temporary = Convert.ToBoolean(reader["temporary"]);
asset.Flags = (AssetFlags)(Convert.ToInt32(reader["asset_flags"]));
asset.Data = (byte[])reader["data"];
return asset;
}
@ -144,26 +145,19 @@ namespace OpenSim.Data.MSSQL
/// <param name="asset">the asset</param>
override public void StoreAsset(AssetBase asset)
{
if (ExistsAsset(asset.FullID))
UpdateAsset(asset);
else
InsertAsset(asset);
}
private void InsertAsset(AssetBase asset)
{
if (ExistsAsset(asset.FullID))
{
return;
}
string sql = @"INSERT INTO assets
([id], [name], [description], [assetType], [local],
[temporary], [create_time], [access_time], [data])
VALUES
(@id, @name, @description, @assetType, @local,
@temporary, @create_time, @access_time, @data)";
string sql =
@"IF EXISTS(SELECT * FROM assets WHERE id=@id)
UPDATE assets set name = @name, description = @description, assetType = @assetType,
local = @local, temporary = @temporary, creatorid = @creatorid, data = @data
WHERE id=@id
ELSE
INSERT INTO assets
([id], [name], [description], [assetType], [local],
[temporary], [create_time], [access_time], [creatorid], [asset_flags], [data])
VALUES
(@id, @name, @description, @assetType, @local,
@temporary, @create_time, @access_time, @creatorid, @asset_flags, @data)";
string assetName = asset.Name;
if (asset.Name.Length > 64)
@ -191,6 +185,8 @@ namespace OpenSim.Data.MSSQL
command.Parameters.Add(m_database.CreateParameter("temporary", asset.Temporary));
command.Parameters.Add(m_database.CreateParameter("access_time", now));
command.Parameters.Add(m_database.CreateParameter("create_time", now));
command.Parameters.Add(m_database.CreateParameter("asset_flags", (int)asset.Flags));
command.Parameters.Add(m_database.CreateParameter("creatorid", asset.Metadata.CreatorID));
command.Parameters.Add(m_database.CreateParameter("data", asset.Data));
conn.Open();
try
@ -199,57 +195,11 @@ namespace OpenSim.Data.MSSQL
}
catch(Exception e)
{
m_log.Error("[ASSET DB]: Error inserting item :" + e.Message);
m_log.Error("[ASSET DB]: Error storing item :" + e.Message);
}
}
}
/// <summary>
/// Update asset in m_database
/// </summary>
/// <param name="asset">the asset</param>
private void UpdateAsset(AssetBase asset)
{
string sql = @"UPDATE assets set id = @id, name = @name, description = @description, assetType = @assetType,
local = @local, temporary = @temporary, data = @data
WHERE id = @keyId;";
string assetName = asset.Name;
if (asset.Name.Length > 64)
{
assetName = asset.Name.Substring(0, 64);
m_log.Warn("[ASSET DB]: Name field truncated from " + asset.Name.Length + " to " + assetName.Length + " characters on update");
}
string assetDescription = asset.Description;
if (asset.Description.Length > 64)
{
assetDescription = asset.Description.Substring(0, 64);
m_log.Warn("[ASSET DB]: Description field truncated from " + asset.Description.Length + " to " + assetDescription.Length + " characters on update");
}
using (SqlConnection conn = new SqlConnection(m_connectionString))
using (SqlCommand command = new SqlCommand(sql, conn))
{
command.Parameters.Add(m_database.CreateParameter("id", asset.FullID));
command.Parameters.Add(m_database.CreateParameter("name", assetName));
command.Parameters.Add(m_database.CreateParameter("description", assetDescription));
command.Parameters.Add(m_database.CreateParameter("assetType", asset.Type));
command.Parameters.Add(m_database.CreateParameter("local", asset.Local));
command.Parameters.Add(m_database.CreateParameter("temporary", asset.Temporary));
command.Parameters.Add(m_database.CreateParameter("data", asset.Data));
command.Parameters.Add(m_database.CreateParameter("@keyId", asset.FullID));
conn.Open();
try
{
command.ExecuteNonQuery();
}
catch (Exception e)
{
m_log.Error(e.ToString());
}
}
}
// Commented out since currently unused - this probably should be called in GetAsset()
// private void UpdateAccessTime(AssetBase asset)
@ -295,26 +245,34 @@ namespace OpenSim.Data.MSSQL
public override List<AssetMetadata> FetchAssetMetadataSet(int start, int count)
{
List<AssetMetadata> retList = new List<AssetMetadata>(count);
string sql = @"SELECT (name,description,assetType,temporary,id), Row = ROW_NUMBER()
OVER (ORDER BY (some column to order by))
WHERE Row >= @Start AND Row < @Start + @Count";
string sql = @"WITH OrderedAssets AS
(
SELECT id, name, description, assetType, temporary, creatorid,
RowNumber = ROW_NUMBER() OVER (ORDER BY id)
FROM assets
)
SELECT *
FROM OrderedAssets
WHERE RowNumber BETWEEN @start AND @stop;";
using (SqlConnection conn = new SqlConnection(m_connectionString))
using (SqlCommand cmd = new SqlCommand(sql, conn))
{
cmd.Parameters.Add(m_database.CreateParameter("start", start));
cmd.Parameters.Add(m_database.CreateParameter("count", count));
cmd.Parameters.Add(m_database.CreateParameter("stop", start + count - 1));
conn.Open();
using (SqlDataReader reader = cmd.ExecuteReader())
{
while (reader.Read())
{
AssetMetadata metadata = new AssetMetadata();
metadata.FullID = new UUID((Guid)reader["id"]);
metadata.FullID = DBGuid.FromDB(reader["id"]);
metadata.Name = (string)reader["name"];
metadata.Description = (string)reader["description"];
metadata.Type = Convert.ToSByte(reader["assetType"]);
metadata.Temporary = Convert.ToBoolean(reader["temporary"]);
metadata.CreatorID = (string)reader["creatorid"];
retList.Add(metadata);
}
}
}

View File

@ -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";

View File

@ -111,6 +111,9 @@ namespace OpenSim.Data.MSSQL
/// <returns>A list of folder objects</returns>
public List<InventoryFolderBase> getUserRootFolders(UUID user)
{
if (user == UUID.Zero)
return new List<InventoryFolderBase>();
return getInventoryFolders(UUID.Zero, user);
}
@ -184,7 +187,19 @@ namespace OpenSim.Data.MSSQL
//Note maybe change this to use a Dataset that loading in all folders of a user and then go throw it that way.
//Note this is changed so it opens only one connection to the database and not everytime it wants to get data.
/* NOTE: the implementation below is very inefficient (makes a separate request to get subfolders for
* every found folder, recursively). Inventory code for other DBs has been already rewritten to get ALL
* inventory for a specific user at once.
*
* Meanwhile, one little thing is corrected: getFolderHierarchy(UUID.Zero) doesn't make sense and should never
* be used, so check for that and return an empty list.
*/
List<InventoryFolderBase> folders = new List<InventoryFolderBase>();
if (parentID == UUID.Zero)
return folders;
string sql = "SELECT * FROM inventoryfolders WHERE parentFolderID = @parentID";
using (SqlConnection conn = new SqlConnection(m_connectionString))
using (SqlCommand cmd = new SqlCommand(sql, conn))
@ -249,13 +264,12 @@ namespace OpenSim.Data.MSSQL
/// <param name="folder">Folder to update</param>
public void updateInventoryFolder(InventoryFolderBase folder)
{
string sql = @"UPDATE inventoryfolders SET folderID = @folderID,
agentID = @agentID,
string sql = @"UPDATE inventoryfolders SET agentID = @agentID,
parentFolderID = @parentFolderID,
folderName = @folderName,
type = @type,
version = @version
WHERE folderID = @keyFolderID";
WHERE folderID = @folderID";
string folderName = folder.Name;
if (folderName.Length > 64)
@ -272,7 +286,6 @@ namespace OpenSim.Data.MSSQL
cmd.Parameters.Add(database.CreateParameter("folderName", folderName));
cmd.Parameters.Add(database.CreateParameter("type", folder.Type));
cmd.Parameters.Add(database.CreateParameter("version", folder.Version));
cmd.Parameters.Add(database.CreateParameter("@keyFolderID", folder.ID));
conn.Open();
try
{
@ -296,7 +309,7 @@ namespace OpenSim.Data.MSSQL
using (SqlCommand cmd = new SqlCommand(sql, conn))
{
cmd.Parameters.Add(database.CreateParameter("parentFolderID", folder.ParentID));
cmd.Parameters.Add(database.CreateParameter("@folderID", folder.ID));
cmd.Parameters.Add(database.CreateParameter("folderID", folder.ID));
conn.Open();
try
{
@ -489,8 +502,7 @@ namespace OpenSim.Data.MSSQL
/// <param name="item">Inventory item to update</param>
public void updateInventoryItem(InventoryItemBase item)
{
string sql = @"UPDATE inventoryitems SET inventoryID = @inventoryID,
assetID = @assetID,
string sql = @"UPDATE inventoryitems SET assetID = @assetID,
assetType = @assetType,
parentFolderID = @parentFolderID,
avatarID = @avatarID,
@ -502,13 +514,14 @@ namespace OpenSim.Data.MSSQL
creatorID = @creatorID,
inventoryBasePermissions = @inventoryBasePermissions,
inventoryEveryOnePermissions = @inventoryEveryOnePermissions,
inventoryGroupPermissions = @inventoryGroupPermissions,
salePrice = @salePrice,
saleType = @saleType,
creationDate = @creationDate,
groupID = @groupID,
groupOwned = @groupOwned,
flags = @flags
WHERE inventoryID = @keyInventoryID";
WHERE inventoryID = @inventoryID";
string itemName = item.Name;
if (item.Name.Length > 64)
@ -537,16 +550,16 @@ namespace OpenSim.Data.MSSQL
command.Parameters.Add(database.CreateParameter("inventoryNextPermissions", item.NextPermissions));
command.Parameters.Add(database.CreateParameter("inventoryCurrentPermissions", item.CurrentPermissions));
command.Parameters.Add(database.CreateParameter("invType", item.InvType));
command.Parameters.Add(database.CreateParameter("creatorID", item.CreatorIdAsUuid));
command.Parameters.Add(database.CreateParameter("creatorID", item.CreatorId));
command.Parameters.Add(database.CreateParameter("inventoryBasePermissions", item.BasePermissions));
command.Parameters.Add(database.CreateParameter("inventoryEveryOnePermissions", item.EveryOnePermissions));
command.Parameters.Add(database.CreateParameter("inventoryGroupPermissions", item.GroupPermissions));
command.Parameters.Add(database.CreateParameter("salePrice", item.SalePrice));
command.Parameters.Add(database.CreateParameter("saleType", item.SaleType));
command.Parameters.Add(database.CreateParameter("creationDate", item.CreationDate));
command.Parameters.Add(database.CreateParameter("groupID", item.GroupID));
command.Parameters.Add(database.CreateParameter("groupOwned", item.GroupOwned));
command.Parameters.Add(database.CreateParameter("flags", item.Flags));
command.Parameters.Add(database.CreateParameter("keyInventoryID", item.ID));
conn.Open();
try
{
@ -732,9 +745,9 @@ namespace OpenSim.Data.MSSQL
try
{
InventoryFolderBase folder = new InventoryFolderBase();
folder.Owner = new UUID((Guid)reader["agentID"]);
folder.ParentID = new UUID((Guid)reader["parentFolderID"]);
folder.ID = new UUID((Guid)reader["folderID"]);
folder.Owner = DBGuid.FromDB(reader["agentID"]);
folder.ParentID = DBGuid.FromDB(reader["parentFolderID"]);
folder.ID = DBGuid.FromDB(reader["folderID"]);
folder.Name = (string)reader["folderName"];
folder.Type = (short)reader["type"];
folder.Version = Convert.ToUInt16(reader["version"]);
@ -760,24 +773,24 @@ namespace OpenSim.Data.MSSQL
{
InventoryItemBase item = new InventoryItemBase();
item.ID = new UUID((Guid)reader["inventoryID"]);
item.AssetID = new UUID((Guid)reader["assetID"]);
item.ID = DBGuid.FromDB(reader["inventoryID"]);
item.AssetID = DBGuid.FromDB(reader["assetID"]);
item.AssetType = Convert.ToInt32(reader["assetType"].ToString());
item.Folder = new UUID((Guid)reader["parentFolderID"]);
item.Owner = new UUID((Guid)reader["avatarID"]);
item.Folder = DBGuid.FromDB(reader["parentFolderID"]);
item.Owner = DBGuid.FromDB(reader["avatarID"]);
item.Name = reader["inventoryName"].ToString();
item.Description = reader["inventoryDescription"].ToString();
item.NextPermissions = Convert.ToUInt32(reader["inventoryNextPermissions"]);
item.CurrentPermissions = Convert.ToUInt32(reader["inventoryCurrentPermissions"]);
item.InvType = Convert.ToInt32(reader["invType"].ToString());
item.CreatorId = ((Guid)reader["creatorID"]).ToString();
item.CreatorId = reader["creatorID"].ToString();
item.BasePermissions = Convert.ToUInt32(reader["inventoryBasePermissions"]);
item.EveryOnePermissions = Convert.ToUInt32(reader["inventoryEveryOnePermissions"]);
item.GroupPermissions = Convert.ToUInt32(reader["inventoryGroupPermissions"]);
item.SalePrice = Convert.ToInt32(reader["salePrice"]);
item.SaleType = Convert.ToByte(reader["saleType"]);
item.CreationDate = Convert.ToInt32(reader["creationDate"]);
item.GroupID = new UUID((Guid)reader["groupID"]);
item.GroupID = DBGuid.FromDB(reader["groupID"]);
item.GroupOwned = Convert.ToBoolean(reader["groupOwned"]);
item.Flags = Convert.ToUInt32(reader["flags"]);

View File

@ -97,4 +97,10 @@ COMMIT
DELETE FROM assets WHERE id = 'dc4b9f0b-d008-45c6-96a4-01dd947ac621';
:VERSION 6
ALTER TABLE assets ADD asset_flags INTEGER NOT NULL DEFAULT 0;
:VERSION 7
alter table assets add creatorid varchar(36) not null default '';

View File

@ -171,4 +171,74 @@ CREATE NONCLUSTERED INDEX folder ON dbo.inventoryitems
COMMIT
:VERSION 5
# It would be totally crazy to have to recreate the whole table just to change one column type,
# just because MS SQL treats each DEFAULT as a constraint object that must be dropped
# before anything can be done to the column. Since all defaults here are unnamed, there is
# no easy way to drop them! The hairy piece of code below removes all DEFAULT constraints
# from InventoryItems.
# SO: anything that's NULLable is by default NULL, so please don't declare DEFAULT(NULL),
# they do nothing but prevent changes to the columns. If you really
# need to have DEFAULTs or other constraints, give them names so they can be dropped when needed!
BEGIN TRANSACTION
DECLARE @nm varchar(80);
DECLARE x CURSOR LOCAL FORWARD_ONLY READ_ONLY
FOR SELECT name FROM sys.default_constraints where parent_object_id = OBJECT_ID('inventoryitems');
OPEN x;
FETCH NEXT FROM x INTO @nm;
WHILE @@FETCH_STATUS = 0
BEGIN
EXEC('alter table inventoryitems drop ' + @nm);
FETCH NEXT FROM x INTO @nm;
END
CLOSE x
DEALLOCATE x
COMMIT
# all DEFAULTs dropped!
:GO
BEGIN TRANSACTION
# Restoring defaults:
# NOTE: [inventoryID] does NOT need one: it's NOT NULL PK and a unique Guid must be provided every time anyway!
alter table inventoryitems
add constraint def_baseperm default 0 for inventoryBasePermissions
alter table inventoryitems
add constraint def_allperm default 0 for inventoryEveryOnePermissions
alter table inventoryitems
add constraint def_grpperm default 0 for inventoryGroupPermissions
COMMIT
:VERSION 7
BEGIN TRANSACTION
# CreatorID goes back to VARCHAR(36) (???)
exec sp_rename 'inventoryitems.CreatorID', 'cr_old', 'COLUMN'
:GO
alter table inventoryitems
add creatorID varchar(36) NULL
:GO
update inventoryitems set creatorID = CONVERT(VARCHAR(36), cr_old)
alter table inventoryitems
drop column cr_old
COMMIT

View File

@ -0,0 +1,81 @@
:VERSION 13
# The estate migrations used to be in Region store
# here they will do nothing (bad) if the tables are already there,
# just update the store version.
BEGIN;
CREATE TABLE IF NOT EXISTS `estate_managers` (
`EstateID` int(10) unsigned NOT NULL,
`uuid` char(36) NOT NULL,
KEY `EstateID` (`EstateID`)
) ENGINE=InnoDB;
CREATE TABLE IF NOT EXISTS `estate_groups` (
`EstateID` int(10) unsigned NOT NULL,
`uuid` char(36) NOT NULL,
KEY `EstateID` (`EstateID`)
) ENGINE=InnoDB;
CREATE TABLE IF NOT EXISTS `estate_users` (
`EstateID` int(10) unsigned NOT NULL,
`uuid` char(36) NOT NULL,
KEY `EstateID` (`EstateID`)
) ENGINE=InnoDB;
CREATE TABLE IF NOT EXISTS `estateban` (
`EstateID` int(10) unsigned NOT NULL,
`bannedUUID` varchar(36) NOT NULL,
`bannedIp` varchar(16) NOT NULL,
`bannedIpHostMask` varchar(16) NOT NULL,
`bannedNameMask` varchar(64) default NULL,
KEY `estateban_EstateID` (`EstateID`)
) ENGINE=InnoDB;
CREATE TABLE IF NOT EXISTS `estate_settings` (
`EstateID` int(10) unsigned NOT NULL auto_increment,
`EstateName` varchar(64) default NULL,
`AbuseEmailToEstateOwner` tinyint(4) NOT NULL,
`DenyAnonymous` tinyint(4) NOT NULL,
`ResetHomeOnTeleport` tinyint(4) NOT NULL,
`FixedSun` tinyint(4) NOT NULL,
`DenyTransacted` tinyint(4) NOT NULL,
`BlockDwell` tinyint(4) NOT NULL,
`DenyIdentified` tinyint(4) NOT NULL,
`AllowVoice` tinyint(4) NOT NULL,
`UseGlobalTime` tinyint(4) NOT NULL,
`PricePerMeter` int(11) NOT NULL,
`TaxFree` tinyint(4) NOT NULL,
`AllowDirectTeleport` tinyint(4) NOT NULL,
`RedirectGridX` int(11) NOT NULL,
`RedirectGridY` int(11) NOT NULL,
`ParentEstateID` int(10) unsigned NOT NULL,
`SunPosition` double NOT NULL,
`EstateSkipScripts` tinyint(4) NOT NULL,
`BillableFactor` float NOT NULL,
`PublicAccess` tinyint(4) NOT NULL,
`AbuseEmail` varchar(255) not null,
`EstateOwner` varchar(36) not null,
`DenyMinors` tinyint not null,
PRIMARY KEY (`EstateID`)
) ENGINE=InnoDB AUTO_INCREMENT=100;
CREATE TABLE IF NOT EXISTS `estate_map` (
`RegionID` char(36) NOT NULL default '00000000-0000-0000-0000-000000000000',
`EstateID` int(11) NOT NULL,
PRIMARY KEY (`RegionID`),
KEY `EstateID` (`EstateID`)
) ENGINE=InnoDB;
COMMIT;
:VERSION 32 #--------------------- (moved from RegionStore migr, just in case)
BEGIN;
ALTER TABLE estate_settings AUTO_INCREMENT = 100;
COMMIT;

View File

@ -386,84 +386,6 @@ CREATE TABLE `regionsettings` (
PRIMARY KEY (`regionUUID`)
) ENGINE=InnoDB;
CREATE TABLE `estate_managers` (
`EstateID` int(10) unsigned NOT NULL,
`uuid` char(36) NOT NULL,
KEY `EstateID` (`EstateID`)
) ENGINE=InnoDB;
CREATE TABLE `estate_groups` (
`EstateID` int(10) unsigned NOT NULL,
`uuid` char(36) NOT NULL,
KEY `EstateID` (`EstateID`)
) ENGINE=InnoDB;
CREATE TABLE `estate_users` (
`EstateID` int(10) unsigned NOT NULL,
`uuid` char(36) NOT NULL,
KEY `EstateID` (`EstateID`)
) ENGINE=InnoDB;
CREATE TABLE `estateban` (
`EstateID` int(10) unsigned NOT NULL,
`bannedUUID` varchar(36) NOT NULL,
`bannedIp` varchar(16) NOT NULL,
`bannedIpHostMask` varchar(16) NOT NULL,
`bannedNameMask` varchar(64) default NULL,
KEY `estateban_EstateID` (`EstateID`)
) ENGINE=InnoDB;
CREATE TABLE `estate_settings` (
`EstateID` int(10) unsigned NOT NULL auto_increment,
`EstateName` varchar(64) default NULL,
`AbuseEmailToEstateOwner` tinyint(4) NOT NULL,
`DenyAnonymous` tinyint(4) NOT NULL,
`ResetHomeOnTeleport` tinyint(4) NOT NULL,
`FixedSun` tinyint(4) NOT NULL,
`DenyTransacted` tinyint(4) NOT NULL,
`BlockDwell` tinyint(4) NOT NULL,
`DenyIdentified` tinyint(4) NOT NULL,
`AllowVoice` tinyint(4) NOT NULL,
`UseGlobalTime` tinyint(4) NOT NULL,
`PricePerMeter` int(11) NOT NULL,
`TaxFree` tinyint(4) NOT NULL,
`AllowDirectTeleport` tinyint(4) NOT NULL,
`RedirectGridX` int(11) NOT NULL,
`RedirectGridY` int(11) NOT NULL,
`ParentEstateID` int(10) unsigned NOT NULL,
`SunPosition` double NOT NULL,
`EstateSkipScripts` tinyint(4) NOT NULL,
`BillableFactor` float NOT NULL,
`PublicAccess` tinyint(4) NOT NULL,
PRIMARY KEY (`EstateID`)
) ENGINE=InnoDB AUTO_INCREMENT=100;
CREATE TABLE `estate_map` (
`RegionID` char(36) NOT NULL default '00000000-0000-0000-0000-000000000000',
`EstateID` int(11) NOT NULL,
PRIMARY KEY (`RegionID`),
KEY `EstateID` (`EstateID`)
) ENGINE=InnoDB;
commit;
:VERSION 14 #---------------------
begin;
alter table estate_settings add column AbuseEmail varchar(255) not null;
alter table estate_settings add column EstateOwner varchar(36) not null;
commit;
:VERSION 15 #---------------------
begin;
alter table estate_settings add column DenyMinors tinyint not null;
commit;
:VERSION 16 #---------------------
@ -795,12 +717,6 @@ ALTER TABLE regionsettings ADD COLUMN loaded_creation_datetime int unsigned NOT
COMMIT;
:VERSION 32 #---------------------
BEGIN;
ALTER TABLE estate_settings AUTO_INCREMENT = 100;
COMMIT;
:VERSION 33 #---------------------
BEGIN;

View File

@ -1,92 +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 MySQLAssetTest : BasicAssetTest
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public string file;
private string m_connectionString;
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
{
db = new MySQLAssetData();
db.Initialise(connect);
}
catch (Exception e)
{
m_log.Error(e.ToString());
Assert.Ignore();
}
}
[TestFixtureTearDown]
public void Cleanup()
{
if (db != null)
{
db.Dispose();
}
ExecuteSql("drop table migrations");
ExecuteSql("drop table assets");
}
/// <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();
}
}
}
}

View File

@ -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();
}
}
}
}

View File

@ -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();
}
}
}
}

View File

@ -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();
}
}
}
}

View File

@ -0,0 +1,88 @@
:VERSION 6
BEGIN TRANSACTION;
CREATE TABLE estate_groups (
EstateID int(10) NOT NULL,
uuid char(36) NOT NULL
);
CREATE TABLE estate_managers (
EstateID int(10) NOT NULL,
uuid char(36) NOT NULL
);
CREATE TABLE estate_map (
RegionID char(36) NOT NULL default '00000000-0000-0000-0000-000000000000',
EstateID int(11) NOT NULL
);
CREATE TABLE estate_settings (
EstateID INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
EstateName varchar(64) default NULL,
AbuseEmailToEstateOwner tinyint(4) NOT NULL,
DenyAnonymous tinyint(4) NOT NULL,
ResetHomeOnTeleport tinyint(4) NOT NULL,
FixedSun tinyint(4) NOT NULL,
DenyTransacted tinyint(4) NOT NULL,
BlockDwell tinyint(4) NOT NULL,
DenyIdentified tinyint(4) NOT NULL,
AllowVoice tinyint(4) NOT NULL,
UseGlobalTime tinyint(4) NOT NULL,
PricePerMeter int(11) NOT NULL,
TaxFree tinyint(4) NOT NULL,
AllowDirectTeleport tinyint(4) NOT NULL,
RedirectGridX int(11) NOT NULL,
RedirectGridY int(11) NOT NULL,
ParentEstateID int(10) NOT NULL,
SunPosition double NOT NULL,
EstateSkipScripts tinyint(4) NOT NULL,
BillableFactor float NOT NULL,
PublicAccess tinyint(4) NOT NULL
);
insert into estate_settings (
EstateID,EstateName,AbuseEmailToEstateOwner,DenyAnonymous,ResetHomeOnTeleport,FixedSun,DenyTransacted,BlockDwell,DenyIdentified,AllowVoice,UseGlobalTime,PricePerMeter,TaxFree,AllowDirectTeleport,RedirectGridX,RedirectGridY,ParentEstateID,SunPosition,PublicAccess,EstateSkipScripts,BillableFactor)
values ( 99, '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '');
delete from estate_settings;
CREATE TABLE estate_users (
EstateID int(10) NOT NULL,
uuid char(36) NOT NULL
);
CREATE TABLE estateban (
EstateID int(10) NOT NULL,
bannedUUID varchar(36) NOT NULL,
bannedIp varchar(16) NOT NULL,
bannedIpHostMask varchar(16) NOT NULL,
bannedNameMask varchar(64) default NULL
);
CREATE INDEX estate_ban_estate_id on estateban(EstateID);
CREATE INDEX estate_groups_estate_id on estate_groups(EstateID);
CREATE INDEX estate_managers_estate_id on estate_managers(EstateID);
CREATE INDEX estate_map_estate_id on estate_map(EstateID);
CREATE UNIQUE INDEX estate_map_region_id on estate_map(RegionID);
CREATE INDEX estate_users_estate_id on estate_users(EstateID);
COMMIT;
:VERSION 7
begin;
alter table estate_settings add column AbuseEmail varchar(255) not null default '';
alter table estate_settings add column EstateOwner varchar(36) not null default '';
commit;
:VERSION 8
begin;
alter table estate_settings add column DenyMinors tinyint not null default 0;
commit;

View File

@ -311,33 +311,8 @@ CREATE TABLE regionsettings (
PRIMARY KEY (regionUUID)
);
CREATE INDEX estate_ban_estate_id on estateban(EstateID);
CREATE INDEX estate_groups_estate_id on estate_groups(EstateID);
CREATE INDEX estate_managers_estate_id on estate_managers(EstateID);
CREATE INDEX estate_map_estate_id on estate_map(EstateID);
CREATE UNIQUE INDEX estate_map_region_id on estate_map(RegionID);
CREATE INDEX estate_users_estate_id on estate_users(EstateID);
COMMIT;
:VERSION 7
begin;
alter table estate_settings add column AbuseEmail varchar(255) not null default '';
alter table estate_settings add column EstateOwner varchar(36) not null default '';
commit;
:VERSION 8
begin;
alter table estate_settings add column DenyMinors tinyint not null default 0;
commit;
:VERSION 9
BEGIN;

View 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 SQLiteAssetTest : BasicAssetTest
{
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 SQLiteAssetData();
db.Initialise(connect);
}
[TestFixtureTearDown]
public void Cleanup()
{
db.Dispose();
File.Delete(file);
}
}
}

View File

@ -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();
}
}
}

View File

@ -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);
}
}
}

View 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);
}
}
}

View File

@ -0,0 +1,221 @@
/*
* 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 System.Collections.Generic;
using log4net.Config;
using NUnit.Framework;
using NUnit.Framework.Constraints;
using OpenMetaverse;
using OpenSim.Framework;
using System.Data.Common;
using log4net;
#if !NUNIT25
using NUnit.Framework.SyntaxHelpers;
#endif
// 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
{
#if NUNIT25
[TestFixture(typeof(MySqlConnection), typeof(MySQLAssetData), Description="Basic Asset store tests (MySQL)")]
[TestFixture(typeof(SqlConnection), typeof(MSSQLAssetData), Description = "Basic Asset store tests (MS SQL Server)")]
[TestFixture(typeof(SqliteConnection), typeof(SQLiteAssetData), Description = "Basic Asset store tests (SQLite)")]
#else
[TestFixture(Description = "Asset store tests (SQLite)")]
public class SQLiteAssetTests : AssetTests<SqliteConnection, SQLiteAssetData>
{
}
[TestFixture(Description = "Asset store tests (MySQL)")]
public class MySqlAssetTests : AssetTests<MySqlConnection, MySQLAssetData>
{
}
[TestFixture(Description = "Asset store tests (MS SQL Server)")]
public class MSSQLAssetTests : AssetTests<SqlConnection, MSSQLAssetData>
{
}
#endif
public class AssetTests<TConn, TAssetData> : BasicDataServiceTest<TConn, TAssetData>
where TConn : DbConnection, new()
where TAssetData : AssetDataBase, new()
{
TAssetData m_db;
public UUID uuid1 = UUID.Random();
public UUID uuid2 = UUID.Random();
public UUID uuid3 = UUID.Random();
public string critter1 = UUID.Random().ToString();
public string critter2 = UUID.Random().ToString();
public string critter3 = UUID.Random().ToString();
public byte[] data1 = new byte[100];
PropertyScrambler<AssetBase> scrambler = new PropertyScrambler<AssetBase>()
.DontScramble(x => x.ID)
.DontScramble(x => x.Type)
.DontScramble(x => x.FullID)
.DontScramble(x => x.Metadata.ID)
.DontScramble(x => x.Metadata.CreatorID)
.DontScramble(x => x.Metadata.ContentType)
.DontScramble(x => x.Metadata.FullID)
.DontScramble(x => x.Data);
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()
{
Assert.That(m_db.ExistsAsset(uuid1), Is.False);
Assert.That(m_db.ExistsAsset(uuid2), Is.False);
Assert.That(m_db.ExistsAsset(uuid3), Is.False);
}
[Test]
public void T010_StoreReadVerifyAssets()
{
AssetBase a1 = new AssetBase(uuid1, "asset one", (sbyte)AssetType.Texture, critter1.ToString());
AssetBase a2 = new AssetBase(uuid2, "asset two", (sbyte)AssetType.Texture, critter2.ToString());
AssetBase a3 = new AssetBase(uuid3, "asset three", (sbyte)AssetType.Texture, critter3.ToString());
a1.Data = data1;
a2.Data = data1;
a3.Data = data1;
scrambler.Scramble(a1);
scrambler.Scramble(a2);
scrambler.Scramble(a3);
m_db.StoreAsset(a1);
m_db.StoreAsset(a2);
m_db.StoreAsset(a3);
AssetBase a1a = m_db.GetAsset(uuid1);
Assert.That(a1a, Constraints.PropertyCompareConstraint(a1));
AssetBase a2a = m_db.GetAsset(uuid2);
Assert.That(a2a, Constraints.PropertyCompareConstraint(a2));
AssetBase a3a = m_db.GetAsset(uuid3);
Assert.That(a3a, Constraints.PropertyCompareConstraint(a3));
scrambler.Scramble(a1a);
scrambler.Scramble(a2a);
scrambler.Scramble(a3a);
m_db.StoreAsset(a1a);
m_db.StoreAsset(a2a);
m_db.StoreAsset(a3a);
AssetBase a1b = m_db.GetAsset(uuid1);
Assert.That(a1b, Constraints.PropertyCompareConstraint(a1a));
AssetBase a2b = m_db.GetAsset(uuid2);
Assert.That(a2b, Constraints.PropertyCompareConstraint(a2a));
AssetBase a3b = m_db.GetAsset(uuid3);
Assert.That(a3b, Constraints.PropertyCompareConstraint(a3a));
Assert.That(m_db.ExistsAsset(uuid1), Is.True);
Assert.That(m_db.ExistsAsset(uuid2), Is.True);
Assert.That(m_db.ExistsAsset(uuid3), Is.True);
List<AssetMetadata> metadatas = m_db.FetchAssetMetadataSet(0, 1000);
Assert.That(metadatas.Count >= 3, "FetchAssetMetadataSet() should have returned at least 3 assets!");
// It is possible that the Asset table is filled with data, in which case we don't try to find "our"
// assets there:
if (metadatas.Count < 1000)
{
AssetMetadata metadata = metadatas.Find(x => x.FullID == uuid1);
Assert.That(metadata.Name, Is.EqualTo(a1b.Name));
Assert.That(metadata.Description, Is.EqualTo(a1b.Description));
Assert.That(metadata.Type, Is.EqualTo(a1b.Type));
Assert.That(metadata.Temporary, Is.EqualTo(a1b.Temporary));
Assert.That(metadata.FullID, Is.EqualTo(a1b.FullID));
}
}
[Test]
public void T020_CheckForWeirdCreatorID()
{
// It is expected that eventually the CreatorID might be an arbitrary string (an URI)
// rather than a valid UUID (?). This test is to make sure that the database layer does not
// attempt to convert CreatorID to GUID, but just passes it both ways as a string.
AssetBase a1 = new AssetBase(uuid1, "asset one", (sbyte)AssetType.Texture, critter1);
AssetBase a2 = new AssetBase(uuid2, "asset two", (sbyte)AssetType.Texture, "This is not a GUID!");
AssetBase a3 = new AssetBase(uuid3, "asset three", (sbyte)AssetType.Texture, "");
a1.Data = data1;
a2.Data = data1;
a3.Data = data1;
m_db.StoreAsset(a1);
m_db.StoreAsset(a2);
m_db.StoreAsset(a3);
AssetBase a1a = m_db.GetAsset(uuid1);
Assert.That(a1a, Constraints.PropertyCompareConstraint(a1));
AssetBase a2a = m_db.GetAsset(uuid2);
Assert.That(a2a, Constraints.PropertyCompareConstraint(a2));
AssetBase a3a = m_db.GetAsset(uuid3);
Assert.That(a3a, Constraints.PropertyCompareConstraint(a3));
}
}
}

View File

@ -1,166 +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 System.Collections.Generic;
using log4net.Config;
using NUnit.Framework;
using NUnit.Framework.SyntaxHelpers;
using OpenMetaverse;
using OpenSim.Framework;
using log4net;
namespace OpenSim.Data.Tests
{
public class BasicAssetTest
{
public IAssetDataPlugin db;
public UUID uuid1;
public UUID uuid2;
public UUID uuid3;
public string critter1 = UUID.Random().ToString();
public string critter2 = UUID.Random().ToString();
public string critter3 = UUID.Random().ToString();
public byte[] asset1;
PropertyScrambler<AssetBase> scrambler;
public void SuperInit()
{
OpenSim.Tests.Common.TestLogging.LogToConsole();
uuid1 = UUID.Random();
uuid2 = UUID.Random();
uuid3 = UUID.Random();
asset1 = new byte[100];
asset1.Initialize();
scrambler = new PropertyScrambler<AssetBase>()
.DontScramble(x => x.ID)
.DontScramble(x => x.FullID)
.DontScramble(x => x.Metadata.ID)
.DontScramble(x => x.Metadata.Type)
.DontScramble(x => x.Metadata.CreatorID)
.DontScramble(x => x.Metadata.ContentType)
.DontScramble(x => x.Metadata.FullID);
}
[Test]
public void T001_LoadEmpty()
{
Assert.That(db.ExistsAsset(uuid1), Is.False);
Assert.That(db.ExistsAsset(uuid2), Is.False);
Assert.That(db.ExistsAsset(uuid3), Is.False);
}
[Test]
public void T010_StoreSimpleAsset()
{
AssetBase a1 = new AssetBase(uuid1, "asset one", (sbyte)AssetType.Texture, critter1);
AssetBase a2 = new AssetBase(uuid2, "asset two", (sbyte)AssetType.Texture, critter2);
AssetBase a3 = new AssetBase(uuid3, "asset three", (sbyte)AssetType.Texture, critter3);
a1.Data = asset1;
a2.Data = asset1;
a3.Data = asset1;
scrambler.Scramble(a1);
scrambler.Scramble(a2);
scrambler.Scramble(a3);
db.StoreAsset(a1);
db.StoreAsset(a2);
db.StoreAsset(a3);
AssetBase a1a = db.GetAsset(uuid1);
Assert.That(a1a, Constraints.PropertyCompareConstraint(a1));
AssetBase a2a = db.GetAsset(uuid2);
Assert.That(a2a, Constraints.PropertyCompareConstraint(a2));
AssetBase a3a = db.GetAsset(uuid3);
Assert.That(a3a, Constraints.PropertyCompareConstraint(a3));
scrambler.Scramble(a1a);
scrambler.Scramble(a2a);
scrambler.Scramble(a3a);
db.StoreAsset(a1a);
db.StoreAsset(a2a);
db.StoreAsset(a3a);
AssetBase a1b = db.GetAsset(uuid1);
Assert.That(a1b, Constraints.PropertyCompareConstraint(a1a));
AssetBase a2b = db.GetAsset(uuid2);
Assert.That(a2b, Constraints.PropertyCompareConstraint(a2a));
AssetBase a3b = db.GetAsset(uuid3);
Assert.That(a3b, Constraints.PropertyCompareConstraint(a3a));
Assert.That(db.ExistsAsset(uuid1), Is.True);
Assert.That(db.ExistsAsset(uuid2), Is.True);
Assert.That(db.ExistsAsset(uuid3), Is.True);
List<AssetMetadata> metadatas = db.FetchAssetMetadataSet(0, 1000);
AssetMetadata metadata = metadatas.Find(x => x.FullID == uuid1);
Assert.That(metadata.Name, Is.EqualTo(a1b.Name));
Assert.That(metadata.Description, Is.EqualTo(a1b.Description));
Assert.That(metadata.Type, Is.EqualTo(a1b.Type));
Assert.That(metadata.Temporary, Is.EqualTo(a1b.Temporary));
Assert.That(metadata.FullID, Is.EqualTo(a1b.FullID));
}
[Test]
public void T020_CheckForWeirdCreatorID()
{
// It is expected that eventually the CreatorID might be an arbitrary string (an URI)
// rather than a valid UUID (?). This test is to make sure that the database layer does not
// attempt to convert CreatorID to GUID, but just passes it both ways as a string.
AssetBase a1 = new AssetBase(uuid1, "asset one", (sbyte)AssetType.Texture, critter1);
AssetBase a2 = new AssetBase(uuid2, "asset two", (sbyte)AssetType.Texture, "This is not a GUID!");
AssetBase a3 = new AssetBase(uuid3, "asset three", (sbyte)AssetType.Texture, "");
a1.Data = asset1;
a2.Data = asset1;
a3.Data = asset1;
db.StoreAsset(a1);
db.StoreAsset(a2);
db.StoreAsset(a3);
AssetBase a1a = db.GetAsset(uuid1);
Assert.That(a1a, Constraints.PropertyCompareConstraint(a1));
AssetBase a2a = db.GetAsset(uuid2);
Assert.That(a2a, Constraints.PropertyCompareConstraint(a2));
AssetBase a3a = db.GetAsset(uuid3);
Assert.That(a3a, Constraints.PropertyCompareConstraint(a3));
}
}
}

View File

@ -0,0 +1,234 @@
using System;
using System.IO;
using System.Collections.Generic;
using log4net.Config;
using NUnit.Framework;
using NUnit.Framework.Constraints;
using OpenMetaverse;
using OpenSim.Framework;
using log4net;
using System.Data;
using System.Data.Common;
using System.Reflection;
namespace OpenSim.Data.Tests
{
/// <summary>This is a base class for testing any Data service for any DBMS.
/// Requires NUnit 2.5 or better (to support the generics).
/// </summary>
/// <typeparam name="TConn"></typeparam>
/// <typeparam name="TService"></typeparam>
public class BasicDataServiceTest<TConn, TService>
where TConn : DbConnection, new()
where TService : class, new()
{
protected string m_connStr;
private TService m_service;
private string m_file;
// TODO: Is this in the right place here?
// Later: apparently it's not, but does it matter here?
// protected static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
protected ILog m_log; // doesn't matter here that it's not static, init to correct type in instance .ctor
public BasicDataServiceTest()
: this("")
{
}
public BasicDataServiceTest(string conn)
{
m_connStr = !String.IsNullOrEmpty(conn) ? conn : DefaultTestConns.Get(typeof(TConn));
m_log = LogManager.GetLogger(this.GetType());
OpenSim.Tests.Common.TestLogging.LogToConsole(); // TODO: Is that right?
}
/// <summary>
/// To be overridden in derived classes. Do whatever init with the m_service, like setting the conn string to it.
/// You'd probably want to to cast the 'service' to a more specific type and store it in a member var.
/// This framework takes care of disposing it, if it's disposable.
/// </summary>
/// <param name="service">The service being tested</param>
protected virtual void InitService(object service)
{
}
[TestFixtureSetUp]
public void Init()
{
// Sorry, some SQLite-specific stuff goes here (not a big deal, as its just some file ops)
if (typeof(TConn).Name.StartsWith("Sqlite"))
{
// SQLite doesn't work on power or z linux
if (Directory.Exists("/proc/ppc64") || Directory.Exists("/proc/dasd"))
Assert.Ignore();
// for SQLite, if no explicit conn string is specified, use a temp file
if (String.IsNullOrEmpty(m_connStr))
{
m_file = Path.GetTempFileName() + ".db";
m_connStr = "URI=file:" + m_file + ",version=3";
}
}
if (String.IsNullOrEmpty(m_connStr))
{
string msg = String.Format("Connection string for {0} is not defined, ignoring tests", typeof(TConn).Name);
m_log.Warn(msg);
Assert.Ignore(msg);
}
// Try the connection, ignore tests if Open() fails
using (TConn conn = new TConn())
{
conn.ConnectionString = m_connStr;
try
{
conn.Open();
conn.Close();
}
catch
{
string msg = String.Format("{0} is unable to connect to the database, ignoring tests", typeof(TConn).Name);
m_log.Warn(msg);
Assert.Ignore(msg);
}
}
// 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
{
m_service = new TService();
InitService(m_service);
}
catch (Exception e)
{
m_log.Error(e.ToString());
Assert.Ignore();
}
}
[TestFixtureTearDown]
public void Cleanup()
{
if (m_service != null)
{
if( m_service is IDisposable)
((IDisposable)m_service).Dispose();
m_service = null;
}
if( !String.IsNullOrEmpty(m_file) && File.Exists(m_file) )
File.Delete(m_file);
}
protected virtual DbConnection Connect()
{
DbConnection cnn = new TConn();
cnn.ConnectionString = m_connStr;
cnn.Open();
return cnn;
}
protected virtual void ExecuteSql(string sql)
{
using (DbConnection dbcon = Connect())
{
using (DbCommand cmd = dbcon.CreateCommand())
{
cmd.CommandText = sql;
cmd.ExecuteNonQuery();
}
}
}
protected delegate bool ProcessRow(IDataReader reader);
protected virtual int ExecQuery(string sql, bool bSingleRow, ProcessRow action)
{
int nRecs = 0;
using (DbConnection dbcon = Connect())
{
using (DbCommand cmd = dbcon.CreateCommand())
{
cmd.CommandText = sql;
CommandBehavior cb = bSingleRow ? CommandBehavior.SingleRow : CommandBehavior.Default;
using (DbDataReader rdr = cmd.ExecuteReader(cb))
{
while (rdr.Read())
{
nRecs++;
if (!action(rdr))
break;
}
}
}
}
return nRecs;
}
/// <summary>Drop tables (listed as parameters). There is no "DROP IF EXISTS" syntax common for all
/// databases, so we just DROP and ignore an exception.
/// </summary>
/// <param name="tables"></param>
protected virtual void DropTables(params string[] tables)
{
foreach (string tbl in tables)
{
try
{
ExecuteSql("DROP TABLE " + tbl + ";");
}catch
{
}
}
}
/// <summary>Clear tables listed as parameters (without dropping them).
/// </summary>
/// <param name="tables"></param>
protected virtual void ResetMigrations(params string[] stores)
{
string lst = "";
foreach (string store in stores)
{
string s = "'" + store + "'";
if (lst == "")
lst = s;
else
lst += ", " + s;
}
string sCond = stores.Length > 1 ? ("in (" + lst + ")") : ("=" + lst);
try
{
ExecuteSql("DELETE FROM migrations where name " + sCond);
}
catch
{
}
}
/// <summary>Clear tables listed as parameters (without dropping them).
/// </summary>
/// <param name="tables"></param>
protected virtual void ClearTables(params string[] tables)
{
foreach (string tbl in tables)
{
try
{
ExecuteSql("DELETE FROM " + tbl + ";");
}
catch
{
}
}
}
}
}

View File

@ -0,0 +1,63 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Reflection;
using System.IO;
using Nini.Config;
namespace OpenSim.Data.Tests
{
/// <summary>This static class looks for TestDataConnections.ini file in the /bin directory to obtain
/// a connection string for testing one of the supported databases.
/// The connections must be in the section [TestConnections] with names matching the connection class
/// name for the specific database, e.g.:
///
/// [TestConnections]
/// MySqlConnection="..."
/// SqlConnection="..."
/// SqliteConnection="..."
///
/// Note that the conn string may also be set explicitly in the [TestCase()] attribute of test classes
/// based on BasicDataServiceTest.cs.
/// </summary>
static class DefaultTestConns
{
private static Dictionary<Type, string> conns = new Dictionary<Type, string>();
public static string Get(Type connType)
{
string sConn;
if (conns.TryGetValue(connType, out sConn))
return sConn;
Assembly asm = Assembly.GetExecutingAssembly();
string sType = connType.Name;
// Note: when running from NUnit, the DLL is located in some temp dir, so how do we get
// to the INI file? Ok, so put it into the resources!
// string iniName = Path.Combine(Path.GetDirectoryName(asm.Location), "TestDataConnections.ini");
string[] allres = asm.GetManifestResourceNames();
string sResFile = Array.Find(allres, s => s.Contains("TestDataConnections.ini"));
if (String.IsNullOrEmpty(sResFile))
throw new Exception(String.Format("Please add resource TestDataConnections.ini, with section [TestConnections] and settings like {0}=\"...\"",
sType));
using (Stream resource = asm.GetManifestResourceStream(sResFile))
{
IConfigSource source = new IniConfigSource(resource);
var cfg = source.Configs["TestConnections"];
sConn = cfg.Get(sType, "");
}
if (!String.IsNullOrEmpty(sConn))
conns[connType] = sConn;
return sConn;
}
}
}

View File

@ -35,13 +35,57 @@ using OpenSim.Region.Framework.Interfaces;
using System.Text;
using log4net;
using System.Reflection;
using System.Data.Common;
#if !NUNIT25
using NUnit.Framework.SyntaxHelpers;
#endif
// 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
#if NUNIT25
[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)")]
#else
[TestFixture(Description = "Estate store tests (SQLite)")]
public class SQLiteEstateTests : EstateTests<SqliteConnection, SQLiteEstateStore>
{
}
[TestFixture(Description = "Estate store tests (MySQL)")]
public class MySqlEstateTests : EstateTests<MySqlConnection, MySQLEstateStore>
{
}
[TestFixture(Description = "Estate store tests (MS SQL Server)")]
public class MSSQLEstateTests : EstateTests<SqlConnection, MSSQLEstateStore>
{
}
#endif
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 +98,25 @@ 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();
ClearDB();
db = (IEstateDataStore)service;
db.Initialise(m_connStr);
}
private void ClearDB()
{
// if a new table is added, it has to be dropped here
DropTables(
"estate_managers",
"estate_groups",
"estate_users",
"estateban",
"estate_settings",
"estate_map"
);
ResetMigrations("EstateStore");
}
#region 0Tests
@ -292,8 +352,7 @@ namespace OpenSim.Data.Tests
// Letting estate store generate rows to database for us
EstateSettings originalSettings = db.LoadEstateSettings(regionId, true);
SetEstateSettings(
originalSettings,
SetEstateSettings(originalSettings,
estateName,
parentEstateID,
billableFactor,
@ -319,30 +378,6 @@ namespace OpenSim.Data.Tests
estateOwner
);
originalSettings.EstateName = estateName;
originalSettings.ParentEstateID = parentEstateID;
originalSettings.BillableFactor = billableFactor;
originalSettings.PricePerMeter = pricePerMeter;
originalSettings.RedirectGridX = redirectGridX;
originalSettings.RedirectGridY = redirectGridY;
originalSettings.UseGlobalTime = useGlobalTime;
originalSettings.FixedSun = fixedSun;
originalSettings.SunPosition = sunPosition;
originalSettings.AllowVoice = allowVoice;
originalSettings.AllowDirectTeleport = allowDirectTeleport;
originalSettings.ResetHomeOnTeleport = resetHomeOnTeleport;
originalSettings.DenyAnonymous = denyAnonymous;
originalSettings.DenyIdentified = denyIdentified;
originalSettings.DenyTransacted = denyTransacted;
originalSettings.DenyMinors = denyMinors;
originalSettings.AbuseEmailToEstateOwner = abuseEmailToEstateOwner;
originalSettings.BlockDwell = blockDwell;
originalSettings.EstateSkipScripts = estateSkipScripts;
originalSettings.TaxFree = taxFree;
originalSettings.PublicAccess = publicAccess;
originalSettings.AbuseEmail = abuseEmail;
originalSettings.EstateOwner = estateOwner;
// Saving settings.
db.StoreEstateSettings(originalSettings);
@ -350,8 +385,7 @@ namespace OpenSim.Data.Tests
EstateSettings loadedSettings = db.LoadEstateSettings(regionId, true);
// Checking that loaded values are correct.
ValidateEstateSettings(
loadedSettings,
ValidateEstateSettings(loadedSettings,
estateName,
parentEstateID,
billableFactor,

View File

@ -25,6 +25,8 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
// #define NUNIT25
using System;
using log4net.Config;
using NUnit.Framework;
@ -33,62 +35,95 @@ using OpenMetaverse;
using OpenSim.Framework;
using log4net;
using System.Reflection;
using System.Data.Common;
#if !NUNIT25
using NUnit.Framework.SyntaxHelpers;
#endif
// 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
#if NUNIT25
[TestFixture(typeof(SqliteConnection), typeof(SQLiteInventoryStore), Description = "Inventory store tests (SQLite)")]
[TestFixture(typeof(MySqlConnection), typeof(MySQLInventoryData), Description = "Inventory store tests (MySQL)")]
[TestFixture(typeof(SqlConnection), typeof(MSSQLInventoryData), Description = "Inventory store tests (MS SQL Server)")]
#else
[TestFixture(Description = "Inventory store tests (SQLite)")]
public class SQLiteInventoryTests : InventoryTests<SqliteConnection, SQLiteInventoryStore>
{
}
[TestFixture(Description = "Inventory store tests (MySQL)")]
public class MySqlInventoryTests : InventoryTests<MySqlConnection, MySQLInventoryData>
{
}
[TestFixture(Description = "Inventory store tests (MS SQL Server)")]
public class MSSQLInventoryTests : InventoryTests<SqlConnection, MSSQLInventoryData>
{
}
#endif
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";
}
public InventoryTests() : this("") { }
protected override void InitService(object service)
{
ClearDB();
db = (IInventoryDataPlugin)service;
db.Initialise(m_connStr);
}
private void ClearDB()
{
DropTables("inventoryitems", "inventoryfolders");
ResetMigrations("InventoryStore");
}
[Test]
@ -159,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))");

View File

@ -38,59 +38,112 @@ using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes;
using log4net;
using System.Reflection;
using System.Data.Common;
#if !NUNIT25
using NUnit.Framework.SyntaxHelpers;
#endif
// 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
#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<SqliteConnection, SQLiteRegionData>
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
}
[TestFixture(Description = "Region store tests (MySQL)")]
public class MySqlRegionTests : RegionTests<MySqlConnection, MySQLDataStore>
{
}
[TestFixture(Description = "Region store tests (MS SQL Server)")]
public class MSSQLRegionTests : RegionTests<SqlConnection, MSSQLRegionDataStore>
{
}
#endif
public class RegionTests<TConn, TRegStore> : BasicDataServiceTest<TConn, TRegStore>
where TConn : DbConnection, new()
where TRegStore : class, IRegionDataStore, new()
{
bool m_rebuildDB;
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;
public RegionTests(string conn, bool rebuild)
: base(conn)
{
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;
m_rebuildDB = rebuild;
}
public RegionTests() : this("", true) { }
public RegionTests(string conn) : this(conn, true) {}
public RegionTests(bool rebuild): this("", rebuild) {}
protected override void InitService(object service)
{
ClearDB();
db = (IRegionDataStore)service;
db.Initialise(m_connStr);
}
private void ClearDB()
{
string[] reg_tables = new string[] {
"prims", "primshapes", "primitems", "terrain", "land", "landaccesslist", "regionban", "regionsettings"
};
if (m_rebuildDB)
{
DropTables(reg_tables);
ResetMigrations("RegionStore");
}else
ClearTables(reg_tables);
}
// Test Plan
// Prims
// - empty test - 001
@ -580,68 +633,88 @@ namespace OpenSim.Data.Tests
.IgnoreProperty(x=>x.PassCollision)
.IgnoreProperty(x=>x.RootPart));
}
private SceneObjectGroup GetMySOG(string name)
{
SceneObjectGroup sog = FindSOG(name, region1);
if (sog == null)
{
sog = NewSOG(name, prim1, region1);
db.StoreObject(sog, region1);
}
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()
{
SceneObjectGroup sog = FindSOG("object1", region1);
SceneObjectGroup sog = GetMySOG("object1");
TaskInventoryItem t = sog.GetInventoryItem(sog.RootPart.LocalId, item1);
Assert.That(t, Is.Null);
}
[Test]
public void T021_PrimInventoryStore()
// TODO: Is there any point to call StorePrimInventory on a list, rather than on the prim itself?
private void StoreInventory(SceneObjectGroup sog)
{
SceneObjectGroup sog = FindSOG("object1", region1);
List<TaskInventoryItem> list = new List<TaskInventoryItem>();
// TODO: seriously??? this is the way we need to loop to get this?
foreach (UUID uuid in sog.RootPart.Inventory.GetInventoryList())
{
list.Add(sog.GetInventoryItem(sog.RootPart.LocalId, uuid));
}
db.StorePrimInventory(sog.RootPart.UUID, list);
}
[Test]
public void T021_PrimInventoryBasic()
{
SceneObjectGroup sog = GetMySOG("object1");
InventoryItemBase i = NewItem(item1, zero, zero, itemname1, zero);
Assert.That(sog.AddInventoryItem(null, sog.RootPart.LocalId, i, zero), Is.True);
TaskInventoryItem t = sog.GetInventoryItem(sog.RootPart.LocalId, item1);
Assert.That(t.Name, Is.EqualTo(itemname1), "Assert.That(t.Name, Is.EqualTo(itemname1))");
// TODO: seriously??? this is the way we need to loop to get this?
StoreInventory(sog);
List<TaskInventoryItem> list = new List<TaskInventoryItem>();
foreach (UUID uuid in sog.RootPart.Inventory.GetInventoryList())
{
list.Add(sog.GetInventoryItem(sog.RootPart.LocalId, uuid));
}
db.StorePrimInventory(prim1, list);
}
SceneObjectGroup sog1 = FindSOG("object1", region1);
Assert.That(sog1, Is.Not.Null);
[Test]
public void T022_PrimInventoryRetrieve()
{
SceneObjectGroup sog = FindSOG("object1", region1);
TaskInventoryItem t = sog.GetInventoryItem(sog.RootPart.LocalId, item1);
TaskInventoryItem t1 = sog1.GetInventoryItem(sog1.RootPart.LocalId, item1);
Assert.That(t1, Is.Not.Null);
Assert.That(t1.Name, Is.EqualTo(itemname1), "Assert.That(t.Name, Is.EqualTo(itemname1))");
Assert.That(t.Name, Is.EqualTo(itemname1), "Assert.That(t.Name, Is.EqualTo(itemname1))");
}
[Test]
public void T023_PrimInventoryUpdate()
{
SceneObjectGroup sog = FindSOG("object1", region1);
TaskInventoryItem t = sog.GetInventoryItem(sog.RootPart.LocalId, item1);
t.Name = "My New Name";
sog.UpdateInventoryItem(t);
// Updating inventory
t1.Name = "My New Name";
sog1.UpdateInventoryItem(t1);
Assert.That(t.Name, Is.EqualTo("My New Name"), "Assert.That(t.Name, Is.EqualTo(\"My New Name\"))");
StoreInventory(sog1);
}
SceneObjectGroup sog2 = FindSOG("object1", region1);
TaskInventoryItem t2 = sog2.GetInventoryItem(sog2.RootPart.LocalId, item1);
Assert.That(t2.Name, Is.EqualTo("My New Name"), "Assert.That(t.Name, Is.EqualTo(\"My New Name\"))");
// Removing inventory
[Test]
public void T024_PrimInventoryRemove()
{
List<TaskInventoryItem> list = new List<TaskInventoryItem>();
db.StorePrimInventory(prim1, list);
SceneObjectGroup sog = FindSOG("object1", region1);
TaskInventoryItem t = sog.GetInventoryItem(sog.RootPart.LocalId, item1);
sog = FindSOG("object1", region1);
t = sog.GetInventoryItem(sog.RootPart.LocalId, item1);
Assert.That(t, Is.Null);
}
[Test]
public void T025_PrimInventoryPersistency()
@ -685,7 +758,7 @@ namespace OpenSim.Data.Tests
int creationd = random.Next();
i.CreationDate = creationd;
SceneObjectGroup sog = FindSOG("object1", region1);
SceneObjectGroup sog = GetMySOG("object1");
Assert.That(sog.AddInventoryItem(null, sog.RootPart.LocalId, i, zero), Is.True);
TaskInventoryItem t = sog.GetInventoryItem(sog.RootPart.LocalId, id);

View File

@ -0,0 +1,24 @@
; The default connections to the test databases. Used by all data tests based on BasicDataServiceTest.cs.
; This is read by code in DefaultTestConns.cs.
; NOTE that this INI file is currently loaded as a embedded RESOURCE, which is weird and has a
; disadvantage of having to rebuild the Tests whenever the conn strings are changed.
; The only reason is that I couldn't figure out a reliable way to put this INI into the correct
; dir at runtime. If somebody can do it, that would be cool.
; I'm using a local MSDE server for testing. Obviously, you'll have to modify
; the conn string to whatever MS SQL server is available to you.
; If any of the conn strings is commented out, emty or not valid on your system,
; the relevant tests will be ignored, rather than fail.
; As to SQLite, if the conn string here is empty, it will work anyway using a temporary
; file for the DB. If you want the resulting DB to persist (e.g. for performance testing,
; when filling up the tables can take a long time), explicitly specify a conn string like this:
; SqliteConnection="URI=file:<path_to_your_file>,version=3"
[TestConnections]
MySqlConnection="Server=localhost;Port=3306;Database=opensim-nunit;User ID=opensim-nunit;Password=opensim-nunit;"
SqlConnection="Server=.\SQL2008;Database=opensim-nunit;Trusted_Connection=True;"
SqliteConnection=""

View File

@ -2825,83 +2825,20 @@
<Reference name="log4net.dll"/>
<Reference name="Mono.Addins.dll" />
<Reference name="nunit.framework.dll" />
<Files>
<Match pattern="*.cs" recurse="true"/>
</Files>
</Project>
<Reference name="Nini.dll" />
<Project frameworkVersion="v3_5" name="OpenSim.Data.MySQL.Tests" path="OpenSim/Data/MySQL/Tests" type="Library">
<Configuration name="Debug">
<Options>
<OutputPath>../../../../bin/</OutputPath>
</Options>
</Configuration>
<Configuration name="Release">
<Options>
<OutputPath>../../../../bin/</OutputPath>
</Options>
</Configuration>
<ReferencePath>../../../../bin/</ReferencePath>
<Reference name="System"/>
<Reference name="System.Xml"/>
<Reference name="System.Data"/>
<Reference name="System.Drawing"/>
<Reference name="OpenSim.Framework"/>
<Reference name="OpenSim.Data"/>
<Reference name="OpenMetaverseTypes.dll"/>
<Reference name="OpenMetaverse.dll"/>
<Reference name="MySql.Data.dll"/>
<Reference name="OpenSim.Tests.Common"/>
<Reference name="OpenSim.Data.Tests"/>
<Reference name="OpenSim.Data.MySQL"/>
<Reference name="OpenSim.Framework.Console"/>
<Reference name="OpenSim.Region.Framework"/>
<Reference name="log4net.dll"/>
<Reference name="nunit.framework.dll" />
<Reference name="Mono.Addins.dll" />
<Reference name="OpenSim.Data.MSSQL"/>
<Reference name="OpenSim.Data.SQLite"/>
<Reference name="MySql.Data.dll"/>
<Reference name="Mono.Data.Sqlite.dll"/>
<Files>
<Match pattern="*.cs" recurse="true"/>
<Match path="Resources" pattern="*.ini" buildAction="EmbeddedResource"/>
</Files>
</Project>
<Project frameworkVersion="v3_5" name="OpenSim.Data.SQLite.Tests" path="OpenSim/Data/SQLite/Tests" type="Library">
<Configuration name="Debug">
<Options>
<OutputPath>../../../../bin/</OutputPath>
</Options>
</Configuration>
<Configuration name="Release">
<Options>
<OutputPath>../../../../bin/</OutputPath>
</Options>
</Configuration>
<ReferencePath>../../../../bin/</ReferencePath>
<Reference name="System"/>
<Reference name="System.Xml"/>
<Reference name="System.Data"/>
<Reference name="System.Data.SQLite.dll"/>
<Reference name="OpenSim.Data"/>
<Reference name="OpenSim.Data.Tests"/>
<Reference name="OpenSim.Tests.Common"/>
<Reference name="OpenSim.Data.SQLite" />
<Reference name="System.Drawing"/>
<Reference name="OpenSim.Framework"/>
<Reference name="OpenSim.Framework.Console"/>
<Reference name="OpenSim.Region.Framework"/>
<Reference name="OpenMetaverseTypes.dll"/>
<Reference name="OpenMetaverse.dll"/>
<Reference name="Mono.Data.SqliteClient"/>
<Reference name="Mono.Addins.dll" />
<Reference name="log4net.dll"/>
<Reference name="nunit.framework.dll" />
<Files>
<Match pattern="*.cs" recurse="true"/>
</Files>
</Project>
<Project frameworkVersion="v3_5" name="OpenSim.Framework.Tests" path="OpenSim/Framework/Tests" type="Library">
<Configuration name="Debug">