diff options
author | Sean Dague | 2008-10-30 12:56:04 +0000 |
---|---|---|
committer | Sean Dague | 2008-10-30 12:56:04 +0000 |
commit | 409e7262df255649de687eec828d9ef476edc03b (patch) | |
tree | ff631ba12d6eb899abff42ade2c56244485c1a5a | |
parent | - Inserted code coverage monocov. To run do nant test-cov. (diff) | |
download | opensim-SC-409e7262df255649de687eec828d9ef476edc03b.zip opensim-SC-409e7262df255649de687eec828d9ef476edc03b.tar.gz opensim-SC-409e7262df255649de687eec828d9ef476edc03b.tar.bz2 opensim-SC-409e7262df255649de687eec828d9ef476edc03b.tar.xz |
Mid-work, trying to fix region part insertion and retrieval
SQLite reports System NUll Reference, but works, inside
LoadItems, on SQLiteRegionData.cs
From: Arthur Rodrigo S Valadares <arthursv@linux.vnet.ibm.com>
-rw-r--r-- | .gitignore | 2 | ||||
-rw-r--r-- | OpenSim/Data/MySQL/MySQLRegionData.cs | 36 | ||||
-rw-r--r-- | OpenSim/Data/SQLite/SQLiteRegionData.cs | 42 | ||||
-rw-r--r-- | OpenSim/Data/Tests/BasicRegionTest.cs | 324 | ||||
-rw-r--r-- | prebuild.xml | 2 |
5 files changed, 382 insertions, 24 deletions
@@ -31,4 +31,6 @@ bin/Physics* | |||
31 | bin/Terrain* | 31 | bin/Terrain* |
32 | bin/estate_settings.xml | 32 | bin/estate_settings.xml |
33 | cov/* | 33 | cov/* |
34 | OpenSim/OpenSim.userprefs | ||
35 | OpenSim/OpenSim.usertasks | ||
34 | *~ | 36 | *~ |
diff --git a/OpenSim/Data/MySQL/MySQLRegionData.cs b/OpenSim/Data/MySQL/MySQLRegionData.cs index ab7e92d..fb08049 100644 --- a/OpenSim/Data/MySQL/MySQLRegionData.cs +++ b/OpenSim/Data/MySQL/MySQLRegionData.cs | |||
@@ -395,7 +395,8 @@ namespace OpenSim.Data.MySQL | |||
395 | DataRow[] primsForRegion = prims.Select(byRegion, orderByParent); | 395 | DataRow[] primsForRegion = prims.Select(byRegion, orderByParent); |
396 | m_log.Info("[REGION DB]: " + | 396 | m_log.Info("[REGION DB]: " + |
397 | "Loaded " + primsForRegion.Length + " prims for region: " + regionUUID); | 397 | "Loaded " + primsForRegion.Length + " prims for region: " + regionUUID); |
398 | 398 | ||
399 | // First, create all groups | ||
399 | foreach (DataRow primRow in primsForRegion) | 400 | foreach (DataRow primRow in primsForRegion) |
400 | { | 401 | { |
401 | try | 402 | try |
@@ -422,11 +423,33 @@ namespace OpenSim.Data.MySQL | |||
422 | } | 423 | } |
423 | group.AddPart(prim); | 424 | group.AddPart(prim); |
424 | group.RootPart = prim; | 425 | group.RootPart = prim; |
425 | |||
426 | createdObjects.Add(group.UUID, group); | 426 | createdObjects.Add(group.UUID, group); |
427 | retvals.Add(group); | 427 | retvals.Add(group); |
428 | } | 428 | } |
429 | else | 429 | LoadItems(prim); |
430 | } | ||
431 | catch (Exception e) | ||
432 | { | ||
433 | m_log.Error("[REGION DB]: Failed create prim object, exception and data follows"); | ||
434 | m_log.Info("[REGION DB]: " + e.ToString()); | ||
435 | foreach (DataColumn col in prims.Columns) | ||
436 | { | ||
437 | m_log.Info("[REGION DB]: Col: " + col.ColumnName + " => " + primRow[col]); | ||
438 | } | ||
439 | } | ||
440 | } | ||
441 | |||
442 | // Now fill the groups with part data | ||
443 | foreach (DataRow primRow in primsForRegion) | ||
444 | { | ||
445 | try | ||
446 | { | ||
447 | string uuid = (string) primRow["UUID"]; | ||
448 | string objID = (string) primRow["SceneGroupID"]; | ||
449 | |||
450 | SceneObjectPart prim = buildPrim(primRow); | ||
451 | |||
452 | if (uuid != objID) //is new SceneObjectGroup ? | ||
430 | { | 453 | { |
431 | DataRow shapeRow = shapes.Rows.Find(Util.ToRawUuidString(prim.UUID)); | 454 | DataRow shapeRow = shapes.Rows.Find(Util.ToRawUuidString(prim.UUID)); |
432 | if (shapeRow != null) | 455 | if (shapeRow != null) |
@@ -441,9 +464,8 @@ namespace OpenSim.Data.MySQL | |||
441 | } | 464 | } |
442 | createdObjects[new UUID(objID)].AddPart(prim); | 465 | createdObjects[new UUID(objID)].AddPart(prim); |
443 | } | 466 | } |
444 | 467 | LoadItems(prim); | |
445 | LoadItems(prim); | 468 | } |
446 | } | ||
447 | catch (Exception e) | 469 | catch (Exception e) |
448 | { | 470 | { |
449 | m_log.Error("[REGION DB]: Failed create prim object, exception and data follows"); | 471 | m_log.Error("[REGION DB]: Failed create prim object, exception and data follows"); |
@@ -473,7 +495,7 @@ namespace OpenSim.Data.MySQL | |||
473 | 495 | ||
474 | String sql = String.Format("primID = '{0}'", prim.UUID.ToString()); | 496 | String sql = String.Format("primID = '{0}'", prim.UUID.ToString()); |
475 | DataRow[] dbItemRows = dbItems.Select(sql); | 497 | DataRow[] dbItemRows = dbItems.Select(sql); |
476 | 498 | Console.WriteLine("dbItemRows MYSQL Length: {0}",dbItemRows.Length); | |
477 | IList<TaskInventoryItem> inventory = new List<TaskInventoryItem>(); | 499 | IList<TaskInventoryItem> inventory = new List<TaskInventoryItem>(); |
478 | 500 | ||
479 | foreach (DataRow row in dbItemRows) | 501 | foreach (DataRow row in dbItemRows) |
diff --git a/OpenSim/Data/SQLite/SQLiteRegionData.cs b/OpenSim/Data/SQLite/SQLiteRegionData.cs index 812367d..9ddab55 100644 --- a/OpenSim/Data/SQLite/SQLiteRegionData.cs +++ b/OpenSim/Data/SQLite/SQLiteRegionData.cs | |||
@@ -412,7 +412,7 @@ namespace OpenSim.Data.SQLite | |||
412 | DataRow[] primsForRegion = prims.Select(byRegion, orderByParent); | 412 | DataRow[] primsForRegion = prims.Select(byRegion, orderByParent); |
413 | m_log.Info("[REGION DB]: " + | 413 | m_log.Info("[REGION DB]: " + |
414 | "Loaded " + primsForRegion.Length + " prims for region: " + regionUUID); | 414 | "Loaded " + primsForRegion.Length + " prims for region: " + regionUUID); |
415 | 415 | // First, create all groups | |
416 | foreach (DataRow primRow in primsForRegion) | 416 | foreach (DataRow primRow in primsForRegion) |
417 | { | 417 | { |
418 | try | 418 | try |
@@ -438,11 +438,32 @@ namespace OpenSim.Data.SQLite | |||
438 | } | 438 | } |
439 | group.AddPart(prim); | 439 | group.AddPart(prim); |
440 | group.RootPart = prim; | 440 | group.RootPart = prim; |
441 | 441 | Console.WriteLine("The Object UUID is {0}",prim.UUID); | |
442 | createdObjects.Add(group.UUID, group); | 442 | createdObjects.Add(group.UUID, group); |
443 | retvals.Add(group); | 443 | retvals.Add(group); |
444 | } | 444 | } |
445 | else | 445 | LoadItems(prim); |
446 | } | ||
447 | catch (Exception e) | ||
448 | { | ||
449 | m_log.Error("[REGION DB]: Failed create prim object in new group, exception and data follows"); | ||
450 | m_log.Info("[REGION DB]: " + e.ToString()); | ||
451 | foreach (DataColumn col in prims.Columns) | ||
452 | { | ||
453 | m_log.Info("[REGION DB]: Col: " + col.ColumnName + " => " + primRow[col]); | ||
454 | } | ||
455 | } | ||
456 | } | ||
457 | // Now fill the groups with part data | ||
458 | foreach (DataRow primRow in primsForRegion) | ||
459 | { | ||
460 | try | ||
461 | { | ||
462 | SceneObjectPart prim = null; | ||
463 | |||
464 | string uuid = (string) primRow["UUID"]; | ||
465 | string objID = (string) primRow["SceneGroupID"]; | ||
466 | if (uuid != objID) //is new SceneObjectGroup ? | ||
446 | { | 467 | { |
447 | prim = buildPrim(primRow); | 468 | prim = buildPrim(primRow); |
448 | DataRow shapeRow = shapes.Rows.Find(Util.ToRawUuidString(prim.UUID)); | 469 | DataRow shapeRow = shapes.Rows.Find(Util.ToRawUuidString(prim.UUID)); |
@@ -456,14 +477,14 @@ namespace OpenSim.Data.SQLite | |||
456 | "[REGION DB]: No shape found for prim in storage, so setting default box shape"); | 477 | "[REGION DB]: No shape found for prim in storage, so setting default box shape"); |
457 | prim.Shape = PrimitiveBaseShape.Default; | 478 | prim.Shape = PrimitiveBaseShape.Default; |
458 | } | 479 | } |
480 | Console.WriteLine("Version2: The Object UUID is {0}",prim.UUID); | ||
459 | createdObjects[new UUID(objID)].AddPart(prim); | 481 | createdObjects[new UUID(objID)].AddPart(prim); |
460 | } | 482 | } |
461 | |||
462 | LoadItems(prim); | 483 | LoadItems(prim); |
463 | } | 484 | } |
464 | catch (Exception e) | 485 | catch (Exception e) |
465 | { | 486 | { |
466 | m_log.Error("[REGION DB]: Failed create prim object, exception and data follows"); | 487 | m_log.Error("[REGION DB]: Failed create prim object in group, exception and data follows"); |
467 | m_log.Info("[REGION DB]: " + e.ToString()); | 488 | m_log.Info("[REGION DB]: " + e.ToString()); |
468 | foreach (DataColumn col in prims.Columns) | 489 | foreach (DataColumn col in prims.Columns) |
469 | { | 490 | { |
@@ -482,16 +503,21 @@ namespace OpenSim.Data.SQLite | |||
482 | private void LoadItems(SceneObjectPart prim) | 503 | private void LoadItems(SceneObjectPart prim) |
483 | { | 504 | { |
484 | //m_log.DebugFormat("[DATASTORE]: Loading inventory for {0}, {1}", prim.Name, prim.UUID); | 505 | //m_log.DebugFormat("[DATASTORE]: Loading inventory for {0}, {1}", prim.Name, prim.UUID); |
485 | 506 | ||
486 | DataTable dbItems = ds.Tables["primitems"]; | 507 | DataTable dbItems = ds.Tables["primitems"]; |
487 | 508 | //return; POINT OF FAILURE!!! BELOW THIS LINE FAILS | |
509 | Console.WriteLine("dbItems: {0} and the prim is: {1}, UUID {2}",dbItems,prim.Name,prim.UUID); | ||
488 | String sql = String.Format("primID = '{0}'", prim.UUID.ToString()); | 510 | String sql = String.Format("primID = '{0}'", prim.UUID.ToString()); |
511 | //string sql = "primID = '" + prim.UUID.ToString() + "'"; | ||
489 | DataRow[] dbItemRows = dbItems.Select(sql); | 512 | DataRow[] dbItemRows = dbItems.Select(sql); |
490 | 513 | Console.WriteLine("dbItemRows Length: {0}",dbItemRows.Length); | |
514 | if (dbItemRows.Length == 0) | ||
515 | return; | ||
491 | IList<TaskInventoryItem> inventory = new List<TaskInventoryItem>(); | 516 | IList<TaskInventoryItem> inventory = new List<TaskInventoryItem>(); |
492 | 517 | ||
493 | foreach (DataRow row in dbItemRows) | 518 | foreach (DataRow row in dbItemRows) |
494 | { | 519 | { |
520 | Console.WriteLine("Inside the foreach"); | ||
495 | TaskInventoryItem item = buildItem(row); | 521 | TaskInventoryItem item = buildItem(row); |
496 | inventory.Add(item); | 522 | inventory.Add(item); |
497 | 523 | ||
diff --git a/OpenSim/Data/Tests/BasicRegionTest.cs b/OpenSim/Data/Tests/BasicRegionTest.cs index 9a73cc2..d09b458 100644 --- a/OpenSim/Data/Tests/BasicRegionTest.cs +++ b/OpenSim/Data/Tests/BasicRegionTest.cs | |||
@@ -27,6 +27,8 @@ | |||
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Drawing; | ||
31 | using System.Text; | ||
30 | using NUnit.Framework; | 32 | using NUnit.Framework; |
31 | using NUnit.Framework.SyntaxHelpers; | 33 | using NUnit.Framework.SyntaxHelpers; |
32 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
@@ -44,15 +46,24 @@ namespace OpenSim.Data.Tests | |||
44 | public UUID zero = UUID.Zero; | 46 | public UUID zero = UUID.Zero; |
45 | public UUID region1; | 47 | public UUID region1; |
46 | public UUID region2; | 48 | public UUID region2; |
49 | public UUID region3; | ||
50 | public UUID region4; | ||
47 | public UUID prim1; | 51 | public UUID prim1; |
48 | public UUID prim2; | 52 | public UUID prim2; |
49 | public UUID prim3; | 53 | public UUID prim3; |
54 | public UUID prim4; | ||
55 | public UUID prim5; | ||
56 | public UUID prim6; | ||
50 | public UUID item1; | 57 | public UUID item1; |
51 | public UUID item2; | 58 | public UUID item2; |
52 | public UUID item3; | 59 | public UUID item3; |
53 | 60 | ||
61 | public static Random random; | ||
62 | |||
54 | public string itemname1 = "item1"; | 63 | public string itemname1 = "item1"; |
55 | 64 | ||
65 | public uint localID; | ||
66 | |||
56 | public double height1; | 67 | public double height1; |
57 | public double height2; | 68 | public double height2; |
58 | 69 | ||
@@ -68,12 +79,19 @@ namespace OpenSim.Data.Tests | |||
68 | } | 79 | } |
69 | 80 | ||
70 | region1 = UUID.Random(); | 81 | region1 = UUID.Random(); |
82 | region3 = UUID.Random(); | ||
83 | region4 = UUID.Random(); | ||
71 | prim1 = UUID.Random(); | 84 | prim1 = UUID.Random(); |
72 | prim2 = UUID.Random(); | 85 | prim2 = UUID.Random(); |
73 | prim3 = UUID.Random(); | 86 | prim3 = UUID.Random(); |
87 | prim4 = UUID.Random(); | ||
88 | prim5 = UUID.Random(); | ||
89 | prim6 = UUID.Random(); | ||
74 | item1 = UUID.Random(); | 90 | item1 = UUID.Random(); |
75 | item2 = UUID.Random(); | 91 | item2 = UUID.Random(); |
76 | item3 = UUID.Random(); | 92 | item3 = UUID.Random(); |
93 | random = new Random(); | ||
94 | localID = 1; | ||
77 | height1 = 20; | 95 | height1 = 20; |
78 | height2 = 100; | 96 | height2 = 100; |
79 | } | 97 | } |
@@ -82,18 +100,22 @@ namespace OpenSim.Data.Tests | |||
82 | // Prims | 100 | // Prims |
83 | // - empty test - 001 | 101 | // - empty test - 001 |
84 | // - store / retrieve basic prims (most minimal we can make) - 010, 011 | 102 | // - store / retrieve basic prims (most minimal we can make) - 010, 011 |
85 | // - update existing prims, make sure it sticks - 012 | 103 | // - store / retrieve parts in a scenegroup 012 |
86 | // - add inventory items to prims make - 013 | 104 | // - store a prim with complete information for consistency check 013 |
87 | // - remove inventory items make sure it sticks - 014 | 105 | // - update existing prims, make sure it sticks - 014 |
106 | // - add inventory items to prims make - 015 | ||
107 | // - remove inventory items make sure it sticks - 016 | ||
88 | // - remove prim, make sure it sticks - 020 | 108 | // - remove prim, make sure it sticks - 020 |
89 | 109 | ||
90 | [Test] | 110 | [Test] |
91 | public void T001_LoadEmpty() | 111 | public void T001_LoadEmpty() |
92 | { | 112 | { |
93 | List<SceneObjectGroup> objs = db.LoadObjects(region1); | 113 | List<SceneObjectGroup> objs = db.LoadObjects(region1); |
114 | List<SceneObjectGroup> objs3 = db.LoadObjects(region3); | ||
94 | List<LandData> land = db.LoadLandObjects(region1); | 115 | List<LandData> land = db.LoadLandObjects(region1); |
95 | 116 | ||
96 | Assert.That(objs.Count, Is.EqualTo(0)); | 117 | Assert.That(objs.Count, Is.EqualTo(0)); |
118 | Assert.That(objs3.Count, Is.EqualTo(0)); | ||
97 | Assert.That(land.Count, Is.EqualTo(0)); | 119 | Assert.That(land.Count, Is.EqualTo(0)); |
98 | } | 120 | } |
99 | 121 | ||
@@ -145,9 +167,262 @@ namespace OpenSim.Data.Tests | |||
145 | Assert.That(p.Name, Is.EqualTo(p.Description)); | 167 | Assert.That(p.Name, Is.EqualTo(p.Description)); |
146 | } | 168 | } |
147 | } | 169 | } |
148 | 170 | ||
171 | [Test] | ||
172 | public void T012_SceneParts() | ||
173 | { | ||
174 | UUID tmp0 = UUID.Random(); | ||
175 | UUID tmp1 = UUID.Random(); | ||
176 | UUID tmp2 = UUID.Random(); | ||
177 | UUID tmp3 = UUID.Random(); | ||
178 | UUID newregion = UUID.Random(); | ||
179 | SceneObjectPart p1 = NewSOP("SoP 1",tmp1); | ||
180 | SceneObjectPart p2 = NewSOP("SoP 2",tmp2); | ||
181 | SceneObjectPart p3 = NewSOP("SoP 3",tmp3); | ||
182 | SceneObjectGroup sog = NewSOG("Sop 0",tmp0); | ||
183 | sog.AddPart(p1); | ||
184 | sog.AddPart(p2); | ||
185 | sog.AddPart(p3); | ||
186 | |||
187 | Console.WriteLine("Test 10 has prims {0} and {1} in region {2}",prim1,prim2,region1); | ||
188 | Console.WriteLine("The prims are {0}, {1}, {2} and {3} and region is {4}",tmp0,tmp1,tmp2,tmp3,newregion); | ||
189 | SceneObjectPart[] parts = sog.GetParts(); | ||
190 | Console.WriteLine("Before Insertion:"); | ||
191 | Assert.That(parts.Length,Is.EqualTo(4)); | ||
192 | Console.WriteLine("PASSED BEFORE"); | ||
193 | |||
194 | db.StoreObject(sog, newregion); | ||
195 | List<SceneObjectGroup> sogs = db.LoadObjects(newregion); | ||
196 | Assert.That(sogs.Count,Is.EqualTo(1)); | ||
197 | SceneObjectGroup newsog = sogs[0]; | ||
198 | |||
199 | SceneObjectPart[] newparts = newsog.GetParts(); | ||
200 | Console.WriteLine("After Insertion:"); | ||
201 | Assert.That(newparts.Length,Is.EqualTo(4)); | ||
202 | Console.WriteLine("PASSED AFTER!"); | ||
203 | |||
204 | Assert.That(newsog.HasChildPrim(tmp0)); | ||
205 | Assert.That(newsog.HasChildPrim(tmp1)); | ||
206 | Assert.That(newsog.HasChildPrim(tmp2)); | ||
207 | Assert.That(newsog.HasChildPrim(tmp3)); | ||
208 | } | ||
209 | |||
210 | [Test] | ||
211 | [Ignore("Make sure 12 works first")] | ||
212 | public void T013_ObjectConsistency() | ||
213 | { | ||
214 | UUID creator,uuid = new UUID(); | ||
215 | creator = UUID.Random(); | ||
216 | uint iserial = (uint) random.Next(); | ||
217 | TaskInventoryDictionary dic = new TaskInventoryDictionary(); | ||
218 | uint objf = (uint) random.Next(); | ||
219 | uuid = prim4; | ||
220 | uint localid = localID+1; | ||
221 | localID = localID + 1; | ||
222 | string name = "Adam West"; | ||
223 | byte material = (byte) random.Next(255); | ||
224 | ulong regionh = (ulong)random.NextDouble() * (ulong)random.Next(); | ||
225 | int pin = random.Next(); | ||
226 | Byte[] partsys = new byte[8]; | ||
227 | Byte[] textani = new byte[8]; | ||
228 | random.NextBytes(textani); | ||
229 | random.NextBytes(partsys); | ||
230 | DateTime expires = new DateTime(2008, 12, 20); | ||
231 | DateTime rezzed = new DateTime(2009, 07, 15); | ||
232 | Vector3 groupos = new Vector3(random.Next(),random.Next(),random.Next()); | ||
233 | Vector3 offset = new Vector3(random.Next(),random.Next(),random.Next()); | ||
234 | Quaternion rotoff = new Quaternion(random.Next(),random.Next(),random.Next(),random.Next()); | ||
235 | Vector3 velocity = new Vector3(random.Next(),random.Next(),random.Next()); | ||
236 | Vector3 angvelo = new Vector3(random.Next(),random.Next(),random.Next()); | ||
237 | Vector3 accel = new Vector3(random.Next(),random.Next(),random.Next()); | ||
238 | string description = name; | ||
239 | //Color color = Color.Brown; | ||
240 | Color color = Color.FromArgb(255, 165, 42, 42); | ||
241 | string text = "All Your Base Are Belong to Us"; | ||
242 | string sitname = "SitName"; | ||
243 | string touchname = "TouchName"; | ||
244 | int linknum = random.Next(); | ||
245 | byte clickaction = (byte) random.Next(255); | ||
246 | PrimitiveBaseShape pbshap = new PrimitiveBaseShape(); | ||
247 | pbshap = PrimitiveBaseShape.Default; | ||
248 | Vector3 scale = new Vector3(random.Next(),random.Next(),random.Next()); | ||
249 | byte updatef = (byte) random.Next(255); | ||
250 | |||
251 | SceneObjectPart sop = new SceneObjectPart(); | ||
252 | sop.RegionHandle = regionh; | ||
253 | sop.UUID = uuid; | ||
254 | sop.LocalId = localid; | ||
255 | sop.Shape = pbshap; | ||
256 | sop.GroupPosition = groupos; | ||
257 | sop.RotationOffset = rotoff; | ||
258 | sop.CreatorID = creator; | ||
259 | sop.InventorySerial = iserial; | ||
260 | sop.TaskInventory = dic; | ||
261 | sop.ObjectFlags = objf; | ||
262 | sop.Name = name; | ||
263 | sop.Material = material; | ||
264 | sop.ScriptAccessPin = pin; | ||
265 | sop.TextureAnimation = textani; | ||
266 | sop.ParticleSystem = partsys; | ||
267 | sop.Expires = expires; | ||
268 | sop.Rezzed = rezzed; | ||
269 | sop.OffsetPosition = offset; | ||
270 | sop.Velocity = velocity; | ||
271 | sop.AngularVelocity = angvelo; | ||
272 | sop.Acceleration = accel; | ||
273 | sop.Description = description; | ||
274 | sop.Color = color; | ||
275 | sop.Text = text; | ||
276 | sop.SitName = sitname; | ||
277 | sop.TouchName = touchname; | ||
278 | sop.LinkNum = linknum; | ||
279 | sop.ClickAction = clickaction; | ||
280 | sop.Scale = scale; | ||
281 | sop.UpdateFlag = updatef; | ||
282 | |||
283 | //Tests if local part accepted the parameters: | ||
284 | Console.WriteLine("Test -0"); | ||
285 | Assert.That(regionh,Is.EqualTo(sop.RegionHandle)); | ||
286 | Console.WriteLine("Test -1 localid é: {0} e LocalId é {1}",localid,sop.LocalId); | ||
287 | Assert.That(localid,Is.EqualTo(sop.LocalId)); | ||
288 | Console.WriteLine("Test -2"); | ||
289 | //**Assert.That(pbshap,Is.EqualTo(sop.Shape)); | ||
290 | Assert.That(groupos,Is.EqualTo(sop.GroupPosition)); | ||
291 | Console.WriteLine("Test -3"); | ||
292 | Assert.That(name,Is.EqualTo(sop.Name)); | ||
293 | Console.WriteLine("Test -4"); | ||
294 | Assert.That(rotoff,Is.EqualTo(sop.RotationOffset)); | ||
295 | Console.WriteLine("Test 0 - uuid is {0}",uuid); | ||
296 | Assert.That(uuid,Is.EqualTo(sop.UUID)); | ||
297 | Console.WriteLine("Test 1"); | ||
298 | Assert.That(creator,Is.EqualTo(sop.CreatorID)); | ||
299 | Console.WriteLine("Test 2 - iserial is {0}",iserial); | ||
300 | Assert.That(iserial,Is.EqualTo(sop.InventorySerial)); | ||
301 | Console.WriteLine("Test 3"); | ||
302 | Assert.That(dic,Is.EqualTo(sop.TaskInventory)); | ||
303 | Console.WriteLine("Test 4"); | ||
304 | Assert.That(objf,Is.EqualTo(sop.ObjectFlags)); | ||
305 | Console.WriteLine("Test 5"); | ||
306 | Assert.That(name,Is.EqualTo(sop.Name)); | ||
307 | Console.WriteLine("Test 6"); | ||
308 | Assert.That(material,Is.EqualTo(sop.Material)); | ||
309 | Console.WriteLine("Test 7"); | ||
310 | Assert.That(pin,Is.EqualTo(sop.ScriptAccessPin)); | ||
311 | Console.WriteLine("Test 8"); | ||
312 | Assert.That(textani,Is.EqualTo(sop.TextureAnimation)); | ||
313 | Console.WriteLine("Test 9"); | ||
314 | Assert.That(partsys,Is.EqualTo(sop.ParticleSystem)); | ||
315 | Console.WriteLine("Test 9.1"); | ||
316 | Assert.That(expires,Is.EqualTo(sop.Expires)); | ||
317 | Console.WriteLine("Test 9.2"); | ||
318 | Assert.That(rezzed,Is.EqualTo(sop.Rezzed)); | ||
319 | Console.WriteLine("Test 10"); | ||
320 | Assert.That(offset,Is.EqualTo(sop.OffsetPosition)); | ||
321 | Assert.That(velocity,Is.EqualTo(sop.Velocity)); | ||
322 | Console.WriteLine("Test 12"); | ||
323 | Assert.That(angvelo,Is.EqualTo(sop.AngularVelocity)); | ||
324 | Console.WriteLine("Test 13"); | ||
325 | Assert.That(accel,Is.EqualTo(sop.Acceleration)); | ||
326 | Console.WriteLine("Test 14"); | ||
327 | Assert.That(description,Is.EqualTo(sop.Description)); | ||
328 | Assert.That(color,Is.EqualTo(sop.Color)); | ||
329 | Assert.That(text,Is.EqualTo(sop.Text)); | ||
330 | Assert.That(sitname,Is.EqualTo(sop.SitName)); | ||
331 | Console.WriteLine("Test 15"); | ||
332 | Assert.That(touchname,Is.EqualTo(sop.TouchName)); | ||
333 | Console.WriteLine("Test 16"); | ||
334 | Assert.That(linknum,Is.EqualTo(sop.LinkNum)); | ||
335 | Console.WriteLine("Test 17"); | ||
336 | Assert.That(clickaction,Is.EqualTo(sop.ClickAction)); | ||
337 | Console.WriteLine("Test 18"); | ||
338 | Assert.That(scale,Is.EqualTo(sop.Scale)); | ||
339 | Console.WriteLine("Test 19"); | ||
340 | Assert.That(updatef,Is.EqualTo(sop.UpdateFlag)); | ||
341 | Console.WriteLine("Test 20"); | ||
342 | |||
343 | // This is necessary or object will not be inserted in DB | ||
344 | sop.ObjectFlags = 0; | ||
345 | |||
346 | SceneObjectGroup sog = new SceneObjectGroup(); | ||
347 | sog.AddPart(sop); | ||
348 | sog.RootPart = sop; | ||
349 | |||
350 | // Inserts group in DB | ||
351 | db.StoreObject(sog,region3); | ||
352 | List<SceneObjectGroup> sogs = db.LoadObjects(region3); | ||
353 | Assert.That(sogs.Count, Is.EqualTo(1)); | ||
354 | // Makes sure there are no double insertions: | ||
355 | /* | ||
356 | db.StoreObject(sog,region3); | ||
357 | sogs = db.LoadObjects(region3); | ||
358 | Assert.That(sogs.Count, Is.EqualTo(1)); | ||
359 | */ | ||
360 | |||
361 | // Tests if the parameters were inserted correctly | ||
362 | SceneObjectPart p = sogs[0].RootPart; | ||
363 | Console.WriteLine("Test -0"); | ||
364 | Assert.That(regionh,Is.EqualTo(p.RegionHandle)); | ||
365 | Console.WriteLine("Test -1 localid é: {0} e LocalId é {1}",localid,p.LocalId); | ||
366 | //Assert.That(localid,Is.EqualTo(p.LocalId)); | ||
367 | Console.WriteLine("Test -2"); | ||
368 | //Assert.That(pbshap,Is.EqualTo(p.Shape)); | ||
369 | Assert.That(groupos,Is.EqualTo(p.GroupPosition)); | ||
370 | Console.WriteLine("Test -3"); | ||
371 | Assert.That(name,Is.EqualTo(p.Name)); | ||
372 | Console.WriteLine("Test -4"); | ||
373 | Assert.That(rotoff,Is.EqualTo(p.RotationOffset)); | ||
374 | Console.WriteLine("Test 0 - uuid is {0}",uuid); | ||
375 | Assert.That(uuid,Is.EqualTo(p.UUID)); | ||
376 | Console.WriteLine("Test 1"); | ||
377 | Assert.That(creator,Is.EqualTo(p.CreatorID)); | ||
378 | Console.WriteLine("Test 2 - iserial is {0}",iserial); | ||
379 | //Assert.That(iserial,Is.EqualTo(p.InventorySerial)); | ||
380 | Console.WriteLine("Test 3"); | ||
381 | Assert.That(dic,Is.EqualTo(p.TaskInventory)); | ||
382 | Console.WriteLine("Test 4"); | ||
383 | //Assert.That(objf,Is.EqualTo(p.ObjectFlags)); | ||
384 | Console.WriteLine("Test 5"); | ||
385 | Assert.That(name,Is.EqualTo(p.Name)); | ||
386 | Console.WriteLine("Test 6"); | ||
387 | Assert.That(material,Is.EqualTo(p.Material)); | ||
388 | Console.WriteLine("Test 7"); | ||
389 | Assert.That(pin,Is.EqualTo(p.ScriptAccessPin)); | ||
390 | Console.WriteLine("Test 8"); | ||
391 | Assert.That(textani,Is.EqualTo(p.TextureAnimation)); | ||
392 | Console.WriteLine("Test 9"); | ||
393 | Assert.That(partsys,Is.EqualTo(p.ParticleSystem)); | ||
394 | Console.WriteLine("Test 9.1 - Expires in {0}",expires); | ||
395 | //Assert.That(expires,Is.EqualTo(p.Expires)); | ||
396 | Console.WriteLine("Test 9.2 - Rezzed in {0}",rezzed); | ||
397 | //Assert.That(rezzed,Is.EqualTo(p.Rezzed)); | ||
398 | Console.WriteLine("Test 10"); | ||
399 | Assert.That(offset,Is.EqualTo(p.OffsetPosition)); | ||
400 | Assert.That(velocity,Is.EqualTo(p.Velocity)); | ||
401 | Console.WriteLine("Test 12"); | ||
402 | Assert.That(angvelo,Is.EqualTo(p.AngularVelocity)); | ||
403 | Console.WriteLine("Test 13"); | ||
404 | Assert.That(accel,Is.EqualTo(p.Acceleration)); | ||
405 | Console.WriteLine("Test 14"); | ||
406 | Assert.That(description,Is.EqualTo(p.Description)); | ||
407 | Assert.That(color,Is.EqualTo(p.Color)); | ||
408 | Assert.That(text,Is.EqualTo(p.Text)); | ||
409 | Assert.That(sitname,Is.EqualTo(p.SitName)); | ||
410 | Console.WriteLine("Test 15"); | ||
411 | Assert.That(touchname,Is.EqualTo(p.TouchName)); | ||
412 | Console.WriteLine("Test 16"); | ||
413 | //Assert.That(linknum,Is.EqualTo(p.LinkNum)); | ||
414 | Console.WriteLine("Test 17"); | ||
415 | Assert.That(clickaction,Is.EqualTo(p.ClickAction)); | ||
416 | Console.WriteLine("Test 18"); | ||
417 | Assert.That(scale,Is.EqualTo(p.Scale)); | ||
418 | Console.WriteLine("Test 19"); | ||
419 | //Assert.That(updatef,Is.EqualTo(p.UpdateFlag)); | ||
420 | Console.WriteLine("Test 20"); | ||
421 | |||
422 | } | ||
423 | |||
149 | [Test] | 424 | [Test] |
150 | public void T012_UpdateObject() | 425 | public void T014_UpdateObject() |
151 | { | 426 | { |
152 | string text = "object1 text"; | 427 | string text = "object1 text"; |
153 | SceneObjectGroup sog = FindSOG("object1", region1); | 428 | SceneObjectGroup sog = FindSOG("object1", region1); |
@@ -364,14 +639,17 @@ namespace OpenSim.Data.Tests | |||
364 | private SceneObjectGroup NewSOG(string name, UUID uuid) | 639 | private SceneObjectGroup NewSOG(string name, UUID uuid) |
365 | { | 640 | { |
366 | SceneObjectPart sop = new SceneObjectPart(); | 641 | SceneObjectPart sop = new SceneObjectPart(); |
367 | sop.LocalId = 1; | 642 | //sop.LocalId = 1; |
643 | sop.LocalId = localID; | ||
644 | localID = localID + 1; | ||
368 | sop.Name = name; | 645 | sop.Name = name; |
369 | sop.Description = name; | 646 | sop.Description = name; |
370 | sop.Text = ""; | 647 | sop.Text = RandomName(); |
371 | sop.SitName = ""; | 648 | sop.SitName = RandomName(); |
372 | sop.TouchName = ""; | 649 | sop.TouchName = RandomName(); |
373 | sop.UUID = uuid; | 650 | sop.UUID = uuid; |
374 | sop.Shape = PrimitiveBaseShape.Default; | 651 | sop.Shape = PrimitiveBaseShape.Default; |
652 | |||
375 | 653 | ||
376 | SceneObjectGroup sog = new SceneObjectGroup(); | 654 | SceneObjectGroup sog = new SceneObjectGroup(); |
377 | sog.AddPart(sop); | 655 | sog.AddPart(sop); |
@@ -379,6 +657,22 @@ namespace OpenSim.Data.Tests | |||
379 | 657 | ||
380 | return sog; | 658 | return sog; |
381 | } | 659 | } |
660 | |||
661 | private SceneObjectPart NewSOP(string name, UUID uuid) | ||
662 | { | ||
663 | SceneObjectPart sop = new SceneObjectPart(); | ||
664 | //sop.LocalId = 1; | ||
665 | sop.LocalId = localID; | ||
666 | localID = localID + 1; | ||
667 | sop.Name = name; | ||
668 | sop.Description = name; | ||
669 | sop.Text = RandomName(); | ||
670 | sop.SitName = RandomName(); | ||
671 | sop.TouchName = RandomName(); | ||
672 | sop.UUID = uuid; | ||
673 | sop.Shape = PrimitiveBaseShape.Default; | ||
674 | return sop; | ||
675 | } | ||
382 | 676 | ||
383 | // These are copied from the Inventory Item tests | 677 | // These are copied from the Inventory Item tests |
384 | 678 | ||
@@ -395,6 +689,18 @@ namespace OpenSim.Data.Tests | |||
395 | return i; | 689 | return i; |
396 | } | 690 | } |
397 | 691 | ||
692 | private static string RandomName() | ||
693 | { | ||
694 | StringBuilder name = new StringBuilder(); | ||
695 | int size = random.Next(5,12); | ||
696 | char ch ; | ||
697 | for (int i=0; i<size; i++) | ||
698 | { | ||
699 | ch = Convert.ToChar(Convert.ToInt32(Math.Floor(26 * random.NextDouble() + 65))) ; | ||
700 | name.Append(ch); | ||
701 | } | ||
702 | return name.ToString(); | ||
703 | } | ||
398 | // private InventoryFolderBase NewFolder(UUID id, UUID parent, UUID owner, string name) | 704 | // private InventoryFolderBase NewFolder(UUID id, UUID parent, UUID owner, string name) |
399 | // { | 705 | // { |
400 | // InventoryFolderBase f = new InventoryFolderBase(); | 706 | // InventoryFolderBase f = new InventoryFolderBase(); |
diff --git a/prebuild.xml b/prebuild.xml index 1b93226..e2a00fc 100644 --- a/prebuild.xml +++ b/prebuild.xml | |||
@@ -116,6 +116,7 @@ | |||
116 | 116 | ||
117 | <ReferencePath>../../../bin/</ReferencePath> | 117 | <ReferencePath>../../../bin/</ReferencePath> |
118 | <Reference name="System"/> | 118 | <Reference name="System"/> |
119 | <Reference name="System.Drawing"/> | ||
119 | <Reference name="System.Xml"/> | 120 | <Reference name="System.Xml"/> |
120 | <Reference name="System.Data"/> | 121 | <Reference name="System.Data"/> |
121 | <Reference name="nunit.framework.dll" /> | 122 | <Reference name="nunit.framework.dll" /> |
@@ -1403,6 +1404,7 @@ | |||
1403 | <ReferencePath>../../../bin/</ReferencePath> | 1404 | <ReferencePath>../../../bin/</ReferencePath> |
1404 | <Reference name="System" localCopy="false"/> | 1405 | <Reference name="System" localCopy="false"/> |
1405 | <Reference name="System.Xml"/> | 1406 | <Reference name="System.Xml"/> |
1407 | <Reference name="System.Drawing"/> | ||
1406 | <Reference name="System.Data"/> | 1408 | <Reference name="System.Data"/> |
1407 | <Reference name="OpenMetaverse.dll"/> | 1409 | <Reference name="OpenMetaverse.dll"/> |
1408 | <Reference name="OpenMetaverseTypes.dll"/> | 1410 | <Reference name="OpenMetaverseTypes.dll"/> |