diff options
author | Melanie Thielker | 2017-01-05 19:07:37 +0000 |
---|---|---|
committer | Melanie Thielker | 2017-01-05 19:07:37 +0000 |
commit | b16abc8166c29585cb76cc55c3bdd76e5833cb4f (patch) | |
tree | 6a34f465a74b7a3a6dc00a3d7aa8dcc25ac3e3a5 /OpenSim/Data/Tests/RegionTests.cs | |
parent | Make it possible to disable the bakes module in the way it is described in co... (diff) | |
download | opensim-SC-b16abc8166c29585cb76cc55c3bdd76e5833cb4f.zip opensim-SC-b16abc8166c29585cb76cc55c3bdd76e5833cb4f.tar.gz opensim-SC-b16abc8166c29585cb76cc55c3bdd76e5833cb4f.tar.bz2 opensim-SC-b16abc8166c29585cb76cc55c3bdd76e5833cb4f.tar.xz |
Massive tab and trailing space cleanup
Diffstat (limited to 'OpenSim/Data/Tests/RegionTests.cs')
-rw-r--r-- | OpenSim/Data/Tests/RegionTests.cs | 152 |
1 files changed, 76 insertions, 76 deletions
diff --git a/OpenSim/Data/Tests/RegionTests.cs b/OpenSim/Data/Tests/RegionTests.cs index e1503d0..4f81594 100644 --- a/OpenSim/Data/Tests/RegionTests.cs +++ b/OpenSim/Data/Tests/RegionTests.cs | |||
@@ -83,7 +83,7 @@ namespace OpenSim.Data.Tests | |||
83 | public UUID item3 = UUID.Random(); | 83 | public UUID item3 = UUID.Random(); |
84 | 84 | ||
85 | public static Random random = new Random(); | 85 | public static Random random = new Random(); |
86 | 86 | ||
87 | public string itemname1 = "item1"; | 87 | public string itemname1 = "item1"; |
88 | 88 | ||
89 | public uint localID = 1; | 89 | public uint localID = 1; |
@@ -111,10 +111,10 @@ namespace OpenSim.Data.Tests | |||
111 | 111 | ||
112 | private void ClearDB() | 112 | private void ClearDB() |
113 | { | 113 | { |
114 | string[] reg_tables = new string[] { | 114 | string[] reg_tables = new string[] { |
115 | "prims", "primshapes", "primitems", "terrain", "land", "landaccesslist", "regionban", "regionsettings" | 115 | "prims", "primshapes", "primitems", "terrain", "land", "landaccesslist", "regionban", "regionsettings" |
116 | }; | 116 | }; |
117 | 117 | ||
118 | if (m_rebuildDB) | 118 | if (m_rebuildDB) |
119 | { | 119 | { |
120 | DropTables(reg_tables); | 120 | DropTables(reg_tables); |
@@ -145,7 +145,7 @@ namespace OpenSim.Data.Tests | |||
145 | public void T001_LoadEmpty() | 145 | public void T001_LoadEmpty() |
146 | { | 146 | { |
147 | TestHelpers.InMethod(); | 147 | TestHelpers.InMethod(); |
148 | 148 | ||
149 | List<SceneObjectGroup> objs = db.LoadObjects(region1); | 149 | List<SceneObjectGroup> objs = db.LoadObjects(region1); |
150 | List<SceneObjectGroup> objs3 = db.LoadObjects(region3); | 150 | List<SceneObjectGroup> objs3 = db.LoadObjects(region3); |
151 | List<LandData> land = db.LoadLandObjects(region1); | 151 | List<LandData> land = db.LoadLandObjects(region1); |
@@ -154,21 +154,21 @@ namespace OpenSim.Data.Tests | |||
154 | Assert.That(objs3.Count, Is.EqualTo(0), "Assert.That(objs3.Count, Is.EqualTo(0))"); | 154 | Assert.That(objs3.Count, Is.EqualTo(0), "Assert.That(objs3.Count, Is.EqualTo(0))"); |
155 | Assert.That(land.Count, Is.EqualTo(0), "Assert.That(land.Count, Is.EqualTo(0))"); | 155 | Assert.That(land.Count, Is.EqualTo(0), "Assert.That(land.Count, Is.EqualTo(0))"); |
156 | } | 156 | } |
157 | 157 | ||
158 | // SOG round trips | 158 | // SOG round trips |
159 | // * store objects, make sure they save | 159 | // * store objects, make sure they save |
160 | // * update | 160 | // * update |
161 | 161 | ||
162 | [Test] | 162 | [Test] |
163 | public void T010_StoreSimpleObject() | 163 | public void T010_StoreSimpleObject() |
164 | { | 164 | { |
165 | TestHelpers.InMethod(); | 165 | TestHelpers.InMethod(); |
166 | 166 | ||
167 | SceneObjectGroup sog = NewSOG("object1", prim1, region1); | 167 | SceneObjectGroup sog = NewSOG("object1", prim1, region1); |
168 | SceneObjectGroup sog2 = NewSOG("object2", prim2, region1); | 168 | SceneObjectGroup sog2 = NewSOG("object2", prim2, region1); |
169 | 169 | ||
170 | // in case the objects don't store | 170 | // in case the objects don't store |
171 | try | 171 | try |
172 | { | 172 | { |
173 | db.StoreObject(sog, region1); | 173 | db.StoreObject(sog, region1); |
174 | } | 174 | } |
@@ -177,8 +177,8 @@ namespace OpenSim.Data.Tests | |||
177 | m_log.Error(e.ToString()); | 177 | m_log.Error(e.ToString()); |
178 | Assert.Fail(); | 178 | Assert.Fail(); |
179 | } | 179 | } |
180 | 180 | ||
181 | try | 181 | try |
182 | { | 182 | { |
183 | db.StoreObject(sog2, region1); | 183 | db.StoreObject(sog2, region1); |
184 | } | 184 | } |
@@ -190,15 +190,15 @@ namespace OpenSim.Data.Tests | |||
190 | 190 | ||
191 | // This tests the ADO.NET driver | 191 | // This tests the ADO.NET driver |
192 | List<SceneObjectGroup> objs = db.LoadObjects(region1); | 192 | List<SceneObjectGroup> objs = db.LoadObjects(region1); |
193 | 193 | ||
194 | Assert.That(objs.Count, Is.EqualTo(2), "Assert.That(objs.Count, Is.EqualTo(2))"); | 194 | Assert.That(objs.Count, Is.EqualTo(2), "Assert.That(objs.Count, Is.EqualTo(2))"); |
195 | } | 195 | } |
196 | 196 | ||
197 | [Test] | 197 | [Test] |
198 | public void T011_ObjectNames() | 198 | public void T011_ObjectNames() |
199 | { | 199 | { |
200 | TestHelpers.InMethod(); | 200 | TestHelpers.InMethod(); |
201 | 201 | ||
202 | List<SceneObjectGroup> objs = db.LoadObjects(region1); | 202 | List<SceneObjectGroup> objs = db.LoadObjects(region1); |
203 | foreach (SceneObjectGroup sog in objs) | 203 | foreach (SceneObjectGroup sog in objs) |
204 | { | 204 | { |
@@ -207,12 +207,12 @@ namespace OpenSim.Data.Tests | |||
207 | Assert.That(p.Name, Is.EqualTo(p.Description), "Assert.That(p.Name, Is.EqualTo(p.Description))"); | 207 | Assert.That(p.Name, Is.EqualTo(p.Description), "Assert.That(p.Name, Is.EqualTo(p.Description))"); |
208 | } | 208 | } |
209 | } | 209 | } |
210 | 210 | ||
211 | [Test] | 211 | [Test] |
212 | public void T012_SceneParts() | 212 | public void T012_SceneParts() |
213 | { | 213 | { |
214 | TestHelpers.InMethod(); | 214 | TestHelpers.InMethod(); |
215 | 215 | ||
216 | UUID tmp0 = UUID.Random(); | 216 | UUID tmp0 = UUID.Random(); |
217 | UUID tmp1 = UUID.Random(); | 217 | UUID tmp1 = UUID.Random(); |
218 | UUID tmp2 = UUID.Random(); | 218 | UUID tmp2 = UUID.Random(); |
@@ -225,10 +225,10 @@ namespace OpenSim.Data.Tests | |||
225 | sog.AddPart(p1); | 225 | sog.AddPart(p1); |
226 | sog.AddPart(p2); | 226 | sog.AddPart(p2); |
227 | sog.AddPart(p3); | 227 | sog.AddPart(p3); |
228 | 228 | ||
229 | SceneObjectPart[] parts = sog.Parts; | 229 | SceneObjectPart[] parts = sog.Parts; |
230 | Assert.That(parts.Length,Is.EqualTo(4), "Assert.That(parts.Length,Is.EqualTo(4))"); | 230 | Assert.That(parts.Length,Is.EqualTo(4), "Assert.That(parts.Length,Is.EqualTo(4))"); |
231 | 231 | ||
232 | db.StoreObject(sog, newregion); | 232 | db.StoreObject(sog, newregion); |
233 | List<SceneObjectGroup> sogs = db.LoadObjects(newregion); | 233 | List<SceneObjectGroup> sogs = db.LoadObjects(newregion); |
234 | Assert.That(sogs.Count,Is.EqualTo(1), "Assert.That(sogs.Count,Is.EqualTo(1))"); | 234 | Assert.That(sogs.Count,Is.EqualTo(1), "Assert.That(sogs.Count,Is.EqualTo(1))"); |
@@ -236,18 +236,18 @@ namespace OpenSim.Data.Tests | |||
236 | 236 | ||
237 | SceneObjectPart[] newparts = newsog.Parts; | 237 | SceneObjectPart[] newparts = newsog.Parts; |
238 | Assert.That(newparts.Length,Is.EqualTo(4), "Assert.That(newparts.Length,Is.EqualTo(4))"); | 238 | Assert.That(newparts.Length,Is.EqualTo(4), "Assert.That(newparts.Length,Is.EqualTo(4))"); |
239 | 239 | ||
240 | Assert.That(newsog.ContainsPart(tmp0), "Assert.That(newsog.ContainsPart(tmp0))"); | 240 | Assert.That(newsog.ContainsPart(tmp0), "Assert.That(newsog.ContainsPart(tmp0))"); |
241 | Assert.That(newsog.ContainsPart(tmp1), "Assert.That(newsog.ContainsPart(tmp1))"); | 241 | Assert.That(newsog.ContainsPart(tmp1), "Assert.That(newsog.ContainsPart(tmp1))"); |
242 | Assert.That(newsog.ContainsPart(tmp2), "Assert.That(newsog.ContainsPart(tmp2))"); | 242 | Assert.That(newsog.ContainsPart(tmp2), "Assert.That(newsog.ContainsPart(tmp2))"); |
243 | Assert.That(newsog.ContainsPart(tmp3), "Assert.That(newsog.ContainsPart(tmp3))"); | 243 | Assert.That(newsog.ContainsPart(tmp3), "Assert.That(newsog.ContainsPart(tmp3))"); |
244 | } | 244 | } |
245 | 245 | ||
246 | [Test] | 246 | [Test] |
247 | public void T013_DatabasePersistency() | 247 | public void T013_DatabasePersistency() |
248 | { | 248 | { |
249 | TestHelpers.InMethod(); | 249 | TestHelpers.InMethod(); |
250 | 250 | ||
251 | // Sets all ScenePart parameters, stores and retrieves them, then check for consistency with initial data | 251 | // Sets all ScenePart parameters, stores and retrieves them, then check for consistency with initial data |
252 | // The commented Asserts are the ones that are unchangeable (when storing on the database, their "Set" values are ignored | 252 | // The commented Asserts are the ones that are unchangeable (when storing on the database, their "Set" values are ignored |
253 | // The ObjectFlags is an exception, if it is entered incorrectly, the object IS REJECTED on the database silently. | 253 | // The ObjectFlags is an exception, if it is entered incorrectly, the object IS REJECTED on the database silently. |
@@ -298,7 +298,7 @@ namespace OpenSim.Data.Tests | |||
298 | 298 | ||
299 | SceneObjectPart sop = new SceneObjectPart(); | 299 | SceneObjectPart sop = new SceneObjectPart(); |
300 | SceneObjectGroup sog = new SceneObjectGroup(sop); | 300 | SceneObjectGroup sog = new SceneObjectGroup(sop); |
301 | 301 | ||
302 | sop.RegionHandle = regionh; | 302 | sop.RegionHandle = regionh; |
303 | sop.UUID = uuid; | 303 | sop.UUID = uuid; |
304 | sop.LocalId = localid; | 304 | sop.LocalId = localid; |
@@ -360,10 +360,10 @@ namespace OpenSim.Data.Tests | |||
360 | Assert.That(linknum,Is.EqualTo(sop.LinkNum), "Assert.That(linknum,Is.EqualTo(sop.LinkNum))"); | 360 | Assert.That(linknum,Is.EqualTo(sop.LinkNum), "Assert.That(linknum,Is.EqualTo(sop.LinkNum))"); |
361 | Assert.That(clickaction,Is.EqualTo(sop.ClickAction), "Assert.That(clickaction,Is.EqualTo(sop.ClickAction))"); | 361 | Assert.That(clickaction,Is.EqualTo(sop.ClickAction), "Assert.That(clickaction,Is.EqualTo(sop.ClickAction))"); |
362 | Assert.That(scale,Is.EqualTo(sop.Scale), "Assert.That(scale,Is.EqualTo(sop.Scale))"); | 362 | Assert.That(scale,Is.EqualTo(sop.Scale), "Assert.That(scale,Is.EqualTo(sop.Scale))"); |
363 | 363 | ||
364 | // This is necessary or object will not be inserted in DB | 364 | // This is necessary or object will not be inserted in DB |
365 | sop.Flags = PrimFlags.None; | 365 | sop.Flags = PrimFlags.None; |
366 | 366 | ||
367 | // Inserts group in DB | 367 | // Inserts group in DB |
368 | db.StoreObject(sog,region3); | 368 | db.StoreObject(sog,region3); |
369 | List<SceneObjectGroup> sogs = db.LoadObjects(region3); | 369 | List<SceneObjectGroup> sogs = db.LoadObjects(region3); |
@@ -372,7 +372,7 @@ namespace OpenSim.Data.Tests | |||
372 | db.StoreObject(sog,region3); | 372 | db.StoreObject(sog,region3); |
373 | sogs = db.LoadObjects(region3); | 373 | sogs = db.LoadObjects(region3); |
374 | Assert.That(sogs.Count, Is.EqualTo(1), "Assert.That(sogs.Count, Is.EqualTo(1))"); | 374 | Assert.That(sogs.Count, Is.EqualTo(1), "Assert.That(sogs.Count, Is.EqualTo(1))"); |
375 | 375 | ||
376 | 376 | ||
377 | // Tests if the parameters were inserted correctly | 377 | // Tests if the parameters were inserted correctly |
378 | SceneObjectPart p = sogs[0].RootPart; | 378 | SceneObjectPart p = sogs[0].RootPart; |
@@ -414,12 +414,12 @@ namespace OpenSim.Data.Tests | |||
414 | Assert.That(pbshap.ProfileEnd, Is.EqualTo(p.Shape.ProfileEnd), "Assert.That(pbshap.ProfileEnd, Is.EqualTo(p.Shape.ProfileEnd))"); | 414 | Assert.That(pbshap.ProfileEnd, Is.EqualTo(p.Shape.ProfileEnd), "Assert.That(pbshap.ProfileEnd, Is.EqualTo(p.Shape.ProfileEnd))"); |
415 | Assert.That(pbshap.ProfileHollow, Is.EqualTo(p.Shape.ProfileHollow), "Assert.That(pbshap.ProfileHollow, Is.EqualTo(p.Shape.ProfileHollow))"); | 415 | Assert.That(pbshap.ProfileHollow, Is.EqualTo(p.Shape.ProfileHollow), "Assert.That(pbshap.ProfileHollow, Is.EqualTo(p.Shape.ProfileHollow))"); |
416 | } | 416 | } |
417 | 417 | ||
418 | [Test] | 418 | [Test] |
419 | public void T014_UpdateObject() | 419 | public void T014_UpdateObject() |
420 | { | 420 | { |
421 | TestHelpers.InMethod(); | 421 | TestHelpers.InMethod(); |
422 | 422 | ||
423 | string text1 = "object1 text"; | 423 | string text1 = "object1 text"; |
424 | SceneObjectGroup sog = FindSOG("object1", region1); | 424 | SceneObjectGroup sog = FindSOG("object1", region1); |
425 | sog.RootPart.Text = text1; | 425 | sog.RootPart.Text = text1; |
@@ -459,7 +459,7 @@ namespace OpenSim.Data.Tests | |||
459 | PrimitiveBaseShape pbshap = new PrimitiveBaseShape(); | 459 | PrimitiveBaseShape pbshap = new PrimitiveBaseShape(); |
460 | pbshap = PrimitiveBaseShape.Default; | 460 | pbshap = PrimitiveBaseShape.Default; |
461 | Vector3 scale = new Vector3(random.Next(),random.Next(),random.Next()); | 461 | Vector3 scale = new Vector3(random.Next(),random.Next(),random.Next()); |
462 | 462 | ||
463 | // Updates the region with new values | 463 | // Updates the region with new values |
464 | SceneObjectGroup sog2 = FindSOG("Adam West", region3); | 464 | SceneObjectGroup sog2 = FindSOG("Adam West", region3); |
465 | Assert.That(sog2,Is.Not.Null); | 465 | Assert.That(sog2,Is.Not.Null); |
@@ -488,11 +488,11 @@ namespace OpenSim.Data.Tests | |||
488 | sog2.RootPart.LinkNum = linknum; | 488 | sog2.RootPart.LinkNum = linknum; |
489 | sog2.RootPart.ClickAction = clickaction; | 489 | sog2.RootPart.ClickAction = clickaction; |
490 | sog2.RootPart.Scale = scale; | 490 | sog2.RootPart.Scale = scale; |
491 | 491 | ||
492 | db.StoreObject(sog2, region3); | 492 | db.StoreObject(sog2, region3); |
493 | List<SceneObjectGroup> sogs = db.LoadObjects(region3); | 493 | List<SceneObjectGroup> sogs = db.LoadObjects(region3); |
494 | Assert.That(sogs.Count, Is.EqualTo(1), "Assert.That(sogs.Count, Is.EqualTo(1))"); | 494 | Assert.That(sogs.Count, Is.EqualTo(1), "Assert.That(sogs.Count, Is.EqualTo(1))"); |
495 | 495 | ||
496 | SceneObjectGroup retsog = FindSOG("West Adam", region3); | 496 | SceneObjectGroup retsog = FindSOG("West Adam", region3); |
497 | Assert.That(retsog,Is.Not.Null); | 497 | Assert.That(retsog,Is.Not.Null); |
498 | SceneObjectPart p = retsog.RootPart; | 498 | SceneObjectPart p = retsog.RootPart; |
@@ -519,7 +519,7 @@ namespace OpenSim.Data.Tests | |||
519 | Assert.That(clickaction,Is.EqualTo(p.ClickAction), "Assert.That(clickaction,Is.EqualTo(p.ClickAction))"); | 519 | Assert.That(clickaction,Is.EqualTo(p.ClickAction), "Assert.That(clickaction,Is.EqualTo(p.ClickAction))"); |
520 | Assert.That(scale,Is.EqualTo(p.Scale), "Assert.That(scale,Is.EqualTo(p.Scale))"); | 520 | Assert.That(scale,Is.EqualTo(p.Scale), "Assert.That(scale,Is.EqualTo(p.Scale))"); |
521 | } | 521 | } |
522 | 522 | ||
523 | /// <summary> | 523 | /// <summary> |
524 | /// Test storage and retrieval of a scene object with a large number of parts. | 524 | /// Test storage and retrieval of a scene object with a large number of parts. |
525 | /// </summary> | 525 | /// </summary> |
@@ -527,12 +527,12 @@ namespace OpenSim.Data.Tests | |||
527 | public void T015_LargeSceneObjects() | 527 | public void T015_LargeSceneObjects() |
528 | { | 528 | { |
529 | TestHelpers.InMethod(); | 529 | TestHelpers.InMethod(); |
530 | 530 | ||
531 | UUID id = UUID.Random(); | 531 | UUID id = UUID.Random(); |
532 | Dictionary<UUID, SceneObjectPart> mydic = new Dictionary<UUID, SceneObjectPart>(); | 532 | Dictionary<UUID, SceneObjectPart> mydic = new Dictionary<UUID, SceneObjectPart>(); |
533 | SceneObjectGroup sog = NewSOG("Test SOG", id, region4); | 533 | SceneObjectGroup sog = NewSOG("Test SOG", id, region4); |
534 | mydic.Add(sog.RootPart.UUID,sog.RootPart); | 534 | mydic.Add(sog.RootPart.UUID,sog.RootPart); |
535 | for (int i = 0; i < 30; i++) | 535 | for (int i = 0; i < 30; i++) |
536 | { | 536 | { |
537 | UUID tmp = UUID.Random(); | 537 | UUID tmp = UUID.Random(); |
538 | SceneObjectPart sop = NewSOP(("Test SOP " + i.ToString()),tmp); | 538 | SceneObjectPart sop = NewSOP(("Test SOP " + i.ToString()),tmp); |
@@ -542,20 +542,20 @@ namespace OpenSim.Data.Tests | |||
542 | Vector3 velocity = new Vector3(random.Next(),random.Next(),random.Next()); | 542 | Vector3 velocity = new Vector3(random.Next(),random.Next(),random.Next()); |
543 | Vector3 angvelo = new Vector3(random.Next(),random.Next(),random.Next()); | 543 | Vector3 angvelo = new Vector3(random.Next(),random.Next(),random.Next()); |
544 | Vector3 accel = new Vector3(random.Next(),random.Next(),random.Next()); | 544 | Vector3 accel = new Vector3(random.Next(),random.Next(),random.Next()); |
545 | 545 | ||
546 | sop.GroupPosition = groupos; | 546 | sop.GroupPosition = groupos; |
547 | sop.RotationOffset = rotoff; | 547 | sop.RotationOffset = rotoff; |
548 | sop.OffsetPosition = offset; | 548 | sop.OffsetPosition = offset; |
549 | sop.Velocity = velocity; | 549 | sop.Velocity = velocity; |
550 | sop.AngularVelocity = angvelo; | 550 | sop.AngularVelocity = angvelo; |
551 | sop.Acceleration = accel; | 551 | sop.Acceleration = accel; |
552 | 552 | ||
553 | mydic.Add(tmp,sop); | 553 | mydic.Add(tmp,sop); |
554 | sog.AddPart(sop); | 554 | sog.AddPart(sop); |
555 | } | 555 | } |
556 | 556 | ||
557 | db.StoreObject(sog, region4); | 557 | db.StoreObject(sog, region4); |
558 | 558 | ||
559 | SceneObjectGroup retsog = FindSOG("Test SOG", region4); | 559 | SceneObjectGroup retsog = FindSOG("Test SOG", region4); |
560 | SceneObjectPart[] parts = retsog.Parts; | 560 | SceneObjectPart[] parts = retsog.Parts; |
561 | for (int i = 0; i < 30; i++) | 561 | for (int i = 0; i < 30; i++) |
@@ -574,7 +574,7 @@ namespace OpenSim.Data.Tests | |||
574 | public void T016_RandomSogWithSceneParts() | 574 | public void T016_RandomSogWithSceneParts() |
575 | { | 575 | { |
576 | TestHelpers.InMethod(); | 576 | TestHelpers.InMethod(); |
577 | 577 | ||
578 | PropertyScrambler<SceneObjectPart> scrambler = | 578 | PropertyScrambler<SceneObjectPart> scrambler = |
579 | new PropertyScrambler<SceneObjectPart>() | 579 | new PropertyScrambler<SceneObjectPart>() |
580 | .DontScramble(x => x.UUID); | 580 | .DontScramble(x => x.UUID); |
@@ -634,22 +634,22 @@ namespace OpenSim.Data.Tests | |||
634 | SceneObjectGroup sog = FindSOG(name, region1); | 634 | SceneObjectGroup sog = FindSOG(name, region1); |
635 | if (sog == null) | 635 | if (sog == null) |
636 | { | 636 | { |
637 | sog = NewSOG(name, prim1, region1); | 637 | sog = NewSOG(name, prim1, region1); |
638 | db.StoreObject(sog, region1); | 638 | db.StoreObject(sog, region1); |
639 | } | 639 | } |
640 | return sog; | 640 | return sog; |
641 | } | 641 | } |
642 | 642 | ||
643 | // NOTE: it is a bad practice to rely on some of the previous tests having been run before. | 643 | // NOTE: it is a bad practice to rely on some of the previous tests having been run before. |
644 | // If the tests are run manually, one at a time, each starts with full class init (DB cleared). | 644 | // If the tests are run manually, one at a time, each starts with full class init (DB cleared). |
645 | // Even when all tests are run, NUnit 2.5+ no longer guarantee a specific test order. | 645 | // Even when all tests are run, NUnit 2.5+ no longer guarantee a specific test order. |
646 | // We shouldn't expect to find anything in the DB if we haven't put it there *in the same test*! | 646 | // We shouldn't expect to find anything in the DB if we haven't put it there *in the same test*! |
647 | 647 | ||
648 | [Test] | 648 | [Test] |
649 | public void T020_PrimInventoryEmpty() | 649 | public void T020_PrimInventoryEmpty() |
650 | { | 650 | { |
651 | TestHelpers.InMethod(); | 651 | TestHelpers.InMethod(); |
652 | 652 | ||
653 | SceneObjectGroup sog = GetMySOG("object1"); | 653 | SceneObjectGroup sog = GetMySOG("object1"); |
654 | TaskInventoryItem t = sog.GetInventoryItem(sog.RootPart.LocalId, item1); | 654 | TaskInventoryItem t = sog.GetInventoryItem(sog.RootPart.LocalId, item1); |
655 | Assert.That(t, Is.Null); | 655 | Assert.That(t, Is.Null); |
@@ -673,14 +673,14 @@ namespace OpenSim.Data.Tests | |||
673 | public void T021_PrimInventoryBasic() | 673 | public void T021_PrimInventoryBasic() |
674 | { | 674 | { |
675 | TestHelpers.InMethod(); | 675 | TestHelpers.InMethod(); |
676 | 676 | ||
677 | SceneObjectGroup sog = GetMySOG("object1"); | 677 | SceneObjectGroup sog = GetMySOG("object1"); |
678 | InventoryItemBase i = NewItem(item1, zero, zero, itemname1, zero); | 678 | InventoryItemBase i = NewItem(item1, zero, zero, itemname1, zero); |
679 | 679 | ||
680 | Assert.That(sog.AddInventoryItem(zero, sog.RootPart.LocalId, i, zero), Is.True); | 680 | Assert.That(sog.AddInventoryItem(zero, sog.RootPart.LocalId, i, zero), Is.True); |
681 | TaskInventoryItem t = sog.GetInventoryItem(sog.RootPart.LocalId, item1); | 681 | TaskInventoryItem t = sog.GetInventoryItem(sog.RootPart.LocalId, item1); |
682 | Assert.That(t.Name, Is.EqualTo(itemname1), "Assert.That(t.Name, Is.EqualTo(itemname1))"); | 682 | Assert.That(t.Name, Is.EqualTo(itemname1), "Assert.That(t.Name, Is.EqualTo(itemname1))"); |
683 | 683 | ||
684 | StoreInventory(sog); | 684 | StoreInventory(sog); |
685 | 685 | ||
686 | SceneObjectGroup sog1 = FindSOG("object1", region1); | 686 | SceneObjectGroup sog1 = FindSOG("object1", region1); |
@@ -708,12 +708,12 @@ namespace OpenSim.Data.Tests | |||
708 | t = sog.GetInventoryItem(sog.RootPart.LocalId, item1); | 708 | t = sog.GetInventoryItem(sog.RootPart.LocalId, item1); |
709 | Assert.That(t, Is.Null); | 709 | Assert.That(t, Is.Null); |
710 | } | 710 | } |
711 | 711 | ||
712 | [Test] | 712 | [Test] |
713 | public void T025_PrimInventoryPersistency() | 713 | public void T025_PrimInventoryPersistency() |
714 | { | 714 | { |
715 | TestHelpers.InMethod(); | 715 | TestHelpers.InMethod(); |
716 | 716 | ||
717 | InventoryItemBase i = new InventoryItemBase(); | 717 | InventoryItemBase i = new InventoryItemBase(); |
718 | UUID id = UUID.Random(); | 718 | UUID id = UUID.Random(); |
719 | i.ID = id; | 719 | i.ID = id; |
@@ -752,11 +752,11 @@ namespace OpenSim.Data.Tests | |||
752 | i.Flags = flags; | 752 | i.Flags = flags; |
753 | int creationd = random.Next(); | 753 | int creationd = random.Next(); |
754 | i.CreationDate = creationd; | 754 | i.CreationDate = creationd; |
755 | 755 | ||
756 | SceneObjectGroup sog = GetMySOG("object1"); | 756 | SceneObjectGroup sog = GetMySOG("object1"); |
757 | Assert.That(sog.AddInventoryItem(zero, sog.RootPart.LocalId, i, zero), Is.True); | 757 | Assert.That(sog.AddInventoryItem(zero, sog.RootPart.LocalId, i, zero), Is.True); |
758 | TaskInventoryItem t = sog.GetInventoryItem(sog.RootPart.LocalId, id); | 758 | TaskInventoryItem t = sog.GetInventoryItem(sog.RootPart.LocalId, id); |
759 | 759 | ||
760 | Assert.That(t.Name, Is.EqualTo(name), "Assert.That(t.Name, Is.EqualTo(name))"); | 760 | Assert.That(t.Name, Is.EqualTo(name), "Assert.That(t.Name, Is.EqualTo(name))"); |
761 | Assert.That(t.AssetID,Is.EqualTo(assetid), "Assert.That(t.AssetID,Is.EqualTo(assetid))"); | 761 | Assert.That(t.AssetID,Is.EqualTo(assetid), "Assert.That(t.AssetID,Is.EqualTo(assetid))"); |
762 | Assert.That(t.BasePermissions,Is.EqualTo(baseperm), "Assert.That(t.BasePermissions,Is.EqualTo(baseperm))"); | 762 | Assert.That(t.BasePermissions,Is.EqualTo(baseperm), "Assert.That(t.BasePermissions,Is.EqualTo(baseperm))"); |
@@ -780,13 +780,13 @@ namespace OpenSim.Data.Tests | |||
780 | Assert.That(t.ParentID,Is.EqualTo(sog.RootPart.FolderID), "Assert.That(t.ParentID,Is.EqualTo(sog.RootPart.FolderID))"); | 780 | Assert.That(t.ParentID,Is.EqualTo(sog.RootPart.FolderID), "Assert.That(t.ParentID,Is.EqualTo(sog.RootPart.FolderID))"); |
781 | Assert.That(t.ParentPartID,Is.EqualTo(sog.RootPart.UUID), "Assert.That(t.ParentPartID,Is.EqualTo(sog.RootPart.UUID))"); | 781 | Assert.That(t.ParentPartID,Is.EqualTo(sog.RootPart.UUID), "Assert.That(t.ParentPartID,Is.EqualTo(sog.RootPart.UUID))"); |
782 | } | 782 | } |
783 | 783 | ||
784 | [Test] | 784 | [Test] |
785 | [ExpectedException(typeof(ArgumentException))] | 785 | [ExpectedException(typeof(ArgumentException))] |
786 | public void T026_PrimInventoryMany() | 786 | public void T026_PrimInventoryMany() |
787 | { | 787 | { |
788 | TestHelpers.InMethod(); | 788 | TestHelpers.InMethod(); |
789 | 789 | ||
790 | UUID i1,i2,i3,i4; | 790 | UUID i1,i2,i3,i4; |
791 | i1 = UUID.Random(); | 791 | i1 = UUID.Random(); |
792 | i2 = UUID.Random(); | 792 | i2 = UUID.Random(); |
@@ -796,14 +796,14 @@ namespace OpenSim.Data.Tests | |||
796 | InventoryItemBase ib2 = NewItem(i2, zero, zero, RandomName(), zero); | 796 | InventoryItemBase ib2 = NewItem(i2, zero, zero, RandomName(), zero); |
797 | InventoryItemBase ib3 = NewItem(i3, zero, zero, RandomName(), zero); | 797 | InventoryItemBase ib3 = NewItem(i3, zero, zero, RandomName(), zero); |
798 | InventoryItemBase ib4 = NewItem(i4, zero, zero, RandomName(), zero); | 798 | InventoryItemBase ib4 = NewItem(i4, zero, zero, RandomName(), zero); |
799 | 799 | ||
800 | SceneObjectGroup sog = FindSOG("object1", region1); | 800 | SceneObjectGroup sog = FindSOG("object1", region1); |
801 | 801 | ||
802 | Assert.That(sog.AddInventoryItem(zero, sog.RootPart.LocalId, ib1, zero), Is.True); | 802 | Assert.That(sog.AddInventoryItem(zero, sog.RootPart.LocalId, ib1, zero), Is.True); |
803 | Assert.That(sog.AddInventoryItem(zero, sog.RootPart.LocalId, ib2, zero), Is.True); | 803 | Assert.That(sog.AddInventoryItem(zero, sog.RootPart.LocalId, ib2, zero), Is.True); |
804 | Assert.That(sog.AddInventoryItem(zero, sog.RootPart.LocalId, ib3, zero), Is.True); | 804 | Assert.That(sog.AddInventoryItem(zero, sog.RootPart.LocalId, ib3, zero), Is.True); |
805 | Assert.That(sog.AddInventoryItem(zero, sog.RootPart.LocalId, ib4, zero), Is.True); | 805 | Assert.That(sog.AddInventoryItem(zero, sog.RootPart.LocalId, ib4, zero), Is.True); |
806 | 806 | ||
807 | TaskInventoryItem t1 = sog.GetInventoryItem(sog.RootPart.LocalId, i1); | 807 | TaskInventoryItem t1 = sog.GetInventoryItem(sog.RootPart.LocalId, i1); |
808 | Assert.That(t1.Name, Is.EqualTo(ib1.Name), "Assert.That(t1.Name, Is.EqualTo(ib1.Name))"); | 808 | Assert.That(t1.Name, Is.EqualTo(ib1.Name), "Assert.That(t1.Name, Is.EqualTo(ib1.Name))"); |
809 | TaskInventoryItem t2 = sog.GetInventoryItem(sog.RootPart.LocalId, i2); | 809 | TaskInventoryItem t2 = sog.GetInventoryItem(sog.RootPart.LocalId, i2); |
@@ -818,7 +818,7 @@ namespace OpenSim.Data.Tests | |||
818 | public void T052_RemoveObject() | 818 | public void T052_RemoveObject() |
819 | { | 819 | { |
820 | TestHelpers.InMethod(); | 820 | TestHelpers.InMethod(); |
821 | 821 | ||
822 | db.RemoveObject(prim1, region1); | 822 | db.RemoveObject(prim1, region1); |
823 | SceneObjectGroup sog = FindSOG("object1", region1); | 823 | SceneObjectGroup sog = FindSOG("object1", region1); |
824 | Assert.That(sog, Is.Null); | 824 | Assert.That(sog, Is.Null); |
@@ -828,7 +828,7 @@ namespace OpenSim.Data.Tests | |||
828 | public void T100_DefaultRegionInfo() | 828 | public void T100_DefaultRegionInfo() |
829 | { | 829 | { |
830 | TestHelpers.InMethod(); | 830 | TestHelpers.InMethod(); |
831 | 831 | ||
832 | RegionSettings r1 = db.LoadRegionSettings(region1); | 832 | RegionSettings r1 = db.LoadRegionSettings(region1); |
833 | Assert.That(r1.RegionUUID, Is.EqualTo(region1), "Assert.That(r1.RegionUUID, Is.EqualTo(region1))"); | 833 | Assert.That(r1.RegionUUID, Is.EqualTo(region1), "Assert.That(r1.RegionUUID, Is.EqualTo(region1))"); |
834 | 834 | ||
@@ -840,7 +840,7 @@ namespace OpenSim.Data.Tests | |||
840 | public void T101_UpdateRegionInfo() | 840 | public void T101_UpdateRegionInfo() |
841 | { | 841 | { |
842 | TestHelpers.InMethod(); | 842 | TestHelpers.InMethod(); |
843 | 843 | ||
844 | int agentlimit = random.Next(); | 844 | int agentlimit = random.Next(); |
845 | double objectbonus = random.Next(); | 845 | double objectbonus = random.Next(); |
846 | int maturity = random.Next(); | 846 | int maturity = random.Next(); |
@@ -900,9 +900,9 @@ namespace OpenSim.Data.Tests | |||
900 | r1.FixedSun = true; | 900 | r1.FixedSun = true; |
901 | r1.SunPosition = sunpos; | 901 | r1.SunPosition = sunpos; |
902 | r1.Covenant = cov; | 902 | r1.Covenant = cov; |
903 | 903 | ||
904 | db.StoreRegionSettings(r1); | 904 | db.StoreRegionSettings(r1); |
905 | 905 | ||
906 | RegionSettings r1a = db.LoadRegionSettings(region1); | 906 | RegionSettings r1a = db.LoadRegionSettings(region1); |
907 | Assert.That(r1a.RegionUUID, Is.EqualTo(region1), "Assert.That(r1a.RegionUUID, Is.EqualTo(region1))"); | 907 | Assert.That(r1a.RegionUUID, Is.EqualTo(region1), "Assert.That(r1a.RegionUUID, Is.EqualTo(region1))"); |
908 | Assert.That(r1a.BlockTerraform,Is.True); | 908 | Assert.That(r1a.BlockTerraform,Is.True); |
@@ -939,14 +939,14 @@ namespace OpenSim.Data.Tests | |||
939 | //Assert.That(r1a.TerrainImageID,Is.EqualTo(terimgid), "Assert.That(r1a.TerrainImageID,Is.EqualTo(terimgid))"); | 939 | //Assert.That(r1a.TerrainImageID,Is.EqualTo(terimgid), "Assert.That(r1a.TerrainImageID,Is.EqualTo(terimgid))"); |
940 | Assert.That(r1a.FixedSun,Is.True); | 940 | Assert.That(r1a.FixedSun,Is.True); |
941 | Assert.That(r1a.SunPosition, Is.EqualTo(sunpos), "Assert.That(r1a.SunPosition, Is.EqualTo(sunpos))"); | 941 | Assert.That(r1a.SunPosition, Is.EqualTo(sunpos), "Assert.That(r1a.SunPosition, Is.EqualTo(sunpos))"); |
942 | Assert.That(r1a.Covenant, Is.EqualTo(cov), "Assert.That(r1a.Covenant, Is.EqualTo(cov))"); | 942 | Assert.That(r1a.Covenant, Is.EqualTo(cov), "Assert.That(r1a.Covenant, Is.EqualTo(cov))"); |
943 | } | 943 | } |
944 | 944 | ||
945 | [Test] | 945 | [Test] |
946 | public void T300_NoTerrain() | 946 | public void T300_NoTerrain() |
947 | { | 947 | { |
948 | TestHelpers.InMethod(); | 948 | TestHelpers.InMethod(); |
949 | 949 | ||
950 | Assert.That(db.LoadTerrain(zero), Is.Null); | 950 | Assert.That(db.LoadTerrain(zero), Is.Null); |
951 | Assert.That(db.LoadTerrain(region1), Is.Null); | 951 | Assert.That(db.LoadTerrain(region1), Is.Null); |
952 | Assert.That(db.LoadTerrain(region2), Is.Null); | 952 | Assert.That(db.LoadTerrain(region2), Is.Null); |
@@ -957,13 +957,13 @@ namespace OpenSim.Data.Tests | |||
957 | public void T301_CreateTerrain() | 957 | public void T301_CreateTerrain() |
958 | { | 958 | { |
959 | TestHelpers.InMethod(); | 959 | TestHelpers.InMethod(); |
960 | 960 | ||
961 | double[,] t1 = GenTerrain(height1); | 961 | double[,] t1 = GenTerrain(height1); |
962 | db.StoreTerrain(t1, region1); | 962 | db.StoreTerrain(t1, region1); |
963 | 963 | ||
964 | // store terrain is async | 964 | // store terrain is async |
965 | Thread.Sleep(1000); | 965 | Thread.Sleep(1000); |
966 | 966 | ||
967 | Assert.That(db.LoadTerrain(zero), Is.Null); | 967 | Assert.That(db.LoadTerrain(zero), Is.Null); |
968 | Assert.That(db.LoadTerrain(region1), Is.Not.Null); | 968 | Assert.That(db.LoadTerrain(region1), Is.Not.Null); |
969 | Assert.That(db.LoadTerrain(region2), Is.Null); | 969 | Assert.That(db.LoadTerrain(region2), Is.Null); |
@@ -974,7 +974,7 @@ namespace OpenSim.Data.Tests | |||
974 | public void T302_FetchTerrain() | 974 | public void T302_FetchTerrain() |
975 | { | 975 | { |
976 | TestHelpers.InMethod(); | 976 | TestHelpers.InMethod(); |
977 | 977 | ||
978 | double[,] baseterrain1 = GenTerrain(height1); | 978 | double[,] baseterrain1 = GenTerrain(height1); |
979 | double[,] baseterrain2 = GenTerrain(height2); | 979 | double[,] baseterrain2 = GenTerrain(height2); |
980 | double[,] t1 = db.LoadTerrain(region1); | 980 | double[,] t1 = db.LoadTerrain(region1); |
@@ -986,7 +986,7 @@ namespace OpenSim.Data.Tests | |||
986 | public void T303_UpdateTerrain() | 986 | public void T303_UpdateTerrain() |
987 | { | 987 | { |
988 | TestHelpers.InMethod(); | 988 | TestHelpers.InMethod(); |
989 | 989 | ||
990 | double[,] baseterrain1 = GenTerrain(height1); | 990 | double[,] baseterrain1 = GenTerrain(height1); |
991 | double[,] baseterrain2 = GenTerrain(height2); | 991 | double[,] baseterrain2 = GenTerrain(height2); |
992 | db.StoreTerrain(baseterrain2, region1); | 992 | db.StoreTerrain(baseterrain2, region1); |
@@ -1003,7 +1003,7 @@ namespace OpenSim.Data.Tests | |||
1003 | public void T400_EmptyLand() | 1003 | public void T400_EmptyLand() |
1004 | { | 1004 | { |
1005 | TestHelpers.InMethod(); | 1005 | TestHelpers.InMethod(); |
1006 | 1006 | ||
1007 | Assert.That(db.LoadLandObjects(zero).Count, Is.EqualTo(0), "Assert.That(db.LoadLandObjects(zero).Count, Is.EqualTo(0))"); | 1007 | Assert.That(db.LoadLandObjects(zero).Count, Is.EqualTo(0), "Assert.That(db.LoadLandObjects(zero).Count, Is.EqualTo(0))"); |
1008 | Assert.That(db.LoadLandObjects(region1).Count, Is.EqualTo(0), "Assert.That(db.LoadLandObjects(region1).Count, Is.EqualTo(0))"); | 1008 | Assert.That(db.LoadLandObjects(region1).Count, Is.EqualTo(0), "Assert.That(db.LoadLandObjects(region1).Count, Is.EqualTo(0))"); |
1009 | Assert.That(db.LoadLandObjects(region2).Count, Is.EqualTo(0), "Assert.That(db.LoadLandObjects(region2).Count, Is.EqualTo(0))"); | 1009 | Assert.That(db.LoadLandObjects(region2).Count, Is.EqualTo(0), "Assert.That(db.LoadLandObjects(region2).Count, Is.EqualTo(0))"); |
@@ -1025,15 +1025,15 @@ namespace OpenSim.Data.Tests | |||
1025 | for (int x = 0; x < Constants.RegionSize; x++) | 1025 | for (int x = 0; x < Constants.RegionSize; x++) |
1026 | for (int y = 0; y < Constants.RegionSize; y++) | 1026 | for (int y = 0; y < Constants.RegionSize; y++) |
1027 | terret[x,y] = value; | 1027 | terret[x,y] = value; |
1028 | 1028 | ||
1029 | return terret; | 1029 | return terret; |
1030 | } | 1030 | } |
1031 | 1031 | ||
1032 | private bool CompareTerrain(double[,] one, double[,] two) | 1032 | private bool CompareTerrain(double[,] one, double[,] two) |
1033 | { | 1033 | { |
1034 | for (int x = 0; x < Constants.RegionSize; x++) | 1034 | for (int x = 0; x < Constants.RegionSize; x++) |
1035 | for (int y = 0; y < Constants.RegionSize; y++) | 1035 | for (int y = 0; y < Constants.RegionSize; y++) |
1036 | if (one[x,y] != two[x,y]) | 1036 | if (one[x,y] != two[x,y]) |
1037 | return false; | 1037 | return false; |
1038 | 1038 | ||
1039 | return true; | 1039 | return true; |
@@ -1053,12 +1053,12 @@ namespace OpenSim.Data.Tests | |||
1053 | // common failure case is people adding new fields that aren't | 1053 | // common failure case is people adding new fields that aren't |
1054 | // initialized, but have non-null db constraints. We should | 1054 | // initialized, but have non-null db constraints. We should |
1055 | // honestly be passing more and more null things in here. | 1055 | // honestly be passing more and more null things in here. |
1056 | // | 1056 | // |
1057 | // Please note that in Sqlite.BuildPrim there is a commented out inline version | 1057 | // Please note that in Sqlite.BuildPrim there is a commented out inline version |
1058 | // of this so you can debug and step through the build process and check the fields | 1058 | // of this so you can debug and step through the build process and check the fields |
1059 | // | 1059 | // |
1060 | // Real World Value: Tests for situation where extending a SceneObjectGroup/SceneObjectPart | 1060 | // Real World Value: Tests for situation where extending a SceneObjectGroup/SceneObjectPart |
1061 | // causes the application to crash at the database layer because of null values | 1061 | // causes the application to crash at the database layer because of null values |
1062 | // in NOT NULL fields | 1062 | // in NOT NULL fields |
1063 | // | 1063 | // |
1064 | private SceneObjectGroup NewSOG(string name, UUID uuid, UUID regionId) | 1064 | private SceneObjectGroup NewSOG(string name, UUID uuid, UUID regionId) |
@@ -1082,7 +1082,7 @@ namespace OpenSim.Data.Tests | |||
1082 | 1082 | ||
1083 | return sog; | 1083 | return sog; |
1084 | } | 1084 | } |
1085 | 1085 | ||
1086 | private SceneObjectPart NewSOP(string name, UUID uuid) | 1086 | private SceneObjectPart NewSOP(string name, UUID uuid) |
1087 | { | 1087 | { |
1088 | SceneObjectPart sop = new SceneObjectPart(); | 1088 | SceneObjectPart sop = new SceneObjectPart(); |
@@ -1096,7 +1096,7 @@ namespace OpenSim.Data.Tests | |||
1096 | return sop; | 1096 | return sop; |
1097 | } | 1097 | } |
1098 | 1098 | ||
1099 | // These are copied from the Inventory Item tests | 1099 | // These are copied from the Inventory Item tests |
1100 | 1100 | ||
1101 | private InventoryItemBase NewItem(UUID id, UUID parent, UUID owner, string name, UUID asset) | 1101 | private InventoryItemBase NewItem(UUID id, UUID parent, UUID owner, string name, UUID asset) |
1102 | { | 1102 | { |
@@ -1114,7 +1114,7 @@ namespace OpenSim.Data.Tests | |||
1114 | private static string RandomName() | 1114 | private static string RandomName() |
1115 | { | 1115 | { |
1116 | StringBuilder name = new StringBuilder(); | 1116 | StringBuilder name = new StringBuilder(); |
1117 | int size = random.Next(5,12); | 1117 | int size = random.Next(5,12); |
1118 | char ch ; | 1118 | char ch ; |
1119 | for (int i=0; i<size; i++) | 1119 | for (int i=0; i<size; i++) |
1120 | { | 1120 | { |