aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/Tests/RegionTests.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Data/Tests/RegionTests.cs')
-rw-r--r--OpenSim/Data/Tests/RegionTests.cs88
1 files changed, 58 insertions, 30 deletions
diff --git a/OpenSim/Data/Tests/RegionTests.cs b/OpenSim/Data/Tests/RegionTests.cs
index 9598716..44cf1ab 100644
--- a/OpenSim/Data/Tests/RegionTests.cs
+++ b/OpenSim/Data/Tests/RegionTests.cs
@@ -35,6 +35,7 @@ using OpenMetaverse;
35using OpenSim.Framework; 35using OpenSim.Framework;
36using OpenSim.Region.Framework.Interfaces; 36using OpenSim.Region.Framework.Interfaces;
37using OpenSim.Region.Framework.Scenes; 37using OpenSim.Region.Framework.Scenes;
38using OpenSim.Tests.Common;
38using log4net; 39using log4net;
39using System.Reflection; 40using System.Reflection;
40using System.Data.Common; 41using System.Data.Common;
@@ -120,15 +121,18 @@ namespace OpenSim.Data.Tests
120 string[] reg_tables = new string[] { 121 string[] reg_tables = new string[] {
121 "prims", "primshapes", "primitems", "terrain", "land", "landaccesslist", "regionban", "regionsettings" 122 "prims", "primshapes", "primitems", "terrain", "land", "landaccesslist", "regionban", "regionsettings"
122 }; 123 };
124
123 if (m_rebuildDB) 125 if (m_rebuildDB)
124 { 126 {
125 DropTables(reg_tables); 127 DropTables(reg_tables);
126 ResetMigrations("RegionStore"); 128 ResetMigrations("RegionStore");
127 }else 129 }
130 else
131 {
128 ClearTables(reg_tables); 132 ClearTables(reg_tables);
133 }
129 } 134 }
130 135
131
132 // Test Plan 136 // Test Plan
133 // Prims 137 // Prims
134 // - empty test - 001 138 // - empty test - 001
@@ -147,6 +151,8 @@ namespace OpenSim.Data.Tests
147 [Test] 151 [Test]
148 public void T001_LoadEmpty() 152 public void T001_LoadEmpty()
149 { 153 {
154 TestHelper.InMethod();
155
150 List<SceneObjectGroup> objs = db.LoadObjects(region1); 156 List<SceneObjectGroup> objs = db.LoadObjects(region1);
151 List<SceneObjectGroup> objs3 = db.LoadObjects(region3); 157 List<SceneObjectGroup> objs3 = db.LoadObjects(region3);
152 List<LandData> land = db.LoadLandObjects(region1); 158 List<LandData> land = db.LoadLandObjects(region1);
@@ -163,6 +169,8 @@ namespace OpenSim.Data.Tests
163 [Test] 169 [Test]
164 public void T010_StoreSimpleObject() 170 public void T010_StoreSimpleObject()
165 { 171 {
172 TestHelper.InMethod();
173
166 SceneObjectGroup sog = NewSOG("object1", prim1, region1); 174 SceneObjectGroup sog = NewSOG("object1", prim1, region1);
167 SceneObjectGroup sog2 = NewSOG("object2", prim2, region1); 175 SceneObjectGroup sog2 = NewSOG("object2", prim2, region1);
168 176
@@ -196,6 +204,8 @@ namespace OpenSim.Data.Tests
196 [Test] 204 [Test]
197 public void T011_ObjectNames() 205 public void T011_ObjectNames()
198 { 206 {
207 TestHelper.InMethod();
208
199 List<SceneObjectGroup> objs = db.LoadObjects(region1); 209 List<SceneObjectGroup> objs = db.LoadObjects(region1);
200 foreach (SceneObjectGroup sog in objs) 210 foreach (SceneObjectGroup sog in objs)
201 { 211 {
@@ -208,6 +218,8 @@ namespace OpenSim.Data.Tests
208 [Test] 218 [Test]
209 public void T012_SceneParts() 219 public void T012_SceneParts()
210 { 220 {
221 TestHelper.InMethod();
222
211 UUID tmp0 = UUID.Random(); 223 UUID tmp0 = UUID.Random();
212 UUID tmp1 = UUID.Random(); 224 UUID tmp1 = UUID.Random();
213 UUID tmp2 = UUID.Random(); 225 UUID tmp2 = UUID.Random();
@@ -241,6 +253,8 @@ namespace OpenSim.Data.Tests
241 [Test] 253 [Test]
242 public void T013_DatabasePersistency() 254 public void T013_DatabasePersistency()
243 { 255 {
256 TestHelper.InMethod();
257
244 // Sets all ScenePart parameters, stores and retrieves them, then check for consistency with initial data 258 // Sets all ScenePart parameters, stores and retrieves them, then check for consistency with initial data
245 // The commented Asserts are the ones that are unchangeable (when storing on the database, their "Set" values are ignored 259 // The commented Asserts are the ones that are unchangeable (when storing on the database, their "Set" values are ignored
246 // The ObjectFlags is an exception, if it is entered incorrectly, the object IS REJECTED on the database silently. 260 // The ObjectFlags is an exception, if it is entered incorrectly, the object IS REJECTED on the database silently.
@@ -416,6 +430,8 @@ namespace OpenSim.Data.Tests
416 [Test] 430 [Test]
417 public void T014_UpdateObject() 431 public void T014_UpdateObject()
418 { 432 {
433 TestHelper.InMethod();
434
419 string text1 = "object1 text"; 435 string text1 = "object1 text";
420 SceneObjectGroup sog = FindSOG("object1", region1); 436 SceneObjectGroup sog = FindSOG("object1", region1);
421 sog.RootPart.Text = text1; 437 sog.RootPart.Text = text1;
@@ -517,15 +533,20 @@ namespace OpenSim.Data.Tests
517 Assert.That(clickaction,Is.EqualTo(p.ClickAction), "Assert.That(clickaction,Is.EqualTo(p.ClickAction))"); 533 Assert.That(clickaction,Is.EqualTo(p.ClickAction), "Assert.That(clickaction,Is.EqualTo(p.ClickAction))");
518 Assert.That(scale,Is.EqualTo(p.Scale), "Assert.That(scale,Is.EqualTo(p.Scale))"); 534 Assert.That(scale,Is.EqualTo(p.Scale), "Assert.That(scale,Is.EqualTo(p.Scale))");
519 } 535 }
520 536
537 /// <summary>
538 /// Test storage and retrieval of a scene object with a large number of parts.
539 /// </summary>
521 [Test] 540 [Test]
522 public void T015_LargeSceneObjects() 541 public void T015_LargeSceneObjects()
523 { 542 {
543 TestHelper.InMethod();
544
524 UUID id = UUID.Random(); 545 UUID id = UUID.Random();
525 Dictionary<UUID, SceneObjectPart> mydic = new Dictionary<UUID, SceneObjectPart>(); 546 Dictionary<UUID, SceneObjectPart> mydic = new Dictionary<UUID, SceneObjectPart>();
526 SceneObjectGroup sog = NewSOG("Test SOG", id, region4); 547 SceneObjectGroup sog = NewSOG("Test SOG", id, region4);
527 mydic.Add(sog.RootPart.UUID,sog.RootPart); 548 mydic.Add(sog.RootPart.UUID,sog.RootPart);
528 for (int i=0;i<30;i++) 549 for (int i = 0; i < 30; i++)
529 { 550 {
530 UUID tmp = UUID.Random(); 551 UUID tmp = UUID.Random();
531 SceneObjectPart sop = NewSOP(("Test SOP " + i.ToString()),tmp); 552 SceneObjectPart sop = NewSOP(("Test SOP " + i.ToString()),tmp);
@@ -544,13 +565,14 @@ namespace OpenSim.Data.Tests
544 sop.Acceleration = accel; 565 sop.Acceleration = accel;
545 566
546 mydic.Add(tmp,sop); 567 mydic.Add(tmp,sop);
547 sog.AddPart(sop); 568 sog.AddPart(sop);
548 db.StoreObject(sog, region4);
549 } 569 }
550 570
571 db.StoreObject(sog, region4);
572
551 SceneObjectGroup retsog = FindSOG("Test SOG", region4); 573 SceneObjectGroup retsog = FindSOG("Test SOG", region4);
552 SceneObjectPart[] parts = retsog.Parts; 574 SceneObjectPart[] parts = retsog.Parts;
553 for (int i=0;i<30;i++) 575 for (int i = 0; i < 30; i++)
554 { 576 {
555 SceneObjectPart cursop = mydic[parts[i].UUID]; 577 SceneObjectPart cursop = mydic[parts[i].UUID];
556 Assert.That(cursop.GroupPosition,Is.EqualTo(parts[i].GroupPosition), "Assert.That(cursop.GroupPosition,Is.EqualTo(parts[i].GroupPosition))"); 578 Assert.That(cursop.GroupPosition,Is.EqualTo(parts[i].GroupPosition), "Assert.That(cursop.GroupPosition,Is.EqualTo(parts[i].GroupPosition))");
@@ -565,6 +587,8 @@ namespace OpenSim.Data.Tests
565 //[Test] 587 //[Test]
566 public void T016_RandomSogWithSceneParts() 588 public void T016_RandomSogWithSceneParts()
567 { 589 {
590 TestHelper.InMethod();
591
568 PropertyScrambler<SceneObjectPart> scrambler = 592 PropertyScrambler<SceneObjectPart> scrambler =
569 new PropertyScrambler<SceneObjectPart>() 593 new PropertyScrambler<SceneObjectPart>()
570 .DontScramble(x => x.UUID); 594 .DontScramble(x => x.UUID);
@@ -631,15 +655,16 @@ namespace OpenSim.Data.Tests
631 return sog; 655 return sog;
632 } 656 }
633 657
634
635 // NOTE: it is a bad practice to rely on some of the previous tests having been run before. 658 // NOTE: it is a bad practice to rely on some of the previous tests having been run before.
636 // If the tests are run manually, one at a time, each starts with full class init (DB cleared). 659 // If the tests are run manually, one at a time, each starts with full class init (DB cleared).
637 // Even when all tests are run, NUnit 2.5+ no longer guarantee a specific test order. 660 // Even when all tests are run, NUnit 2.5+ no longer guarantee a specific test order.
638 // We shouldn't expect to find anything in the DB if we haven't put it there *in the same test*! 661 // We shouldn't expect to find anything in the DB if we haven't put it there *in the same test*!
639 662
640 [Test] 663 [Test]
641 public void T020_PrimInventoryEmpty() 664 public void T020_PrimInventoryEmpty()
642 { 665 {
666 TestHelper.InMethod();
667
643 SceneObjectGroup sog = GetMySOG("object1"); 668 SceneObjectGroup sog = GetMySOG("object1");
644 TaskInventoryItem t = sog.GetInventoryItem(sog.RootPart.LocalId, item1); 669 TaskInventoryItem t = sog.GetInventoryItem(sog.RootPart.LocalId, item1);
645 Assert.That(t, Is.Null); 670 Assert.That(t, Is.Null);
@@ -659,10 +684,11 @@ namespace OpenSim.Data.Tests
659 db.StorePrimInventory(sog.RootPart.UUID, list); 684 db.StorePrimInventory(sog.RootPart.UUID, list);
660 } 685 }
661 686
662
663 [Test] 687 [Test]
664 public void T021_PrimInventoryBasic() 688 public void T021_PrimInventoryBasic()
665 { 689 {
690 TestHelper.InMethod();
691
666 SceneObjectGroup sog = GetMySOG("object1"); 692 SceneObjectGroup sog = GetMySOG("object1");
667 InventoryItemBase i = NewItem(item1, zero, zero, itemname1, zero); 693 InventoryItemBase i = NewItem(item1, zero, zero, itemname1, zero);
668 694
@@ -690,20 +716,19 @@ namespace OpenSim.Data.Tests
690 Assert.That(t2.Name, Is.EqualTo("My New Name"), "Assert.That(t.Name, Is.EqualTo(\"My New Name\"))"); 716 Assert.That(t2.Name, Is.EqualTo("My New Name"), "Assert.That(t.Name, Is.EqualTo(\"My New Name\"))");
691 717
692 // Removing inventory 718 // Removing inventory
693
694 List<TaskInventoryItem> list = new List<TaskInventoryItem>(); 719 List<TaskInventoryItem> list = new List<TaskInventoryItem>();
695 db.StorePrimInventory(prim1, list); 720 db.StorePrimInventory(prim1, list);
696 721
697 sog = FindSOG("object1", region1); 722 sog = FindSOG("object1", region1);
698 t = sog.GetInventoryItem(sog.RootPart.LocalId, item1); 723 t = sog.GetInventoryItem(sog.RootPart.LocalId, item1);
699 Assert.That(t, Is.Null); 724 Assert.That(t, Is.Null);
700
701 } 725 }
702
703 726
704 [Test] 727 [Test]
705 public void T025_PrimInventoryPersistency() 728 public void T025_PrimInventoryPersistency()
706 { 729 {
730 TestHelper.InMethod();
731
707 InventoryItemBase i = new InventoryItemBase(); 732 InventoryItemBase i = new InventoryItemBase();
708 UUID id = UUID.Random(); 733 UUID id = UUID.Random();
709 i.ID = id; 734 i.ID = id;
@@ -775,6 +800,8 @@ namespace OpenSim.Data.Tests
775 [ExpectedException(typeof(ArgumentException))] 800 [ExpectedException(typeof(ArgumentException))]
776 public void T026_PrimInventoryMany() 801 public void T026_PrimInventoryMany()
777 { 802 {
803 TestHelper.InMethod();
804
778 UUID i1,i2,i3,i4; 805 UUID i1,i2,i3,i4;
779 i1 = UUID.Random(); 806 i1 = UUID.Random();
780 i2 = UUID.Random(); 807 i2 = UUID.Random();
@@ -805,15 +832,18 @@ namespace OpenSim.Data.Tests
805 [Test] 832 [Test]
806 public void T052_RemoveObject() 833 public void T052_RemoveObject()
807 { 834 {
835 TestHelper.InMethod();
836
808 db.RemoveObject(prim1, region1); 837 db.RemoveObject(prim1, region1);
809 SceneObjectGroup sog = FindSOG("object1", region1); 838 SceneObjectGroup sog = FindSOG("object1", region1);
810 Assert.That(sog, Is.Null); 839 Assert.That(sog, Is.Null);
811 } 840 }
812 841
813
814 [Test] 842 [Test]
815 public void T100_DefaultRegionInfo() 843 public void T100_DefaultRegionInfo()
816 { 844 {
845 TestHelper.InMethod();
846
817 RegionSettings r1 = db.LoadRegionSettings(region1); 847 RegionSettings r1 = db.LoadRegionSettings(region1);
818 Assert.That(r1.RegionUUID, Is.EqualTo(region1), "Assert.That(r1.RegionUUID, Is.EqualTo(region1))"); 848 Assert.That(r1.RegionUUID, Is.EqualTo(region1), "Assert.That(r1.RegionUUID, Is.EqualTo(region1))");
819 849
@@ -824,6 +854,8 @@ namespace OpenSim.Data.Tests
824 [Test] 854 [Test]
825 public void T101_UpdateRegionInfo() 855 public void T101_UpdateRegionInfo()
826 { 856 {
857 TestHelper.InMethod();
858
827 int agentlimit = random.Next(); 859 int agentlimit = random.Next();
828 double objectbonus = random.Next(); 860 double objectbonus = random.Next();
829 int maturity = random.Next(); 861 int maturity = random.Next();
@@ -922,13 +954,14 @@ namespace OpenSim.Data.Tests
922 //Assert.That(r1a.TerrainImageID,Is.EqualTo(terimgid), "Assert.That(r1a.TerrainImageID,Is.EqualTo(terimgid))"); 954 //Assert.That(r1a.TerrainImageID,Is.EqualTo(terimgid), "Assert.That(r1a.TerrainImageID,Is.EqualTo(terimgid))");
923 Assert.That(r1a.FixedSun,Is.True); 955 Assert.That(r1a.FixedSun,Is.True);
924 Assert.That(r1a.SunPosition, Is.EqualTo(sunpos), "Assert.That(r1a.SunPosition, Is.EqualTo(sunpos))"); 956 Assert.That(r1a.SunPosition, Is.EqualTo(sunpos), "Assert.That(r1a.SunPosition, Is.EqualTo(sunpos))");
925 Assert.That(r1a.Covenant, Is.EqualTo(cov), "Assert.That(r1a.Covenant, Is.EqualTo(cov))"); 957 Assert.That(r1a.Covenant, Is.EqualTo(cov), "Assert.That(r1a.Covenant, Is.EqualTo(cov))");
926
927 } 958 }
928 959
929 [Test] 960 [Test]
930 public void T300_NoTerrain() 961 public void T300_NoTerrain()
931 { 962 {
963 TestHelper.InMethod();
964
932 Assert.That(db.LoadTerrain(zero), Is.Null); 965 Assert.That(db.LoadTerrain(zero), Is.Null);
933 Assert.That(db.LoadTerrain(region1), Is.Null); 966 Assert.That(db.LoadTerrain(region1), Is.Null);
934 Assert.That(db.LoadTerrain(region2), Is.Null); 967 Assert.That(db.LoadTerrain(region2), Is.Null);
@@ -938,6 +971,8 @@ namespace OpenSim.Data.Tests
938 [Test] 971 [Test]
939 public void T301_CreateTerrain() 972 public void T301_CreateTerrain()
940 { 973 {
974 TestHelper.InMethod();
975
941 double[,] t1 = GenTerrain(height1); 976 double[,] t1 = GenTerrain(height1);
942 db.StoreTerrain(t1, region1); 977 db.StoreTerrain(t1, region1);
943 978
@@ -950,6 +985,8 @@ namespace OpenSim.Data.Tests
950 [Test] 985 [Test]
951 public void T302_FetchTerrain() 986 public void T302_FetchTerrain()
952 { 987 {
988 TestHelper.InMethod();
989
953 double[,] baseterrain1 = GenTerrain(height1); 990 double[,] baseterrain1 = GenTerrain(height1);
954 double[,] baseterrain2 = GenTerrain(height2); 991 double[,] baseterrain2 = GenTerrain(height2);
955 double[,] t1 = db.LoadTerrain(region1); 992 double[,] t1 = db.LoadTerrain(region1);
@@ -960,6 +997,8 @@ namespace OpenSim.Data.Tests
960 [Test] 997 [Test]
961 public void T303_UpdateTerrain() 998 public void T303_UpdateTerrain()
962 { 999 {
1000 TestHelper.InMethod();
1001
963 double[,] baseterrain1 = GenTerrain(height1); 1002 double[,] baseterrain1 = GenTerrain(height1);
964 double[,] baseterrain2 = GenTerrain(height2); 1003 double[,] baseterrain2 = GenTerrain(height2);
965 db.StoreTerrain(baseterrain2, region1); 1004 db.StoreTerrain(baseterrain2, region1);
@@ -972,6 +1011,8 @@ namespace OpenSim.Data.Tests
972 [Test] 1011 [Test]
973 public void T400_EmptyLand() 1012 public void T400_EmptyLand()
974 { 1013 {
1014 TestHelper.InMethod();
1015
975 Assert.That(db.LoadLandObjects(zero).Count, Is.EqualTo(0), "Assert.That(db.LoadLandObjects(zero).Count, Is.EqualTo(0))"); 1016 Assert.That(db.LoadLandObjects(zero).Count, Is.EqualTo(0), "Assert.That(db.LoadLandObjects(zero).Count, Is.EqualTo(0))");
976 Assert.That(db.LoadLandObjects(region1).Count, Is.EqualTo(0), "Assert.That(db.LoadLandObjects(region1).Count, Is.EqualTo(0))"); 1017 Assert.That(db.LoadLandObjects(region1).Count, Is.EqualTo(0), "Assert.That(db.LoadLandObjects(region1).Count, Is.EqualTo(0))");
977 Assert.That(db.LoadLandObjects(region2).Count, Is.EqualTo(0), "Assert.That(db.LoadLandObjects(region2).Count, Is.EqualTo(0))"); 1018 Assert.That(db.LoadLandObjects(region2).Count, Is.EqualTo(0), "Assert.That(db.LoadLandObjects(region2).Count, Is.EqualTo(0))");
@@ -1007,25 +1048,12 @@ namespace OpenSim.Data.Tests
1007 return true; 1048 return true;
1008 } 1049 }
1009 1050
1010
1011 private SceneObjectGroup FindSOG(string name, UUID r) 1051 private SceneObjectGroup FindSOG(string name, UUID r)
1012 { 1052 {
1013 List<SceneObjectGroup> objs = db.LoadObjects(r); 1053 List<SceneObjectGroup> objs = db.LoadObjects(r);
1014 foreach (SceneObjectGroup sog in objs) 1054 foreach (SceneObjectGroup sog in objs)
1015 { 1055 if (sog.Name == name)
1016 SceneObjectPart p = sog.RootPart;
1017 if (p.Name == name) {
1018 RegionInfo regionInfo = new RegionInfo();
1019 regionInfo.RegionID = r;
1020 regionInfo.RegionLocX = 0;
1021 regionInfo.RegionLocY = 0;
1022
1023 Scene scene = new Scene(regionInfo);
1024 sog.SetScene(scene);
1025
1026 return sog; 1056 return sog;
1027 }
1028 }
1029 1057
1030 return null; 1058 return null;
1031 } 1059 }