diff options
author | AlexRa | 2010-05-17 15:54:43 +0300 |
---|---|---|
committer | AlexRa | 2010-05-23 11:47:39 +0300 |
commit | 7f70ae0ebd686507bc15ac6fc7eeb75ed0b9b64a (patch) | |
tree | 8e9893cf02218f72888d5cdb12f8bb8a21cc5698 /OpenSim/Data/Tests/RegionTests.cs | |
parent | Added generic base classes for testing database services (diff) | |
download | opensim-SC-7f70ae0ebd686507bc15ac6fc7eeb75ed0b9b64a.zip opensim-SC-7f70ae0ebd686507bc15ac6fc7eeb75ed0b9b64a.tar.gz opensim-SC-7f70ae0ebd686507bc15ac6fc7eeb75ed0b9b64a.tar.bz2 opensim-SC-7f70ae0ebd686507bc15ac6fc7eeb75ed0b9b64a.tar.xz |
All data tests made DBMS-independent
Diffstat (limited to 'OpenSim/Data/Tests/RegionTests.cs')
-rw-r--r-- | OpenSim/Data/Tests/RegionTests.cs | 1082 |
1 files changed, 1082 insertions, 0 deletions
diff --git a/OpenSim/Data/Tests/RegionTests.cs b/OpenSim/Data/Tests/RegionTests.cs new file mode 100644 index 0000000..2a97368 --- /dev/null +++ b/OpenSim/Data/Tests/RegionTests.cs | |||
@@ -0,0 +1,1082 @@ | |||
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 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Drawing; | ||
31 | using System.Text; | ||
32 | using log4net.Config; | ||
33 | using NUnit.Framework; | ||
34 | using NUnit.Framework.SyntaxHelpers; | ||
35 | using OpenMetaverse; | ||
36 | using OpenSim.Framework; | ||
37 | using OpenSim.Region.Framework.Interfaces; | ||
38 | using OpenSim.Region.Framework.Scenes; | ||
39 | using log4net; | ||
40 | using System.Reflection; | ||
41 | using System.Data.Common; | ||
42 | |||
43 | // DBMS-specific: | ||
44 | using MySql.Data.MySqlClient; | ||
45 | using OpenSim.Data.MySQL; | ||
46 | |||
47 | using System.Data.SqlClient; | ||
48 | using OpenSim.Data.MSSQL; | ||
49 | |||
50 | using Mono.Data.Sqlite; | ||
51 | using OpenSim.Data.SQLite; | ||
52 | |||
53 | namespace OpenSim.Data.Tests | ||
54 | { | ||
55 | [TestFixture(typeof(MySqlConnection), typeof(MySqlRegionData), Description = "Region store tests (MySQL)")] | ||
56 | [TestFixture(typeof(SqlConnection), typeof(MSSQLRegionData), Description = "Region store tests (MS SQL Server)")] | ||
57 | [TestFixture(typeof(SqliteConnection), typeof(SQLiteRegionData), Description = "Region store tests (SQLite)")] | ||
58 | |||
59 | public class RegionTests<TConn, TRegStore> : BasicDataServiceTest<TConn, TRegStore> | ||
60 | where TConn : DbConnection, new() | ||
61 | where TRegStore : class, IRegionDataStore, new() | ||
62 | { | ||
63 | public IRegionDataStore db; | ||
64 | public UUID zero = UUID.Zero; | ||
65 | public UUID region1 = UUID.Random(); | ||
66 | public UUID region2 = UUID.Random(); | ||
67 | public UUID region3 = UUID.Random(); | ||
68 | public UUID region4 = UUID.Random(); | ||
69 | public UUID prim1 = UUID.Random(); | ||
70 | public UUID prim2 = UUID.Random(); | ||
71 | public UUID prim3 = UUID.Random(); | ||
72 | public UUID prim4 = UUID.Random(); | ||
73 | public UUID prim5 = UUID.Random(); | ||
74 | public UUID prim6 = UUID.Random(); | ||
75 | public UUID item1 = UUID.Random(); | ||
76 | public UUID item2 = UUID.Random(); | ||
77 | public UUID item3 = UUID.Random(); | ||
78 | |||
79 | public static Random random = new Random(); | ||
80 | |||
81 | public string itemname1 = "item1"; | ||
82 | |||
83 | public uint localID = 1; | ||
84 | |||
85 | public double height1 = 20; | ||
86 | public double height2 = 100; | ||
87 | |||
88 | |||
89 | protected override void InitService(object service) | ||
90 | { | ||
91 | db = (IRegionDataStore)service; | ||
92 | db.Initialise(m_connStr); | ||
93 | ClearDB(); | ||
94 | } | ||
95 | |||
96 | |||
97 | private void ClearDB() | ||
98 | { | ||
99 | // if a new table is added, it has to be dropped here | ||
100 | ExecuteSql("delete from migrations where name='RegionStore';"); | ||
101 | |||
102 | DropTables( | ||
103 | "prims", | ||
104 | "primshapes", | ||
105 | "primitems", | ||
106 | "terrain", | ||
107 | "land", | ||
108 | "landaccesslist", | ||
109 | "regionban", | ||
110 | "regionsettings" | ||
111 | ); | ||
112 | } | ||
113 | |||
114 | |||
115 | // Test Plan | ||
116 | // Prims | ||
117 | // - empty test - 001 | ||
118 | // - store / retrieve basic prims (most minimal we can make) - 010, 011 | ||
119 | // - store / retrieve parts in a scenegroup 012 | ||
120 | // - store a prim with complete information for consistency check 013 | ||
121 | // - update existing prims, make sure it sticks - 014 | ||
122 | // - tests empty inventory - 020 | ||
123 | // - add inventory items to prims make - 021 | ||
124 | // - retrieves the added item - 022 | ||
125 | // - update inventory items to prims - 023 | ||
126 | // - remove inventory items make sure it sticks - 024 | ||
127 | // - checks if all parameters are persistent - 025 | ||
128 | // - adds many items and see if it is handled correctly - 026 | ||
129 | |||
130 | [Test] | ||
131 | public void T001_LoadEmpty() | ||
132 | { | ||
133 | List<SceneObjectGroup> objs = db.LoadObjects(region1); | ||
134 | List<SceneObjectGroup> objs3 = db.LoadObjects(region3); | ||
135 | List<LandData> land = db.LoadLandObjects(region1); | ||
136 | |||
137 | Assert.That(objs.Count, Is.EqualTo(0), "Assert.That(objs.Count, Is.EqualTo(0))"); | ||
138 | Assert.That(objs3.Count, Is.EqualTo(0), "Assert.That(objs3.Count, Is.EqualTo(0))"); | ||
139 | Assert.That(land.Count, Is.EqualTo(0), "Assert.That(land.Count, Is.EqualTo(0))"); | ||
140 | } | ||
141 | |||
142 | // SOG round trips | ||
143 | // * store objects, make sure they save | ||
144 | // * update | ||
145 | |||
146 | [Test] | ||
147 | public void T010_StoreSimpleObject() | ||
148 | { | ||
149 | SceneObjectGroup sog = NewSOG("object1", prim1, region1); | ||
150 | SceneObjectGroup sog2 = NewSOG("object2", prim2, region1); | ||
151 | |||
152 | // in case the objects don't store | ||
153 | try | ||
154 | { | ||
155 | db.StoreObject(sog, region1); | ||
156 | } | ||
157 | catch (Exception e) | ||
158 | { | ||
159 | m_log.Error(e.ToString()); | ||
160 | Assert.Fail(); | ||
161 | } | ||
162 | |||
163 | try | ||
164 | { | ||
165 | db.StoreObject(sog2, region1); | ||
166 | } | ||
167 | catch (Exception e) | ||
168 | { | ||
169 | m_log.Error(e.ToString()); | ||
170 | Assert.Fail(); | ||
171 | } | ||
172 | |||
173 | // This tests the ADO.NET driver | ||
174 | List<SceneObjectGroup> objs = db.LoadObjects(region1); | ||
175 | |||
176 | Assert.That(objs.Count, Is.EqualTo(2), "Assert.That(objs.Count, Is.EqualTo(2))"); | ||
177 | } | ||
178 | |||
179 | [Test] | ||
180 | public void T011_ObjectNames() | ||
181 | { | ||
182 | List<SceneObjectGroup> objs = db.LoadObjects(region1); | ||
183 | foreach (SceneObjectGroup sog in objs) | ||
184 | { | ||
185 | SceneObjectPart p = sog.RootPart; | ||
186 | Assert.That("", Is.Not.EqualTo(p.Name), "Assert.That(\"\", Is.Not.EqualTo(p.Name))"); | ||
187 | Assert.That(p.Name, Is.EqualTo(p.Description), "Assert.That(p.Name, Is.EqualTo(p.Description))"); | ||
188 | } | ||
189 | } | ||
190 | |||
191 | [Test] | ||
192 | public void T012_SceneParts() | ||
193 | { | ||
194 | UUID tmp0 = UUID.Random(); | ||
195 | UUID tmp1 = UUID.Random(); | ||
196 | UUID tmp2 = UUID.Random(); | ||
197 | UUID tmp3 = UUID.Random(); | ||
198 | UUID newregion = UUID.Random(); | ||
199 | SceneObjectPart p1 = NewSOP("SoP 1",tmp1); | ||
200 | SceneObjectPart p2 = NewSOP("SoP 2",tmp2); | ||
201 | SceneObjectPart p3 = NewSOP("SoP 3",tmp3); | ||
202 | SceneObjectGroup sog = NewSOG("Sop 0", tmp0, newregion); | ||
203 | sog.AddPart(p1); | ||
204 | sog.AddPart(p2); | ||
205 | sog.AddPart(p3); | ||
206 | |||
207 | SceneObjectPart[] parts = sog.GetParts(); | ||
208 | Assert.That(parts.Length,Is.EqualTo(4), "Assert.That(parts.Length,Is.EqualTo(4))"); | ||
209 | |||
210 | db.StoreObject(sog, newregion); | ||
211 | List<SceneObjectGroup> sogs = db.LoadObjects(newregion); | ||
212 | Assert.That(sogs.Count,Is.EqualTo(1), "Assert.That(sogs.Count,Is.EqualTo(1))"); | ||
213 | SceneObjectGroup newsog = sogs[0]; | ||
214 | |||
215 | SceneObjectPart[] newparts = newsog.GetParts(); | ||
216 | Assert.That(newparts.Length,Is.EqualTo(4), "Assert.That(newparts.Length,Is.EqualTo(4))"); | ||
217 | |||
218 | Assert.That(newsog.HasChildPrim(tmp0), "Assert.That(newsog.HasChildPrim(tmp0))"); | ||
219 | Assert.That(newsog.HasChildPrim(tmp1), "Assert.That(newsog.HasChildPrim(tmp1))"); | ||
220 | Assert.That(newsog.HasChildPrim(tmp2), "Assert.That(newsog.HasChildPrim(tmp2))"); | ||
221 | Assert.That(newsog.HasChildPrim(tmp3), "Assert.That(newsog.HasChildPrim(tmp3))"); | ||
222 | } | ||
223 | |||
224 | [Test] | ||
225 | public void T013_DatabasePersistency() | ||
226 | { | ||
227 | // Sets all ScenePart parameters, stores and retrieves them, then check for consistency with initial data | ||
228 | // The commented Asserts are the ones that are unchangeable (when storing on the database, their "Set" values are ignored | ||
229 | // The ObjectFlags is an exception, if it is entered incorrectly, the object IS REJECTED on the database silently. | ||
230 | UUID creator,uuid = new UUID(); | ||
231 | creator = UUID.Random(); | ||
232 | uint iserial = (uint)random.Next(); | ||
233 | TaskInventoryDictionary dic = new TaskInventoryDictionary(); | ||
234 | uint objf = (uint) random.Next(); | ||
235 | uuid = prim4; | ||
236 | uint localid = localID+1; | ||
237 | localID = localID + 1; | ||
238 | string name = "Adam West"; | ||
239 | byte material = (byte) random.Next(127); | ||
240 | ulong regionh = (ulong)random.NextDouble() * (ulong)random.Next(); | ||
241 | int pin = random.Next(); | ||
242 | Byte[] partsys = new byte[8]; | ||
243 | Byte[] textani = new byte[8]; | ||
244 | random.NextBytes(textani); | ||
245 | random.NextBytes(partsys); | ||
246 | DateTime expires = new DateTime(2008, 12, 20); | ||
247 | DateTime rezzed = new DateTime(2009, 07, 15); | ||
248 | Vector3 groupos = new Vector3(random.Next(),random.Next(),random.Next()); | ||
249 | Vector3 offset = new Vector3(random.Next(),random.Next(),random.Next()); | ||
250 | Quaternion rotoff = new Quaternion(random.Next(),random.Next(),random.Next(),random.Next()); | ||
251 | Vector3 velocity = new Vector3(random.Next(),random.Next(),random.Next()); | ||
252 | Vector3 angvelo = new Vector3(random.Next(),random.Next(),random.Next()); | ||
253 | Vector3 accel = new Vector3(random.Next(),random.Next(),random.Next()); | ||
254 | string description = name; | ||
255 | Color color = Color.FromArgb(255, 165, 50, 100); | ||
256 | string text = "All Your Base Are Belong to Us"; | ||
257 | string sitname = "SitName"; | ||
258 | string touchname = "TouchName"; | ||
259 | int linknum = random.Next(); | ||
260 | byte clickaction = (byte) random.Next(127); | ||
261 | PrimitiveBaseShape pbshap = new PrimitiveBaseShape(); | ||
262 | pbshap = PrimitiveBaseShape.Default; | ||
263 | pbshap.PathBegin = ushort.MaxValue; | ||
264 | pbshap.PathEnd = ushort.MaxValue; | ||
265 | pbshap.ProfileBegin = ushort.MaxValue; | ||
266 | pbshap.ProfileEnd = ushort.MaxValue; | ||
267 | pbshap.ProfileHollow = ushort.MaxValue; | ||
268 | Vector3 scale = new Vector3(random.Next(),random.Next(),random.Next()); | ||
269 | byte updatef = (byte) random.Next(127); | ||
270 | |||
271 | RegionInfo regionInfo = new RegionInfo(); | ||
272 | regionInfo.RegionID = region3; | ||
273 | regionInfo.RegionLocX = 0; | ||
274 | regionInfo.RegionLocY = 0; | ||
275 | |||
276 | // Scene scene = new Scene(regionInfo); | ||
277 | |||
278 | SceneObjectPart sop = new SceneObjectPart(); | ||
279 | sop.RegionHandle = regionh; | ||
280 | sop.UUID = uuid; | ||
281 | sop.LocalId = localid; | ||
282 | sop.Shape = pbshap; | ||
283 | sop.GroupPosition = groupos; | ||
284 | sop.RotationOffset = rotoff; | ||
285 | sop.CreatorID = creator; | ||
286 | sop.InventorySerial = iserial; | ||
287 | sop.TaskInventory = dic; | ||
288 | sop.ObjectFlags = objf; | ||
289 | sop.Name = name; | ||
290 | sop.Material = material; | ||
291 | sop.ScriptAccessPin = pin; | ||
292 | sop.TextureAnimation = textani; | ||
293 | sop.ParticleSystem = partsys; | ||
294 | sop.Expires = expires; | ||
295 | sop.Rezzed = rezzed; | ||
296 | sop.OffsetPosition = offset; | ||
297 | sop.Velocity = velocity; | ||
298 | sop.AngularVelocity = angvelo; | ||
299 | sop.Acceleration = accel; | ||
300 | sop.Description = description; | ||
301 | sop.Color = color; | ||
302 | sop.Text = text; | ||
303 | sop.SitName = sitname; | ||
304 | sop.TouchName = touchname; | ||
305 | sop.LinkNum = linknum; | ||
306 | sop.ClickAction = clickaction; | ||
307 | sop.Scale = scale; | ||
308 | sop.UpdateFlag = updatef; | ||
309 | |||
310 | //Tests if local part accepted the parameters: | ||
311 | Assert.That(regionh,Is.EqualTo(sop.RegionHandle), "Assert.That(regionh,Is.EqualTo(sop.RegionHandle))"); | ||
312 | Assert.That(localid,Is.EqualTo(sop.LocalId), "Assert.That(localid,Is.EqualTo(sop.LocalId))"); | ||
313 | Assert.That(groupos,Is.EqualTo(sop.GroupPosition), "Assert.That(groupos,Is.EqualTo(sop.GroupPosition))"); | ||
314 | Assert.That(name,Is.EqualTo(sop.Name), "Assert.That(name,Is.EqualTo(sop.Name))"); | ||
315 | Assert.That(rotoff,Is.EqualTo(sop.RotationOffset), "Assert.That(rotoff,Is.EqualTo(sop.RotationOffset))"); | ||
316 | Assert.That(uuid,Is.EqualTo(sop.UUID), "Assert.That(uuid,Is.EqualTo(sop.UUID))"); | ||
317 | Assert.That(creator,Is.EqualTo(sop.CreatorID), "Assert.That(creator,Is.EqualTo(sop.CreatorID))"); | ||
318 | // Modified in-class | ||
319 | // Assert.That(iserial,Is.EqualTo(sop.InventorySerial), "Assert.That(iserial,Is.EqualTo(sop.InventorySerial))"); | ||
320 | Assert.That(dic,Is.EqualTo(sop.TaskInventory), "Assert.That(dic,Is.EqualTo(sop.TaskInventory))"); | ||
321 | Assert.That(objf,Is.EqualTo(sop.ObjectFlags), "Assert.That(objf,Is.EqualTo(sop.ObjectFlags))"); | ||
322 | Assert.That(name,Is.EqualTo(sop.Name), "Assert.That(name,Is.EqualTo(sop.Name))"); | ||
323 | Assert.That(material,Is.EqualTo(sop.Material), "Assert.That(material,Is.EqualTo(sop.Material))"); | ||
324 | Assert.That(pin,Is.EqualTo(sop.ScriptAccessPin), "Assert.That(pin,Is.EqualTo(sop.ScriptAccessPin))"); | ||
325 | Assert.That(textani,Is.EqualTo(sop.TextureAnimation), "Assert.That(textani,Is.EqualTo(sop.TextureAnimation))"); | ||
326 | Assert.That(partsys,Is.EqualTo(sop.ParticleSystem), "Assert.That(partsys,Is.EqualTo(sop.ParticleSystem))"); | ||
327 | Assert.That(expires,Is.EqualTo(sop.Expires), "Assert.That(expires,Is.EqualTo(sop.Expires))"); | ||
328 | Assert.That(rezzed,Is.EqualTo(sop.Rezzed), "Assert.That(rezzed,Is.EqualTo(sop.Rezzed))"); | ||
329 | Assert.That(offset,Is.EqualTo(sop.OffsetPosition), "Assert.That(offset,Is.EqualTo(sop.OffsetPosition))"); | ||
330 | Assert.That(velocity,Is.EqualTo(sop.Velocity), "Assert.That(velocity,Is.EqualTo(sop.Velocity))"); | ||
331 | Assert.That(angvelo,Is.EqualTo(sop.AngularVelocity), "Assert.That(angvelo,Is.EqualTo(sop.AngularVelocity))"); | ||
332 | Assert.That(accel,Is.EqualTo(sop.Acceleration), "Assert.That(accel,Is.EqualTo(sop.Acceleration))"); | ||
333 | Assert.That(description,Is.EqualTo(sop.Description), "Assert.That(description,Is.EqualTo(sop.Description))"); | ||
334 | Assert.That(color,Is.EqualTo(sop.Color), "Assert.That(color,Is.EqualTo(sop.Color))"); | ||
335 | Assert.That(text,Is.EqualTo(sop.Text), "Assert.That(text,Is.EqualTo(sop.Text))"); | ||
336 | Assert.That(sitname,Is.EqualTo(sop.SitName), "Assert.That(sitname,Is.EqualTo(sop.SitName))"); | ||
337 | Assert.That(touchname,Is.EqualTo(sop.TouchName), "Assert.That(touchname,Is.EqualTo(sop.TouchName))"); | ||
338 | Assert.That(linknum,Is.EqualTo(sop.LinkNum), "Assert.That(linknum,Is.EqualTo(sop.LinkNum))"); | ||
339 | Assert.That(clickaction,Is.EqualTo(sop.ClickAction), "Assert.That(clickaction,Is.EqualTo(sop.ClickAction))"); | ||
340 | Assert.That(scale,Is.EqualTo(sop.Scale), "Assert.That(scale,Is.EqualTo(sop.Scale))"); | ||
341 | Assert.That(updatef,Is.EqualTo(sop.UpdateFlag), "Assert.That(updatef,Is.EqualTo(sop.UpdateFlag))"); | ||
342 | |||
343 | // This is necessary or object will not be inserted in DB | ||
344 | sop.ObjectFlags = 0; | ||
345 | |||
346 | SceneObjectGroup sog = new SceneObjectGroup(sop); | ||
347 | |||
348 | // Inserts group in DB | ||
349 | db.StoreObject(sog,region3); | ||
350 | List<SceneObjectGroup> sogs = db.LoadObjects(region3); | ||
351 | Assert.That(sogs.Count, Is.EqualTo(1), "Assert.That(sogs.Count, Is.EqualTo(1))"); | ||
352 | // Makes sure there are no double insertions: | ||
353 | db.StoreObject(sog,region3); | ||
354 | sogs = db.LoadObjects(region3); | ||
355 | Assert.That(sogs.Count, Is.EqualTo(1), "Assert.That(sogs.Count, Is.EqualTo(1))"); | ||
356 | |||
357 | |||
358 | // Tests if the parameters were inserted correctly | ||
359 | SceneObjectPart p = sogs[0].RootPart; | ||
360 | Assert.That(regionh,Is.EqualTo(p.RegionHandle), "Assert.That(regionh,Is.EqualTo(p.RegionHandle))"); | ||
361 | //Assert.That(localid,Is.EqualTo(p.LocalId), "Assert.That(localid,Is.EqualTo(p.LocalId))"); | ||
362 | Assert.That(groupos,Is.EqualTo(p.GroupPosition), "Assert.That(groupos,Is.EqualTo(p.GroupPosition))"); | ||
363 | Assert.That(name,Is.EqualTo(p.Name), "Assert.That(name,Is.EqualTo(p.Name))"); | ||
364 | Assert.That(rotoff,Is.EqualTo(p.RotationOffset), "Assert.That(rotoff,Is.EqualTo(p.RotationOffset))"); | ||
365 | Assert.That(uuid,Is.EqualTo(p.UUID), "Assert.That(uuid,Is.EqualTo(p.UUID))"); | ||
366 | Assert.That(creator,Is.EqualTo(p.CreatorID), "Assert.That(creator,Is.EqualTo(p.CreatorID))"); | ||
367 | //Assert.That(iserial,Is.EqualTo(p.InventorySerial), "Assert.That(iserial,Is.EqualTo(p.InventorySerial))"); | ||
368 | Assert.That(dic,Is.EqualTo(p.TaskInventory), "Assert.That(dic,Is.EqualTo(p.TaskInventory))"); | ||
369 | //Assert.That(objf,Is.EqualTo(p.ObjectFlags), "Assert.That(objf,Is.EqualTo(p.ObjectFlags))"); | ||
370 | Assert.That(name,Is.EqualTo(p.Name), "Assert.That(name,Is.EqualTo(p.Name))"); | ||
371 | Assert.That(material,Is.EqualTo(p.Material), "Assert.That(material,Is.EqualTo(p.Material))"); | ||
372 | Assert.That(pin,Is.EqualTo(p.ScriptAccessPin), "Assert.That(pin,Is.EqualTo(p.ScriptAccessPin))"); | ||
373 | Assert.That(textani,Is.EqualTo(p.TextureAnimation), "Assert.That(textani,Is.EqualTo(p.TextureAnimation))"); | ||
374 | Assert.That(partsys,Is.EqualTo(p.ParticleSystem), "Assert.That(partsys,Is.EqualTo(p.ParticleSystem))"); | ||
375 | //Assert.That(expires,Is.EqualTo(p.Expires), "Assert.That(expires,Is.EqualTo(p.Expires))"); | ||
376 | //Assert.That(rezzed,Is.EqualTo(p.Rezzed), "Assert.That(rezzed,Is.EqualTo(p.Rezzed))"); | ||
377 | Assert.That(offset,Is.EqualTo(p.OffsetPosition), "Assert.That(offset,Is.EqualTo(p.OffsetPosition))"); | ||
378 | Assert.That(velocity,Is.EqualTo(p.Velocity), "Assert.That(velocity,Is.EqualTo(p.Velocity))"); | ||
379 | Assert.That(angvelo,Is.EqualTo(p.AngularVelocity), "Assert.That(angvelo,Is.EqualTo(p.AngularVelocity))"); | ||
380 | Assert.That(accel,Is.EqualTo(p.Acceleration), "Assert.That(accel,Is.EqualTo(p.Acceleration))"); | ||
381 | Assert.That(description,Is.EqualTo(p.Description), "Assert.That(description,Is.EqualTo(p.Description))"); | ||
382 | Assert.That(color,Is.EqualTo(p.Color), "Assert.That(color,Is.EqualTo(p.Color))"); | ||
383 | Assert.That(text,Is.EqualTo(p.Text), "Assert.That(text,Is.EqualTo(p.Text))"); | ||
384 | Assert.That(sitname,Is.EqualTo(p.SitName), "Assert.That(sitname,Is.EqualTo(p.SitName))"); | ||
385 | Assert.That(touchname,Is.EqualTo(p.TouchName), "Assert.That(touchname,Is.EqualTo(p.TouchName))"); | ||
386 | //Assert.That(linknum,Is.EqualTo(p.LinkNum), "Assert.That(linknum,Is.EqualTo(p.LinkNum))"); | ||
387 | Assert.That(clickaction,Is.EqualTo(p.ClickAction), "Assert.That(clickaction,Is.EqualTo(p.ClickAction))"); | ||
388 | Assert.That(scale,Is.EqualTo(p.Scale), "Assert.That(scale,Is.EqualTo(p.Scale))"); | ||
389 | |||
390 | //Assert.That(updatef,Is.EqualTo(p.UpdateFlag), "Assert.That(updatef,Is.EqualTo(p.UpdateFlag))"); | ||
391 | |||
392 | Assert.That(pbshap.PathBegin, Is.EqualTo(p.Shape.PathBegin), "Assert.That(pbshap.PathBegin, Is.EqualTo(p.Shape.PathBegin))"); | ||
393 | Assert.That(pbshap.PathEnd, Is.EqualTo(p.Shape.PathEnd), "Assert.That(pbshap.PathEnd, Is.EqualTo(p.Shape.PathEnd))"); | ||
394 | Assert.That(pbshap.ProfileBegin, Is.EqualTo(p.Shape.ProfileBegin), "Assert.That(pbshap.ProfileBegin, Is.EqualTo(p.Shape.ProfileBegin))"); | ||
395 | Assert.That(pbshap.ProfileEnd, Is.EqualTo(p.Shape.ProfileEnd), "Assert.That(pbshap.ProfileEnd, Is.EqualTo(p.Shape.ProfileEnd))"); | ||
396 | Assert.That(pbshap.ProfileHollow, Is.EqualTo(p.Shape.ProfileHollow), "Assert.That(pbshap.ProfileHollow, Is.EqualTo(p.Shape.ProfileHollow))"); | ||
397 | } | ||
398 | |||
399 | [Test] | ||
400 | public void T014_UpdateObject() | ||
401 | { | ||
402 | string text1 = "object1 text"; | ||
403 | SceneObjectGroup sog = FindSOG("object1", region1); | ||
404 | sog.RootPart.Text = text1; | ||
405 | db.StoreObject(sog, region1); | ||
406 | |||
407 | sog = FindSOG("object1", region1); | ||
408 | Assert.That(text1, Is.EqualTo(sog.RootPart.Text), "Assert.That(text1, Is.EqualTo(sog.RootPart.Text))"); | ||
409 | |||
410 | // Creates random values | ||
411 | UUID creator = new UUID(); | ||
412 | creator = UUID.Random(); | ||
413 | TaskInventoryDictionary dic = new TaskInventoryDictionary(); | ||
414 | localID = localID + 1; | ||
415 | string name = "West Adam"; | ||
416 | byte material = (byte) random.Next(127); | ||
417 | ulong regionh = (ulong)random.NextDouble() * (ulong)random.Next(); | ||
418 | int pin = random.Next(); | ||
419 | Byte[] partsys = new byte[8]; | ||
420 | Byte[] textani = new byte[8]; | ||
421 | random.NextBytes(textani); | ||
422 | random.NextBytes(partsys); | ||
423 | DateTime expires = new DateTime(2010, 12, 20); | ||
424 | DateTime rezzed = new DateTime(2005, 07, 15); | ||
425 | Vector3 groupos = new Vector3(random.Next(),random.Next(),random.Next()); | ||
426 | Vector3 offset = new Vector3(random.Next(),random.Next(),random.Next()); | ||
427 | Quaternion rotoff = new Quaternion(random.Next(),random.Next(),random.Next(),random.Next()); | ||
428 | Vector3 velocity = new Vector3(random.Next(),random.Next(),random.Next()); | ||
429 | Vector3 angvelo = new Vector3(random.Next(),random.Next(),random.Next()); | ||
430 | Vector3 accel = new Vector3(random.Next(),random.Next(),random.Next()); | ||
431 | string description = name; | ||
432 | Color color = Color.FromArgb(255, 255, 255, 0); | ||
433 | string text = "What You Say?{]\vz~"; | ||
434 | string sitname = RandomName(); | ||
435 | string touchname = RandomName(); | ||
436 | int linknum = random.Next(); | ||
437 | byte clickaction = (byte) random.Next(127); | ||
438 | PrimitiveBaseShape pbshap = new PrimitiveBaseShape(); | ||
439 | pbshap = PrimitiveBaseShape.Default; | ||
440 | Vector3 scale = new Vector3(random.Next(),random.Next(),random.Next()); | ||
441 | byte updatef = (byte) random.Next(127); | ||
442 | |||
443 | // Updates the region with new values | ||
444 | SceneObjectGroup sog2 = FindSOG("Adam West", region3); | ||
445 | Assert.That(sog2,Is.Not.Null); | ||
446 | sog2.RootPart.RegionHandle = regionh; | ||
447 | sog2.RootPart.Shape = pbshap; | ||
448 | sog2.RootPart.GroupPosition = groupos; | ||
449 | sog2.RootPart.RotationOffset = rotoff; | ||
450 | sog2.RootPart.CreatorID = creator; | ||
451 | sog2.RootPart.TaskInventory = dic; | ||
452 | sog2.RootPart.Name = name; | ||
453 | sog2.RootPart.Material = material; | ||
454 | sog2.RootPart.ScriptAccessPin = pin; | ||
455 | sog2.RootPart.TextureAnimation = textani; | ||
456 | sog2.RootPart.ParticleSystem = partsys; | ||
457 | sog2.RootPart.Expires = expires; | ||
458 | sog2.RootPart.Rezzed = rezzed; | ||
459 | sog2.RootPart.OffsetPosition = offset; | ||
460 | sog2.RootPart.Velocity = velocity; | ||
461 | sog2.RootPart.AngularVelocity = angvelo; | ||
462 | sog2.RootPart.Acceleration = accel; | ||
463 | sog2.RootPart.Description = description; | ||
464 | sog2.RootPart.Color = color; | ||
465 | sog2.RootPart.Text = text; | ||
466 | sog2.RootPart.SitName = sitname; | ||
467 | sog2.RootPart.TouchName = touchname; | ||
468 | sog2.RootPart.LinkNum = linknum; | ||
469 | sog2.RootPart.ClickAction = clickaction; | ||
470 | sog2.RootPart.Scale = scale; | ||
471 | sog2.RootPart.UpdateFlag = updatef; | ||
472 | |||
473 | db.StoreObject(sog2, region3); | ||
474 | List<SceneObjectGroup> sogs = db.LoadObjects(region3); | ||
475 | Assert.That(sogs.Count, Is.EqualTo(1), "Assert.That(sogs.Count, Is.EqualTo(1))"); | ||
476 | |||
477 | SceneObjectGroup retsog = FindSOG("West Adam", region3); | ||
478 | Assert.That(retsog,Is.Not.Null); | ||
479 | SceneObjectPart p = retsog.RootPart; | ||
480 | Assert.That(regionh,Is.EqualTo(p.RegionHandle), "Assert.That(regionh,Is.EqualTo(p.RegionHandle))"); | ||
481 | Assert.That(groupos,Is.EqualTo(p.GroupPosition), "Assert.That(groupos,Is.EqualTo(p.GroupPosition))"); | ||
482 | Assert.That(name,Is.EqualTo(p.Name), "Assert.That(name,Is.EqualTo(p.Name))"); | ||
483 | Assert.That(rotoff,Is.EqualTo(p.RotationOffset), "Assert.That(rotoff,Is.EqualTo(p.RotationOffset))"); | ||
484 | Assert.That(creator,Is.EqualTo(p.CreatorID), "Assert.That(creator,Is.EqualTo(p.CreatorID))"); | ||
485 | Assert.That(dic,Is.EqualTo(p.TaskInventory), "Assert.That(dic,Is.EqualTo(p.TaskInventory))"); | ||
486 | Assert.That(name,Is.EqualTo(p.Name), "Assert.That(name,Is.EqualTo(p.Name))"); | ||
487 | Assert.That(material,Is.EqualTo(p.Material), "Assert.That(material,Is.EqualTo(p.Material))"); | ||
488 | Assert.That(pin,Is.EqualTo(p.ScriptAccessPin), "Assert.That(pin,Is.EqualTo(p.ScriptAccessPin))"); | ||
489 | Assert.That(textani,Is.EqualTo(p.TextureAnimation), "Assert.That(textani,Is.EqualTo(p.TextureAnimation))"); | ||
490 | Assert.That(partsys,Is.EqualTo(p.ParticleSystem), "Assert.That(partsys,Is.EqualTo(p.ParticleSystem))"); | ||
491 | Assert.That(offset,Is.EqualTo(p.OffsetPosition), "Assert.That(offset,Is.EqualTo(p.OffsetPosition))"); | ||
492 | Assert.That(velocity,Is.EqualTo(p.Velocity), "Assert.That(velocity,Is.EqualTo(p.Velocity))"); | ||
493 | Assert.That(angvelo,Is.EqualTo(p.AngularVelocity), "Assert.That(angvelo,Is.EqualTo(p.AngularVelocity))"); | ||
494 | Assert.That(accel,Is.EqualTo(p.Acceleration), "Assert.That(accel,Is.EqualTo(p.Acceleration))"); | ||
495 | Assert.That(description,Is.EqualTo(p.Description), "Assert.That(description,Is.EqualTo(p.Description))"); | ||
496 | Assert.That(color,Is.EqualTo(p.Color), "Assert.That(color,Is.EqualTo(p.Color))"); | ||
497 | Assert.That(text,Is.EqualTo(p.Text), "Assert.That(text,Is.EqualTo(p.Text))"); | ||
498 | Assert.That(sitname,Is.EqualTo(p.SitName), "Assert.That(sitname,Is.EqualTo(p.SitName))"); | ||
499 | Assert.That(touchname,Is.EqualTo(p.TouchName), "Assert.That(touchname,Is.EqualTo(p.TouchName))"); | ||
500 | Assert.That(clickaction,Is.EqualTo(p.ClickAction), "Assert.That(clickaction,Is.EqualTo(p.ClickAction))"); | ||
501 | Assert.That(scale,Is.EqualTo(p.Scale), "Assert.That(scale,Is.EqualTo(p.Scale))"); | ||
502 | } | ||
503 | |||
504 | [Test] | ||
505 | public void T015_LargeSceneObjects() | ||
506 | { | ||
507 | UUID id = UUID.Random(); | ||
508 | Dictionary<UUID, SceneObjectPart> mydic = new Dictionary<UUID, SceneObjectPart>(); | ||
509 | SceneObjectGroup sog = NewSOG("Test SOG", id, region4); | ||
510 | mydic.Add(sog.RootPart.UUID,sog.RootPart); | ||
511 | for (int i=0;i<30;i++) | ||
512 | { | ||
513 | UUID tmp = UUID.Random(); | ||
514 | SceneObjectPart sop = NewSOP(("Test SOP " + i.ToString()),tmp); | ||
515 | Vector3 groupos = new Vector3(random.Next(),random.Next(),random.Next()); | ||
516 | Vector3 offset = new Vector3(random.Next(),random.Next(),random.Next()); | ||
517 | Quaternion rotoff = new Quaternion(random.Next(),random.Next(),random.Next(),random.Next()); | ||
518 | Vector3 velocity = new Vector3(random.Next(),random.Next(),random.Next()); | ||
519 | Vector3 angvelo = new Vector3(random.Next(),random.Next(),random.Next()); | ||
520 | Vector3 accel = new Vector3(random.Next(),random.Next(),random.Next()); | ||
521 | |||
522 | sop.GroupPosition = groupos; | ||
523 | sop.RotationOffset = rotoff; | ||
524 | sop.OffsetPosition = offset; | ||
525 | sop.Velocity = velocity; | ||
526 | sop.AngularVelocity = angvelo; | ||
527 | sop.Acceleration = accel; | ||
528 | |||
529 | mydic.Add(tmp,sop); | ||
530 | sog.AddPart(sop); | ||
531 | db.StoreObject(sog, region4); | ||
532 | } | ||
533 | |||
534 | SceneObjectGroup retsog = FindSOG("Test SOG", region4); | ||
535 | SceneObjectPart[] parts = retsog.GetParts(); | ||
536 | for (int i=0;i<30;i++) | ||
537 | { | ||
538 | SceneObjectPart cursop = mydic[parts[i].UUID]; | ||
539 | Assert.That(cursop.GroupPosition,Is.EqualTo(parts[i].GroupPosition), "Assert.That(cursop.GroupPosition,Is.EqualTo(parts[i].GroupPosition))"); | ||
540 | Assert.That(cursop.RotationOffset,Is.EqualTo(parts[i].RotationOffset), "Assert.That(cursop.RotationOffset,Is.EqualTo(parts[i].RotationOffset))"); | ||
541 | Assert.That(cursop.OffsetPosition,Is.EqualTo(parts[i].OffsetPosition), "Assert.That(cursop.OffsetPosition,Is.EqualTo(parts[i].OffsetPosition))"); | ||
542 | Assert.That(cursop.Velocity,Is.EqualTo(parts[i].Velocity), "Assert.That(cursop.Velocity,Is.EqualTo(parts[i].Velocity))"); | ||
543 | Assert.That(cursop.AngularVelocity,Is.EqualTo(parts[i].AngularVelocity), "Assert.That(cursop.AngularVelocity,Is.EqualTo(parts[i].AngularVelocity))"); | ||
544 | Assert.That(cursop.Acceleration,Is.EqualTo(parts[i].Acceleration), "Assert.That(cursop.Acceleration,Is.EqualTo(parts[i].Acceleration))"); | ||
545 | } | ||
546 | } | ||
547 | |||
548 | //[Test] | ||
549 | public void T016_RandomSogWithSceneParts() | ||
550 | { | ||
551 | PropertyScrambler<SceneObjectPart> scrambler = | ||
552 | new PropertyScrambler<SceneObjectPart>() | ||
553 | .DontScramble(x => x.UUID); | ||
554 | UUID tmpSog = UUID.Random(); | ||
555 | UUID tmp1 = UUID.Random(); | ||
556 | UUID tmp2 = UUID.Random(); | ||
557 | UUID tmp3 = UUID.Random(); | ||
558 | UUID newregion = UUID.Random(); | ||
559 | SceneObjectPart p1 = new SceneObjectPart(); | ||
560 | SceneObjectPart p2 = new SceneObjectPart(); | ||
561 | SceneObjectPart p3 = new SceneObjectPart(); | ||
562 | p1.Shape = PrimitiveBaseShape.Default; | ||
563 | p2.Shape = PrimitiveBaseShape.Default; | ||
564 | p3.Shape = PrimitiveBaseShape.Default; | ||
565 | p1.UUID = tmp1; | ||
566 | p2.UUID = tmp2; | ||
567 | p3.UUID = tmp3; | ||
568 | scrambler.Scramble(p1); | ||
569 | scrambler.Scramble(p2); | ||
570 | scrambler.Scramble(p3); | ||
571 | |||
572 | SceneObjectGroup sog = NewSOG("Sop 0", tmpSog, newregion); | ||
573 | PropertyScrambler<SceneObjectGroup> sogScrambler = | ||
574 | new PropertyScrambler<SceneObjectGroup>() | ||
575 | .DontScramble(x => x.UUID); | ||
576 | sogScrambler.Scramble(sog); | ||
577 | sog.UUID = tmpSog; | ||
578 | sog.AddPart(p1); | ||
579 | sog.AddPart(p2); | ||
580 | sog.AddPart(p3); | ||
581 | |||
582 | SceneObjectPart[] parts = sog.GetParts(); | ||
583 | Assert.That(parts.Length, Is.EqualTo(4), "Assert.That(parts.Length,Is.EqualTo(4))"); | ||
584 | |||
585 | db.StoreObject(sog, newregion); | ||
586 | List<SceneObjectGroup> sogs = db.LoadObjects(newregion); | ||
587 | Assert.That(sogs.Count, Is.EqualTo(1), "Assert.That(sogs.Count,Is.EqualTo(1))"); | ||
588 | SceneObjectGroup newsog = sogs[0]; | ||
589 | |||
590 | SceneObjectPart[] newparts = newsog.GetParts(); | ||
591 | Assert.That(newparts.Length, Is.EqualTo(4), "Assert.That(newparts.Length,Is.EqualTo(4))"); | ||
592 | |||
593 | Assert.That(newsog, Constraints.PropertyCompareConstraint(sog) | ||
594 | .IgnoreProperty(x=>x.LocalId) | ||
595 | .IgnoreProperty(x=>x.HasGroupChanged) | ||
596 | .IgnoreProperty(x=>x.IsSelected) | ||
597 | .IgnoreProperty(x=>x.RegionHandle) | ||
598 | .IgnoreProperty(x=>x.RegionUUID) | ||
599 | .IgnoreProperty(x=>x.Scene) | ||
600 | .IgnoreProperty(x=>x.Children) | ||
601 | .IgnoreProperty(x=>x.PassCollision) | ||
602 | .IgnoreProperty(x=>x.RootPart)); | ||
603 | } | ||
604 | |||
605 | [Test] | ||
606 | public void T020_PrimInventoryEmpty() | ||
607 | { | ||
608 | SceneObjectGroup sog = FindSOG("object1", region1); | ||
609 | TaskInventoryItem t = sog.GetInventoryItem(sog.RootPart.LocalId, item1); | ||
610 | Assert.That(t, Is.Null); | ||
611 | } | ||
612 | |||
613 | [Test] | ||
614 | public void T021_PrimInventoryStore() | ||
615 | { | ||
616 | SceneObjectGroup sog = FindSOG("object1", region1); | ||
617 | InventoryItemBase i = NewItem(item1, zero, zero, itemname1, zero); | ||
618 | |||
619 | Assert.That(sog.AddInventoryItem(null, sog.RootPart.LocalId, i, zero), Is.True); | ||
620 | TaskInventoryItem t = sog.GetInventoryItem(sog.RootPart.LocalId, item1); | ||
621 | Assert.That(t.Name, Is.EqualTo(itemname1), "Assert.That(t.Name, Is.EqualTo(itemname1))"); | ||
622 | |||
623 | // TODO: seriously??? this is the way we need to loop to get this? | ||
624 | |||
625 | List<TaskInventoryItem> list = new List<TaskInventoryItem>(); | ||
626 | foreach (UUID uuid in sog.RootPart.Inventory.GetInventoryList()) | ||
627 | { | ||
628 | list.Add(sog.GetInventoryItem(sog.RootPart.LocalId, uuid)); | ||
629 | } | ||
630 | |||
631 | db.StorePrimInventory(prim1, list); | ||
632 | } | ||
633 | |||
634 | [Test] | ||
635 | public void T022_PrimInventoryRetrieve() | ||
636 | { | ||
637 | SceneObjectGroup sog = FindSOG("object1", region1); | ||
638 | TaskInventoryItem t = sog.GetInventoryItem(sog.RootPart.LocalId, item1); | ||
639 | |||
640 | Assert.That(t.Name, Is.EqualTo(itemname1), "Assert.That(t.Name, Is.EqualTo(itemname1))"); | ||
641 | } | ||
642 | |||
643 | [Test] | ||
644 | public void T023_PrimInventoryUpdate() | ||
645 | { | ||
646 | SceneObjectGroup sog = FindSOG("object1", region1); | ||
647 | TaskInventoryItem t = sog.GetInventoryItem(sog.RootPart.LocalId, item1); | ||
648 | |||
649 | t.Name = "My New Name"; | ||
650 | sog.UpdateInventoryItem(t); | ||
651 | |||
652 | Assert.That(t.Name, Is.EqualTo("My New Name"), "Assert.That(t.Name, Is.EqualTo(\"My New Name\"))"); | ||
653 | |||
654 | } | ||
655 | |||
656 | [Test] | ||
657 | public void T024_PrimInventoryRemove() | ||
658 | { | ||
659 | List<TaskInventoryItem> list = new List<TaskInventoryItem>(); | ||
660 | db.StorePrimInventory(prim1, list); | ||
661 | |||
662 | SceneObjectGroup sog = FindSOG("object1", region1); | ||
663 | TaskInventoryItem t = sog.GetInventoryItem(sog.RootPart.LocalId, item1); | ||
664 | Assert.That(t, Is.Null); | ||
665 | } | ||
666 | |||
667 | [Test] | ||
668 | public void T025_PrimInventoryPersistency() | ||
669 | { | ||
670 | InventoryItemBase i = new InventoryItemBase(); | ||
671 | UUID id = UUID.Random(); | ||
672 | i.ID = id; | ||
673 | UUID folder = UUID.Random(); | ||
674 | i.Folder = folder; | ||
675 | UUID owner = UUID.Random(); | ||
676 | i.Owner = owner; | ||
677 | UUID creator = UUID.Random(); | ||
678 | i.CreatorId = creator.ToString(); | ||
679 | string name = RandomName(); | ||
680 | i.Name = name; | ||
681 | i.Description = name; | ||
682 | UUID assetid = UUID.Random(); | ||
683 | i.AssetID = assetid; | ||
684 | int invtype = random.Next(); | ||
685 | i.InvType = invtype; | ||
686 | uint nextperm = (uint) random.Next(); | ||
687 | i.NextPermissions = nextperm; | ||
688 | uint curperm = (uint) random.Next(); | ||
689 | i.CurrentPermissions = curperm; | ||
690 | uint baseperm = (uint) random.Next(); | ||
691 | i.BasePermissions = baseperm; | ||
692 | uint eoperm = (uint) random.Next(); | ||
693 | i.EveryOnePermissions = eoperm; | ||
694 | int assettype = random.Next(); | ||
695 | i.AssetType = assettype; | ||
696 | UUID groupid = UUID.Random(); | ||
697 | i.GroupID = groupid; | ||
698 | bool groupown = true; | ||
699 | i.GroupOwned = groupown; | ||
700 | int saleprice = random.Next(); | ||
701 | i.SalePrice = saleprice; | ||
702 | byte saletype = (byte) random.Next(127); | ||
703 | i.SaleType = saletype; | ||
704 | uint flags = (uint) random.Next(); | ||
705 | i.Flags = flags; | ||
706 | int creationd = random.Next(); | ||
707 | i.CreationDate = creationd; | ||
708 | |||
709 | SceneObjectGroup sog = FindSOG("object1", region1); | ||
710 | Assert.That(sog.AddInventoryItem(null, sog.RootPart.LocalId, i, zero), Is.True); | ||
711 | TaskInventoryItem t = sog.GetInventoryItem(sog.RootPart.LocalId, id); | ||
712 | |||
713 | Assert.That(t.Name, Is.EqualTo(name), "Assert.That(t.Name, Is.EqualTo(name))"); | ||
714 | Assert.That(t.AssetID,Is.EqualTo(assetid), "Assert.That(t.AssetID,Is.EqualTo(assetid))"); | ||
715 | Assert.That(t.BasePermissions,Is.EqualTo(baseperm), "Assert.That(t.BasePermissions,Is.EqualTo(baseperm))"); | ||
716 | Assert.That(t.CreationDate,Is.EqualTo(creationd), "Assert.That(t.CreationDate,Is.EqualTo(creationd))"); | ||
717 | Assert.That(t.CreatorID,Is.EqualTo(creator), "Assert.That(t.CreatorID,Is.EqualTo(creator))"); | ||
718 | Assert.That(t.Description,Is.EqualTo(name), "Assert.That(t.Description,Is.EqualTo(name))"); | ||
719 | Assert.That(t.EveryonePermissions,Is.EqualTo(eoperm), "Assert.That(t.EveryonePermissions,Is.EqualTo(eoperm))"); | ||
720 | Assert.That(t.Flags,Is.EqualTo(flags), "Assert.That(t.Flags,Is.EqualTo(flags))"); | ||
721 | Assert.That(t.GroupID,Is.EqualTo(sog.RootPart.GroupID), "Assert.That(t.GroupID,Is.EqualTo(sog.RootPart.GroupID))"); | ||
722 | // Where is this group permissions?? | ||
723 | // Assert.That(t.GroupPermissions,Is.EqualTo(), "Assert.That(t.GroupPermissions,Is.EqualTo())"); | ||
724 | Assert.That(t.Type,Is.EqualTo(assettype), "Assert.That(t.Type,Is.EqualTo(assettype))"); | ||
725 | Assert.That(t.InvType, Is.EqualTo(invtype), "Assert.That(t.InvType, Is.EqualTo(invtype))"); | ||
726 | Assert.That(t.ItemID, Is.EqualTo(id), "Assert.That(t.ItemID, Is.EqualTo(id))"); | ||
727 | Assert.That(t.LastOwnerID, Is.EqualTo(sog.RootPart.LastOwnerID), "Assert.That(t.LastOwnerID, Is.EqualTo(sog.RootPart.LastOwnerID))"); | ||
728 | Assert.That(t.NextPermissions, Is.EqualTo(nextperm), "Assert.That(t.NextPermissions, Is.EqualTo(nextperm))"); | ||
729 | // Ownership changes when you drop an object into an object | ||
730 | // owned by someone else | ||
731 | Assert.That(t.OwnerID,Is.EqualTo(sog.RootPart.OwnerID), "Assert.That(t.OwnerID,Is.EqualTo(sog.RootPart.OwnerID))"); | ||
732 | Assert.That(t.CurrentPermissions, Is.EqualTo(curperm | 8), "Assert.That(t.CurrentPermissions, Is.EqualTo(curperm | 8))"); | ||
733 | Assert.That(t.ParentID,Is.EqualTo(sog.RootPart.FolderID), "Assert.That(t.ParentID,Is.EqualTo(sog.RootPart.FolderID))"); | ||
734 | Assert.That(t.ParentPartID,Is.EqualTo(sog.RootPart.UUID), "Assert.That(t.ParentPartID,Is.EqualTo(sog.RootPart.UUID))"); | ||
735 | } | ||
736 | |||
737 | [Test] | ||
738 | [ExpectedException(typeof(ArgumentException))] | ||
739 | public void T026_PrimInventoryMany() | ||
740 | { | ||
741 | UUID i1,i2,i3,i4; | ||
742 | i1 = UUID.Random(); | ||
743 | i2 = UUID.Random(); | ||
744 | i3 = UUID.Random(); | ||
745 | i4 = i3; | ||
746 | InventoryItemBase ib1 = NewItem(i1, zero, zero, RandomName(), zero); | ||
747 | InventoryItemBase ib2 = NewItem(i2, zero, zero, RandomName(), zero); | ||
748 | InventoryItemBase ib3 = NewItem(i3, zero, zero, RandomName(), zero); | ||
749 | InventoryItemBase ib4 = NewItem(i4, zero, zero, RandomName(), zero); | ||
750 | |||
751 | SceneObjectGroup sog = FindSOG("object1", region1); | ||
752 | |||
753 | Assert.That(sog.AddInventoryItem(null, sog.RootPart.LocalId, ib1, zero), Is.True); | ||
754 | Assert.That(sog.AddInventoryItem(null, sog.RootPart.LocalId, ib2, zero), Is.True); | ||
755 | Assert.That(sog.AddInventoryItem(null, sog.RootPart.LocalId, ib3, zero), Is.True); | ||
756 | Assert.That(sog.AddInventoryItem(null, sog.RootPart.LocalId, ib4, zero), Is.True); | ||
757 | |||
758 | TaskInventoryItem t1 = sog.GetInventoryItem(sog.RootPart.LocalId, i1); | ||
759 | Assert.That(t1.Name, Is.EqualTo(ib1.Name), "Assert.That(t1.Name, Is.EqualTo(ib1.Name))"); | ||
760 | TaskInventoryItem t2 = sog.GetInventoryItem(sog.RootPart.LocalId, i2); | ||
761 | Assert.That(t2.Name, Is.EqualTo(ib2.Name), "Assert.That(t2.Name, Is.EqualTo(ib2.Name))"); | ||
762 | TaskInventoryItem t3 = sog.GetInventoryItem(sog.RootPart.LocalId, i3); | ||
763 | Assert.That(t3.Name, Is.EqualTo(ib3.Name), "Assert.That(t3.Name, Is.EqualTo(ib3.Name))"); | ||
764 | TaskInventoryItem t4 = sog.GetInventoryItem(sog.RootPart.LocalId, i4); | ||
765 | Assert.That(t4, Is.Null); | ||
766 | } | ||
767 | |||
768 | [Test] | ||
769 | public void T052_RemoveObject() | ||
770 | { | ||
771 | db.RemoveObject(prim1, region1); | ||
772 | SceneObjectGroup sog = FindSOG("object1", region1); | ||
773 | Assert.That(sog, Is.Null); | ||
774 | } | ||
775 | |||
776 | |||
777 | [Test] | ||
778 | public void T100_DefaultRegionInfo() | ||
779 | { | ||
780 | RegionSettings r1 = db.LoadRegionSettings(region1); | ||
781 | Assert.That(r1.RegionUUID, Is.EqualTo(region1), "Assert.That(r1.RegionUUID, Is.EqualTo(region1))"); | ||
782 | |||
783 | RegionSettings r2 = db.LoadRegionSettings(region2); | ||
784 | Assert.That(r2.RegionUUID, Is.EqualTo(region2), "Assert.That(r2.RegionUUID, Is.EqualTo(region2))"); | ||
785 | } | ||
786 | |||
787 | [Test] | ||
788 | public void T101_UpdateRegionInfo() | ||
789 | { | ||
790 | int agentlimit = random.Next(); | ||
791 | double objectbonus = random.Next(); | ||
792 | int maturity = random.Next(); | ||
793 | UUID tertex1 = UUID.Random(); | ||
794 | UUID tertex2 = UUID.Random(); | ||
795 | UUID tertex3 = UUID.Random(); | ||
796 | UUID tertex4 = UUID.Random(); | ||
797 | double elev1nw = random.Next(); | ||
798 | double elev2nw = random.Next(); | ||
799 | double elev1ne = random.Next(); | ||
800 | double elev2ne = random.Next(); | ||
801 | double elev1se = random.Next(); | ||
802 | double elev2se = random.Next(); | ||
803 | double elev1sw = random.Next(); | ||
804 | double elev2sw = random.Next(); | ||
805 | double waterh = random.Next(); | ||
806 | double terrainraise = random.Next(); | ||
807 | double terrainlower = random.Next(); | ||
808 | Vector3 sunvector = new Vector3((float)Math.Round(random.NextDouble(),5),(float)Math.Round(random.NextDouble(),5),(float)Math.Round(random.NextDouble(),5)); | ||
809 | UUID terimgid = UUID.Random(); | ||
810 | double sunpos = random.Next(); | ||
811 | UUID cov = UUID.Random(); | ||
812 | |||
813 | RegionSettings r1 = db.LoadRegionSettings(region1); | ||
814 | r1.BlockTerraform = true; | ||
815 | r1.BlockFly = true; | ||
816 | r1.AllowDamage = true; | ||
817 | r1.RestrictPushing = true; | ||
818 | r1.AllowLandResell = false; | ||
819 | r1.AllowLandJoinDivide = false; | ||
820 | r1.BlockShowInSearch = true; | ||
821 | r1.AgentLimit = agentlimit; | ||
822 | r1.ObjectBonus = objectbonus; | ||
823 | r1.Maturity = maturity; | ||
824 | r1.DisableScripts = true; | ||
825 | r1.DisableCollisions = true; | ||
826 | r1.DisablePhysics = true; | ||
827 | r1.TerrainTexture1 = tertex1; | ||
828 | r1.TerrainTexture2 = tertex2; | ||
829 | r1.TerrainTexture3 = tertex3; | ||
830 | r1.TerrainTexture4 = tertex4; | ||
831 | r1.Elevation1NW = elev1nw; | ||
832 | r1.Elevation2NW = elev2nw; | ||
833 | r1.Elevation1NE = elev1ne; | ||
834 | r1.Elevation2NE = elev2ne; | ||
835 | r1.Elevation1SE = elev1se; | ||
836 | r1.Elevation2SE = elev2se; | ||
837 | r1.Elevation1SW = elev1sw; | ||
838 | r1.Elevation2SW = elev2sw; | ||
839 | r1.WaterHeight = waterh; | ||
840 | r1.TerrainRaiseLimit = terrainraise; | ||
841 | r1.TerrainLowerLimit = terrainlower; | ||
842 | r1.UseEstateSun = false; | ||
843 | r1.Sandbox = true; | ||
844 | r1.SunVector = sunvector; | ||
845 | r1.TerrainImageID = terimgid; | ||
846 | r1.FixedSun = true; | ||
847 | r1.SunPosition = sunpos; | ||
848 | r1.Covenant = cov; | ||
849 | |||
850 | db.StoreRegionSettings(r1); | ||
851 | |||
852 | RegionSettings r1a = db.LoadRegionSettings(region1); | ||
853 | Assert.That(r1a.RegionUUID, Is.EqualTo(region1), "Assert.That(r1a.RegionUUID, Is.EqualTo(region1))"); | ||
854 | Assert.That(r1a.BlockTerraform,Is.True); | ||
855 | Assert.That(r1a.BlockFly,Is.True); | ||
856 | Assert.That(r1a.AllowDamage,Is.True); | ||
857 | Assert.That(r1a.RestrictPushing,Is.True); | ||
858 | Assert.That(r1a.AllowLandResell,Is.False); | ||
859 | Assert.That(r1a.AllowLandJoinDivide,Is.False); | ||
860 | Assert.That(r1a.BlockShowInSearch,Is.True); | ||
861 | Assert.That(r1a.AgentLimit,Is.EqualTo(agentlimit), "Assert.That(r1a.AgentLimit,Is.EqualTo(agentlimit))"); | ||
862 | Assert.That(r1a.ObjectBonus,Is.EqualTo(objectbonus), "Assert.That(r1a.ObjectBonus,Is.EqualTo(objectbonus))"); | ||
863 | Assert.That(r1a.Maturity,Is.EqualTo(maturity), "Assert.That(r1a.Maturity,Is.EqualTo(maturity))"); | ||
864 | Assert.That(r1a.DisableScripts,Is.True); | ||
865 | Assert.That(r1a.DisableCollisions,Is.True); | ||
866 | Assert.That(r1a.DisablePhysics,Is.True); | ||
867 | Assert.That(r1a.TerrainTexture1,Is.EqualTo(tertex1), "Assert.That(r1a.TerrainTexture1,Is.EqualTo(tertex1))"); | ||
868 | Assert.That(r1a.TerrainTexture2,Is.EqualTo(tertex2), "Assert.That(r1a.TerrainTexture2,Is.EqualTo(tertex2))"); | ||
869 | Assert.That(r1a.TerrainTexture3,Is.EqualTo(tertex3), "Assert.That(r1a.TerrainTexture3,Is.EqualTo(tertex3))"); | ||
870 | Assert.That(r1a.TerrainTexture4,Is.EqualTo(tertex4), "Assert.That(r1a.TerrainTexture4,Is.EqualTo(tertex4))"); | ||
871 | Assert.That(r1a.Elevation1NW,Is.EqualTo(elev1nw), "Assert.That(r1a.Elevation1NW,Is.EqualTo(elev1nw))"); | ||
872 | Assert.That(r1a.Elevation2NW,Is.EqualTo(elev2nw), "Assert.That(r1a.Elevation2NW,Is.EqualTo(elev2nw))"); | ||
873 | Assert.That(r1a.Elevation1NE,Is.EqualTo(elev1ne), "Assert.That(r1a.Elevation1NE,Is.EqualTo(elev1ne))"); | ||
874 | Assert.That(r1a.Elevation2NE,Is.EqualTo(elev2ne), "Assert.That(r1a.Elevation2NE,Is.EqualTo(elev2ne))"); | ||
875 | Assert.That(r1a.Elevation1SE,Is.EqualTo(elev1se), "Assert.That(r1a.Elevation1SE,Is.EqualTo(elev1se))"); | ||
876 | Assert.That(r1a.Elevation2SE,Is.EqualTo(elev2se), "Assert.That(r1a.Elevation2SE,Is.EqualTo(elev2se))"); | ||
877 | Assert.That(r1a.Elevation1SW,Is.EqualTo(elev1sw), "Assert.That(r1a.Elevation1SW,Is.EqualTo(elev1sw))"); | ||
878 | Assert.That(r1a.Elevation2SW,Is.EqualTo(elev2sw), "Assert.That(r1a.Elevation2SW,Is.EqualTo(elev2sw))"); | ||
879 | Assert.That(r1a.WaterHeight,Is.EqualTo(waterh), "Assert.That(r1a.WaterHeight,Is.EqualTo(waterh))"); | ||
880 | Assert.That(r1a.TerrainRaiseLimit,Is.EqualTo(terrainraise), "Assert.That(r1a.TerrainRaiseLimit,Is.EqualTo(terrainraise))"); | ||
881 | Assert.That(r1a.TerrainLowerLimit,Is.EqualTo(terrainlower), "Assert.That(r1a.TerrainLowerLimit,Is.EqualTo(terrainlower))"); | ||
882 | Assert.That(r1a.UseEstateSun,Is.False); | ||
883 | Assert.That(r1a.Sandbox,Is.True); | ||
884 | Assert.That(r1a.SunVector,Is.EqualTo(sunvector), "Assert.That(r1a.SunVector,Is.EqualTo(sunvector))"); | ||
885 | //Assert.That(r1a.TerrainImageID,Is.EqualTo(terimgid), "Assert.That(r1a.TerrainImageID,Is.EqualTo(terimgid))"); | ||
886 | Assert.That(r1a.FixedSun,Is.True); | ||
887 | Assert.That(r1a.SunPosition, Is.EqualTo(sunpos), "Assert.That(r1a.SunPosition, Is.EqualTo(sunpos))"); | ||
888 | Assert.That(r1a.Covenant, Is.EqualTo(cov), "Assert.That(r1a.Covenant, Is.EqualTo(cov))"); | ||
889 | |||
890 | } | ||
891 | |||
892 | [Test] | ||
893 | public void T300_NoTerrain() | ||
894 | { | ||
895 | Assert.That(db.LoadTerrain(zero), Is.Null); | ||
896 | Assert.That(db.LoadTerrain(region1), Is.Null); | ||
897 | Assert.That(db.LoadTerrain(region2), Is.Null); | ||
898 | Assert.That(db.LoadTerrain(UUID.Random()), Is.Null); | ||
899 | } | ||
900 | |||
901 | [Test] | ||
902 | public void T301_CreateTerrain() | ||
903 | { | ||
904 | double[,] t1 = GenTerrain(height1); | ||
905 | db.StoreTerrain(t1, region1); | ||
906 | |||
907 | Assert.That(db.LoadTerrain(zero), Is.Null); | ||
908 | Assert.That(db.LoadTerrain(region1), Is.Not.Null); | ||
909 | Assert.That(db.LoadTerrain(region2), Is.Null); | ||
910 | Assert.That(db.LoadTerrain(UUID.Random()), Is.Null); | ||
911 | } | ||
912 | |||
913 | [Test] | ||
914 | public void T302_FetchTerrain() | ||
915 | { | ||
916 | double[,] baseterrain1 = GenTerrain(height1); | ||
917 | double[,] baseterrain2 = GenTerrain(height2); | ||
918 | double[,] t1 = db.LoadTerrain(region1); | ||
919 | Assert.That(CompareTerrain(t1, baseterrain1), Is.True); | ||
920 | Assert.That(CompareTerrain(t1, baseterrain2), Is.False); | ||
921 | } | ||
922 | |||
923 | [Test] | ||
924 | public void T303_UpdateTerrain() | ||
925 | { | ||
926 | double[,] baseterrain1 = GenTerrain(height1); | ||
927 | double[,] baseterrain2 = GenTerrain(height2); | ||
928 | db.StoreTerrain(baseterrain2, region1); | ||
929 | |||
930 | double[,] t1 = db.LoadTerrain(region1); | ||
931 | Assert.That(CompareTerrain(t1, baseterrain1), Is.False); | ||
932 | Assert.That(CompareTerrain(t1, baseterrain2), Is.True); | ||
933 | } | ||
934 | |||
935 | [Test] | ||
936 | public void T400_EmptyLand() | ||
937 | { | ||
938 | Assert.That(db.LoadLandObjects(zero).Count, Is.EqualTo(0), "Assert.That(db.LoadLandObjects(zero).Count, Is.EqualTo(0))"); | ||
939 | Assert.That(db.LoadLandObjects(region1).Count, Is.EqualTo(0), "Assert.That(db.LoadLandObjects(region1).Count, Is.EqualTo(0))"); | ||
940 | Assert.That(db.LoadLandObjects(region2).Count, Is.EqualTo(0), "Assert.That(db.LoadLandObjects(region2).Count, Is.EqualTo(0))"); | ||
941 | Assert.That(db.LoadLandObjects(UUID.Random()).Count, Is.EqualTo(0), "Assert.That(db.LoadLandObjects(UUID.Random()).Count, Is.EqualTo(0))"); | ||
942 | } | ||
943 | |||
944 | // TODO: we should have real land tests, but Land is so | ||
945 | // intermingled with scene that you can't test it without a | ||
946 | // valid scene. That requires some disagregation. | ||
947 | |||
948 | |||
949 | //************************************************************************************// | ||
950 | // Extra private methods | ||
951 | |||
952 | private double[,] GenTerrain(double value) | ||
953 | { | ||
954 | double[,] terret = new double[Constants.RegionSize, Constants.RegionSize]; | ||
955 | terret.Initialize(); | ||
956 | for (int x = 0; x < Constants.RegionSize; x++) | ||
957 | for (int y = 0; y < Constants.RegionSize; y++) | ||
958 | terret[x,y] = value; | ||
959 | |||
960 | return terret; | ||
961 | } | ||
962 | |||
963 | private bool CompareTerrain(double[,] one, double[,] two) | ||
964 | { | ||
965 | for (int x = 0; x < Constants.RegionSize; x++) | ||
966 | for (int y = 0; y < Constants.RegionSize; y++) | ||
967 | if (one[x,y] != two[x,y]) | ||
968 | return false; | ||
969 | |||
970 | return true; | ||
971 | } | ||
972 | |||
973 | |||
974 | private SceneObjectGroup FindSOG(string name, UUID r) | ||
975 | { | ||
976 | List<SceneObjectGroup> objs = db.LoadObjects(r); | ||
977 | foreach (SceneObjectGroup sog in objs) | ||
978 | { | ||
979 | SceneObjectPart p = sog.RootPart; | ||
980 | if (p.Name == name) { | ||
981 | RegionInfo regionInfo = new RegionInfo(); | ||
982 | regionInfo.RegionID = r; | ||
983 | regionInfo.RegionLocX = 0; | ||
984 | regionInfo.RegionLocY = 0; | ||
985 | |||
986 | Scene scene = new Scene(regionInfo); | ||
987 | sog.SetScene(scene); | ||
988 | |||
989 | return sog; | ||
990 | } | ||
991 | } | ||
992 | |||
993 | return null; | ||
994 | } | ||
995 | |||
996 | // This builds a minimalistic Prim, 1 SOG with 1 root SOP. A | ||
997 | // common failure case is people adding new fields that aren't | ||
998 | // initialized, but have non-null db constraints. We should | ||
999 | // honestly be passing more and more null things in here. | ||
1000 | // | ||
1001 | // Please note that in Sqlite.BuildPrim there is a commented out inline version | ||
1002 | // of this so you can debug and step through the build process and check the fields | ||
1003 | // | ||
1004 | // Real World Value: Tests for situation where extending a SceneObjectGroup/SceneObjectPart | ||
1005 | // causes the application to crash at the database layer because of null values | ||
1006 | // in NOT NULL fields | ||
1007 | // | ||
1008 | private SceneObjectGroup NewSOG(string name, UUID uuid, UUID regionId) | ||
1009 | { | ||
1010 | RegionInfo regionInfo = new RegionInfo(); | ||
1011 | regionInfo.RegionID = regionId; | ||
1012 | regionInfo.RegionLocX = 0; | ||
1013 | regionInfo.RegionLocY = 0; | ||
1014 | |||
1015 | Scene scene = new Scene(regionInfo); | ||
1016 | |||
1017 | SceneObjectPart sop = new SceneObjectPart(); | ||
1018 | sop.Name = name; | ||
1019 | sop.Description = name; | ||
1020 | sop.Text = RandomName(); | ||
1021 | sop.SitName = RandomName(); | ||
1022 | sop.TouchName = RandomName(); | ||
1023 | sop.UUID = uuid; | ||
1024 | sop.Shape = PrimitiveBaseShape.Default; | ||
1025 | |||
1026 | SceneObjectGroup sog = new SceneObjectGroup(sop); | ||
1027 | sog.SetScene(scene); | ||
1028 | |||
1029 | return sog; | ||
1030 | } | ||
1031 | |||
1032 | private SceneObjectPart NewSOP(string name, UUID uuid) | ||
1033 | { | ||
1034 | SceneObjectPart sop = new SceneObjectPart(); | ||
1035 | sop.Name = name; | ||
1036 | sop.Description = name; | ||
1037 | sop.Text = RandomName(); | ||
1038 | sop.SitName = RandomName(); | ||
1039 | sop.TouchName = RandomName(); | ||
1040 | sop.UUID = uuid; | ||
1041 | sop.Shape = PrimitiveBaseShape.Default; | ||
1042 | return sop; | ||
1043 | } | ||
1044 | |||
1045 | // These are copied from the Inventory Item tests | ||
1046 | |||
1047 | private InventoryItemBase NewItem(UUID id, UUID parent, UUID owner, string name, UUID asset) | ||
1048 | { | ||
1049 | InventoryItemBase i = new InventoryItemBase(); | ||
1050 | i.ID = id; | ||
1051 | i.Folder = parent; | ||
1052 | i.Owner = owner; | ||
1053 | i.CreatorId = owner.ToString(); | ||
1054 | i.Name = name; | ||
1055 | i.Description = name; | ||
1056 | i.AssetID = asset; | ||
1057 | return i; | ||
1058 | } | ||
1059 | |||
1060 | private static string RandomName() | ||
1061 | { | ||
1062 | StringBuilder name = new StringBuilder(); | ||
1063 | int size = random.Next(5,12); | ||
1064 | char ch ; | ||
1065 | for (int i=0; i<size; i++) | ||
1066 | { | ||
1067 | ch = Convert.ToChar(Convert.ToInt32(Math.Floor(26 * random.NextDouble() + 65))) ; | ||
1068 | name.Append(ch); | ||
1069 | } | ||
1070 | return name.ToString(); | ||
1071 | } | ||
1072 | // private InventoryFolderBase NewFolder(UUID id, UUID parent, UUID owner, string name) | ||
1073 | // { | ||
1074 | // InventoryFolderBase f = new InventoryFolderBase(); | ||
1075 | // f.ID = id; | ||
1076 | // f.ParentID = parent; | ||
1077 | // f.Owner = owner; | ||
1078 | // f.Name = name; | ||
1079 | // return f; | ||
1080 | // } | ||
1081 | } | ||
1082 | } | ||