From 23d478f2fa06d1dedabfb24cf6ff763b586173ce Mon Sep 17 00:00:00 2001
From: Kunnis
Date: Sun, 9 Aug 2009 02:01:21 -0500
Subject: Adding in Reflection-based testing, to ensure that all properties are
covered.
---
OpenSim/Data/MySQL/MySQLAssetData.cs | 1 +
OpenSim/Data/MySQL/MySQLInventoryData.cs | 11 ++--
OpenSim/Data/MySQL/MySQLRegionData.cs | 17 +++---
OpenSim/Data/MySQL/Tests/MySQLGridTest.cs | 8 +++
OpenSim/Data/MySQL/Tests/MySQLInventoryTest.cs | 12 +++-
OpenSim/Data/Tests/BasicAssetTest.cs | 19 ++++---
OpenSim/Data/Tests/BasicEstateTest.cs | 18 ++++++
OpenSim/Data/Tests/BasicGridTest.cs | 79 +++++---------------------
OpenSim/Data/Tests/BasicInventoryTest.cs | 37 ++++++++----
OpenSim/Data/Tests/BasicRegionTest.cs | 47 +++++++++++++++
OpenSim/Data/Tests/BasicUserTest.cs | 30 +++++++---
11 files changed, 174 insertions(+), 105 deletions(-)
(limited to 'OpenSim')
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
}
asset.Name = (string) dbReader["name"];
asset.Type = (sbyte) dbReader["assetType"];
+ asset.Temporary = (bool)dbReader["temporary"];
}
dbReader.Close();
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
item.EveryOnePermissions = (uint) reader["inventoryEveryOnePermissions"];
item.GroupPermissions = (uint) reader["inventoryGroupPermissions"];
item.SalePrice = (int) reader["salePrice"];
- item.SaleType = Convert.ToByte(reader["saleType"]);
+ item.SaleType = unchecked((byte)(Convert.ToSByte(reader["saleType"])));
item.CreationDate = (int) reader["creationDate"];
item.GroupOwned = Convert.ToBoolean(reader["groupOwned"]);
item.Flags = (uint) reader["flags"];
@@ -423,7 +423,7 @@ namespace OpenSim.Data.MySQL
///
/// Returns a specified inventory folder
///
- /// The folder to return
+ /// The folder to return
/// A folder class
public InventoryFolderBase getInventoryFolder(UUID folderID)
{
@@ -438,8 +438,9 @@ namespace OpenSim.Data.MySQL
result.Parameters.AddWithValue("?uuid", folderID.ToString());
MySqlDataReader reader = result.ExecuteReader();
- reader.Read();
- InventoryFolderBase folder = readInventoryFolder(reader);
+ InventoryFolderBase folder = null;
+ if(reader.Read())
+ folder = readInventoryFolder(reader);
reader.Close();
result.Dispose();
@@ -506,7 +507,7 @@ namespace OpenSim.Data.MySQL
result.Parameters.AddWithValue("?inventoryEveryOnePermissions", item.EveryOnePermissions);
result.Parameters.AddWithValue("?inventoryGroupPermissions", item.GroupPermissions);
result.Parameters.AddWithValue("?salePrice", item.SalePrice);
- result.Parameters.AddWithValue("?saleType", item.SaleType);
+ result.Parameters.AddWithValue("?saleType", unchecked((sbyte)item.SaleType));
result.Parameters.AddWithValue("?creationDate", item.CreationDate);
result.Parameters.AddWithValue("?groupID", item.GroupID);
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
// explicit conversion of integers is required, which sort
// of sucks. No idea if there is a shortcut here or not.
prim.CreationDate = Convert.ToInt32(row["CreationDate"]);
- prim.Name = (String) row["Name"];
+ if (row["Name"] != DBNull.Value)
+ prim.Name = (String)row["Name"];
+ else
+ prim.Name = string.Empty;
// various text fields
prim.Text = (String) row["Text"];
prim.Color = Color.FromArgb(Convert.ToInt32(row["ColorA"]),
@@ -945,12 +948,12 @@ namespace OpenSim.Data.MySQL
prim.DIE_AT_EDGE = true;
prim.SalePrice = Convert.ToInt32(row["SalePrice"]);
- prim.ObjectSaleType = Convert.ToByte(row["SaleType"]);
+ prim.ObjectSaleType = unchecked((byte)Convert.ToSByte(row["SaleType"]));
- prim.Material = Convert.ToByte(row["Material"]);
+ prim.Material = unchecked((byte)Convert.ToSByte(row["Material"]));
if (!(row["ClickAction"] is DBNull))
- prim.ClickAction = (byte)Convert.ToByte(row["ClickAction"]);
+ prim.ClickAction = unchecked((byte)Convert.ToSByte(row["ClickAction"]));
prim.CollisionSound = new UUID(row["CollisionSound"].ToString());
prim.CollisionSoundVolume = Convert.ToSingle(row["CollisionSoundVolume"]);
@@ -1277,12 +1280,12 @@ namespace OpenSim.Data.MySQL
cmd.Parameters.AddWithValue("DieAtEdge", 0);
cmd.Parameters.AddWithValue("SalePrice", prim.SalePrice);
- cmd.Parameters.AddWithValue("SaleType", Convert.ToInt16(prim.ObjectSaleType));
+ cmd.Parameters.AddWithValue("SaleType", unchecked((sbyte)(prim.ObjectSaleType)));
byte clickAction = prim.ClickAction;
- cmd.Parameters.AddWithValue("ClickAction", clickAction);
+ cmd.Parameters.AddWithValue("ClickAction", unchecked((sbyte)(clickAction)));
- cmd.Parameters.AddWithValue("Material", prim.Material);
+ cmd.Parameters.AddWithValue("Material", unchecked((sbyte)(prim.Material)));
cmd.Parameters.AddWithValue("CollisionSound", prim.CollisionSound.ToString());
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
m_log.Error("Exception {0}", e);
Assert.Ignore();
}
+
+ // This actually does the roll forward assembly stuff
+ Assembly assem = GetType().Assembly;
+ Migration m = new Migration(database.Connection, assem, "GridStore");
+
+ m.Update();
}
[TestFixtureTearDown]
public void Cleanup()
{
+ m_log.Warn("Cleaning up.");
if (db != null)
{
db.Dispose();
@@ -74,6 +81,7 @@ namespace OpenSim.Data.MySQL.Tests
// if a new table is added, it has to be dropped here
if (database != null)
{
+ database.ExecuteSql("drop table migrations");
database.ExecuteSql("drop table regions");
}
}
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
try
{
database = new MySQLManager(connect);
+ DropTables();
db = new MySQLInventoryData();
db.Initialise(connect);
}
@@ -72,10 +73,15 @@ namespace OpenSim.Data.MySQL.Tests
}
if (database != null)
{
- database.ExecuteSql("drop table inventoryitems");
- database.ExecuteSql("drop table inventoryfolders");
- database.ExecuteSql("drop table migrations");
+ DropTables();
}
}
+
+ private void DropTables()
+ {
+ database.ExecuteSql("drop table IF EXISTS inventoryitems");
+ database.ExecuteSql("drop table IF EXISTS inventoryfolders");
+ database.ExecuteSql("drop table IF EXISTS migrations");
+ }
}
}
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;
using OpenMetaverse;
using OpenSim.Framework;
using log4net;
-using System.Reflection;
namespace OpenSim.Data.Tests
{
@@ -77,25 +76,31 @@ namespace OpenSim.Data.Tests
AssetBase a1 = new AssetBase(uuid1, "asset one");
AssetBase a2 = new AssetBase(uuid2, "asset two");
AssetBase a3 = new AssetBase(uuid3, "asset three");
+
+ ScrambleForTesting.Scramble(a1);
+ ScrambleForTesting.Scramble(a2);
+ ScrambleForTesting.Scramble(a3);
+
a1.Data = asset1;
a2.Data = asset1;
a3.Data = asset1;
+ a1.FullID = uuid1;
+ a2.FullID = uuid2;
+ a3.FullID = uuid3;
+
db.CreateAsset(a1);
db.CreateAsset(a2);
db.CreateAsset(a3);
AssetBase a1a = db.FetchAsset(uuid1);
- Assert.That(a1.ID, Is.EqualTo(a1a.ID), "Assert.That(a1.ID, Is.EqualTo(a1a.ID))");
- Assert.That(a1.Name, Is.EqualTo(a1a.Name), "Assert.That(a1.Name, Is.EqualTo(a1a.Name))");
+ Assert.That(a1, Constraints.PropertyCompareConstraint(a1a));
AssetBase a2a = db.FetchAsset(uuid2);
- Assert.That(a2.ID, Is.EqualTo(a2a.ID), "Assert.That(a2.ID, Is.EqualTo(a2a.ID))");
- Assert.That(a2.Name, Is.EqualTo(a2a.Name), "Assert.That(a2.Name, Is.EqualTo(a2a.Name))");
+ Assert.That(a2, Constraints.PropertyCompareConstraint(a2a));
AssetBase a3a = db.FetchAsset(uuid3);
- Assert.That(a3.ID, Is.EqualTo(a3a.ID), "Assert.That(a3.ID, Is.EqualTo(a3a.ID))");
- Assert.That(a3.Name, Is.EqualTo(a3a.Name), "Assert.That(a3.Name, Is.EqualTo(a3a.Name))");
+ Assert.That(a3, Constraints.PropertyCompareConstraint(a3a));
}
[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
}
[Test]
+ private void T012_EstateSettingsRandomStorage()
+ {
+
+ // Letting estate store generate rows to database for us
+ EstateSettings originalSettings = db.LoadEstateSettings(REGION_ID);
+ ScrambleForTesting.Scramble(originalSettings);
+
+ // Saving settings.
+ db.StoreEstateSettings(originalSettings);
+
+ // Loading settings to another instance variable.
+ EstateSettings loadedSettings = db.LoadEstateSettings(REGION_ID);
+
+ // Checking that loaded values are correct.
+ Assert.That(loadedSettings, Constraints.PropertyCompareConstraint(originalSettings));
+ }
+
+ [Test]
public void T020_EstateSettingsManagerList()
{
// 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
public void removeAllRegions()
{
// Clean up all the regions.
- foreach (RegionProfileData region in db.GetRegionsByName("", 100))
+ List regions = db.GetRegionsByName("", 100);
+ if(regions != null)
{
- db.DeleteProfile(region.Uuid.ToString());
+ foreach (RegionProfileData region in regions)
+ {
+ db.DeleteProfile(region.Uuid.ToString());
+ }
}
}
@@ -74,35 +78,9 @@ namespace OpenSim.Data.Tests
protected RegionProfileData createRegion(UUID regionUUID, string regionName)
{
RegionProfileData reg = new RegionProfileData();
+ ScrambleForTesting.Scramble(reg);
reg.Uuid = regionUUID;
reg.RegionName = regionName;
- reg.RegionHandle = (ulong) random.Next();
- reg.RegionLocX = (uint) random.Next();
- reg.RegionLocY = (uint) random.Next();
- reg.RegionLocZ = (uint) random.Next();
- reg.RegionSendKey = RandomName();
- reg.RegionRecvKey = RandomName();
- reg.RegionSecret = RandomName();
- reg.RegionOnline = false;
- reg.ServerIP = RandomName();
- reg.ServerPort = (uint) random.Next();
- reg.ServerURI = RandomName();
- reg.ServerHttpPort = (uint) random.Next();
- reg.ServerRemotingPort = (uint) random.Next();
- reg.NorthOverrideHandle = (ulong) random.Next();
- reg.SouthOverrideHandle = (ulong) random.Next();
- reg.EastOverrideHandle = (ulong) random.Next();
- reg.WestOverrideHandle = (ulong) random.Next();
- reg.RegionDataURI = RandomName();
- reg.RegionAssetURI = RandomName();
- reg.RegionAssetSendKey = RandomName();
- reg.RegionAssetRecvKey = RandomName();
- reg.RegionUserURI = RandomName();
- reg.RegionUserSendKey = RandomName();
- reg.RegionUserRecvKey = RandomName();
- reg.RegionMapTextureID = UUID.Random();
- reg.Owner_uuid = UUID.Random();
- reg.OriginUUID = UUID.Random();
db.AddProfile(reg);
@@ -119,47 +97,12 @@ namespace OpenSim.Data.Tests
}
[Test]
- public void T999_StillNull()
- {
- Assert.That(db.GetProfileByUUID(zero),Is.Null);
- }
-
- [Test]
public void T011_AddRetrieveCompleteTest()
{
RegionProfileData newreg = createRegion(region2, "||");
RegionProfileData retreg = db.GetProfileByUUID(region2);
- Assert.That(retreg.RegionName, Is.EqualTo(newreg.RegionName), "Assert.That(retreg.RegionName, Is.EqualTo(newreg.RegionName))");
- Assert.That(retreg.Uuid, Is.EqualTo(region2), "Assert.That(retreg.Uuid, Is.EqualTo(region2))");
- Assert.That(retreg.RegionHandle, Is.EqualTo(newreg.RegionHandle), "Assert.That(retreg.RegionHandle, Is.EqualTo(newreg.RegionHandle))");
- Assert.That(retreg.RegionLocX, Is.EqualTo(newreg.RegionLocX), "Assert.That(retreg.RegionLocX, Is.EqualTo(newreg.RegionLocX))");
- Assert.That(retreg.RegionLocY, Is.EqualTo(newreg.RegionLocY), "Assert.That(retreg.RegionLocY, Is.EqualTo(newreg.RegionLocY))");
- Assert.That(retreg.RegionLocZ, Is.EqualTo(newreg.RegionLocZ), "Assert.That(retreg.RegionLocZ, Is.EqualTo(newreg.RegionLocZ))");
- Assert.That(retreg.RegionSendKey, Is.EqualTo(newreg.RegionSendKey), "Assert.That(retreg.RegionSendKey, Is.EqualTo(newreg.RegionSendKey))");
- Assert.That(retreg.RegionRecvKey, Is.EqualTo(newreg.RegionRecvKey), "Assert.That(retreg.RegionRecvKey, Is.EqualTo(newreg.RegionRecvKey))");
- Assert.That(retreg.RegionSecret, Is.EqualTo(newreg.RegionSecret), "Assert.That(retreg.RegionSecret, Is.EqualTo(newreg.RegionSecret))");
- Assert.That(retreg.RegionOnline, Is.EqualTo(newreg.RegionOnline), "Assert.That(retreg.RegionOnline, Is.EqualTo(newreg.RegionOnline))");
- Assert.That(retreg.OriginUUID, Is.EqualTo(newreg.OriginUUID), "Assert.That(retreg.OriginUUID, Is.EqualTo(newreg.OriginUUID))");
- Assert.That(retreg.ServerIP, Is.EqualTo(newreg.ServerIP), "Assert.That(retreg.ServerIP, Is.EqualTo(newreg.ServerIP))");
- Assert.That(retreg.ServerPort, Is.EqualTo(newreg.ServerPort), "Assert.That(retreg.ServerPort, Is.EqualTo(newreg.ServerPort))");
- Assert.That(retreg.ServerURI, Is.EqualTo(newreg.ServerURI), "Assert.That(retreg.ServerURI, Is.EqualTo(newreg.ServerURI))");
- Assert.That(retreg.ServerHttpPort, Is.EqualTo(newreg.ServerHttpPort), "Assert.That(retreg.ServerHttpPort, Is.EqualTo(newreg.ServerHttpPort))");
- Assert.That(retreg.ServerRemotingPort, Is.EqualTo(newreg.ServerRemotingPort), "Assert.That(retreg.ServerRemotingPort, Is.EqualTo(newreg.ServerRemotingPort))");
- Assert.That(retreg.NorthOverrideHandle, Is.EqualTo(newreg.NorthOverrideHandle), "Assert.That(retreg.NorthOverrideHandle, Is.EqualTo(newreg.NorthOverrideHandle))");
- Assert.That(retreg.SouthOverrideHandle, Is.EqualTo(newreg.SouthOverrideHandle), "Assert.That(retreg.SouthOverrideHandle, Is.EqualTo(newreg.SouthOverrideHandle))");
- Assert.That(retreg.EastOverrideHandle, Is.EqualTo(newreg.EastOverrideHandle), "Assert.That(retreg.EastOverrideHandle, Is.EqualTo(newreg.EastOverrideHandle))");
- Assert.That(retreg.WestOverrideHandle, Is.EqualTo(newreg.WestOverrideHandle), "Assert.That(retreg.WestOverrideHandle, Is.EqualTo(newreg.WestOverrideHandle))");
- Assert.That(retreg.RegionDataURI, Is.EqualTo(newreg.RegionDataURI), "Assert.That(retreg.RegionDataURI, Is.EqualTo(newreg.RegionDataURI))");
- Assert.That(retreg.RegionAssetURI, Is.EqualTo(newreg.RegionAssetURI), "Assert.That(retreg.RegionAssetURI, Is.EqualTo(newreg.RegionAssetURI))");
- Assert.That(retreg.RegionAssetSendKey, Is.EqualTo(newreg.RegionAssetSendKey), "Assert.That(retreg.RegionAssetSendKey, Is.EqualTo(newreg.RegionAssetSendKey))");
- Assert.That(retreg.RegionAssetRecvKey, Is.EqualTo(newreg.RegionAssetRecvKey), "Assert.That(retreg.RegionAssetRecvKey, Is.EqualTo(newreg.RegionAssetRecvKey))");
- Assert.That(retreg.RegionUserURI, Is.EqualTo(newreg.RegionUserURI), "Assert.That(retreg.RegionUserURI, Is.EqualTo(newreg.RegionUserURI))");
- Assert.That(retreg.RegionUserSendKey, Is.EqualTo(newreg.RegionUserSendKey), "Assert.That(retreg.RegionUserSendKey, Is.EqualTo(newreg.RegionUserSendKey))");
- Assert.That(retreg.RegionUserRecvKey, Is.EqualTo(newreg.RegionUserRecvKey), "Assert.That(retreg.RegionUserRecvKey, Is.EqualTo(newreg.RegionUserRecvKey))");
- Assert.That(retreg.RegionMapTextureID, Is.EqualTo(newreg.RegionMapTextureID), "Assert.That(retreg.RegionMapTextureID, Is.EqualTo(newreg.RegionMapTextureID))");
- Assert.That(retreg.Owner_uuid, Is.EqualTo(newreg.Owner_uuid), "Assert.That(retreg.Owner_uuid, Is.EqualTo(newreg.Owner_uuid))");
- Assert.That(retreg.OriginUUID, Is.EqualTo(newreg.OriginUUID), "Assert.That(retreg.OriginUUID, Is.EqualTo(newreg.OriginUUID))");
+ Assert.That(retreg, Constraints.PropertyCompareConstraint(newreg).IgnoreProperty(x => x.RegionOnline));
retreg = db.GetProfileByHandle(newreg.RegionHandle);
Assert.That(retreg.Uuid, Is.EqualTo(region2), "Assert.That(retreg.Uuid, Is.EqualTo(region2))");
@@ -220,6 +163,12 @@ namespace OpenSim.Data.Tests
Assert.That(listreg[1].Uuid, Is.EqualTo(region1) | Is.EqualTo(region2), "Assert.That(listreg[1].Uuid, Is.EqualTo(region1) | Is.EqualTo(region2))");
}
+ [Test]
+ public void T999_StillNull()
+ {
+ Assert.That(db.GetProfileByUUID(zero), Is.Null);
+ }
+
protected static string RandomName()
{
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
Assert.That(db.getUserRootFolder(owner1), Is.Null);
}
- [Test]
- public void T999_StillNull()
- {
- // After all tests are run, these should still return no results
- Assert.That(db.getInventoryFolder(zero), Is.Null);
- Assert.That(db.getInventoryItem(zero), Is.Null);
- Assert.That(db.getUserRootFolder(zero), Is.Null);
- Assert.That(db.getInventoryInFolder(zero).Count, Is.EqualTo(0), "Assert.That(db.getInventoryInFolder(zero).Count, Is.EqualTo(0))");
- }
-
// 01x - folder tests
[Test]
public void T010_FolderNonParent()
@@ -248,7 +238,7 @@ namespace OpenSim.Data.Tests
}
[Test]
- public void T103UpdateItem()
+ public void T103_UpdateItem()
{
// TODO: probably shouldn't have the ability to have an
// owner of an item in a folder not owned by the user
@@ -265,6 +255,31 @@ namespace OpenSim.Data.Tests
Assert.That(i1.Owner, Is.EqualTo(owner2), "Assert.That(i1.Owner, Is.EqualTo(owner2))");
}
+ [Test]
+ public void T104_RandomUpdateItem()
+ {
+ InventoryItemBase expected = db.getInventoryItem(item1);
+ ScrambleForTesting.Scramble(expected);
+ expected.ID = item1;
+ db.updateInventoryItem(expected);
+
+ InventoryItemBase actual = db.getInventoryItem(item1);
+ Assert.That(actual, Constraints.PropertyCompareConstraint(expected)
+ .IgnoreProperty(x=>x.InvType)
+ .IgnoreProperty(x=>x.Description)
+ .IgnoreProperty(x=>x.CreatorId));
+ }
+
+ [Test]
+ public void T999_StillNull()
+ {
+ // After all tests are run, these should still return no results
+ Assert.That(db.getInventoryFolder(zero), Is.Null);
+ Assert.That(db.getInventoryItem(zero), Is.Null);
+ Assert.That(db.getUserRootFolder(zero), Is.Null);
+ Assert.That(db.getInventoryInFolder(zero).Count, Is.EqualTo(0), "Assert.That(db.getInventoryInFolder(zero).Count, Is.EqualTo(0))");
+ }
+
private InventoryItemBase NewItem(UUID id, UUID parent, UUID owner, string name, UUID asset)
{
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
Assert.That(cursop.Acceleration,Is.EqualTo(parts[i].Acceleration), "Assert.That(cursop.Acceleration,Is.EqualTo(parts[i].Acceleration))");
}
}
+
+ [Test]
+ public void T016_RandomSogWithSceneParts()
+ {
+ UUID tmpSog = UUID.Random();
+ UUID tmp1 = UUID.Random();
+ UUID tmp2 = UUID.Random();
+ UUID tmp3 = UUID.Random();
+ UUID newregion = UUID.Random();
+ SceneObjectPart p1 = new SceneObjectPart();
+ SceneObjectPart p2 = new SceneObjectPart();
+ SceneObjectPart p3 = new SceneObjectPart();
+ p1.Shape = PrimitiveBaseShape.Default;
+ p2.Shape = PrimitiveBaseShape.Default;
+ p3.Shape = PrimitiveBaseShape.Default;
+ ScrambleForTesting.Scramble(p1);
+ ScrambleForTesting.Scramble(p2);
+ ScrambleForTesting.Scramble(p3);
+ p1.UUID = tmp1;
+ p2.UUID = tmp2;
+ p3.UUID = tmp3;
+ SceneObjectGroup sog = NewSOG("Sop 0", tmpSog, newregion);
+ ScrambleForTesting.Scramble(sog);
+ sog.UUID = tmpSog;
+ sog.AddPart(p1);
+ sog.AddPart(p2);
+ sog.AddPart(p3);
+
+ SceneObjectPart[] parts = sog.GetParts();
+ Assert.That(parts.Length, Is.EqualTo(4), "Assert.That(parts.Length,Is.EqualTo(4))");
+
+ db.StoreObject(sog, newregion);
+ List sogs = db.LoadObjects(newregion);
+ Assert.That(sogs.Count, Is.EqualTo(1), "Assert.That(sogs.Count,Is.EqualTo(1))");
+ SceneObjectGroup newsog = sogs[0];
+
+ SceneObjectPart[] newparts = newsog.GetParts();
+ Assert.That(newparts.Length, Is.EqualTo(4), "Assert.That(newparts.Length,Is.EqualTo(4))");
+
+ Assert.That(newsog, Constraints.PropertyCompareConstraint(sog)
+ .IgnoreProperty(x=>x.LocalId)
+ .IgnoreProperty(x=>x.HasGroupChanged)
+ .IgnoreProperty(x=>x.IsSelected)
+ .IgnoreProperty(x=>x.RegionHandle)
+ .IgnoreProperty(x=>x.Scene)
+ .IgnoreProperty(x=>x.RootPart.InventorySerial));
+ }
[Test]
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
}
[Test]
- public void T999_StillNull()
- {
- Assert.That(db.GetUserByUUID(zero), Is.Null);
- Assert.That(db.GetAgentByUUID(zero), Is.Null);
- }
-
- [Test]
public void T010_CreateUser()
{
UserProfileData u1 = NewUser(user1,fname1,lname1);
@@ -396,6 +389,22 @@ namespace OpenSim.Data.Tests
Assert.That(customtype,Is.EqualTo(u1a.CustomType), "Assert.That(customtype,Is.EqualTo(u1a.CustomType))");
Assert.That(partner,Is.EqualTo(u1a.Partner), "Assert.That(partner,Is.EqualTo(u1a.Partner))");
}
+
+ [Test]
+ public void T017_UserUpdateRandomPersistency()
+ {
+ UUID id = user5;
+ UserProfileData u = db.GetUserByUUID(id);
+ ScrambleForTesting.Scramble(u);
+ u.ID = id;
+
+ db.UpdateUserProfile(u);
+ UserProfileData u1a = db.GetUserByUUID(id);
+ Assert.That(u1a, Constraints.PropertyCompareConstraint(u)
+ .IgnoreProperty(x=>x.HomeRegionX)
+ .IgnoreProperty(x=>x.HomeRegionY)
+ );
+ }
[Test]
public void T020_CreateAgent()
@@ -660,6 +669,13 @@ namespace OpenSim.Data.Tests
Assert.That(avatarheight,Is.EqualTo(app.AvatarHeight), "Assert.That(avatarheight,Is.EqualTo(app.AvatarHeight))");
}
+ [Test]
+ public void T999_StillNull()
+ {
+ Assert.That(db.GetUserByUUID(zero), Is.Null);
+ Assert.That(db.GetAgentByUUID(zero), Is.Null);
+ }
+
public UserProfileData NewUser(UUID id,string fname,string lname)
{
UserProfileData u = new UserProfileData();
--
cgit v1.1