aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Data/NHibernate/EstateRegionLink.cs49
-rw-r--r--OpenSim/Data/NHibernate/NHibernateAssetData.cs5
-rw-r--r--OpenSim/Data/NHibernate/NHibernateEstateData.cs161
-rw-r--r--OpenSim/Data/NHibernate/NHibernateGridData.cs2
-rw-r--r--OpenSim/Data/NHibernate/NHibernateInventoryData.cs74
-rw-r--r--OpenSim/Data/NHibernate/NHibernateManager.cs14
-rw-r--r--OpenSim/Data/NHibernate/NHibernateRegionData.cs10
-rw-r--r--OpenSim/Data/NHibernate/NHibernateUserData.cs10
-rw-r--r--OpenSim/Data/NHibernate/Resources/EstateRegionLink.hbm.xml12
-rw-r--r--OpenSim/Data/NHibernate/Resources/EstateSettings.hbm.xml39
-rw-r--r--OpenSim/Data/NHibernate/Resources/MigrationSyntaxDifferences.txt14
-rw-r--r--OpenSim/Data/NHibernate/Resources/MsSql2005Dialect/001_EstateStore.sql40
-rw-r--r--OpenSim/Data/NHibernate/Resources/MySQLDialect/001_EstateStore.sql40
-rw-r--r--OpenSim/Data/NHibernate/Resources/PostgreSQLDialect/001_EstateStore.sql40
-rw-r--r--OpenSim/Data/NHibernate/Resources/SQLiteDialect/001_EstateStore.sql40
-rw-r--r--OpenSim/Data/NHibernate/Tests/NHibernateMsSqlEstateTest.cs77
-rw-r--r--OpenSim/Data/NHibernate/Tests/NHibernateMySqlEstateTest.cs76
-rw-r--r--OpenSim/Data/NHibernate/Tests/NHibernatePostgreSQLEstateTest.cs76
-rw-r--r--OpenSim/Data/NHibernate/Tests/NHibernateSQLiteEstateTest.cs78
-rw-r--r--OpenSim/Data/Tests/BasicEstateTest.cs3
20 files changed, 803 insertions, 57 deletions
diff --git a/OpenSim/Data/NHibernate/EstateRegionLink.cs b/OpenSim/Data/NHibernate/EstateRegionLink.cs
new file mode 100644
index 0000000..cceced2
--- /dev/null
+++ b/OpenSim/Data/NHibernate/EstateRegionLink.cs
@@ -0,0 +1,49 @@
1?using System;
2using System.Collections.Generic;
3using System.Text;
4using OpenMetaverse;
5
6namespace OpenSim.Data.NHibernate
7{
8 public class EstateRegionLink
9 {
10 private UUID estateRegionLinkID;
11 public UUID EstateRegionLinkID
12 {
13 get
14 {
15 return estateRegionLinkID;
16 }
17 set
18 {
19 estateRegionLinkID = value;
20 }
21 }
22
23 private uint estateID;
24 public uint EstateID
25 {
26 get
27 {
28 return estateID;
29 }
30 set
31 {
32 estateID = value;
33 }
34 }
35
36 private UUID regionID;
37 public UUID RegionID
38 {
39 get
40 {
41 return regionID;
42 }
43 set
44 {
45 regionID = value;
46 }
47 }
48 }
49}
diff --git a/OpenSim/Data/NHibernate/NHibernateAssetData.cs b/OpenSim/Data/NHibernate/NHibernateAssetData.cs
index f4527bf..f8715cc 100644
--- a/OpenSim/Data/NHibernate/NHibernateAssetData.cs
+++ b/OpenSim/Data/NHibernate/NHibernateAssetData.cs
@@ -45,7 +45,8 @@ namespace OpenSim.Data.NHibernate
45 45
46 public override void Initialise() 46 public override void Initialise()
47 { 47 {
48 Initialise("SQLiteDialect;SqliteClientDriver;URI=file:Asset.db,version=3"); 48 m_log.Info("[NHibernateGridData]: " + Name + " cannot be default-initialized!");
49 throw new PluginNotInitialisedException(Name);
49 } 50 }
50 51
51 public override void Initialise(string connect) 52 public override void Initialise(string connect)
@@ -66,7 +67,7 @@ namespace OpenSim.Data.NHibernate
66 AssetBase temp = (AssetBase)manager.Load(typeof(AssetBase), asset.Metadata.FullID); 67 AssetBase temp = (AssetBase)manager.Load(typeof(AssetBase), asset.Metadata.FullID);
67 if (temp == null) 68 if (temp == null)
68 { 69 {
69 manager.Save(asset); 70 manager.Insert(asset);
70 } 71 }
71 } 72 }
72 73
diff --git a/OpenSim/Data/NHibernate/NHibernateEstateData.cs b/OpenSim/Data/NHibernate/NHibernateEstateData.cs
new file mode 100644
index 0000000..59896dd
--- /dev/null
+++ b/OpenSim/Data/NHibernate/NHibernateEstateData.cs
@@ -0,0 +1,161 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSim Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System.Reflection;
29using log4net;
30using OpenMetaverse;
31using OpenSim.Framework;
32using OpenSim.Region.Framework.Interfaces;
33using NHibernate;
34using NHibernate.Criterion;
35using System.Collections;
36using System;
37
38namespace OpenSim.Data.NHibernate
39{
40 /// <summary>
41 /// A User storage interface for the DB4o database system
42 /// </summary>
43 public class NHibernateEstateData : IEstateDataStore
44 {
45
46 #region Fields
47
48 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
49
50 public NHibernateManager manager;
51
52 public string Name
53 {
54 get { return "NHibernateEstateData"; }
55 }
56
57 public string Version
58 {
59 get { return "0.1"; }
60 }
61
62 #endregion
63
64 #region Startup and shutdown.
65
66 public void Initialise()
67 {
68 m_log.Info("[NHIBERNATE]: " + Name + " cannot be default-initialized!");
69 throw new PluginNotInitialisedException(Name);
70 }
71
72 public void Initialise(string connect)
73 {
74
75 m_log.InfoFormat("[NHIBERNATE] Initializing " + Name + ".");
76 manager = new NHibernateManager(connect, "EstateStore");
77 }
78
79 public void Dispose() { }
80
81 #endregion
82
83 #region IEstateDataStore Members
84
85 public EstateSettings LoadEstateSettings(UUID regionID)
86 {
87 EstateRegionLink link = LoadEstateRegionLink(regionID);
88
89 // Ensure that estate settings exist for the link
90 if (link != null)
91 {
92 if (manager.Load(typeof(EstateSettings), link.EstateID) == null)
93 {
94 // Delete broken link
95 manager.Delete(link);
96 link = null;
97 }
98 }
99
100 // If estate link does not exist create estate settings and link it to region.
101 if (link == null)
102 {
103 EstateSettings estateSettings = new EstateSettings();
104 //estateSettings.EstateOwner = UUID.Random();
105 //estateSettings.BlockDwell = false;
106 object identifier = manager.Insert(estateSettings);
107
108 if (identifier == null)
109 {
110 // Saving failed. Error is logged in the manager.
111 return null;
112 }
113
114 uint estateID = (uint)identifier;
115 link = new EstateRegionLink();
116 link.EstateRegionLinkID = UUID.Random();
117 link.RegionID = regionID;
118 link.EstateID = estateID;
119 manager.Insert(link);
120 }
121
122 // Load estate settings according to the existing or created link.
123 return (EstateSettings)manager.Load(typeof(EstateSettings), link.EstateID);
124 }
125
126 public void StoreEstateSettings(EstateSettings estateSettings)
127 {
128 // Estates are always updated when stored.
129 // Insert is always done via. load method as with the current API
130 // this is explicitly the only way to create region link.
131 manager.Update(estateSettings);
132 }
133
134 #endregion
135
136 #region Private Utility Methods
137 private EstateRegionLink LoadEstateRegionLink(UUID regionID)
138 {
139 ICriteria criteria = manager.GetSession().CreateCriteria(typeof(EstateRegionLink));
140 criteria.Add(Expression.Eq("RegionID", regionID));
141 IList links = criteria.List();
142
143 // Fail fast if more than one estate links exist
144 if (links.Count > 1)
145 {
146 m_log.Error("[NHIBERNATE]: Region had more than one estate linked: " + regionID);
147 throw new Exception("[NHIBERNATE]: Region had more than one estate linked: " + regionID);
148 }
149
150 if (links.Count == 1)
151 {
152 return (EstateRegionLink)links[0];
153 }
154 else
155 {
156 return null;
157 }
158 }
159 #endregion
160 }
161}
diff --git a/OpenSim/Data/NHibernate/NHibernateGridData.cs b/OpenSim/Data/NHibernate/NHibernateGridData.cs
index 836c99e..e58d1ed 100644
--- a/OpenSim/Data/NHibernate/NHibernateGridData.cs
+++ b/OpenSim/Data/NHibernate/NHibernateGridData.cs
@@ -113,7 +113,7 @@ namespace OpenSim.Data.NHibernate
113 { 113 {
114 if (manager.Load(typeof(RegionProfileData), profile.Uuid) == null) 114 if (manager.Load(typeof(RegionProfileData), profile.Uuid) == null)
115 { 115 {
116 manager.Save(profile); 116 manager.Insert(profile);
117 return DataResponse.RESPONSE_OK; 117 return DataResponse.RESPONSE_OK;
118 } 118 }
119 else 119 else
diff --git a/OpenSim/Data/NHibernate/NHibernateInventoryData.cs b/OpenSim/Data/NHibernate/NHibernateInventoryData.cs
index 0129800..7657ae5 100644
--- a/OpenSim/Data/NHibernate/NHibernateInventoryData.cs
+++ b/OpenSim/Data/NHibernate/NHibernateInventoryData.cs
@@ -42,6 +42,34 @@ namespace OpenSim.Data.NHibernate
42 42
43 public NHibernateManager manager; 43 public NHibernateManager manager;
44 44
45 /// <summary>
46 /// The plugin being loaded
47 /// </summary>
48 /// <returns>A string containing the plugin name</returns>
49 public string Name
50 {
51 get { return "NHibernate Inventory Data Interface"; }
52 }
53
54 /// <summary>
55 /// The plugins version
56 /// </summary>
57 /// <returns>A string containing the plugin version</returns>
58 public string Version
59 {
60 get
61 {
62 Module module = GetType().Module;
63 // string dllName = module.Assembly.ManifestModule.Name;
64 Version dllVersion = module.Assembly.GetName().Version;
65
66
67 return
68 string.Format("{0}.{1}.{2}.{3}", dllVersion.Major, dllVersion.Minor, dllVersion.Build,
69 dllVersion.Revision);
70 }
71 }
72
45 public void Initialise() 73 public void Initialise()
46 { 74 {
47 m_log.Info("[NHibernateInventoryData]: " + Name + " cannot be default-initialized!"); 75 m_log.Info("[NHibernateInventoryData]: " + Name + " cannot be default-initialized!");
@@ -57,6 +85,13 @@ namespace OpenSim.Data.NHibernate
57 manager = new NHibernateManager(connect, "InventoryStore"); 85 manager = new NHibernateManager(connect, "InventoryStore");
58 } 86 }
59 87
88 /// <summary>
89 /// Closes the interface
90 /// </summary>
91 public void Dispose()
92 {
93 }
94
60 /***************************************************************** 95 /*****************************************************************
61 * 96 *
62 * Basic CRUD operations on Data 97 * Basic CRUD operations on Data
@@ -92,7 +127,7 @@ namespace OpenSim.Data.NHibernate
92 { 127 {
93 if (!ExistsItem(item.ID)) 128 if (!ExistsItem(item.ID))
94 { 129 {
95 manager.Save(item); 130 manager.Insert(item);
96 } 131 }
97 else 132 else
98 { 133 {
@@ -161,7 +196,7 @@ namespace OpenSim.Data.NHibernate
161 { 196 {
162 if (!ExistsFolder(folder.ID)) 197 if (!ExistsFolder(folder.ID))
163 { 198 {
164 manager.Save(folder); 199 manager.Insert(folder);
165 } 200 }
166 else 201 else
167 { 202 {
@@ -220,41 +255,6 @@ namespace OpenSim.Data.NHibernate
220 // TODO: DataSet commit 255 // TODO: DataSet commit
221 } 256 }
222 257
223 /// <summary>
224 /// Closes the interface
225 /// </summary>
226 public void Dispose()
227 {
228 }
229
230 /// <summary>
231 /// The plugin being loaded
232 /// </summary>
233 /// <returns>A string containing the plugin name</returns>
234 public string Name
235 {
236 get { return "NHibernate Inventory Data Interface"; }
237 }
238
239 /// <summary>
240 /// The plugins version
241 /// </summary>
242 /// <returns>A string containing the plugin version</returns>
243 public string Version
244 {
245 get
246 {
247 Module module = GetType().Module;
248 // string dllName = module.Assembly.ManifestModule.Name;
249 Version dllVersion = module.Assembly.GetName().Version;
250
251
252 return
253 string.Format("{0}.{1}.{2}.{3}", dllVersion.Major, dllVersion.Minor, dllVersion.Build,
254 dllVersion.Revision);
255 }
256 }
257
258 // Move seems to be just update 258 // Move seems to be just update
259 259
260 public void moveInventoryFolder(InventoryFolderBase folder) 260 public void moveInventoryFolder(InventoryFolderBase folder)
diff --git a/OpenSim/Data/NHibernate/NHibernateManager.cs b/OpenSim/Data/NHibernate/NHibernateManager.cs
index 51467da..26bc219 100644
--- a/OpenSim/Data/NHibernate/NHibernateManager.cs
+++ b/OpenSim/Data/NHibernate/NHibernateManager.cs
@@ -131,25 +131,25 @@ namespace OpenSim.Data.NHibernate
131 RunMigration(dialect, assembly, store); 131 RunMigration(dialect, assembly, store);
132 } 132 }
133 133
134 public object Load(Type type, UUID uuid) 134 public object Load(Type type, Object id)
135 { 135 {
136 using (IStatelessSession session = sessionFactory.OpenStatelessSession()) 136 using (IStatelessSession session = sessionFactory.OpenStatelessSession())
137 { 137 {
138 object obj = null; 138 object obj = null;
139 try 139 try
140 { 140 {
141 obj = session.Get(type.FullName, uuid); 141 obj = session.Get(type.FullName, id);
142 } 142 }
143 catch (Exception e) 143 catch (Exception e)
144 { 144 {
145 m_log.ErrorFormat("[NHIBERNATE] {0} of id {1} loading threw exception: "+ e.ToString(), type.Name, uuid); 145 m_log.ErrorFormat("[NHIBERNATE] {0} of id {1} loading threw exception: " + e.ToString(), type.Name, id);
146 } 146 }
147 return obj; 147 return obj;
148 } 148 }
149 149
150 } 150 }
151 151
152 public bool Save(object obj) 152 public object Insert(object obj)
153 { 153 {
154 try 154 try
155 { 155 {
@@ -157,16 +157,16 @@ namespace OpenSim.Data.NHibernate
157 { 157 {
158 using (ITransaction transaction=session.BeginTransaction()) 158 using (ITransaction transaction=session.BeginTransaction())
159 { 159 {
160 session.Insert(obj); 160 Object identifier=session.Insert(obj);
161 transaction.Commit(); 161 transaction.Commit();
162 return true; 162 return identifier;
163 } 163 }
164 } 164 }
165 } 165 }
166 catch (Exception e) 166 catch (Exception e)
167 { 167 {
168 m_log.Error("[NHIBERNATE] issue inserting object ", e); 168 m_log.Error("[NHIBERNATE] issue inserting object ", e);
169 return false; 169 return null;
170 } 170 }
171 } 171 }
172 172
diff --git a/OpenSim/Data/NHibernate/NHibernateRegionData.cs b/OpenSim/Data/NHibernate/NHibernateRegionData.cs
index 0cd3969..78db52d 100644
--- a/OpenSim/Data/NHibernate/NHibernateRegionData.cs
+++ b/OpenSim/Data/NHibernate/NHibernateRegionData.cs
@@ -70,7 +70,7 @@ namespace OpenSim.Data.NHibernate
70 } 70 }
71 else 71 else
72 { 72 {
73 manager.Save(rs); 73 manager.Insert(rs);
74 } 74 }
75 } 75 }
76 76
@@ -82,7 +82,7 @@ namespace OpenSim.Data.NHibernate
82 { 82 {
83 regionSettings = new RegionSettings(); 83 regionSettings = new RegionSettings();
84 regionSettings.RegionUUID = regionUUID; 84 regionSettings.RegionUUID = regionUUID;
85 manager.Save(regionSettings); 85 manager.Insert(regionSettings);
86 } 86 }
87 87
88 regionSettings.OnSave += StoreRegionSettings; 88 regionSettings.OnSave += StoreRegionSettings;
@@ -105,7 +105,7 @@ namespace OpenSim.Data.NHibernate
105 else 105 else
106 { 106 {
107 m_log.InfoFormat("[NHIBERNATE] saving object {0}", p.UUID); 107 m_log.InfoFormat("[NHIBERNATE] saving object {0}", p.UUID);
108 manager.Save(p); 108 manager.Insert(p);
109 } 109 }
110 110
111 } 111 }
@@ -129,7 +129,7 @@ namespace OpenSim.Data.NHibernate
129 else 129 else
130 { 130 {
131 m_log.InfoFormat("[NHIBERNATE] saving terrain {0}", t.RegionID); 131 m_log.InfoFormat("[NHIBERNATE] saving terrain {0}", t.RegionID);
132 manager.Save(t); 132 manager.Insert(t);
133 } 133 }
134 134
135 } 135 }
@@ -394,7 +394,7 @@ namespace OpenSim.Data.NHibernate
394 394
395 foreach (TaskInventoryItem i in items) 395 foreach (TaskInventoryItem i in items)
396 { 396 {
397 manager.Save(i); 397 manager.Insert(i);
398 398
399 } 399 }
400 } 400 }
diff --git a/OpenSim/Data/NHibernate/NHibernateUserData.cs b/OpenSim/Data/NHibernate/NHibernateUserData.cs
index 7dfdcb5..3f1f260 100644
--- a/OpenSim/Data/NHibernate/NHibernateUserData.cs
+++ b/OpenSim/Data/NHibernate/NHibernateUserData.cs
@@ -102,7 +102,7 @@ namespace OpenSim.Data.NHibernate
102 if (!ExistsUser(profile.ID)) 102 if (!ExistsUser(profile.ID))
103 { 103 {
104 m_log.InfoFormat("[NHIBERNATE] AddNewUserProfile {0}", profile.ID); 104 m_log.InfoFormat("[NHIBERNATE] AddNewUserProfile {0}", profile.ID);
105 manager.Save(profile); 105 manager.Insert(profile);
106 // Agent should not be saved according to BasicUserTest.T015_UserPersistency() 106 // Agent should not be saved according to BasicUserTest.T015_UserPersistency()
107 // SetAgentData(profile.ID, profile.CurrentAgent); 107 // SetAgentData(profile.ID, profile.CurrentAgent);
108 108
@@ -169,7 +169,7 @@ namespace OpenSim.Data.NHibernate
169 manager.Delete(old); 169 manager.Delete(old);
170 } 170 }
171 171
172 manager.Save(agent); 172 manager.Insert(agent);
173 173
174 } 174 }
175 175
@@ -245,11 +245,11 @@ namespace OpenSim.Data.NHibernate
245 { 245 {
246 if (!FriendRelationExists(ownerId,friendId)) 246 if (!FriendRelationExists(ownerId,friendId))
247 { 247 {
248 manager.Save(new UserFriend(UUID.Random(), ownerId, friendId, perms)); 248 manager.Insert(new UserFriend(UUID.Random(), ownerId, friendId, perms));
249 } 249 }
250 if (!FriendRelationExists(friendId, ownerId)) 250 if (!FriendRelationExists(friendId, ownerId))
251 { 251 {
252 manager.Save(new UserFriend(UUID.Random(), friendId, ownerId, perms)); 252 manager.Insert(new UserFriend(UUID.Random(), friendId, ownerId, perms));
253 } 253 }
254 return; 254 return;
255 } 255 }
@@ -426,7 +426,7 @@ namespace OpenSim.Data.NHibernate
426 } 426 }
427 else 427 else
428 { 428 {
429 manager.Save(appearance); 429 manager.Insert(appearance);
430 } 430 }
431 } 431 }
432 432
diff --git a/OpenSim/Data/NHibernate/Resources/EstateRegionLink.hbm.xml b/OpenSim/Data/NHibernate/Resources/EstateRegionLink.hbm.xml
new file mode 100644
index 0000000..91bddee
--- /dev/null
+++ b/OpenSim/Data/NHibernate/Resources/EstateRegionLink.hbm.xml
@@ -0,0 +1,12 @@
1<?xml version="1.0" encoding="utf-8" ?>
2<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
3 <class name="OpenSim.Data.NHibernate.EstateRegionLink, OpenSim.Data.NHibernate" table="EstateRegionLink" lazy="false">
4 <id name="EstateRegionLinkID" column="EstateRegionLinkID" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate">
5 <generator class="assigned" />
6 </id>
7
8 <property name="EstateID" type="OpenSim.Data.NHibernate.UInt32Type, OpenSim.Data.NHibernate" />
9 <property name="RegionID" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate" />
10
11 </class>
12</hibernate-mapping>
diff --git a/OpenSim/Data/NHibernate/Resources/EstateSettings.hbm.xml b/OpenSim/Data/NHibernate/Resources/EstateSettings.hbm.xml
new file mode 100644
index 0000000..1ff0f10
--- /dev/null
+++ b/OpenSim/Data/NHibernate/Resources/EstateSettings.hbm.xml
@@ -0,0 +1,39 @@
1<?xml version="1.0" encoding="utf-8" ?>
2<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
3 <class name="OpenSim.Framework.EstateSettings, OpenSim.Framework" table="EstateSettings" lazy="false">
4
5 <id name="EstateID" column="EstateID" type="OpenSim.Data.NHibernate.UInt32Type, OpenSim.Data.NHibernate">
6 <generator class="increment" />
7 </id>
8
9 <property name="ParentEstateID" type="OpenSim.Data.NHibernate.UInt32Type, OpenSim.Data.NHibernate" />
10 <property name="EstateOwner" column="EstateOwnerID" type="OpenSim.Data.NHibernate.UUIDUserType, OpenSim.Data.NHibernate" />
11
12 <property name="EstateName" column="Name" type="String" length="64" />
13
14 <property name="RedirectGridX" type="System.Int32" />
15 <property name="RedirectGridY" type="System.Int32" />
16
17 <property name="BillableFactor" type="System.Single" />
18 <property name="PricePerMeter" type="System.Int32" />
19 <property name="SunPosition" type="System.Double" />
20
21 <property name="UseGlobalTime" type="System.Boolean" />
22 <property name="FixedSun" type="System.Boolean" />
23 <property name="AllowVoice" type="System.Boolean" />
24 <property name="AllowDirectTeleport" type="System.Boolean" />
25 <property name="ResetHomeOnTeleport" type="System.Boolean" />
26 <property name="PublicAccess" type="System.Boolean" />
27 <property name="DenyAnonymous" type="System.Boolean" />
28 <property name="DenyIdentified" type="System.Boolean" />
29 <property name="DenyTransacted" type="System.Boolean" />
30 <property name="DenyMinors" type="System.Boolean" />
31 <property name="BlockDwell" type="System.Boolean" />
32 <property name="EstateSkipScripts" type="System.Boolean" />
33 <property name="TaxFree" type="System.Boolean" />
34 <property name="AbuseEmailToEstateOwner" type="System.Boolean" />
35
36 <property name="AbuseEmail" type="String" length="255" />
37
38 </class>
39</hibernate-mapping>
diff --git a/OpenSim/Data/NHibernate/Resources/MigrationSyntaxDifferences.txt b/OpenSim/Data/NHibernate/Resources/MigrationSyntaxDifferences.txt
new file mode 100644
index 0000000..f3d86df
--- /dev/null
+++ b/OpenSim/Data/NHibernate/Resources/MigrationSyntaxDifferences.txt
@@ -0,0 +1,14 @@
1?This file describes the differences in schema creation and migration scripts.
2
3MySQL is used as reference script against which differences are listed.
4
5Generally MySQL create table options should be removed for other databases.
6
7_PostgreSQL_
8* DOUBLE->DOUBLE PRECISION
9* BIT->BOOLEAN
10
11_MsSql_
12* VARCHAR->NVARCHAR
13* Remove DEFAULT-keywords
14* DOUBLE->REAL
diff --git a/OpenSim/Data/NHibernate/Resources/MsSql2005Dialect/001_EstateStore.sql b/OpenSim/Data/NHibernate/Resources/MsSql2005Dialect/001_EstateStore.sql
new file mode 100644
index 0000000..893e2a2
--- /dev/null
+++ b/OpenSim/Data/NHibernate/Resources/MsSql2005Dialect/001_EstateStore.sql
@@ -0,0 +1,40 @@
1CREATE TABLE EstateSettings (
2 EstateID INT NOT NULL,
3 ParentEstateID INT NULL,
4 EstateOwnerID NVARCHAR(36) NULL,
5 Name NVARCHAR(64) NULL,
6 RedirectGridX INT NULL,
7 RedirectGridY INT NULL,
8 BillableFactor REAL NULL,
9 PricePerMeter INT NULL,
10 SunPosition REAL NULL,
11
12 UseGlobalTime BIT NULL,
13 FixedSun BIT NULL,
14 AllowVoice BIT NULL,
15 AllowDirectTeleport BIT NULL,
16 ResetHomeOnTeleport BIT NULL,
17 PublicAccess BIT NULL,
18 DenyAnonymous BIT NULL,
19 DenyIdentified BIT NULL,
20 DenyTransacted BIT NULL,
21 DenyMinors BIT NULL,
22 BlockDwell BIT NULL,
23 EstateSkipScripts BIT NULL,
24 TaxFree BIT NULL,
25 AbuseEmailToEstateOwner BIT NULL,
26
27 AbuseEmail NVARCHAR(255) NULL,
28
29 PRIMARY KEY (EstateID)
30);
31
32CREATE TABLE EstateRegionLink (
33 EstateRegionLinkID NVARCHAR(36) NOT NULL,
34 EstateID INT NULL,
35 RegionID NVARCHAR(36) NULL,
36 PRIMARY KEY (EstateRegionLinkID)
37);
38
39CREATE INDEX EstateRegionLinkEstateIDIndex ON EstateRegionLink (EstateID);
40CREATE 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
new file mode 100644
index 0000000..a791bc6
--- /dev/null
+++ b/OpenSim/Data/NHibernate/Resources/MySQLDialect/001_EstateStore.sql
@@ -0,0 +1,40 @@
1CREATE TABLE EstateSettings (
2 EstateID INT NOT NULL,
3 ParentEstateID INT DEFAULT NULL,
4 EstateOwnerID VARCHAR(36) DEFAULT NULL,
5 Name VARCHAR(64) DEFAULT NULL,
6 RedirectGridX INT DEFAULT NULL,
7 RedirectGridY INT DEFAULT NULL,
8 BillableFactor DOUBLE DEFAULT NULL,
9 PricePerMeter INT DEFAULT NULL,
10 SunPosition DOUBLE DEFAULT NULL,
11
12 UseGlobalTime BIT DEFAULT NULL,
13 FixedSun BIT DEFAULT NULL,
14 AllowVoice BIT DEFAULT NULL,
15 AllowDirectTeleport BIT DEFAULT NULL,
16 ResetHomeOnTeleport BIT DEFAULT NULL,
17 PublicAccess BIT DEFAULT NULL,
18 DenyAnonymous BIT DEFAULT NULL,
19 DenyIdentified BIT DEFAULT NULL,
20 DenyTransacted BIT DEFAULT NULL,
21 DenyMinors BIT DEFAULT NULL,
22 BlockDwell BIT DEFAULT NULL,
23 EstateSkipScripts BIT DEFAULT NULL,
24 TaxFree BIT DEFAULT NULL,
25 AbuseEmailToEstateOwner BIT DEFAULT NULL,
26
27 AbuseEmail VARCHAR(255) DEFAULT NULL,
28
29 PRIMARY KEY (EstateID)
30) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Rev. 1';
31
32CREATE TABLE EstateRegionLink (
33 EstateRegionLinkID VARCHAR(36) NOT NULL,
34 EstateID INT DEFAULT NULL,
35 RegionID VARCHAR(36) DEFAULT NULL,
36 PRIMARY KEY (EstateRegionLinkID)
37) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Rev. 1';
38
39CREATE INDEX EstateRegionLinkEstateIDIndex ON EstateRegionLink (EstateID);
40CREATE 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
new file mode 100644
index 0000000..421a0c4
--- /dev/null
+++ b/OpenSim/Data/NHibernate/Resources/PostgreSQLDialect/001_EstateStore.sql
@@ -0,0 +1,40 @@
1CREATE TABLE EstateSettings (
2 EstateID INT NOT NULL,
3 ParentEstateID INT DEFAULT NULL,
4 EstateOwnerID VARCHAR(36) DEFAULT NULL,
5 Name VARCHAR(64) DEFAULT NULL,
6 RedirectGridX INT DEFAULT NULL,
7 RedirectGridY INT DEFAULT NULL,
8 BillableFactor DOUBLE PRECISION DEFAULT NULL,
9 PricePerMeter INT DEFAULT NULL,
10 SunPosition DOUBLE PRECISION DEFAULT NULL,
11
12 UseGlobalTime BOOLEAN DEFAULT NULL,
13 FixedSun BOOLEAN DEFAULT NULL,
14 AllowVoice BOOLEAN DEFAULT NULL,
15 AllowDirectTeleport BOOLEAN DEFAULT NULL,
16 ResetHomeOnTeleport BOOLEAN DEFAULT NULL,
17 PublicAccess BOOLEAN DEFAULT NULL,
18 DenyAnonymous BOOLEAN DEFAULT NULL,
19 DenyIdentified BOOLEAN DEFAULT NULL,
20 DenyTransacted BOOLEAN DEFAULT NULL,
21 DenyMinors BOOLEAN DEFAULT NULL,
22 BlockDwell BOOLEAN DEFAULT NULL,
23 EstateSkipScripts BOOLEAN DEFAULT NULL,
24 TaxFree BOOLEAN DEFAULT NULL,
25 AbuseEmailToEstateOwner BOOLEAN DEFAULT NULL,
26
27 AbuseEmail VARCHAR(255) DEFAULT NULL,
28
29 PRIMARY KEY (EstateID)
30);
31
32CREATE TABLE EstateRegionLink (
33 EstateRegionLinkID VARCHAR(36) NOT NULL,
34 EstateID INT DEFAULT NULL,
35 RegionID VARCHAR(36) DEFAULT NULL,
36 PRIMARY KEY (EstateRegionLinkID)
37);
38
39CREATE INDEX EstateRegionLinkEstateIDIndex ON EstateRegionLink (EstateID);
40CREATE 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
new file mode 100644
index 0000000..b16ae82
--- /dev/null
+++ b/OpenSim/Data/NHibernate/Resources/SQLiteDialect/001_EstateStore.sql
@@ -0,0 +1,40 @@
1CREATE TABLE EstateSettings (
2 EstateID INT NOT NULL,
3 ParentEstateID INT DEFAULT NULL,
4 EstateOwnerID VARCHAR(36) DEFAULT NULL,
5 Name VARCHAR(64) DEFAULT NULL,
6 RedirectGridX INT DEFAULT NULL,
7 RedirectGridY INT DEFAULT NULL,
8 BillableFactor DOUBLE DEFAULT NULL,
9 PricePerMeter INT DEFAULT NULL,
10 SunPosition DOUBLE DEFAULT NULL,
11
12 UseGlobalTime BIT DEFAULT NULL,
13 FixedSun BIT DEFAULT NULL,
14 AllowVoice BIT DEFAULT NULL,
15 AllowDirectTeleport BIT DEFAULT NULL,
16 ResetHomeOnTeleport BIT DEFAULT NULL,
17 PublicAccess BIT DEFAULT NULL,
18 DenyAnonymous BIT DEFAULT NULL,
19 DenyIdentified BIT DEFAULT NULL,
20 DenyTransacted BIT DEFAULT NULL,
21 DenyMinors BIT DEFAULT NULL,
22 BlockDwell BIT DEFAULT NULL,
23 EstateSkipScripts BIT DEFAULT NULL,
24 TaxFree BIT DEFAULT NULL,
25 AbuseEmailToEstateOwner BIT DEFAULT NULL,
26
27 AbuseEmail VARCHAR(255) DEFAULT NULL,
28
29 PRIMARY KEY (EstateID)
30);
31
32CREATE TABLE EstateRegionLink (
33 EstateRegionLinkID VARCHAR(36) NOT NULL,
34 EstateID INT DEFAULT NULL,
35 RegionID VARCHAR(36) DEFAULT NULL,
36 PRIMARY KEY (EstateRegionLinkID)
37);
38
39CREATE INDEX EstateRegionLinkEstateIDIndex ON EstateRegionLink (EstateID);
40CREATE INDEX EstateRegionLinkERegionIDIndex ON EstateRegionLink (RegionID);
diff --git a/OpenSim/Data/NHibernate/Tests/NHibernateMsSqlEstateTest.cs b/OpenSim/Data/NHibernate/Tests/NHibernateMsSqlEstateTest.cs
new file mode 100644
index 0000000..ea3c1eb
--- /dev/null
+++ b/OpenSim/Data/NHibernate/Tests/NHibernateMsSqlEstateTest.cs
@@ -0,0 +1,77 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSim Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using NUnit.Framework;
30using OpenSim.Data.Tests;
31
32namespace OpenSim.Data.NHibernate.Tests
33{
34 [TestFixture]
35 public class NHibernateMsSqlEstateTest : BasicEstateTest
36 {
37 public string file;
38 public NHibernateManager database;
39
40 [TestFixtureSetUp]
41 public void Init()
42 {
43 SuperInit();
44 // If we manage to connect to the database with the user
45 // and password above it is our test database, and run
46 // these tests. If anything goes wrong, ignore these
47 // tests.
48 try
49 {
50 string connect = "MsSql2005Dialect;SqlClientDriver;Data Source=127.0.0.1;Network Library=DBMSSOCN;Initial Catalog=opensim-nunit;User ID=opensim-nunit;Password=opensim-nunit";
51
52 db = new NHibernateEstateData();
53 db.Initialise(connect);
54 database = ((NHibernateEstateData)db).manager;
55 }
56 catch (Exception e)
57 {
58 Console.WriteLine("Exception {0}", e);
59 Assert.Ignore();
60 }
61 }
62
63 [TestFixtureTearDown]
64 public void Cleanup()
65 {
66 if (db != null)
67 {
68 ((NHibernateEstateData)db).Dispose();
69 }
70 if (database != null)
71 {
72 database.DropSchema();
73 }
74 }
75
76 }
77}
diff --git a/OpenSim/Data/NHibernate/Tests/NHibernateMySqlEstateTest.cs b/OpenSim/Data/NHibernate/Tests/NHibernateMySqlEstateTest.cs
new file mode 100644
index 0000000..651ff4e
--- /dev/null
+++ b/OpenSim/Data/NHibernate/Tests/NHibernateMySqlEstateTest.cs
@@ -0,0 +1,76 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSim Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using NUnit.Framework;
30using OpenSim.Data.Tests;
31
32namespace OpenSim.Data.NHibernate.Tests
33{
34 [TestFixture]
35 public class NHibernateMySQLEstateTest : BasicEstateTest
36 {
37 public string file;
38 public NHibernateManager database;
39 public string connect = "MySQL5Dialect;MySqlDataDriver;Server=localhost;Database=opensim-nunit;User ID=opensim-nunit;Password=opensim-nunit";
40
41 [TestFixtureSetUp]
42 public void Init()
43 {
44 SuperInit();
45 // If we manage to connect to the database with the user
46 // and password above it is our test database, and run
47 // these tests. If anything goes wrong, ignore these
48 // tests.
49 try
50 {
51 db = new NHibernateEstateData();
52 db.Initialise(connect);
53 database = ((NHibernateEstateData)db).manager;
54 }
55 catch (Exception e)
56 {
57 Console.WriteLine("Exception {0}", e);
58 Assert.Ignore();
59 }
60 }
61
62 [TestFixtureTearDown]
63 public void Cleanup()
64 {
65 if (db != null)
66 {
67 ((NHibernateEstateData)db).Dispose();
68 }
69 if (database != null)
70 {
71 database.DropSchema();
72 }
73 }
74
75 }
76}
diff --git a/OpenSim/Data/NHibernate/Tests/NHibernatePostgreSQLEstateTest.cs b/OpenSim/Data/NHibernate/Tests/NHibernatePostgreSQLEstateTest.cs
new file mode 100644
index 0000000..1d113c7
--- /dev/null
+++ b/OpenSim/Data/NHibernate/Tests/NHibernatePostgreSQLEstateTest.cs
@@ -0,0 +1,76 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSim Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using NUnit.Framework;
30using OpenSim.Data.Tests;
31
32namespace OpenSim.Data.NHibernate.Tests
33{
34 [TestFixture]
35 public class NHibernatePostgreSQLEstateTest : BasicEstateTest
36 {
37 public string file;
38 public NHibernateManager database;
39 public string connect = "PostgreSQLDialect;NpgsqlDriver;Server=localhost;Database=opensim-nunit;User ID=opensim-nunit;Password=opensim-nunit;";
40
41 [TestFixtureSetUp]
42 public void Init()
43 {
44 SuperInit();
45 // If we manage to connect to the database with the user
46 // and password above it is our test database, and run
47 // these tests. If anything goes wrong, ignore these
48 // tests.
49 try
50 {
51 db = new NHibernateEstateData();
52 db.Initialise(connect);
53 database = ((NHibernateEstateData)db).manager;
54 }
55 catch (Exception e)
56 {
57 Console.WriteLine("Exception {0}", e);
58 Assert.Ignore();
59 }
60 }
61
62 [TestFixtureTearDown]
63 public void Cleanup()
64 {
65 if (db != null)
66 {
67 ((NHibernateEstateData)db).Dispose();
68 }
69 if (database != null)
70 {
71 database.DropSchema();
72 }
73 }
74
75 }
76}
diff --git a/OpenSim/Data/NHibernate/Tests/NHibernateSQLiteEstateTest.cs b/OpenSim/Data/NHibernate/Tests/NHibernateSQLiteEstateTest.cs
new file mode 100644
index 0000000..86fb573
--- /dev/null
+++ b/OpenSim/Data/NHibernate/Tests/NHibernateSQLiteEstateTest.cs
@@ -0,0 +1,78 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSim Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.IO;
30using NUnit.Framework;
31using OpenSim.Data.Tests;
32
33namespace OpenSim.Data.NHibernate.Tests
34{
35 [TestFixture]
36 public class NHibernateSQLiteEstateTest : BasicEstateTest
37 {
38 public string file;
39 public NHibernateManager database;
40
41 [TestFixtureSetUp]
42 public void Init()
43 {
44 SuperInit();
45 // If we manage to connect to the database with the user
46 // and password above it is our test database, and run
47 // these tests. If anything goes wrong, ignore these
48 // tests.
49 try
50 {
51 string connect = "SQLiteDialect;SQLite20Driver;Data Source=" + Path.GetTempFileName() + ".db;Version=3";
52
53 db = new NHibernateEstateData();
54 db.Initialise(connect);
55 database = ((NHibernateEstateData)db).manager;
56 }
57 catch (Exception e)
58 {
59 Console.WriteLine("Exception {0}", e);
60 Assert.Ignore();
61 }
62 }
63
64 [TestFixtureTearDown]
65 public void Cleanup()
66 {
67 if (db != null)
68 {
69 ((NHibernateEstateData)db).Dispose();
70 }
71 if (database != null)
72 {
73 database.DropSchema();
74 }
75 }
76
77 }
78}
diff --git a/OpenSim/Data/Tests/BasicEstateTest.cs b/OpenSim/Data/Tests/BasicEstateTest.cs
index 24c25ec..d0f7a8b 100644
--- a/OpenSim/Data/Tests/BasicEstateTest.cs
+++ b/OpenSim/Data/Tests/BasicEstateTest.cs
@@ -73,6 +73,7 @@ namespace OpenSim.Data.Tests
73 double sunPosition = 7; 73 double sunPosition = 7;
74 bool allowVoice = true; 74 bool allowVoice = true;
75 bool allowDirectTeleport = true; 75 bool allowDirectTeleport = true;
76 bool resetHomeOnTeleport = true;
76 bool denyAnonymous = true; 77 bool denyAnonymous = true;
77 bool denyIdentified = true; 78 bool denyIdentified = true;
78 bool denyTransacted = true; 79 bool denyTransacted = true;
@@ -103,6 +104,7 @@ namespace OpenSim.Data.Tests
103 es.SunPosition = sunPosition; 104 es.SunPosition = sunPosition;
104 es.AllowVoice = allowVoice; 105 es.AllowVoice = allowVoice;
105 es.AllowDirectTeleport = allowDirectTeleport; 106 es.AllowDirectTeleport = allowDirectTeleport;
107 es.ResetHomeOnTeleport = resetHomeOnTeleport;
106 es.DenyAnonymous = denyAnonymous; 108 es.DenyAnonymous = denyAnonymous;
107 es.DenyIdentified = denyIdentified; 109 es.DenyIdentified = denyIdentified;
108 es.DenyTransacted = denyTransacted; 110 es.DenyTransacted = denyTransacted;
@@ -133,6 +135,7 @@ namespace OpenSim.Data.Tests
133 Assert.That(sunPosition, Is.EqualTo(nes.SunPosition)); 135 Assert.That(sunPosition, Is.EqualTo(nes.SunPosition));
134 Assert.That(allowVoice, Is.EqualTo(nes.AllowVoice)); 136 Assert.That(allowVoice, Is.EqualTo(nes.AllowVoice));
135 Assert.That(allowDirectTeleport, Is.EqualTo(nes.AllowDirectTeleport)); 137 Assert.That(allowDirectTeleport, Is.EqualTo(nes.AllowDirectTeleport));
138 Assert.That(resetHomeOnTeleport, Is.EqualTo(nes.ResetHomeOnTeleport));
136 Assert.That(denyAnonymous, Is.EqualTo(nes.DenyAnonymous)); 139 Assert.That(denyAnonymous, Is.EqualTo(nes.DenyAnonymous));
137 Assert.That(denyIdentified, Is.EqualTo(nes.DenyIdentified)); 140 Assert.That(denyIdentified, Is.EqualTo(nes.DenyIdentified));
138 Assert.That(denyTransacted, Is.EqualTo(nes.DenyTransacted)); 141 Assert.That(denyTransacted, Is.EqualTo(nes.DenyTransacted));