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.cs59
1 files changed, 48 insertions, 11 deletions
diff --git a/OpenSim/Data/Tests/RegionTests.cs b/OpenSim/Data/Tests/RegionTests.cs
index 9598716..2dc177a 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;
@@ -521,6 +537,8 @@ namespace OpenSim.Data.Tests
521 [Test] 537 [Test]
522 public void T015_LargeSceneObjects() 538 public void T015_LargeSceneObjects()
523 { 539 {
540 TestHelper.InMethod();
541
524 UUID id = UUID.Random(); 542 UUID id = UUID.Random();
525 Dictionary<UUID, SceneObjectPart> mydic = new Dictionary<UUID, SceneObjectPart>(); 543 Dictionary<UUID, SceneObjectPart> mydic = new Dictionary<UUID, SceneObjectPart>();
526 SceneObjectGroup sog = NewSOG("Test SOG", id, region4); 544 SceneObjectGroup sog = NewSOG("Test SOG", id, region4);
@@ -565,6 +583,8 @@ namespace OpenSim.Data.Tests
565 //[Test] 583 //[Test]
566 public void T016_RandomSogWithSceneParts() 584 public void T016_RandomSogWithSceneParts()
567 { 585 {
586 TestHelper.InMethod();
587
568 PropertyScrambler<SceneObjectPart> scrambler = 588 PropertyScrambler<SceneObjectPart> scrambler =
569 new PropertyScrambler<SceneObjectPart>() 589 new PropertyScrambler<SceneObjectPart>()
570 .DontScramble(x => x.UUID); 590 .DontScramble(x => x.UUID);
@@ -631,15 +651,16 @@ namespace OpenSim.Data.Tests
631 return sog; 651 return sog;
632 } 652 }
633 653
634
635 // NOTE: it is a bad practice to rely on some of the previous tests having been run before. 654 // 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). 655 // 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. 656 // 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*! 657 // We shouldn't expect to find anything in the DB if we haven't put it there *in the same test*!
639 658
640 [Test] 659 [Test]
641 public void T020_PrimInventoryEmpty() 660 public void T020_PrimInventoryEmpty()
642 { 661 {
662 TestHelper.InMethod();
663
643 SceneObjectGroup sog = GetMySOG("object1"); 664 SceneObjectGroup sog = GetMySOG("object1");
644 TaskInventoryItem t = sog.GetInventoryItem(sog.RootPart.LocalId, item1); 665 TaskInventoryItem t = sog.GetInventoryItem(sog.RootPart.LocalId, item1);
645 Assert.That(t, Is.Null); 666 Assert.That(t, Is.Null);
@@ -659,10 +680,11 @@ namespace OpenSim.Data.Tests
659 db.StorePrimInventory(sog.RootPart.UUID, list); 680 db.StorePrimInventory(sog.RootPart.UUID, list);
660 } 681 }
661 682
662
663 [Test] 683 [Test]
664 public void T021_PrimInventoryBasic() 684 public void T021_PrimInventoryBasic()
665 { 685 {
686 TestHelper.InMethod();
687
666 SceneObjectGroup sog = GetMySOG("object1"); 688 SceneObjectGroup sog = GetMySOG("object1");
667 InventoryItemBase i = NewItem(item1, zero, zero, itemname1, zero); 689 InventoryItemBase i = NewItem(item1, zero, zero, itemname1, zero);
668 690
@@ -690,20 +712,19 @@ namespace OpenSim.Data.Tests
690 Assert.That(t2.Name, Is.EqualTo("My New Name"), "Assert.That(t.Name, Is.EqualTo(\"My New Name\"))"); 712 Assert.That(t2.Name, Is.EqualTo("My New Name"), "Assert.That(t.Name, Is.EqualTo(\"My New Name\"))");
691 713
692 // Removing inventory 714 // Removing inventory
693
694 List<TaskInventoryItem> list = new List<TaskInventoryItem>(); 715 List<TaskInventoryItem> list = new List<TaskInventoryItem>();
695 db.StorePrimInventory(prim1, list); 716 db.StorePrimInventory(prim1, list);
696 717
697 sog = FindSOG("object1", region1); 718 sog = FindSOG("object1", region1);
698 t = sog.GetInventoryItem(sog.RootPart.LocalId, item1); 719 t = sog.GetInventoryItem(sog.RootPart.LocalId, item1);
699 Assert.That(t, Is.Null); 720 Assert.That(t, Is.Null);
700
701 } 721 }
702
703 722
704 [Test] 723 [Test]
705 public void T025_PrimInventoryPersistency() 724 public void T025_PrimInventoryPersistency()
706 { 725 {
726 TestHelper.InMethod();
727
707 InventoryItemBase i = new InventoryItemBase(); 728 InventoryItemBase i = new InventoryItemBase();
708 UUID id = UUID.Random(); 729 UUID id = UUID.Random();
709 i.ID = id; 730 i.ID = id;
@@ -775,6 +796,8 @@ namespace OpenSim.Data.Tests
775 [ExpectedException(typeof(ArgumentException))] 796 [ExpectedException(typeof(ArgumentException))]
776 public void T026_PrimInventoryMany() 797 public void T026_PrimInventoryMany()
777 { 798 {
799 TestHelper.InMethod();
800
778 UUID i1,i2,i3,i4; 801 UUID i1,i2,i3,i4;
779 i1 = UUID.Random(); 802 i1 = UUID.Random();
780 i2 = UUID.Random(); 803 i2 = UUID.Random();
@@ -805,15 +828,18 @@ namespace OpenSim.Data.Tests
805 [Test] 828 [Test]
806 public void T052_RemoveObject() 829 public void T052_RemoveObject()
807 { 830 {
831 TestHelper.InMethod();
832
808 db.RemoveObject(prim1, region1); 833 db.RemoveObject(prim1, region1);
809 SceneObjectGroup sog = FindSOG("object1", region1); 834 SceneObjectGroup sog = FindSOG("object1", region1);
810 Assert.That(sog, Is.Null); 835 Assert.That(sog, Is.Null);
811 } 836 }
812 837
813
814 [Test] 838 [Test]
815 public void T100_DefaultRegionInfo() 839 public void T100_DefaultRegionInfo()
816 { 840 {
841 TestHelper.InMethod();
842
817 RegionSettings r1 = db.LoadRegionSettings(region1); 843 RegionSettings r1 = db.LoadRegionSettings(region1);
818 Assert.That(r1.RegionUUID, Is.EqualTo(region1), "Assert.That(r1.RegionUUID, Is.EqualTo(region1))"); 844 Assert.That(r1.RegionUUID, Is.EqualTo(region1), "Assert.That(r1.RegionUUID, Is.EqualTo(region1))");
819 845
@@ -824,6 +850,8 @@ namespace OpenSim.Data.Tests
824 [Test] 850 [Test]
825 public void T101_UpdateRegionInfo() 851 public void T101_UpdateRegionInfo()
826 { 852 {
853 TestHelper.InMethod();
854
827 int agentlimit = random.Next(); 855 int agentlimit = random.Next();
828 double objectbonus = random.Next(); 856 double objectbonus = random.Next();
829 int maturity = random.Next(); 857 int maturity = random.Next();
@@ -922,13 +950,14 @@ namespace OpenSim.Data.Tests
922 //Assert.That(r1a.TerrainImageID,Is.EqualTo(terimgid), "Assert.That(r1a.TerrainImageID,Is.EqualTo(terimgid))"); 950 //Assert.That(r1a.TerrainImageID,Is.EqualTo(terimgid), "Assert.That(r1a.TerrainImageID,Is.EqualTo(terimgid))");
923 Assert.That(r1a.FixedSun,Is.True); 951 Assert.That(r1a.FixedSun,Is.True);
924 Assert.That(r1a.SunPosition, Is.EqualTo(sunpos), "Assert.That(r1a.SunPosition, Is.EqualTo(sunpos))"); 952 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))"); 953 Assert.That(r1a.Covenant, Is.EqualTo(cov), "Assert.That(r1a.Covenant, Is.EqualTo(cov))");
926
927 } 954 }
928 955
929 [Test] 956 [Test]
930 public void T300_NoTerrain() 957 public void T300_NoTerrain()
931 { 958 {
959 TestHelper.InMethod();
960
932 Assert.That(db.LoadTerrain(zero), Is.Null); 961 Assert.That(db.LoadTerrain(zero), Is.Null);
933 Assert.That(db.LoadTerrain(region1), Is.Null); 962 Assert.That(db.LoadTerrain(region1), Is.Null);
934 Assert.That(db.LoadTerrain(region2), Is.Null); 963 Assert.That(db.LoadTerrain(region2), Is.Null);
@@ -938,6 +967,8 @@ namespace OpenSim.Data.Tests
938 [Test] 967 [Test]
939 public void T301_CreateTerrain() 968 public void T301_CreateTerrain()
940 { 969 {
970 TestHelper.InMethod();
971
941 double[,] t1 = GenTerrain(height1); 972 double[,] t1 = GenTerrain(height1);
942 db.StoreTerrain(t1, region1); 973 db.StoreTerrain(t1, region1);
943 974
@@ -950,6 +981,8 @@ namespace OpenSim.Data.Tests
950 [Test] 981 [Test]
951 public void T302_FetchTerrain() 982 public void T302_FetchTerrain()
952 { 983 {
984 TestHelper.InMethod();
985
953 double[,] baseterrain1 = GenTerrain(height1); 986 double[,] baseterrain1 = GenTerrain(height1);
954 double[,] baseterrain2 = GenTerrain(height2); 987 double[,] baseterrain2 = GenTerrain(height2);
955 double[,] t1 = db.LoadTerrain(region1); 988 double[,] t1 = db.LoadTerrain(region1);
@@ -960,6 +993,8 @@ namespace OpenSim.Data.Tests
960 [Test] 993 [Test]
961 public void T303_UpdateTerrain() 994 public void T303_UpdateTerrain()
962 { 995 {
996 TestHelper.InMethod();
997
963 double[,] baseterrain1 = GenTerrain(height1); 998 double[,] baseterrain1 = GenTerrain(height1);
964 double[,] baseterrain2 = GenTerrain(height2); 999 double[,] baseterrain2 = GenTerrain(height2);
965 db.StoreTerrain(baseterrain2, region1); 1000 db.StoreTerrain(baseterrain2, region1);
@@ -972,6 +1007,8 @@ namespace OpenSim.Data.Tests
972 [Test] 1007 [Test]
973 public void T400_EmptyLand() 1008 public void T400_EmptyLand()
974 { 1009 {
1010 TestHelper.InMethod();
1011
975 Assert.That(db.LoadLandObjects(zero).Count, Is.EqualTo(0), "Assert.That(db.LoadLandObjects(zero).Count, Is.EqualTo(0))"); 1012 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))"); 1013 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))"); 1014 Assert.That(db.LoadLandObjects(region2).Count, Is.EqualTo(0), "Assert.That(db.LoadLandObjects(region2).Count, Is.EqualTo(0))");