Adding in Reflection-based testing, to ensure that all properties are covered.

arthursv
Kunnis 2009-08-09 02:01:21 -05:00 committed by Teravus Ovares (Dan Olivares)
parent 58d2775ff2
commit 23d478f2fa
12 changed files with 175 additions and 106 deletions

View File

@ -168,6 +168,7 @@ namespace OpenSim.Data.MySQL
} }
asset.Name = (string) dbReader["name"]; asset.Name = (string) dbReader["name"];
asset.Type = (sbyte) dbReader["assetType"]; asset.Type = (sbyte) dbReader["assetType"];
asset.Temporary = (bool)dbReader["temporary"];
} }
dbReader.Close(); dbReader.Close();
cmd.Dispose(); cmd.Dispose();

View File

@ -342,7 +342,7 @@ namespace OpenSim.Data.MySQL
item.EveryOnePermissions = (uint) reader["inventoryEveryOnePermissions"]; item.EveryOnePermissions = (uint) reader["inventoryEveryOnePermissions"];
item.GroupPermissions = (uint) reader["inventoryGroupPermissions"]; item.GroupPermissions = (uint) reader["inventoryGroupPermissions"];
item.SalePrice = (int) reader["salePrice"]; 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.CreationDate = (int) reader["creationDate"];
item.GroupOwned = Convert.ToBoolean(reader["groupOwned"]); item.GroupOwned = Convert.ToBoolean(reader["groupOwned"]);
item.Flags = (uint) reader["flags"]; item.Flags = (uint) reader["flags"];
@ -423,7 +423,7 @@ namespace OpenSim.Data.MySQL
/// <summary> /// <summary>
/// Returns a specified inventory folder /// Returns a specified inventory folder
/// </summary> /// </summary>
/// <param name="folder">The folder to return</param> /// <param name="folderID">The folder to return</param>
/// <returns>A folder class</returns> /// <returns>A folder class</returns>
public InventoryFolderBase getInventoryFolder(UUID folderID) public InventoryFolderBase getInventoryFolder(UUID folderID)
{ {
@ -438,8 +438,9 @@ namespace OpenSim.Data.MySQL
result.Parameters.AddWithValue("?uuid", folderID.ToString()); result.Parameters.AddWithValue("?uuid", folderID.ToString());
MySqlDataReader reader = result.ExecuteReader(); MySqlDataReader reader = result.ExecuteReader();
reader.Read(); InventoryFolderBase folder = null;
InventoryFolderBase folder = readInventoryFolder(reader); if(reader.Read())
folder = readInventoryFolder(reader);
reader.Close(); reader.Close();
result.Dispose(); result.Dispose();
@ -506,7 +507,7 @@ namespace OpenSim.Data.MySQL
result.Parameters.AddWithValue("?inventoryEveryOnePermissions", item.EveryOnePermissions); result.Parameters.AddWithValue("?inventoryEveryOnePermissions", item.EveryOnePermissions);
result.Parameters.AddWithValue("?inventoryGroupPermissions", item.GroupPermissions); result.Parameters.AddWithValue("?inventoryGroupPermissions", item.GroupPermissions);
result.Parameters.AddWithValue("?salePrice", item.SalePrice); 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("?creationDate", item.CreationDate);
result.Parameters.AddWithValue("?groupID", item.GroupID); result.Parameters.AddWithValue("?groupID", item.GroupID);
result.Parameters.AddWithValue("?groupOwned", item.GroupOwned); result.Parameters.AddWithValue("?groupOwned", item.GroupOwned);

View File

@ -834,7 +834,10 @@ namespace OpenSim.Data.MySQL
// explicit conversion of integers is required, which sort // explicit conversion of integers is required, which sort
// of sucks. No idea if there is a shortcut here or not. // of sucks. No idea if there is a shortcut here or not.
prim.CreationDate = Convert.ToInt32(row["CreationDate"]); prim.CreationDate = Convert.ToInt32(row["CreationDate"]);
if (row["Name"] != DBNull.Value)
prim.Name = (String)row["Name"]; prim.Name = (String)row["Name"];
else
prim.Name = string.Empty;
// various text fields // various text fields
prim.Text = (String) row["Text"]; prim.Text = (String) row["Text"];
prim.Color = Color.FromArgb(Convert.ToInt32(row["ColorA"]), prim.Color = Color.FromArgb(Convert.ToInt32(row["ColorA"]),
@ -945,12 +948,12 @@ namespace OpenSim.Data.MySQL
prim.DIE_AT_EDGE = true; prim.DIE_AT_EDGE = true;
prim.SalePrice = Convert.ToInt32(row["SalePrice"]); 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)) 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.CollisionSound = new UUID(row["CollisionSound"].ToString());
prim.CollisionSoundVolume = Convert.ToSingle(row["CollisionSoundVolume"]); prim.CollisionSoundVolume = Convert.ToSingle(row["CollisionSoundVolume"]);
@ -1277,12 +1280,12 @@ namespace OpenSim.Data.MySQL
cmd.Parameters.AddWithValue("DieAtEdge", 0); cmd.Parameters.AddWithValue("DieAtEdge", 0);
cmd.Parameters.AddWithValue("SalePrice", prim.SalePrice); 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; 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("CollisionSound", prim.CollisionSound.ToString());
cmd.Parameters.AddWithValue("CollisionSoundVolume", prim.CollisionSoundVolume); cmd.Parameters.AddWithValue("CollisionSoundVolume", prim.CollisionSoundVolume);

View File

@ -62,11 +62,18 @@ namespace OpenSim.Data.MySQL.Tests
m_log.Error("Exception {0}", e); m_log.Error("Exception {0}", e);
Assert.Ignore(); 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] [TestFixtureTearDown]
public void Cleanup() public void Cleanup()
{ {
m_log.Warn("Cleaning up.");
if (db != null) if (db != null)
{ {
db.Dispose(); db.Dispose();
@ -74,6 +81,7 @@ namespace OpenSim.Data.MySQL.Tests
// if a new table is added, it has to be dropped here // if a new table is added, it has to be dropped here
if (database != null) if (database != null)
{ {
database.ExecuteSql("drop table migrations");
database.ExecuteSql("drop table regions"); database.ExecuteSql("drop table regions");
} }
} }

View File

@ -53,6 +53,7 @@ namespace OpenSim.Data.MySQL.Tests
try try
{ {
database = new MySQLManager(connect); database = new MySQLManager(connect);
DropTables();
db = new MySQLInventoryData(); db = new MySQLInventoryData();
db.Initialise(connect); db.Initialise(connect);
} }
@ -72,10 +73,15 @@ namespace OpenSim.Data.MySQL.Tests
} }
if (database != null) if (database != null)
{ {
database.ExecuteSql("drop table inventoryitems"); DropTables();
database.ExecuteSql("drop table inventoryfolders"); }
database.ExecuteSql("drop table migrations"); }
}
private void DropTables()
{
database.ExecuteSql("drop table IF EXISTS inventoryitems");
database.ExecuteSql("drop table IF EXISTS inventoryfolders");
database.ExecuteSql("drop table IF EXISTS migrations");
} }
} }
} }

View File

@ -32,7 +32,6 @@ using NUnit.Framework.SyntaxHelpers;
using OpenMetaverse; using OpenMetaverse;
using OpenSim.Framework; using OpenSim.Framework;
using log4net; using log4net;
using System.Reflection;
namespace OpenSim.Data.Tests namespace OpenSim.Data.Tests
{ {
@ -77,25 +76,31 @@ namespace OpenSim.Data.Tests
AssetBase a1 = new AssetBase(uuid1, "asset one"); AssetBase a1 = new AssetBase(uuid1, "asset one");
AssetBase a2 = new AssetBase(uuid2, "asset two"); AssetBase a2 = new AssetBase(uuid2, "asset two");
AssetBase a3 = new AssetBase(uuid3, "asset three"); AssetBase a3 = new AssetBase(uuid3, "asset three");
ScrambleForTesting.Scramble(a1);
ScrambleForTesting.Scramble(a2);
ScrambleForTesting.Scramble(a3);
a1.Data = asset1; a1.Data = asset1;
a2.Data = asset1; a2.Data = asset1;
a3.Data = asset1; a3.Data = asset1;
a1.FullID = uuid1;
a2.FullID = uuid2;
a3.FullID = uuid3;
db.CreateAsset(a1); db.CreateAsset(a1);
db.CreateAsset(a2); db.CreateAsset(a2);
db.CreateAsset(a3); db.CreateAsset(a3);
AssetBase a1a = db.FetchAsset(uuid1); AssetBase a1a = db.FetchAsset(uuid1);
Assert.That(a1.ID, Is.EqualTo(a1a.ID), "Assert.That(a1.ID, Is.EqualTo(a1a.ID))"); Assert.That(a1, Constraints.PropertyCompareConstraint(a1a));
Assert.That(a1.Name, Is.EqualTo(a1a.Name), "Assert.That(a1.Name, Is.EqualTo(a1a.Name))");
AssetBase a2a = db.FetchAsset(uuid2); AssetBase a2a = db.FetchAsset(uuid2);
Assert.That(a2.ID, Is.EqualTo(a2a.ID), "Assert.That(a2.ID, Is.EqualTo(a2a.ID))"); Assert.That(a2, Constraints.PropertyCompareConstraint(a2a));
Assert.That(a2.Name, Is.EqualTo(a2a.Name), "Assert.That(a2.Name, Is.EqualTo(a2a.Name))");
AssetBase a3a = db.FetchAsset(uuid3); AssetBase a3a = db.FetchAsset(uuid3);
Assert.That(a3.ID, Is.EqualTo(a3a.ID), "Assert.That(a3.ID, Is.EqualTo(a3a.ID))"); Assert.That(a3, Constraints.PropertyCompareConstraint(a3a));
Assert.That(a3.Name, Is.EqualTo(a3a.Name), "Assert.That(a3.Name, Is.EqualTo(a3a.Name))");
} }
[Test] [Test]

View File

@ -162,6 +162,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] [Test]
public void T020_EstateSettingsManagerList() public void T020_EstateSettingsManagerList()
{ {

View File

@ -49,11 +49,15 @@ namespace OpenSim.Data.Tests
public void removeAllRegions() public void removeAllRegions()
{ {
// Clean up all the regions. // Clean up all the regions.
foreach (RegionProfileData region in db.GetRegionsByName("", 100)) List<RegionProfileData> regions = db.GetRegionsByName("", 100);
if(regions != null)
{
foreach (RegionProfileData region in regions)
{ {
db.DeleteProfile(region.Uuid.ToString()); db.DeleteProfile(region.Uuid.ToString());
} }
} }
}
public void SuperInit() public void SuperInit()
{ {
@ -74,35 +78,9 @@ namespace OpenSim.Data.Tests
protected RegionProfileData createRegion(UUID regionUUID, string regionName) protected RegionProfileData createRegion(UUID regionUUID, string regionName)
{ {
RegionProfileData reg = new RegionProfileData(); RegionProfileData reg = new RegionProfileData();
ScrambleForTesting.Scramble(reg);
reg.Uuid = regionUUID; reg.Uuid = regionUUID;
reg.RegionName = regionName; 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); db.AddProfile(reg);
@ -118,48 +96,13 @@ namespace OpenSim.Data.Tests
Assert.That(db.GetProfileByUUID(zero),Is.Null); Assert.That(db.GetProfileByUUID(zero),Is.Null);
} }
[Test]
public void T999_StillNull()
{
Assert.That(db.GetProfileByUUID(zero),Is.Null);
}
[Test] [Test]
public void T011_AddRetrieveCompleteTest() public void T011_AddRetrieveCompleteTest()
{ {
RegionProfileData newreg = createRegion(region2, "|<Goth@m Ci1y>|"); RegionProfileData newreg = createRegion(region2, "|<Goth@m Ci1y>|");
RegionProfileData retreg = db.GetProfileByUUID(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, Constraints.PropertyCompareConstraint(newreg).IgnoreProperty(x => x.RegionOnline));
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))");
retreg = db.GetProfileByHandle(newreg.RegionHandle); retreg = db.GetProfileByHandle(newreg.RegionHandle);
Assert.That(retreg.Uuid, Is.EqualTo(region2), "Assert.That(retreg.Uuid, Is.EqualTo(region2))"); 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))"); 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() protected static string RandomName()
{ {
StringBuilder name = new StringBuilder(); StringBuilder name = new StringBuilder();

View File

@ -115,16 +115,6 @@ namespace OpenSim.Data.Tests
Assert.That(db.getUserRootFolder(owner1), Is.Null); 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 // 01x - folder tests
[Test] [Test]
public void T010_FolderNonParent() public void T010_FolderNonParent()
@ -248,7 +238,7 @@ namespace OpenSim.Data.Tests
} }
[Test] [Test]
public void T103UpdateItem() public void T103_UpdateItem()
{ {
// TODO: probably shouldn't have the ability to have an // TODO: probably shouldn't have the ability to have an
// owner of an item in a folder not owned by the user // 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))"); 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) private InventoryItemBase NewItem(UUID id, UUID parent, UUID owner, string name, UUID asset)
{ {
InventoryItemBase i = new InventoryItemBase(); InventoryItemBase i = new InventoryItemBase();

View File

@ -533,6 +533,53 @@ namespace OpenSim.Data.Tests
} }
} }
[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<SceneObjectGroup> 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] [Test]
public void T020_PrimInventoryEmpty() public void T020_PrimInventoryEmpty()
{ {

View File

@ -117,13 +117,6 @@ namespace OpenSim.Data.Tests
Assert.That(db.GetAgentByUUID(UUID.Random()), Is.Null); Assert.That(db.GetAgentByUUID(UUID.Random()), Is.Null);
} }
[Test]
public void T999_StillNull()
{
Assert.That(db.GetUserByUUID(zero), Is.Null);
Assert.That(db.GetAgentByUUID(zero), Is.Null);
}
[Test] [Test]
public void T010_CreateUser() public void T010_CreateUser()
{ {
@ -397,6 +390,22 @@ namespace OpenSim.Data.Tests
Assert.That(partner,Is.EqualTo(u1a.Partner), "Assert.That(partner,Is.EqualTo(u1a.Partner))"); 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] [Test]
public void T020_CreateAgent() 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))"); 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) public UserProfileData NewUser(UUID id,string fname,string lname)
{ {
UserProfileData u = new UserProfileData(); UserProfileData u = new UserProfileData();

View File

@ -26,7 +26,7 @@
<!-- Set root logger level to DEBUG and its only appender to A1 --> <!-- Set root logger level to DEBUG and its only appender to A1 -->
<root> <root>
<level value="DEBUG" /> <level value="Info" />
<appender-ref ref="A1" /> <appender-ref ref="A1" />
</root> </root>
</log4net> </log4net>