aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Data')
-rw-r--r--OpenSim/Data/MySQL/MySQLRegionData.cs5
-rw-r--r--OpenSim/Data/SQLite/SQLiteRegionData.cs17
-rw-r--r--OpenSim/Data/Tests/BasicRegionTest.cs186
3 files changed, 112 insertions, 96 deletions
diff --git a/OpenSim/Data/MySQL/MySQLRegionData.cs b/OpenSim/Data/MySQL/MySQLRegionData.cs
index fb08049..ac8165c 100644
--- a/OpenSim/Data/MySQL/MySQLRegionData.cs
+++ b/OpenSim/Data/MySQL/MySQLRegionData.cs
@@ -425,8 +425,8 @@ namespace OpenSim.Data.MySQL
425 group.RootPart = prim; 425 group.RootPart = prim;
426 createdObjects.Add(group.UUID, group); 426 createdObjects.Add(group.UUID, group);
427 retvals.Add(group); 427 retvals.Add(group);
428 LoadItems(prim);
428 } 429 }
429 LoadItems(prim);
430 } 430 }
431 catch (Exception e) 431 catch (Exception e)
432 { 432 {
@@ -463,8 +463,8 @@ namespace OpenSim.Data.MySQL
463 prim.Shape = PrimitiveBaseShape.Default; 463 prim.Shape = PrimitiveBaseShape.Default;
464 } 464 }
465 createdObjects[new UUID(objID)].AddPart(prim); 465 createdObjects[new UUID(objID)].AddPart(prim);
466 LoadItems(prim);
466 } 467 }
467 LoadItems(prim);
468 } 468 }
469 catch (Exception e) 469 catch (Exception e)
470 { 470 {
@@ -495,7 +495,6 @@ namespace OpenSim.Data.MySQL
495 495
496 String sql = String.Format("primID = '{0}'", prim.UUID.ToString()); 496 String sql = String.Format("primID = '{0}'", prim.UUID.ToString());
497 DataRow[] dbItemRows = dbItems.Select(sql); 497 DataRow[] dbItemRows = dbItems.Select(sql);
498 Console.WriteLine("dbItemRows MYSQL Length: {0}",dbItemRows.Length);
499 IList<TaskInventoryItem> inventory = new List<TaskInventoryItem>(); 498 IList<TaskInventoryItem> inventory = new List<TaskInventoryItem>();
500 499
501 foreach (DataRow row in dbItemRows) 500 foreach (DataRow row in dbItemRows)
diff --git a/OpenSim/Data/SQLite/SQLiteRegionData.cs b/OpenSim/Data/SQLite/SQLiteRegionData.cs
index 9ddab55..93d9406 100644
--- a/OpenSim/Data/SQLite/SQLiteRegionData.cs
+++ b/OpenSim/Data/SQLite/SQLiteRegionData.cs
@@ -438,11 +438,10 @@ namespace OpenSim.Data.SQLite
438 } 438 }
439 group.AddPart(prim); 439 group.AddPart(prim);
440 group.RootPart = prim; 440 group.RootPart = prim;
441 Console.WriteLine("The Object UUID is {0}",prim.UUID);
442 createdObjects.Add(group.UUID, group); 441 createdObjects.Add(group.UUID, group);
443 retvals.Add(group); 442 retvals.Add(group);
443 LoadItems(prim);
444 } 444 }
445 LoadItems(prim);
446 } 445 }
447 catch (Exception e) 446 catch (Exception e)
448 { 447 {
@@ -477,10 +476,9 @@ namespace OpenSim.Data.SQLite
477 "[REGION DB]: No shape found for prim in storage, so setting default box shape"); 476 "[REGION DB]: No shape found for prim in storage, so setting default box shape");
478 prim.Shape = PrimitiveBaseShape.Default; 477 prim.Shape = PrimitiveBaseShape.Default;
479 } 478 }
480 Console.WriteLine("Version2: The Object UUID is {0}",prim.UUID);
481 createdObjects[new UUID(objID)].AddPart(prim); 479 createdObjects[new UUID(objID)].AddPart(prim);
480 LoadItems(prim);
482 } 481 }
483 LoadItems(prim);
484 } 482 }
485 catch (Exception e) 483 catch (Exception e)
486 { 484 {
@@ -504,20 +502,13 @@ namespace OpenSim.Data.SQLite
504 { 502 {
505 //m_log.DebugFormat("[DATASTORE]: Loading inventory for {0}, {1}", prim.Name, prim.UUID); 503 //m_log.DebugFormat("[DATASTORE]: Loading inventory for {0}, {1}", prim.Name, prim.UUID);
506 504
507 DataTable dbItems = ds.Tables["primitems"]; 505 DataTable dbItems = ds.Tables["primitems"];
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);
510 String sql = String.Format("primID = '{0}'", prim.UUID.ToString()); 506 String sql = String.Format("primID = '{0}'", prim.UUID.ToString());
511 //string sql = "primID = '" + prim.UUID.ToString() + "'";
512 DataRow[] dbItemRows = dbItems.Select(sql); 507 DataRow[] dbItemRows = dbItems.Select(sql);
513 Console.WriteLine("dbItemRows Length: {0}",dbItemRows.Length);
514 if (dbItemRows.Length == 0)
515 return;
516 IList<TaskInventoryItem> inventory = new List<TaskInventoryItem>(); 508 IList<TaskInventoryItem> inventory = new List<TaskInventoryItem>();
517 509
518 foreach (DataRow row in dbItemRows) 510 foreach (DataRow row in dbItemRows)
519 { 511 {
520 Console.WriteLine("Inside the foreach");
521 TaskInventoryItem item = buildItem(row); 512 TaskInventoryItem item = buildItem(row);
522 inventory.Add(item); 513 inventory.Add(item);
523 514
@@ -1194,7 +1185,7 @@ namespace OpenSim.Data.SQLite
1194 Convert.ToSingle( 1185 Convert.ToSingle(
1195 row["SitTargetOrientW"])); 1186 row["SitTargetOrientW"]));
1196 1187
1197 prim.Color = Color.FromArgb(Convert.ToInt32(row["ColorR"]), Convert.ToInt32(row["ColorB"]), Convert.ToInt32(row["ColorG"])); 1188 prim.Color = Color.FromArgb(Convert.ToInt32(row["ColorR"]), Convert.ToInt32(row["ColorG"]), Convert.ToInt32(row["ColorB"]));
1198 1189
1199 prim.ClickAction = Convert.ToByte(row["ClickAction"]); 1190 prim.ClickAction = Convert.ToByte(row["ClickAction"]);
1200 prim.PayPrice[0] = Convert.ToInt32(row["PayPrice"]); 1191 prim.PayPrice[0] = Convert.ToInt32(row["PayPrice"]);
diff --git a/OpenSim/Data/Tests/BasicRegionTest.cs b/OpenSim/Data/Tests/BasicRegionTest.cs
index d09b458..2d6fd60 100644
--- a/OpenSim/Data/Tests/BasicRegionTest.cs
+++ b/OpenSim/Data/Tests/BasicRegionTest.cs
@@ -184,12 +184,8 @@ namespace OpenSim.Data.Tests
184 sog.AddPart(p2); 184 sog.AddPart(p2);
185 sog.AddPart(p3); 185 sog.AddPart(p3);
186 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(); 187 SceneObjectPart[] parts = sog.GetParts();
190 Console.WriteLine("Before Insertion:");
191 Assert.That(parts.Length,Is.EqualTo(4)); 188 Assert.That(parts.Length,Is.EqualTo(4));
192 Console.WriteLine("PASSED BEFORE");
193 189
194 db.StoreObject(sog, newregion); 190 db.StoreObject(sog, newregion);
195 List<SceneObjectGroup> sogs = db.LoadObjects(newregion); 191 List<SceneObjectGroup> sogs = db.LoadObjects(newregion);
@@ -197,9 +193,7 @@ namespace OpenSim.Data.Tests
197 SceneObjectGroup newsog = sogs[0]; 193 SceneObjectGroup newsog = sogs[0];
198 194
199 SceneObjectPart[] newparts = newsog.GetParts(); 195 SceneObjectPart[] newparts = newsog.GetParts();
200 Console.WriteLine("After Insertion:");
201 Assert.That(newparts.Length,Is.EqualTo(4)); 196 Assert.That(newparts.Length,Is.EqualTo(4));
202 Console.WriteLine("PASSED AFTER!");
203 197
204 Assert.That(newsog.HasChildPrim(tmp0)); 198 Assert.That(newsog.HasChildPrim(tmp0));
205 Assert.That(newsog.HasChildPrim(tmp1)); 199 Assert.That(newsog.HasChildPrim(tmp1));
@@ -208,9 +202,11 @@ namespace OpenSim.Data.Tests
208 } 202 }
209 203
210 [Test] 204 [Test]
211 [Ignore("Make sure 12 works first")] 205 public void T013_DatabaseConsistency()
212 public void T013_ObjectConsistency()
213 { 206 {
207 // Sets all ScenePart parameters, stores and retrieves them, then check for consistency with initial data
208 // The commented Asserts are the ones that are unchangeable (when storing on the database, their "Set" values are ignored
209 // The ObjectFlags is an exception, if it is entered incorrectly, the object IS REJECTED on the database silently.
214 UUID creator,uuid = new UUID(); 210 UUID creator,uuid = new UUID();
215 creator = UUID.Random(); 211 creator = UUID.Random();
216 uint iserial = (uint) random.Next(); 212 uint iserial = (uint) random.Next();
@@ -236,8 +232,7 @@ namespace OpenSim.Data.Tests
236 Vector3 angvelo = new Vector3(random.Next(),random.Next(),random.Next()); 232 Vector3 angvelo = new Vector3(random.Next(),random.Next(),random.Next());
237 Vector3 accel = new Vector3(random.Next(),random.Next(),random.Next()); 233 Vector3 accel = new Vector3(random.Next(),random.Next(),random.Next());
238 string description = name; 234 string description = name;
239 //Color color = Color.Brown; 235 Color color = Color.FromArgb(255, 165, 50, 100);
240 Color color = Color.FromArgb(255, 165, 42, 42);
241 string text = "All Your Base Are Belong to Us"; 236 string text = "All Your Base Are Belong to Us";
242 string sitname = "SitName"; 237 string sitname = "SitName";
243 string touchname = "TouchName"; 238 string touchname = "TouchName";
@@ -281,156 +276,194 @@ namespace OpenSim.Data.Tests
281 sop.UpdateFlag = updatef; 276 sop.UpdateFlag = updatef;
282 277
283 //Tests if local part accepted the parameters: 278 //Tests if local part accepted the parameters:
284 Console.WriteLine("Test -0");
285 Assert.That(regionh,Is.EqualTo(sop.RegionHandle)); 279 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)); 280 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)); 281 Assert.That(groupos,Is.EqualTo(sop.GroupPosition));
291 Console.WriteLine("Test -3");
292 Assert.That(name,Is.EqualTo(sop.Name)); 282 Assert.That(name,Is.EqualTo(sop.Name));
293 Console.WriteLine("Test -4");
294 Assert.That(rotoff,Is.EqualTo(sop.RotationOffset)); 283 Assert.That(rotoff,Is.EqualTo(sop.RotationOffset));
295 Console.WriteLine("Test 0 - uuid is {0}",uuid);
296 Assert.That(uuid,Is.EqualTo(sop.UUID)); 284 Assert.That(uuid,Is.EqualTo(sop.UUID));
297 Console.WriteLine("Test 1");
298 Assert.That(creator,Is.EqualTo(sop.CreatorID)); 285 Assert.That(creator,Is.EqualTo(sop.CreatorID));
299 Console.WriteLine("Test 2 - iserial is {0}",iserial);
300 Assert.That(iserial,Is.EqualTo(sop.InventorySerial)); 286 Assert.That(iserial,Is.EqualTo(sop.InventorySerial));
301 Console.WriteLine("Test 3");
302 Assert.That(dic,Is.EqualTo(sop.TaskInventory)); 287 Assert.That(dic,Is.EqualTo(sop.TaskInventory));
303 Console.WriteLine("Test 4");
304 Assert.That(objf,Is.EqualTo(sop.ObjectFlags)); 288 Assert.That(objf,Is.EqualTo(sop.ObjectFlags));
305 Console.WriteLine("Test 5");
306 Assert.That(name,Is.EqualTo(sop.Name)); 289 Assert.That(name,Is.EqualTo(sop.Name));
307 Console.WriteLine("Test 6");
308 Assert.That(material,Is.EqualTo(sop.Material)); 290 Assert.That(material,Is.EqualTo(sop.Material));
309 Console.WriteLine("Test 7");
310 Assert.That(pin,Is.EqualTo(sop.ScriptAccessPin)); 291 Assert.That(pin,Is.EqualTo(sop.ScriptAccessPin));
311 Console.WriteLine("Test 8");
312 Assert.That(textani,Is.EqualTo(sop.TextureAnimation)); 292 Assert.That(textani,Is.EqualTo(sop.TextureAnimation));
313 Console.WriteLine("Test 9");
314 Assert.That(partsys,Is.EqualTo(sop.ParticleSystem)); 293 Assert.That(partsys,Is.EqualTo(sop.ParticleSystem));
315 Console.WriteLine("Test 9.1");
316 Assert.That(expires,Is.EqualTo(sop.Expires)); 294 Assert.That(expires,Is.EqualTo(sop.Expires));
317 Console.WriteLine("Test 9.2");
318 Assert.That(rezzed,Is.EqualTo(sop.Rezzed)); 295 Assert.That(rezzed,Is.EqualTo(sop.Rezzed));
319 Console.WriteLine("Test 10");
320 Assert.That(offset,Is.EqualTo(sop.OffsetPosition)); 296 Assert.That(offset,Is.EqualTo(sop.OffsetPosition));
321 Assert.That(velocity,Is.EqualTo(sop.Velocity)); 297 Assert.That(velocity,Is.EqualTo(sop.Velocity));
322 Console.WriteLine("Test 12");
323 Assert.That(angvelo,Is.EqualTo(sop.AngularVelocity)); 298 Assert.That(angvelo,Is.EqualTo(sop.AngularVelocity));
324 Console.WriteLine("Test 13");
325 Assert.That(accel,Is.EqualTo(sop.Acceleration)); 299 Assert.That(accel,Is.EqualTo(sop.Acceleration));
326 Console.WriteLine("Test 14");
327 Assert.That(description,Is.EqualTo(sop.Description)); 300 Assert.That(description,Is.EqualTo(sop.Description));
328 Assert.That(color,Is.EqualTo(sop.Color)); 301 Assert.That(color,Is.EqualTo(sop.Color));
329 Assert.That(text,Is.EqualTo(sop.Text)); 302 Assert.That(text,Is.EqualTo(sop.Text));
330 Assert.That(sitname,Is.EqualTo(sop.SitName)); 303 Assert.That(sitname,Is.EqualTo(sop.SitName));
331 Console.WriteLine("Test 15");
332 Assert.That(touchname,Is.EqualTo(sop.TouchName)); 304 Assert.That(touchname,Is.EqualTo(sop.TouchName));
333 Console.WriteLine("Test 16");
334 Assert.That(linknum,Is.EqualTo(sop.LinkNum)); 305 Assert.That(linknum,Is.EqualTo(sop.LinkNum));
335 Console.WriteLine("Test 17");
336 Assert.That(clickaction,Is.EqualTo(sop.ClickAction)); 306 Assert.That(clickaction,Is.EqualTo(sop.ClickAction));
337 Console.WriteLine("Test 18");
338 Assert.That(scale,Is.EqualTo(sop.Scale)); 307 Assert.That(scale,Is.EqualTo(sop.Scale));
339 Console.WriteLine("Test 19");
340 Assert.That(updatef,Is.EqualTo(sop.UpdateFlag)); 308 Assert.That(updatef,Is.EqualTo(sop.UpdateFlag));
341 Console.WriteLine("Test 20");
342 309
343 // This is necessary or object will not be inserted in DB 310 // This is necessary or object will not be inserted in DB
344 sop.ObjectFlags = 0; 311 sop.ObjectFlags = 0;
345 312
346 SceneObjectGroup sog = new SceneObjectGroup(); 313 SceneObjectGroup sog = new SceneObjectGroup();
347 sog.AddPart(sop); 314 sog.AddPart(sop);
348 sog.RootPart = sop; 315 sog.RootPart = sop;
349 316
350 // Inserts group in DB 317 // Inserts group in DB
351 db.StoreObject(sog,region3); 318 db.StoreObject(sog,region3);
352 List<SceneObjectGroup> sogs = db.LoadObjects(region3); 319 List<SceneObjectGroup> sogs = db.LoadObjects(region3);
353 Assert.That(sogs.Count, Is.EqualTo(1)); 320 Assert.That(sogs.Count, Is.EqualTo(1));
354 // Makes sure there are no double insertions: 321 // Makes sure there are no double insertions:
355 /*
356 db.StoreObject(sog,region3); 322 db.StoreObject(sog,region3);
357 sogs = db.LoadObjects(region3); 323 sogs = db.LoadObjects(region3);
358 Assert.That(sogs.Count, Is.EqualTo(1)); 324 Assert.That(sogs.Count, Is.EqualTo(1));
359 */ 325
360 326
361 // Tests if the parameters were inserted correctly 327 // Tests if the parameters were inserted correctly
362 SceneObjectPart p = sogs[0].RootPart; 328 SceneObjectPart p = sogs[0].RootPart;
363 Console.WriteLine("Test -0");
364 Assert.That(regionh,Is.EqualTo(p.RegionHandle)); 329 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)); 330 //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)); 331 Assert.That(groupos,Is.EqualTo(p.GroupPosition));
370 Console.WriteLine("Test -3");
371 Assert.That(name,Is.EqualTo(p.Name)); 332 Assert.That(name,Is.EqualTo(p.Name));
372 Console.WriteLine("Test -4");
373 Assert.That(rotoff,Is.EqualTo(p.RotationOffset)); 333 Assert.That(rotoff,Is.EqualTo(p.RotationOffset));
374 Console.WriteLine("Test 0 - uuid is {0}",uuid);
375 Assert.That(uuid,Is.EqualTo(p.UUID)); 334 Assert.That(uuid,Is.EqualTo(p.UUID));
376 Console.WriteLine("Test 1");
377 Assert.That(creator,Is.EqualTo(p.CreatorID)); 335 Assert.That(creator,Is.EqualTo(p.CreatorID));
378 Console.WriteLine("Test 2 - iserial is {0}",iserial);
379 //Assert.That(iserial,Is.EqualTo(p.InventorySerial)); 336 //Assert.That(iserial,Is.EqualTo(p.InventorySerial));
380 Console.WriteLine("Test 3");
381 Assert.That(dic,Is.EqualTo(p.TaskInventory)); 337 Assert.That(dic,Is.EqualTo(p.TaskInventory));
382 Console.WriteLine("Test 4");
383 //Assert.That(objf,Is.EqualTo(p.ObjectFlags)); 338 //Assert.That(objf,Is.EqualTo(p.ObjectFlags));
384 Console.WriteLine("Test 5");
385 Assert.That(name,Is.EqualTo(p.Name)); 339 Assert.That(name,Is.EqualTo(p.Name));
386 Console.WriteLine("Test 6");
387 Assert.That(material,Is.EqualTo(p.Material)); 340 Assert.That(material,Is.EqualTo(p.Material));
388 Console.WriteLine("Test 7");
389 Assert.That(pin,Is.EqualTo(p.ScriptAccessPin)); 341 Assert.That(pin,Is.EqualTo(p.ScriptAccessPin));
390 Console.WriteLine("Test 8");
391 Assert.That(textani,Is.EqualTo(p.TextureAnimation)); 342 Assert.That(textani,Is.EqualTo(p.TextureAnimation));
392 Console.WriteLine("Test 9");
393 Assert.That(partsys,Is.EqualTo(p.ParticleSystem)); 343 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)); 344 //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)); 345 //Assert.That(rezzed,Is.EqualTo(p.Rezzed));
398 Console.WriteLine("Test 10");
399 Assert.That(offset,Is.EqualTo(p.OffsetPosition)); 346 Assert.That(offset,Is.EqualTo(p.OffsetPosition));
400 Assert.That(velocity,Is.EqualTo(p.Velocity)); 347 Assert.That(velocity,Is.EqualTo(p.Velocity));
401 Console.WriteLine("Test 12");
402 Assert.That(angvelo,Is.EqualTo(p.AngularVelocity)); 348 Assert.That(angvelo,Is.EqualTo(p.AngularVelocity));
403 Console.WriteLine("Test 13");
404 Assert.That(accel,Is.EqualTo(p.Acceleration)); 349 Assert.That(accel,Is.EqualTo(p.Acceleration));
405 Console.WriteLine("Test 14");
406 Assert.That(description,Is.EqualTo(p.Description)); 350 Assert.That(description,Is.EqualTo(p.Description));
407 Assert.That(color,Is.EqualTo(p.Color)); 351 Assert.That(color,Is.EqualTo(p.Color));
408 Assert.That(text,Is.EqualTo(p.Text)); 352 Assert.That(text,Is.EqualTo(p.Text));
409 Assert.That(sitname,Is.EqualTo(p.SitName)); 353 Assert.That(sitname,Is.EqualTo(p.SitName));
410 Console.WriteLine("Test 15");
411 Assert.That(touchname,Is.EqualTo(p.TouchName)); 354 Assert.That(touchname,Is.EqualTo(p.TouchName));
412 Console.WriteLine("Test 16");
413 //Assert.That(linknum,Is.EqualTo(p.LinkNum)); 355 //Assert.That(linknum,Is.EqualTo(p.LinkNum));
414 Console.WriteLine("Test 17");
415 Assert.That(clickaction,Is.EqualTo(p.ClickAction)); 356 Assert.That(clickaction,Is.EqualTo(p.ClickAction));
416 Console.WriteLine("Test 18");
417 Assert.That(scale,Is.EqualTo(p.Scale)); 357 Assert.That(scale,Is.EqualTo(p.Scale));
418 Console.WriteLine("Test 19");
419 //Assert.That(updatef,Is.EqualTo(p.UpdateFlag)); 358 //Assert.That(updatef,Is.EqualTo(p.UpdateFlag));
420 Console.WriteLine("Test 20");
421
422 } 359 }
423 360
424 [Test] 361 [Test]
425 public void T014_UpdateObject() 362 public void T014_UpdateObject()
426 { 363 {
427 string text = "object1 text"; 364
365 string text1 = "object1 text";
428 SceneObjectGroup sog = FindSOG("object1", region1); 366 SceneObjectGroup sog = FindSOG("object1", region1);
429 sog.RootPart.Text = text; 367 sog.RootPart.Text = text1;
430 db.StoreObject(sog, region1); 368 db.StoreObject(sog, region1);
431 369
432 sog = FindSOG("object1", region1); 370 sog = FindSOG("object1", region1);
433 Assert.That(text, Is.EqualTo(sog.RootPart.Text)); 371 Assert.That(text1, Is.EqualTo(sog.RootPart.Text));
372
373
374 // Creates random values
375 UUID creator = new UUID();
376 creator = UUID.Random();
377 TaskInventoryDictionary dic = new TaskInventoryDictionary();
378 uint objf = (uint) random.Next();
379 localID = localID + 1;
380 string name = "West Adam";
381 byte material = (byte) random.Next(255);
382 ulong regionh = (ulong)random.NextDouble() * (ulong)random.Next();
383 int pin = random.Next();
384 Byte[] partsys = new byte[8];
385 Byte[] textani = new byte[8];
386 random.NextBytes(textani);
387 random.NextBytes(partsys);
388 DateTime expires = new DateTime(2010, 12, 20);
389 DateTime rezzed = new DateTime(2005, 07, 15);
390 Vector3 groupos = new Vector3(random.Next(),random.Next(),random.Next());
391 Vector3 offset = new Vector3(random.Next(),random.Next(),random.Next());
392 Quaternion rotoff = new Quaternion(random.Next(),random.Next(),random.Next(),random.Next());
393 Vector3 velocity = new Vector3(random.Next(),random.Next(),random.Next());
394 Vector3 angvelo = new Vector3(random.Next(),random.Next(),random.Next());
395 Vector3 accel = new Vector3(random.Next(),random.Next(),random.Next());
396 string description = name;
397 Color color = Color.FromArgb(255, 255, 255, 0);
398 string text = "What You Say?{]\vz~";
399 string sitname = RandomName();
400 string touchname = RandomName();
401 int linknum = random.Next();
402 byte clickaction = (byte) random.Next(255);
403 PrimitiveBaseShape pbshap = new PrimitiveBaseShape();
404 pbshap = PrimitiveBaseShape.Default;
405 Vector3 scale = new Vector3(random.Next(),random.Next(),random.Next());
406 byte updatef = (byte) random.Next(255);
407
408 // Updates the region with new values
409 SceneObjectGroup sog2 = FindSOG("Adam West", region3);
410 Assert.That(sog2,Is.Not.Null);
411 sog2.RootPart.RegionHandle = regionh;
412 sog2.RootPart.Shape = pbshap;
413 sog2.RootPart.GroupPosition = groupos;
414 sog2.RootPart.RotationOffset = rotoff;
415 sog2.RootPart.CreatorID = creator;
416 sog2.RootPart.TaskInventory = dic;
417 sog2.RootPart.Name = name;
418 sog2.RootPart.Material = material;
419 sog2.RootPart.ScriptAccessPin = pin;
420 sog2.RootPart.TextureAnimation = textani;
421 sog2.RootPart.ParticleSystem = partsys;
422 sog2.RootPart.Expires = expires;
423 sog2.RootPart.Rezzed = rezzed;
424 sog2.RootPart.OffsetPosition = offset;
425 sog2.RootPart.Velocity = velocity;
426 sog2.RootPart.AngularVelocity = angvelo;
427 sog2.RootPart.Acceleration = accel;
428 sog2.RootPart.Description = description;
429 sog2.RootPart.Color = color;
430 sog2.RootPart.Text = text;
431 sog2.RootPart.SitName = sitname;
432 sog2.RootPart.TouchName = touchname;
433 sog2.RootPart.LinkNum = linknum;
434 sog2.RootPart.ClickAction = clickaction;
435 sog2.RootPart.Scale = scale;
436 sog2.RootPart.UpdateFlag = updatef;
437
438 db.StoreObject(sog2, region3);
439 List<SceneObjectGroup> sogs = db.LoadObjects(region3);
440 Assert.That(sogs.Count, Is.EqualTo(1));
441
442 SceneObjectGroup retsog = FindSOG("West Adam", region3);
443 Assert.That(retsog,Is.Not.Null);
444 SceneObjectPart p = retsog.RootPart;
445 Assert.That(regionh,Is.EqualTo(p.RegionHandle));
446 Assert.That(groupos,Is.EqualTo(p.GroupPosition));
447 Assert.That(name,Is.EqualTo(p.Name));
448 Assert.That(rotoff,Is.EqualTo(p.RotationOffset));
449 Assert.That(creator,Is.EqualTo(p.CreatorID));
450 Assert.That(dic,Is.EqualTo(p.TaskInventory));
451 Assert.That(name,Is.EqualTo(p.Name));
452 Assert.That(material,Is.EqualTo(p.Material));
453 Assert.That(pin,Is.EqualTo(p.ScriptAccessPin));
454 Assert.That(textani,Is.EqualTo(p.TextureAnimation));
455 Assert.That(partsys,Is.EqualTo(p.ParticleSystem));
456 Assert.That(offset,Is.EqualTo(p.OffsetPosition));
457 Assert.That(velocity,Is.EqualTo(p.Velocity));
458 Assert.That(angvelo,Is.EqualTo(p.AngularVelocity));
459 Assert.That(accel,Is.EqualTo(p.Acceleration));
460 Assert.That(description,Is.EqualTo(p.Description));
461 Assert.That(color,Is.EqualTo(p.Color));
462 Assert.That(text,Is.EqualTo(p.Text));
463 Assert.That(sitname,Is.EqualTo(p.SitName));
464 Assert.That(touchname,Is.EqualTo(p.TouchName));
465 Assert.That(clickaction,Is.EqualTo(p.ClickAction));
466 Assert.That(scale,Is.EqualTo(p.Scale));
434 } 467 }
435 468
436 [Test] 469 [Test]
@@ -639,9 +672,6 @@ namespace OpenSim.Data.Tests
639 private SceneObjectGroup NewSOG(string name, UUID uuid) 672 private SceneObjectGroup NewSOG(string name, UUID uuid)
640 { 673 {
641 SceneObjectPart sop = new SceneObjectPart(); 674 SceneObjectPart sop = new SceneObjectPart();
642 //sop.LocalId = 1;
643 sop.LocalId = localID;
644 localID = localID + 1;
645 sop.Name = name; 675 sop.Name = name;
646 sop.Description = name; 676 sop.Description = name;
647 sop.Text = RandomName(); 677 sop.Text = RandomName();
@@ -654,16 +684,12 @@ namespace OpenSim.Data.Tests
654 SceneObjectGroup sog = new SceneObjectGroup(); 684 SceneObjectGroup sog = new SceneObjectGroup();
655 sog.AddPart(sop); 685 sog.AddPart(sop);
656 sog.RootPart = sop; 686 sog.RootPart = sop;
657
658 return sog; 687 return sog;
659 } 688 }
660 689
661 private SceneObjectPart NewSOP(string name, UUID uuid) 690 private SceneObjectPart NewSOP(string name, UUID uuid)
662 { 691 {
663 SceneObjectPart sop = new SceneObjectPart(); 692 SceneObjectPart sop = new SceneObjectPart();
664 //sop.LocalId = 1;
665 sop.LocalId = localID;
666 localID = localID + 1;
667 sop.Name = name; 693 sop.Name = name;
668 sop.Description = name; 694 sop.Description = name;
669 sop.Text = RandomName(); 695 sop.Text = RandomName();