From ad02aefaee803a0a2118eff6bfaa436f3099e121 Mon Sep 17 00:00:00 2001
From: Jeff Ames
Date: Mon, 17 Aug 2009 01:45:48 +0900
Subject: Fix argument index in log4net call. (fixes #4003)
---
.../ServiceConnectorsIn/Land/LandServiceInConnectorModule.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'OpenSim')
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Land/LandServiceInConnectorModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Land/LandServiceInConnectorModule.cs
index 20671e0..bce160a 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Land/LandServiceInConnectorModule.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Land/LandServiceInConnectorModule.cs
@@ -123,7 +123,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Land
public LandData GetLandData(ulong regionHandle, uint x, uint y)
{
- m_log.DebugFormat("[LAND IN CONNECTOR]: GetLandData for {0}. Count = {2}",
+ m_log.DebugFormat("[LAND IN CONNECTOR]: GetLandData for {0}. Count = {1}",
regionHandle, m_Scenes.Count);
foreach (Scene s in m_Scenes)
{
--
cgit v1.1
From 58d2775ff29c1a4faa26302515c7a6cbd8bdb764 Mon Sep 17 00:00:00 2001
From: Jeff Ames
Date: Mon, 17 Aug 2009 02:05:12 +0900
Subject: Add copyright header. Formatting cleanup.
---
.../Framework/Scenes/Tests/ScenePresenceTests.cs | 2 +-
.../Minimodule/Interfaces/IAvatarAttachment.cs | 27 ++++++++++++++++++++++
.../Scripting/Minimodule/SOPObject.cs | 4 ++--
3 files changed, 30 insertions(+), 3 deletions(-)
(limited to 'OpenSim')
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs
index 8ec14c7..88452d2 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs
@@ -72,7 +72,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
scene3 = SceneSetupHelpers.SetupScene("Neighbour x-1", UUID.Random(), 999, 1000, cm);
ISharedRegionModule interregionComms = new RESTInterregionComms();
- interregionComms.Initialise( new IniConfigSource());
+ interregionComms.Initialise(new IniConfigSource());
interregionComms.PostInitialise();
SceneSetupHelpers.SetupSceneModules(scene, new IniConfigSource(), interregionComms);
SceneSetupHelpers.SetupSceneModules(scene2, new IniConfigSource(), interregionComms);
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IAvatarAttachment.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IAvatarAttachment.cs
index 22b4605..1993948 100644
--- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IAvatarAttachment.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IAvatarAttachment.cs
@@ -1,3 +1,30 @@
+/*
+ * Copyright (c) Contributors, http://opensimulator.org/
+ * See CONTRIBUTORS.TXT for a full list of copyright holders.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of the OpenSimulator Project nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
{
public interface IAvatarAttachment
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs
index 35b0a0f..292e345 100644
--- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs
@@ -71,7 +71,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
private bool CanEdit()
{
- if(!m_security.CanEditObject(this))
+ if (!m_security.CanEditObject(this))
{
throw new SecurityException("Insufficient Permission to edit object with UUID [" + GetSOP().UUID + "]");
}
@@ -672,7 +672,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
get { return m_sculptType; }
set
{
- if(!CanEdit())
+ if (!CanEdit())
return;
m_sculptType = value;
--
cgit v1.1
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
From f6251ce810e0bebe68d08a8e4b20a9dfc3fe1af6 Mon Sep 17 00:00:00 2001
From: Kunnis
Date: Sat, 15 Aug 2009 06:08:36 -0500
Subject: * Modified SQLite/SQLiteInventoryStore.cs to not throw if the
inventory row does not exist, to match the mysql behavior. * Modified
SQLite/SQLiteRegionData.cs to only persist temporary items following the same
rules mysql uses. * Added another ignore to the inventory test that was
missing. * Added a few more ignores to the RegionTest that the first version
of my test were missing. * Added ignoring the root Folder ID, which is set by
the inventory system. * Added several improvements to the
PropertyCompareConstraint: Protection against infinite loops, added
IComparable (for UUID) and moved IComparable before the property matching.
* Fixed a bug where I was saving the inside of the ignore expression instead
of the outside of it.
---
OpenSim/Data/SQLite/SQLiteInventoryStore.cs | 3 +-
OpenSim/Data/SQLite/SQLiteRegionData.cs | 29 ++--
OpenSim/Data/Tests/BasicInventoryTest.cs | 1 +
OpenSim/Data/Tests/BasicRegionTest.cs | 4 +-
OpenSim/Data/Tests/BasicUserTest.cs | 1 +
OpenSim/Data/Tests/PropertyCompareConstraint.cs | 180 ++++++++++++++++++------
6 files changed, 154 insertions(+), 64 deletions(-)
(limited to 'OpenSim')
diff --git a/OpenSim/Data/SQLite/SQLiteInventoryStore.cs b/OpenSim/Data/SQLite/SQLiteInventoryStore.cs
index 97c40ba..557dec7 100644
--- a/OpenSim/Data/SQLite/SQLiteInventoryStore.cs
+++ b/OpenSim/Data/SQLite/SQLiteInventoryStore.cs
@@ -301,7 +301,8 @@ namespace OpenSim.Data.SQLite
DataTable inventoryFolderTable = ds.Tables["inventoryfolders"];
inventoryRow = inventoryFolderTable.Rows.Find(item.Folder.ToString());
- inventoryRow["version"] = (int)inventoryRow["version"] + 1;
+ if(inventoryRow != null) //MySQL doesn't throw an exception here, so sqlite shouldn't either.
+ inventoryRow["version"] = (int)inventoryRow["version"] + 1;
invFoldersDa.Update(ds, "inventoryfolders");
}
diff --git a/OpenSim/Data/SQLite/SQLiteRegionData.cs b/OpenSim/Data/SQLite/SQLiteRegionData.cs
index d2548c2..0259ac5 100644
--- a/OpenSim/Data/SQLite/SQLiteRegionData.cs
+++ b/OpenSim/Data/SQLite/SQLiteRegionData.cs
@@ -307,26 +307,21 @@ namespace OpenSim.Data.SQLite
/// the region UUID
public void StoreObject(SceneObjectGroup obj, UUID regionUUID)
{
+ uint flags = obj.RootPart.GetEffectiveObjectFlags();
+
+ // Eligibility check
+ //
+ if ((flags & (uint)PrimFlags.Temporary) != 0)
+ return;
+ if ((flags & (uint)PrimFlags.TemporaryOnRez) != 0)
+ return;
+
lock (ds)
{
foreach (SceneObjectPart prim in obj.Children.Values)
{
- if ((prim.GetEffectiveObjectFlags() & (uint)PrimFlags.Temporary) == 0
- && (prim.GetEffectiveObjectFlags() & (uint)PrimFlags.TemporaryOnRez) == 0)
- {
- m_log.Info("[REGION DB]: Adding obj: " + obj.UUID + " to region: " + regionUUID);
- addPrim(prim, obj.UUID, regionUUID);
- }
- else if (prim.Stopped)
- {
- //m_log.Info("[DATASTORE]: " +
- //"Adding stopped obj: " + obj.UUID + " to region: " + regionUUID);
- //addPrim(prim, obj.UUID.ToString(), regionUUID.ToString());
- }
- else
- {
- // m_log.Info("[DATASTORE]: Ignoring Physical obj: " + obj.UUID + " in region: " + regionUUID);
- }
+ m_log.Info("[REGION DB]: Adding obj: " + obj.UUID + " to region: " + regionUUID);
+ addPrim(prim, obj.UUID, regionUUID);
}
}
@@ -1130,7 +1125,7 @@ namespace OpenSim.Data.SQLite
// 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"];
+ prim.Name = row["Name"] == DBNull.Value ? string.Empty : (string)row["Name"];
// various text fields
prim.Text = (String) row["Text"];
prim.Color = Color.FromArgb(Convert.ToInt32(row["ColorA"]),
diff --git a/OpenSim/Data/Tests/BasicInventoryTest.cs b/OpenSim/Data/Tests/BasicInventoryTest.cs
index 3c33bb4..967c6e7 100644
--- a/OpenSim/Data/Tests/BasicInventoryTest.cs
+++ b/OpenSim/Data/Tests/BasicInventoryTest.cs
@@ -266,6 +266,7 @@ namespace OpenSim.Data.Tests
InventoryItemBase actual = db.getInventoryItem(item1);
Assert.That(actual, Constraints.PropertyCompareConstraint(expected)
.IgnoreProperty(x=>x.InvType)
+ .IgnoreProperty(x=>x.CreatorIdAsUuid)
.IgnoreProperty(x=>x.Description)
.IgnoreProperty(x=>x.CreatorId));
}
diff --git a/OpenSim/Data/Tests/BasicRegionTest.cs b/OpenSim/Data/Tests/BasicRegionTest.cs
index a746ef0..8373922 100644
--- a/OpenSim/Data/Tests/BasicRegionTest.cs
+++ b/OpenSim/Data/Tests/BasicRegionTest.cs
@@ -576,8 +576,10 @@ namespace OpenSim.Data.Tests
.IgnoreProperty(x=>x.HasGroupChanged)
.IgnoreProperty(x=>x.IsSelected)
.IgnoreProperty(x=>x.RegionHandle)
+ .IgnoreProperty(x=>x.RegionUUID)
.IgnoreProperty(x=>x.Scene)
- .IgnoreProperty(x=>x.RootPart.InventorySerial));
+ .IgnoreProperty(x=>x.Children)
+ .IgnoreProperty(x=>x.RootPart));
}
[Test]
diff --git a/OpenSim/Data/Tests/BasicUserTest.cs b/OpenSim/Data/Tests/BasicUserTest.cs
index 21d1a7e..a3c125d 100644
--- a/OpenSim/Data/Tests/BasicUserTest.cs
+++ b/OpenSim/Data/Tests/BasicUserTest.cs
@@ -403,6 +403,7 @@ namespace OpenSim.Data.Tests
Assert.That(u1a, Constraints.PropertyCompareConstraint(u)
.IgnoreProperty(x=>x.HomeRegionX)
.IgnoreProperty(x=>x.HomeRegionY)
+ .IgnoreProperty(x=>x.RootInventoryFolderID)
);
}
diff --git a/OpenSim/Data/Tests/PropertyCompareConstraint.cs b/OpenSim/Data/Tests/PropertyCompareConstraint.cs
index 063267b..5f53725 100644
--- a/OpenSim/Data/Tests/PropertyCompareConstraint.cs
+++ b/OpenSim/Data/Tests/PropertyCompareConstraint.cs
@@ -69,6 +69,15 @@ namespace OpenSim.Data.Tests
private bool ObjectCompare(object expected, object actual, Stack propertyNames)
{
+ //prevent loops...
+ if(propertyNames.Count > 50)
+ {
+ failingPropertyName = string.Join(".", propertyNames.Reverse().ToArray());
+ failingActual = actual;
+ failingExpected = expected;
+ return false;
+ }
+
if (actual.GetType() != expected.GetType())
{
propertyNames.Push("GetType()");
@@ -122,6 +131,60 @@ namespace OpenSim.Data.Tests
return true;
}
+ IComparable comp = actual as IComparable;
+ if (comp != null)
+ {
+ if (comp.CompareTo(expected) != 0)
+ {
+ failingPropertyName = string.Join(".", propertyNames.Reverse().ToArray());
+ failingActual = actual;
+ failingExpected = expected;
+ return false;
+ }
+ return true;
+ }
+
+ //Now try the much more annoying IComparable
+ Type icomparableInterface = actual.GetType().GetInterface("IComparable`1");
+ if (icomparableInterface != null)
+ {
+ int result = (int)icomparableInterface.GetMethod("CompareTo").Invoke(actual, new[] { expected });
+ if (result != 0)
+ {
+ failingPropertyName = string.Join(".", propertyNames.Reverse().ToArray());
+ failingActual = actual;
+ failingExpected = expected;
+ return false;
+ }
+ return true;
+ }
+
+ IEnumerable arr = actual as IEnumerable;
+ if (arr != null)
+ {
+ List