aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Data/NHibernate/Resources/MsSql2005Dialect/001_EstateStore.sql2
-rw-r--r--OpenSim/Data/Tests/BasicEstateTest.cs518
-rw-r--r--OpenSim/Data/Tests/DataTestUtil.cs62
3 files changed, 494 insertions, 88 deletions
diff --git a/OpenSim/Data/NHibernate/Resources/MsSql2005Dialect/001_EstateStore.sql b/OpenSim/Data/NHibernate/Resources/MsSql2005Dialect/001_EstateStore.sql
index 893e2a2..0e95963 100644
--- a/OpenSim/Data/NHibernate/Resources/MsSql2005Dialect/001_EstateStore.sql
+++ b/OpenSim/Data/NHibernate/Resources/MsSql2005Dialect/001_EstateStore.sql
@@ -7,7 +7,7 @@ CREATE TABLE EstateSettings (
7 RedirectGridY INT NULL, 7 RedirectGridY INT NULL,
8 BillableFactor REAL NULL, 8 BillableFactor REAL NULL,
9 PricePerMeter INT NULL, 9 PricePerMeter INT NULL,
10 SunPosition REAL NULL, 10 SunPosition FLOAT NULL,
11 11
12 UseGlobalTime BIT NULL, 12 UseGlobalTime BIT NULL,
13 FixedSun BIT NULL, 13 FixedSun BIT NULL,
diff --git a/OpenSim/Data/Tests/BasicEstateTest.cs b/OpenSim/Data/Tests/BasicEstateTest.cs
index d0f7a8b..04ff8ec 100644
--- a/OpenSim/Data/Tests/BasicEstateTest.cs
+++ b/OpenSim/Data/Tests/BasicEstateTest.cs
@@ -32,6 +32,7 @@ using NUnit.Framework.SyntaxHelpers;
32using OpenMetaverse; 32using OpenMetaverse;
33using OpenSim.Framework; 33using OpenSim.Framework;
34using OpenSim.Region.Framework.Interfaces; 34using OpenSim.Region.Framework.Interfaces;
35using System.Text;
35 36
36namespace OpenSim.Data.Tests 37namespace OpenSim.Data.Tests
37{ 38{
@@ -39,9 +40,18 @@ namespace OpenSim.Data.Tests
39 { 40 {
40 public IEstateDataStore db; 41 public IEstateDataStore db;
41 public IRegionDataStore regionDb; 42 public IRegionDataStore regionDb;
42 public UUID prim1; 43
43 public static Random random; 44 public static UUID REGION_ID = new UUID("250d214e-1c7e-4f9b-a488-87c5e53feed7");
44 45
46 public static UUID USER_ID_1 = new UUID("250d214e-1c7e-4f9b-a488-87c5e53feed1");
47 public static UUID USER_ID_2 = new UUID("250d214e-1c7e-4f9b-a488-87c5e53feed2");
48
49 public static UUID MANAGER_ID_1 = new UUID("250d214e-1c7e-4f9b-a488-87c5e53feed3");
50 public static UUID MANAGER_ID_2 = new UUID("250d214e-1c7e-4f9b-a488-87c5e53feed4");
51
52 public static UUID GROUP_ID_1 = new UUID("250d214e-1c7e-4f9b-a488-87c5e53feed5");
53 public static UUID GROUP_ID_2 = new UUID("250d214e-1c7e-4f9b-a488-87c5e53feed6");
54
45 public void SuperInit() 55 public void SuperInit()
46 { 56 {
47 try 57 try
@@ -52,103 +62,437 @@ namespace OpenSim.Data.Tests
52 { 62 {
53 // I don't care, just leave log4net off 63 // I don't care, just leave log4net off
54 } 64 }
55 prim1 = UUID.Random(); 65 }
56 random = new Random(); 66
67 #region 0Tests
68
69 [Test]
70 public void T010_EstateSettingsSimpleStorage_MinimumParameterSet()
71 {
72 EstateSettingsSimpleStorage(
73 REGION_ID,
74 DataTestUtil.STRING_MIN,
75 DataTestUtil.UNSIGNED_INTEGER_MIN,
76 DataTestUtil.FLOAT_MIN,
77 DataTestUtil.INTEGER_MIN,
78 DataTestUtil.INTEGER_MIN,
79 DataTestUtil.INTEGER_MIN,
80 DataTestUtil.BOOLEAN_MIN,
81 DataTestUtil.BOOLEAN_MIN,
82 DataTestUtil.DOUBLE_MIN,
83 DataTestUtil.BOOLEAN_MIN,
84 DataTestUtil.BOOLEAN_MIN,
85 DataTestUtil.BOOLEAN_MIN,
86 DataTestUtil.BOOLEAN_MIN,
87 DataTestUtil.BOOLEAN_MIN,
88 DataTestUtil.BOOLEAN_MIN,
89 DataTestUtil.BOOLEAN_MIN,
90 DataTestUtil.BOOLEAN_MIN,
91 DataTestUtil.BOOLEAN_MIN,
92 DataTestUtil.BOOLEAN_MIN,
93 DataTestUtil.BOOLEAN_MIN,
94 DataTestUtil.BOOLEAN_MIN,
95 DataTestUtil.STRING_MIN,
96 DataTestUtil.UUID_MIN
97 );
98 }
99
100 [Test]
101 public void T011_EstateSettingsSimpleStorage_MaximumParameterSet()
102 {
103 EstateSettingsSimpleStorage(
104 REGION_ID,
105 DataTestUtil.STRING_MAX(64),
106 DataTestUtil.UNSIGNED_INTEGER_MAX,
107 DataTestUtil.FLOAT_MAX,
108 DataTestUtil.INTEGER_MAX,
109 DataTestUtil.INTEGER_MAX,
110 DataTestUtil.INTEGER_MAX,
111 DataTestUtil.BOOLEAN_MAX,
112 DataTestUtil.BOOLEAN_MAX,
113 DataTestUtil.DOUBLE_MAX,
114 DataTestUtil.BOOLEAN_MAX,
115 DataTestUtil.BOOLEAN_MAX,
116 DataTestUtil.BOOLEAN_MAX,
117 DataTestUtil.BOOLEAN_MAX,
118 DataTestUtil.BOOLEAN_MAX,
119 DataTestUtil.BOOLEAN_MAX,
120 DataTestUtil.BOOLEAN_MAX,
121 DataTestUtil.BOOLEAN_MAX,
122 DataTestUtil.BOOLEAN_MAX,
123 DataTestUtil.BOOLEAN_MAX,
124 DataTestUtil.BOOLEAN_MAX,
125 DataTestUtil.BOOLEAN_MAX,
126 DataTestUtil.STRING_MAX(255),
127 DataTestUtil.UUID_MAX
128 );
129 }
130
131 [Test]
132 public void T012_EstateSettingsSimpleStorage_AccurateParameterSet()
133 {
134 EstateSettingsSimpleStorage(
135 REGION_ID,
136 DataTestUtil.STRING_MAX(1),
137 DataTestUtil.UNSIGNED_INTEGER_MIN,
138 DataTestUtil.FLOAT_ACCURATE,
139 DataTestUtil.INTEGER_MIN,
140 DataTestUtil.INTEGER_MIN,
141 DataTestUtil.INTEGER_MIN,
142 DataTestUtil.BOOLEAN_MIN,
143 DataTestUtil.BOOLEAN_MIN,
144 DataTestUtil.DOUBLE_ACCURATE,
145 DataTestUtil.BOOLEAN_MIN,
146 DataTestUtil.BOOLEAN_MIN,
147 DataTestUtil.BOOLEAN_MIN,
148 DataTestUtil.BOOLEAN_MIN,
149 DataTestUtil.BOOLEAN_MIN,
150 DataTestUtil.BOOLEAN_MIN,
151 DataTestUtil.BOOLEAN_MIN,
152 DataTestUtil.BOOLEAN_MIN,
153 DataTestUtil.BOOLEAN_MIN,
154 DataTestUtil.BOOLEAN_MIN,
155 DataTestUtil.BOOLEAN_MIN,
156 DataTestUtil.BOOLEAN_MIN,
157 DataTestUtil.STRING_MAX(1),
158 DataTestUtil.UUID_MIN
159 );
160 }
161
162 [Test]
163 public void T020_EstateSettingsManagerList()
164 {
165 // Letting estate store generate rows to database for us
166 EstateSettings originalSettings = db.LoadEstateSettings(REGION_ID);
167
168 originalSettings.EstateManagers = new UUID[] { MANAGER_ID_1, MANAGER_ID_2 };
169
170 // Saving settings.
171 db.StoreEstateSettings(originalSettings);
172
173 // Loading settings to another instance variable.
174 EstateSettings loadedSettings = db.LoadEstateSettings(REGION_ID);
175
176 Assert.AreEqual(2, loadedSettings.EstateManagers.Length);
177 Assert.AreEqual(MANAGER_ID_1, loadedSettings.EstateManagers[0]);
178 Assert.AreEqual(MANAGER_ID_2, loadedSettings.EstateManagers[1]);
179 }
180
181 [Test]
182 public void T021_EstateSettingsUserList()
183 {
184 // Letting estate store generate rows to database for us
185 EstateSettings originalSettings = db.LoadEstateSettings(REGION_ID);
186
187 originalSettings.EstateAccess = new UUID[] { USER_ID_1, USER_ID_2 };
188
189 // Saving settings.
190 db.StoreEstateSettings(originalSettings);
191
192 // Loading settings to another instance variable.
193 EstateSettings loadedSettings = db.LoadEstateSettings(REGION_ID);
194
195 Assert.AreEqual(2, loadedSettings.EstateAccess.Length);
196 Assert.AreEqual(USER_ID_1, loadedSettings.EstateAccess[0]);
197 Assert.AreEqual(USER_ID_2, loadedSettings.EstateAccess[1]);
198 }
199
200 [Test]
201 public void T022_EstateSettingsGroupList()
202 {
203 // Letting estate store generate rows to database for us
204 EstateSettings originalSettings = db.LoadEstateSettings(REGION_ID);
205
206 originalSettings.EstateGroups = new UUID[] { GROUP_ID_1, GROUP_ID_2 };
207
208 // Saving settings.
209 db.StoreEstateSettings(originalSettings);
57 210
211 // Loading settings to another instance variable.
212 EstateSettings loadedSettings = db.LoadEstateSettings(REGION_ID);
213
214 Assert.AreEqual(2, loadedSettings.EstateAccess.Length);
215 Assert.AreEqual(GROUP_ID_1, loadedSettings.EstateGroups[0]);
216 Assert.AreEqual(GROUP_ID_2, loadedSettings.EstateGroups[1]);
58 } 217 }
59 218
60 [Test] 219 [Test]
61 public void T010_StoreEstateSettings() 220 public void T022_EstateSettingsBanList()
221 {
222 // This is not working on native MySQL so ignoring.
223 Assert.Ignore();
224
225 // Letting estate store generate rows to database for us
226 EstateSettings originalSettings = db.LoadEstateSettings(REGION_ID);
227
228 EstateBan estateBan1 = new EstateBan();
229 estateBan1.bannedIP = DataTestUtil.STRING_MIN;
230 estateBan1.bannedIPHostMask = DataTestUtil.STRING_MIN;
231 estateBan1.bannedNameMask = DataTestUtil.STRING_MIN;
232 estateBan1.bannedUUID = DataTestUtil.UUID_MIN;
233
234 EstateBan estateBan2 = new EstateBan();
235 estateBan2.bannedIP = DataTestUtil.STRING_MAX(16);
236 estateBan2.bannedIPHostMask = DataTestUtil.STRING_MAX(16);
237 estateBan2.bannedNameMask = DataTestUtil.STRING_MAX(64);
238 estateBan2.bannedUUID = DataTestUtil.UUID_MAX;
239
240 originalSettings.EstateBans = new EstateBan[] { estateBan1, estateBan2 };
241
242 // Saving settings.
243 db.StoreEstateSettings(originalSettings);
244
245 // Loading settings to another instance variable.
246 EstateSettings loadedSettings = db.LoadEstateSettings(REGION_ID);
247
248 Assert.AreEqual(2, loadedSettings.EstateBans.Length);
249 Assert.AreEqual(DataTestUtil.STRING_MIN, loadedSettings.EstateBans[0].bannedIP);
250 Assert.AreEqual(DataTestUtil.STRING_MIN, loadedSettings.EstateBans[0].bannedIPHostMask);
251 Assert.AreEqual(DataTestUtil.STRING_MIN, loadedSettings.EstateBans[0].bannedNameMask);
252 Assert.AreEqual(DataTestUtil.UUID_MIN, loadedSettings.EstateBans[0].bannedUUID);
253
254 Assert.AreEqual(DataTestUtil.STRING_MAX(16), loadedSettings.EstateBans[1].bannedIP);
255 Assert.AreEqual(DataTestUtil.STRING_MAX(16), loadedSettings.EstateBans[1].bannedIPHostMask);
256 Assert.AreEqual(DataTestUtil.STRING_MAX(64), loadedSettings.EstateBans[1].bannedNameMask);
257 Assert.AreEqual(DataTestUtil.UUID_MAX, loadedSettings.EstateBans[1].bannedUUID);
258
259 }
260
261 #endregion
262
263 #region Parametrizable Test Implementations
264
265 private void EstateSettingsSimpleStorage(
266 UUID regionId,
267 string estateName,
268 uint parentEstateID,
269 float billableFactor,
270 int pricePerMeter,
271 int redirectGridX,
272 int redirectGridY,
273 bool useGlobalTime,
274 bool fixedSun,
275 double sunPosition,
276 bool allowVoice,
277 bool allowDirectTeleport,
278 bool resetHomeOnTeleport,
279 bool denyAnonymous,
280 bool denyIdentified,
281 bool denyTransacted,
282 bool denyMinors,
283 bool abuseEmailToEstateOwner,
284 bool blockDwell,
285 bool estateSkipScripts,
286 bool taxFree,
287 bool publicAccess,
288 string abuseEmail,
289 UUID estateOwner
290 )
62 { 291 {
63 // Initializing field values. Avoid randomness. For checking ranges use different parameter sets
64 // for mix and max values. If you use random values the tests are not _repeatable_.
65 string estateName = "test-estate";
66 uint parentEstateID = 2;
67 float billableFactor = 3;
68 int priceMeter = 4;
69 int redirectGridX = 5;
70 int redirectGridY = 6;
71 bool useGlobalTime = true;
72 bool fixedSun = true;
73 double sunPosition = 7;
74 bool allowVoice = true;
75 bool allowDirectTeleport = true;
76 bool resetHomeOnTeleport = true;
77 bool denyAnonymous = true;
78 bool denyIdentified = true;
79 bool denyTransacted = true;
80 bool abuseEmailtoEstateOwner = true;
81 bool blockDwell = true;
82 bool estateskipScripts = true;
83 bool taxFree = true;
84 bool publicAccess = true;
85 string abuseMail = "test-email@nowhere.com";
86 UUID estateOwner = new UUID("250d214e-1c7e-4f9b-a488-87c5e53feed7");
87 bool denyMinors = (random.NextDouble() > 0.5)? true : false;
88
89 // Lets choose random region ID
90 UUID regionId = new UUID("250d214e-1c7e-4f9b-a488-87c5e53feed7");
91 292
92 // Letting estate store generate rows to database for us 293 // Letting estate store generate rows to database for us
93 EstateSettings es = db.LoadEstateSettings(regionId); 294 EstateSettings originalSettings = db.LoadEstateSettings(regionId);
94 295
95 // Setting field values to the on demand create settings object. 296 SetEstateSettings(
96 es.EstateName = estateName; 297 originalSettings,
97 es.ParentEstateID = parentEstateID; 298 estateName,
98 es.BillableFactor = billableFactor; 299 parentEstateID,
99 es.PricePerMeter = priceMeter; 300 billableFactor,
100 es.RedirectGridX = redirectGridX; 301 pricePerMeter,
101 es.RedirectGridY = redirectGridY; 302 redirectGridX,
102 es.UseGlobalTime = useGlobalTime; 303 redirectGridY,
103 es.FixedSun = fixedSun; 304 useGlobalTime,
104 es.SunPosition = sunPosition; 305 fixedSun,
105 es.AllowVoice = allowVoice; 306 sunPosition,
106 es.AllowDirectTeleport = allowDirectTeleport; 307 allowVoice,
107 es.ResetHomeOnTeleport = resetHomeOnTeleport; 308 allowDirectTeleport,
108 es.DenyAnonymous = denyAnonymous; 309 resetHomeOnTeleport,
109 es.DenyIdentified = denyIdentified; 310 denyAnonymous,
110 es.DenyTransacted = denyTransacted; 311 denyIdentified,
111 es.AbuseEmailToEstateOwner = abuseEmailtoEstateOwner; 312 denyTransacted,
112 es.BlockDwell = blockDwell; 313 denyMinors,
113 es.EstateSkipScripts = estateskipScripts; 314 abuseEmailToEstateOwner,
114 es.TaxFree = taxFree; 315 blockDwell,
115 es.PublicAccess = publicAccess; 316 estateSkipScripts,
116 es.AbuseEmail = abuseMail; 317 taxFree,
117 es.EstateOwner = estateOwner; 318 publicAccess,
118 es.DenyMinors = denyMinors; 319 abuseEmail,
320 estateOwner
321 );
322
323 originalSettings.EstateName = estateName;
324 originalSettings.ParentEstateID = parentEstateID;
325 originalSettings.BillableFactor = billableFactor;
326 originalSettings.PricePerMeter = pricePerMeter;
327 originalSettings.RedirectGridX = redirectGridX;
328 originalSettings.RedirectGridY = redirectGridY;
329 originalSettings.UseGlobalTime = useGlobalTime;
330 originalSettings.FixedSun = fixedSun;
331 originalSettings.SunPosition = sunPosition;
332 originalSettings.AllowVoice = allowVoice;
333 originalSettings.AllowDirectTeleport = allowDirectTeleport;
334 originalSettings.ResetHomeOnTeleport = resetHomeOnTeleport;
335 originalSettings.DenyAnonymous = denyAnonymous;
336 originalSettings.DenyIdentified = denyIdentified;
337 originalSettings.DenyTransacted = denyTransacted;
338 originalSettings.DenyMinors = denyMinors;
339 originalSettings.AbuseEmailToEstateOwner = abuseEmailToEstateOwner;
340 originalSettings.BlockDwell = blockDwell;
341 originalSettings.EstateSkipScripts = estateSkipScripts;
342 originalSettings.TaxFree = taxFree;
343 originalSettings.PublicAccess = publicAccess;
344 originalSettings.AbuseEmail = abuseEmail;
345 originalSettings.EstateOwner = estateOwner;
119 346
120 // Saving settings. 347 // Saving settings.
121 db.StoreEstateSettings(es); 348 db.StoreEstateSettings(originalSettings);
122 349
123 // Loading settings to another instance variable. 350 // Loading settings to another instance variable.
124 EstateSettings nes = db.LoadEstateSettings(regionId); 351 EstateSettings loadedSettings = db.LoadEstateSettings(regionId);
125 352
126 // Checking that loaded values are correct. 353 // Checking that loaded values are correct.
127 Assert.That(estateName, Is.EqualTo(nes.EstateName)); 354 ValidateEstateSettings(
128 Assert.That(parentEstateID, Is.EqualTo(nes.ParentEstateID)); 355 loadedSettings,
129 Assert.That(billableFactor, Is.EqualTo(nes.BillableFactor)); 356 estateName,
130 Assert.That(priceMeter, Is.EqualTo(nes.PricePerMeter)); 357 parentEstateID,
131 Assert.That(redirectGridX, Is.EqualTo(nes.RedirectGridX)); 358 billableFactor,
132 Assert.That(redirectGridY, Is.EqualTo(nes.RedirectGridY)); 359 pricePerMeter,
133 Assert.That(useGlobalTime, Is.EqualTo(nes.UseGlobalTime)); 360 redirectGridX,
134 Assert.That(fixedSun, Is.EqualTo(nes.FixedSun)); 361 redirectGridY,
135 Assert.That(sunPosition, Is.EqualTo(nes.SunPosition)); 362 useGlobalTime,
136 Assert.That(allowVoice, Is.EqualTo(nes.AllowVoice)); 363 fixedSun,
137 Assert.That(allowDirectTeleport, Is.EqualTo(nes.AllowDirectTeleport)); 364 sunPosition,
138 Assert.That(resetHomeOnTeleport, Is.EqualTo(nes.ResetHomeOnTeleport)); 365 allowVoice,
139 Assert.That(denyAnonymous, Is.EqualTo(nes.DenyAnonymous)); 366 allowDirectTeleport,
140 Assert.That(denyIdentified, Is.EqualTo(nes.DenyIdentified)); 367 resetHomeOnTeleport,
141 Assert.That(denyTransacted, Is.EqualTo(nes.DenyTransacted)); 368 denyAnonymous,
142 Assert.That(abuseEmailtoEstateOwner, Is.EqualTo(nes.AbuseEmailToEstateOwner)); 369 denyIdentified,
143 Assert.That(blockDwell, Is.EqualTo(nes.BlockDwell)); 370 denyTransacted,
144 Assert.That(estateskipScripts, Is.EqualTo(nes.EstateSkipScripts)); 371 denyMinors,
145 Assert.That(taxFree, Is.EqualTo(nes.TaxFree)); 372 abuseEmailToEstateOwner,
146 Assert.That(publicAccess, Is.EqualTo(nes.PublicAccess)); 373 blockDwell,
147 Assert.That(abuseMail, Is.EqualTo(nes.AbuseEmail)); 374 estateSkipScripts,
148 Assert.That(estateOwner, Is.EqualTo(nes.EstateOwner)); 375 taxFree,
149 Assert.That(denyMinors, Is.EqualTo(nes.DenyMinors)); 376 publicAccess,
377 abuseEmail,
378 estateOwner
379 );
150 380
151 } 381 }
152 382
383 #endregion
384
385 #region EstateSetting Initialization and Validation Methods
386
387 private void SetEstateSettings(
388 EstateSettings estateSettings,
389 string estateName,
390 uint parentEstateID,
391 float billableFactor,
392 int pricePerMeter,
393 int redirectGridX,
394 int redirectGridY,
395 bool useGlobalTime,
396 bool fixedSun,
397 double sunPosition,
398 bool allowVoice,
399 bool allowDirectTeleport,
400 bool resetHomeOnTeleport,
401 bool denyAnonymous,
402 bool denyIdentified,
403 bool denyTransacted,
404 bool denyMinors,
405 bool abuseEmailToEstateOwner,
406 bool blockDwell,
407 bool estateSkipScripts,
408 bool taxFree,
409 bool publicAccess,
410 string abuseEmail,
411 UUID estateOwner
412 )
413 {
414 estateSettings.EstateName = estateName;
415 estateSettings.ParentEstateID = parentEstateID;
416 estateSettings.BillableFactor = billableFactor;
417 estateSettings.PricePerMeter = pricePerMeter;
418 estateSettings.RedirectGridX = redirectGridX;
419 estateSettings.RedirectGridY = redirectGridY;
420 estateSettings.UseGlobalTime = useGlobalTime;
421 estateSettings.FixedSun = fixedSun;
422 estateSettings.SunPosition = sunPosition;
423 estateSettings.AllowVoice = allowVoice;
424 estateSettings.AllowDirectTeleport = allowDirectTeleport;
425 estateSettings.ResetHomeOnTeleport = resetHomeOnTeleport;
426 estateSettings.DenyAnonymous = denyAnonymous;
427 estateSettings.DenyIdentified = denyIdentified;
428 estateSettings.DenyTransacted = denyTransacted;
429 estateSettings.DenyMinors = denyMinors;
430 estateSettings.AbuseEmailToEstateOwner = abuseEmailToEstateOwner;
431 estateSettings.BlockDwell = blockDwell;
432 estateSettings.EstateSkipScripts = estateSkipScripts;
433 estateSettings.TaxFree = taxFree;
434 estateSettings.PublicAccess = publicAccess;
435 estateSettings.AbuseEmail = abuseEmail;
436 estateSettings.EstateOwner = estateOwner;
437 }
438
439 private void ValidateEstateSettings(
440 EstateSettings estateSettings,
441 string estateName,
442 uint parentEstateID,
443 float billableFactor,
444 int pricePerMeter,
445 int redirectGridX,
446 int redirectGridY,
447 bool useGlobalTime,
448 bool fixedSun,
449 double sunPosition,
450 bool allowVoice,
451 bool allowDirectTeleport,
452 bool resetHomeOnTeleport,
453 bool denyAnonymous,
454 bool denyIdentified,
455 bool denyTransacted,
456 bool denyMinors,
457 bool abuseEmailToEstateOwner,
458 bool blockDwell,
459 bool estateSkipScripts,
460 bool taxFree,
461 bool publicAccess,
462 string abuseEmail,
463 UUID estateOwner
464 )
465 {
466 Assert.AreEqual(estateName, estateSettings.EstateName);
467 Assert.AreEqual(parentEstateID, estateSettings.ParentEstateID);
468
469 DataTestUtil.AssertFloatEqualsWithTolerance(billableFactor, estateSettings.BillableFactor);
470
471 Assert.AreEqual(pricePerMeter, estateSettings.PricePerMeter);
472 Assert.AreEqual(redirectGridX, estateSettings.RedirectGridX);
473 Assert.AreEqual(redirectGridY, estateSettings.RedirectGridY);
474 Assert.AreEqual(useGlobalTime, estateSettings.UseGlobalTime);
475 Assert.AreEqual(fixedSun, estateSettings.FixedSun);
476
477 DataTestUtil.AssertDoubleEqualsWithTolerance(sunPosition, estateSettings.SunPosition);
478
479 Assert.AreEqual(allowVoice, estateSettings.AllowVoice);
480 Assert.AreEqual(allowDirectTeleport, estateSettings.AllowDirectTeleport);
481 Assert.AreEqual(resetHomeOnTeleport, estateSettings.ResetHomeOnTeleport);
482 Assert.AreEqual(denyAnonymous, estateSettings.DenyAnonymous);
483 Assert.AreEqual(denyIdentified, estateSettings.DenyIdentified);
484 Assert.AreEqual(denyTransacted, estateSettings.DenyTransacted);
485 Assert.AreEqual(denyMinors, estateSettings.DenyMinors);
486 Assert.AreEqual(abuseEmailToEstateOwner, estateSettings.AbuseEmailToEstateOwner);
487 Assert.AreEqual(blockDwell, estateSettings.BlockDwell);
488 Assert.AreEqual(estateSkipScripts, estateSettings.EstateSkipScripts);
489 Assert.AreEqual(taxFree, estateSettings.TaxFree);
490 Assert.AreEqual(publicAccess, estateSettings.PublicAccess);
491 Assert.AreEqual(abuseEmail, estateSettings.AbuseEmail);
492 Assert.AreEqual(estateOwner, estateSettings.EstateOwner);
493 }
494
495 #endregion
496
153 } 497 }
154} 498}
diff --git a/OpenSim/Data/Tests/DataTestUtil.cs b/OpenSim/Data/Tests/DataTestUtil.cs
new file mode 100644
index 0000000..778772f
--- /dev/null
+++ b/OpenSim/Data/Tests/DataTestUtil.cs
@@ -0,0 +1,62 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using OpenMetaverse;
5using NUnit.Framework;
6
7namespace OpenSim.Data.Tests
8{
9
10 /// <summary>
11 /// Shared constants and methods for database unit tests.
12 /// </summary>
13 public class DataTestUtil
14 {
15
16 public const uint UNSIGNED_INTEGER_MIN = uint.MinValue;
17 public const uint UNSIGNED_INTEGER_MAX = uint.MaxValue / 2; // NHibernate does not support unsigned integer range.
18
19 public const int INTEGER_MIN = int.MinValue + 1; // Postgresql requires +1 to .NET int.MinValue
20 public const int INTEGER_MAX = int.MaxValue;
21
22 public const float FLOAT_MIN = float.MinValue * (1 - FLOAT_PRECISSION);
23 public const float FLOAT_MAX = float.MaxValue * (1 - FLOAT_PRECISSION);
24 public const float FLOAT_ACCURATE = 1.234567890123456789012f;
25 public const float FLOAT_PRECISSION = 1E-5f; // Native MySQL is severly limited with floating accuracy
26
27 public const double DOUBLE_MIN = -1E52 * (1 - DOUBLE_PRECISSION);
28 public const double DOUBLE_MAX = 1E52 * (1 - DOUBLE_PRECISSION);
29 public const double DOUBLE_ACCURATE = 1.2345678901234567890123456789012345678901234567890123f;
30 public const double DOUBLE_PRECISSION = 1E-14; // Native MySQL is severly limited with double accuracy
31
32 public const string STRING_MIN = "";
33 public static string STRING_MAX(int length)
34 {
35 StringBuilder stringBuilder = new StringBuilder();
36 for (int i = 0; i < length; i++)
37 {
38 stringBuilder.Append(i % 10);
39 }
40 return stringBuilder.ToString();
41 }
42
43 public static UUID UUID_MIN = new UUID("00000000-0000-0000-0000-000000000000");
44 public static UUID UUID_MAX = new UUID("ffffffff-ffff-ffff-ffff-ffffffffffff");
45
46 public const bool BOOLEAN_MIN = false;
47 public const bool BOOLEAN_MAX = true;
48
49 public static void AssertFloatEqualsWithTolerance(float expectedValue, float actualValue)
50 {
51 Assert.GreaterOrEqual(actualValue, expectedValue - Math.Abs(expectedValue) * FLOAT_PRECISSION);
52 Assert.LessOrEqual(actualValue, expectedValue + Math.Abs(expectedValue) * FLOAT_PRECISSION);
53 }
54
55 public static void AssertDoubleEqualsWithTolerance(double expectedValue, double actualValue)
56 {
57 Assert.GreaterOrEqual(actualValue, expectedValue - Math.Abs(expectedValue) * DOUBLE_PRECISSION);
58 Assert.LessOrEqual(actualValue, expectedValue + Math.Abs(expectedValue) * DOUBLE_PRECISSION);
59 }
60
61 }
62}