From c7a08752c0d49a470534fcebcd13710f517b3d00 Mon Sep 17 00:00:00 2001 From: Sean Dague Date: Mon, 16 Feb 2009 19:23:53 +0000 Subject: line ending fixes and set native eol property --- OpenSim/Data/NHibernate/EstateRegionLink.cs | 98 +++---- OpenSim/Data/NHibernate/NHibernateEstateData.cs | 322 ++++++++++----------- .../NHibernate/Resources/EstateRegionLink.hbm.xml | 24 +- .../NHibernate/Resources/EstateSettings.hbm.xml | 78 ++--- .../Resources/MigrationSyntaxDifferences.txt | 28 +- .../Resources/MsSql2005Dialect/001_EstateStore.sql | 80 ++--- .../Resources/MySQLDialect/001_EstateStore.sql | 80 ++--- .../PostgreSQLDialect/001_EstateStore.sql | 80 ++--- .../Resources/SQLiteDialect/001_EstateStore.sql | 80 ++--- .../NHibernate/Tests/NHibernateMsSqlEstateTest.cs | 154 +++++----- .../NHibernate/Tests/NHibernateMySqlEstateTest.cs | 152 +++++----- .../Tests/NHibernatePostgreSQLEstateTest.cs | 152 +++++----- .../NHibernate/Tests/NHibernateSQLiteEstateTest.cs | 156 +++++----- OpenSim/Data/Tests/DataTestUtil.cs | 124 ++++---- 14 files changed, 804 insertions(+), 804 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Data/NHibernate/EstateRegionLink.cs b/OpenSim/Data/NHibernate/EstateRegionLink.cs index 95739c5..e666c3a 100644 --- a/OpenSim/Data/NHibernate/EstateRegionLink.cs +++ b/OpenSim/Data/NHibernate/EstateRegionLink.cs @@ -1,49 +1,49 @@ -using System; -using System.Collections.Generic; -using System.Text; -using OpenMetaverse; - -namespace OpenSim.Data.NHibernate -{ - public class EstateRegionLink - { - private UUID estateRegionLinkID; - public UUID EstateRegionLinkID - { - get - { - return estateRegionLinkID; - } - set - { - estateRegionLinkID = value; - } - } - - private uint estateID; - public uint EstateID - { - get - { - return estateID; - } - set - { - estateID = value; - } - } - - private UUID regionID; - public UUID RegionID - { - get - { - return regionID; - } - set - { - regionID = value; - } - } - } -} +using System; +using System.Collections.Generic; +using System.Text; +using OpenMetaverse; + +namespace OpenSim.Data.NHibernate +{ + public class EstateRegionLink + { + private UUID estateRegionLinkID; + public UUID EstateRegionLinkID + { + get + { + return estateRegionLinkID; + } + set + { + estateRegionLinkID = value; + } + } + + private uint estateID; + public uint EstateID + { + get + { + return estateID; + } + set + { + estateID = value; + } + } + + private UUID regionID; + public UUID RegionID + { + get + { + return regionID; + } + set + { + regionID = value; + } + } + } +} diff --git a/OpenSim/Data/NHibernate/NHibernateEstateData.cs b/OpenSim/Data/NHibernate/NHibernateEstateData.cs index 59896dd..3d74135 100644 --- a/OpenSim/Data/NHibernate/NHibernateEstateData.cs +++ b/OpenSim/Data/NHibernate/NHibernateEstateData.cs @@ -1,161 +1,161 @@ -/* - * 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 OpenSim 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.Reflection; -using log4net; -using OpenMetaverse; -using OpenSim.Framework; -using OpenSim.Region.Framework.Interfaces; -using NHibernate; -using NHibernate.Criterion; -using System.Collections; -using System; - -namespace OpenSim.Data.NHibernate -{ - /// - /// A User storage interface for the DB4o database system - /// - public class NHibernateEstateData : IEstateDataStore - { - - #region Fields - - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - - public NHibernateManager manager; - - public string Name - { - get { return "NHibernateEstateData"; } - } - - public string Version - { - get { return "0.1"; } - } - - #endregion - - #region Startup and shutdown. - - public void Initialise() - { - m_log.Info("[NHIBERNATE]: " + Name + " cannot be default-initialized!"); - throw new PluginNotInitialisedException(Name); - } - - public void Initialise(string connect) - { - - m_log.InfoFormat("[NHIBERNATE] Initializing " + Name + "."); - manager = new NHibernateManager(connect, "EstateStore"); - } - - public void Dispose() { } - - #endregion - - #region IEstateDataStore Members - - public EstateSettings LoadEstateSettings(UUID regionID) - { - EstateRegionLink link = LoadEstateRegionLink(regionID); - - // Ensure that estate settings exist for the link - if (link != null) - { - if (manager.Load(typeof(EstateSettings), link.EstateID) == null) - { - // Delete broken link - manager.Delete(link); - link = null; - } - } - - // If estate link does not exist create estate settings and link it to region. - if (link == null) - { - EstateSettings estateSettings = new EstateSettings(); - //estateSettings.EstateOwner = UUID.Random(); - //estateSettings.BlockDwell = false; - object identifier = manager.Insert(estateSettings); - - if (identifier == null) - { - // Saving failed. Error is logged in the manager. - return null; - } - - uint estateID = (uint)identifier; - link = new EstateRegionLink(); - link.EstateRegionLinkID = UUID.Random(); - link.RegionID = regionID; - link.EstateID = estateID; - manager.Insert(link); - } - - // Load estate settings according to the existing or created link. - return (EstateSettings)manager.Load(typeof(EstateSettings), link.EstateID); - } - - public void StoreEstateSettings(EstateSettings estateSettings) - { - // Estates are always updated when stored. - // Insert is always done via. load method as with the current API - // this is explicitly the only way to create region link. - manager.Update(estateSettings); - } - - #endregion - - #region Private Utility Methods - private EstateRegionLink LoadEstateRegionLink(UUID regionID) - { - ICriteria criteria = manager.GetSession().CreateCriteria(typeof(EstateRegionLink)); - criteria.Add(Expression.Eq("RegionID", regionID)); - IList links = criteria.List(); - - // Fail fast if more than one estate links exist - if (links.Count > 1) - { - m_log.Error("[NHIBERNATE]: Region had more than one estate linked: " + regionID); - throw new Exception("[NHIBERNATE]: Region had more than one estate linked: " + regionID); - } - - if (links.Count == 1) - { - return (EstateRegionLink)links[0]; - } - else - { - return null; - } - } - #endregion - } -} +/* + * 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 OpenSim 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.Reflection; +using log4net; +using OpenMetaverse; +using OpenSim.Framework; +using OpenSim.Region.Framework.Interfaces; +using NHibernate; +using NHibernate.Criterion; +using System.Collections; +using System; + +namespace OpenSim.Data.NHibernate +{ + /// + /// A User storage interface for the DB4o database system + /// + public class NHibernateEstateData : IEstateDataStore + { + + #region Fields + + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + + public NHibernateManager manager; + + public string Name + { + get { return "NHibernateEstateData"; } + } + + public string Version + { + get { return "0.1"; } + } + + #endregion + + #region Startup and shutdown. + + public void Initialise() + { + m_log.Info("[NHIBERNATE]: " + Name + " cannot be default-initialized!"); + throw new PluginNotInitialisedException(Name); + } + + public void Initialise(string connect) + { + + m_log.InfoFormat("[NHIBERNATE] Initializing " + Name + "."); + manager = new NHibernateManager(connect, "EstateStore"); + } + + public void Dispose() { } + + #endregion + + #region IEstateDataStore Members + + public EstateSettings LoadEstateSettings(UUID regionID) + { + EstateRegionLink link = LoadEstateRegionLink(regionID); + + // Ensure that estate settings exist for the link + if (link != null) + { + if (manager.Load(typeof(EstateSettings), link.EstateID) == null) + { + // Delete broken link + manager.Delete(link); + link = null; + } + } + + // If estate link does not exist create estate settings and link it to region. + if (link == null) + { + EstateSettings estateSettings = new EstateSettings(); + //estateSettings.EstateOwner = UUID.Random(); + //estateSettings.BlockDwell = false; + object identifier = manager.Insert(estateSettings); + + if (identifier == null) + { + // Saving failed. Error is logged in the manager. + return null; + } + + uint estateID = (uint)identifier; + link = new EstateRegionLink(); + link.EstateRegionLinkID = UUID.Random(); + link.RegionID = regionID; + link.EstateID = estateID; + manager.Insert(link); + } + + // Load estate settings according to the existing or created link. + return (EstateSettings)manager.Load(typeof(EstateSettings), link.EstateID); + } + + public void StoreEstateSettings(EstateSettings estateSettings) + { + // Estates are always updated when stored. + // Insert is always done via. load method as with the current API + // this is explicitly the only way to create region link. + manager.Update(estateSettings); + } + + #endregion + + #region Private Utility Methods + private EstateRegionLink LoadEstateRegionLink(UUID regionID) + { + ICriteria criteria = manager.GetSession().CreateCriteria(typeof(EstateRegionLink)); + criteria.Add(Expression.Eq("RegionID", regionID)); + IList links = criteria.List(); + + // Fail fast if more than one estate links exist + if (links.Count > 1) + { + m_log.Error("[NHIBERNATE]: Region had more than one estate linked: " + regionID); + throw new Exception("[NHIBERNATE]: Region had more than one estate linked: " + regionID); + } + + if (links.Count == 1) + { + return (EstateRegionLink)links[0]; + } + else + { + return null; + } + } + #endregion + } +} diff --git a/OpenSim/Data/NHibernate/Resources/EstateRegionLink.hbm.xml b/OpenSim/Data/NHibernate/Resources/EstateRegionLink.hbm.xml index 91bddee..fd66910 100644 --- a/OpenSim/Data/NHibernate/Resources/EstateRegionLink.hbm.xml +++ b/OpenSim/Data/NHibernate/Resources/EstateRegionLink.hbm.xml @@ -1,12 +1,12 @@ - - - - - - - - - - - - + + + + + + + + + + + + diff --git a/OpenSim/Data/NHibernate/Resources/EstateSettings.hbm.xml b/OpenSim/Data/NHibernate/Resources/EstateSettings.hbm.xml index 1ff0f10..2dc3949 100644 --- a/OpenSim/Data/NHibernate/Resources/EstateSettings.hbm.xml +++ b/OpenSim/Data/NHibernate/Resources/EstateSettings.hbm.xml @@ -1,39 +1,39 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/OpenSim/Data/NHibernate/Resources/MigrationSyntaxDifferences.txt b/OpenSim/Data/NHibernate/Resources/MigrationSyntaxDifferences.txt index f3d86df..1c89516 100644 --- a/OpenSim/Data/NHibernate/Resources/MigrationSyntaxDifferences.txt +++ b/OpenSim/Data/NHibernate/Resources/MigrationSyntaxDifferences.txt @@ -1,14 +1,14 @@ -?This file describes the differences in schema creation and migration scripts. - -MySQL is used as reference script against which differences are listed. - -Generally MySQL create table options should be removed for other databases. - -_PostgreSQL_ -* DOUBLE->DOUBLE PRECISION -* BIT->BOOLEAN - -_MsSql_ -* VARCHAR->NVARCHAR -* Remove DEFAULT-keywords -* DOUBLE->REAL +?This file describes the differences in schema creation and migration scripts. + +MySQL is used as reference script against which differences are listed. + +Generally MySQL create table options should be removed for other databases. + +_PostgreSQL_ +* DOUBLE->DOUBLE PRECISION +* BIT->BOOLEAN + +_MsSql_ +* VARCHAR->NVARCHAR +* Remove DEFAULT-keywords +* DOUBLE->REAL diff --git a/OpenSim/Data/NHibernate/Resources/MsSql2005Dialect/001_EstateStore.sql b/OpenSim/Data/NHibernate/Resources/MsSql2005Dialect/001_EstateStore.sql index 0e95963..4ca51be 100644 --- a/OpenSim/Data/NHibernate/Resources/MsSql2005Dialect/001_EstateStore.sql +++ b/OpenSim/Data/NHibernate/Resources/MsSql2005Dialect/001_EstateStore.sql @@ -1,40 +1,40 @@ -CREATE TABLE EstateSettings ( - EstateID INT NOT NULL, - ParentEstateID INT NULL, - EstateOwnerID NVARCHAR(36) NULL, - Name NVARCHAR(64) NULL, - RedirectGridX INT NULL, - RedirectGridY INT NULL, - BillableFactor REAL NULL, - PricePerMeter INT NULL, - SunPosition FLOAT NULL, - - UseGlobalTime BIT NULL, - FixedSun BIT NULL, - AllowVoice BIT NULL, - AllowDirectTeleport BIT NULL, - ResetHomeOnTeleport BIT NULL, - PublicAccess BIT NULL, - DenyAnonymous BIT NULL, - DenyIdentified BIT NULL, - DenyTransacted BIT NULL, - DenyMinors BIT NULL, - BlockDwell BIT NULL, - EstateSkipScripts BIT NULL, - TaxFree BIT NULL, - AbuseEmailToEstateOwner BIT NULL, - - AbuseEmail NVARCHAR(255) NULL, - - PRIMARY KEY (EstateID) -); - -CREATE TABLE EstateRegionLink ( - EstateRegionLinkID NVARCHAR(36) NOT NULL, - EstateID INT NULL, - RegionID NVARCHAR(36) NULL, - PRIMARY KEY (EstateRegionLinkID) -); - -CREATE INDEX EstateRegionLinkEstateIDIndex ON EstateRegionLink (EstateID); -CREATE INDEX EstateRegionLinkERegionIDIndex ON EstateRegionLink (RegionID); +CREATE TABLE EstateSettings ( + EstateID INT NOT NULL, + ParentEstateID INT NULL, + EstateOwnerID NVARCHAR(36) NULL, + Name NVARCHAR(64) NULL, + RedirectGridX INT NULL, + RedirectGridY INT NULL, + BillableFactor REAL NULL, + PricePerMeter INT NULL, + SunPosition FLOAT NULL, + + UseGlobalTime BIT NULL, + FixedSun BIT NULL, + AllowVoice BIT NULL, + AllowDirectTeleport BIT NULL, + ResetHomeOnTeleport BIT NULL, + PublicAccess BIT NULL, + DenyAnonymous BIT NULL, + DenyIdentified BIT NULL, + DenyTransacted BIT NULL, + DenyMinors BIT NULL, + BlockDwell BIT NULL, + EstateSkipScripts BIT NULL, + TaxFree BIT NULL, + AbuseEmailToEstateOwner BIT NULL, + + AbuseEmail NVARCHAR(255) NULL, + + PRIMARY KEY (EstateID) +); + +CREATE TABLE EstateRegionLink ( + EstateRegionLinkID NVARCHAR(36) NOT NULL, + EstateID INT NULL, + RegionID NVARCHAR(36) NULL, + PRIMARY KEY (EstateRegionLinkID) +); + +CREATE INDEX EstateRegionLinkEstateIDIndex ON EstateRegionLink (EstateID); +CREATE INDEX EstateRegionLinkERegionIDIndex ON EstateRegionLink (RegionID); diff --git a/OpenSim/Data/NHibernate/Resources/MySQLDialect/001_EstateStore.sql b/OpenSim/Data/NHibernate/Resources/MySQLDialect/001_EstateStore.sql index a791bc6..2114186 100644 --- a/OpenSim/Data/NHibernate/Resources/MySQLDialect/001_EstateStore.sql +++ b/OpenSim/Data/NHibernate/Resources/MySQLDialect/001_EstateStore.sql @@ -1,40 +1,40 @@ -CREATE TABLE EstateSettings ( - EstateID INT NOT NULL, - ParentEstateID INT DEFAULT NULL, - EstateOwnerID VARCHAR(36) DEFAULT NULL, - Name VARCHAR(64) DEFAULT NULL, - RedirectGridX INT DEFAULT NULL, - RedirectGridY INT DEFAULT NULL, - BillableFactor DOUBLE DEFAULT NULL, - PricePerMeter INT DEFAULT NULL, - SunPosition DOUBLE DEFAULT NULL, - - UseGlobalTime BIT DEFAULT NULL, - FixedSun BIT DEFAULT NULL, - AllowVoice BIT DEFAULT NULL, - AllowDirectTeleport BIT DEFAULT NULL, - ResetHomeOnTeleport BIT DEFAULT NULL, - PublicAccess BIT DEFAULT NULL, - DenyAnonymous BIT DEFAULT NULL, - DenyIdentified BIT DEFAULT NULL, - DenyTransacted BIT DEFAULT NULL, - DenyMinors BIT DEFAULT NULL, - BlockDwell BIT DEFAULT NULL, - EstateSkipScripts BIT DEFAULT NULL, - TaxFree BIT DEFAULT NULL, - AbuseEmailToEstateOwner BIT DEFAULT NULL, - - AbuseEmail VARCHAR(255) DEFAULT NULL, - - PRIMARY KEY (EstateID) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Rev. 1'; - -CREATE TABLE EstateRegionLink ( - EstateRegionLinkID VARCHAR(36) NOT NULL, - EstateID INT DEFAULT NULL, - RegionID VARCHAR(36) DEFAULT NULL, - PRIMARY KEY (EstateRegionLinkID) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Rev. 1'; - -CREATE INDEX EstateRegionLinkEstateIDIndex ON EstateRegionLink (EstateID); -CREATE INDEX EstateRegionLinkERegionIDIndex ON EstateRegionLink (RegionID); +CREATE TABLE EstateSettings ( + EstateID INT NOT NULL, + ParentEstateID INT DEFAULT NULL, + EstateOwnerID VARCHAR(36) DEFAULT NULL, + Name VARCHAR(64) DEFAULT NULL, + RedirectGridX INT DEFAULT NULL, + RedirectGridY INT DEFAULT NULL, + BillableFactor DOUBLE DEFAULT NULL, + PricePerMeter INT DEFAULT NULL, + SunPosition DOUBLE DEFAULT NULL, + + UseGlobalTime BIT DEFAULT NULL, + FixedSun BIT DEFAULT NULL, + AllowVoice BIT DEFAULT NULL, + AllowDirectTeleport BIT DEFAULT NULL, + ResetHomeOnTeleport BIT DEFAULT NULL, + PublicAccess BIT DEFAULT NULL, + DenyAnonymous BIT DEFAULT NULL, + DenyIdentified BIT DEFAULT NULL, + DenyTransacted BIT DEFAULT NULL, + DenyMinors BIT DEFAULT NULL, + BlockDwell BIT DEFAULT NULL, + EstateSkipScripts BIT DEFAULT NULL, + TaxFree BIT DEFAULT NULL, + AbuseEmailToEstateOwner BIT DEFAULT NULL, + + AbuseEmail VARCHAR(255) DEFAULT NULL, + + PRIMARY KEY (EstateID) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Rev. 1'; + +CREATE TABLE EstateRegionLink ( + EstateRegionLinkID VARCHAR(36) NOT NULL, + EstateID INT DEFAULT NULL, + RegionID VARCHAR(36) DEFAULT NULL, + PRIMARY KEY (EstateRegionLinkID) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Rev. 1'; + +CREATE INDEX EstateRegionLinkEstateIDIndex ON EstateRegionLink (EstateID); +CREATE INDEX EstateRegionLinkERegionIDIndex ON EstateRegionLink (RegionID); diff --git a/OpenSim/Data/NHibernate/Resources/PostgreSQLDialect/001_EstateStore.sql b/OpenSim/Data/NHibernate/Resources/PostgreSQLDialect/001_EstateStore.sql index 421a0c4..e43fd86 100644 --- a/OpenSim/Data/NHibernate/Resources/PostgreSQLDialect/001_EstateStore.sql +++ b/OpenSim/Data/NHibernate/Resources/PostgreSQLDialect/001_EstateStore.sql @@ -1,40 +1,40 @@ -CREATE TABLE EstateSettings ( - EstateID INT NOT NULL, - ParentEstateID INT DEFAULT NULL, - EstateOwnerID VARCHAR(36) DEFAULT NULL, - Name VARCHAR(64) DEFAULT NULL, - RedirectGridX INT DEFAULT NULL, - RedirectGridY INT DEFAULT NULL, - BillableFactor DOUBLE PRECISION DEFAULT NULL, - PricePerMeter INT DEFAULT NULL, - SunPosition DOUBLE PRECISION DEFAULT NULL, - - UseGlobalTime BOOLEAN DEFAULT NULL, - FixedSun BOOLEAN DEFAULT NULL, - AllowVoice BOOLEAN DEFAULT NULL, - AllowDirectTeleport BOOLEAN DEFAULT NULL, - ResetHomeOnTeleport BOOLEAN DEFAULT NULL, - PublicAccess BOOLEAN DEFAULT NULL, - DenyAnonymous BOOLEAN DEFAULT NULL, - DenyIdentified BOOLEAN DEFAULT NULL, - DenyTransacted BOOLEAN DEFAULT NULL, - DenyMinors BOOLEAN DEFAULT NULL, - BlockDwell BOOLEAN DEFAULT NULL, - EstateSkipScripts BOOLEAN DEFAULT NULL, - TaxFree BOOLEAN DEFAULT NULL, - AbuseEmailToEstateOwner BOOLEAN DEFAULT NULL, - - AbuseEmail VARCHAR(255) DEFAULT NULL, - - PRIMARY KEY (EstateID) -); - -CREATE TABLE EstateRegionLink ( - EstateRegionLinkID VARCHAR(36) NOT NULL, - EstateID INT DEFAULT NULL, - RegionID VARCHAR(36) DEFAULT NULL, - PRIMARY KEY (EstateRegionLinkID) -); - -CREATE INDEX EstateRegionLinkEstateIDIndex ON EstateRegionLink (EstateID); -CREATE INDEX EstateRegionLinkERegionIDIndex ON EstateRegionLink (RegionID); +CREATE TABLE EstateSettings ( + EstateID INT NOT NULL, + ParentEstateID INT DEFAULT NULL, + EstateOwnerID VARCHAR(36) DEFAULT NULL, + Name VARCHAR(64) DEFAULT NULL, + RedirectGridX INT DEFAULT NULL, + RedirectGridY INT DEFAULT NULL, + BillableFactor DOUBLE PRECISION DEFAULT NULL, + PricePerMeter INT DEFAULT NULL, + SunPosition DOUBLE PRECISION DEFAULT NULL, + + UseGlobalTime BOOLEAN DEFAULT NULL, + FixedSun BOOLEAN DEFAULT NULL, + AllowVoice BOOLEAN DEFAULT NULL, + AllowDirectTeleport BOOLEAN DEFAULT NULL, + ResetHomeOnTeleport BOOLEAN DEFAULT NULL, + PublicAccess BOOLEAN DEFAULT NULL, + DenyAnonymous BOOLEAN DEFAULT NULL, + DenyIdentified BOOLEAN DEFAULT NULL, + DenyTransacted BOOLEAN DEFAULT NULL, + DenyMinors BOOLEAN DEFAULT NULL, + BlockDwell BOOLEAN DEFAULT NULL, + EstateSkipScripts BOOLEAN DEFAULT NULL, + TaxFree BOOLEAN DEFAULT NULL, + AbuseEmailToEstateOwner BOOLEAN DEFAULT NULL, + + AbuseEmail VARCHAR(255) DEFAULT NULL, + + PRIMARY KEY (EstateID) +); + +CREATE TABLE EstateRegionLink ( + EstateRegionLinkID VARCHAR(36) NOT NULL, + EstateID INT DEFAULT NULL, + RegionID VARCHAR(36) DEFAULT NULL, + PRIMARY KEY (EstateRegionLinkID) +); + +CREATE INDEX EstateRegionLinkEstateIDIndex ON EstateRegionLink (EstateID); +CREATE INDEX EstateRegionLinkERegionIDIndex ON EstateRegionLink (RegionID); diff --git a/OpenSim/Data/NHibernate/Resources/SQLiteDialect/001_EstateStore.sql b/OpenSim/Data/NHibernate/Resources/SQLiteDialect/001_EstateStore.sql index b16ae82..b540bc6 100644 --- a/OpenSim/Data/NHibernate/Resources/SQLiteDialect/001_EstateStore.sql +++ b/OpenSim/Data/NHibernate/Resources/SQLiteDialect/001_EstateStore.sql @@ -1,40 +1,40 @@ -CREATE TABLE EstateSettings ( - EstateID INT NOT NULL, - ParentEstateID INT DEFAULT NULL, - EstateOwnerID VARCHAR(36) DEFAULT NULL, - Name VARCHAR(64) DEFAULT NULL, - RedirectGridX INT DEFAULT NULL, - RedirectGridY INT DEFAULT NULL, - BillableFactor DOUBLE DEFAULT NULL, - PricePerMeter INT DEFAULT NULL, - SunPosition DOUBLE DEFAULT NULL, - - UseGlobalTime BIT DEFAULT NULL, - FixedSun BIT DEFAULT NULL, - AllowVoice BIT DEFAULT NULL, - AllowDirectTeleport BIT DEFAULT NULL, - ResetHomeOnTeleport BIT DEFAULT NULL, - PublicAccess BIT DEFAULT NULL, - DenyAnonymous BIT DEFAULT NULL, - DenyIdentified BIT DEFAULT NULL, - DenyTransacted BIT DEFAULT NULL, - DenyMinors BIT DEFAULT NULL, - BlockDwell BIT DEFAULT NULL, - EstateSkipScripts BIT DEFAULT NULL, - TaxFree BIT DEFAULT NULL, - AbuseEmailToEstateOwner BIT DEFAULT NULL, - - AbuseEmail VARCHAR(255) DEFAULT NULL, - - PRIMARY KEY (EstateID) -); - -CREATE TABLE EstateRegionLink ( - EstateRegionLinkID VARCHAR(36) NOT NULL, - EstateID INT DEFAULT NULL, - RegionID VARCHAR(36) DEFAULT NULL, - PRIMARY KEY (EstateRegionLinkID) -); - -CREATE INDEX EstateRegionLinkEstateIDIndex ON EstateRegionLink (EstateID); -CREATE INDEX EstateRegionLinkERegionIDIndex ON EstateRegionLink (RegionID); +CREATE TABLE EstateSettings ( + EstateID INT NOT NULL, + ParentEstateID INT DEFAULT NULL, + EstateOwnerID VARCHAR(36) DEFAULT NULL, + Name VARCHAR(64) DEFAULT NULL, + RedirectGridX INT DEFAULT NULL, + RedirectGridY INT DEFAULT NULL, + BillableFactor DOUBLE DEFAULT NULL, + PricePerMeter INT DEFAULT NULL, + SunPosition DOUBLE DEFAULT NULL, + + UseGlobalTime BIT DEFAULT NULL, + FixedSun BIT DEFAULT NULL, + AllowVoice BIT DEFAULT NULL, + AllowDirectTeleport BIT DEFAULT NULL, + ResetHomeOnTeleport BIT DEFAULT NULL, + PublicAccess BIT DEFAULT NULL, + DenyAnonymous BIT DEFAULT NULL, + DenyIdentified BIT DEFAULT NULL, + DenyTransacted BIT DEFAULT NULL, + DenyMinors BIT DEFAULT NULL, + BlockDwell BIT DEFAULT NULL, + EstateSkipScripts BIT DEFAULT NULL, + TaxFree BIT DEFAULT NULL, + AbuseEmailToEstateOwner BIT DEFAULT NULL, + + AbuseEmail VARCHAR(255) DEFAULT NULL, + + PRIMARY KEY (EstateID) +); + +CREATE TABLE EstateRegionLink ( + EstateRegionLinkID VARCHAR(36) NOT NULL, + EstateID INT DEFAULT NULL, + RegionID VARCHAR(36) DEFAULT NULL, + PRIMARY KEY (EstateRegionLinkID) +); + +CREATE INDEX EstateRegionLinkEstateIDIndex ON EstateRegionLink (EstateID); +CREATE INDEX EstateRegionLinkERegionIDIndex ON EstateRegionLink (RegionID); diff --git a/OpenSim/Data/NHibernate/Tests/NHibernateMsSqlEstateTest.cs b/OpenSim/Data/NHibernate/Tests/NHibernateMsSqlEstateTest.cs index ea3c1eb..ac7343b 100644 --- a/OpenSim/Data/NHibernate/Tests/NHibernateMsSqlEstateTest.cs +++ b/OpenSim/Data/NHibernate/Tests/NHibernateMsSqlEstateTest.cs @@ -1,77 +1,77 @@ -/* - * 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 OpenSim 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; - -namespace OpenSim.Data.NHibernate.Tests -{ - [TestFixture] - public class NHibernateMsSqlEstateTest : BasicEstateTest - { - public string file; - public NHibernateManager database; - - [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 - { - string connect = "MsSql2005Dialect;SqlClientDriver;Data Source=127.0.0.1;Network Library=DBMSSOCN;Initial Catalog=opensim-nunit;User ID=opensim-nunit;Password=opensim-nunit"; - - db = new NHibernateEstateData(); - db.Initialise(connect); - database = ((NHibernateEstateData)db).manager; - } - catch (Exception e) - { - Console.WriteLine("Exception {0}", e); - Assert.Ignore(); - } - } - - [TestFixtureTearDown] - public void Cleanup() - { - if (db != null) - { - ((NHibernateEstateData)db).Dispose(); - } - if (database != null) - { - database.DropSchema(); - } - } - - } -} +/* + * 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 OpenSim 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; + +namespace OpenSim.Data.NHibernate.Tests +{ + [TestFixture] + public class NHibernateMsSqlEstateTest : BasicEstateTest + { + public string file; + public NHibernateManager database; + + [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 + { + string connect = "MsSql2005Dialect;SqlClientDriver;Data Source=127.0.0.1;Network Library=DBMSSOCN;Initial Catalog=opensim-nunit;User ID=opensim-nunit;Password=opensim-nunit"; + + db = new NHibernateEstateData(); + db.Initialise(connect); + database = ((NHibernateEstateData)db).manager; + } + catch (Exception e) + { + Console.WriteLine("Exception {0}", e); + Assert.Ignore(); + } + } + + [TestFixtureTearDown] + public void Cleanup() + { + if (db != null) + { + ((NHibernateEstateData)db).Dispose(); + } + if (database != null) + { + database.DropSchema(); + } + } + + } +} diff --git a/OpenSim/Data/NHibernate/Tests/NHibernateMySqlEstateTest.cs b/OpenSim/Data/NHibernate/Tests/NHibernateMySqlEstateTest.cs index 651ff4e..7e199c7 100644 --- a/OpenSim/Data/NHibernate/Tests/NHibernateMySqlEstateTest.cs +++ b/OpenSim/Data/NHibernate/Tests/NHibernateMySqlEstateTest.cs @@ -1,76 +1,76 @@ -/* - * 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 OpenSim 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; - -namespace OpenSim.Data.NHibernate.Tests -{ - [TestFixture] - public class NHibernateMySQLEstateTest : BasicEstateTest - { - public string file; - public NHibernateManager database; - public string connect = "MySQL5Dialect;MySqlDataDriver;Server=localhost;Database=opensim-nunit;User ID=opensim-nunit;Password=opensim-nunit"; - - [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 NHibernateEstateData(); - db.Initialise(connect); - database = ((NHibernateEstateData)db).manager; - } - catch (Exception e) - { - Console.WriteLine("Exception {0}", e); - Assert.Ignore(); - } - } - - [TestFixtureTearDown] - public void Cleanup() - { - if (db != null) - { - ((NHibernateEstateData)db).Dispose(); - } - if (database != null) - { - database.DropSchema(); - } - } - - } -} +/* + * 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 OpenSim 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; + +namespace OpenSim.Data.NHibernate.Tests +{ + [TestFixture] + public class NHibernateMySQLEstateTest : BasicEstateTest + { + public string file; + public NHibernateManager database; + public string connect = "MySQL5Dialect;MySqlDataDriver;Server=localhost;Database=opensim-nunit;User ID=opensim-nunit;Password=opensim-nunit"; + + [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 NHibernateEstateData(); + db.Initialise(connect); + database = ((NHibernateEstateData)db).manager; + } + catch (Exception e) + { + Console.WriteLine("Exception {0}", e); + Assert.Ignore(); + } + } + + [TestFixtureTearDown] + public void Cleanup() + { + if (db != null) + { + ((NHibernateEstateData)db).Dispose(); + } + if (database != null) + { + database.DropSchema(); + } + } + + } +} diff --git a/OpenSim/Data/NHibernate/Tests/NHibernatePostgreSQLEstateTest.cs b/OpenSim/Data/NHibernate/Tests/NHibernatePostgreSQLEstateTest.cs index 1d113c7..6458c98 100644 --- a/OpenSim/Data/NHibernate/Tests/NHibernatePostgreSQLEstateTest.cs +++ b/OpenSim/Data/NHibernate/Tests/NHibernatePostgreSQLEstateTest.cs @@ -1,76 +1,76 @@ -/* - * 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 OpenSim 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; - -namespace OpenSim.Data.NHibernate.Tests -{ - [TestFixture] - public class NHibernatePostgreSQLEstateTest : BasicEstateTest - { - public string file; - public NHibernateManager database; - public string connect = "PostgreSQLDialect;NpgsqlDriver;Server=localhost;Database=opensim-nunit;User ID=opensim-nunit;Password=opensim-nunit;"; - - [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 NHibernateEstateData(); - db.Initialise(connect); - database = ((NHibernateEstateData)db).manager; - } - catch (Exception e) - { - Console.WriteLine("Exception {0}", e); - Assert.Ignore(); - } - } - - [TestFixtureTearDown] - public void Cleanup() - { - if (db != null) - { - ((NHibernateEstateData)db).Dispose(); - } - if (database != null) - { - database.DropSchema(); - } - } - - } -} +/* + * 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 OpenSim 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; + +namespace OpenSim.Data.NHibernate.Tests +{ + [TestFixture] + public class NHibernatePostgreSQLEstateTest : BasicEstateTest + { + public string file; + public NHibernateManager database; + public string connect = "PostgreSQLDialect;NpgsqlDriver;Server=localhost;Database=opensim-nunit;User ID=opensim-nunit;Password=opensim-nunit;"; + + [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 NHibernateEstateData(); + db.Initialise(connect); + database = ((NHibernateEstateData)db).manager; + } + catch (Exception e) + { + Console.WriteLine("Exception {0}", e); + Assert.Ignore(); + } + } + + [TestFixtureTearDown] + public void Cleanup() + { + if (db != null) + { + ((NHibernateEstateData)db).Dispose(); + } + if (database != null) + { + database.DropSchema(); + } + } + + } +} diff --git a/OpenSim/Data/NHibernate/Tests/NHibernateSQLiteEstateTest.cs b/OpenSim/Data/NHibernate/Tests/NHibernateSQLiteEstateTest.cs index 86fb573..88f85b0 100644 --- a/OpenSim/Data/NHibernate/Tests/NHibernateSQLiteEstateTest.cs +++ b/OpenSim/Data/NHibernate/Tests/NHibernateSQLiteEstateTest.cs @@ -1,78 +1,78 @@ -/* - * 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 OpenSim 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.IO; -using NUnit.Framework; -using OpenSim.Data.Tests; - -namespace OpenSim.Data.NHibernate.Tests -{ - [TestFixture] - public class NHibernateSQLiteEstateTest : BasicEstateTest - { - public string file; - public NHibernateManager database; - - [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 - { - string connect = "SQLiteDialect;SQLite20Driver;Data Source=" + Path.GetTempFileName() + ".db;Version=3"; - - db = new NHibernateEstateData(); - db.Initialise(connect); - database = ((NHibernateEstateData)db).manager; - } - catch (Exception e) - { - Console.WriteLine("Exception {0}", e); - Assert.Ignore(); - } - } - - [TestFixtureTearDown] - public void Cleanup() - { - if (db != null) - { - ((NHibernateEstateData)db).Dispose(); - } - if (database != null) - { - database.DropSchema(); - } - } - - } -} +/* + * 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 OpenSim 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.IO; +using NUnit.Framework; +using OpenSim.Data.Tests; + +namespace OpenSim.Data.NHibernate.Tests +{ + [TestFixture] + public class NHibernateSQLiteEstateTest : BasicEstateTest + { + public string file; + public NHibernateManager database; + + [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 + { + string connect = "SQLiteDialect;SQLite20Driver;Data Source=" + Path.GetTempFileName() + ".db;Version=3"; + + db = new NHibernateEstateData(); + db.Initialise(connect); + database = ((NHibernateEstateData)db).manager; + } + catch (Exception e) + { + Console.WriteLine("Exception {0}", e); + Assert.Ignore(); + } + } + + [TestFixtureTearDown] + public void Cleanup() + { + if (db != null) + { + ((NHibernateEstateData)db).Dispose(); + } + if (database != null) + { + database.DropSchema(); + } + } + + } +} diff --git a/OpenSim/Data/Tests/DataTestUtil.cs b/OpenSim/Data/Tests/DataTestUtil.cs index 778772f..37d1443 100644 --- a/OpenSim/Data/Tests/DataTestUtil.cs +++ b/OpenSim/Data/Tests/DataTestUtil.cs @@ -1,62 +1,62 @@ -using System; -using System.Collections.Generic; -using System.Text; -using OpenMetaverse; -using NUnit.Framework; - -namespace OpenSim.Data.Tests -{ - - /// - /// Shared constants and methods for database unit tests. - /// - public class DataTestUtil - { - - public const uint UNSIGNED_INTEGER_MIN = uint.MinValue; - public const uint UNSIGNED_INTEGER_MAX = uint.MaxValue / 2; // NHibernate does not support unsigned integer range. - - public const int INTEGER_MIN = int.MinValue + 1; // Postgresql requires +1 to .NET int.MinValue - public const int INTEGER_MAX = int.MaxValue; - - public const float FLOAT_MIN = float.MinValue * (1 - FLOAT_PRECISSION); - public const float FLOAT_MAX = float.MaxValue * (1 - FLOAT_PRECISSION); - public const float FLOAT_ACCURATE = 1.234567890123456789012f; - public const float FLOAT_PRECISSION = 1E-5f; // Native MySQL is severly limited with floating accuracy - - public const double DOUBLE_MIN = -1E52 * (1 - DOUBLE_PRECISSION); - public const double DOUBLE_MAX = 1E52 * (1 - DOUBLE_PRECISSION); - public const double DOUBLE_ACCURATE = 1.2345678901234567890123456789012345678901234567890123f; - public const double DOUBLE_PRECISSION = 1E-14; // Native MySQL is severly limited with double accuracy - - public const string STRING_MIN = ""; - public static string STRING_MAX(int length) - { - StringBuilder stringBuilder = new StringBuilder(); - for (int i = 0; i < length; i++) - { - stringBuilder.Append(i % 10); - } - return stringBuilder.ToString(); - } - - public static UUID UUID_MIN = new UUID("00000000-0000-0000-0000-000000000000"); - public static UUID UUID_MAX = new UUID("ffffffff-ffff-ffff-ffff-ffffffffffff"); - - public const bool BOOLEAN_MIN = false; - public const bool BOOLEAN_MAX = true; - - public static void AssertFloatEqualsWithTolerance(float expectedValue, float actualValue) - { - Assert.GreaterOrEqual(actualValue, expectedValue - Math.Abs(expectedValue) * FLOAT_PRECISSION); - Assert.LessOrEqual(actualValue, expectedValue + Math.Abs(expectedValue) * FLOAT_PRECISSION); - } - - public static void AssertDoubleEqualsWithTolerance(double expectedValue, double actualValue) - { - Assert.GreaterOrEqual(actualValue, expectedValue - Math.Abs(expectedValue) * DOUBLE_PRECISSION); - Assert.LessOrEqual(actualValue, expectedValue + Math.Abs(expectedValue) * DOUBLE_PRECISSION); - } - - } -} +using System; +using System.Collections.Generic; +using System.Text; +using OpenMetaverse; +using NUnit.Framework; + +namespace OpenSim.Data.Tests +{ + + /// + /// Shared constants and methods for database unit tests. + /// + public class DataTestUtil + { + + public const uint UNSIGNED_INTEGER_MIN = uint.MinValue; + public const uint UNSIGNED_INTEGER_MAX = uint.MaxValue / 2; // NHibernate does not support unsigned integer range. + + public const int INTEGER_MIN = int.MinValue + 1; // Postgresql requires +1 to .NET int.MinValue + public const int INTEGER_MAX = int.MaxValue; + + public const float FLOAT_MIN = float.MinValue * (1 - FLOAT_PRECISSION); + public const float FLOAT_MAX = float.MaxValue * (1 - FLOAT_PRECISSION); + public const float FLOAT_ACCURATE = 1.234567890123456789012f; + public const float FLOAT_PRECISSION = 1E-5f; // Native MySQL is severly limited with floating accuracy + + public const double DOUBLE_MIN = -1E52 * (1 - DOUBLE_PRECISSION); + public const double DOUBLE_MAX = 1E52 * (1 - DOUBLE_PRECISSION); + public const double DOUBLE_ACCURATE = 1.2345678901234567890123456789012345678901234567890123f; + public const double DOUBLE_PRECISSION = 1E-14; // Native MySQL is severly limited with double accuracy + + public const string STRING_MIN = ""; + public static string STRING_MAX(int length) + { + StringBuilder stringBuilder = new StringBuilder(); + for (int i = 0; i < length; i++) + { + stringBuilder.Append(i % 10); + } + return stringBuilder.ToString(); + } + + public static UUID UUID_MIN = new UUID("00000000-0000-0000-0000-000000000000"); + public static UUID UUID_MAX = new UUID("ffffffff-ffff-ffff-ffff-ffffffffffff"); + + public const bool BOOLEAN_MIN = false; + public const bool BOOLEAN_MAX = true; + + public static void AssertFloatEqualsWithTolerance(float expectedValue, float actualValue) + { + Assert.GreaterOrEqual(actualValue, expectedValue - Math.Abs(expectedValue) * FLOAT_PRECISSION); + Assert.LessOrEqual(actualValue, expectedValue + Math.Abs(expectedValue) * FLOAT_PRECISSION); + } + + public static void AssertDoubleEqualsWithTolerance(double expectedValue, double actualValue) + { + Assert.GreaterOrEqual(actualValue, expectedValue - Math.Abs(expectedValue) * DOUBLE_PRECISSION); + Assert.LessOrEqual(actualValue, expectedValue + Math.Abs(expectedValue) * DOUBLE_PRECISSION); + } + + } +} -- cgit v1.1