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