diff options
Diffstat (limited to 'OpenSim/Data/Tests')
-rw-r--r-- | OpenSim/Data/Tests/AssetTests.cs | 24 | ||||
-rw-r--r-- | OpenSim/Data/Tests/BasicDataServiceTest.cs | 14 | ||||
-rw-r--r-- | OpenSim/Data/Tests/DefaultTestConns.cs | 10 | ||||
-rw-r--r-- | OpenSim/Data/Tests/EstateTests.cs | 18 | ||||
-rw-r--r-- | OpenSim/Data/Tests/InventoryTests.cs | 33 | ||||
-rw-r--r-- | OpenSim/Data/Tests/PropertyScrambler.cs | 2 | ||||
-rw-r--r-- | OpenSim/Data/Tests/RegionTests.cs | 161 | ||||
-rw-r--r-- | OpenSim/Data/Tests/Resources/TestDataConnections.ini | 4 |
8 files changed, 143 insertions, 123 deletions
diff --git a/OpenSim/Data/Tests/AssetTests.cs b/OpenSim/Data/Tests/AssetTests.cs index 5d7b169..70880cf 100644 --- a/OpenSim/Data/Tests/AssetTests.cs +++ b/OpenSim/Data/Tests/AssetTests.cs | |||
@@ -110,7 +110,7 @@ namespace OpenSim.Data.Tests | |||
110 | public void T010_StoreReadVerifyAssets() | 110 | public void T010_StoreReadVerifyAssets() |
111 | { | 111 | { |
112 | TestHelpers.InMethod(); | 112 | TestHelpers.InMethod(); |
113 | 113 | ||
114 | AssetBase a1 = new AssetBase(uuid1, "asset one", (sbyte)AssetType.Texture, critter1.ToString()); | 114 | AssetBase a1 = new AssetBase(uuid1, "asset one", (sbyte)AssetType.Texture, critter1.ToString()); |
115 | AssetBase a2 = new AssetBase(uuid2, "asset two", (sbyte)AssetType.Texture, critter2.ToString()); | 115 | AssetBase a2 = new AssetBase(uuid2, "asset two", (sbyte)AssetType.Texture, critter2.ToString()); |
116 | AssetBase a3 = new AssetBase(uuid3, "asset three", (sbyte)AssetType.Texture, critter3.ToString()); | 116 | AssetBase a3 = new AssetBase(uuid3, "asset three", (sbyte)AssetType.Texture, critter3.ToString()); |
@@ -125,14 +125,20 @@ namespace OpenSim.Data.Tests | |||
125 | m_db.StoreAsset(a1); | 125 | m_db.StoreAsset(a1); |
126 | m_db.StoreAsset(a2); | 126 | m_db.StoreAsset(a2); |
127 | m_db.StoreAsset(a3); | 127 | m_db.StoreAsset(a3); |
128 | 128 | a1.UploadAttempts = 0; | |
129 | a2.UploadAttempts = 0; | ||
130 | a3.UploadAttempts = 0; | ||
131 | |||
129 | AssetBase a1a = m_db.GetAsset(uuid1); | 132 | AssetBase a1a = m_db.GetAsset(uuid1); |
133 | a1a.UploadAttempts = 0; | ||
130 | Assert.That(a1a, Constraints.PropertyCompareConstraint(a1)); | 134 | Assert.That(a1a, Constraints.PropertyCompareConstraint(a1)); |
131 | 135 | ||
132 | AssetBase a2a = m_db.GetAsset(uuid2); | 136 | AssetBase a2a = m_db.GetAsset(uuid2); |
137 | a2a.UploadAttempts = 0; | ||
133 | Assert.That(a2a, Constraints.PropertyCompareConstraint(a2)); | 138 | Assert.That(a2a, Constraints.PropertyCompareConstraint(a2)); |
134 | 139 | ||
135 | AssetBase a3a = m_db.GetAsset(uuid3); | 140 | AssetBase a3a = m_db.GetAsset(uuid3); |
141 | a3a.UploadAttempts = 0; | ||
136 | Assert.That(a3a, Constraints.PropertyCompareConstraint(a3)); | 142 | Assert.That(a3a, Constraints.PropertyCompareConstraint(a3)); |
137 | 143 | ||
138 | scrambler.Scramble(a1a); | 144 | scrambler.Scramble(a1a); |
@@ -142,14 +148,20 @@ namespace OpenSim.Data.Tests | |||
142 | m_db.StoreAsset(a1a); | 148 | m_db.StoreAsset(a1a); |
143 | m_db.StoreAsset(a2a); | 149 | m_db.StoreAsset(a2a); |
144 | m_db.StoreAsset(a3a); | 150 | m_db.StoreAsset(a3a); |
151 | a1a.UploadAttempts = 0; | ||
152 | a2a.UploadAttempts = 0; | ||
153 | a3a.UploadAttempts = 0; | ||
145 | 154 | ||
146 | AssetBase a1b = m_db.GetAsset(uuid1); | 155 | AssetBase a1b = m_db.GetAsset(uuid1); |
156 | a1b.UploadAttempts = 0; | ||
147 | Assert.That(a1b, Constraints.PropertyCompareConstraint(a1a)); | 157 | Assert.That(a1b, Constraints.PropertyCompareConstraint(a1a)); |
148 | 158 | ||
149 | AssetBase a2b = m_db.GetAsset(uuid2); | 159 | AssetBase a2b = m_db.GetAsset(uuid2); |
160 | a2b.UploadAttempts = 0; | ||
150 | Assert.That(a2b, Constraints.PropertyCompareConstraint(a2a)); | 161 | Assert.That(a2b, Constraints.PropertyCompareConstraint(a2a)); |
151 | 162 | ||
152 | AssetBase a3b = m_db.GetAsset(uuid3); | 163 | AssetBase a3b = m_db.GetAsset(uuid3); |
164 | a3b.UploadAttempts = 0; | ||
153 | Assert.That(a3b, Constraints.PropertyCompareConstraint(a3a)); | 165 | Assert.That(a3b, Constraints.PropertyCompareConstraint(a3a)); |
154 | 166 | ||
155 | bool[] exist = m_db.AssetsExist(new[] { uuid1, uuid2, uuid3 }); | 167 | bool[] exist = m_db.AssetsExist(new[] { uuid1, uuid2, uuid3 }); |
@@ -178,7 +190,7 @@ namespace OpenSim.Data.Tests | |||
178 | public void T020_CheckForWeirdCreatorID() | 190 | public void T020_CheckForWeirdCreatorID() |
179 | { | 191 | { |
180 | TestHelpers.InMethod(); | 192 | TestHelpers.InMethod(); |
181 | 193 | ||
182 | // It is expected that eventually the CreatorID might be an arbitrary string (an URI) | 194 | // It is expected that eventually the CreatorID might be an arbitrary string (an URI) |
183 | // rather than a valid UUID (?). This test is to make sure that the database layer does not | 195 | // rather than a valid UUID (?). This test is to make sure that the database layer does not |
184 | // attempt to convert CreatorID to GUID, but just passes it both ways as a string. | 196 | // attempt to convert CreatorID to GUID, but just passes it both ways as a string. |
@@ -190,16 +202,22 @@ namespace OpenSim.Data.Tests | |||
190 | a3.Data = data1; | 202 | a3.Data = data1; |
191 | 203 | ||
192 | m_db.StoreAsset(a1); | 204 | m_db.StoreAsset(a1); |
205 | a1.UploadAttempts = 0; | ||
193 | m_db.StoreAsset(a2); | 206 | m_db.StoreAsset(a2); |
207 | a2.UploadAttempts = 0; | ||
194 | m_db.StoreAsset(a3); | 208 | m_db.StoreAsset(a3); |
209 | a3.UploadAttempts = 0; | ||
195 | 210 | ||
196 | AssetBase a1a = m_db.GetAsset(uuid1); | 211 | AssetBase a1a = m_db.GetAsset(uuid1); |
212 | a1a.UploadAttempts = 0; | ||
197 | Assert.That(a1a, Constraints.PropertyCompareConstraint(a1)); | 213 | Assert.That(a1a, Constraints.PropertyCompareConstraint(a1)); |
198 | 214 | ||
199 | AssetBase a2a = m_db.GetAsset(uuid2); | 215 | AssetBase a2a = m_db.GetAsset(uuid2); |
216 | a2a.UploadAttempts = 0; | ||
200 | Assert.That(a2a, Constraints.PropertyCompareConstraint(a2)); | 217 | Assert.That(a2a, Constraints.PropertyCompareConstraint(a2)); |
201 | 218 | ||
202 | AssetBase a3a = m_db.GetAsset(uuid3); | 219 | AssetBase a3a = m_db.GetAsset(uuid3); |
220 | a3a.UploadAttempts = 0; | ||
203 | Assert.That(a3a, Constraints.PropertyCompareConstraint(a3)); | 221 | Assert.That(a3a, Constraints.PropertyCompareConstraint(a3)); |
204 | } | 222 | } |
205 | } | 223 | } |
diff --git a/OpenSim/Data/Tests/BasicDataServiceTest.cs b/OpenSim/Data/Tests/BasicDataServiceTest.cs index 8c296b9..580e7aa 100644 --- a/OpenSim/Data/Tests/BasicDataServiceTest.cs +++ b/OpenSim/Data/Tests/BasicDataServiceTest.cs | |||
@@ -41,11 +41,11 @@ using System.Reflection; | |||
41 | 41 | ||
42 | namespace OpenSim.Data.Tests | 42 | namespace OpenSim.Data.Tests |
43 | { | 43 | { |
44 | /// <summary>This is a base class for testing any Data service for any DBMS. | 44 | /// <summary>This is a base class for testing any Data service for any DBMS. |
45 | /// Requires NUnit 2.5 or better (to support the generics). | 45 | /// Requires NUnit 2.5 or better (to support the generics). |
46 | /// </summary> | 46 | /// </summary> |
47 | /// <remarks> | 47 | /// <remarks> |
48 | /// FIXME: Should extend OpenSimTestCase but compile on mono 2.4.3 currently fails with | 48 | /// FIXME: Should extend OpenSimTestCase but compile on mono 2.4.3 currently fails with |
49 | /// AssetTests`2 : System.MemberAccessException : Cannot create an instance of OpenSim.Data.Tests.AssetTests`2[TConn,TAssetData] because Type.ContainsGenericParameters is true. | 49 | /// AssetTests`2 : System.MemberAccessException : Cannot create an instance of OpenSim.Data.Tests.AssetTests`2[TConn,TAssetData] because Type.ContainsGenericParameters is true. |
50 | /// and similar on EstateTests, InventoryTests and RegionTests. | 50 | /// and similar on EstateTests, InventoryTests and RegionTests. |
51 | /// Runs fine with mono 2.10.8.1, so easiest thing is to wait until min Mono version uplifts. | 51 | /// Runs fine with mono 2.10.8.1, so easiest thing is to wait until min Mono version uplifts. |
@@ -60,7 +60,7 @@ namespace OpenSim.Data.Tests | |||
60 | private TService m_service; | 60 | private TService m_service; |
61 | private string m_file; | 61 | private string m_file; |
62 | 62 | ||
63 | // TODO: Is this in the right place here? | 63 | // TODO: Is this in the right place here? |
64 | // Later: apparently it's not, but does it matter here? | 64 | // Later: apparently it's not, but does it matter here? |
65 | // protected static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 65 | // protected static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
66 | 66 | ||
@@ -68,7 +68,7 @@ namespace OpenSim.Data.Tests | |||
68 | 68 | ||
69 | public BasicDataServiceTest() | 69 | public BasicDataServiceTest() |
70 | : this("") | 70 | : this("") |
71 | { | 71 | { |
72 | } | 72 | } |
73 | 73 | ||
74 | public BasicDataServiceTest(string conn) | 74 | public BasicDataServiceTest(string conn) |
@@ -106,7 +106,7 @@ namespace OpenSim.Data.Tests | |||
106 | if (String.IsNullOrEmpty(m_connStr)) | 106 | if (String.IsNullOrEmpty(m_connStr)) |
107 | { | 107 | { |
108 | m_file = Path.GetTempFileName() + ".db"; | 108 | m_file = Path.GetTempFileName() + ".db"; |
109 | m_connStr = "URI=file:../db/" + m_file + ",version=3"; | 109 | m_connStr = "URI=file:" + Util.dbDir() + "/" + m_file + ",version=3"; |
110 | } | 110 | } |
111 | } | 111 | } |
112 | 112 | ||
@@ -226,7 +226,7 @@ namespace OpenSim.Data.Tests | |||
226 | } | 226 | } |
227 | } | 227 | } |
228 | 228 | ||
229 | /// <summary>Clear tables listed as parameters (without dropping them). | 229 | /// <summary>Clear tables listed as parameters (without dropping them). |
230 | /// </summary> | 230 | /// </summary> |
231 | /// <param name="tables"></param> | 231 | /// <param name="tables"></param> |
232 | protected virtual void ResetMigrations(params string[] stores) | 232 | protected virtual void ResetMigrations(params string[] stores) |
@@ -251,7 +251,7 @@ namespace OpenSim.Data.Tests | |||
251 | } | 251 | } |
252 | } | 252 | } |
253 | 253 | ||
254 | /// <summary>Clear tables listed as parameters (without dropping them). | 254 | /// <summary>Clear tables listed as parameters (without dropping them). |
255 | /// </summary> | 255 | /// </summary> |
256 | /// <param name="tables"></param> | 256 | /// <param name="tables"></param> |
257 | protected virtual void ClearTables(params string[] tables) | 257 | protected virtual void ClearTables(params string[] tables) |
diff --git a/OpenSim/Data/Tests/DefaultTestConns.cs b/OpenSim/Data/Tests/DefaultTestConns.cs index 7c47bdd..5ad238b 100644 --- a/OpenSim/Data/Tests/DefaultTestConns.cs +++ b/OpenSim/Data/Tests/DefaultTestConns.cs | |||
@@ -39,16 +39,16 @@ namespace OpenSim.Data.Tests | |||
39 | /// a connection string for testing one of the supported databases. | 39 | /// a connection string for testing one of the supported databases. |
40 | /// The connections must be in the section [TestConnections] with names matching the connection class | 40 | /// The connections must be in the section [TestConnections] with names matching the connection class |
41 | /// name for the specific database, e.g.: | 41 | /// name for the specific database, e.g.: |
42 | /// | 42 | /// |
43 | /// [TestConnections] | 43 | /// [TestConnections] |
44 | /// MySqlConnection="..." | 44 | /// MySqlConnection="..." |
45 | /// SqlConnection="..." | 45 | /// SqlConnection="..." |
46 | /// SqliteConnection="..." | 46 | /// SqliteConnection="..." |
47 | /// | 47 | /// |
48 | /// Note that the conn string may also be set explicitly in the [TestCase()] attribute of test classes | 48 | /// Note that the conn string may also be set explicitly in the [TestCase()] attribute of test classes |
49 | /// based on BasicDataServiceTest.cs. | 49 | /// based on BasicDataServiceTest.cs. |
50 | /// </summary> | 50 | /// </summary> |
51 | 51 | ||
52 | static class DefaultTestConns | 52 | static class DefaultTestConns |
53 | { | 53 | { |
54 | private static Dictionary<Type, string> conns = new Dictionary<Type, string>(); | 54 | private static Dictionary<Type, string> conns = new Dictionary<Type, string>(); |
@@ -63,8 +63,8 @@ namespace OpenSim.Data.Tests | |||
63 | Assembly asm = Assembly.GetExecutingAssembly(); | 63 | Assembly asm = Assembly.GetExecutingAssembly(); |
64 | string sType = connType.Name; | 64 | string sType = connType.Name; |
65 | 65 | ||
66 | // Note: when running from NUnit, the DLL is located in some temp dir, so how do we get | 66 | // Note: when running from NUnit, the DLL is located in some temp dir, so how do we get |
67 | // to the INI file? Ok, so put it into the resources! | 67 | // to the INI file? Ok, so put it into the resources! |
68 | // string iniName = Path.Combine(Path.GetDirectoryName(asm.Location), "TestDataConnections.ini"); | 68 | // string iniName = Path.Combine(Path.GetDirectoryName(asm.Location), "TestDataConnections.ini"); |
69 | 69 | ||
70 | string[] allres = asm.GetManifestResourceNames(); | 70 | string[] allres = asm.GetManifestResourceNames(); |
diff --git a/OpenSim/Data/Tests/EstateTests.cs b/OpenSim/Data/Tests/EstateTests.cs index e2b2d12..cf3f2b4 100644 --- a/OpenSim/Data/Tests/EstateTests.cs +++ b/OpenSim/Data/Tests/EstateTests.cs | |||
@@ -100,7 +100,7 @@ namespace OpenSim.Data.Tests | |||
100 | public void T010_EstateSettingsSimpleStorage_MinimumParameterSet() | 100 | public void T010_EstateSettingsSimpleStorage_MinimumParameterSet() |
101 | { | 101 | { |
102 | TestHelpers.InMethod(); | 102 | TestHelpers.InMethod(); |
103 | 103 | ||
104 | EstateSettingsSimpleStorage( | 104 | EstateSettingsSimpleStorage( |
105 | REGION_ID, | 105 | REGION_ID, |
106 | DataTestUtil.STRING_MIN, | 106 | DataTestUtil.STRING_MIN, |
@@ -133,7 +133,7 @@ namespace OpenSim.Data.Tests | |||
133 | public void T011_EstateSettingsSimpleStorage_MaximumParameterSet() | 133 | public void T011_EstateSettingsSimpleStorage_MaximumParameterSet() |
134 | { | 134 | { |
135 | TestHelpers.InMethod(); | 135 | TestHelpers.InMethod(); |
136 | 136 | ||
137 | EstateSettingsSimpleStorage( | 137 | EstateSettingsSimpleStorage( |
138 | REGION_ID, | 138 | REGION_ID, |
139 | DataTestUtil.STRING_MAX(64), | 139 | DataTestUtil.STRING_MAX(64), |
@@ -166,7 +166,7 @@ namespace OpenSim.Data.Tests | |||
166 | public void T012_EstateSettingsSimpleStorage_AccurateParameterSet() | 166 | public void T012_EstateSettingsSimpleStorage_AccurateParameterSet() |
167 | { | 167 | { |
168 | TestHelpers.InMethod(); | 168 | TestHelpers.InMethod(); |
169 | 169 | ||
170 | EstateSettingsSimpleStorage( | 170 | EstateSettingsSimpleStorage( |
171 | REGION_ID, | 171 | REGION_ID, |
172 | DataTestUtil.STRING_MAX(1), | 172 | DataTestUtil.STRING_MAX(1), |
@@ -199,7 +199,7 @@ namespace OpenSim.Data.Tests | |||
199 | public void T012_EstateSettingsRandomStorage() | 199 | public void T012_EstateSettingsRandomStorage() |
200 | { | 200 | { |
201 | TestHelpers.InMethod(); | 201 | TestHelpers.InMethod(); |
202 | 202 | ||
203 | // Letting estate store generate rows to database for us | 203 | // Letting estate store generate rows to database for us |
204 | EstateSettings originalSettings = db.LoadEstateSettings(REGION_ID, true); | 204 | EstateSettings originalSettings = db.LoadEstateSettings(REGION_ID, true); |
205 | new PropertyScrambler<EstateSettings>() | 205 | new PropertyScrambler<EstateSettings>() |
@@ -220,7 +220,7 @@ namespace OpenSim.Data.Tests | |||
220 | public void T020_EstateSettingsManagerList() | 220 | public void T020_EstateSettingsManagerList() |
221 | { | 221 | { |
222 | TestHelpers.InMethod(); | 222 | TestHelpers.InMethod(); |
223 | 223 | ||
224 | // Letting estate store generate rows to database for us | 224 | // Letting estate store generate rows to database for us |
225 | EstateSettings originalSettings = db.LoadEstateSettings(REGION_ID, true); | 225 | EstateSettings originalSettings = db.LoadEstateSettings(REGION_ID, true); |
226 | 226 | ||
@@ -241,7 +241,7 @@ namespace OpenSim.Data.Tests | |||
241 | public void T021_EstateSettingsUserList() | 241 | public void T021_EstateSettingsUserList() |
242 | { | 242 | { |
243 | TestHelpers.InMethod(); | 243 | TestHelpers.InMethod(); |
244 | 244 | ||
245 | // Letting estate store generate rows to database for us | 245 | // Letting estate store generate rows to database for us |
246 | EstateSettings originalSettings = db.LoadEstateSettings(REGION_ID, true); | 246 | EstateSettings originalSettings = db.LoadEstateSettings(REGION_ID, true); |
247 | 247 | ||
@@ -262,7 +262,7 @@ namespace OpenSim.Data.Tests | |||
262 | public void T022_EstateSettingsGroupList() | 262 | public void T022_EstateSettingsGroupList() |
263 | { | 263 | { |
264 | TestHelpers.InMethod(); | 264 | TestHelpers.InMethod(); |
265 | 265 | ||
266 | // Letting estate store generate rows to database for us | 266 | // Letting estate store generate rows to database for us |
267 | EstateSettings originalSettings = db.LoadEstateSettings(REGION_ID, true); | 267 | EstateSettings originalSettings = db.LoadEstateSettings(REGION_ID, true); |
268 | 268 | ||
@@ -283,7 +283,7 @@ namespace OpenSim.Data.Tests | |||
283 | public void T022_EstateSettingsBanList() | 283 | public void T022_EstateSettingsBanList() |
284 | { | 284 | { |
285 | TestHelpers.InMethod(); | 285 | TestHelpers.InMethod(); |
286 | 286 | ||
287 | // Letting estate store generate rows to database for us | 287 | // Letting estate store generate rows to database for us |
288 | EstateSettings originalSettings = db.LoadEstateSettings(REGION_ID, true); | 288 | EstateSettings originalSettings = db.LoadEstateSettings(REGION_ID, true); |
289 | 289 | ||
@@ -310,7 +310,7 @@ namespace OpenSim.Data.Tests | |||
310 | 310 | ||
311 | #endregion | 311 | #endregion |
312 | 312 | ||
313 | #region Parametrizable Test Implementations | 313 | #region Parametrizable Test Implementations |
314 | 314 | ||
315 | private void EstateSettingsSimpleStorage( | 315 | private void EstateSettingsSimpleStorage( |
316 | UUID regionId, | 316 | UUID regionId, |
diff --git a/OpenSim/Data/Tests/InventoryTests.cs b/OpenSim/Data/Tests/InventoryTests.cs index 3edf89d..da6e7d4 100644 --- a/OpenSim/Data/Tests/InventoryTests.cs +++ b/OpenSim/Data/Tests/InventoryTests.cs | |||
@@ -44,14 +44,9 @@ using OpenSim.Data.SQLite; | |||
44 | 44 | ||
45 | namespace OpenSim.Data.Tests | 45 | namespace OpenSim.Data.Tests |
46 | { | 46 | { |
47 | [TestFixture(Description = "Inventory store tests (SQLite)")] | ||
48 | public class SQLiteInventoryTests : InventoryTests<SqliteConnection, SQLiteInventoryStore> | ||
49 | { | ||
50 | } | ||
51 | |||
52 | [TestFixture(Description = "Inventory store tests (MySQL)")] | 47 | [TestFixture(Description = "Inventory store tests (MySQL)")] |
53 | public class MySqlInventoryTests : InventoryTests<MySqlConnection, MySQLInventoryData> | 48 | public class MySqlInventoryTests : InventoryTests<MySqlConnection, MySQLInventoryData> |
54 | { | 49 | { |
55 | } | 50 | } |
56 | 51 | ||
57 | public class InventoryTests<TConn, TInvStore> : BasicDataServiceTest<TConn, TInvStore> | 52 | public class InventoryTests<TConn, TInvStore> : BasicDataServiceTest<TConn, TInvStore> |
@@ -107,7 +102,7 @@ namespace OpenSim.Data.Tests | |||
107 | public void T001_LoadEmpty() | 102 | public void T001_LoadEmpty() |
108 | { | 103 | { |
109 | TestHelpers.InMethod(); | 104 | TestHelpers.InMethod(); |
110 | 105 | ||
111 | Assert.That(db.getInventoryFolder(zero), Is.Null); | 106 | Assert.That(db.getInventoryFolder(zero), Is.Null); |
112 | Assert.That(db.getInventoryFolder(folder1), Is.Null); | 107 | Assert.That(db.getInventoryFolder(folder1), Is.Null); |
113 | Assert.That(db.getInventoryFolder(folder2), Is.Null); | 108 | Assert.That(db.getInventoryFolder(folder2), Is.Null); |
@@ -127,7 +122,7 @@ namespace OpenSim.Data.Tests | |||
127 | public void T010_FolderNonParent() | 122 | public void T010_FolderNonParent() |
128 | { | 123 | { |
129 | TestHelpers.InMethod(); | 124 | TestHelpers.InMethod(); |
130 | 125 | ||
131 | InventoryFolderBase f1 = NewFolder(folder2, folder1, owner1, name2); | 126 | InventoryFolderBase f1 = NewFolder(folder2, folder1, owner1, name2); |
132 | // the folder will go in | 127 | // the folder will go in |
133 | db.addInventoryFolder(f1); | 128 | db.addInventoryFolder(f1); |
@@ -139,7 +134,7 @@ namespace OpenSim.Data.Tests | |||
139 | public void T011_FolderCreate() | 134 | public void T011_FolderCreate() |
140 | { | 135 | { |
141 | TestHelpers.InMethod(); | 136 | TestHelpers.InMethod(); |
142 | 137 | ||
143 | InventoryFolderBase f1 = NewFolder(folder1, zero, owner1, name1); | 138 | InventoryFolderBase f1 = NewFolder(folder1, zero, owner1, name1); |
144 | // TODO: this is probably wrong behavior, but is what we have | 139 | // TODO: this is probably wrong behavior, but is what we have |
145 | // db.updateInventoryFolder(f1); | 140 | // db.updateInventoryFolder(f1); |
@@ -164,7 +159,7 @@ namespace OpenSim.Data.Tests | |||
164 | public void T012_FolderList() | 159 | public void T012_FolderList() |
165 | { | 160 | { |
166 | TestHelpers.InMethod(); | 161 | TestHelpers.InMethod(); |
167 | 162 | ||
168 | InventoryFolderBase f2 = NewFolder(folder3, folder1, owner1, name3); | 163 | InventoryFolderBase f2 = NewFolder(folder3, folder1, owner1, name3); |
169 | db.addInventoryFolder(f2); | 164 | db.addInventoryFolder(f2); |
170 | 165 | ||
@@ -180,7 +175,7 @@ namespace OpenSim.Data.Tests | |||
180 | public void T013_FolderHierarchy() | 175 | public void T013_FolderHierarchy() |
181 | { | 176 | { |
182 | TestHelpers.InMethod(); | 177 | TestHelpers.InMethod(); |
183 | 178 | ||
184 | int n = db.getFolderHierarchy(zero).Count; // (for dbg - easier to see what's returned) | 179 | int n = db.getFolderHierarchy(zero).Count; // (for dbg - easier to see what's returned) |
185 | Assert.That(n, Is.EqualTo(0), "Assert.That(db.getFolderHierarchy(zero).Count, Is.EqualTo(0))"); | 180 | Assert.That(n, Is.EqualTo(0), "Assert.That(db.getFolderHierarchy(zero).Count, Is.EqualTo(0))"); |
186 | n = db.getFolderHierarchy(folder1).Count; | 181 | n = db.getFolderHierarchy(folder1).Count; |
@@ -195,7 +190,7 @@ namespace OpenSim.Data.Tests | |||
195 | public void T014_MoveFolder() | 190 | public void T014_MoveFolder() |
196 | { | 191 | { |
197 | TestHelpers.InMethod(); | 192 | TestHelpers.InMethod(); |
198 | 193 | ||
199 | InventoryFolderBase f2 = db.getInventoryFolder(folder2); | 194 | InventoryFolderBase f2 = db.getInventoryFolder(folder2); |
200 | f2.ParentID = folder3; | 195 | f2.ParentID = folder3; |
201 | db.moveInventoryFolder(f2); | 196 | db.moveInventoryFolder(f2); |
@@ -211,7 +206,7 @@ namespace OpenSim.Data.Tests | |||
211 | public void T015_FolderHierarchy() | 206 | public void T015_FolderHierarchy() |
212 | { | 207 | { |
213 | TestHelpers.InMethod(); | 208 | TestHelpers.InMethod(); |
214 | 209 | ||
215 | Assert.That(db.getFolderHierarchy(zero).Count, Is.EqualTo(0), "Assert.That(db.getFolderHierarchy(zero).Count, Is.EqualTo(0))"); | 210 | Assert.That(db.getFolderHierarchy(zero).Count, Is.EqualTo(0), "Assert.That(db.getFolderHierarchy(zero).Count, Is.EqualTo(0))"); |
216 | Assert.That(db.getFolderHierarchy(folder1).Count, Is.EqualTo(2), "Assert.That(db.getFolderHierarchy(folder1).Count, Is.EqualTo(2))"); | 211 | Assert.That(db.getFolderHierarchy(folder1).Count, Is.EqualTo(2), "Assert.That(db.getFolderHierarchy(folder1).Count, Is.EqualTo(2))"); |
217 | Assert.That(db.getFolderHierarchy(folder2).Count, Is.EqualTo(0), "Assert.That(db.getFolderHierarchy(folder2).Count, Is.EqualTo(0))"); | 212 | Assert.That(db.getFolderHierarchy(folder2).Count, Is.EqualTo(0), "Assert.That(db.getFolderHierarchy(folder2).Count, Is.EqualTo(0))"); |
@@ -224,7 +219,7 @@ namespace OpenSim.Data.Tests | |||
224 | public void T100_NoItems() | 219 | public void T100_NoItems() |
225 | { | 220 | { |
226 | TestHelpers.InMethod(); | 221 | TestHelpers.InMethod(); |
227 | 222 | ||
228 | Assert.That(db.getInventoryInFolder(zero).Count, Is.EqualTo(0), "Assert.That(db.getInventoryInFolder(zero).Count, Is.EqualTo(0))"); | 223 | Assert.That(db.getInventoryInFolder(zero).Count, Is.EqualTo(0), "Assert.That(db.getInventoryInFolder(zero).Count, Is.EqualTo(0))"); |
229 | Assert.That(db.getInventoryInFolder(folder1).Count, Is.EqualTo(0), "Assert.That(db.getInventoryInFolder(folder1).Count, Is.EqualTo(0))"); | 224 | Assert.That(db.getInventoryInFolder(folder1).Count, Is.EqualTo(0), "Assert.That(db.getInventoryInFolder(folder1).Count, Is.EqualTo(0))"); |
230 | Assert.That(db.getInventoryInFolder(folder2).Count, Is.EqualTo(0), "Assert.That(db.getInventoryInFolder(folder2).Count, Is.EqualTo(0))"); | 225 | Assert.That(db.getInventoryInFolder(folder2).Count, Is.EqualTo(0), "Assert.That(db.getInventoryInFolder(folder2).Count, Is.EqualTo(0))"); |
@@ -238,7 +233,7 @@ namespace OpenSim.Data.Tests | |||
238 | public void T101_CreatItems() | 233 | public void T101_CreatItems() |
239 | { | 234 | { |
240 | TestHelpers.InMethod(); | 235 | TestHelpers.InMethod(); |
241 | 236 | ||
242 | db.addInventoryItem(NewItem(item1, folder3, owner1, iname1, asset1)); | 237 | db.addInventoryItem(NewItem(item1, folder3, owner1, iname1, asset1)); |
243 | db.addInventoryItem(NewItem(item2, folder3, owner1, iname2, asset2)); | 238 | db.addInventoryItem(NewItem(item2, folder3, owner1, iname2, asset2)); |
244 | db.addInventoryItem(NewItem(item3, folder3, owner1, iname3, asset3)); | 239 | db.addInventoryItem(NewItem(item3, folder3, owner1, iname3, asset3)); |
@@ -249,7 +244,7 @@ namespace OpenSim.Data.Tests | |||
249 | public void T102_CompareItems() | 244 | public void T102_CompareItems() |
250 | { | 245 | { |
251 | TestHelpers.InMethod(); | 246 | TestHelpers.InMethod(); |
252 | 247 | ||
253 | InventoryItemBase i1 = db.getInventoryItem(item1); | 248 | InventoryItemBase i1 = db.getInventoryItem(item1); |
254 | InventoryItemBase i2 = db.getInventoryItem(item2); | 249 | InventoryItemBase i2 = db.getInventoryItem(item2); |
255 | InventoryItemBase i3 = db.getInventoryItem(item3); | 250 | InventoryItemBase i3 = db.getInventoryItem(item3); |
@@ -268,7 +263,7 @@ namespace OpenSim.Data.Tests | |||
268 | public void T103_UpdateItem() | 263 | public void T103_UpdateItem() |
269 | { | 264 | { |
270 | TestHelpers.InMethod(); | 265 | TestHelpers.InMethod(); |
271 | 266 | ||
272 | // TODO: probably shouldn't have the ability to have an | 267 | // TODO: probably shouldn't have the ability to have an |
273 | // owner of an item in a folder not owned by the user | 268 | // owner of an item in a folder not owned by the user |
274 | 269 | ||
@@ -288,7 +283,7 @@ namespace OpenSim.Data.Tests | |||
288 | public void T104_RandomUpdateItem() | 283 | public void T104_RandomUpdateItem() |
289 | { | 284 | { |
290 | TestHelpers.InMethod(); | 285 | TestHelpers.InMethod(); |
291 | 286 | ||
292 | PropertyScrambler<InventoryFolderBase> folderScrambler = | 287 | PropertyScrambler<InventoryFolderBase> folderScrambler = |
293 | new PropertyScrambler<InventoryFolderBase>() | 288 | new PropertyScrambler<InventoryFolderBase>() |
294 | .DontScramble(x => x.Owner) | 289 | .DontScramble(x => x.Owner) |
@@ -347,7 +342,7 @@ namespace OpenSim.Data.Tests | |||
347 | public void T999_StillNull() | 342 | public void T999_StillNull() |
348 | { | 343 | { |
349 | TestHelpers.InMethod(); | 344 | TestHelpers.InMethod(); |
350 | 345 | ||
351 | // After all tests are run, these should still return no results | 346 | // After all tests are run, these should still return no results |
352 | Assert.That(db.getInventoryFolder(zero), Is.Null); | 347 | Assert.That(db.getInventoryFolder(zero), Is.Null); |
353 | Assert.That(db.getInventoryItem(zero), Is.Null); | 348 | Assert.That(db.getInventoryItem(zero), Is.Null); |
diff --git a/OpenSim/Data/Tests/PropertyScrambler.cs b/OpenSim/Data/Tests/PropertyScrambler.cs index e0f5862..0d291df 100644 --- a/OpenSim/Data/Tests/PropertyScrambler.cs +++ b/OpenSim/Data/Tests/PropertyScrambler.cs | |||
@@ -42,7 +42,7 @@ namespace OpenSim.Data.Tests | |||
42 | public class PropertyScrambler<T> | 42 | public class PropertyScrambler<T> |
43 | { | 43 | { |
44 | readonly System.Collections.Generic.List<string> membersToNotScramble = new List<string>(); | 44 | readonly System.Collections.Generic.List<string> membersToNotScramble = new List<string>(); |
45 | 45 | ||
46 | private void AddExpressionToNotScrableList(Expression expression) | 46 | private void AddExpressionToNotScrableList(Expression expression) |
47 | { | 47 | { |
48 | UnaryExpression unaryExpression = expression as UnaryExpression; | 48 | UnaryExpression unaryExpression = expression as UnaryExpression; |
diff --git a/OpenSim/Data/Tests/RegionTests.cs b/OpenSim/Data/Tests/RegionTests.cs index 8d4249a..4f81594 100644 --- a/OpenSim/Data/Tests/RegionTests.cs +++ b/OpenSim/Data/Tests/RegionTests.cs | |||
@@ -39,6 +39,7 @@ using OpenSim.Tests.Common; | |||
39 | using log4net; | 39 | using log4net; |
40 | using System.Reflection; | 40 | using System.Reflection; |
41 | using System.Data.Common; | 41 | using System.Data.Common; |
42 | using System.Threading; | ||
42 | 43 | ||
43 | // DBMS-specific: | 44 | // DBMS-specific: |
44 | using MySql.Data.MySqlClient; | 45 | using MySql.Data.MySqlClient; |
@@ -82,7 +83,7 @@ namespace OpenSim.Data.Tests | |||
82 | public UUID item3 = UUID.Random(); | 83 | public UUID item3 = UUID.Random(); |
83 | 84 | ||
84 | public static Random random = new Random(); | 85 | public static Random random = new Random(); |
85 | 86 | ||
86 | public string itemname1 = "item1"; | 87 | public string itemname1 = "item1"; |
87 | 88 | ||
88 | public uint localID = 1; | 89 | public uint localID = 1; |
@@ -110,10 +111,10 @@ namespace OpenSim.Data.Tests | |||
110 | 111 | ||
111 | private void ClearDB() | 112 | private void ClearDB() |
112 | { | 113 | { |
113 | string[] reg_tables = new string[] { | 114 | string[] reg_tables = new string[] { |
114 | "prims", "primshapes", "primitems", "terrain", "land", "landaccesslist", "regionban", "regionsettings" | 115 | "prims", "primshapes", "primitems", "terrain", "land", "landaccesslist", "regionban", "regionsettings" |
115 | }; | 116 | }; |
116 | 117 | ||
117 | if (m_rebuildDB) | 118 | if (m_rebuildDB) |
118 | { | 119 | { |
119 | DropTables(reg_tables); | 120 | DropTables(reg_tables); |
@@ -144,7 +145,7 @@ namespace OpenSim.Data.Tests | |||
144 | public void T001_LoadEmpty() | 145 | public void T001_LoadEmpty() |
145 | { | 146 | { |
146 | TestHelpers.InMethod(); | 147 | TestHelpers.InMethod(); |
147 | 148 | ||
148 | List<SceneObjectGroup> objs = db.LoadObjects(region1); | 149 | List<SceneObjectGroup> objs = db.LoadObjects(region1); |
149 | List<SceneObjectGroup> objs3 = db.LoadObjects(region3); | 150 | List<SceneObjectGroup> objs3 = db.LoadObjects(region3); |
150 | List<LandData> land = db.LoadLandObjects(region1); | 151 | List<LandData> land = db.LoadLandObjects(region1); |
@@ -153,21 +154,21 @@ namespace OpenSim.Data.Tests | |||
153 | Assert.That(objs3.Count, Is.EqualTo(0), "Assert.That(objs3.Count, Is.EqualTo(0))"); | 154 | Assert.That(objs3.Count, Is.EqualTo(0), "Assert.That(objs3.Count, Is.EqualTo(0))"); |
154 | Assert.That(land.Count, Is.EqualTo(0), "Assert.That(land.Count, Is.EqualTo(0))"); | 155 | Assert.That(land.Count, Is.EqualTo(0), "Assert.That(land.Count, Is.EqualTo(0))"); |
155 | } | 156 | } |
156 | 157 | ||
157 | // SOG round trips | 158 | // SOG round trips |
158 | // * store objects, make sure they save | 159 | // * store objects, make sure they save |
159 | // * update | 160 | // * update |
160 | 161 | ||
161 | [Test] | 162 | [Test] |
162 | public void T010_StoreSimpleObject() | 163 | public void T010_StoreSimpleObject() |
163 | { | 164 | { |
164 | TestHelpers.InMethod(); | 165 | TestHelpers.InMethod(); |
165 | 166 | ||
166 | SceneObjectGroup sog = NewSOG("object1", prim1, region1); | 167 | SceneObjectGroup sog = NewSOG("object1", prim1, region1); |
167 | SceneObjectGroup sog2 = NewSOG("object2", prim2, region1); | 168 | SceneObjectGroup sog2 = NewSOG("object2", prim2, region1); |
168 | 169 | ||
169 | // in case the objects don't store | 170 | // in case the objects don't store |
170 | try | 171 | try |
171 | { | 172 | { |
172 | db.StoreObject(sog, region1); | 173 | db.StoreObject(sog, region1); |
173 | } | 174 | } |
@@ -176,8 +177,8 @@ namespace OpenSim.Data.Tests | |||
176 | m_log.Error(e.ToString()); | 177 | m_log.Error(e.ToString()); |
177 | Assert.Fail(); | 178 | Assert.Fail(); |
178 | } | 179 | } |
179 | 180 | ||
180 | try | 181 | try |
181 | { | 182 | { |
182 | db.StoreObject(sog2, region1); | 183 | db.StoreObject(sog2, region1); |
183 | } | 184 | } |
@@ -189,15 +190,15 @@ namespace OpenSim.Data.Tests | |||
189 | 190 | ||
190 | // This tests the ADO.NET driver | 191 | // This tests the ADO.NET driver |
191 | List<SceneObjectGroup> objs = db.LoadObjects(region1); | 192 | List<SceneObjectGroup> objs = db.LoadObjects(region1); |
192 | 193 | ||
193 | Assert.That(objs.Count, Is.EqualTo(2), "Assert.That(objs.Count, Is.EqualTo(2))"); | 194 | Assert.That(objs.Count, Is.EqualTo(2), "Assert.That(objs.Count, Is.EqualTo(2))"); |
194 | } | 195 | } |
195 | 196 | ||
196 | [Test] | 197 | [Test] |
197 | public void T011_ObjectNames() | 198 | public void T011_ObjectNames() |
198 | { | 199 | { |
199 | TestHelpers.InMethod(); | 200 | TestHelpers.InMethod(); |
200 | 201 | ||
201 | List<SceneObjectGroup> objs = db.LoadObjects(region1); | 202 | List<SceneObjectGroup> objs = db.LoadObjects(region1); |
202 | foreach (SceneObjectGroup sog in objs) | 203 | foreach (SceneObjectGroup sog in objs) |
203 | { | 204 | { |
@@ -206,12 +207,12 @@ namespace OpenSim.Data.Tests | |||
206 | Assert.That(p.Name, Is.EqualTo(p.Description), "Assert.That(p.Name, Is.EqualTo(p.Description))"); | 207 | Assert.That(p.Name, Is.EqualTo(p.Description), "Assert.That(p.Name, Is.EqualTo(p.Description))"); |
207 | } | 208 | } |
208 | } | 209 | } |
209 | 210 | ||
210 | [Test] | 211 | [Test] |
211 | public void T012_SceneParts() | 212 | public void T012_SceneParts() |
212 | { | 213 | { |
213 | TestHelpers.InMethod(); | 214 | TestHelpers.InMethod(); |
214 | 215 | ||
215 | UUID tmp0 = UUID.Random(); | 216 | UUID tmp0 = UUID.Random(); |
216 | UUID tmp1 = UUID.Random(); | 217 | UUID tmp1 = UUID.Random(); |
217 | UUID tmp2 = UUID.Random(); | 218 | UUID tmp2 = UUID.Random(); |
@@ -224,10 +225,10 @@ namespace OpenSim.Data.Tests | |||
224 | sog.AddPart(p1); | 225 | sog.AddPart(p1); |
225 | sog.AddPart(p2); | 226 | sog.AddPart(p2); |
226 | sog.AddPart(p3); | 227 | sog.AddPart(p3); |
227 | 228 | ||
228 | SceneObjectPart[] parts = sog.Parts; | 229 | SceneObjectPart[] parts = sog.Parts; |
229 | Assert.That(parts.Length,Is.EqualTo(4), "Assert.That(parts.Length,Is.EqualTo(4))"); | 230 | Assert.That(parts.Length,Is.EqualTo(4), "Assert.That(parts.Length,Is.EqualTo(4))"); |
230 | 231 | ||
231 | db.StoreObject(sog, newregion); | 232 | db.StoreObject(sog, newregion); |
232 | List<SceneObjectGroup> sogs = db.LoadObjects(newregion); | 233 | List<SceneObjectGroup> sogs = db.LoadObjects(newregion); |
233 | Assert.That(sogs.Count,Is.EqualTo(1), "Assert.That(sogs.Count,Is.EqualTo(1))"); | 234 | Assert.That(sogs.Count,Is.EqualTo(1), "Assert.That(sogs.Count,Is.EqualTo(1))"); |
@@ -235,18 +236,18 @@ namespace OpenSim.Data.Tests | |||
235 | 236 | ||
236 | SceneObjectPart[] newparts = newsog.Parts; | 237 | SceneObjectPart[] newparts = newsog.Parts; |
237 | Assert.That(newparts.Length,Is.EqualTo(4), "Assert.That(newparts.Length,Is.EqualTo(4))"); | 238 | Assert.That(newparts.Length,Is.EqualTo(4), "Assert.That(newparts.Length,Is.EqualTo(4))"); |
238 | 239 | ||
239 | Assert.That(newsog.ContainsPart(tmp0), "Assert.That(newsog.ContainsPart(tmp0))"); | 240 | Assert.That(newsog.ContainsPart(tmp0), "Assert.That(newsog.ContainsPart(tmp0))"); |
240 | Assert.That(newsog.ContainsPart(tmp1), "Assert.That(newsog.ContainsPart(tmp1))"); | 241 | Assert.That(newsog.ContainsPart(tmp1), "Assert.That(newsog.ContainsPart(tmp1))"); |
241 | Assert.That(newsog.ContainsPart(tmp2), "Assert.That(newsog.ContainsPart(tmp2))"); | 242 | Assert.That(newsog.ContainsPart(tmp2), "Assert.That(newsog.ContainsPart(tmp2))"); |
242 | Assert.That(newsog.ContainsPart(tmp3), "Assert.That(newsog.ContainsPart(tmp3))"); | 243 | Assert.That(newsog.ContainsPart(tmp3), "Assert.That(newsog.ContainsPart(tmp3))"); |
243 | } | 244 | } |
244 | 245 | ||
245 | [Test] | 246 | [Test] |
246 | public void T013_DatabasePersistency() | 247 | public void T013_DatabasePersistency() |
247 | { | 248 | { |
248 | TestHelpers.InMethod(); | 249 | TestHelpers.InMethod(); |
249 | 250 | ||
250 | // Sets all ScenePart parameters, stores and retrieves them, then check for consistency with initial data | 251 | // Sets all ScenePart parameters, stores and retrieves them, then check for consistency with initial data |
251 | // The commented Asserts are the ones that are unchangeable (when storing on the database, their "Set" values are ignored | 252 | // The commented Asserts are the ones that are unchangeable (when storing on the database, their "Set" values are ignored |
252 | // The ObjectFlags is an exception, if it is entered incorrectly, the object IS REJECTED on the database silently. | 253 | // The ObjectFlags is an exception, if it is entered incorrectly, the object IS REJECTED on the database silently. |
@@ -259,7 +260,7 @@ namespace OpenSim.Data.Tests | |||
259 | uint localid = localID+1; | 260 | uint localid = localID+1; |
260 | localID = localID + 1; | 261 | localID = localID + 1; |
261 | string name = "Adam West"; | 262 | string name = "Adam West"; |
262 | byte material = (byte) random.Next(127); | 263 | byte material = (byte) random.Next((int)SOPMaterialData.MaxMaterial); |
263 | ulong regionh = (ulong)random.NextDouble() * (ulong)random.Next(); | 264 | ulong regionh = (ulong)random.NextDouble() * (ulong)random.Next(); |
264 | int pin = random.Next(); | 265 | int pin = random.Next(); |
265 | Byte[] partsys = new byte[8]; | 266 | Byte[] partsys = new byte[8]; |
@@ -297,7 +298,7 @@ namespace OpenSim.Data.Tests | |||
297 | 298 | ||
298 | SceneObjectPart sop = new SceneObjectPart(); | 299 | SceneObjectPart sop = new SceneObjectPart(); |
299 | SceneObjectGroup sog = new SceneObjectGroup(sop); | 300 | SceneObjectGroup sog = new SceneObjectGroup(sop); |
300 | 301 | ||
301 | sop.RegionHandle = regionh; | 302 | sop.RegionHandle = regionh; |
302 | sop.UUID = uuid; | 303 | sop.UUID = uuid; |
303 | sop.LocalId = localid; | 304 | sop.LocalId = localid; |
@@ -359,10 +360,10 @@ namespace OpenSim.Data.Tests | |||
359 | Assert.That(linknum,Is.EqualTo(sop.LinkNum), "Assert.That(linknum,Is.EqualTo(sop.LinkNum))"); | 360 | Assert.That(linknum,Is.EqualTo(sop.LinkNum), "Assert.That(linknum,Is.EqualTo(sop.LinkNum))"); |
360 | Assert.That(clickaction,Is.EqualTo(sop.ClickAction), "Assert.That(clickaction,Is.EqualTo(sop.ClickAction))"); | 361 | Assert.That(clickaction,Is.EqualTo(sop.ClickAction), "Assert.That(clickaction,Is.EqualTo(sop.ClickAction))"); |
361 | Assert.That(scale,Is.EqualTo(sop.Scale), "Assert.That(scale,Is.EqualTo(sop.Scale))"); | 362 | Assert.That(scale,Is.EqualTo(sop.Scale), "Assert.That(scale,Is.EqualTo(sop.Scale))"); |
362 | 363 | ||
363 | // This is necessary or object will not be inserted in DB | 364 | // This is necessary or object will not be inserted in DB |
364 | sop.Flags = PrimFlags.None; | 365 | sop.Flags = PrimFlags.None; |
365 | 366 | ||
366 | // Inserts group in DB | 367 | // Inserts group in DB |
367 | db.StoreObject(sog,region3); | 368 | db.StoreObject(sog,region3); |
368 | List<SceneObjectGroup> sogs = db.LoadObjects(region3); | 369 | List<SceneObjectGroup> sogs = db.LoadObjects(region3); |
@@ -371,7 +372,7 @@ namespace OpenSim.Data.Tests | |||
371 | db.StoreObject(sog,region3); | 372 | db.StoreObject(sog,region3); |
372 | sogs = db.LoadObjects(region3); | 373 | sogs = db.LoadObjects(region3); |
373 | Assert.That(sogs.Count, Is.EqualTo(1), "Assert.That(sogs.Count, Is.EqualTo(1))"); | 374 | Assert.That(sogs.Count, Is.EqualTo(1), "Assert.That(sogs.Count, Is.EqualTo(1))"); |
374 | 375 | ||
375 | 376 | ||
376 | // Tests if the parameters were inserted correctly | 377 | // Tests if the parameters were inserted correctly |
377 | SceneObjectPart p = sogs[0].RootPart; | 378 | SceneObjectPart p = sogs[0].RootPart; |
@@ -413,12 +414,12 @@ namespace OpenSim.Data.Tests | |||
413 | Assert.That(pbshap.ProfileEnd, Is.EqualTo(p.Shape.ProfileEnd), "Assert.That(pbshap.ProfileEnd, Is.EqualTo(p.Shape.ProfileEnd))"); | 414 | Assert.That(pbshap.ProfileEnd, Is.EqualTo(p.Shape.ProfileEnd), "Assert.That(pbshap.ProfileEnd, Is.EqualTo(p.Shape.ProfileEnd))"); |
414 | Assert.That(pbshap.ProfileHollow, Is.EqualTo(p.Shape.ProfileHollow), "Assert.That(pbshap.ProfileHollow, Is.EqualTo(p.Shape.ProfileHollow))"); | 415 | Assert.That(pbshap.ProfileHollow, Is.EqualTo(p.Shape.ProfileHollow), "Assert.That(pbshap.ProfileHollow, Is.EqualTo(p.Shape.ProfileHollow))"); |
415 | } | 416 | } |
416 | 417 | ||
417 | [Test] | 418 | [Test] |
418 | public void T014_UpdateObject() | 419 | public void T014_UpdateObject() |
419 | { | 420 | { |
420 | TestHelpers.InMethod(); | 421 | TestHelpers.InMethod(); |
421 | 422 | ||
422 | string text1 = "object1 text"; | 423 | string text1 = "object1 text"; |
423 | SceneObjectGroup sog = FindSOG("object1", region1); | 424 | SceneObjectGroup sog = FindSOG("object1", region1); |
424 | sog.RootPart.Text = text1; | 425 | sog.RootPart.Text = text1; |
@@ -433,7 +434,7 @@ namespace OpenSim.Data.Tests | |||
433 | TaskInventoryDictionary dic = new TaskInventoryDictionary(); | 434 | TaskInventoryDictionary dic = new TaskInventoryDictionary(); |
434 | localID = localID + 1; | 435 | localID = localID + 1; |
435 | string name = "West Adam"; | 436 | string name = "West Adam"; |
436 | byte material = (byte) random.Next(127); | 437 | byte material = (byte) random.Next((int)SOPMaterialData.MaxMaterial); |
437 | ulong regionh = (ulong)random.NextDouble() * (ulong)random.Next(); | 438 | ulong regionh = (ulong)random.NextDouble() * (ulong)random.Next(); |
438 | int pin = random.Next(); | 439 | int pin = random.Next(); |
439 | Byte[] partsys = new byte[8]; | 440 | Byte[] partsys = new byte[8]; |
@@ -458,7 +459,7 @@ namespace OpenSim.Data.Tests | |||
458 | PrimitiveBaseShape pbshap = new PrimitiveBaseShape(); | 459 | PrimitiveBaseShape pbshap = new PrimitiveBaseShape(); |
459 | pbshap = PrimitiveBaseShape.Default; | 460 | pbshap = PrimitiveBaseShape.Default; |
460 | Vector3 scale = new Vector3(random.Next(),random.Next(),random.Next()); | 461 | Vector3 scale = new Vector3(random.Next(),random.Next(),random.Next()); |
461 | 462 | ||
462 | // Updates the region with new values | 463 | // Updates the region with new values |
463 | SceneObjectGroup sog2 = FindSOG("Adam West", region3); | 464 | SceneObjectGroup sog2 = FindSOG("Adam West", region3); |
464 | Assert.That(sog2,Is.Not.Null); | 465 | Assert.That(sog2,Is.Not.Null); |
@@ -487,11 +488,11 @@ namespace OpenSim.Data.Tests | |||
487 | sog2.RootPart.LinkNum = linknum; | 488 | sog2.RootPart.LinkNum = linknum; |
488 | sog2.RootPart.ClickAction = clickaction; | 489 | sog2.RootPart.ClickAction = clickaction; |
489 | sog2.RootPart.Scale = scale; | 490 | sog2.RootPart.Scale = scale; |
490 | 491 | ||
491 | db.StoreObject(sog2, region3); | 492 | db.StoreObject(sog2, region3); |
492 | List<SceneObjectGroup> sogs = db.LoadObjects(region3); | 493 | List<SceneObjectGroup> sogs = db.LoadObjects(region3); |
493 | Assert.That(sogs.Count, Is.EqualTo(1), "Assert.That(sogs.Count, Is.EqualTo(1))"); | 494 | Assert.That(sogs.Count, Is.EqualTo(1), "Assert.That(sogs.Count, Is.EqualTo(1))"); |
494 | 495 | ||
495 | SceneObjectGroup retsog = FindSOG("West Adam", region3); | 496 | SceneObjectGroup retsog = FindSOG("West Adam", region3); |
496 | Assert.That(retsog,Is.Not.Null); | 497 | Assert.That(retsog,Is.Not.Null); |
497 | SceneObjectPart p = retsog.RootPart; | 498 | SceneObjectPart p = retsog.RootPart; |
@@ -518,7 +519,7 @@ namespace OpenSim.Data.Tests | |||
518 | Assert.That(clickaction,Is.EqualTo(p.ClickAction), "Assert.That(clickaction,Is.EqualTo(p.ClickAction))"); | 519 | Assert.That(clickaction,Is.EqualTo(p.ClickAction), "Assert.That(clickaction,Is.EqualTo(p.ClickAction))"); |
519 | Assert.That(scale,Is.EqualTo(p.Scale), "Assert.That(scale,Is.EqualTo(p.Scale))"); | 520 | Assert.That(scale,Is.EqualTo(p.Scale), "Assert.That(scale,Is.EqualTo(p.Scale))"); |
520 | } | 521 | } |
521 | 522 | ||
522 | /// <summary> | 523 | /// <summary> |
523 | /// Test storage and retrieval of a scene object with a large number of parts. | 524 | /// Test storage and retrieval of a scene object with a large number of parts. |
524 | /// </summary> | 525 | /// </summary> |
@@ -526,12 +527,12 @@ namespace OpenSim.Data.Tests | |||
526 | public void T015_LargeSceneObjects() | 527 | public void T015_LargeSceneObjects() |
527 | { | 528 | { |
528 | TestHelpers.InMethod(); | 529 | TestHelpers.InMethod(); |
529 | 530 | ||
530 | UUID id = UUID.Random(); | 531 | UUID id = UUID.Random(); |
531 | Dictionary<UUID, SceneObjectPart> mydic = new Dictionary<UUID, SceneObjectPart>(); | 532 | Dictionary<UUID, SceneObjectPart> mydic = new Dictionary<UUID, SceneObjectPart>(); |
532 | SceneObjectGroup sog = NewSOG("Test SOG", id, region4); | 533 | SceneObjectGroup sog = NewSOG("Test SOG", id, region4); |
533 | mydic.Add(sog.RootPart.UUID,sog.RootPart); | 534 | mydic.Add(sog.RootPart.UUID,sog.RootPart); |
534 | for (int i = 0; i < 30; i++) | 535 | for (int i = 0; i < 30; i++) |
535 | { | 536 | { |
536 | UUID tmp = UUID.Random(); | 537 | UUID tmp = UUID.Random(); |
537 | SceneObjectPart sop = NewSOP(("Test SOP " + i.ToString()),tmp); | 538 | SceneObjectPart sop = NewSOP(("Test SOP " + i.ToString()),tmp); |
@@ -541,20 +542,20 @@ namespace OpenSim.Data.Tests | |||
541 | Vector3 velocity = new Vector3(random.Next(),random.Next(),random.Next()); | 542 | Vector3 velocity = new Vector3(random.Next(),random.Next(),random.Next()); |
542 | Vector3 angvelo = new Vector3(random.Next(),random.Next(),random.Next()); | 543 | Vector3 angvelo = new Vector3(random.Next(),random.Next(),random.Next()); |
543 | Vector3 accel = new Vector3(random.Next(),random.Next(),random.Next()); | 544 | Vector3 accel = new Vector3(random.Next(),random.Next(),random.Next()); |
544 | 545 | ||
545 | sop.GroupPosition = groupos; | 546 | sop.GroupPosition = groupos; |
546 | sop.RotationOffset = rotoff; | 547 | sop.RotationOffset = rotoff; |
547 | sop.OffsetPosition = offset; | 548 | sop.OffsetPosition = offset; |
548 | sop.Velocity = velocity; | 549 | sop.Velocity = velocity; |
549 | sop.AngularVelocity = angvelo; | 550 | sop.AngularVelocity = angvelo; |
550 | sop.Acceleration = accel; | 551 | sop.Acceleration = accel; |
551 | 552 | ||
552 | mydic.Add(tmp,sop); | 553 | mydic.Add(tmp,sop); |
553 | sog.AddPart(sop); | 554 | sog.AddPart(sop); |
554 | } | 555 | } |
555 | 556 | ||
556 | db.StoreObject(sog, region4); | 557 | db.StoreObject(sog, region4); |
557 | 558 | ||
558 | SceneObjectGroup retsog = FindSOG("Test SOG", region4); | 559 | SceneObjectGroup retsog = FindSOG("Test SOG", region4); |
559 | SceneObjectPart[] parts = retsog.Parts; | 560 | SceneObjectPart[] parts = retsog.Parts; |
560 | for (int i = 0; i < 30; i++) | 561 | for (int i = 0; i < 30; i++) |
@@ -573,7 +574,7 @@ namespace OpenSim.Data.Tests | |||
573 | public void T016_RandomSogWithSceneParts() | 574 | public void T016_RandomSogWithSceneParts() |
574 | { | 575 | { |
575 | TestHelpers.InMethod(); | 576 | TestHelpers.InMethod(); |
576 | 577 | ||
577 | PropertyScrambler<SceneObjectPart> scrambler = | 578 | PropertyScrambler<SceneObjectPart> scrambler = |
578 | new PropertyScrambler<SceneObjectPart>() | 579 | new PropertyScrambler<SceneObjectPart>() |
579 | .DontScramble(x => x.UUID); | 580 | .DontScramble(x => x.UUID); |
@@ -633,22 +634,22 @@ namespace OpenSim.Data.Tests | |||
633 | SceneObjectGroup sog = FindSOG(name, region1); | 634 | SceneObjectGroup sog = FindSOG(name, region1); |
634 | if (sog == null) | 635 | if (sog == null) |
635 | { | 636 | { |
636 | sog = NewSOG(name, prim1, region1); | 637 | sog = NewSOG(name, prim1, region1); |
637 | db.StoreObject(sog, region1); | 638 | db.StoreObject(sog, region1); |
638 | } | 639 | } |
639 | return sog; | 640 | return sog; |
640 | } | 641 | } |
641 | 642 | ||
642 | // NOTE: it is a bad practice to rely on some of the previous tests having been run before. | 643 | // NOTE: it is a bad practice to rely on some of the previous tests having been run before. |
643 | // If the tests are run manually, one at a time, each starts with full class init (DB cleared). | 644 | // If the tests are run manually, one at a time, each starts with full class init (DB cleared). |
644 | // Even when all tests are run, NUnit 2.5+ no longer guarantee a specific test order. | 645 | // Even when all tests are run, NUnit 2.5+ no longer guarantee a specific test order. |
645 | // We shouldn't expect to find anything in the DB if we haven't put it there *in the same test*! | 646 | // We shouldn't expect to find anything in the DB if we haven't put it there *in the same test*! |
646 | 647 | ||
647 | [Test] | 648 | [Test] |
648 | public void T020_PrimInventoryEmpty() | 649 | public void T020_PrimInventoryEmpty() |
649 | { | 650 | { |
650 | TestHelpers.InMethod(); | 651 | TestHelpers.InMethod(); |
651 | 652 | ||
652 | SceneObjectGroup sog = GetMySOG("object1"); | 653 | SceneObjectGroup sog = GetMySOG("object1"); |
653 | TaskInventoryItem t = sog.GetInventoryItem(sog.RootPart.LocalId, item1); | 654 | TaskInventoryItem t = sog.GetInventoryItem(sog.RootPart.LocalId, item1); |
654 | Assert.That(t, Is.Null); | 655 | Assert.That(t, Is.Null); |
@@ -672,14 +673,14 @@ namespace OpenSim.Data.Tests | |||
672 | public void T021_PrimInventoryBasic() | 673 | public void T021_PrimInventoryBasic() |
673 | { | 674 | { |
674 | TestHelpers.InMethod(); | 675 | TestHelpers.InMethod(); |
675 | 676 | ||
676 | SceneObjectGroup sog = GetMySOG("object1"); | 677 | SceneObjectGroup sog = GetMySOG("object1"); |
677 | InventoryItemBase i = NewItem(item1, zero, zero, itemname1, zero); | 678 | InventoryItemBase i = NewItem(item1, zero, zero, itemname1, zero); |
678 | 679 | ||
679 | Assert.That(sog.AddInventoryItem(zero, sog.RootPart.LocalId, i, zero), Is.True); | 680 | Assert.That(sog.AddInventoryItem(zero, sog.RootPart.LocalId, i, zero), Is.True); |
680 | TaskInventoryItem t = sog.GetInventoryItem(sog.RootPart.LocalId, item1); | 681 | TaskInventoryItem t = sog.GetInventoryItem(sog.RootPart.LocalId, item1); |
681 | Assert.That(t.Name, Is.EqualTo(itemname1), "Assert.That(t.Name, Is.EqualTo(itemname1))"); | 682 | Assert.That(t.Name, Is.EqualTo(itemname1), "Assert.That(t.Name, Is.EqualTo(itemname1))"); |
682 | 683 | ||
683 | StoreInventory(sog); | 684 | StoreInventory(sog); |
684 | 685 | ||
685 | SceneObjectGroup sog1 = FindSOG("object1", region1); | 686 | SceneObjectGroup sog1 = FindSOG("object1", region1); |
@@ -707,12 +708,12 @@ namespace OpenSim.Data.Tests | |||
707 | t = sog.GetInventoryItem(sog.RootPart.LocalId, item1); | 708 | t = sog.GetInventoryItem(sog.RootPart.LocalId, item1); |
708 | Assert.That(t, Is.Null); | 709 | Assert.That(t, Is.Null); |
709 | } | 710 | } |
710 | 711 | ||
711 | [Test] | 712 | [Test] |
712 | public void T025_PrimInventoryPersistency() | 713 | public void T025_PrimInventoryPersistency() |
713 | { | 714 | { |
714 | TestHelpers.InMethod(); | 715 | TestHelpers.InMethod(); |
715 | 716 | ||
716 | InventoryItemBase i = new InventoryItemBase(); | 717 | InventoryItemBase i = new InventoryItemBase(); |
717 | UUID id = UUID.Random(); | 718 | UUID id = UUID.Random(); |
718 | i.ID = id; | 719 | i.ID = id; |
@@ -751,11 +752,11 @@ namespace OpenSim.Data.Tests | |||
751 | i.Flags = flags; | 752 | i.Flags = flags; |
752 | int creationd = random.Next(); | 753 | int creationd = random.Next(); |
753 | i.CreationDate = creationd; | 754 | i.CreationDate = creationd; |
754 | 755 | ||
755 | SceneObjectGroup sog = GetMySOG("object1"); | 756 | SceneObjectGroup sog = GetMySOG("object1"); |
756 | Assert.That(sog.AddInventoryItem(zero, sog.RootPart.LocalId, i, zero), Is.True); | 757 | Assert.That(sog.AddInventoryItem(zero, sog.RootPart.LocalId, i, zero), Is.True); |
757 | TaskInventoryItem t = sog.GetInventoryItem(sog.RootPart.LocalId, id); | 758 | TaskInventoryItem t = sog.GetInventoryItem(sog.RootPart.LocalId, id); |
758 | 759 | ||
759 | Assert.That(t.Name, Is.EqualTo(name), "Assert.That(t.Name, Is.EqualTo(name))"); | 760 | Assert.That(t.Name, Is.EqualTo(name), "Assert.That(t.Name, Is.EqualTo(name))"); |
760 | Assert.That(t.AssetID,Is.EqualTo(assetid), "Assert.That(t.AssetID,Is.EqualTo(assetid))"); | 761 | Assert.That(t.AssetID,Is.EqualTo(assetid), "Assert.That(t.AssetID,Is.EqualTo(assetid))"); |
761 | Assert.That(t.BasePermissions,Is.EqualTo(baseperm), "Assert.That(t.BasePermissions,Is.EqualTo(baseperm))"); | 762 | Assert.That(t.BasePermissions,Is.EqualTo(baseperm), "Assert.That(t.BasePermissions,Is.EqualTo(baseperm))"); |
@@ -779,13 +780,13 @@ namespace OpenSim.Data.Tests | |||
779 | Assert.That(t.ParentID,Is.EqualTo(sog.RootPart.FolderID), "Assert.That(t.ParentID,Is.EqualTo(sog.RootPart.FolderID))"); | 780 | Assert.That(t.ParentID,Is.EqualTo(sog.RootPart.FolderID), "Assert.That(t.ParentID,Is.EqualTo(sog.RootPart.FolderID))"); |
780 | Assert.That(t.ParentPartID,Is.EqualTo(sog.RootPart.UUID), "Assert.That(t.ParentPartID,Is.EqualTo(sog.RootPart.UUID))"); | 781 | Assert.That(t.ParentPartID,Is.EqualTo(sog.RootPart.UUID), "Assert.That(t.ParentPartID,Is.EqualTo(sog.RootPart.UUID))"); |
781 | } | 782 | } |
782 | 783 | ||
783 | [Test] | 784 | [Test] |
784 | [ExpectedException(typeof(ArgumentException))] | 785 | [ExpectedException(typeof(ArgumentException))] |
785 | public void T026_PrimInventoryMany() | 786 | public void T026_PrimInventoryMany() |
786 | { | 787 | { |
787 | TestHelpers.InMethod(); | 788 | TestHelpers.InMethod(); |
788 | 789 | ||
789 | UUID i1,i2,i3,i4; | 790 | UUID i1,i2,i3,i4; |
790 | i1 = UUID.Random(); | 791 | i1 = UUID.Random(); |
791 | i2 = UUID.Random(); | 792 | i2 = UUID.Random(); |
@@ -795,14 +796,14 @@ namespace OpenSim.Data.Tests | |||
795 | InventoryItemBase ib2 = NewItem(i2, zero, zero, RandomName(), zero); | 796 | InventoryItemBase ib2 = NewItem(i2, zero, zero, RandomName(), zero); |
796 | InventoryItemBase ib3 = NewItem(i3, zero, zero, RandomName(), zero); | 797 | InventoryItemBase ib3 = NewItem(i3, zero, zero, RandomName(), zero); |
797 | InventoryItemBase ib4 = NewItem(i4, zero, zero, RandomName(), zero); | 798 | InventoryItemBase ib4 = NewItem(i4, zero, zero, RandomName(), zero); |
798 | 799 | ||
799 | SceneObjectGroup sog = FindSOG("object1", region1); | 800 | SceneObjectGroup sog = FindSOG("object1", region1); |
800 | 801 | ||
801 | Assert.That(sog.AddInventoryItem(zero, sog.RootPart.LocalId, ib1, zero), Is.True); | 802 | Assert.That(sog.AddInventoryItem(zero, sog.RootPart.LocalId, ib1, zero), Is.True); |
802 | Assert.That(sog.AddInventoryItem(zero, sog.RootPart.LocalId, ib2, zero), Is.True); | 803 | Assert.That(sog.AddInventoryItem(zero, sog.RootPart.LocalId, ib2, zero), Is.True); |
803 | Assert.That(sog.AddInventoryItem(zero, sog.RootPart.LocalId, ib3, zero), Is.True); | 804 | Assert.That(sog.AddInventoryItem(zero, sog.RootPart.LocalId, ib3, zero), Is.True); |
804 | Assert.That(sog.AddInventoryItem(zero, sog.RootPart.LocalId, ib4, zero), Is.True); | 805 | Assert.That(sog.AddInventoryItem(zero, sog.RootPart.LocalId, ib4, zero), Is.True); |
805 | 806 | ||
806 | TaskInventoryItem t1 = sog.GetInventoryItem(sog.RootPart.LocalId, i1); | 807 | TaskInventoryItem t1 = sog.GetInventoryItem(sog.RootPart.LocalId, i1); |
807 | Assert.That(t1.Name, Is.EqualTo(ib1.Name), "Assert.That(t1.Name, Is.EqualTo(ib1.Name))"); | 808 | Assert.That(t1.Name, Is.EqualTo(ib1.Name), "Assert.That(t1.Name, Is.EqualTo(ib1.Name))"); |
808 | TaskInventoryItem t2 = sog.GetInventoryItem(sog.RootPart.LocalId, i2); | 809 | TaskInventoryItem t2 = sog.GetInventoryItem(sog.RootPart.LocalId, i2); |
@@ -817,7 +818,7 @@ namespace OpenSim.Data.Tests | |||
817 | public void T052_RemoveObject() | 818 | public void T052_RemoveObject() |
818 | { | 819 | { |
819 | TestHelpers.InMethod(); | 820 | TestHelpers.InMethod(); |
820 | 821 | ||
821 | db.RemoveObject(prim1, region1); | 822 | db.RemoveObject(prim1, region1); |
822 | SceneObjectGroup sog = FindSOG("object1", region1); | 823 | SceneObjectGroup sog = FindSOG("object1", region1); |
823 | Assert.That(sog, Is.Null); | 824 | Assert.That(sog, Is.Null); |
@@ -827,7 +828,7 @@ namespace OpenSim.Data.Tests | |||
827 | public void T100_DefaultRegionInfo() | 828 | public void T100_DefaultRegionInfo() |
828 | { | 829 | { |
829 | TestHelpers.InMethod(); | 830 | TestHelpers.InMethod(); |
830 | 831 | ||
831 | RegionSettings r1 = db.LoadRegionSettings(region1); | 832 | RegionSettings r1 = db.LoadRegionSettings(region1); |
832 | Assert.That(r1.RegionUUID, Is.EqualTo(region1), "Assert.That(r1.RegionUUID, Is.EqualTo(region1))"); | 833 | Assert.That(r1.RegionUUID, Is.EqualTo(region1), "Assert.That(r1.RegionUUID, Is.EqualTo(region1))"); |
833 | 834 | ||
@@ -839,7 +840,7 @@ namespace OpenSim.Data.Tests | |||
839 | public void T101_UpdateRegionInfo() | 840 | public void T101_UpdateRegionInfo() |
840 | { | 841 | { |
841 | TestHelpers.InMethod(); | 842 | TestHelpers.InMethod(); |
842 | 843 | ||
843 | int agentlimit = random.Next(); | 844 | int agentlimit = random.Next(); |
844 | double objectbonus = random.Next(); | 845 | double objectbonus = random.Next(); |
845 | int maturity = random.Next(); | 846 | int maturity = random.Next(); |
@@ -899,9 +900,9 @@ namespace OpenSim.Data.Tests | |||
899 | r1.FixedSun = true; | 900 | r1.FixedSun = true; |
900 | r1.SunPosition = sunpos; | 901 | r1.SunPosition = sunpos; |
901 | r1.Covenant = cov; | 902 | r1.Covenant = cov; |
902 | 903 | ||
903 | db.StoreRegionSettings(r1); | 904 | db.StoreRegionSettings(r1); |
904 | 905 | ||
905 | RegionSettings r1a = db.LoadRegionSettings(region1); | 906 | RegionSettings r1a = db.LoadRegionSettings(region1); |
906 | Assert.That(r1a.RegionUUID, Is.EqualTo(region1), "Assert.That(r1a.RegionUUID, Is.EqualTo(region1))"); | 907 | Assert.That(r1a.RegionUUID, Is.EqualTo(region1), "Assert.That(r1a.RegionUUID, Is.EqualTo(region1))"); |
907 | Assert.That(r1a.BlockTerraform,Is.True); | 908 | Assert.That(r1a.BlockTerraform,Is.True); |
@@ -938,14 +939,14 @@ namespace OpenSim.Data.Tests | |||
938 | //Assert.That(r1a.TerrainImageID,Is.EqualTo(terimgid), "Assert.That(r1a.TerrainImageID,Is.EqualTo(terimgid))"); | 939 | //Assert.That(r1a.TerrainImageID,Is.EqualTo(terimgid), "Assert.That(r1a.TerrainImageID,Is.EqualTo(terimgid))"); |
939 | Assert.That(r1a.FixedSun,Is.True); | 940 | Assert.That(r1a.FixedSun,Is.True); |
940 | Assert.That(r1a.SunPosition, Is.EqualTo(sunpos), "Assert.That(r1a.SunPosition, Is.EqualTo(sunpos))"); | 941 | Assert.That(r1a.SunPosition, Is.EqualTo(sunpos), "Assert.That(r1a.SunPosition, Is.EqualTo(sunpos))"); |
941 | Assert.That(r1a.Covenant, Is.EqualTo(cov), "Assert.That(r1a.Covenant, Is.EqualTo(cov))"); | 942 | Assert.That(r1a.Covenant, Is.EqualTo(cov), "Assert.That(r1a.Covenant, Is.EqualTo(cov))"); |
942 | } | 943 | } |
943 | 944 | ||
944 | [Test] | 945 | [Test] |
945 | public void T300_NoTerrain() | 946 | public void T300_NoTerrain() |
946 | { | 947 | { |
947 | TestHelpers.InMethod(); | 948 | TestHelpers.InMethod(); |
948 | 949 | ||
949 | Assert.That(db.LoadTerrain(zero), Is.Null); | 950 | Assert.That(db.LoadTerrain(zero), Is.Null); |
950 | Assert.That(db.LoadTerrain(region1), Is.Null); | 951 | Assert.That(db.LoadTerrain(region1), Is.Null); |
951 | Assert.That(db.LoadTerrain(region2), Is.Null); | 952 | Assert.That(db.LoadTerrain(region2), Is.Null); |
@@ -956,10 +957,13 @@ namespace OpenSim.Data.Tests | |||
956 | public void T301_CreateTerrain() | 957 | public void T301_CreateTerrain() |
957 | { | 958 | { |
958 | TestHelpers.InMethod(); | 959 | TestHelpers.InMethod(); |
959 | 960 | ||
960 | double[,] t1 = GenTerrain(height1); | 961 | double[,] t1 = GenTerrain(height1); |
961 | db.StoreTerrain(t1, region1); | 962 | db.StoreTerrain(t1, region1); |
962 | 963 | ||
964 | // store terrain is async | ||
965 | Thread.Sleep(1000); | ||
966 | |||
963 | Assert.That(db.LoadTerrain(zero), Is.Null); | 967 | Assert.That(db.LoadTerrain(zero), Is.Null); |
964 | Assert.That(db.LoadTerrain(region1), Is.Not.Null); | 968 | Assert.That(db.LoadTerrain(region1), Is.Not.Null); |
965 | Assert.That(db.LoadTerrain(region2), Is.Null); | 969 | Assert.That(db.LoadTerrain(region2), Is.Null); |
@@ -970,7 +974,7 @@ namespace OpenSim.Data.Tests | |||
970 | public void T302_FetchTerrain() | 974 | public void T302_FetchTerrain() |
971 | { | 975 | { |
972 | TestHelpers.InMethod(); | 976 | TestHelpers.InMethod(); |
973 | 977 | ||
974 | double[,] baseterrain1 = GenTerrain(height1); | 978 | double[,] baseterrain1 = GenTerrain(height1); |
975 | double[,] baseterrain2 = GenTerrain(height2); | 979 | double[,] baseterrain2 = GenTerrain(height2); |
976 | double[,] t1 = db.LoadTerrain(region1); | 980 | double[,] t1 = db.LoadTerrain(region1); |
@@ -982,11 +986,14 @@ namespace OpenSim.Data.Tests | |||
982 | public void T303_UpdateTerrain() | 986 | public void T303_UpdateTerrain() |
983 | { | 987 | { |
984 | TestHelpers.InMethod(); | 988 | TestHelpers.InMethod(); |
985 | 989 | ||
986 | double[,] baseterrain1 = GenTerrain(height1); | 990 | double[,] baseterrain1 = GenTerrain(height1); |
987 | double[,] baseterrain2 = GenTerrain(height2); | 991 | double[,] baseterrain2 = GenTerrain(height2); |
988 | db.StoreTerrain(baseterrain2, region1); | 992 | db.StoreTerrain(baseterrain2, region1); |
989 | 993 | ||
994 | // store terrain is async | ||
995 | Thread.Sleep(1000); | ||
996 | |||
990 | double[,] t1 = db.LoadTerrain(region1); | 997 | double[,] t1 = db.LoadTerrain(region1); |
991 | Assert.That(CompareTerrain(t1, baseterrain1), Is.False); | 998 | Assert.That(CompareTerrain(t1, baseterrain1), Is.False); |
992 | Assert.That(CompareTerrain(t1, baseterrain2), Is.True); | 999 | Assert.That(CompareTerrain(t1, baseterrain2), Is.True); |
@@ -996,7 +1003,7 @@ namespace OpenSim.Data.Tests | |||
996 | public void T400_EmptyLand() | 1003 | public void T400_EmptyLand() |
997 | { | 1004 | { |
998 | TestHelpers.InMethod(); | 1005 | TestHelpers.InMethod(); |
999 | 1006 | ||
1000 | Assert.That(db.LoadLandObjects(zero).Count, Is.EqualTo(0), "Assert.That(db.LoadLandObjects(zero).Count, Is.EqualTo(0))"); | 1007 | Assert.That(db.LoadLandObjects(zero).Count, Is.EqualTo(0), "Assert.That(db.LoadLandObjects(zero).Count, Is.EqualTo(0))"); |
1001 | Assert.That(db.LoadLandObjects(region1).Count, Is.EqualTo(0), "Assert.That(db.LoadLandObjects(region1).Count, Is.EqualTo(0))"); | 1008 | Assert.That(db.LoadLandObjects(region1).Count, Is.EqualTo(0), "Assert.That(db.LoadLandObjects(region1).Count, Is.EqualTo(0))"); |
1002 | Assert.That(db.LoadLandObjects(region2).Count, Is.EqualTo(0), "Assert.That(db.LoadLandObjects(region2).Count, Is.EqualTo(0))"); | 1009 | Assert.That(db.LoadLandObjects(region2).Count, Is.EqualTo(0), "Assert.That(db.LoadLandObjects(region2).Count, Is.EqualTo(0))"); |
@@ -1018,15 +1025,15 @@ namespace OpenSim.Data.Tests | |||
1018 | for (int x = 0; x < Constants.RegionSize; x++) | 1025 | for (int x = 0; x < Constants.RegionSize; x++) |
1019 | for (int y = 0; y < Constants.RegionSize; y++) | 1026 | for (int y = 0; y < Constants.RegionSize; y++) |
1020 | terret[x,y] = value; | 1027 | terret[x,y] = value; |
1021 | 1028 | ||
1022 | return terret; | 1029 | return terret; |
1023 | } | 1030 | } |
1024 | 1031 | ||
1025 | private bool CompareTerrain(double[,] one, double[,] two) | 1032 | private bool CompareTerrain(double[,] one, double[,] two) |
1026 | { | 1033 | { |
1027 | for (int x = 0; x < Constants.RegionSize; x++) | 1034 | for (int x = 0; x < Constants.RegionSize; x++) |
1028 | for (int y = 0; y < Constants.RegionSize; y++) | 1035 | for (int y = 0; y < Constants.RegionSize; y++) |
1029 | if (one[x,y] != two[x,y]) | 1036 | if (one[x,y] != two[x,y]) |
1030 | return false; | 1037 | return false; |
1031 | 1038 | ||
1032 | return true; | 1039 | return true; |
@@ -1046,12 +1053,12 @@ namespace OpenSim.Data.Tests | |||
1046 | // common failure case is people adding new fields that aren't | 1053 | // common failure case is people adding new fields that aren't |
1047 | // initialized, but have non-null db constraints. We should | 1054 | // initialized, but have non-null db constraints. We should |
1048 | // honestly be passing more and more null things in here. | 1055 | // honestly be passing more and more null things in here. |
1049 | // | 1056 | // |
1050 | // Please note that in Sqlite.BuildPrim there is a commented out inline version | 1057 | // Please note that in Sqlite.BuildPrim there is a commented out inline version |
1051 | // of this so you can debug and step through the build process and check the fields | 1058 | // of this so you can debug and step through the build process and check the fields |
1052 | // | 1059 | // |
1053 | // Real World Value: Tests for situation where extending a SceneObjectGroup/SceneObjectPart | 1060 | // Real World Value: Tests for situation where extending a SceneObjectGroup/SceneObjectPart |
1054 | // causes the application to crash at the database layer because of null values | 1061 | // causes the application to crash at the database layer because of null values |
1055 | // in NOT NULL fields | 1062 | // in NOT NULL fields |
1056 | // | 1063 | // |
1057 | private SceneObjectGroup NewSOG(string name, UUID uuid, UUID regionId) | 1064 | private SceneObjectGroup NewSOG(string name, UUID uuid, UUID regionId) |
@@ -1075,7 +1082,7 @@ namespace OpenSim.Data.Tests | |||
1075 | 1082 | ||
1076 | return sog; | 1083 | return sog; |
1077 | } | 1084 | } |
1078 | 1085 | ||
1079 | private SceneObjectPart NewSOP(string name, UUID uuid) | 1086 | private SceneObjectPart NewSOP(string name, UUID uuid) |
1080 | { | 1087 | { |
1081 | SceneObjectPart sop = new SceneObjectPart(); | 1088 | SceneObjectPart sop = new SceneObjectPart(); |
@@ -1089,7 +1096,7 @@ namespace OpenSim.Data.Tests | |||
1089 | return sop; | 1096 | return sop; |
1090 | } | 1097 | } |
1091 | 1098 | ||
1092 | // These are copied from the Inventory Item tests | 1099 | // These are copied from the Inventory Item tests |
1093 | 1100 | ||
1094 | private InventoryItemBase NewItem(UUID id, UUID parent, UUID owner, string name, UUID asset) | 1101 | private InventoryItemBase NewItem(UUID id, UUID parent, UUID owner, string name, UUID asset) |
1095 | { | 1102 | { |
@@ -1107,7 +1114,7 @@ namespace OpenSim.Data.Tests | |||
1107 | private static string RandomName() | 1114 | private static string RandomName() |
1108 | { | 1115 | { |
1109 | StringBuilder name = new StringBuilder(); | 1116 | StringBuilder name = new StringBuilder(); |
1110 | int size = random.Next(5,12); | 1117 | int size = random.Next(5,12); |
1111 | char ch ; | 1118 | char ch ; |
1112 | for (int i=0; i<size; i++) | 1119 | for (int i=0; i<size; i++) |
1113 | { | 1120 | { |
diff --git a/OpenSim/Data/Tests/Resources/TestDataConnections.ini b/OpenSim/Data/Tests/Resources/TestDataConnections.ini index 75f7855..2ddec8b 100644 --- a/OpenSim/Data/Tests/Resources/TestDataConnections.ini +++ b/OpenSim/Data/Tests/Resources/TestDataConnections.ini | |||
@@ -16,9 +16,9 @@ | |||
16 | ; file for the DB. If you want the resulting DB to persist (e.g. for performance testing, | 16 | ; file for the DB. If you want the resulting DB to persist (e.g. for performance testing, |
17 | ; when filling up the tables can take a long time), explicitly specify a conn string like this: | 17 | ; when filling up the tables can take a long time), explicitly specify a conn string like this: |
18 | 18 | ||
19 | ; SqliteConnection="URI=file:../db/<path_to_your_file>,version=3" | 19 | ; SqliteConnection="URI=file:../../db/<path_to_your_file>,version=3" |
20 | 20 | ||
21 | [TestConnections] | 21 | [TestConnections] |
22 | MySqlConnection="Server=localhost;Port=3306;Database=opensim-nunit;User ID=opensim-nunit;Password=opensim-nunit;" | 22 | MySqlConnection="Server=localhost;Port=3306;Database=opensim-nunit;User ID=opensim-nunit;Password=opensim-nunit;" |
23 | SqlConnection="Server=.\SQL2008;Database=opensim-nunit;Trusted_Connection=True;" | 23 | SqlConnection="Server=.\SQL2008;Database=opensim-nunit;Trusted_Connection=True;" |
24 | SqliteConnection="URI=file:../db/opensim-nunit.db,version=3" \ No newline at end of file | 24 | SqliteConnection="URI=file:../../db/opensim-nunit.db,version=3" |