diff options
author | Kunnis | 2009-08-09 02:01:21 -0500 |
---|---|---|
committer | Teravus Ovares (Dan Olivares) | 2009-08-16 13:35:44 -0400 |
commit | 23d478f2fa06d1dedabfb24cf6ff763b586173ce (patch) | |
tree | 072fdcfe343d84cf01b0881045fc96fb8403c324 | |
parent | Add copyright header. Formatting cleanup. (diff) | |
download | opensim-SC-23d478f2fa06d1dedabfb24cf6ff763b586173ce.zip opensim-SC-23d478f2fa06d1dedabfb24cf6ff763b586173ce.tar.gz opensim-SC-23d478f2fa06d1dedabfb24cf6ff763b586173ce.tar.bz2 opensim-SC-23d478f2fa06d1dedabfb24cf6ff763b586173ce.tar.xz |
Adding in Reflection-based testing, to ensure that all properties are covered.
-rw-r--r-- | OpenSim/Data/MySQL/MySQLAssetData.cs | 1 | ||||
-rw-r--r-- | OpenSim/Data/MySQL/MySQLInventoryData.cs | 11 | ||||
-rw-r--r-- | OpenSim/Data/MySQL/MySQLRegionData.cs | 17 | ||||
-rw-r--r-- | OpenSim/Data/MySQL/Tests/MySQLGridTest.cs | 8 | ||||
-rw-r--r-- | OpenSim/Data/MySQL/Tests/MySQLInventoryTest.cs | 12 | ||||
-rw-r--r-- | OpenSim/Data/Tests/BasicAssetTest.cs | 19 | ||||
-rw-r--r-- | OpenSim/Data/Tests/BasicEstateTest.cs | 18 | ||||
-rw-r--r-- | OpenSim/Data/Tests/BasicGridTest.cs | 79 | ||||
-rw-r--r-- | OpenSim/Data/Tests/BasicInventoryTest.cs | 37 | ||||
-rw-r--r-- | OpenSim/Data/Tests/BasicRegionTest.cs | 47 | ||||
-rw-r--r-- | OpenSim/Data/Tests/BasicUserTest.cs | 30 | ||||
-rw-r--r-- | bin/OpenSim.Data.NHibernate.Tests.dll.config | 2 |
12 files changed, 175 insertions, 106 deletions
diff --git a/OpenSim/Data/MySQL/MySQLAssetData.cs b/OpenSim/Data/MySQL/MySQLAssetData.cs index 26cdd06..5d87649 100644 --- a/OpenSim/Data/MySQL/MySQLAssetData.cs +++ b/OpenSim/Data/MySQL/MySQLAssetData.cs | |||
@@ -168,6 +168,7 @@ namespace OpenSim.Data.MySQL | |||
168 | } | 168 | } |
169 | asset.Name = (string) dbReader["name"]; | 169 | asset.Name = (string) dbReader["name"]; |
170 | asset.Type = (sbyte) dbReader["assetType"]; | 170 | asset.Type = (sbyte) dbReader["assetType"]; |
171 | asset.Temporary = (bool)dbReader["temporary"]; | ||
171 | } | 172 | } |
172 | dbReader.Close(); | 173 | dbReader.Close(); |
173 | cmd.Dispose(); | 174 | cmd.Dispose(); |
diff --git a/OpenSim/Data/MySQL/MySQLInventoryData.cs b/OpenSim/Data/MySQL/MySQLInventoryData.cs index a4b8663..121ef7a 100644 --- a/OpenSim/Data/MySQL/MySQLInventoryData.cs +++ b/OpenSim/Data/MySQL/MySQLInventoryData.cs | |||
@@ -342,7 +342,7 @@ namespace OpenSim.Data.MySQL | |||
342 | item.EveryOnePermissions = (uint) reader["inventoryEveryOnePermissions"]; | 342 | item.EveryOnePermissions = (uint) reader["inventoryEveryOnePermissions"]; |
343 | item.GroupPermissions = (uint) reader["inventoryGroupPermissions"]; | 343 | item.GroupPermissions = (uint) reader["inventoryGroupPermissions"]; |
344 | item.SalePrice = (int) reader["salePrice"]; | 344 | item.SalePrice = (int) reader["salePrice"]; |
345 | item.SaleType = Convert.ToByte(reader["saleType"]); | 345 | item.SaleType = unchecked((byte)(Convert.ToSByte(reader["saleType"]))); |
346 | item.CreationDate = (int) reader["creationDate"]; | 346 | item.CreationDate = (int) reader["creationDate"]; |
347 | item.GroupOwned = Convert.ToBoolean(reader["groupOwned"]); | 347 | item.GroupOwned = Convert.ToBoolean(reader["groupOwned"]); |
348 | item.Flags = (uint) reader["flags"]; | 348 | item.Flags = (uint) reader["flags"]; |
@@ -423,7 +423,7 @@ namespace OpenSim.Data.MySQL | |||
423 | /// <summary> | 423 | /// <summary> |
424 | /// Returns a specified inventory folder | 424 | /// Returns a specified inventory folder |
425 | /// </summary> | 425 | /// </summary> |
426 | /// <param name="folder">The folder to return</param> | 426 | /// <param name="folderID">The folder to return</param> |
427 | /// <returns>A folder class</returns> | 427 | /// <returns>A folder class</returns> |
428 | public InventoryFolderBase getInventoryFolder(UUID folderID) | 428 | public InventoryFolderBase getInventoryFolder(UUID folderID) |
429 | { | 429 | { |
@@ -438,8 +438,9 @@ namespace OpenSim.Data.MySQL | |||
438 | result.Parameters.AddWithValue("?uuid", folderID.ToString()); | 438 | result.Parameters.AddWithValue("?uuid", folderID.ToString()); |
439 | MySqlDataReader reader = result.ExecuteReader(); | 439 | MySqlDataReader reader = result.ExecuteReader(); |
440 | 440 | ||
441 | reader.Read(); | 441 | InventoryFolderBase folder = null; |
442 | InventoryFolderBase folder = readInventoryFolder(reader); | 442 | if(reader.Read()) |
443 | folder = readInventoryFolder(reader); | ||
443 | reader.Close(); | 444 | reader.Close(); |
444 | result.Dispose(); | 445 | result.Dispose(); |
445 | 446 | ||
@@ -506,7 +507,7 @@ namespace OpenSim.Data.MySQL | |||
506 | result.Parameters.AddWithValue("?inventoryEveryOnePermissions", item.EveryOnePermissions); | 507 | result.Parameters.AddWithValue("?inventoryEveryOnePermissions", item.EveryOnePermissions); |
507 | result.Parameters.AddWithValue("?inventoryGroupPermissions", item.GroupPermissions); | 508 | result.Parameters.AddWithValue("?inventoryGroupPermissions", item.GroupPermissions); |
508 | result.Parameters.AddWithValue("?salePrice", item.SalePrice); | 509 | result.Parameters.AddWithValue("?salePrice", item.SalePrice); |
509 | result.Parameters.AddWithValue("?saleType", item.SaleType); | 510 | result.Parameters.AddWithValue("?saleType", unchecked((sbyte)item.SaleType)); |
510 | result.Parameters.AddWithValue("?creationDate", item.CreationDate); | 511 | result.Parameters.AddWithValue("?creationDate", item.CreationDate); |
511 | result.Parameters.AddWithValue("?groupID", item.GroupID); | 512 | result.Parameters.AddWithValue("?groupID", item.GroupID); |
512 | result.Parameters.AddWithValue("?groupOwned", item.GroupOwned); | 513 | result.Parameters.AddWithValue("?groupOwned", item.GroupOwned); |
diff --git a/OpenSim/Data/MySQL/MySQLRegionData.cs b/OpenSim/Data/MySQL/MySQLRegionData.cs index 2166845..9c2ee4a 100644 --- a/OpenSim/Data/MySQL/MySQLRegionData.cs +++ b/OpenSim/Data/MySQL/MySQLRegionData.cs | |||
@@ -834,7 +834,10 @@ namespace OpenSim.Data.MySQL | |||
834 | // explicit conversion of integers is required, which sort | 834 | // explicit conversion of integers is required, which sort |
835 | // of sucks. No idea if there is a shortcut here or not. | 835 | // of sucks. No idea if there is a shortcut here or not. |
836 | prim.CreationDate = Convert.ToInt32(row["CreationDate"]); | 836 | prim.CreationDate = Convert.ToInt32(row["CreationDate"]); |
837 | prim.Name = (String) row["Name"]; | 837 | if (row["Name"] != DBNull.Value) |
838 | prim.Name = (String)row["Name"]; | ||
839 | else | ||
840 | prim.Name = string.Empty; | ||
838 | // various text fields | 841 | // various text fields |
839 | prim.Text = (String) row["Text"]; | 842 | prim.Text = (String) row["Text"]; |
840 | prim.Color = Color.FromArgb(Convert.ToInt32(row["ColorA"]), | 843 | prim.Color = Color.FromArgb(Convert.ToInt32(row["ColorA"]), |
@@ -945,12 +948,12 @@ namespace OpenSim.Data.MySQL | |||
945 | prim.DIE_AT_EDGE = true; | 948 | prim.DIE_AT_EDGE = true; |
946 | 949 | ||
947 | prim.SalePrice = Convert.ToInt32(row["SalePrice"]); | 950 | prim.SalePrice = Convert.ToInt32(row["SalePrice"]); |
948 | prim.ObjectSaleType = Convert.ToByte(row["SaleType"]); | 951 | prim.ObjectSaleType = unchecked((byte)Convert.ToSByte(row["SaleType"])); |
949 | 952 | ||
950 | prim.Material = Convert.ToByte(row["Material"]); | 953 | prim.Material = unchecked((byte)Convert.ToSByte(row["Material"])); |
951 | 954 | ||
952 | if (!(row["ClickAction"] is DBNull)) | 955 | if (!(row["ClickAction"] is DBNull)) |
953 | prim.ClickAction = (byte)Convert.ToByte(row["ClickAction"]); | 956 | prim.ClickAction = unchecked((byte)Convert.ToSByte(row["ClickAction"])); |
954 | 957 | ||
955 | prim.CollisionSound = new UUID(row["CollisionSound"].ToString()); | 958 | prim.CollisionSound = new UUID(row["CollisionSound"].ToString()); |
956 | prim.CollisionSoundVolume = Convert.ToSingle(row["CollisionSoundVolume"]); | 959 | prim.CollisionSoundVolume = Convert.ToSingle(row["CollisionSoundVolume"]); |
@@ -1277,12 +1280,12 @@ namespace OpenSim.Data.MySQL | |||
1277 | cmd.Parameters.AddWithValue("DieAtEdge", 0); | 1280 | cmd.Parameters.AddWithValue("DieAtEdge", 0); |
1278 | 1281 | ||
1279 | cmd.Parameters.AddWithValue("SalePrice", prim.SalePrice); | 1282 | cmd.Parameters.AddWithValue("SalePrice", prim.SalePrice); |
1280 | cmd.Parameters.AddWithValue("SaleType", Convert.ToInt16(prim.ObjectSaleType)); | 1283 | cmd.Parameters.AddWithValue("SaleType", unchecked((sbyte)(prim.ObjectSaleType))); |
1281 | 1284 | ||
1282 | byte clickAction = prim.ClickAction; | 1285 | byte clickAction = prim.ClickAction; |
1283 | cmd.Parameters.AddWithValue("ClickAction", clickAction); | 1286 | cmd.Parameters.AddWithValue("ClickAction", unchecked((sbyte)(clickAction))); |
1284 | 1287 | ||
1285 | cmd.Parameters.AddWithValue("Material", prim.Material); | 1288 | cmd.Parameters.AddWithValue("Material", unchecked((sbyte)(prim.Material))); |
1286 | 1289 | ||
1287 | cmd.Parameters.AddWithValue("CollisionSound", prim.CollisionSound.ToString()); | 1290 | cmd.Parameters.AddWithValue("CollisionSound", prim.CollisionSound.ToString()); |
1288 | cmd.Parameters.AddWithValue("CollisionSoundVolume", prim.CollisionSoundVolume); | 1291 | cmd.Parameters.AddWithValue("CollisionSoundVolume", prim.CollisionSoundVolume); |
diff --git a/OpenSim/Data/MySQL/Tests/MySQLGridTest.cs b/OpenSim/Data/MySQL/Tests/MySQLGridTest.cs index 7c36375..d1d5c2a 100644 --- a/OpenSim/Data/MySQL/Tests/MySQLGridTest.cs +++ b/OpenSim/Data/MySQL/Tests/MySQLGridTest.cs | |||
@@ -62,11 +62,18 @@ namespace OpenSim.Data.MySQL.Tests | |||
62 | m_log.Error("Exception {0}", e); | 62 | m_log.Error("Exception {0}", e); |
63 | Assert.Ignore(); | 63 | Assert.Ignore(); |
64 | } | 64 | } |
65 | |||
66 | // This actually does the roll forward assembly stuff | ||
67 | Assembly assem = GetType().Assembly; | ||
68 | Migration m = new Migration(database.Connection, assem, "GridStore"); | ||
69 | |||
70 | m.Update(); | ||
65 | } | 71 | } |
66 | 72 | ||
67 | [TestFixtureTearDown] | 73 | [TestFixtureTearDown] |
68 | public void Cleanup() | 74 | public void Cleanup() |
69 | { | 75 | { |
76 | m_log.Warn("Cleaning up."); | ||
70 | if (db != null) | 77 | if (db != null) |
71 | { | 78 | { |
72 | db.Dispose(); | 79 | db.Dispose(); |
@@ -74,6 +81,7 @@ namespace OpenSim.Data.MySQL.Tests | |||
74 | // if a new table is added, it has to be dropped here | 81 | // if a new table is added, it has to be dropped here |
75 | if (database != null) | 82 | if (database != null) |
76 | { | 83 | { |
84 | database.ExecuteSql("drop table migrations"); | ||
77 | database.ExecuteSql("drop table regions"); | 85 | database.ExecuteSql("drop table regions"); |
78 | } | 86 | } |
79 | } | 87 | } |
diff --git a/OpenSim/Data/MySQL/Tests/MySQLInventoryTest.cs b/OpenSim/Data/MySQL/Tests/MySQLInventoryTest.cs index 23c1ec5..a3a32dc 100644 --- a/OpenSim/Data/MySQL/Tests/MySQLInventoryTest.cs +++ b/OpenSim/Data/MySQL/Tests/MySQLInventoryTest.cs | |||
@@ -53,6 +53,7 @@ namespace OpenSim.Data.MySQL.Tests | |||
53 | try | 53 | try |
54 | { | 54 | { |
55 | database = new MySQLManager(connect); | 55 | database = new MySQLManager(connect); |
56 | DropTables(); | ||
56 | db = new MySQLInventoryData(); | 57 | db = new MySQLInventoryData(); |
57 | db.Initialise(connect); | 58 | db.Initialise(connect); |
58 | } | 59 | } |
@@ -72,10 +73,15 @@ namespace OpenSim.Data.MySQL.Tests | |||
72 | } | 73 | } |
73 | if (database != null) | 74 | if (database != null) |
74 | { | 75 | { |
75 | database.ExecuteSql("drop table inventoryitems"); | 76 | DropTables(); |
76 | database.ExecuteSql("drop table inventoryfolders"); | ||
77 | database.ExecuteSql("drop table migrations"); | ||
78 | } | 77 | } |
79 | } | 78 | } |
79 | |||
80 | private void DropTables() | ||
81 | { | ||
82 | database.ExecuteSql("drop table IF EXISTS inventoryitems"); | ||
83 | database.ExecuteSql("drop table IF EXISTS inventoryfolders"); | ||
84 | database.ExecuteSql("drop table IF EXISTS migrations"); | ||
85 | } | ||
80 | } | 86 | } |
81 | } | 87 | } |
diff --git a/OpenSim/Data/Tests/BasicAssetTest.cs b/OpenSim/Data/Tests/BasicAssetTest.cs index e85a6a7..eddb999 100644 --- a/OpenSim/Data/Tests/BasicAssetTest.cs +++ b/OpenSim/Data/Tests/BasicAssetTest.cs | |||
@@ -32,7 +32,6 @@ using NUnit.Framework.SyntaxHelpers; | |||
32 | using OpenMetaverse; | 32 | using OpenMetaverse; |
33 | using OpenSim.Framework; | 33 | using OpenSim.Framework; |
34 | using log4net; | 34 | using log4net; |
35 | using System.Reflection; | ||
36 | 35 | ||
37 | namespace OpenSim.Data.Tests | 36 | namespace OpenSim.Data.Tests |
38 | { | 37 | { |
@@ -77,25 +76,31 @@ namespace OpenSim.Data.Tests | |||
77 | AssetBase a1 = new AssetBase(uuid1, "asset one"); | 76 | AssetBase a1 = new AssetBase(uuid1, "asset one"); |
78 | AssetBase a2 = new AssetBase(uuid2, "asset two"); | 77 | AssetBase a2 = new AssetBase(uuid2, "asset two"); |
79 | AssetBase a3 = new AssetBase(uuid3, "asset three"); | 78 | AssetBase a3 = new AssetBase(uuid3, "asset three"); |
79 | |||
80 | ScrambleForTesting.Scramble(a1); | ||
81 | ScrambleForTesting.Scramble(a2); | ||
82 | ScrambleForTesting.Scramble(a3); | ||
83 | |||
80 | a1.Data = asset1; | 84 | a1.Data = asset1; |
81 | a2.Data = asset1; | 85 | a2.Data = asset1; |
82 | a3.Data = asset1; | 86 | a3.Data = asset1; |
83 | 87 | ||
88 | a1.FullID = uuid1; | ||
89 | a2.FullID = uuid2; | ||
90 | a3.FullID = uuid3; | ||
91 | |||
84 | db.CreateAsset(a1); | 92 | db.CreateAsset(a1); |
85 | db.CreateAsset(a2); | 93 | db.CreateAsset(a2); |
86 | db.CreateAsset(a3); | 94 | db.CreateAsset(a3); |
87 | 95 | ||
88 | AssetBase a1a = db.FetchAsset(uuid1); | 96 | AssetBase a1a = db.FetchAsset(uuid1); |
89 | Assert.That(a1.ID, Is.EqualTo(a1a.ID), "Assert.That(a1.ID, Is.EqualTo(a1a.ID))"); | 97 | Assert.That(a1, Constraints.PropertyCompareConstraint(a1a)); |
90 | Assert.That(a1.Name, Is.EqualTo(a1a.Name), "Assert.That(a1.Name, Is.EqualTo(a1a.Name))"); | ||
91 | 98 | ||
92 | AssetBase a2a = db.FetchAsset(uuid2); | 99 | AssetBase a2a = db.FetchAsset(uuid2); |
93 | Assert.That(a2.ID, Is.EqualTo(a2a.ID), "Assert.That(a2.ID, Is.EqualTo(a2a.ID))"); | 100 | Assert.That(a2, Constraints.PropertyCompareConstraint(a2a)); |
94 | Assert.That(a2.Name, Is.EqualTo(a2a.Name), "Assert.That(a2.Name, Is.EqualTo(a2a.Name))"); | ||
95 | 101 | ||
96 | AssetBase a3a = db.FetchAsset(uuid3); | 102 | AssetBase a3a = db.FetchAsset(uuid3); |
97 | Assert.That(a3.ID, Is.EqualTo(a3a.ID), "Assert.That(a3.ID, Is.EqualTo(a3a.ID))"); | 103 | Assert.That(a3, Constraints.PropertyCompareConstraint(a3a)); |
98 | Assert.That(a3.Name, Is.EqualTo(a3a.Name), "Assert.That(a3.Name, Is.EqualTo(a3a.Name))"); | ||
99 | } | 104 | } |
100 | 105 | ||
101 | [Test] | 106 | [Test] |
diff --git a/OpenSim/Data/Tests/BasicEstateTest.cs b/OpenSim/Data/Tests/BasicEstateTest.cs index a0266b3..b702e2a 100644 --- a/OpenSim/Data/Tests/BasicEstateTest.cs +++ b/OpenSim/Data/Tests/BasicEstateTest.cs | |||
@@ -163,6 +163,24 @@ namespace OpenSim.Data.Tests | |||
163 | } | 163 | } |
164 | 164 | ||
165 | [Test] | 165 | [Test] |
166 | private void T012_EstateSettingsRandomStorage() | ||
167 | { | ||
168 | |||
169 | // Letting estate store generate rows to database for us | ||
170 | EstateSettings originalSettings = db.LoadEstateSettings(REGION_ID); | ||
171 | ScrambleForTesting.Scramble(originalSettings); | ||
172 | |||
173 | // Saving settings. | ||
174 | db.StoreEstateSettings(originalSettings); | ||
175 | |||
176 | // Loading settings to another instance variable. | ||
177 | EstateSettings loadedSettings = db.LoadEstateSettings(REGION_ID); | ||
178 | |||
179 | // Checking that loaded values are correct. | ||
180 | Assert.That(loadedSettings, Constraints.PropertyCompareConstraint(originalSettings)); | ||
181 | } | ||
182 | |||
183 | [Test] | ||
166 | public void T020_EstateSettingsManagerList() | 184 | public void T020_EstateSettingsManagerList() |
167 | { | 185 | { |
168 | // Letting estate store generate rows to database for us | 186 | // Letting estate store generate rows to database for us |
diff --git a/OpenSim/Data/Tests/BasicGridTest.cs b/OpenSim/Data/Tests/BasicGridTest.cs index 85273c5..b0ee4a0 100644 --- a/OpenSim/Data/Tests/BasicGridTest.cs +++ b/OpenSim/Data/Tests/BasicGridTest.cs | |||
@@ -49,9 +49,13 @@ namespace OpenSim.Data.Tests | |||
49 | public void removeAllRegions() | 49 | public void removeAllRegions() |
50 | { | 50 | { |
51 | // Clean up all the regions. | 51 | // Clean up all the regions. |
52 | foreach (RegionProfileData region in db.GetRegionsByName("", 100)) | 52 | List<RegionProfileData> regions = db.GetRegionsByName("", 100); |
53 | if(regions != null) | ||
53 | { | 54 | { |
54 | db.DeleteProfile(region.Uuid.ToString()); | 55 | foreach (RegionProfileData region in regions) |
56 | { | ||
57 | db.DeleteProfile(region.Uuid.ToString()); | ||
58 | } | ||
55 | } | 59 | } |
56 | } | 60 | } |
57 | 61 | ||
@@ -74,35 +78,9 @@ namespace OpenSim.Data.Tests | |||
74 | protected RegionProfileData createRegion(UUID regionUUID, string regionName) | 78 | protected RegionProfileData createRegion(UUID regionUUID, string regionName) |
75 | { | 79 | { |
76 | RegionProfileData reg = new RegionProfileData(); | 80 | RegionProfileData reg = new RegionProfileData(); |
81 | ScrambleForTesting.Scramble(reg); | ||
77 | reg.Uuid = regionUUID; | 82 | reg.Uuid = regionUUID; |
78 | reg.RegionName = regionName; | 83 | reg.RegionName = regionName; |
79 | reg.RegionHandle = (ulong) random.Next(); | ||
80 | reg.RegionLocX = (uint) random.Next(); | ||
81 | reg.RegionLocY = (uint) random.Next(); | ||
82 | reg.RegionLocZ = (uint) random.Next(); | ||
83 | reg.RegionSendKey = RandomName(); | ||
84 | reg.RegionRecvKey = RandomName(); | ||
85 | reg.RegionSecret = RandomName(); | ||
86 | reg.RegionOnline = false; | ||
87 | reg.ServerIP = RandomName(); | ||
88 | reg.ServerPort = (uint) random.Next(); | ||
89 | reg.ServerURI = RandomName(); | ||
90 | reg.ServerHttpPort = (uint) random.Next(); | ||
91 | reg.ServerRemotingPort = (uint) random.Next(); | ||
92 | reg.NorthOverrideHandle = (ulong) random.Next(); | ||
93 | reg.SouthOverrideHandle = (ulong) random.Next(); | ||
94 | reg.EastOverrideHandle = (ulong) random.Next(); | ||
95 | reg.WestOverrideHandle = (ulong) random.Next(); | ||
96 | reg.RegionDataURI = RandomName(); | ||
97 | reg.RegionAssetURI = RandomName(); | ||
98 | reg.RegionAssetSendKey = RandomName(); | ||
99 | reg.RegionAssetRecvKey = RandomName(); | ||
100 | reg.RegionUserURI = RandomName(); | ||
101 | reg.RegionUserSendKey = RandomName(); | ||
102 | reg.RegionUserRecvKey = RandomName(); | ||
103 | reg.RegionMapTextureID = UUID.Random(); | ||
104 | reg.Owner_uuid = UUID.Random(); | ||
105 | reg.OriginUUID = UUID.Random(); | ||
106 | 84 | ||
107 | db.AddProfile(reg); | 85 | db.AddProfile(reg); |
108 | 86 | ||
@@ -119,47 +97,12 @@ namespace OpenSim.Data.Tests | |||
119 | } | 97 | } |
120 | 98 | ||
121 | [Test] | 99 | [Test] |
122 | public void T999_StillNull() | ||
123 | { | ||
124 | Assert.That(db.GetProfileByUUID(zero),Is.Null); | ||
125 | } | ||
126 | |||
127 | [Test] | ||
128 | public void T011_AddRetrieveCompleteTest() | 100 | public void T011_AddRetrieveCompleteTest() |
129 | { | 101 | { |
130 | RegionProfileData newreg = createRegion(region2, "|<Goth@m Ci1y>|"); | 102 | RegionProfileData newreg = createRegion(region2, "|<Goth@m Ci1y>|"); |
131 | RegionProfileData retreg = db.GetProfileByUUID(region2); | 103 | RegionProfileData retreg = db.GetProfileByUUID(region2); |
132 | 104 | ||
133 | Assert.That(retreg.RegionName, Is.EqualTo(newreg.RegionName), "Assert.That(retreg.RegionName, Is.EqualTo(newreg.RegionName))"); | 105 | Assert.That(retreg, Constraints.PropertyCompareConstraint(newreg).IgnoreProperty(x => x.RegionOnline)); |
134 | Assert.That(retreg.Uuid, Is.EqualTo(region2), "Assert.That(retreg.Uuid, Is.EqualTo(region2))"); | ||
135 | Assert.That(retreg.RegionHandle, Is.EqualTo(newreg.RegionHandle), "Assert.That(retreg.RegionHandle, Is.EqualTo(newreg.RegionHandle))"); | ||
136 | Assert.That(retreg.RegionLocX, Is.EqualTo(newreg.RegionLocX), "Assert.That(retreg.RegionLocX, Is.EqualTo(newreg.RegionLocX))"); | ||
137 | Assert.That(retreg.RegionLocY, Is.EqualTo(newreg.RegionLocY), "Assert.That(retreg.RegionLocY, Is.EqualTo(newreg.RegionLocY))"); | ||
138 | Assert.That(retreg.RegionLocZ, Is.EqualTo(newreg.RegionLocZ), "Assert.That(retreg.RegionLocZ, Is.EqualTo(newreg.RegionLocZ))"); | ||
139 | Assert.That(retreg.RegionSendKey, Is.EqualTo(newreg.RegionSendKey), "Assert.That(retreg.RegionSendKey, Is.EqualTo(newreg.RegionSendKey))"); | ||
140 | Assert.That(retreg.RegionRecvKey, Is.EqualTo(newreg.RegionRecvKey), "Assert.That(retreg.RegionRecvKey, Is.EqualTo(newreg.RegionRecvKey))"); | ||
141 | Assert.That(retreg.RegionSecret, Is.EqualTo(newreg.RegionSecret), "Assert.That(retreg.RegionSecret, Is.EqualTo(newreg.RegionSecret))"); | ||
142 | Assert.That(retreg.RegionOnline, Is.EqualTo(newreg.RegionOnline), "Assert.That(retreg.RegionOnline, Is.EqualTo(newreg.RegionOnline))"); | ||
143 | Assert.That(retreg.OriginUUID, Is.EqualTo(newreg.OriginUUID), "Assert.That(retreg.OriginUUID, Is.EqualTo(newreg.OriginUUID))"); | ||
144 | Assert.That(retreg.ServerIP, Is.EqualTo(newreg.ServerIP), "Assert.That(retreg.ServerIP, Is.EqualTo(newreg.ServerIP))"); | ||
145 | Assert.That(retreg.ServerPort, Is.EqualTo(newreg.ServerPort), "Assert.That(retreg.ServerPort, Is.EqualTo(newreg.ServerPort))"); | ||
146 | Assert.That(retreg.ServerURI, Is.EqualTo(newreg.ServerURI), "Assert.That(retreg.ServerURI, Is.EqualTo(newreg.ServerURI))"); | ||
147 | Assert.That(retreg.ServerHttpPort, Is.EqualTo(newreg.ServerHttpPort), "Assert.That(retreg.ServerHttpPort, Is.EqualTo(newreg.ServerHttpPort))"); | ||
148 | Assert.That(retreg.ServerRemotingPort, Is.EqualTo(newreg.ServerRemotingPort), "Assert.That(retreg.ServerRemotingPort, Is.EqualTo(newreg.ServerRemotingPort))"); | ||
149 | Assert.That(retreg.NorthOverrideHandle, Is.EqualTo(newreg.NorthOverrideHandle), "Assert.That(retreg.NorthOverrideHandle, Is.EqualTo(newreg.NorthOverrideHandle))"); | ||
150 | Assert.That(retreg.SouthOverrideHandle, Is.EqualTo(newreg.SouthOverrideHandle), "Assert.That(retreg.SouthOverrideHandle, Is.EqualTo(newreg.SouthOverrideHandle))"); | ||
151 | Assert.That(retreg.EastOverrideHandle, Is.EqualTo(newreg.EastOverrideHandle), "Assert.That(retreg.EastOverrideHandle, Is.EqualTo(newreg.EastOverrideHandle))"); | ||
152 | Assert.That(retreg.WestOverrideHandle, Is.EqualTo(newreg.WestOverrideHandle), "Assert.That(retreg.WestOverrideHandle, Is.EqualTo(newreg.WestOverrideHandle))"); | ||
153 | Assert.That(retreg.RegionDataURI, Is.EqualTo(newreg.RegionDataURI), "Assert.That(retreg.RegionDataURI, Is.EqualTo(newreg.RegionDataURI))"); | ||
154 | Assert.That(retreg.RegionAssetURI, Is.EqualTo(newreg.RegionAssetURI), "Assert.That(retreg.RegionAssetURI, Is.EqualTo(newreg.RegionAssetURI))"); | ||
155 | Assert.That(retreg.RegionAssetSendKey, Is.EqualTo(newreg.RegionAssetSendKey), "Assert.That(retreg.RegionAssetSendKey, Is.EqualTo(newreg.RegionAssetSendKey))"); | ||
156 | Assert.That(retreg.RegionAssetRecvKey, Is.EqualTo(newreg.RegionAssetRecvKey), "Assert.That(retreg.RegionAssetRecvKey, Is.EqualTo(newreg.RegionAssetRecvKey))"); | ||
157 | Assert.That(retreg.RegionUserURI, Is.EqualTo(newreg.RegionUserURI), "Assert.That(retreg.RegionUserURI, Is.EqualTo(newreg.RegionUserURI))"); | ||
158 | Assert.That(retreg.RegionUserSendKey, Is.EqualTo(newreg.RegionUserSendKey), "Assert.That(retreg.RegionUserSendKey, Is.EqualTo(newreg.RegionUserSendKey))"); | ||
159 | Assert.That(retreg.RegionUserRecvKey, Is.EqualTo(newreg.RegionUserRecvKey), "Assert.That(retreg.RegionUserRecvKey, Is.EqualTo(newreg.RegionUserRecvKey))"); | ||
160 | Assert.That(retreg.RegionMapTextureID, Is.EqualTo(newreg.RegionMapTextureID), "Assert.That(retreg.RegionMapTextureID, Is.EqualTo(newreg.RegionMapTextureID))"); | ||
161 | Assert.That(retreg.Owner_uuid, Is.EqualTo(newreg.Owner_uuid), "Assert.That(retreg.Owner_uuid, Is.EqualTo(newreg.Owner_uuid))"); | ||
162 | Assert.That(retreg.OriginUUID, Is.EqualTo(newreg.OriginUUID), "Assert.That(retreg.OriginUUID, Is.EqualTo(newreg.OriginUUID))"); | ||
163 | 106 | ||
164 | retreg = db.GetProfileByHandle(newreg.RegionHandle); | 107 | retreg = db.GetProfileByHandle(newreg.RegionHandle); |
165 | Assert.That(retreg.Uuid, Is.EqualTo(region2), "Assert.That(retreg.Uuid, Is.EqualTo(region2))"); | 108 | Assert.That(retreg.Uuid, Is.EqualTo(region2), "Assert.That(retreg.Uuid, Is.EqualTo(region2))"); |
@@ -220,6 +163,12 @@ namespace OpenSim.Data.Tests | |||
220 | Assert.That(listreg[1].Uuid, Is.EqualTo(region1) | Is.EqualTo(region2), "Assert.That(listreg[1].Uuid, Is.EqualTo(region1) | Is.EqualTo(region2))"); | 163 | Assert.That(listreg[1].Uuid, Is.EqualTo(region1) | Is.EqualTo(region2), "Assert.That(listreg[1].Uuid, Is.EqualTo(region1) | Is.EqualTo(region2))"); |
221 | } | 164 | } |
222 | 165 | ||
166 | [Test] | ||
167 | public void T999_StillNull() | ||
168 | { | ||
169 | Assert.That(db.GetProfileByUUID(zero), Is.Null); | ||
170 | } | ||
171 | |||
223 | protected static string RandomName() | 172 | protected static string RandomName() |
224 | { | 173 | { |
225 | StringBuilder name = new StringBuilder(); | 174 | StringBuilder name = new StringBuilder(); |
diff --git a/OpenSim/Data/Tests/BasicInventoryTest.cs b/OpenSim/Data/Tests/BasicInventoryTest.cs index e13ed89..3c33bb4 100644 --- a/OpenSim/Data/Tests/BasicInventoryTest.cs +++ b/OpenSim/Data/Tests/BasicInventoryTest.cs | |||
@@ -115,16 +115,6 @@ namespace OpenSim.Data.Tests | |||
115 | Assert.That(db.getUserRootFolder(owner1), Is.Null); | 115 | Assert.That(db.getUserRootFolder(owner1), Is.Null); |
116 | } | 116 | } |
117 | 117 | ||
118 | [Test] | ||
119 | public void T999_StillNull() | ||
120 | { | ||
121 | // After all tests are run, these should still return no results | ||
122 | Assert.That(db.getInventoryFolder(zero), Is.Null); | ||
123 | Assert.That(db.getInventoryItem(zero), Is.Null); | ||
124 | Assert.That(db.getUserRootFolder(zero), Is.Null); | ||
125 | Assert.That(db.getInventoryInFolder(zero).Count, Is.EqualTo(0), "Assert.That(db.getInventoryInFolder(zero).Count, Is.EqualTo(0))"); | ||
126 | } | ||
127 | |||
128 | // 01x - folder tests | 118 | // 01x - folder tests |
129 | [Test] | 119 | [Test] |
130 | public void T010_FolderNonParent() | 120 | public void T010_FolderNonParent() |
@@ -248,7 +238,7 @@ namespace OpenSim.Data.Tests | |||
248 | } | 238 | } |
249 | 239 | ||
250 | [Test] | 240 | [Test] |
251 | public void T103UpdateItem() | 241 | public void T103_UpdateItem() |
252 | { | 242 | { |
253 | // TODO: probably shouldn't have the ability to have an | 243 | // TODO: probably shouldn't have the ability to have an |
254 | // owner of an item in a folder not owned by the user | 244 | // owner of an item in a folder not owned by the user |
@@ -265,6 +255,31 @@ namespace OpenSim.Data.Tests | |||
265 | Assert.That(i1.Owner, Is.EqualTo(owner2), "Assert.That(i1.Owner, Is.EqualTo(owner2))"); | 255 | Assert.That(i1.Owner, Is.EqualTo(owner2), "Assert.That(i1.Owner, Is.EqualTo(owner2))"); |
266 | } | 256 | } |
267 | 257 | ||
258 | [Test] | ||
259 | public void T104_RandomUpdateItem() | ||
260 | { | ||
261 | InventoryItemBase expected = db.getInventoryItem(item1); | ||
262 | ScrambleForTesting.Scramble(expected); | ||
263 | expected.ID = item1; | ||
264 | db.updateInventoryItem(expected); | ||
265 | |||
266 | InventoryItemBase actual = db.getInventoryItem(item1); | ||
267 | Assert.That(actual, Constraints.PropertyCompareConstraint(expected) | ||
268 | .IgnoreProperty(x=>x.InvType) | ||
269 | .IgnoreProperty(x=>x.Description) | ||
270 | .IgnoreProperty(x=>x.CreatorId)); | ||
271 | } | ||
272 | |||
273 | [Test] | ||
274 | public void T999_StillNull() | ||
275 | { | ||
276 | // After all tests are run, these should still return no results | ||
277 | Assert.That(db.getInventoryFolder(zero), Is.Null); | ||
278 | Assert.That(db.getInventoryItem(zero), Is.Null); | ||
279 | Assert.That(db.getUserRootFolder(zero), Is.Null); | ||
280 | Assert.That(db.getInventoryInFolder(zero).Count, Is.EqualTo(0), "Assert.That(db.getInventoryInFolder(zero).Count, Is.EqualTo(0))"); | ||
281 | } | ||
282 | |||
268 | private InventoryItemBase NewItem(UUID id, UUID parent, UUID owner, string name, UUID asset) | 283 | private InventoryItemBase NewItem(UUID id, UUID parent, UUID owner, string name, UUID asset) |
269 | { | 284 | { |
270 | InventoryItemBase i = new InventoryItemBase(); | 285 | InventoryItemBase i = new InventoryItemBase(); |
diff --git a/OpenSim/Data/Tests/BasicRegionTest.cs b/OpenSim/Data/Tests/BasicRegionTest.cs index 836da78..a746ef0 100644 --- a/OpenSim/Data/Tests/BasicRegionTest.cs +++ b/OpenSim/Data/Tests/BasicRegionTest.cs | |||
@@ -532,6 +532,53 @@ namespace OpenSim.Data.Tests | |||
532 | Assert.That(cursop.Acceleration,Is.EqualTo(parts[i].Acceleration), "Assert.That(cursop.Acceleration,Is.EqualTo(parts[i].Acceleration))"); | 532 | Assert.That(cursop.Acceleration,Is.EqualTo(parts[i].Acceleration), "Assert.That(cursop.Acceleration,Is.EqualTo(parts[i].Acceleration))"); |
533 | } | 533 | } |
534 | } | 534 | } |
535 | |||
536 | [Test] | ||
537 | public void T016_RandomSogWithSceneParts() | ||
538 | { | ||
539 | UUID tmpSog = UUID.Random(); | ||
540 | UUID tmp1 = UUID.Random(); | ||
541 | UUID tmp2 = UUID.Random(); | ||
542 | UUID tmp3 = UUID.Random(); | ||
543 | UUID newregion = UUID.Random(); | ||
544 | SceneObjectPart p1 = new SceneObjectPart(); | ||
545 | SceneObjectPart p2 = new SceneObjectPart(); | ||
546 | SceneObjectPart p3 = new SceneObjectPart(); | ||
547 | p1.Shape = PrimitiveBaseShape.Default; | ||
548 | p2.Shape = PrimitiveBaseShape.Default; | ||
549 | p3.Shape = PrimitiveBaseShape.Default; | ||
550 | ScrambleForTesting.Scramble(p1); | ||
551 | ScrambleForTesting.Scramble(p2); | ||
552 | ScrambleForTesting.Scramble(p3); | ||
553 | p1.UUID = tmp1; | ||
554 | p2.UUID = tmp2; | ||
555 | p3.UUID = tmp3; | ||
556 | SceneObjectGroup sog = NewSOG("Sop 0", tmpSog, newregion); | ||
557 | ScrambleForTesting.Scramble(sog); | ||
558 | sog.UUID = tmpSog; | ||
559 | sog.AddPart(p1); | ||
560 | sog.AddPart(p2); | ||
561 | sog.AddPart(p3); | ||
562 | |||
563 | SceneObjectPart[] parts = sog.GetParts(); | ||
564 | Assert.That(parts.Length, Is.EqualTo(4), "Assert.That(parts.Length,Is.EqualTo(4))"); | ||
565 | |||
566 | db.StoreObject(sog, newregion); | ||
567 | List<SceneObjectGroup> sogs = db.LoadObjects(newregion); | ||
568 | Assert.That(sogs.Count, Is.EqualTo(1), "Assert.That(sogs.Count,Is.EqualTo(1))"); | ||
569 | SceneObjectGroup newsog = sogs[0]; | ||
570 | |||
571 | SceneObjectPart[] newparts = newsog.GetParts(); | ||
572 | Assert.That(newparts.Length, Is.EqualTo(4), "Assert.That(newparts.Length,Is.EqualTo(4))"); | ||
573 | |||
574 | Assert.That(newsog, Constraints.PropertyCompareConstraint(sog) | ||
575 | .IgnoreProperty(x=>x.LocalId) | ||
576 | .IgnoreProperty(x=>x.HasGroupChanged) | ||
577 | .IgnoreProperty(x=>x.IsSelected) | ||
578 | .IgnoreProperty(x=>x.RegionHandle) | ||
579 | .IgnoreProperty(x=>x.Scene) | ||
580 | .IgnoreProperty(x=>x.RootPart.InventorySerial)); | ||
581 | } | ||
535 | 582 | ||
536 | [Test] | 583 | [Test] |
537 | public void T020_PrimInventoryEmpty() | 584 | public void T020_PrimInventoryEmpty() |
diff --git a/OpenSim/Data/Tests/BasicUserTest.cs b/OpenSim/Data/Tests/BasicUserTest.cs index 4e4ddc8..21d1a7e 100644 --- a/OpenSim/Data/Tests/BasicUserTest.cs +++ b/OpenSim/Data/Tests/BasicUserTest.cs | |||
@@ -118,13 +118,6 @@ namespace OpenSim.Data.Tests | |||
118 | } | 118 | } |
119 | 119 | ||
120 | [Test] | 120 | [Test] |
121 | public void T999_StillNull() | ||
122 | { | ||
123 | Assert.That(db.GetUserByUUID(zero), Is.Null); | ||
124 | Assert.That(db.GetAgentByUUID(zero), Is.Null); | ||
125 | } | ||
126 | |||
127 | [Test] | ||
128 | public void T010_CreateUser() | 121 | public void T010_CreateUser() |
129 | { | 122 | { |
130 | UserProfileData u1 = NewUser(user1,fname1,lname1); | 123 | UserProfileData u1 = NewUser(user1,fname1,lname1); |
@@ -396,6 +389,22 @@ namespace OpenSim.Data.Tests | |||
396 | Assert.That(customtype,Is.EqualTo(u1a.CustomType), "Assert.That(customtype,Is.EqualTo(u1a.CustomType))"); | 389 | Assert.That(customtype,Is.EqualTo(u1a.CustomType), "Assert.That(customtype,Is.EqualTo(u1a.CustomType))"); |
397 | Assert.That(partner,Is.EqualTo(u1a.Partner), "Assert.That(partner,Is.EqualTo(u1a.Partner))"); | 390 | Assert.That(partner,Is.EqualTo(u1a.Partner), "Assert.That(partner,Is.EqualTo(u1a.Partner))"); |
398 | } | 391 | } |
392 | |||
393 | [Test] | ||
394 | public void T017_UserUpdateRandomPersistency() | ||
395 | { | ||
396 | UUID id = user5; | ||
397 | UserProfileData u = db.GetUserByUUID(id); | ||
398 | ScrambleForTesting.Scramble(u); | ||
399 | u.ID = id; | ||
400 | |||
401 | db.UpdateUserProfile(u); | ||
402 | UserProfileData u1a = db.GetUserByUUID(id); | ||
403 | Assert.That(u1a, Constraints.PropertyCompareConstraint(u) | ||
404 | .IgnoreProperty(x=>x.HomeRegionX) | ||
405 | .IgnoreProperty(x=>x.HomeRegionY) | ||
406 | ); | ||
407 | } | ||
399 | 408 | ||
400 | [Test] | 409 | [Test] |
401 | public void T020_CreateAgent() | 410 | public void T020_CreateAgent() |
@@ -660,6 +669,13 @@ namespace OpenSim.Data.Tests | |||
660 | Assert.That(avatarheight,Is.EqualTo(app.AvatarHeight), "Assert.That(avatarheight,Is.EqualTo(app.AvatarHeight))"); | 669 | Assert.That(avatarheight,Is.EqualTo(app.AvatarHeight), "Assert.That(avatarheight,Is.EqualTo(app.AvatarHeight))"); |
661 | } | 670 | } |
662 | 671 | ||
672 | [Test] | ||
673 | public void T999_StillNull() | ||
674 | { | ||
675 | Assert.That(db.GetUserByUUID(zero), Is.Null); | ||
676 | Assert.That(db.GetAgentByUUID(zero), Is.Null); | ||
677 | } | ||
678 | |||
663 | public UserProfileData NewUser(UUID id,string fname,string lname) | 679 | public UserProfileData NewUser(UUID id,string fname,string lname) |
664 | { | 680 | { |
665 | UserProfileData u = new UserProfileData(); | 681 | UserProfileData u = new UserProfileData(); |
diff --git a/bin/OpenSim.Data.NHibernate.Tests.dll.config b/bin/OpenSim.Data.NHibernate.Tests.dll.config index a3f681d..9b3231f 100644 --- a/bin/OpenSim.Data.NHibernate.Tests.dll.config +++ b/bin/OpenSim.Data.NHibernate.Tests.dll.config | |||
@@ -26,7 +26,7 @@ | |||
26 | 26 | ||
27 | <!-- Set root logger level to DEBUG and its only appender to A1 --> | 27 | <!-- Set root logger level to DEBUG and its only appender to A1 --> |
28 | <root> | 28 | <root> |
29 | <level value="DEBUG" /> | 29 | <level value="Info" /> |
30 | <appender-ref ref="A1" /> | 30 | <appender-ref ref="A1" /> |
31 | </root> | 31 | </root> |
32 | </log4net> | 32 | </log4net> |