aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/Tests/BasicEstateTest.cs
diff options
context:
space:
mode:
authorAlexRa2010-05-17 15:54:43 +0300
committerAlexRa2010-05-23 11:47:39 +0300
commit7f70ae0ebd686507bc15ac6fc7eeb75ed0b9b64a (patch)
tree8e9893cf02218f72888d5cdb12f8bb8a21cc5698 /OpenSim/Data/Tests/BasicEstateTest.cs
parentAdded generic base classes for testing database services (diff)
downloadopensim-SC_OLD-7f70ae0ebd686507bc15ac6fc7eeb75ed0b9b64a.zip
opensim-SC_OLD-7f70ae0ebd686507bc15ac6fc7eeb75ed0b9b64a.tar.gz
opensim-SC_OLD-7f70ae0ebd686507bc15ac6fc7eeb75ed0b9b64a.tar.bz2
opensim-SC_OLD-7f70ae0ebd686507bc15ac6fc7eeb75ed0b9b64a.tar.xz
All data tests made DBMS-independent
Diffstat (limited to 'OpenSim/Data/Tests/BasicEstateTest.cs')
-rw-r--r--OpenSim/Data/Tests/BasicEstateTest.cs497
1 files changed, 0 insertions, 497 deletions
diff --git a/OpenSim/Data/Tests/BasicEstateTest.cs b/OpenSim/Data/Tests/BasicEstateTest.cs
deleted file mode 100644
index d14d405..0000000
--- a/OpenSim/Data/Tests/BasicEstateTest.cs
+++ /dev/null
@@ -1,497 +0,0 @@
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 OpenSimulator 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 log4net.Config;
30using NUnit.Framework;
31using NUnit.Framework.SyntaxHelpers;
32using OpenMetaverse;
33using OpenSim.Framework;
34using OpenSim.Region.Framework.Interfaces;
35using System.Text;
36using log4net;
37using System.Reflection;
38
39namespace OpenSim.Data.Tests
40{
41 public class BasicEstateTest
42 {
43 public IEstateDataStore db;
44 public IRegionDataStore regionDb;
45
46 public static UUID REGION_ID = new UUID("250d214e-1c7e-4f9b-a488-87c5e53feed7");
47
48 public static UUID USER_ID_1 = new UUID("250d214e-1c7e-4f9b-a488-87c5e53feed1");
49 public static UUID USER_ID_2 = new UUID("250d214e-1c7e-4f9b-a488-87c5e53feed2");
50
51 public static UUID MANAGER_ID_1 = new UUID("250d214e-1c7e-4f9b-a488-87c5e53feed3");
52 public static UUID MANAGER_ID_2 = new UUID("250d214e-1c7e-4f9b-a488-87c5e53feed4");
53
54 public static UUID GROUP_ID_1 = new UUID("250d214e-1c7e-4f9b-a488-87c5e53feed5");
55 public static UUID GROUP_ID_2 = new UUID("250d214e-1c7e-4f9b-a488-87c5e53feed6");
56
57 public void SuperInit()
58 {
59 OpenSim.Tests.Common.TestLogging.LogToConsole();
60 }
61
62 #region 0Tests
63
64 [Test]
65 public void T010_EstateSettingsSimpleStorage_MinimumParameterSet()
66 {
67 EstateSettingsSimpleStorage(
68 REGION_ID,
69 DataTestUtil.STRING_MIN,
70 DataTestUtil.UNSIGNED_INTEGER_MIN,
71 DataTestUtil.FLOAT_MIN,
72 DataTestUtil.INTEGER_MIN,
73 DataTestUtil.INTEGER_MIN,
74 DataTestUtil.INTEGER_MIN,
75 DataTestUtil.BOOLEAN_MIN,
76 DataTestUtil.BOOLEAN_MIN,
77 DataTestUtil.DOUBLE_MIN,
78 DataTestUtil.BOOLEAN_MIN,
79 DataTestUtil.BOOLEAN_MIN,
80 DataTestUtil.BOOLEAN_MIN,
81 DataTestUtil.BOOLEAN_MIN,
82 DataTestUtil.BOOLEAN_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.STRING_MIN,
91 DataTestUtil.UUID_MIN
92 );
93 }
94
95 [Test]
96 public void T011_EstateSettingsSimpleStorage_MaximumParameterSet()
97 {
98 EstateSettingsSimpleStorage(
99 REGION_ID,
100 DataTestUtil.STRING_MAX(64),
101 DataTestUtil.UNSIGNED_INTEGER_MAX,
102 DataTestUtil.FLOAT_MAX,
103 DataTestUtil.INTEGER_MAX,
104 DataTestUtil.INTEGER_MAX,
105 DataTestUtil.INTEGER_MAX,
106 DataTestUtil.BOOLEAN_MAX,
107 DataTestUtil.BOOLEAN_MAX,
108 DataTestUtil.DOUBLE_MAX,
109 DataTestUtil.BOOLEAN_MAX,
110 DataTestUtil.BOOLEAN_MAX,
111 DataTestUtil.BOOLEAN_MAX,
112 DataTestUtil.BOOLEAN_MAX,
113 DataTestUtil.BOOLEAN_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.STRING_MAX(255),
122 DataTestUtil.UUID_MAX
123 );
124 }
125
126 [Test]
127 public void T012_EstateSettingsSimpleStorage_AccurateParameterSet()
128 {
129 EstateSettingsSimpleStorage(
130 REGION_ID,
131 DataTestUtil.STRING_MAX(1),
132 DataTestUtil.UNSIGNED_INTEGER_MIN,
133 DataTestUtil.FLOAT_ACCURATE,
134 DataTestUtil.INTEGER_MIN,
135 DataTestUtil.INTEGER_MIN,
136 DataTestUtil.INTEGER_MIN,
137 DataTestUtil.BOOLEAN_MIN,
138 DataTestUtil.BOOLEAN_MIN,
139 DataTestUtil.DOUBLE_ACCURATE,
140 DataTestUtil.BOOLEAN_MIN,
141 DataTestUtil.BOOLEAN_MIN,
142 DataTestUtil.BOOLEAN_MIN,
143 DataTestUtil.BOOLEAN_MIN,
144 DataTestUtil.BOOLEAN_MIN,
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.STRING_MAX(1),
153 DataTestUtil.UUID_MIN
154 );
155 }
156
157 [Test]
158 public void T012_EstateSettingsRandomStorage()
159 {
160 // Letting estate store generate rows to database for us
161 EstateSettings originalSettings = db.LoadEstateSettings(REGION_ID, true);
162 new PropertyScrambler<EstateSettings>()
163 .DontScramble(x=>x.EstateID)
164 .Scramble(originalSettings);
165
166 // Saving settings.
167 db.StoreEstateSettings(originalSettings);
168
169 // Loading settings to another instance variable.
170 EstateSettings loadedSettings = db.LoadEstateSettings(REGION_ID, true);
171
172 // Checking that loaded values are correct.
173 Assert.That(loadedSettings, Constraints.PropertyCompareConstraint(originalSettings));
174 }
175
176 [Test]
177 public void T020_EstateSettingsManagerList()
178 {
179 // Letting estate store generate rows to database for us
180 EstateSettings originalSettings = db.LoadEstateSettings(REGION_ID, true);
181
182 originalSettings.EstateManagers = new UUID[] { MANAGER_ID_1, MANAGER_ID_2 };
183
184 // Saving settings.
185 db.StoreEstateSettings(originalSettings);
186
187 // Loading settings to another instance variable.
188 EstateSettings loadedSettings = db.LoadEstateSettings(REGION_ID, true);
189
190 Assert.AreEqual(2, loadedSettings.EstateManagers.Length);
191 Assert.AreEqual(MANAGER_ID_1, loadedSettings.EstateManagers[0]);
192 Assert.AreEqual(MANAGER_ID_2, loadedSettings.EstateManagers[1]);
193 }
194
195 [Test]
196 public void T021_EstateSettingsUserList()
197 {
198 // Letting estate store generate rows to database for us
199 EstateSettings originalSettings = db.LoadEstateSettings(REGION_ID, true);
200
201 originalSettings.EstateAccess = new UUID[] { USER_ID_1, USER_ID_2 };
202
203 // Saving settings.
204 db.StoreEstateSettings(originalSettings);
205
206 // Loading settings to another instance variable.
207 EstateSettings loadedSettings = db.LoadEstateSettings(REGION_ID, true);
208
209 Assert.AreEqual(2, loadedSettings.EstateAccess.Length);
210 Assert.AreEqual(USER_ID_1, loadedSettings.EstateAccess[0]);
211 Assert.AreEqual(USER_ID_2, loadedSettings.EstateAccess[1]);
212 }
213
214 [Test]
215 public void T022_EstateSettingsGroupList()
216 {
217 // Letting estate store generate rows to database for us
218 EstateSettings originalSettings = db.LoadEstateSettings(REGION_ID, true);
219
220 originalSettings.EstateGroups = new UUID[] { GROUP_ID_1, GROUP_ID_2 };
221
222 // Saving settings.
223 db.StoreEstateSettings(originalSettings);
224
225 // Loading settings to another instance variable.
226 EstateSettings loadedSettings = db.LoadEstateSettings(REGION_ID, true);
227
228 Assert.AreEqual(2, loadedSettings.EstateAccess.Length);
229 Assert.AreEqual(GROUP_ID_1, loadedSettings.EstateGroups[0]);
230 Assert.AreEqual(GROUP_ID_2, loadedSettings.EstateGroups[1]);
231 }
232
233 [Test]
234 public void T022_EstateSettingsBanList()
235 {
236 // Letting estate store generate rows to database for us
237 EstateSettings originalSettings = db.LoadEstateSettings(REGION_ID, true);
238
239 EstateBan estateBan1 = new EstateBan();
240 estateBan1.BannedUserID = DataTestUtil.UUID_MIN;
241
242 EstateBan estateBan2 = new EstateBan();
243 estateBan2.BannedUserID = DataTestUtil.UUID_MAX;
244
245 originalSettings.EstateBans = new EstateBan[] { estateBan1, estateBan2 };
246
247 // Saving settings.
248 db.StoreEstateSettings(originalSettings);
249
250 // Loading settings to another instance variable.
251 EstateSettings loadedSettings = db.LoadEstateSettings(REGION_ID, true);
252
253 Assert.AreEqual(2, loadedSettings.EstateBans.Length);
254 Assert.AreEqual(DataTestUtil.UUID_MIN, loadedSettings.EstateBans[0].BannedUserID);
255
256 Assert.AreEqual(DataTestUtil.UUID_MAX, loadedSettings.EstateBans[1].BannedUserID);
257
258 }
259
260 #endregion
261
262 #region Parametrizable Test Implementations
263
264 private void EstateSettingsSimpleStorage(
265 UUID regionId,
266 string estateName,
267 uint parentEstateID,
268 float billableFactor,
269 int pricePerMeter,
270 int redirectGridX,
271 int redirectGridY,
272 bool useGlobalTime,
273 bool fixedSun,
274 double sunPosition,
275 bool allowVoice,
276 bool allowDirectTeleport,
277 bool resetHomeOnTeleport,
278 bool denyAnonymous,
279 bool denyIdentified,
280 bool denyTransacted,
281 bool denyMinors,
282 bool abuseEmailToEstateOwner,
283 bool blockDwell,
284 bool estateSkipScripts,
285 bool taxFree,
286 bool publicAccess,
287 string abuseEmail,
288 UUID estateOwner
289 )
290 {
291
292 // Letting estate store generate rows to database for us
293 EstateSettings originalSettings = db.LoadEstateSettings(regionId, true);
294
295 SetEstateSettings(
296 originalSettings,
297 estateName,
298 parentEstateID,
299 billableFactor,
300 pricePerMeter,
301 redirectGridX,
302 redirectGridY,
303 useGlobalTime,
304 fixedSun,
305 sunPosition,
306 allowVoice,
307 allowDirectTeleport,
308 resetHomeOnTeleport,
309 denyAnonymous,
310 denyIdentified,
311 denyTransacted,
312 denyMinors,
313 abuseEmailToEstateOwner,
314 blockDwell,
315 estateSkipScripts,
316 taxFree,
317 publicAccess,
318 abuseEmail,
319 estateOwner
320 );
321
322 originalSettings.EstateName = estateName;
323 originalSettings.ParentEstateID = parentEstateID;
324 originalSettings.BillableFactor = billableFactor;
325 originalSettings.PricePerMeter = pricePerMeter;
326 originalSettings.RedirectGridX = redirectGridX;
327 originalSettings.RedirectGridY = redirectGridY;
328 originalSettings.UseGlobalTime = useGlobalTime;
329 originalSettings.FixedSun = fixedSun;
330 originalSettings.SunPosition = sunPosition;
331 originalSettings.AllowVoice = allowVoice;
332 originalSettings.AllowDirectTeleport = allowDirectTeleport;
333 originalSettings.ResetHomeOnTeleport = resetHomeOnTeleport;
334 originalSettings.DenyAnonymous = denyAnonymous;
335 originalSettings.DenyIdentified = denyIdentified;
336 originalSettings.DenyTransacted = denyTransacted;
337 originalSettings.DenyMinors = denyMinors;
338 originalSettings.AbuseEmailToEstateOwner = abuseEmailToEstateOwner;
339 originalSettings.BlockDwell = blockDwell;
340 originalSettings.EstateSkipScripts = estateSkipScripts;
341 originalSettings.TaxFree = taxFree;
342 originalSettings.PublicAccess = publicAccess;
343 originalSettings.AbuseEmail = abuseEmail;
344 originalSettings.EstateOwner = estateOwner;
345
346 // Saving settings.
347 db.StoreEstateSettings(originalSettings);
348
349 // Loading settings to another instance variable.
350 EstateSettings loadedSettings = db.LoadEstateSettings(regionId, true);
351
352 // Checking that loaded values are correct.
353 ValidateEstateSettings(
354 loadedSettings,
355 estateName,
356 parentEstateID,
357 billableFactor,
358 pricePerMeter,
359 redirectGridX,
360 redirectGridY,
361 useGlobalTime,
362 fixedSun,
363 sunPosition,
364 allowVoice,
365 allowDirectTeleport,
366 resetHomeOnTeleport,
367 denyAnonymous,
368 denyIdentified,
369 denyTransacted,
370 denyMinors,
371 abuseEmailToEstateOwner,
372 blockDwell,
373 estateSkipScripts,
374 taxFree,
375 publicAccess,
376 abuseEmail,
377 estateOwner
378 );
379
380 }
381
382 #endregion
383
384 #region EstateSetting Initialization and Validation Methods
385
386 private void SetEstateSettings(
387 EstateSettings estateSettings,
388 string estateName,
389 uint parentEstateID,
390 float billableFactor,
391 int pricePerMeter,
392 int redirectGridX,
393 int redirectGridY,
394 bool useGlobalTime,
395 bool fixedSun,
396 double sunPosition,
397 bool allowVoice,
398 bool allowDirectTeleport,
399 bool resetHomeOnTeleport,
400 bool denyAnonymous,
401 bool denyIdentified,
402 bool denyTransacted,
403 bool denyMinors,
404 bool abuseEmailToEstateOwner,
405 bool blockDwell,
406 bool estateSkipScripts,
407 bool taxFree,
408 bool publicAccess,
409 string abuseEmail,
410 UUID estateOwner
411 )
412 {
413 estateSettings.EstateName = estateName;
414 estateSettings.ParentEstateID = parentEstateID;
415 estateSettings.BillableFactor = billableFactor;
416 estateSettings.PricePerMeter = pricePerMeter;
417 estateSettings.RedirectGridX = redirectGridX;
418 estateSettings.RedirectGridY = redirectGridY;
419 estateSettings.UseGlobalTime = useGlobalTime;
420 estateSettings.FixedSun = fixedSun;
421 estateSettings.SunPosition = sunPosition;
422 estateSettings.AllowVoice = allowVoice;
423 estateSettings.AllowDirectTeleport = allowDirectTeleport;
424 estateSettings.ResetHomeOnTeleport = resetHomeOnTeleport;
425 estateSettings.DenyAnonymous = denyAnonymous;
426 estateSettings.DenyIdentified = denyIdentified;
427 estateSettings.DenyTransacted = denyTransacted;
428 estateSettings.DenyMinors = denyMinors;
429 estateSettings.AbuseEmailToEstateOwner = abuseEmailToEstateOwner;
430 estateSettings.BlockDwell = blockDwell;
431 estateSettings.EstateSkipScripts = estateSkipScripts;
432 estateSettings.TaxFree = taxFree;
433 estateSettings.PublicAccess = publicAccess;
434 estateSettings.AbuseEmail = abuseEmail;
435 estateSettings.EstateOwner = estateOwner;
436 }
437
438 private void ValidateEstateSettings(
439 EstateSettings estateSettings,
440 string estateName,
441 uint parentEstateID,
442 float billableFactor,
443 int pricePerMeter,
444 int redirectGridX,
445 int redirectGridY,
446 bool useGlobalTime,
447 bool fixedSun,
448 double sunPosition,
449 bool allowVoice,
450 bool allowDirectTeleport,
451 bool resetHomeOnTeleport,
452 bool denyAnonymous,
453 bool denyIdentified,
454 bool denyTransacted,
455 bool denyMinors,
456 bool abuseEmailToEstateOwner,
457 bool blockDwell,
458 bool estateSkipScripts,
459 bool taxFree,
460 bool publicAccess,
461 string abuseEmail,
462 UUID estateOwner
463 )
464 {
465 Assert.AreEqual(estateName, estateSettings.EstateName);
466 Assert.AreEqual(parentEstateID, estateSettings.ParentEstateID);
467
468 DataTestUtil.AssertFloatEqualsWithTolerance(billableFactor, estateSettings.BillableFactor);
469
470 Assert.AreEqual(pricePerMeter, estateSettings.PricePerMeter);
471 Assert.AreEqual(redirectGridX, estateSettings.RedirectGridX);
472 Assert.AreEqual(redirectGridY, estateSettings.RedirectGridY);
473 Assert.AreEqual(useGlobalTime, estateSettings.UseGlobalTime);
474 Assert.AreEqual(fixedSun, estateSettings.FixedSun);
475
476 DataTestUtil.AssertDoubleEqualsWithTolerance(sunPosition, estateSettings.SunPosition);
477
478 Assert.AreEqual(allowVoice, estateSettings.AllowVoice);
479 Assert.AreEqual(allowDirectTeleport, estateSettings.AllowDirectTeleport);
480 Assert.AreEqual(resetHomeOnTeleport, estateSettings.ResetHomeOnTeleport);
481 Assert.AreEqual(denyAnonymous, estateSettings.DenyAnonymous);
482 Assert.AreEqual(denyIdentified, estateSettings.DenyIdentified);
483 Assert.AreEqual(denyTransacted, estateSettings.DenyTransacted);
484 Assert.AreEqual(denyMinors, estateSettings.DenyMinors);
485 Assert.AreEqual(abuseEmailToEstateOwner, estateSettings.AbuseEmailToEstateOwner);
486 Assert.AreEqual(blockDwell, estateSettings.BlockDwell);
487 Assert.AreEqual(estateSkipScripts, estateSettings.EstateSkipScripts);
488 Assert.AreEqual(taxFree, estateSettings.TaxFree);
489 Assert.AreEqual(publicAccess, estateSettings.PublicAccess);
490 Assert.AreEqual(abuseEmail, estateSettings.AbuseEmail);
491 Assert.AreEqual(estateOwner, estateSettings.EstateOwner);
492 }
493
494 #endregion
495
496 }
497}