line ending fixes and set native eol property

0.6.3-post-fixes
Sean Dague 2009-02-16 19:23:53 +00:00
parent 93837807ff
commit c7a08752c0
14 changed files with 804 additions and 804 deletions

View File

@ -1,49 +1,49 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using OpenMetaverse; using OpenMetaverse;
namespace OpenSim.Data.NHibernate namespace OpenSim.Data.NHibernate
{ {
public class EstateRegionLink public class EstateRegionLink
{ {
private UUID estateRegionLinkID; private UUID estateRegionLinkID;
public UUID EstateRegionLinkID public UUID EstateRegionLinkID
{ {
get get
{ {
return estateRegionLinkID; return estateRegionLinkID;
} }
set set
{ {
estateRegionLinkID = value; estateRegionLinkID = value;
} }
} }
private uint estateID; private uint estateID;
public uint EstateID public uint EstateID
{ {
get get
{ {
return estateID; return estateID;
} }
set set
{ {
estateID = value; estateID = value;
} }
} }
private UUID regionID; private UUID regionID;
public UUID RegionID public UUID RegionID
{ {
get get
{ {
return regionID; return regionID;
} }
set set
{ {
regionID = value; regionID = value;
} }
} }
} }
} }

View File

@ -1,161 +1,161 @@
/* /*
* Copyright (c) Contributors, http://opensimulator.org/ * Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders. * See CONTRIBUTORS.TXT for a full list of copyright holders.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met: * modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright * * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer. * notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright * * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the * notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution. * documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSim Project nor the * * Neither the name of the OpenSim Project nor the
* names of its contributors may be used to endorse or promote products * names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission. * derived from this software without specific prior written permission.
* *
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * 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 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
using System.Reflection; using System.Reflection;
using log4net; using log4net;
using OpenMetaverse; using OpenMetaverse;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Interfaces;
using NHibernate; using NHibernate;
using NHibernate.Criterion; using NHibernate.Criterion;
using System.Collections; using System.Collections;
using System; using System;
namespace OpenSim.Data.NHibernate namespace OpenSim.Data.NHibernate
{ {
/// <summary> /// <summary>
/// A User storage interface for the DB4o database system /// A User storage interface for the DB4o database system
/// </summary> /// </summary>
public class NHibernateEstateData : IEstateDataStore public class NHibernateEstateData : IEstateDataStore
{ {
#region Fields #region Fields
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public NHibernateManager manager; public NHibernateManager manager;
public string Name public string Name
{ {
get { return "NHibernateEstateData"; } get { return "NHibernateEstateData"; }
} }
public string Version public string Version
{ {
get { return "0.1"; } get { return "0.1"; }
} }
#endregion #endregion
#region Startup and shutdown. #region Startup and shutdown.
public void Initialise() public void Initialise()
{ {
m_log.Info("[NHIBERNATE]: " + Name + " cannot be default-initialized!"); m_log.Info("[NHIBERNATE]: " + Name + " cannot be default-initialized!");
throw new PluginNotInitialisedException(Name); throw new PluginNotInitialisedException(Name);
} }
public void Initialise(string connect) public void Initialise(string connect)
{ {
m_log.InfoFormat("[NHIBERNATE] Initializing " + Name + "."); m_log.InfoFormat("[NHIBERNATE] Initializing " + Name + ".");
manager = new NHibernateManager(connect, "EstateStore"); manager = new NHibernateManager(connect, "EstateStore");
} }
public void Dispose() { } public void Dispose() { }
#endregion #endregion
#region IEstateDataStore Members #region IEstateDataStore Members
public EstateSettings LoadEstateSettings(UUID regionID) public EstateSettings LoadEstateSettings(UUID regionID)
{ {
EstateRegionLink link = LoadEstateRegionLink(regionID); EstateRegionLink link = LoadEstateRegionLink(regionID);
// Ensure that estate settings exist for the link // Ensure that estate settings exist for the link
if (link != null) if (link != null)
{ {
if (manager.Load(typeof(EstateSettings), link.EstateID) == null) if (manager.Load(typeof(EstateSettings), link.EstateID) == null)
{ {
// Delete broken link // Delete broken link
manager.Delete(link); manager.Delete(link);
link = null; link = null;
} }
} }
// If estate link does not exist create estate settings and link it to region. // If estate link does not exist create estate settings and link it to region.
if (link == null) if (link == null)
{ {
EstateSettings estateSettings = new EstateSettings(); EstateSettings estateSettings = new EstateSettings();
//estateSettings.EstateOwner = UUID.Random(); //estateSettings.EstateOwner = UUID.Random();
//estateSettings.BlockDwell = false; //estateSettings.BlockDwell = false;
object identifier = manager.Insert(estateSettings); object identifier = manager.Insert(estateSettings);
if (identifier == null) if (identifier == null)
{ {
// Saving failed. Error is logged in the manager. // Saving failed. Error is logged in the manager.
return null; return null;
} }
uint estateID = (uint)identifier; uint estateID = (uint)identifier;
link = new EstateRegionLink(); link = new EstateRegionLink();
link.EstateRegionLinkID = UUID.Random(); link.EstateRegionLinkID = UUID.Random();
link.RegionID = regionID; link.RegionID = regionID;
link.EstateID = estateID; link.EstateID = estateID;
manager.Insert(link); manager.Insert(link);
} }
// Load estate settings according to the existing or created link. // Load estate settings according to the existing or created link.
return (EstateSettings)manager.Load(typeof(EstateSettings), link.EstateID); return (EstateSettings)manager.Load(typeof(EstateSettings), link.EstateID);
} }
public void StoreEstateSettings(EstateSettings estateSettings) public void StoreEstateSettings(EstateSettings estateSettings)
{ {
// Estates are always updated when stored. // Estates are always updated when stored.
// Insert is always done via. load method as with the current API // Insert is always done via. load method as with the current API
// this is explicitly the only way to create region link. // this is explicitly the only way to create region link.
manager.Update(estateSettings); manager.Update(estateSettings);
} }
#endregion #endregion
#region Private Utility Methods #region Private Utility Methods
private EstateRegionLink LoadEstateRegionLink(UUID regionID) private EstateRegionLink LoadEstateRegionLink(UUID regionID)
{ {
ICriteria criteria = manager.GetSession().CreateCriteria(typeof(EstateRegionLink)); ICriteria criteria = manager.GetSession().CreateCriteria(typeof(EstateRegionLink));
criteria.Add(Expression.Eq("RegionID", regionID)); criteria.Add(Expression.Eq("RegionID", regionID));
IList links = criteria.List(); IList links = criteria.List();
// Fail fast if more than one estate links exist // Fail fast if more than one estate links exist
if (links.Count > 1) if (links.Count > 1)
{ {
m_log.Error("[NHIBERNATE]: Region had more than one estate linked: " + regionID); m_log.Error("[NHIBERNATE]: Region had more than one estate linked: " + regionID);
throw new Exception("[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) if (links.Count == 1)
{ {
return (EstateRegionLink)links[0]; return (EstateRegionLink)links[0];
} }
else else
{ {
return null; return null;
} }
} }
#endregion #endregion
} }
} }

View File

@ -1,12 +1,12 @@
<?xml version="1.0" encoding="utf-8" ?> <?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"> <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
<class name="OpenSim.Data.NHibernate.EstateRegionLink, OpenSim.Data.NHibernate" table="EstateRegionLink" lazy="false"> <class name="OpenSim.Data.NHibernate.EstateRegionLink, OpenSim.Data.NHibernate" table="EstateRegionLink" lazy="false">
<id name="EstateRegionLinkID" column="EstateRegionLinkID" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate"> <id name="EstateRegionLinkID" column="EstateRegionLinkID" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate">
<generator class="assigned" /> <generator class="assigned" />
</id> </id>
<property name="EstateID" type="OpenSim.Data.NHibernate.UInt32Type, OpenSim.Data.NHibernate" /> <property name="EstateID" type="OpenSim.Data.NHibernate.UInt32Type, OpenSim.Data.NHibernate" />
<property name="RegionID" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate" /> <property name="RegionID" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate" />
</class> </class>
</hibernate-mapping> </hibernate-mapping>

View File

@ -1,39 +1,39 @@
<?xml version="1.0" encoding="utf-8" ?> <?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"> <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
<class name="OpenSim.Framework.EstateSettings, OpenSim.Framework" table="EstateSettings" lazy="false"> <class name="OpenSim.Framework.EstateSettings, OpenSim.Framework" table="EstateSettings" lazy="false">
<id name="EstateID" column="EstateID" type="OpenSim.Data.NHibernate.UInt32Type, OpenSim.Data.NHibernate"> <id name="EstateID" column="EstateID" type="OpenSim.Data.NHibernate.UInt32Type, OpenSim.Data.NHibernate">
<generator class="increment" /> <generator class="increment" />
</id> </id>
<property name="ParentEstateID" type="OpenSim.Data.NHibernate.UInt32Type, OpenSim.Data.NHibernate" /> <property name="ParentEstateID" type="OpenSim.Data.NHibernate.UInt32Type, OpenSim.Data.NHibernate" />
<property name="EstateOwner" column="EstateOwnerID" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate" /> <property name="EstateOwner" column="EstateOwnerID" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate" />
<property name="EstateName" column="Name" type="String" length="64" /> <property name="EstateName" column="Name" type="String" length="64" />
<property name="RedirectGridX" type="System.Int32" /> <property name="RedirectGridX" type="System.Int32" />
<property name="RedirectGridY" type="System.Int32" /> <property name="RedirectGridY" type="System.Int32" />
<property name="BillableFactor" type="System.Single" /> <property name="BillableFactor" type="System.Single" />
<property name="PricePerMeter" type="System.Int32" /> <property name="PricePerMeter" type="System.Int32" />
<property name="SunPosition" type="System.Double" /> <property name="SunPosition" type="System.Double" />
<property name="UseGlobalTime" type="System.Boolean" /> <property name="UseGlobalTime" type="System.Boolean" />
<property name="FixedSun" type="System.Boolean" /> <property name="FixedSun" type="System.Boolean" />
<property name="AllowVoice" type="System.Boolean" /> <property name="AllowVoice" type="System.Boolean" />
<property name="AllowDirectTeleport" type="System.Boolean" /> <property name="AllowDirectTeleport" type="System.Boolean" />
<property name="ResetHomeOnTeleport" type="System.Boolean" /> <property name="ResetHomeOnTeleport" type="System.Boolean" />
<property name="PublicAccess" type="System.Boolean" /> <property name="PublicAccess" type="System.Boolean" />
<property name="DenyAnonymous" type="System.Boolean" /> <property name="DenyAnonymous" type="System.Boolean" />
<property name="DenyIdentified" type="System.Boolean" /> <property name="DenyIdentified" type="System.Boolean" />
<property name="DenyTransacted" type="System.Boolean" /> <property name="DenyTransacted" type="System.Boolean" />
<property name="DenyMinors" type="System.Boolean" /> <property name="DenyMinors" type="System.Boolean" />
<property name="BlockDwell" type="System.Boolean" /> <property name="BlockDwell" type="System.Boolean" />
<property name="EstateSkipScripts" type="System.Boolean" /> <property name="EstateSkipScripts" type="System.Boolean" />
<property name="TaxFree" type="System.Boolean" /> <property name="TaxFree" type="System.Boolean" />
<property name="AbuseEmailToEstateOwner" type="System.Boolean" /> <property name="AbuseEmailToEstateOwner" type="System.Boolean" />
<property name="AbuseEmail" type="String" length="255" /> <property name="AbuseEmail" type="String" length="255" />
</class> </class>
</hibernate-mapping> </hibernate-mapping>

View File

@ -1,14 +1,14 @@
?This file describes the differences in schema creation and migration scripts. ?This file describes the differences in schema creation and migration scripts.
MySQL is used as reference script against which differences are listed. MySQL is used as reference script against which differences are listed.
Generally MySQL create table options should be removed for other databases. Generally MySQL create table options should be removed for other databases.
_PostgreSQL_ _PostgreSQL_
* DOUBLE->DOUBLE PRECISION * DOUBLE->DOUBLE PRECISION
* BIT->BOOLEAN * BIT->BOOLEAN
_MsSql_ _MsSql_
* VARCHAR->NVARCHAR * VARCHAR->NVARCHAR
* Remove DEFAULT-keywords * Remove DEFAULT-keywords
* DOUBLE->REAL * DOUBLE->REAL

View File

@ -1,40 +1,40 @@
CREATE TABLE EstateSettings ( CREATE TABLE EstateSettings (
EstateID INT NOT NULL, EstateID INT NOT NULL,
ParentEstateID INT NULL, ParentEstateID INT NULL,
EstateOwnerID NVARCHAR(36) NULL, EstateOwnerID NVARCHAR(36) NULL,
Name NVARCHAR(64) NULL, Name NVARCHAR(64) NULL,
RedirectGridX INT NULL, RedirectGridX INT NULL,
RedirectGridY INT NULL, RedirectGridY INT NULL,
BillableFactor REAL NULL, BillableFactor REAL NULL,
PricePerMeter INT NULL, PricePerMeter INT NULL,
SunPosition FLOAT NULL, SunPosition FLOAT NULL,
UseGlobalTime BIT NULL, UseGlobalTime BIT NULL,
FixedSun BIT NULL, FixedSun BIT NULL,
AllowVoice BIT NULL, AllowVoice BIT NULL,
AllowDirectTeleport BIT NULL, AllowDirectTeleport BIT NULL,
ResetHomeOnTeleport BIT NULL, ResetHomeOnTeleport BIT NULL,
PublicAccess BIT NULL, PublicAccess BIT NULL,
DenyAnonymous BIT NULL, DenyAnonymous BIT NULL,
DenyIdentified BIT NULL, DenyIdentified BIT NULL,
DenyTransacted BIT NULL, DenyTransacted BIT NULL,
DenyMinors BIT NULL, DenyMinors BIT NULL,
BlockDwell BIT NULL, BlockDwell BIT NULL,
EstateSkipScripts BIT NULL, EstateSkipScripts BIT NULL,
TaxFree BIT NULL, TaxFree BIT NULL,
AbuseEmailToEstateOwner BIT NULL, AbuseEmailToEstateOwner BIT NULL,
AbuseEmail NVARCHAR(255) NULL, AbuseEmail NVARCHAR(255) NULL,
PRIMARY KEY (EstateID) PRIMARY KEY (EstateID)
); );
CREATE TABLE EstateRegionLink ( CREATE TABLE EstateRegionLink (
EstateRegionLinkID NVARCHAR(36) NOT NULL, EstateRegionLinkID NVARCHAR(36) NOT NULL,
EstateID INT NULL, EstateID INT NULL,
RegionID NVARCHAR(36) NULL, RegionID NVARCHAR(36) NULL,
PRIMARY KEY (EstateRegionLinkID) PRIMARY KEY (EstateRegionLinkID)
); );
CREATE INDEX EstateRegionLinkEstateIDIndex ON EstateRegionLink (EstateID); CREATE INDEX EstateRegionLinkEstateIDIndex ON EstateRegionLink (EstateID);
CREATE INDEX EstateRegionLinkERegionIDIndex ON EstateRegionLink (RegionID); CREATE INDEX EstateRegionLinkERegionIDIndex ON EstateRegionLink (RegionID);

View File

@ -1,40 +1,40 @@
CREATE TABLE EstateSettings ( CREATE TABLE EstateSettings (
EstateID INT NOT NULL, EstateID INT NOT NULL,
ParentEstateID INT DEFAULT NULL, ParentEstateID INT DEFAULT NULL,
EstateOwnerID VARCHAR(36) DEFAULT NULL, EstateOwnerID VARCHAR(36) DEFAULT NULL,
Name VARCHAR(64) DEFAULT NULL, Name VARCHAR(64) DEFAULT NULL,
RedirectGridX INT DEFAULT NULL, RedirectGridX INT DEFAULT NULL,
RedirectGridY INT DEFAULT NULL, RedirectGridY INT DEFAULT NULL,
BillableFactor DOUBLE DEFAULT NULL, BillableFactor DOUBLE DEFAULT NULL,
PricePerMeter INT DEFAULT NULL, PricePerMeter INT DEFAULT NULL,
SunPosition DOUBLE DEFAULT NULL, SunPosition DOUBLE DEFAULT NULL,
UseGlobalTime BIT DEFAULT NULL, UseGlobalTime BIT DEFAULT NULL,
FixedSun BIT DEFAULT NULL, FixedSun BIT DEFAULT NULL,
AllowVoice BIT DEFAULT NULL, AllowVoice BIT DEFAULT NULL,
AllowDirectTeleport BIT DEFAULT NULL, AllowDirectTeleport BIT DEFAULT NULL,
ResetHomeOnTeleport BIT DEFAULT NULL, ResetHomeOnTeleport BIT DEFAULT NULL,
PublicAccess BIT DEFAULT NULL, PublicAccess BIT DEFAULT NULL,
DenyAnonymous BIT DEFAULT NULL, DenyAnonymous BIT DEFAULT NULL,
DenyIdentified BIT DEFAULT NULL, DenyIdentified BIT DEFAULT NULL,
DenyTransacted BIT DEFAULT NULL, DenyTransacted BIT DEFAULT NULL,
DenyMinors BIT DEFAULT NULL, DenyMinors BIT DEFAULT NULL,
BlockDwell BIT DEFAULT NULL, BlockDwell BIT DEFAULT NULL,
EstateSkipScripts BIT DEFAULT NULL, EstateSkipScripts BIT DEFAULT NULL,
TaxFree BIT DEFAULT NULL, TaxFree BIT DEFAULT NULL,
AbuseEmailToEstateOwner BIT DEFAULT NULL, AbuseEmailToEstateOwner BIT DEFAULT NULL,
AbuseEmail VARCHAR(255) DEFAULT NULL, AbuseEmail VARCHAR(255) DEFAULT NULL,
PRIMARY KEY (EstateID) PRIMARY KEY (EstateID)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Rev. 1'; ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Rev. 1';
CREATE TABLE EstateRegionLink ( CREATE TABLE EstateRegionLink (
EstateRegionLinkID VARCHAR(36) NOT NULL, EstateRegionLinkID VARCHAR(36) NOT NULL,
EstateID INT DEFAULT NULL, EstateID INT DEFAULT NULL,
RegionID VARCHAR(36) DEFAULT NULL, RegionID VARCHAR(36) DEFAULT NULL,
PRIMARY KEY (EstateRegionLinkID) PRIMARY KEY (EstateRegionLinkID)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Rev. 1'; ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Rev. 1';
CREATE INDEX EstateRegionLinkEstateIDIndex ON EstateRegionLink (EstateID); CREATE INDEX EstateRegionLinkEstateIDIndex ON EstateRegionLink (EstateID);
CREATE INDEX EstateRegionLinkERegionIDIndex ON EstateRegionLink (RegionID); CREATE INDEX EstateRegionLinkERegionIDIndex ON EstateRegionLink (RegionID);

View File

@ -1,40 +1,40 @@
CREATE TABLE EstateSettings ( CREATE TABLE EstateSettings (
EstateID INT NOT NULL, EstateID INT NOT NULL,
ParentEstateID INT DEFAULT NULL, ParentEstateID INT DEFAULT NULL,
EstateOwnerID VARCHAR(36) DEFAULT NULL, EstateOwnerID VARCHAR(36) DEFAULT NULL,
Name VARCHAR(64) DEFAULT NULL, Name VARCHAR(64) DEFAULT NULL,
RedirectGridX INT DEFAULT NULL, RedirectGridX INT DEFAULT NULL,
RedirectGridY INT DEFAULT NULL, RedirectGridY INT DEFAULT NULL,
BillableFactor DOUBLE PRECISION DEFAULT NULL, BillableFactor DOUBLE PRECISION DEFAULT NULL,
PricePerMeter INT DEFAULT NULL, PricePerMeter INT DEFAULT NULL,
SunPosition DOUBLE PRECISION DEFAULT NULL, SunPosition DOUBLE PRECISION DEFAULT NULL,
UseGlobalTime BOOLEAN DEFAULT NULL, UseGlobalTime BOOLEAN DEFAULT NULL,
FixedSun BOOLEAN DEFAULT NULL, FixedSun BOOLEAN DEFAULT NULL,
AllowVoice BOOLEAN DEFAULT NULL, AllowVoice BOOLEAN DEFAULT NULL,
AllowDirectTeleport BOOLEAN DEFAULT NULL, AllowDirectTeleport BOOLEAN DEFAULT NULL,
ResetHomeOnTeleport BOOLEAN DEFAULT NULL, ResetHomeOnTeleport BOOLEAN DEFAULT NULL,
PublicAccess BOOLEAN DEFAULT NULL, PublicAccess BOOLEAN DEFAULT NULL,
DenyAnonymous BOOLEAN DEFAULT NULL, DenyAnonymous BOOLEAN DEFAULT NULL,
DenyIdentified BOOLEAN DEFAULT NULL, DenyIdentified BOOLEAN DEFAULT NULL,
DenyTransacted BOOLEAN DEFAULT NULL, DenyTransacted BOOLEAN DEFAULT NULL,
DenyMinors BOOLEAN DEFAULT NULL, DenyMinors BOOLEAN DEFAULT NULL,
BlockDwell BOOLEAN DEFAULT NULL, BlockDwell BOOLEAN DEFAULT NULL,
EstateSkipScripts BOOLEAN DEFAULT NULL, EstateSkipScripts BOOLEAN DEFAULT NULL,
TaxFree BOOLEAN DEFAULT NULL, TaxFree BOOLEAN DEFAULT NULL,
AbuseEmailToEstateOwner BOOLEAN DEFAULT NULL, AbuseEmailToEstateOwner BOOLEAN DEFAULT NULL,
AbuseEmail VARCHAR(255) DEFAULT NULL, AbuseEmail VARCHAR(255) DEFAULT NULL,
PRIMARY KEY (EstateID) PRIMARY KEY (EstateID)
); );
CREATE TABLE EstateRegionLink ( CREATE TABLE EstateRegionLink (
EstateRegionLinkID VARCHAR(36) NOT NULL, EstateRegionLinkID VARCHAR(36) NOT NULL,
EstateID INT DEFAULT NULL, EstateID INT DEFAULT NULL,
RegionID VARCHAR(36) DEFAULT NULL, RegionID VARCHAR(36) DEFAULT NULL,
PRIMARY KEY (EstateRegionLinkID) PRIMARY KEY (EstateRegionLinkID)
); );
CREATE INDEX EstateRegionLinkEstateIDIndex ON EstateRegionLink (EstateID); CREATE INDEX EstateRegionLinkEstateIDIndex ON EstateRegionLink (EstateID);
CREATE INDEX EstateRegionLinkERegionIDIndex ON EstateRegionLink (RegionID); CREATE INDEX EstateRegionLinkERegionIDIndex ON EstateRegionLink (RegionID);

View File

@ -1,40 +1,40 @@
CREATE TABLE EstateSettings ( CREATE TABLE EstateSettings (
EstateID INT NOT NULL, EstateID INT NOT NULL,
ParentEstateID INT DEFAULT NULL, ParentEstateID INT DEFAULT NULL,
EstateOwnerID VARCHAR(36) DEFAULT NULL, EstateOwnerID VARCHAR(36) DEFAULT NULL,
Name VARCHAR(64) DEFAULT NULL, Name VARCHAR(64) DEFAULT NULL,
RedirectGridX INT DEFAULT NULL, RedirectGridX INT DEFAULT NULL,
RedirectGridY INT DEFAULT NULL, RedirectGridY INT DEFAULT NULL,
BillableFactor DOUBLE DEFAULT NULL, BillableFactor DOUBLE DEFAULT NULL,
PricePerMeter INT DEFAULT NULL, PricePerMeter INT DEFAULT NULL,
SunPosition DOUBLE DEFAULT NULL, SunPosition DOUBLE DEFAULT NULL,
UseGlobalTime BIT DEFAULT NULL, UseGlobalTime BIT DEFAULT NULL,
FixedSun BIT DEFAULT NULL, FixedSun BIT DEFAULT NULL,
AllowVoice BIT DEFAULT NULL, AllowVoice BIT DEFAULT NULL,
AllowDirectTeleport BIT DEFAULT NULL, AllowDirectTeleport BIT DEFAULT NULL,
ResetHomeOnTeleport BIT DEFAULT NULL, ResetHomeOnTeleport BIT DEFAULT NULL,
PublicAccess BIT DEFAULT NULL, PublicAccess BIT DEFAULT NULL,
DenyAnonymous BIT DEFAULT NULL, DenyAnonymous BIT DEFAULT NULL,
DenyIdentified BIT DEFAULT NULL, DenyIdentified BIT DEFAULT NULL,
DenyTransacted BIT DEFAULT NULL, DenyTransacted BIT DEFAULT NULL,
DenyMinors BIT DEFAULT NULL, DenyMinors BIT DEFAULT NULL,
BlockDwell BIT DEFAULT NULL, BlockDwell BIT DEFAULT NULL,
EstateSkipScripts BIT DEFAULT NULL, EstateSkipScripts BIT DEFAULT NULL,
TaxFree BIT DEFAULT NULL, TaxFree BIT DEFAULT NULL,
AbuseEmailToEstateOwner BIT DEFAULT NULL, AbuseEmailToEstateOwner BIT DEFAULT NULL,
AbuseEmail VARCHAR(255) DEFAULT NULL, AbuseEmail VARCHAR(255) DEFAULT NULL,
PRIMARY KEY (EstateID) PRIMARY KEY (EstateID)
); );
CREATE TABLE EstateRegionLink ( CREATE TABLE EstateRegionLink (
EstateRegionLinkID VARCHAR(36) NOT NULL, EstateRegionLinkID VARCHAR(36) NOT NULL,
EstateID INT DEFAULT NULL, EstateID INT DEFAULT NULL,
RegionID VARCHAR(36) DEFAULT NULL, RegionID VARCHAR(36) DEFAULT NULL,
PRIMARY KEY (EstateRegionLinkID) PRIMARY KEY (EstateRegionLinkID)
); );
CREATE INDEX EstateRegionLinkEstateIDIndex ON EstateRegionLink (EstateID); CREATE INDEX EstateRegionLinkEstateIDIndex ON EstateRegionLink (EstateID);
CREATE INDEX EstateRegionLinkERegionIDIndex ON EstateRegionLink (RegionID); CREATE INDEX EstateRegionLinkERegionIDIndex ON EstateRegionLink (RegionID);

View File

@ -1,77 +1,77 @@
/* /*
* Copyright (c) Contributors, http://opensimulator.org/ * Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders. * See CONTRIBUTORS.TXT for a full list of copyright holders.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met: * modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright * * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer. * notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright * * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the * notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution. * documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSim Project nor the * * Neither the name of the OpenSim Project nor the
* names of its contributors may be used to endorse or promote products * names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission. * derived from this software without specific prior written permission.
* *
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * 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 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
using System; using System;
using NUnit.Framework; using NUnit.Framework;
using OpenSim.Data.Tests; using OpenSim.Data.Tests;
namespace OpenSim.Data.NHibernate.Tests namespace OpenSim.Data.NHibernate.Tests
{ {
[TestFixture] [TestFixture]
public class NHibernateMsSqlEstateTest : BasicEstateTest public class NHibernateMsSqlEstateTest : BasicEstateTest
{ {
public string file; public string file;
public NHibernateManager database; public NHibernateManager database;
[TestFixtureSetUp] [TestFixtureSetUp]
public void Init() public void Init()
{ {
SuperInit(); SuperInit();
// If we manage to connect to the database with the user // If we manage to connect to the database with the user
// and password above it is our test database, and run // and password above it is our test database, and run
// these tests. If anything goes wrong, ignore these // these tests. If anything goes wrong, ignore these
// tests. // tests.
try 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"; 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 = new NHibernateEstateData();
db.Initialise(connect); db.Initialise(connect);
database = ((NHibernateEstateData)db).manager; database = ((NHibernateEstateData)db).manager;
} }
catch (Exception e) catch (Exception e)
{ {
Console.WriteLine("Exception {0}", e); Console.WriteLine("Exception {0}", e);
Assert.Ignore(); Assert.Ignore();
} }
} }
[TestFixtureTearDown] [TestFixtureTearDown]
public void Cleanup() public void Cleanup()
{ {
if (db != null) if (db != null)
{ {
((NHibernateEstateData)db).Dispose(); ((NHibernateEstateData)db).Dispose();
} }
if (database != null) if (database != null)
{ {
database.DropSchema(); database.DropSchema();
} }
} }
} }
} }

View File

@ -1,76 +1,76 @@
/* /*
* Copyright (c) Contributors, http://opensimulator.org/ * Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders. * See CONTRIBUTORS.TXT for a full list of copyright holders.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met: * modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright * * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer. * notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright * * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the * notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution. * documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSim Project nor the * * Neither the name of the OpenSim Project nor the
* names of its contributors may be used to endorse or promote products * names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission. * derived from this software without specific prior written permission.
* *
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * 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 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
using System; using System;
using NUnit.Framework; using NUnit.Framework;
using OpenSim.Data.Tests; using OpenSim.Data.Tests;
namespace OpenSim.Data.NHibernate.Tests namespace OpenSim.Data.NHibernate.Tests
{ {
[TestFixture] [TestFixture]
public class NHibernateMySQLEstateTest : BasicEstateTest public class NHibernateMySQLEstateTest : BasicEstateTest
{ {
public string file; public string file;
public NHibernateManager database; public NHibernateManager database;
public string connect = "MySQL5Dialect;MySqlDataDriver;Server=localhost;Database=opensim-nunit;User ID=opensim-nunit;Password=opensim-nunit"; public string connect = "MySQL5Dialect;MySqlDataDriver;Server=localhost;Database=opensim-nunit;User ID=opensim-nunit;Password=opensim-nunit";
[TestFixtureSetUp] [TestFixtureSetUp]
public void Init() public void Init()
{ {
SuperInit(); SuperInit();
// If we manage to connect to the database with the user // If we manage to connect to the database with the user
// and password above it is our test database, and run // and password above it is our test database, and run
// these tests. If anything goes wrong, ignore these // these tests. If anything goes wrong, ignore these
// tests. // tests.
try try
{ {
db = new NHibernateEstateData(); db = new NHibernateEstateData();
db.Initialise(connect); db.Initialise(connect);
database = ((NHibernateEstateData)db).manager; database = ((NHibernateEstateData)db).manager;
} }
catch (Exception e) catch (Exception e)
{ {
Console.WriteLine("Exception {0}", e); Console.WriteLine("Exception {0}", e);
Assert.Ignore(); Assert.Ignore();
} }
} }
[TestFixtureTearDown] [TestFixtureTearDown]
public void Cleanup() public void Cleanup()
{ {
if (db != null) if (db != null)
{ {
((NHibernateEstateData)db).Dispose(); ((NHibernateEstateData)db).Dispose();
} }
if (database != null) if (database != null)
{ {
database.DropSchema(); database.DropSchema();
} }
} }
} }
} }

View File

@ -1,76 +1,76 @@
/* /*
* Copyright (c) Contributors, http://opensimulator.org/ * Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders. * See CONTRIBUTORS.TXT for a full list of copyright holders.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met: * modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright * * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer. * notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright * * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the * notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution. * documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSim Project nor the * * Neither the name of the OpenSim Project nor the
* names of its contributors may be used to endorse or promote products * names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission. * derived from this software without specific prior written permission.
* *
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * 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 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
using System; using System;
using NUnit.Framework; using NUnit.Framework;
using OpenSim.Data.Tests; using OpenSim.Data.Tests;
namespace OpenSim.Data.NHibernate.Tests namespace OpenSim.Data.NHibernate.Tests
{ {
[TestFixture] [TestFixture]
public class NHibernatePostgreSQLEstateTest : BasicEstateTest public class NHibernatePostgreSQLEstateTest : BasicEstateTest
{ {
public string file; public string file;
public NHibernateManager database; public NHibernateManager database;
public string connect = "PostgreSQLDialect;NpgsqlDriver;Server=localhost;Database=opensim-nunit;User ID=opensim-nunit;Password=opensim-nunit;"; public string connect = "PostgreSQLDialect;NpgsqlDriver;Server=localhost;Database=opensim-nunit;User ID=opensim-nunit;Password=opensim-nunit;";
[TestFixtureSetUp] [TestFixtureSetUp]
public void Init() public void Init()
{ {
SuperInit(); SuperInit();
// If we manage to connect to the database with the user // If we manage to connect to the database with the user
// and password above it is our test database, and run // and password above it is our test database, and run
// these tests. If anything goes wrong, ignore these // these tests. If anything goes wrong, ignore these
// tests. // tests.
try try
{ {
db = new NHibernateEstateData(); db = new NHibernateEstateData();
db.Initialise(connect); db.Initialise(connect);
database = ((NHibernateEstateData)db).manager; database = ((NHibernateEstateData)db).manager;
} }
catch (Exception e) catch (Exception e)
{ {
Console.WriteLine("Exception {0}", e); Console.WriteLine("Exception {0}", e);
Assert.Ignore(); Assert.Ignore();
} }
} }
[TestFixtureTearDown] [TestFixtureTearDown]
public void Cleanup() public void Cleanup()
{ {
if (db != null) if (db != null)
{ {
((NHibernateEstateData)db).Dispose(); ((NHibernateEstateData)db).Dispose();
} }
if (database != null) if (database != null)
{ {
database.DropSchema(); database.DropSchema();
} }
} }
} }
} }

View File

@ -1,78 +1,78 @@
/* /*
* Copyright (c) Contributors, http://opensimulator.org/ * Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders. * See CONTRIBUTORS.TXT for a full list of copyright holders.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met: * modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright * * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer. * notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright * * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the * notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution. * documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSim Project nor the * * Neither the name of the OpenSim Project nor the
* names of its contributors may be used to endorse or promote products * names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission. * derived from this software without specific prior written permission.
* *
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * 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 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
using System; using System;
using System.IO; using System.IO;
using NUnit.Framework; using NUnit.Framework;
using OpenSim.Data.Tests; using OpenSim.Data.Tests;
namespace OpenSim.Data.NHibernate.Tests namespace OpenSim.Data.NHibernate.Tests
{ {
[TestFixture] [TestFixture]
public class NHibernateSQLiteEstateTest : BasicEstateTest public class NHibernateSQLiteEstateTest : BasicEstateTest
{ {
public string file; public string file;
public NHibernateManager database; public NHibernateManager database;
[TestFixtureSetUp] [TestFixtureSetUp]
public void Init() public void Init()
{ {
SuperInit(); SuperInit();
// If we manage to connect to the database with the user // If we manage to connect to the database with the user
// and password above it is our test database, and run // and password above it is our test database, and run
// these tests. If anything goes wrong, ignore these // these tests. If anything goes wrong, ignore these
// tests. // tests.
try try
{ {
string connect = "SQLiteDialect;SQLite20Driver;Data Source=" + Path.GetTempFileName() + ".db;Version=3"; string connect = "SQLiteDialect;SQLite20Driver;Data Source=" + Path.GetTempFileName() + ".db;Version=3";
db = new NHibernateEstateData(); db = new NHibernateEstateData();
db.Initialise(connect); db.Initialise(connect);
database = ((NHibernateEstateData)db).manager; database = ((NHibernateEstateData)db).manager;
} }
catch (Exception e) catch (Exception e)
{ {
Console.WriteLine("Exception {0}", e); Console.WriteLine("Exception {0}", e);
Assert.Ignore(); Assert.Ignore();
} }
} }
[TestFixtureTearDown] [TestFixtureTearDown]
public void Cleanup() public void Cleanup()
{ {
if (db != null) if (db != null)
{ {
((NHibernateEstateData)db).Dispose(); ((NHibernateEstateData)db).Dispose();
} }
if (database != null) if (database != null)
{ {
database.DropSchema(); database.DropSchema();
} }
} }
} }
} }

View File

@ -1,62 +1,62 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using OpenMetaverse; using OpenMetaverse;
using NUnit.Framework; using NUnit.Framework;
namespace OpenSim.Data.Tests namespace OpenSim.Data.Tests
{ {
/// <summary> /// <summary>
/// Shared constants and methods for database unit tests. /// Shared constants and methods for database unit tests.
/// </summary> /// </summary>
public class DataTestUtil public class DataTestUtil
{ {
public const uint UNSIGNED_INTEGER_MIN = uint.MinValue; 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 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_MIN = int.MinValue + 1; // Postgresql requires +1 to .NET int.MinValue
public const int INTEGER_MAX = int.MaxValue; public const int INTEGER_MAX = int.MaxValue;
public const float FLOAT_MIN = float.MinValue * (1 - FLOAT_PRECISSION); public const float FLOAT_MIN = float.MinValue * (1 - FLOAT_PRECISSION);
public const float FLOAT_MAX = float.MaxValue * (1 - FLOAT_PRECISSION); public const float FLOAT_MAX = float.MaxValue * (1 - FLOAT_PRECISSION);
public const float FLOAT_ACCURATE = 1.234567890123456789012f; public const float FLOAT_ACCURATE = 1.234567890123456789012f;
public const float FLOAT_PRECISSION = 1E-5f; // Native MySQL is severly limited with floating accuracy 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_MIN = -1E52 * (1 - DOUBLE_PRECISSION);
public const double DOUBLE_MAX = 1E52 * (1 - DOUBLE_PRECISSION); public const double DOUBLE_MAX = 1E52 * (1 - DOUBLE_PRECISSION);
public const double DOUBLE_ACCURATE = 1.2345678901234567890123456789012345678901234567890123f; public const double DOUBLE_ACCURATE = 1.2345678901234567890123456789012345678901234567890123f;
public const double DOUBLE_PRECISSION = 1E-14; // Native MySQL is severly limited with double accuracy public const double DOUBLE_PRECISSION = 1E-14; // Native MySQL is severly limited with double accuracy
public const string STRING_MIN = ""; public const string STRING_MIN = "";
public static string STRING_MAX(int length) public static string STRING_MAX(int length)
{ {
StringBuilder stringBuilder = new StringBuilder(); StringBuilder stringBuilder = new StringBuilder();
for (int i = 0; i < length; i++) for (int i = 0; i < length; i++)
{ {
stringBuilder.Append(i % 10); stringBuilder.Append(i % 10);
} }
return stringBuilder.ToString(); return stringBuilder.ToString();
} }
public static UUID UUID_MIN = new UUID("00000000-0000-0000-0000-000000000000"); 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 static UUID UUID_MAX = new UUID("ffffffff-ffff-ffff-ffff-ffffffffffff");
public const bool BOOLEAN_MIN = false; public const bool BOOLEAN_MIN = false;
public const bool BOOLEAN_MAX = true; public const bool BOOLEAN_MAX = true;
public static void AssertFloatEqualsWithTolerance(float expectedValue, float actualValue) public static void AssertFloatEqualsWithTolerance(float expectedValue, float actualValue)
{ {
Assert.GreaterOrEqual(actualValue, expectedValue - Math.Abs(expectedValue) * FLOAT_PRECISSION); Assert.GreaterOrEqual(actualValue, expectedValue - Math.Abs(expectedValue) * FLOAT_PRECISSION);
Assert.LessOrEqual(actualValue, expectedValue + Math.Abs(expectedValue) * FLOAT_PRECISSION); Assert.LessOrEqual(actualValue, expectedValue + Math.Abs(expectedValue) * FLOAT_PRECISSION);
} }
public static void AssertDoubleEqualsWithTolerance(double expectedValue, double actualValue) public static void AssertDoubleEqualsWithTolerance(double expectedValue, double actualValue)
{ {
Assert.GreaterOrEqual(actualValue, expectedValue - Math.Abs(expectedValue) * DOUBLE_PRECISSION); Assert.GreaterOrEqual(actualValue, expectedValue - Math.Abs(expectedValue) * DOUBLE_PRECISSION);
Assert.LessOrEqual(actualValue, expectedValue + Math.Abs(expectedValue) * DOUBLE_PRECISSION); Assert.LessOrEqual(actualValue, expectedValue + Math.Abs(expectedValue) * DOUBLE_PRECISSION);
} }
} }
} }