diff options
Diffstat (limited to 'OpenSim/Data/Tests/BasicEstateTest.cs')
-rw-r--r-- | OpenSim/Data/Tests/BasicEstateTest.cs | 154 |
1 files changed, 154 insertions, 0 deletions
diff --git a/OpenSim/Data/Tests/BasicEstateTest.cs b/OpenSim/Data/Tests/BasicEstateTest.cs new file mode 100644 index 0000000..ef15150 --- /dev/null +++ b/OpenSim/Data/Tests/BasicEstateTest.cs | |||
@@ -0,0 +1,154 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Drawing; | ||
31 | using System.Text; | ||
32 | using NUnit.Framework; | ||
33 | using NUnit.Framework.SyntaxHelpers; | ||
34 | using OpenSim.Framework; | ||
35 | using OpenSim.Data; | ||
36 | using OpenMetaverse; | ||
37 | using OpenSim.Region.Framework.Interfaces; | ||
38 | |||
39 | namespace OpenSim.Data.Tests | ||
40 | { | ||
41 | public class BasicEstateTest | ||
42 | { | ||
43 | public IEstateDataStore db; | ||
44 | public IRegionDataStore regionDb; | ||
45 | public UUID prim1; | ||
46 | public static Random random; | ||
47 | |||
48 | public void SuperInit() | ||
49 | { | ||
50 | try | ||
51 | { | ||
52 | log4net.Config.XmlConfigurator.Configure(); | ||
53 | } | ||
54 | catch (Exception) | ||
55 | { | ||
56 | // I don't care, just leave log4net off | ||
57 | } | ||
58 | prim1 = UUID.Random(); | ||
59 | random = new Random(); | ||
60 | |||
61 | } | ||
62 | |||
63 | [Test] | ||
64 | public void T010_StoreEstateSettings() | ||
65 | { | ||
66 | // Initializing field values. Avoid randomness. For checking ranges use different parameter sets | ||
67 | // for mix and max values. If you use random values the tests are not _repeatable_. | ||
68 | string estateName = "test-estate"; | ||
69 | uint parentEstateID = 2; | ||
70 | float billableFactor = 3; | ||
71 | int priceMeter = 4; | ||
72 | int redirectGridX = 5; | ||
73 | int redirectGridY = 6; | ||
74 | bool useGlobalTime = true; | ||
75 | bool fixedSun = true; | ||
76 | double sunPosition = 7; | ||
77 | bool allowVoice = true; | ||
78 | bool allowDirectTeleport = true; | ||
79 | bool denyAnonymous = true; | ||
80 | bool denyIdentified = true; | ||
81 | bool denyTransacted = true; | ||
82 | bool abuseEmailtoEstateOwner = true; | ||
83 | bool blockDwell = true; | ||
84 | bool estateskipScripts = true; | ||
85 | bool taxFree = true; | ||
86 | bool publicAccess = true; | ||
87 | string abuseMail = "test-email@nowhere.com"; | ||
88 | UUID estateOwner = new UUID("250d214e-1c7e-4f9b-a488-87c5e53feed7"); | ||
89 | bool denyMinors = (random.NextDouble() > 0.5)? true : false; | ||
90 | |||
91 | // Lets choose random region ID | ||
92 | UUID regionId = new UUID("250d214e-1c7e-4f9b-a488-87c5e53feed7"); | ||
93 | |||
94 | // Letting estate store generate rows to database for us | ||
95 | EstateSettings es = db.LoadEstateSettings(regionId); | ||
96 | |||
97 | // Setting field values to the on demand create settings object. | ||
98 | es.EstateName = estateName; | ||
99 | es.ParentEstateID = parentEstateID; | ||
100 | es.BillableFactor = billableFactor; | ||
101 | es.PricePerMeter = priceMeter; | ||
102 | es.RedirectGridX = redirectGridX; | ||
103 | es.RedirectGridY = redirectGridY; | ||
104 | es.UseGlobalTime = useGlobalTime; | ||
105 | es.FixedSun = fixedSun; | ||
106 | es.SunPosition = sunPosition; | ||
107 | es.AllowVoice = allowVoice; | ||
108 | es.AllowDirectTeleport = allowDirectTeleport; | ||
109 | es.DenyAnonymous = denyAnonymous; | ||
110 | es.DenyIdentified = denyIdentified; | ||
111 | es.DenyTransacted = denyTransacted; | ||
112 | es.AbuseEmailToEstateOwner = abuseEmailtoEstateOwner; | ||
113 | es.BlockDwell = blockDwell; | ||
114 | es.EstateSkipScripts = estateskipScripts; | ||
115 | es.TaxFree = taxFree; | ||
116 | es.PublicAccess = publicAccess; | ||
117 | es.AbuseEmail = abuseMail; | ||
118 | es.EstateOwner = estateOwner; | ||
119 | es.DenyMinors = denyMinors; | ||
120 | |||
121 | // Saving settings. | ||
122 | db.StoreEstateSettings(es); | ||
123 | |||
124 | // Loading settings to another instance variable. | ||
125 | EstateSettings nes = db.LoadEstateSettings(regionId); | ||
126 | |||
127 | // Checking that loaded values are correct. | ||
128 | Assert.That(estateName, Is.EqualTo(nes.EstateName)); | ||
129 | Assert.That(parentEstateID, Is.EqualTo(nes.ParentEstateID)); | ||
130 | Assert.That(billableFactor, Is.EqualTo(nes.BillableFactor)); | ||
131 | Assert.That(priceMeter, Is.EqualTo(nes.PricePerMeter)); | ||
132 | Assert.That(redirectGridX, Is.EqualTo(nes.RedirectGridX)); | ||
133 | Assert.That(redirectGridY, Is.EqualTo(nes.RedirectGridY)); | ||
134 | Assert.That(useGlobalTime, Is.EqualTo(nes.UseGlobalTime)); | ||
135 | Assert.That(fixedSun, Is.EqualTo(nes.FixedSun)); | ||
136 | Assert.That(sunPosition, Is.EqualTo(nes.SunPosition)); | ||
137 | Assert.That(allowVoice, Is.EqualTo(nes.AllowVoice)); | ||
138 | Assert.That(allowDirectTeleport, Is.EqualTo(nes.AllowDirectTeleport)); | ||
139 | Assert.That(denyAnonymous, Is.EqualTo(nes.DenyAnonymous)); | ||
140 | Assert.That(denyIdentified, Is.EqualTo(nes.DenyIdentified)); | ||
141 | Assert.That(denyTransacted, Is.EqualTo(nes.DenyTransacted)); | ||
142 | Assert.That(abuseEmailtoEstateOwner, Is.EqualTo(nes.AbuseEmailToEstateOwner)); | ||
143 | Assert.That(blockDwell, Is.EqualTo(nes.BlockDwell)); | ||
144 | Assert.That(estateskipScripts, Is.EqualTo(nes.EstateSkipScripts)); | ||
145 | Assert.That(taxFree, Is.EqualTo(nes.TaxFree)); | ||
146 | Assert.That(publicAccess, Is.EqualTo(nes.PublicAccess)); | ||
147 | Assert.That(abuseMail, Is.EqualTo(nes.AbuseEmail)); | ||
148 | Assert.That(estateOwner, Is.EqualTo(nes.EstateOwner)); | ||
149 | Assert.That(denyMinors, Is.EqualTo(nes.DenyMinors)); | ||
150 | |||
151 | } | ||
152 | |||
153 | } | ||
154 | } | ||