Merge branch 'dev' of ssh://sceneapi@island.sciencesim.com/home/sceneapi/sceneapi into dev

dsg
Huaiyu (Kitty) Liu 2011-03-29 17:13:15 -07:00
commit 170a230e51
107 changed files with 2566 additions and 1243 deletions

View File

@ -28,7 +28,7 @@ people that make the day to day of OpenSim happen.
* Diva (Crista Lopes, University of California, Irvine)
* nlin (3Di)
* Arthur Rodrigo S Valadares (IBM)
* BlueWall (James Hughes)
= Past Open Sim Developers =
These folks are alumns of the OpenSim core group, but are now
@ -117,6 +117,7 @@ what it is today.
* SachaMagne
* Salahzar Stenvaag
* sempuki
* SignpostMarv
* Snoopy
* Strawberry Fride
* tglion

View File

@ -68,7 +68,7 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
public void Initialise()
{
m_log.Error("[LOADREGIONS]: " + Name + " cannot be default-initialized!");
m_log.Error("[LOAD REGIONS PLUGIN]: " + Name + " cannot be default-initialized!");
throw new PluginNotInitialisedException(Name);
}
@ -85,41 +85,39 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
IRegionLoader regionLoader;
if (m_openSim.ConfigSource.Source.Configs["Startup"].GetString("region_info_source", "filesystem") == "filesystem")
{
m_log.Info("[LOADREGIONS]: Loading region configurations from filesystem");
m_log.Info("[LOAD REGIONS PLUGIN]: Loading region configurations from filesystem");
regionLoader = new RegionLoaderFileSystem();
}
else
{
m_log.Info("[LOADREGIONSPLUGIN]: Loading region configurations from web");
m_log.Info("[LOAD REGIONS PLUGIN]: Loading region configurations from web");
regionLoader = new RegionLoaderWebServer();
}
m_log.Info("[LOADREGIONSPLUGIN]: Loading region configurations...");
regionLoader.SetIniConfigSource(m_openSim.ConfigSource.Source);
RegionInfo[] regionsToLoad = regionLoader.LoadRegions();
m_log.Info("[LOADREGIONSPLUGIN]: Loading specific shared modules...");
m_log.Info("[LOADREGIONSPLUGIN]: DynamicTextureModule...");
m_log.Info("[LOAD REGIONS PLUGIN]: Loading specific shared modules...");
m_log.Info("[LOAD REGIONS PLUGIN]: DynamicTextureModule...");
m_openSim.ModuleLoader.LoadDefaultSharedModule(new DynamicTextureModule());
m_log.Info("[LOADREGIONSPLUGIN]: LoadImageURLModule...");
m_log.Info("[LOAD REGIONS PLUGIN]: LoadImageURLModule...");
m_openSim.ModuleLoader.LoadDefaultSharedModule(new LoadImageURLModule());
m_log.Info("[LOADREGIONSPLUGIN]: XMLRPCModule...");
m_log.Info("[LOAD REGIONS PLUGIN]: XMLRPCModule...");
m_openSim.ModuleLoader.LoadDefaultSharedModule(new XMLRPCModule());
// m_log.Info("[LOADREGIONSPLUGIN]: AssetTransactionModule...");
// m_openSim.ModuleLoader.LoadDefaultSharedModule(new AssetTransactionModule());
m_log.Info("[LOADREGIONSPLUGIN]: Done.");
m_log.Info("[LOAD REGIONS PLUGIN]: Done.");
if (!CheckRegionsForSanity(regionsToLoad))
{
m_log.Error("[LOADREGIONS]: Halting startup due to conflicts in region configurations");
m_log.Error("[LOAD REGIONS PLUGIN]: Halting startup due to conflicts in region configurations");
Environment.Exit(1);
}
for (int i = 0; i < regionsToLoad.Length; i++)
{
IScene scene;
m_log.Debug("[LOADREGIONS]: Creating Region: " + regionsToLoad[i].RegionName + " (ThreadID: " +
m_log.Debug("[LOAD REGIONS PLUGIN]: Creating Region: " + regionsToLoad[i].RegionName + " (ThreadID: " +
Thread.CurrentThread.ManagedThreadId.ToString() +
")");
@ -164,7 +162,7 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
if (regions[i].RegionID == regions[j].RegionID)
{
m_log.ErrorFormat(
"[LOADREGIONS]: Regions {0} and {1} have the same UUID {2}",
"[LOAD REGIONS PLUGIN]: Regions {0} and {1} have the same UUID {2}",
regions[i].RegionName, regions[j].RegionName, regions[i].RegionID);
return false;
}
@ -172,14 +170,14 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
regions[i].RegionLocX == regions[j].RegionLocX && regions[i].RegionLocY == regions[j].RegionLocY)
{
m_log.ErrorFormat(
"[LOADREGIONS]: Regions {0} and {1} have the same grid location ({2}, {3})",
"[LOAD REGIONS PLUGIN]: Regions {0} and {1} have the same grid location ({2}, {3})",
regions[i].RegionName, regions[j].RegionName, regions[i].RegionLocX, regions[i].RegionLocY);
return false;
}
else if (regions[i].InternalEndPoint.Port == regions[j].InternalEndPoint.Port)
{
m_log.ErrorFormat(
"[LOADREGIONS]: Regions {0} and {1} have the same internal IP port {2}",
"[LOAD REGIONS PLUGIN]: Regions {0} and {1} have the same internal IP port {2}",
regions[i].RegionName, regions[j].RegionName, regions[i].InternalEndPoint.Port);
return false;
}

View File

@ -2129,17 +2129,17 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
}
catch (DllNotFoundException)
{
Rest.Log.ErrorFormat("OpenJpeg is not installed correctly on this system. Asset Data is emtpy for {0}", ic.Item.Name);
Rest.Log.ErrorFormat("OpenJpeg is not installed correctly on this system. Asset Data is empty for {0}", ic.Item.Name);
ic.Asset.Data = new Byte[0];
}
catch (IndexOutOfRangeException)
{
Rest.Log.ErrorFormat("OpenJpeg was unable to encode this. Asset Data is emtpy for {0}", ic.Item.Name);
Rest.Log.ErrorFormat("OpenJpeg was unable to encode this. Asset Data is empty for {0}", ic.Item.Name);
ic.Asset.Data = new Byte[0];
}
catch (Exception)
{
Rest.Log.ErrorFormat("OpenJpeg was unable to encode this. Asset Data is emtpy for {0}", ic.Item.Name);
Rest.Log.ErrorFormat("OpenJpeg was unable to encode this. Asset Data is empty for {0}", ic.Item.Name);
ic.Asset.Data = new Byte[0];
}
}

View File

@ -1259,7 +1259,7 @@ namespace OpenSim.Client.MXP.ClientStack
// Need to translate to MXP somehow
}
public void SendLandProperties(int sequence_id, bool snap_selection, int request_result, LandData landData, float simObjectBonusFactor, int parcelObjectCapacity, int simObjectCapacity, uint regionFlags)
public void SendLandProperties(int sequence_id, bool snap_selection, int request_result, ILandObject lo, float simObjectBonusFactor, int parcelObjectCapacity, int simObjectCapacity, uint regionFlags)
{
// Need to translate to MXP somehow
}

View File

@ -806,7 +806,7 @@ namespace OpenSim.Client.VWoHTTP.ClientStack
throw new System.NotImplementedException();
}
public void SendLandProperties(int sequence_id, bool snap_selection, int request_result, LandData landData, float simObjectBonusFactor, int parcelObjectCapacity, int simObjectCapacity, uint regionFlags)
public void SendLandProperties(int sequence_id, bool snap_selection, int request_result, ILandObject lo, float simObjectBonusFactor, int parcelObjectCapacity, int simObjectCapacity, uint regionFlags)
{
throw new System.NotImplementedException();
}

View File

@ -350,26 +350,43 @@ namespace OpenSim.Data.MSSQL
public EstateSettings LoadEstateSettings(int estateID)
{
// TODO: Implementation!
return new EstateSettings();
}
public List<EstateSettings> LoadEstateSettingsAll()
{
// TODO: Implementation!
return new List<EstateSettings>();
}
public List<int> GetEstates(string search)
{
// TODO: Implementation!
return new List<int>();
}
public List<int> GetEstatesAll()
{
// TODO: Implementation!
return new List<int>();
}
public bool LinkRegion(UUID regionID, int estateID)
{
// TODO: Implementation!
return false;
}
public List<UUID> GetRegions(int estateID)
{
// TODO: Implementation!
return new List<UUID>();
}
public bool DeleteEstate(int estateID)
{
// TODO: Implementation!
return false;
}
#endregion

View File

@ -47,6 +47,11 @@ namespace OpenSim.Data.MySQL
private string m_connectionString;
private object m_dbLock = new object();
protected virtual Assembly Assembly
{
get { return GetType().Assembly; }
}
#region IPlugin Members
public override string Version { get { return "1.0.0.0"; } }
@ -66,13 +71,10 @@ namespace OpenSim.Data.MySQL
{
m_connectionString = connect;
// This actually does the roll forward assembly stuff
Assembly assem = GetType().Assembly;
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
dbcon.Open();
Migration m = new Migration(dbcon, assem, "AssetStore");
Migration m = new Migration(dbcon, Assembly, "AssetStore");
m.Update();
}
}

View File

@ -28,6 +28,7 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Reflection;
using System.Data;
using OpenMetaverse;
using OpenSim.Framework;
@ -42,6 +43,11 @@ namespace OpenSim.Data.MySQL
private int m_LastExpire;
// private string m_connectionString;
protected virtual Assembly Assembly
{
get { return GetType().Assembly; }
}
public MySqlAuthenticationData(string connectionString, string realm)
: base(connectionString)
{
@ -51,7 +57,7 @@ namespace OpenSim.Data.MySQL
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
dbcon.Open();
Migration m = new Migration(dbcon, GetType().Assembly, "AuthStore");
Migration m = new Migration(dbcon, Assembly, "AuthStore");
m.Update();
}
}

View File

@ -54,6 +54,11 @@ namespace OpenSim.Data.MySQL
private Dictionary<string, FieldInfo> m_FieldMap =
new Dictionary<string, FieldInfo>();
protected virtual Assembly Assembly
{
get { return GetType().Assembly; }
}
public MySQLEstateStore()
{
}
@ -82,8 +87,7 @@ namespace OpenSim.Data.MySQL
{
dbcon.Open();
Assembly assem = GetType().Assembly;
Migration m = new Migration(dbcon, assem, "EstateStore");
Migration m = new Migration(dbcon, Assembly, "EstateStore");
m.Update();
Type t = typeof(EstateSettings);
@ -409,6 +413,46 @@ namespace OpenSim.Data.MySQL
return DoLoad(cmd, UUID.Zero, false);
}
}
public List<EstateSettings> LoadEstateSettingsAll()
{
List<EstateSettings> allEstateSettings = new List<EstateSettings>();
List<int> allEstateIds = GetEstatesAll();
foreach (int estateId in allEstateIds)
allEstateSettings.Add(LoadEstateSettings(estateId));
return allEstateSettings;
}
public List<int> GetEstatesAll()
{
List<int> result = new List<int>();
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
dbcon.Open();
using (MySqlCommand cmd = dbcon.CreateCommand())
{
cmd.CommandText = "select estateID from estate_settings";
using (IDataReader reader = cmd.ExecuteReader())
{
while (reader.Read())
{
result.Add(Convert.ToInt32(reader["EstateID"]));
}
reader.Close();
}
}
dbcon.Close();
}
return result;
}
public List<int> GetEstates(string search)
{

View File

@ -46,6 +46,11 @@ namespace OpenSim.Data.MySQL
protected string m_Realm;
protected FieldInfo m_DataField = null;
protected virtual Assembly Assembly
{
get { return GetType().Assembly; }
}
public MySQLGenericTableHandler(string connectionString,
string realm, string storeName) : base(connectionString)
{
@ -57,7 +62,7 @@ namespace OpenSim.Data.MySQL
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
dbcon.Open();
Migration m = new Migration(dbcon, GetType().Assembly, storeName);
Migration m = new Migration(dbcon, Assembly, storeName);
m.Update();
}
}

View File

@ -29,6 +29,8 @@ using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Reflection;
using OpenMetaverse;
using OpenSim.Framework;
using OpenSim.Data;
@ -42,6 +44,11 @@ namespace OpenSim.Data.MySQL
private List<string> m_ColumnNames;
//private string m_connectionString;
protected virtual Assembly Assembly
{
get { return GetType().Assembly; }
}
public MySqlRegionData(string connectionString, string realm)
: base(connectionString)
{
@ -51,7 +58,7 @@ namespace OpenSim.Data.MySQL
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
{
dbcon.Open();
Migration m = new Migration(dbcon, GetType().Assembly, "GridStore");
Migration m = new Migration(dbcon, Assembly, "GridStore");
m.Update();
}
}

View File

@ -52,6 +52,11 @@ namespace OpenSim.Data.MySQL
private string m_connectionString;
private object m_dbLock = new object();
protected virtual Assembly Assembly
{
get { return GetType().Assembly; }
}
public MySQLSimulationData()
{
}
@ -71,8 +76,7 @@ namespace OpenSim.Data.MySQL
// Apply new Migrations
//
Assembly assem = GetType().Assembly;
Migration m = new Migration(dbcon, assem, "RegionStore");
Migration m = new Migration(dbcon, Assembly, "RegionStore");
m.Update();
// Clean dropped attachments

View File

@ -28,6 +28,9 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Reflection;
using System.Text;
using log4net;
using OpenMetaverse;
using OpenSim.Framework;
using OpenSim.Data;
@ -36,12 +39,17 @@ namespace OpenSim.Data.Null
{
public class NullUserAccountData : IUserAccountData
{
private static Dictionary<UUID, UserAccountData> m_DataByUUID = new Dictionary<UUID, UserAccountData>();
private static Dictionary<string, UserAccountData> m_DataByName = new Dictionary<string, UserAccountData>();
private static Dictionary<string, UserAccountData> m_DataByEmail = new Dictionary<string, UserAccountData>();
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private Dictionary<UUID, UserAccountData> m_DataByUUID = new Dictionary<UUID, UserAccountData>();
private Dictionary<string, UserAccountData> m_DataByName = new Dictionary<string, UserAccountData>();
private Dictionary<string, UserAccountData> m_DataByEmail = new Dictionary<string, UserAccountData>();
public NullUserAccountData(string connectionString, string realm)
{
// m_log.DebugFormat(
// "[NULL USER ACCOUNT DATA]: Initializing new NullUserAccountData with connectionString [{0}], realm [{1}]",
// connectionString, realm);
}
/// <summary>
@ -54,6 +62,15 @@ namespace OpenSim.Data.Null
/// <returns></returns>
public UserAccountData[] Get(string[] fields, string[] values)
{
// if (m_log.IsDebugEnabled)
// {
// m_log.DebugFormat(
// "[NULL USER ACCOUNT DATA]: Called Get with fields [{0}], values [{1}]",
// string.Join(", ", fields), string.Join(", ", values));
// }
UserAccountData[] userAccounts = new UserAccountData[0];
List<string> fieldsLst = new List<string>(fields);
if (fieldsLst.Contains("PrincipalID"))
{
@ -61,41 +78,61 @@ namespace OpenSim.Data.Null
UUID id = UUID.Zero;
if (UUID.TryParse(values[i], out id))
if (m_DataByUUID.ContainsKey(id))
return new UserAccountData[] { m_DataByUUID[id] };
}
if (fieldsLst.Contains("FirstName") && fieldsLst.Contains("LastName"))
userAccounts = new UserAccountData[] { m_DataByUUID[id] };
}
else if (fieldsLst.Contains("FirstName") && fieldsLst.Contains("LastName"))
{
int findex = fieldsLst.IndexOf("FirstName");
int lindex = fieldsLst.IndexOf("LastName");
if (m_DataByName.ContainsKey(values[findex] + " " + values[lindex]))
return new UserAccountData[] { m_DataByName[values[findex] + " " + values[lindex]] };
}
if (fieldsLst.Contains("Email"))
{
userAccounts = new UserAccountData[] { m_DataByName[values[findex] + " " + values[lindex]] };
}
}
else if (fieldsLst.Contains("Email"))
{
int i = fieldsLst.IndexOf("Email");
if (m_DataByEmail.ContainsKey(values[i]))
return new UserAccountData[] { m_DataByEmail[values[i]] };
userAccounts = new UserAccountData[] { m_DataByEmail[values[i]] };
}
// Fail
return new UserAccountData[0];
// if (m_log.IsDebugEnabled)
// {
// StringBuilder sb = new StringBuilder();
// foreach (UserAccountData uad in userAccounts)
// sb.AppendFormat("({0} {1} {2}) ", uad.FirstName, uad.LastName, uad.PrincipalID);
//
// m_log.DebugFormat(
// "[NULL USER ACCOUNT DATA]: Returning {0} user accounts out of {1}: [{2}]", userAccounts.Length, m_DataByName.Count, sb);
// }
return userAccounts;
}
public bool Store(UserAccountData data)
{
if (data == null)
return false;
m_log.DebugFormat(
"[NULL USER ACCOUNT DATA]: Storing user account {0} {1} {2} {3}",
data.FirstName, data.LastName, data.PrincipalID, this.GetHashCode());
m_DataByUUID[data.PrincipalID] = data;
m_DataByName[data.FirstName + " " + data.LastName] = data;
if (data.Data.ContainsKey("Email") && data.Data["Email"] != null && data.Data["Email"] != string.Empty)
m_DataByEmail[data.Data["Email"]] = data;
// m_log.DebugFormat("m_DataByUUID count is {0}, m_DataByName count is {1}", m_DataByUUID.Count, m_DataByName.Count);
return true;
}
public UserAccountData[] GetUsers(UUID scopeID, string query)
{
// m_log.DebugFormat(
// "[NULL USER ACCOUNT DATA]: Called GetUsers with scope [{0}], query [{1}]", scopeID, query);
string[] words = query.Split(new char[] { ' ' });
for (int i = 0; i < words.Length; i++)

View File

@ -357,6 +357,17 @@ namespace OpenSim.Data.SQLite
return DoLoad(cmd, UUID.Zero, false);
}
public List<EstateSettings> LoadEstateSettingsAll()
{
List<EstateSettings> estateSettings = new List<EstateSettings>();
List<int> estateIds = GetEstatesAll();
foreach (int estateId in estateIds)
estateSettings.Add(LoadEstateSettings(estateId));
return estateSettings;
}
public List<int> GetEstates(string search)
{
@ -379,6 +390,27 @@ namespace OpenSim.Data.SQLite
return result;
}
public List<int> GetEstatesAll()
{
List<int> result = new List<int>();
string sql = "select EstateID from estate_settings";
SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
cmd.CommandText = sql;
IDataReader r = cmd.ExecuteReader();
while (r.Read())
{
result.Add(Convert.ToInt32(r["EstateID"]));
}
r.Close();
return result;
}
public bool LinkRegion(UUID regionID, int estateID)
{

View File

@ -100,6 +100,17 @@ namespace OpenSim.Data.SQLiteLegacy
return DoLoad(cmd, regionID, create);
}
public List<EstateSettings> LoadEstateSettingsAll()
{
List<EstateSettings> estateSettings = new List<EstateSettings>();
List<int> estateIds = GetEstatesAll();
foreach (int estateId in estateIds)
estateSettings.Add(LoadEstateSettings(estateId));
return estateSettings;
}
private EstateSettings DoLoad(SqliteCommand cmd, UUID regionID, bool create)
{
@ -369,6 +380,28 @@ namespace OpenSim.Data.SQLiteLegacy
return result;
}
public List<int> GetEstatesAll()
{
List<int> result = new List<int>();
string sql = "select EstateID from estate_settings";
SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
cmd.CommandText = sql;
IDataReader r = cmd.ExecuteReader();
while (r.Read())
{
result.Add(Convert.ToInt32(r["EstateID"]));
}
r.Close();
return result;
}
public bool LinkRegion(UUID regionID, int estateID)
{
SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();

View File

@ -32,13 +32,10 @@ using NUnit.Framework;
using NUnit.Framework.Constraints;
using OpenMetaverse;
using OpenSim.Framework;
using OpenSim.Tests.Common;
using System.Data.Common;
using log4net;
#if !NUNIT25
using NUnit.Framework.SyntaxHelpers;
#endif
// DBMS-specific:
using MySql.Data.MySqlClient;
using OpenSim.Data.MySQL;
@ -51,15 +48,6 @@ using OpenSim.Data.SQLite;
namespace OpenSim.Data.Tests
{
#if NUNIT25
[TestFixture(typeof(MySqlConnection), typeof(MySQLAssetData), Description="Basic Asset store tests (MySQL)")]
[TestFixture(typeof(SqlConnection), typeof(MSSQLAssetData), Description = "Basic Asset store tests (MS SQL Server)")]
[TestFixture(typeof(SqliteConnection), typeof(SQLiteAssetData), Description = "Basic Asset store tests (SQLite)")]
#else
[TestFixture(Description = "Asset store tests (SQLite)")]
public class SQLiteAssetTests : AssetTests<SqliteConnection, SQLiteAssetData>
{
@ -75,9 +63,6 @@ namespace OpenSim.Data.Tests
{
}
#endif
public class AssetTests<TConn, TAssetData> : BasicDataServiceTest<TConn, TAssetData>
where TConn : DbConnection, new()
where TAssetData : AssetDataBase, new()
@ -121,6 +106,8 @@ namespace OpenSim.Data.Tests
[Test]
public void T001_LoadEmpty()
{
TestHelper.InMethod();
Assert.That(m_db.ExistsAsset(uuid1), Is.False);
Assert.That(m_db.ExistsAsset(uuid2), Is.False);
Assert.That(m_db.ExistsAsset(uuid3), Is.False);
@ -129,6 +116,8 @@ namespace OpenSim.Data.Tests
[Test]
public void T010_StoreReadVerifyAssets()
{
TestHelper.InMethod();
AssetBase a1 = new AssetBase(uuid1, "asset one", (sbyte)AssetType.Texture, critter1.ToString());
AssetBase a2 = new AssetBase(uuid2, "asset two", (sbyte)AssetType.Texture, critter2.ToString());
AssetBase a3 = new AssetBase(uuid3, "asset three", (sbyte)AssetType.Texture, critter3.ToString());
@ -194,6 +183,8 @@ namespace OpenSim.Data.Tests
[Test]
public void T020_CheckForWeirdCreatorID()
{
TestHelper.InMethod();
// It is expected that eventually the CreatorID might be an arbitrary string (an URI)
// rather than a valid UUID (?). This test is to make sure that the database layer does not
// attempt to convert CreatorID to GUID, but just passes it both ways as a string.
@ -218,4 +209,4 @@ namespace OpenSim.Data.Tests
Assert.That(a3a, Constraints.PropertyCompareConstraint(a3));
}
}
}
}

View File

@ -28,10 +28,10 @@
using System;
using log4net.Config;
using NUnit.Framework;
using NUnit.Framework.SyntaxHelpers;
using OpenMetaverse;
using OpenSim.Framework;
using OpenSim.Region.Framework.Interfaces;
using OpenSim.Tests.Common;
using System.Text;
using log4net;
using System.Reflection;
@ -49,15 +49,6 @@ using OpenSim.Data.SQLite;
namespace OpenSim.Data.Tests
{
#if NUNIT25
[TestFixture(typeof(MySqlConnection), typeof(MySQLEstateStore), Description = "Estate store tests (MySQL)")]
[TestFixture(typeof(SqlConnection), typeof(MSSQLEstateStore), Description = "Estate store tests (MS SQL Server)")]
[TestFixture(typeof(SqliteConnection), typeof(SQLiteEstateStore), Description = "Estate store tests (SQLite)")]
#else
[TestFixture(Description = "Estate store tests (SQLite)")]
public class SQLiteEstateTests : EstateTests<SqliteConnection, SQLiteEstateStore>
{
@ -73,8 +64,6 @@ namespace OpenSim.Data.Tests
{
}
#endif
public class EstateTests<TConn, TEstateStore> : BasicDataServiceTest<TConn, TEstateStore>
where TConn : DbConnection, new()
where TEstateStore : class, IEstateDataStore, new()
@ -118,6 +107,8 @@ namespace OpenSim.Data.Tests
[Test]
public void T010_EstateSettingsSimpleStorage_MinimumParameterSet()
{
TestHelper.InMethod();
EstateSettingsSimpleStorage(
REGION_ID,
DataTestUtil.STRING_MIN,
@ -149,6 +140,8 @@ namespace OpenSim.Data.Tests
[Test]
public void T011_EstateSettingsSimpleStorage_MaximumParameterSet()
{
TestHelper.InMethod();
EstateSettingsSimpleStorage(
REGION_ID,
DataTestUtil.STRING_MAX(64),
@ -180,6 +173,8 @@ namespace OpenSim.Data.Tests
[Test]
public void T012_EstateSettingsSimpleStorage_AccurateParameterSet()
{
TestHelper.InMethod();
EstateSettingsSimpleStorage(
REGION_ID,
DataTestUtil.STRING_MAX(1),
@ -211,6 +206,8 @@ namespace OpenSim.Data.Tests
[Test]
public void T012_EstateSettingsRandomStorage()
{
TestHelper.InMethod();
// Letting estate store generate rows to database for us
EstateSettings originalSettings = db.LoadEstateSettings(REGION_ID, true);
new PropertyScrambler<EstateSettings>()
@ -230,6 +227,8 @@ namespace OpenSim.Data.Tests
[Test]
public void T020_EstateSettingsManagerList()
{
TestHelper.InMethod();
// Letting estate store generate rows to database for us
EstateSettings originalSettings = db.LoadEstateSettings(REGION_ID, true);
@ -249,6 +248,8 @@ namespace OpenSim.Data.Tests
[Test]
public void T021_EstateSettingsUserList()
{
TestHelper.InMethod();
// Letting estate store generate rows to database for us
EstateSettings originalSettings = db.LoadEstateSettings(REGION_ID, true);
@ -268,6 +269,8 @@ namespace OpenSim.Data.Tests
[Test]
public void T022_EstateSettingsGroupList()
{
TestHelper.InMethod();
// Letting estate store generate rows to database for us
EstateSettings originalSettings = db.LoadEstateSettings(REGION_ID, true);
@ -287,6 +290,8 @@ namespace OpenSim.Data.Tests
[Test]
public void T022_EstateSettingsBanList()
{
TestHelper.InMethod();
// Letting estate store generate rows to database for us
EstateSettings originalSettings = db.LoadEstateSettings(REGION_ID, true);
@ -520,6 +525,5 @@ namespace OpenSim.Data.Tests
}
#endregion
}
}
}

View File

@ -25,14 +25,12 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
// #define NUNIT25
using System;
using log4net.Config;
using NUnit.Framework;
using NUnit.Framework.SyntaxHelpers;
using OpenMetaverse;
using OpenSim.Framework;
using OpenSim.Tests.Common;
using log4net;
using System.Reflection;
using System.Data.Common;
@ -49,14 +47,6 @@ using OpenSim.Data.SQLite;
namespace OpenSim.Data.Tests
{
#if NUNIT25
[TestFixture(typeof(SqliteConnection), typeof(SQLiteInventoryStore), Description = "Inventory store tests (SQLite)")]
[TestFixture(typeof(MySqlConnection), typeof(MySQLInventoryData), Description = "Inventory store tests (MySQL)")]
[TestFixture(typeof(SqlConnection), typeof(MSSQLInventoryData), Description = "Inventory store tests (MS SQL Server)")]
#else
[TestFixture(Description = "Inventory store tests (SQLite)")]
public class SQLiteInventoryTests : InventoryTests<SqliteConnection, SQLiteInventoryStore>
{
@ -71,7 +61,6 @@ namespace OpenSim.Data.Tests
public class MSSQLInventoryTests : InventoryTests<SqlConnection, MSSQLInventoryData>
{
}
#endif
public class InventoryTests<TConn, TInvStore> : BasicDataServiceTest<TConn, TInvStore>
where TConn : DbConnection, new()
@ -125,6 +114,8 @@ namespace OpenSim.Data.Tests
[Test]
public void T001_LoadEmpty()
{
TestHelper.InMethod();
Assert.That(db.getInventoryFolder(zero), Is.Null);
Assert.That(db.getInventoryFolder(folder1), Is.Null);
Assert.That(db.getInventoryFolder(folder2), Is.Null);
@ -143,6 +134,8 @@ namespace OpenSim.Data.Tests
[Test]
public void T010_FolderNonParent()
{
TestHelper.InMethod();
InventoryFolderBase f1 = NewFolder(folder2, folder1, owner1, name2);
// the folder will go in
db.addInventoryFolder(f1);
@ -153,6 +146,8 @@ namespace OpenSim.Data.Tests
[Test]
public void T011_FolderCreate()
{
TestHelper.InMethod();
InventoryFolderBase f1 = NewFolder(folder1, zero, owner1, name1);
// TODO: this is probably wrong behavior, but is what we have
// db.updateInventoryFolder(f1);
@ -165,7 +160,7 @@ namespace OpenSim.Data.Tests
db.addInventoryFolder(f1);
InventoryFolderBase f1a = db.getUserRootFolder(owner1);
Assert.That(folder1, Is.EqualTo(f1a.ID), "Assert.That(folder1, Is.EqualTo(f1a.ID))");
Assert.That(name1, Text.Matches(f1a.Name), "Assert.That(name1, Text.Matches(f1a.Name))");
Assert.That(name1, Is.StringMatching(f1a.Name), "Assert.That(name1, Text.Matches(f1a.Name))");
}
// we now have the following tree
@ -176,6 +171,8 @@ namespace OpenSim.Data.Tests
[Test]
public void T012_FolderList()
{
TestHelper.InMethod();
InventoryFolderBase f2 = NewFolder(folder3, folder1, owner1, name3);
db.addInventoryFolder(f2);
@ -190,6 +187,8 @@ namespace OpenSim.Data.Tests
[Test]
public void T013_FolderHierarchy()
{
TestHelper.InMethod();
int n = db.getFolderHierarchy(zero).Count; // (for dbg - easier to see what's returned)
Assert.That(n, Is.EqualTo(0), "Assert.That(db.getFolderHierarchy(zero).Count, Is.EqualTo(0))");
n = db.getFolderHierarchy(folder1).Count;
@ -203,6 +202,8 @@ namespace OpenSim.Data.Tests
[Test]
public void T014_MoveFolder()
{
TestHelper.InMethod();
InventoryFolderBase f2 = db.getInventoryFolder(folder2);
f2.ParentID = folder3;
db.moveInventoryFolder(f2);
@ -217,6 +218,8 @@ namespace OpenSim.Data.Tests
[Test]
public void T015_FolderHierarchy()
{
TestHelper.InMethod();
Assert.That(db.getFolderHierarchy(zero).Count, Is.EqualTo(0), "Assert.That(db.getFolderHierarchy(zero).Count, Is.EqualTo(0))");
Assert.That(db.getFolderHierarchy(folder1).Count, Is.EqualTo(2), "Assert.That(db.getFolderHierarchy(folder1).Count, Is.EqualTo(2))");
Assert.That(db.getFolderHierarchy(folder2).Count, Is.EqualTo(0), "Assert.That(db.getFolderHierarchy(folder2).Count, Is.EqualTo(0))");
@ -228,6 +231,8 @@ namespace OpenSim.Data.Tests
[Test]
public void T100_NoItems()
{
TestHelper.InMethod();
Assert.That(db.getInventoryInFolder(zero).Count, Is.EqualTo(0), "Assert.That(db.getInventoryInFolder(zero).Count, Is.EqualTo(0))");
Assert.That(db.getInventoryInFolder(folder1).Count, Is.EqualTo(0), "Assert.That(db.getInventoryInFolder(folder1).Count, Is.EqualTo(0))");
Assert.That(db.getInventoryInFolder(folder2).Count, Is.EqualTo(0), "Assert.That(db.getInventoryInFolder(folder2).Count, Is.EqualTo(0))");
@ -240,6 +245,8 @@ namespace OpenSim.Data.Tests
[Test]
public void T101_CreatItems()
{
TestHelper.InMethod();
db.addInventoryItem(NewItem(item1, folder3, owner1, iname1, asset1));
db.addInventoryItem(NewItem(item2, folder3, owner1, iname2, asset2));
db.addInventoryItem(NewItem(item3, folder3, owner1, iname3, asset3));
@ -249,6 +256,8 @@ namespace OpenSim.Data.Tests
[Test]
public void T102_CompareItems()
{
TestHelper.InMethod();
InventoryItemBase i1 = db.getInventoryItem(item1);
InventoryItemBase i2 = db.getInventoryItem(item2);
InventoryItemBase i3 = db.getInventoryItem(item3);
@ -266,6 +275,8 @@ namespace OpenSim.Data.Tests
[Test]
public void T103_UpdateItem()
{
TestHelper.InMethod();
// TODO: probably shouldn't have the ability to have an
// owner of an item in a folder not owned by the user
@ -284,6 +295,8 @@ namespace OpenSim.Data.Tests
[Test]
public void T104_RandomUpdateItem()
{
TestHelper.InMethod();
PropertyScrambler<InventoryFolderBase> folderScrambler =
new PropertyScrambler<InventoryFolderBase>()
.DontScramble(x => x.Owner)
@ -341,6 +354,8 @@ namespace OpenSim.Data.Tests
[Test]
public void T999_StillNull()
{
TestHelper.InMethod();
// 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);

View File

@ -34,7 +34,6 @@ using System.Linq.Expressions;
using System.Reflection;
using NUnit.Framework;
using NUnit.Framework.Constraints;
using NUnit.Framework.SyntaxHelpers;
using OpenMetaverse;
using OpenSim.Framework;

View File

@ -32,13 +32,11 @@ using System.Linq.Expressions;
using System.Reflection;
using System.Text;
using NUnit.Framework;
using NUnit.Framework.SyntaxHelpers;
using OpenMetaverse;
using OpenSim.Framework;
namespace OpenSim.Data.Tests
{
//This is generic so that the lambda expressions will work right in IDEs.
public class PropertyScrambler<T>
{

View File

@ -31,11 +31,11 @@ using System.Drawing;
using System.Text;
using log4net.Config;
using NUnit.Framework;
using NUnit.Framework.SyntaxHelpers;
using OpenMetaverse;
using OpenSim.Framework;
using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes;
using OpenSim.Tests.Common;
using log4net;
using System.Reflection;
using System.Data.Common;
@ -52,14 +52,6 @@ using OpenSim.Data.SQLite;
namespace OpenSim.Data.Tests
{
#if NUNIT25
[TestFixture(typeof(SqliteConnection), typeof(SQLiteRegionData), Description = "Region store tests (SQLite)")]
[TestFixture(typeof(MySqlConnection), typeof(MySqlRegionData), Description = "Region store tests (MySQL)")]
[TestFixture(typeof(SqlConnection), typeof(MSSQLRegionData), Description = "Region store tests (MS SQL Server)")]
#else
[TestFixture(Description = "Region store tests (SQLite)")]
public class SQLiteRegionTests : RegionTests<SqliteConnection, SQLiteSimulationData>
{
@ -75,8 +67,6 @@ namespace OpenSim.Data.Tests
{
}
#endif
public class RegionTests<TConn, TRegStore> : BasicDataServiceTest<TConn, TRegStore>
where TConn : DbConnection, new()
where TRegStore : class, ISimulationDataStore, new()
@ -131,15 +121,18 @@ namespace OpenSim.Data.Tests
string[] reg_tables = new string[] {
"prims", "primshapes", "primitems", "terrain", "land", "landaccesslist", "regionban", "regionsettings"
};
if (m_rebuildDB)
{
DropTables(reg_tables);
ResetMigrations("RegionStore");
}else
}
else
{
ClearTables(reg_tables);
}
}
// Test Plan
// Prims
// - empty test - 001
@ -158,6 +151,8 @@ namespace OpenSim.Data.Tests
[Test]
public void T001_LoadEmpty()
{
TestHelper.InMethod();
List<SceneObjectGroup> objs = db.LoadObjects(region1);
List<SceneObjectGroup> objs3 = db.LoadObjects(region3);
List<LandData> land = db.LoadLandObjects(region1);
@ -174,6 +169,8 @@ namespace OpenSim.Data.Tests
[Test]
public void T010_StoreSimpleObject()
{
TestHelper.InMethod();
SceneObjectGroup sog = NewSOG("object1", prim1, region1);
SceneObjectGroup sog2 = NewSOG("object2", prim2, region1);
@ -207,6 +204,8 @@ namespace OpenSim.Data.Tests
[Test]
public void T011_ObjectNames()
{
TestHelper.InMethod();
List<SceneObjectGroup> objs = db.LoadObjects(region1);
foreach (SceneObjectGroup sog in objs)
{
@ -219,6 +218,8 @@ namespace OpenSim.Data.Tests
[Test]
public void T012_SceneParts()
{
TestHelper.InMethod();
UUID tmp0 = UUID.Random();
UUID tmp1 = UUID.Random();
UUID tmp2 = UUID.Random();
@ -252,6 +253,8 @@ namespace OpenSim.Data.Tests
[Test]
public void T013_DatabasePersistency()
{
TestHelper.InMethod();
// Sets all ScenePart parameters, stores and retrieves them, then check for consistency with initial data
// The commented Asserts are the ones that are unchangeable (when storing on the database, their "Set" values are ignored
// The ObjectFlags is an exception, if it is entered incorrectly, the object IS REJECTED on the database silently.
@ -427,6 +430,8 @@ namespace OpenSim.Data.Tests
[Test]
public void T014_UpdateObject()
{
TestHelper.InMethod();
string text1 = "object1 text";
SceneObjectGroup sog = FindSOG("object1", region1);
sog.RootPart.Text = text1;
@ -528,15 +533,20 @@ namespace OpenSim.Data.Tests
Assert.That(clickaction,Is.EqualTo(p.ClickAction), "Assert.That(clickaction,Is.EqualTo(p.ClickAction))");
Assert.That(scale,Is.EqualTo(p.Scale), "Assert.That(scale,Is.EqualTo(p.Scale))");
}
/// <summary>
/// Test storage and retrieval of a scene object with a large number of parts.
/// </summary>
[Test]
public void T015_LargeSceneObjects()
{
TestHelper.InMethod();
UUID id = UUID.Random();
Dictionary<UUID, SceneObjectPart> mydic = new Dictionary<UUID, SceneObjectPart>();
SceneObjectGroup sog = NewSOG("Test SOG", id, region4);
mydic.Add(sog.RootPart.UUID,sog.RootPart);
for (int i=0;i<30;i++)
for (int i = 0; i < 30; i++)
{
UUID tmp = UUID.Random();
SceneObjectPart sop = NewSOP(("Test SOP " + i.ToString()),tmp);
@ -555,13 +565,14 @@ namespace OpenSim.Data.Tests
sop.Acceleration = accel;
mydic.Add(tmp,sop);
sog.AddPart(sop);
db.StoreObject(sog, region4);
sog.AddPart(sop);
}
db.StoreObject(sog, region4);
SceneObjectGroup retsog = FindSOG("Test SOG", region4);
SceneObjectPart[] parts = retsog.Parts;
for (int i=0;i<30;i++)
for (int i = 0; i < 30; i++)
{
SceneObjectPart cursop = mydic[parts[i].UUID];
Assert.That(cursop.GroupPosition,Is.EqualTo(parts[i].GroupPosition), "Assert.That(cursop.GroupPosition,Is.EqualTo(parts[i].GroupPosition))");
@ -576,6 +587,8 @@ namespace OpenSim.Data.Tests
//[Test]
public void T016_RandomSogWithSceneParts()
{
TestHelper.InMethod();
PropertyScrambler<SceneObjectPart> scrambler =
new PropertyScrambler<SceneObjectPart>()
.DontScramble(x => x.UUID);
@ -642,15 +655,16 @@ namespace OpenSim.Data.Tests
return sog;
}
// NOTE: it is a bad practice to rely on some of the previous tests having been run before.
// If the tests are run manually, one at a time, each starts with full class init (DB cleared).
// Even when all tests are run, NUnit 2.5+ no longer guarantee a specific test order.
// We shouldn't expect to find anything in the DB if we haven't put it there *in the same test*!
[Test]
public void T020_PrimInventoryEmpty()
{
TestHelper.InMethod();
SceneObjectGroup sog = GetMySOG("object1");
TaskInventoryItem t = sog.GetInventoryItem(sog.RootPart.LocalId, item1);
Assert.That(t, Is.Null);
@ -670,10 +684,11 @@ namespace OpenSim.Data.Tests
db.StorePrimInventory(sog.RootPart.UUID, list);
}
[Test]
public void T021_PrimInventoryBasic()
{
TestHelper.InMethod();
SceneObjectGroup sog = GetMySOG("object1");
InventoryItemBase i = NewItem(item1, zero, zero, itemname1, zero);
@ -701,20 +716,19 @@ namespace OpenSim.Data.Tests
Assert.That(t2.Name, Is.EqualTo("My New Name"), "Assert.That(t.Name, Is.EqualTo(\"My New Name\"))");
// Removing inventory
List<TaskInventoryItem> list = new List<TaskInventoryItem>();
db.StorePrimInventory(prim1, list);
sog = FindSOG("object1", region1);
t = sog.GetInventoryItem(sog.RootPart.LocalId, item1);
Assert.That(t, Is.Null);
}
[Test]
public void T025_PrimInventoryPersistency()
{
TestHelper.InMethod();
InventoryItemBase i = new InventoryItemBase();
UUID id = UUID.Random();
i.ID = id;
@ -786,6 +800,8 @@ namespace OpenSim.Data.Tests
[ExpectedException(typeof(ArgumentException))]
public void T026_PrimInventoryMany()
{
TestHelper.InMethod();
UUID i1,i2,i3,i4;
i1 = UUID.Random();
i2 = UUID.Random();
@ -816,15 +832,18 @@ namespace OpenSim.Data.Tests
[Test]
public void T052_RemoveObject()
{
TestHelper.InMethod();
db.RemoveObject(prim1, region1);
SceneObjectGroup sog = FindSOG("object1", region1);
Assert.That(sog, Is.Null);
}
[Test]
public void T100_DefaultRegionInfo()
{
TestHelper.InMethod();
RegionSettings r1 = db.LoadRegionSettings(region1);
Assert.That(r1.RegionUUID, Is.EqualTo(region1), "Assert.That(r1.RegionUUID, Is.EqualTo(region1))");
@ -835,6 +854,8 @@ namespace OpenSim.Data.Tests
[Test]
public void T101_UpdateRegionInfo()
{
TestHelper.InMethod();
int agentlimit = random.Next();
double objectbonus = random.Next();
int maturity = random.Next();
@ -933,13 +954,14 @@ namespace OpenSim.Data.Tests
//Assert.That(r1a.TerrainImageID,Is.EqualTo(terimgid), "Assert.That(r1a.TerrainImageID,Is.EqualTo(terimgid))");
Assert.That(r1a.FixedSun,Is.True);
Assert.That(r1a.SunPosition, Is.EqualTo(sunpos), "Assert.That(r1a.SunPosition, Is.EqualTo(sunpos))");
Assert.That(r1a.Covenant, Is.EqualTo(cov), "Assert.That(r1a.Covenant, Is.EqualTo(cov))");
Assert.That(r1a.Covenant, Is.EqualTo(cov), "Assert.That(r1a.Covenant, Is.EqualTo(cov))");
}
[Test]
public void T300_NoTerrain()
{
TestHelper.InMethod();
Assert.That(db.LoadTerrain(zero), Is.Null);
Assert.That(db.LoadTerrain(region1), Is.Null);
Assert.That(db.LoadTerrain(region2), Is.Null);
@ -949,6 +971,8 @@ namespace OpenSim.Data.Tests
[Test]
public void T301_CreateTerrain()
{
TestHelper.InMethod();
double[,] t1 = GenTerrain(height1);
db.StoreTerrain(t1, region1);
@ -961,6 +985,8 @@ namespace OpenSim.Data.Tests
[Test]
public void T302_FetchTerrain()
{
TestHelper.InMethod();
double[,] baseterrain1 = GenTerrain(height1);
double[,] baseterrain2 = GenTerrain(height2);
double[,] t1 = db.LoadTerrain(region1);
@ -971,6 +997,8 @@ namespace OpenSim.Data.Tests
[Test]
public void T303_UpdateTerrain()
{
TestHelper.InMethod();
double[,] baseterrain1 = GenTerrain(height1);
double[,] baseterrain2 = GenTerrain(height2);
db.StoreTerrain(baseterrain2, region1);
@ -983,6 +1011,8 @@ namespace OpenSim.Data.Tests
[Test]
public void T400_EmptyLand()
{
TestHelper.InMethod();
Assert.That(db.LoadLandObjects(zero).Count, Is.EqualTo(0), "Assert.That(db.LoadLandObjects(zero).Count, Is.EqualTo(0))");
Assert.That(db.LoadLandObjects(region1).Count, Is.EqualTo(0), "Assert.That(db.LoadLandObjects(region1).Count, Is.EqualTo(0))");
Assert.That(db.LoadLandObjects(region2).Count, Is.EqualTo(0), "Assert.That(db.LoadLandObjects(region2).Count, Is.EqualTo(0))");
@ -1018,25 +1048,12 @@ namespace OpenSim.Data.Tests
return true;
}
private SceneObjectGroup FindSOG(string name, UUID r)
{
List<SceneObjectGroup> objs = db.LoadObjects(r);
foreach (SceneObjectGroup sog in objs)
{
SceneObjectPart p = sog.RootPart;
if (p.Name == name) {
RegionInfo regionInfo = new RegionInfo();
regionInfo.RegionID = r;
regionInfo.RegionLocX = 0;
regionInfo.RegionLocY = 0;
Scene scene = new Scene(regionInfo);
sog.SetScene(scene);
if (sog.Name == name)
return sog;
}
}
return null;
}

View File

@ -1149,7 +1149,17 @@ namespace OpenSim.Framework
void SendDetailedEstateData(UUID invoice, string estateName, uint estateID, uint parentEstate, uint estateFlags,
uint sunPosition, UUID covenant, string abuseEmail, UUID estateOwner);
void SendLandProperties(int sequence_id, bool snap_selection, int request_result, LandData landData,
/// <summary>
/// Send land properties to the client.
/// </summary>
/// <param name="sequence_id"></param>
/// <param name="snap_selection"></param>
/// <param name="request_result"></param>
/// <param name="lo"></param></param>
/// <param name="parcelObjectCapacity">/param>
/// <param name="simObjectCapacity"></param>
/// <param name="regionFlags"></param>
void SendLandProperties(int sequence_id, bool snap_selection, int request_result, ILandObject lo,
float simObjectBonusFactor, int parcelObjectCapacity, int simObjectCapacity,
uint regionFlags);

View File

@ -27,10 +27,8 @@
using System.Collections.Generic;
using OpenMetaverse;
using OpenSim.Framework;
using OpenSim.Region.Framework.Scenes;
namespace OpenSim.Region.Framework.Interfaces
namespace OpenSim.Framework
{
public delegate int overrideParcelMaxPrimCountDelegate(ILandObject obj);
public delegate int overrideSimulatorMaxPrimCountDelegate(ILandObject obj);
@ -45,6 +43,11 @@ namespace OpenSim.Region.Framework.Interfaces
bool[,] LandBitmap { get; set; }
UUID RegionUUID { get; }
/// <summary>
/// Prim counts for this land object.
/// </summary>
IPrimCounts PrimCounts { get; set; }
/// <summary>
/// The start point for the land object. This is the western-most point as one scans land working from
/// north to south.
@ -85,11 +88,8 @@ namespace OpenSim.Region.Framework.Interfaces
bool[,] MergeLandBitmaps(bool[,] bitmap_base, bool[,] bitmap_add);
void SendForceObjectSelect(int local_id, int request_type, List<UUID> returnIDs, IClientAPI remote_client);
void SendLandObjectOwners(IClientAPI remote_client);
void ReturnObject(SceneObjectGroup obj);
void ReturnLandObjects(uint type, UUID[] owners, UUID[] tasks, IClientAPI remote_client);
void ResetLandPrimCounts();
void AddPrimToCount(SceneObjectGroup obj);
void RemovePrimFromCount(SceneObjectGroup obj);
void UpdateLandSold(UUID avatarID, UUID groupID, bool groupOwned, uint AuctionID, int claimprice, int area);
void DeedToGroup(UUID groupID);

View File

@ -0,0 +1,74 @@
/*
* 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.
*/
using OpenMetaverse;
namespace OpenSim.Framework
{
public interface IPrimCounts
{
/// <summary>
/// Parcel owner owned prims
/// </summary>
int Owner { get; }
/// <summary>
/// Parcel group owned prims
/// </summary>
int Group { get; }
/// <summary>
/// Prims owned by others (not parcel owner or parcel group).
/// </summary>
int Others { get; }
/// <summary>
/// Selected prims
/// </summary>
int Selected { get; }
/// <summary>
/// Total prims on the parcel.
/// </summary>
int Total { get; }
/// <summary>
/// Prims on the simulator that are owned by the parcel owner, even if they are in other parcels.
/// </summary>
int Simulator { get; }
/// <summary>
/// Prims per individual users.
/// </summary>
IUserPrimCounts Users { get; }
}
public interface IUserPrimCounts
{
int this[UUID agentID] { get; }
}
}

View File

@ -25,15 +25,19 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using log4net;
using System;
using System.Collections.Generic;
using System.IO;
using System.Reflection;
using Nini.Config;
namespace OpenSim.Framework.RegionLoader.Filesystem
{
public class RegionLoaderFileSystem : IRegionLoader
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private IConfigSource m_configSource;
public void SetIniConfigSource(IConfigSource configSource)
@ -63,36 +67,48 @@ namespace OpenSim.Framework.RegionLoader.Filesystem
string[] configFiles = Directory.GetFiles(regionConfigPath, "*.xml");
string[] iniFiles = Directory.GetFiles(regionConfigPath, "*.ini");
// Create an empty Regions.ini if there are no existing config files.
if (configFiles.Length == 0 && iniFiles.Length == 0)
{
{
new RegionInfo("DEFAULT REGION CONFIG", Path.Combine(regionConfigPath, "Regions.ini"), false, m_configSource);
iniFiles = Directory.GetFiles(regionConfigPath, "*.ini");
}
m_log.InfoFormat("[REGION LOADER FILE SYSTEM]: Loading config files from {0}", regionConfigPath);
List<RegionInfo> regionInfos = new List<RegionInfo>();
int i = 0;
foreach (string file in iniFiles)
{
m_log.InfoFormat("[REGION LOADER FILE SYSTEM]: Loading config file {0}", file);
IConfigSource source = new IniConfigSource(file);
foreach (IConfig config in source.Configs)
{
//m_log.Info("[REGIONLOADERFILESYSTEM]: Creating RegionInfo for " + config.Name);
{
RegionInfo regionInfo = new RegionInfo("REGION CONFIG #" + (i + 1), file, false, m_configSource, config.Name);
regionInfos.Add(regionInfo);
m_log.InfoFormat("[REGION LOADER FILE SYSTEM]: Loaded config for region {0}", regionInfo.RegionName);
i++;
}
}
foreach (string file in configFiles)
{
m_log.InfoFormat("[REGION LOADER FILE SYSTEM]: Loading config file {0}", file);
RegionInfo regionInfo = new RegionInfo("REGION CONFIG #" + (i + 1), file, false, m_configSource);
regionInfos.Add(regionInfo);
m_log.InfoFormat("[REGION LOADER FILE SYSTEM]: Loaded config for region {0}", regionInfo.RegionName);
i++;
}
return regionInfos.ToArray();
}
}
}
}

View File

@ -66,9 +66,9 @@ namespace OpenSim.Framework.RegionLoader.Web
{
HttpWebRequest webRequest = (HttpWebRequest) WebRequest.Create(url);
webRequest.Timeout = 30000; //30 Second Timeout
m_log.Debug("[WEBLOADER]: Sending Download Request...");
m_log.DebugFormat("[WEBLOADER]: Sending download request to {0}", url);
HttpWebResponse webResponse = (HttpWebResponse) webRequest.GetResponse();
m_log.Debug("[WEBLOADER]: Downloading Region Information From Remote Server...");
m_log.Debug("[WEBLOADER]: Downloading region information...");
StreamReader reader = new StreamReader(webResponse.GetResponseStream());
string xmlSource = String.Empty;
string tempStr = reader.ReadLine();

View File

@ -66,6 +66,8 @@ namespace OpenSim.Framework.Serialization
UserAccount account = userService.GetUserAccount(UUID.Zero, userId);
if (account != null)
return MakeOspa(account.FirstName, account.LastName);
// else
// m_log.WarnFormat("[OSP RESOLVER]: No user account for {0}", userId);
return null;
}
@ -77,6 +79,8 @@ namespace OpenSim.Framework.Serialization
/// <returns></returns>
public static string MakeOspa(string firstName, string lastName)
{
// m_log.DebugFormat("[OSP RESOLVER]: Making OSPA for {0} {1}", firstName, lastName);
return
OSPA_PREFIX + OSPA_NAME_KEY + OSPA_PAIR_SEPARATOR + firstName + OSPA_NAME_VALUE_SEPARATOR + lastName;
}
@ -97,7 +101,10 @@ namespace OpenSim.Framework.Serialization
public static UUID ResolveOspa(string ospa, IUserAccountService userService)
{
if (!ospa.StartsWith(OSPA_PREFIX))
return UUID.Zero;
{
// m_log.DebugFormat("[OSP RESOLVER]: ResolveOspa() got unrecognized format [{0}]", ospa);
return UUID.Zero;
}
// m_log.DebugFormat("[OSP RESOLVER]: Resolving {0}", ospa);
@ -161,7 +168,17 @@ namespace OpenSim.Framework.Serialization
UserAccount account = userService.GetUserAccount(UUID.Zero, firstName, lastName);
if (account != null)
{
// m_log.DebugFormat(
// "[OSP RESOLVER]: Found user account with uuid {0} for {1} {2}",
// account.PrincipalID, firstName, lastName);
return account.PrincipalID;
}
// else
// {
// m_log.DebugFormat("[OSP RESOLVER]: No resolved OSPA user account for {0}", name);
// }
// XXX: Disable temporary user profile creation for now as implementation is incomplete - justincc
/*

View File

@ -378,6 +378,22 @@ namespace OpenSim.Framework.Servers.HttpServer
/// <param name="response"></param>
public virtual void HandleRequest(OSHttpRequest request, OSHttpResponse response)
{
if (request.HttpMethod == String.Empty) // Can't handle empty requests, not wasting a thread
{
try
{
SendHTML500(response);
}
catch
{
}
return;
}
string requestMethod = request.HttpMethod;
string uriString = request.RawUrl;
string reqnum = "unknown";
int tickstart = Environment.TickCount;
@ -495,7 +511,7 @@ namespace OpenSim.Framework.Servers.HttpServer
request.InputStream.Close();
// HTTP IN support. The script engine taes it from here
// HTTP IN support. The script engine takes it from here
// Nothing to worry about for us.
//
if (buffer == null)
@ -609,19 +625,19 @@ namespace OpenSim.Framework.Servers.HttpServer
{
m_log.ErrorFormat("[BASE HTTP SERVER]: HandleRequest() threw ", e);
}
catch (InvalidOperationException e)
catch (Exception e)
{
m_log.ErrorFormat("[BASE HTTP SERVER]: HandleRequest() threw {0}", e);
m_log.ErrorFormat("[BASE HTTP SERVER]: HandleRequest() threw " + e.ToString());
SendHTML500(response);
}
finally
{
// Every month or so this will wrap and give bad numbers, not really a problem
// since its just for reporting, 200ms limit can be adjusted
// since its just for reporting, tickdiff limit can be adjusted
int tickdiff = Environment.TickCount - tickstart;
if (tickdiff > 500)
if (tickdiff > 3000)
m_log.InfoFormat(
"[BASE HTTP SERVER]: slow request <{0}> for {1} took {2} ms", reqnum, request.RawUrl, tickdiff);
"[BASE HTTP SERVER]: slow {0} request for {1} from {2} took {3} ms", requestMethod, uriString, request.RemoteIPEndPoint.ToString(), tickdiff);
}
}

View File

@ -83,7 +83,7 @@ namespace OpenSim.Framework.Servers.HttpServer
/// <summary>
/// Regular expression used to match against path of the
/// incoming HTTP request. If you want to match any string
/// either use '.*' or null. To match on the emtpy string use
/// either use '.*' or null. To match on the empty string use
/// '^$'.
/// </summary>
public virtual Regex Path

View File

@ -34,7 +34,6 @@ using System.Text;
using HttpServer;
using HttpServer.FormDecoders;
using NUnit.Framework;
using NUnit.Framework.SyntaxHelpers;
using OpenSim.Framework.Servers.HttpServer;
namespace OpenSim.Framework.Servers.Tests

View File

@ -28,7 +28,6 @@
using System;
using System.Reflection;
using NUnit.Framework;
using NUnit.Framework.SyntaxHelpers;
using OpenMetaverse;
using OpenMetaverse.StructuredData;
using OpenSim.Framework;

View File

@ -28,7 +28,6 @@
using System;
using System.Reflection;
using NUnit.Framework;
using NUnit.Framework.SyntaxHelpers;
using OpenMetaverse;
using OpenMetaverse.StructuredData;
using OpenSim.Framework;
@ -38,8 +37,6 @@ namespace OpenSim.Framework.Tests
[TestFixture]
public class PrimeNumberHelperTests
{
[Test]
public void TestGetPrime()
{

View File

@ -27,7 +27,6 @@
using System;
using NUnit.Framework;
using NUnit.Framework.SyntaxHelpers;
using OpenMetaverse;
using OpenSim.Tests.Common;

View File

@ -90,7 +90,7 @@ namespace OpenSim.Framework
return deleted;
}
else
throw new InvalidOperationException("Cannot pop from emtpy stack");
throw new InvalidOperationException("Cannot pop from empty stack");
}
public T Peek()

View File

@ -798,67 +798,116 @@ namespace OpenSim
regionnum = m_sceneManager.Scenes.Count;
}
/// <summary>
/// Create an estate with an initial region.
/// </summary>
/// <remarks>
/// This method doesn't allow an estate to be created with the same name as existing estates.
/// </remarks>
/// <param name="regInfo"></param>
/// <param name="existingName">A list of estate names that already exist.</param>
/// <returns>true if the estate was created, false otherwise</returns>
public bool CreateEstate(RegionInfo regInfo, List<string> existingNames)
{
// Create a new estate
regInfo.EstateSettings = EstateDataService.LoadEstateSettings(regInfo.RegionID, true);
string newName = MainConsole.Instance.CmdPrompt("New estate name", regInfo.EstateSettings.EstateName);
if (existingNames.Contains(newName))
{
MainConsole.Instance.OutputFormat("An estate named {0} already exists. Please try again.", newName);
return false;
}
regInfo.EstateSettings.EstateName = newName;
// FIXME: Later on, the scene constructor will reload the estate settings no matter what.
// Therefore, we need to do an initial save here otherwise the new estate name will be reset
// back to the default. The reloading of estate settings by scene could be eliminated if it
// knows that the passed in settings in RegionInfo are already valid. Also, it might be
// possible to eliminate some additional later saves made by callers of this method.
regInfo.EstateSettings.Save();
return true;
}
/// <summary>
/// Load the estate information for the provided RegionInfo object.
/// </summary>
/// <param name="regInfo"></param>
public void PopulateRegionEstateInfo(RegionInfo regInfo)
{
IEstateDataService estateDataService = EstateDataService;
if (estateDataService != null)
{
regInfo.EstateSettings = estateDataService.LoadEstateSettings(regInfo.RegionID, false);
}
if (EstateDataService != null)
regInfo.EstateSettings = EstateDataService.LoadEstateSettings(regInfo.RegionID, false);
if (regInfo.EstateSettings.EstateID == 0) // No record at all
{
MainConsole.Instance.Output("Your region is not part of an estate.");
MainConsole.Instance.OutputFormat("Region {0} is not part of an estate.", regInfo.RegionName);
List<EstateSettings> estates = EstateDataService.LoadEstateSettingsAll();
List<string> estateNames = new List<string>();
foreach (EstateSettings estate in estates)
estateNames.Add(estate.EstateName);
while (true)
{
string response = MainConsole.Instance.CmdPrompt("Do you wish to join an existing estate?", "no", new List<string>() { "yes", "no" });
if (response == "no")
{
// Create a new estate
regInfo.EstateSettings = estateDataService.LoadEstateSettings(regInfo.RegionID, true);
regInfo.EstateSettings.EstateName = MainConsole.Instance.CmdPrompt("New estate name", regInfo.EstateSettings.EstateName);
if (estates.Count == 0)
{
MainConsole.Instance.Output("No existing estates found. You must create a new one.");
// FIXME: Later on, the scene constructor will reload the estate settings no matter what.
// Therefore, we need to do an initial save here otherwise the new estate name will be reset
// back to the default. The reloading of estate settings by scene could be eliminated if it
// knows that the passed in settings in RegionInfo are already valid. Also, it might be
// possible to eliminate some additional later saves made by callers of this method.
regInfo.EstateSettings.Save();
break;
if (CreateEstate(regInfo, estateNames))
break;
else
continue;
}
else
{
response = MainConsole.Instance.CmdPrompt("Estate name to join", "None");
if (response == "None")
continue;
List<int> estateIDs = estateDataService.GetEstates(response);
if (estateIDs.Count < 1)
string response
= MainConsole.Instance.CmdPrompt(
string.Format(
"Do you wish to join region {0} to an existing estate (yes/no)?", regInfo.RegionName),
"no",
new List<string>() { "yes", "no" });
if (response == "no")
{
MainConsole.Instance.Output("The name you have entered matches no known estate. Please try again");
continue;
if (CreateEstate(regInfo, estateNames))
break;
else
continue;
}
else
{
response
= MainConsole.Instance.CmdPrompt(
string.Format(
"Name of estate to join. Existing estate names are ({0})", string.Join(", ", estateNames.ToArray())),
"None");
if (response == "None")
continue;
List<int> estateIDs = EstateDataService.GetEstates(response);
if (estateIDs.Count < 1)
{
MainConsole.Instance.Output("The name you have entered matches no known estate. Please try again.");
continue;
}
int estateID = estateIDs[0];
regInfo.EstateSettings = EstateDataService.LoadEstateSettings(estateID);
if (EstateDataService.LinkRegion(regInfo.RegionID, estateID))
break;
MainConsole.Instance.Output("Joining the estate failed. Please try again.");
}
int estateID = estateIDs[0];
regInfo.EstateSettings = estateDataService.LoadEstateSettings(estateID);
if (estateDataService.LinkRegion(regInfo.RegionID, estateID))
break;
MainConsole.Instance.Output("Joining the estate failed. Please try again.");
}
}
}
}
}
public class OpenSimConfigSource
{

View File

@ -4345,8 +4345,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP
OutPacket(packet, ThrottleOutPacketType.Task);
}
public void SendLandProperties(int sequence_id, bool snap_selection, int request_result, LandData landData, float simObjectBonusFactor, int parcelObjectCapacity, int simObjectCapacity, uint regionFlags)
public void SendLandProperties(
int sequence_id, bool snap_selection, int request_result, ILandObject lo,
float simObjectBonusFactor, int parcelObjectCapacity, int simObjectCapacity, uint regionFlags)
{
// m_log.DebugFormat("[LLCLIENTVIEW]: Sending land properties for {0} to {1}", lo.LandData.GlobalID, Name);
LandData landData = lo.LandData;
ParcelPropertiesMessage updateMessage = new ParcelPropertiesMessage();
updateMessage.AABBMax = landData.AABBMax;
@ -4354,15 +4360,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
updateMessage.Area = landData.Area;
updateMessage.AuctionID = landData.AuctionID;
updateMessage.AuthBuyerID = landData.AuthBuyerID;
updateMessage.Bitmap = landData.Bitmap;
updateMessage.Desc = landData.Description;
updateMessage.Category = landData.Category;
updateMessage.ClaimDate = Util.ToDateTime(landData.ClaimDate);
updateMessage.ClaimPrice = landData.ClaimPrice;
updateMessage.GroupID = landData.GroupID;
updateMessage.GroupPrims = landData.GroupPrims;
updateMessage.GroupID = landData.GroupID;
updateMessage.IsGroupOwned = landData.IsGroupOwned;
updateMessage.LandingType = (LandingType) landData.LandingType;
updateMessage.LocalID = landData.LocalID;
@ -4383,9 +4386,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
updateMessage.Name = landData.Name;
updateMessage.OtherCleanTime = landData.OtherCleanTime;
updateMessage.OtherCount = 0; //TODO: Unimplemented
updateMessage.OtherPrims = landData.OtherPrims;
updateMessage.OwnerID = landData.OwnerID;
updateMessage.OwnerPrims = landData.OwnerPrims;
updateMessage.OwnerID = landData.OwnerID;
updateMessage.ParcelFlags = (ParcelFlags) landData.Flags;
updateMessage.ParcelPrimBonus = simObjectBonusFactor;
updateMessage.PassHours = landData.PassHours;
@ -4400,10 +4401,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
updateMessage.RentPrice = 0;
updateMessage.RequestResult = (ParcelResult) request_result;
updateMessage.SalePrice = landData.SalePrice;
updateMessage.SelectedPrims = landData.SelectedPrims;
updateMessage.SalePrice = landData.SalePrice;
updateMessage.SelfCount = 0; //TODO: Unimplemented
updateMessage.SequenceID = sequence_id;
if (landData.SimwideArea > 0)
{
int simulatorCapacity = (int)(((float)landData.SimwideArea / 65536.0f) * (float)m_scene.RegionInfo.ObjectCapacity * (float)m_scene.RegionInfo.RegionSettings.ObjectBonus);
@ -4413,22 +4414,28 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{
updateMessage.SimWideMaxPrims = 0;
}
updateMessage.SimWideTotalPrims = landData.SimwidePrims;
updateMessage.SnapSelection = snap_selection;
updateMessage.SnapshotID = landData.SnapshotID;
updateMessage.Status = (ParcelStatus) landData.Status;
updateMessage.TotalPrims = landData.OwnerPrims + landData.GroupPrims + landData.OtherPrims +
landData.SelectedPrims;
updateMessage.UserLocation = landData.UserLocation;
updateMessage.UserLookAt = landData.UserLookAt;
updateMessage.SnapshotID = landData.SnapshotID;
updateMessage.Status = (ParcelStatus) landData.Status;
updateMessage.UserLocation = landData.UserLocation;
updateMessage.UserLookAt = landData.UserLookAt;
updateMessage.MediaType = landData.MediaType;
updateMessage.MediaDesc = landData.MediaDescription;
updateMessage.MediaWidth = landData.MediaWidth;
updateMessage.MediaHeight = landData.MediaHeight;
updateMessage.MediaLoop = landData.MediaLoop;
updateMessage.ObscureMusic = landData.ObscureMusic;
updateMessage.ObscureMedia = landData.ObscureMedia;
updateMessage.MediaType = landData.MediaType;
updateMessage.MediaDesc = landData.MediaDescription;
updateMessage.MediaWidth = landData.MediaWidth;
updateMessage.MediaHeight = landData.MediaHeight;
updateMessage.MediaLoop = landData.MediaLoop;
updateMessage.ObscureMusic = landData.ObscureMusic;
updateMessage.ObscureMedia = landData.ObscureMedia;
IPrimCounts pc = lo.PrimCounts;
updateMessage.OwnerPrims = pc.Owner;
updateMessage.GroupPrims = pc.Group;
updateMessage.OtherPrims = pc.Others;
updateMessage.SelectedPrims = pc.Selected;
updateMessage.TotalPrims = pc.Total;
updateMessage.SimWideTotalPrims = pc.Simulator;
try
{
@ -4436,13 +4443,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if (eq != null)
{
eq.ParcelProperties(updateMessage, this.AgentId);
} else {
m_log.Warn("No EQ Interface when sending parcel data.");
}
else
{
m_log.Warn("[LLCLIENTVIEW]: No EQ Interface when sending parcel data.");
}
}
catch (Exception ex)
{
m_log.Error("Unable to send parcel data via eventqueue - exception: " + ex.ToString());
m_log.Error("[LLCLIENTVIEW]: Unable to send parcel data via eventqueue - exception: " + ex.ToString());
}
}

View File

@ -28,6 +28,7 @@
using System;
using System.Collections.Generic;
using Nini.Config;
using OpenSim.Framework;
using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes;
using OpenMetaverse;

View File

@ -41,6 +41,7 @@ using OpenSim.Framework.Serialization;
using OpenSim.Framework.Serialization.External;
using OpenSim.Region.CoreModules.World.Archiver;
using OpenSim.Region.Framework.Scenes;
using OpenSim.Region.Framework.Scenes.Serialization;
using OpenSim.Region.Framework.Interfaces;
using OpenSim.Services.Interfaces;
@ -75,6 +76,36 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
/// The stream from which the inventory archive will be loaded.
/// </value>
private Stream m_loadStream;
protected bool m_controlFileLoaded;
protected bool m_assetsLoaded;
protected bool m_inventoryNodesLoaded;
protected int m_successfulAssetRestores;
protected int m_failedAssetRestores;
protected int m_successfulItemRestores;
/// <summary>
/// Root destination folder for the IAR load.
/// </summary>
protected InventoryFolderBase m_rootDestinationFolder;
/// <summary>
/// Inventory nodes loaded from the iar.
/// </summary>
protected HashSet<InventoryNodeBase> m_loadedNodes = new HashSet<InventoryNodeBase>();
/// <summary>
/// In order to load identically named folders, we need to keep track of the folders that we have already
/// resolved.
/// </summary>
Dictionary <string, InventoryFolderBase> m_resolvedFolders = new Dictionary<string, InventoryFolderBase>();
/// <summary>
/// Record the creator id that should be associated with an asset. This is used to adjust asset creator ids
/// after OSP resolution (since OSP creators are only stored in the item
/// </summary>
protected Dictionary<UUID, UUID> m_creatorIdForAssetId = new Dictionary<UUID, UUID>();
public InventoryArchiveReadRequest(
Scene scene, UserAccount userInfo, string invPath, string loadPath, bool merge)
@ -100,20 +131,19 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
/// <summary>
/// Execute the request
/// </summary>
/// <remarks>
/// Only call this once. To load another IAR, construct another request object.
/// </remarks>
/// <returns>
/// A list of the inventory nodes loaded. If folders were loaded then only the root folders are
/// returned
/// </returns>
/// <exception cref="System.Exception">Thrown if load fails.</exception>
public HashSet<InventoryNodeBase> Execute()
{
try
{
string filePath = "ERROR";
int successfulAssetRestores = 0;
int failedAssetRestores = 0;
int successfulItemRestores = 0;
HashSet<InventoryNodeBase> loadedNodes = new HashSet<InventoryNodeBase>();
List<InventoryFolderBase> folderCandidates
= InventoryArchiveUtils.FindFolderByPath(
@ -124,16 +154,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
// Possibly provide an option later on to automatically create this folder if it does not exist
m_log.ErrorFormat("[INVENTORY ARCHIVER]: Inventory path {0} does not exist", m_invPath);
return loadedNodes;
return m_loadedNodes;
}
InventoryFolderBase rootDestinationFolder = folderCandidates[0];
m_rootDestinationFolder = folderCandidates[0];
archive = new TarArchiveReader(m_loadStream);
// In order to load identically named folders, we need to keep track of the folders that we have already
// resolved
Dictionary <string, InventoryFolderBase> resolvedFolders = new Dictionary<string, InventoryFolderBase>();
byte[] data;
TarArchiveReader.TarEntryType entryType;
@ -142,45 +167,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
if (filePath == ArchiveConstants.CONTROL_FILE_PATH)
{
LoadControlFile(filePath, data);
}
}
else if (filePath.StartsWith(ArchiveConstants.ASSETS_PATH))
{
if (LoadAsset(filePath, data))
successfulAssetRestores++;
else
failedAssetRestores++;
if ((successfulAssetRestores) % 50 == 0)
m_log.DebugFormat(
"[INVENTORY ARCHIVER]: Loaded {0} assets...",
successfulAssetRestores);
LoadAssetFile(filePath, data);
}
else if (filePath.StartsWith(ArchiveConstants.INVENTORY_PATH))
{
filePath = filePath.Substring(ArchiveConstants.INVENTORY_PATH.Length);
// Trim off the file portion if we aren't already dealing with a directory path
if (TarArchiveReader.TarEntryType.TYPE_DIRECTORY != entryType)
filePath = filePath.Remove(filePath.LastIndexOf("/") + 1);
InventoryFolderBase foundFolder
= ReplicateArchivePathToUserInventory(
filePath, rootDestinationFolder, resolvedFolders, loadedNodes);
if (TarArchiveReader.TarEntryType.TYPE_DIRECTORY != entryType)
{
InventoryItemBase item = LoadItem(data, foundFolder);
if (item != null)
{
successfulItemRestores++;
// If we aren't loading the folder containing the item then well need to update the
// viewer separately for that item.
if (!loadedNodes.Contains(foundFolder))
loadedNodes.Add(item);
}
}
LoadInventoryFile(filePath, entryType, data);
}
}
@ -188,10 +182,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
m_log.DebugFormat(
"[INVENTORY ARCHIVER]: Successfully loaded {0} assets with {1} failures",
successfulAssetRestores, failedAssetRestores);
m_log.InfoFormat("[INVENTORY ARCHIVER]: Successfully loaded {0} items", successfulItemRestores);
m_successfulAssetRestores, m_failedAssetRestores);
m_log.InfoFormat("[INVENTORY ARCHIVER]: Successfully loaded {0} items", m_successfulItemRestores);
return loadedNodes;
return m_loadedNodes;
}
finally
{
@ -400,9 +394,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
UUID ospResolvedId = OspResolver.ResolveOspa(item.CreatorId, m_scene.UserAccountService);
if (UUID.Zero != ospResolvedId) // The user exists in this grid
{
// m_log.DebugFormat("[INVENTORY ARCHIVER]: Found creator {0} via OSPA resolution", ospResolvedId);
item.CreatorIdAsUuid = ospResolvedId;
// XXX: For now, don't preserve the OSPA in the creator id (which actually gets persisted to the
// Don't preserve the OSPA in the creator id (which actually gets persisted to the
// database). Instead, replace with the UUID that we found.
item.CreatorId = ospResolvedId.ToString();
@ -410,7 +406,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
}
else if (item.CreatorData == null || item.CreatorData == String.Empty)
{
item.CreatorIdAsUuid = m_userInfo.PrincipalID;
item.CreatorId = m_userInfo.PrincipalID.ToString();
item.CreatorIdAsUuid = new UUID(item.CreatorId);
}
item.Owner = m_userInfo.PrincipalID;
@ -418,6 +415,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
// Reset folder ID to the one in which we want to load it
item.Folder = loadFolder.ID;
// Record the creator id for the item's asset so that we can use it later, if necessary, when the asset
// is loaded.
// FIXME: This relies on the items coming before the assets in the TAR file. Need to create stronger
// checks for this, and maybe even an external tool for creating OARs which enforces this, rather than
// relying on native tar tools.
m_creatorIdForAssetId[item.AssetID] = item.CreatorIdAsUuid;
m_scene.AddInventoryItem(item);
return item;
@ -446,18 +450,38 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
}
string extension = filename.Substring(i);
string uuid = filename.Remove(filename.Length - extension.Length);
string rawUuid = filename.Remove(filename.Length - extension.Length);
UUID assetId = new UUID(rawUuid);
if (ArchiveConstants.EXTENSION_TO_ASSET_TYPE.ContainsKey(extension))
{
sbyte assetType = ArchiveConstants.EXTENSION_TO_ASSET_TYPE[extension];
if (assetType == (sbyte)AssetType.Unknown)
m_log.WarnFormat("[INVENTORY ARCHIVER]: Importing {0} byte asset {1} with unknown type", data.Length, uuid);
{
m_log.WarnFormat("[INVENTORY ARCHIVER]: Importing {0} byte asset {1} with unknown type", data.Length, assetId);
}
else if (assetType == (sbyte)AssetType.Object)
{
if (m_creatorIdForAssetId.ContainsKey(assetId))
{
string xmlData = Utils.BytesToString(data);
SceneObjectGroup sog = SceneObjectSerializer.FromOriginalXmlFormat(xmlData);
foreach (SceneObjectPart sop in sog.Parts)
{
if (sop.CreatorData == null || sop.CreatorData == "")
{
sop.CreatorID = m_creatorIdForAssetId[assetId];
}
}
data = Utils.StringToBytes(SceneObjectSerializer.ToOriginalXmlFormat(sog));
}
}
//m_log.DebugFormat("[INVENTORY ARCHIVER]: Importing asset {0}, type {1}", uuid, assetType);
AssetBase asset = new AssetBase(new UUID(uuid), "RandomName", assetType, UUID.Zero.ToString());
AssetBase asset = new AssetBase(assetId, "From IAR", assetType, UUID.Zero.ToString());
asset.Data = data;
m_scene.AssetService.Store(asset);
@ -495,7 +519,88 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
majorVersion, MAX_MAJOR_VERSION));
}
m_log.InfoFormat("[INVENTORY ARCHIVER]: Loading IAR with version {0}", version);
m_controlFileLoaded = true;
m_log.InfoFormat("[INVENTORY ARCHIVER]: Loading IAR with version {0}", version);
}
/// <summary>
/// Load inventory file
/// </summary>
/// <param name="path"></param>
/// <param name="entryType"></param>
/// <param name="data"></param>
protected void LoadInventoryFile(string path, TarArchiveReader.TarEntryType entryType, byte[] data)
{
if (!m_controlFileLoaded)
throw new Exception(
string.Format(
"The IAR you are trying to load does not list {0} before {1}. Aborting load",
ArchiveConstants.CONTROL_FILE_PATH, ArchiveConstants.INVENTORY_PATH));
if (m_assetsLoaded)
throw new Exception(
string.Format(
"The IAR you are trying to load does not list all {0} before {1}. Aborting load",
ArchiveConstants.INVENTORY_PATH, ArchiveConstants.ASSETS_PATH));
path = path.Substring(ArchiveConstants.INVENTORY_PATH.Length);
// Trim off the file portion if we aren't already dealing with a directory path
if (TarArchiveReader.TarEntryType.TYPE_DIRECTORY != entryType)
path = path.Remove(path.LastIndexOf("/") + 1);
InventoryFolderBase foundFolder
= ReplicateArchivePathToUserInventory(
path, m_rootDestinationFolder, m_resolvedFolders, m_loadedNodes);
if (TarArchiveReader.TarEntryType.TYPE_DIRECTORY != entryType)
{
InventoryItemBase item = LoadItem(data, foundFolder);
if (item != null)
{
m_successfulItemRestores++;
// If we aren't loading the folder containing the item then well need to update the
// viewer separately for that item.
if (!m_loadedNodes.Contains(foundFolder))
m_loadedNodes.Add(item);
}
}
m_inventoryNodesLoaded = true;
}
/// <summary>
/// Load asset file
/// </summary>
/// <param name="path"></param>
/// <param name="data"></param>
protected void LoadAssetFile(string path, byte[] data)
{
if (!m_controlFileLoaded)
throw new Exception(
string.Format(
"The IAR you are trying to load does not list {0} before {1}. Aborting load",
ArchiveConstants.CONTROL_FILE_PATH, ArchiveConstants.ASSETS_PATH));
if (!m_inventoryNodesLoaded)
throw new Exception(
string.Format(
"The IAR you are trying to load does not list all {0} before {1}. Aborting load",
ArchiveConstants.INVENTORY_PATH, ArchiveConstants.ASSETS_PATH));
if (LoadAsset(path, data))
m_successfulAssetRestores++;
else
m_failedAssetRestores++;
if ((m_successfulAssetRestores) % 50 == 0)
m_log.DebugFormat(
"[INVENTORY ARCHIVER]: Loaded {0} assets...",
m_successfulAssetRestores);
m_assetsLoaded = true;
}
}
}

View File

@ -109,9 +109,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
scene.AddCommand(
this, "load iar",
"load iar [--merge] <first> <last> <inventory path> <password> [<IAR path>]",
"load iar [-m|--merge] <first> <last> <inventory path> <password> [<IAR path>]",
"Load user inventory archive (IAR).",
"--merge is an option which merges the loaded IAR with existing inventory folders where possible, rather than always creating new ones"
"-m|--merge is an option which merges the loaded IAR with existing inventory folders where possible, rather than always creating new ones"
+ "<first> is user's first name." + Environment.NewLine
+ "<last> is user's last name." + Environment.NewLine
+ "<inventory path> is the path inside the user's inventory where the IAR should be loaded." + Environment.NewLine
@ -181,7 +181,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
catch (EntryPointNotFoundException e)
{
m_log.ErrorFormat(
"[ARCHIVER]: Mismatch between Mono and zlib1g library version when trying to create compression stream."
"[INVENTORY ARCHIVER]: Mismatch between Mono and zlib1g library version when trying to create compression stream."
+ "If you've manually installed Mono, have you appropriately updated zlib1g as well?");
m_log.Error(e);
@ -221,7 +221,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
catch (EntryPointNotFoundException e)
{
m_log.ErrorFormat(
"[ARCHIVER]: Mismatch between Mono and zlib1g library version when trying to create compression stream."
"[INVENTORY ARCHIVER]: Mismatch between Mono and zlib1g library version when trying to create compression stream."
+ "If you've manually installed Mono, have you appropriately updated zlib1g as well?");
m_log.Error(e);
@ -269,7 +269,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
catch (EntryPointNotFoundException e)
{
m_log.ErrorFormat(
"[ARCHIVER]: Mismatch between Mono and zlib1g library version when trying to create compression stream."
"[INVENTORY ARCHIVER]: Mismatch between Mono and zlib1g library version when trying to create compression stream."
+ "If you've manually installed Mono, have you appropriately updated zlib1g as well?");
m_log.Error(e);
@ -317,7 +317,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
catch (EntryPointNotFoundException e)
{
m_log.ErrorFormat(
"[ARCHIVER]: Mismatch between Mono and zlib1g library version when trying to create compression stream."
"[INVENTORY ARCHIVER]: Mismatch between Mono and zlib1g library version when trying to create compression stream."
+ "If you've manually installed Mono, have you appropriately updated zlib1g as well?");
m_log.Error(e);
@ -358,7 +358,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
if (mainParams.Count < 6)
{
m_log.Error(
"[INVENTORY ARCHIVER]: usage is load iar [--merge] <first name> <last name> <inventory path> <user password> [<load file path>]");
"[INVENTORY ARCHIVER]: usage is load iar [-m|--merge] <first name> <last name> <inventory path> <user password> [<load file path>]");
return;
}

View File

@ -0,0 +1,155 @@
/*
* 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.
*/
using System;
using System.Collections.Generic;
using System.IO;
using System.Reflection;
using System.Threading;
using NUnit.Framework;
using OpenMetaverse;
using OpenSim.Data;
using OpenSim.Framework;
using OpenSim.Framework.Serialization;
using OpenSim.Framework.Serialization.External;
using OpenSim.Framework.Communications;
using OpenSim.Region.CoreModules.Avatar.Inventory.Archiver;
using OpenSim.Region.CoreModules.World.Serialiser;
using OpenSim.Region.Framework.Scenes;
using OpenSim.Region.Framework.Scenes.Serialization;
using OpenSim.Services.Interfaces;
using OpenSim.Tests.Common;
using OpenSim.Tests.Common.Mock;
using OpenSim.Tests.Common.Setup;
namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
{
[TestFixture]
public class InventoryArchiveTestCase
{
protected ManualResetEvent mre = new ManualResetEvent(false);
/// <summary>
/// A raw array of bytes that we'll use to create an IAR memory stream suitable for isolated use in each test.
/// </summary>
protected byte[] m_iarStreamBytes;
/// <summary>
/// Stream of data representing a common IAR for load tests.
/// </summary>
protected MemoryStream m_iarStream;
protected UserAccount m_uaMT
= new UserAccount {
PrincipalID = UUID.Parse("00000000-0000-0000-0000-000000000555"),
FirstName = "Mr",
LastName = "Tiddles" };
protected UserAccount m_uaLL1
= new UserAccount {
PrincipalID = UUID.Parse("00000000-0000-0000-0000-000000000666"),
FirstName = "Lord",
LastName = "Lucan" };
protected UserAccount m_uaLL2
= new UserAccount {
PrincipalID = UUID.Parse("00000000-0000-0000-0000-000000000777"),
FirstName = "Lord",
LastName = "Lucan" };
protected string m_item1Name = "Ray Gun Item";
[SetUp]
public virtual void SetUp()
{
m_iarStream = new MemoryStream(m_iarStreamBytes);
}
[TestFixtureSetUp]
public void FixtureSetup()
{
ConstructDefaultIarBytesForTestLoad();
}
protected void ConstructDefaultIarBytesForTestLoad()
{
// log4net.Config.XmlConfigurator.Configure();
InventoryArchiverModule archiverModule = new InventoryArchiverModule();
Scene scene = SceneSetupHelpers.SetupScene("Inventory");
SceneSetupHelpers.SetupSceneModules(scene, archiverModule);
UserProfileTestUtils.CreateUserWithInventory(scene, m_uaLL1, "hampshire");
MemoryStream archiveWriteStream = new MemoryStream();
// Create asset
SceneObjectGroup object1;
SceneObjectPart part1;
{
string partName = "Ray Gun Object";
UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000040");
PrimitiveBaseShape shape = PrimitiveBaseShape.CreateSphere();
Vector3 groupPosition = new Vector3(10, 20, 30);
Quaternion rotationOffset = new Quaternion(20, 30, 40, 50);
Vector3 offsetPosition = new Vector3(5, 10, 15);
part1
= new SceneObjectPart(
ownerId, shape, groupPosition, rotationOffset, offsetPosition);
part1.Name = partName;
object1 = new SceneObjectGroup(part1);
scene.AddNewSceneObject(object1, false);
}
UUID asset1Id = UUID.Parse("00000000-0000-0000-0000-000000000060");
AssetBase asset1 = AssetHelpers.CreateAsset(asset1Id, object1);
scene.AssetService.Store(asset1);
// Create item
InventoryItemBase item1 = new InventoryItemBase();
item1.Name = m_item1Name;
item1.ID = UUID.Parse("00000000-0000-0000-0000-000000000020");
item1.AssetID = asset1.FullID;
item1.GroupID = UUID.Random();
item1.CreatorIdAsUuid = m_uaLL1.PrincipalID;
item1.Owner = m_uaLL1.PrincipalID;
item1.Folder = scene.InventoryService.GetRootFolder(m_uaLL1.PrincipalID).ID;
scene.AddInventoryItem(item1);
archiverModule.ArchiveInventory(
Guid.NewGuid(), m_uaLL1.FirstName, m_uaLL1.LastName, m_item1Name, "hampshire", archiveWriteStream);
m_iarStreamBytes = archiveWriteStream.ToArray();
}
protected void SaveCompleted(
Guid id, bool succeeded, UserAccount userInfo, string invPath, Stream saveStream,
Exception reportedException)
{
mre.Set();
}
}
}

View File

@ -31,7 +31,6 @@ using System.IO;
using System.Reflection;
using System.Threading;
using NUnit.Framework;
using NUnit.Framework.SyntaxHelpers;
using OpenMetaverse;
using OpenSim.Data;
using OpenSim.Framework;
@ -50,193 +49,21 @@ using OpenSim.Tests.Common.Setup;
namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
{
[TestFixture]
public class InventoryArchiverTests
{
protected ManualResetEvent mre = new ManualResetEvent(false);
/// <summary>
/// A raw array of bytes that we'll use to create an IAR memory stream suitable for isolated use in each test.
/// </summary>
protected byte[] m_iarStreamBytes;
/// <summary>
/// Stream of data representing a common IAR for load tests.
/// </summary>
protected MemoryStream m_iarStream;
protected UserAccount m_ua1
= new UserAccount {
PrincipalID = UUID.Parse("00000000-0000-0000-0000-000000000555"),
FirstName = "Mr",
LastName = "Tiddles" };
protected UserAccount m_ua2
= new UserAccount {
PrincipalID = UUID.Parse("00000000-0000-0000-0000-000000000666"),
FirstName = "Lord",
LastName = "Lucan" };
string m_item1Name = "b.lsl";
private void SaveCompleted(
Guid id, bool succeeded, UserAccount userInfo, string invPath, Stream saveStream,
Exception reportedException)
{
mre.Set();
}
public class InventoryArchiverTests : InventoryArchiveTestCase
{
protected TestScene m_scene;
protected InventoryArchiverModule m_archiverModule;
[SetUp]
public void SetUp()
public override void SetUp()
{
m_iarStream = new MemoryStream(m_iarStreamBytes);
}
[TestFixtureSetUp]
public void FixtureSetup()
{
ConstructDefaultIarBytesForTestLoad();
}
protected void ConstructDefaultIarBytesForTestLoad()
{
string archiveItemName = InventoryArchiveWriteRequest.CreateArchiveItemName(m_item1Name, UUID.Random());
MemoryStream archiveWriteStream = new MemoryStream();
TarArchiveWriter tar = new TarArchiveWriter(archiveWriteStream);
InventoryItemBase item1 = new InventoryItemBase();
item1.Name = m_item1Name;
item1.AssetID = UUID.Random();
item1.GroupID = UUID.Random();
//item1.CreatorId = OspResolver.MakeOspa(m_ua2.FirstName, m_ua2.LastName);
//item1.CreatorId = userUuid.ToString();
item1.CreatorId = m_ua2.PrincipalID.ToString();
item1.Owner = UUID.Zero;
Scene scene = SceneSetupHelpers.SetupScene("Inventory");
UserProfileTestUtils.CreateUserWithInventory(scene, m_ua2, "hampshire");
string item1FileName
= string.Format("{0}{1}", ArchiveConstants.INVENTORY_PATH, archiveItemName);
tar.WriteFile(item1FileName, UserInventoryItemSerializer.Serialize(item1, new Dictionary<string, object>(), scene.UserAccountService));
tar.Close();
m_iarStreamBytes = archiveWriteStream.ToArray();
}
/// <summary>
/// Test saving an inventory path to a V0.1 OpenSim Inventory Archive
/// (subject to change since there is no fixed format yet).
/// </summary>
[Test]
public void TestSavePathToIarV0_1()
{
TestHelper.InMethod();
// log4net.Config.XmlConfigurator.Configure();
InventoryArchiverModule archiverModule = new InventoryArchiverModule();
Scene scene = SceneSetupHelpers.SetupScene("Inventory");
SceneSetupHelpers.SetupSceneModules(scene, archiverModule);
// Create user
string userFirstName = "Jock";
string userLastName = "Stirrup";
string userPassword = "troll";
UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000020");
UserProfileTestUtils.CreateUserWithInventory(scene, userFirstName, userLastName, userId, userPassword);
base.SetUp();
// Create asset
SceneObjectGroup object1;
SceneObjectPart part1;
{
string partName = "My Little Dog Object";
UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000040");
PrimitiveBaseShape shape = PrimitiveBaseShape.CreateSphere();
Vector3 groupPosition = new Vector3(10, 20, 30);
Quaternion rotationOffset = new Quaternion(20, 30, 40, 50);
Vector3 offsetPosition = new Vector3(5, 10, 15);
SerialiserModule serialiserModule = new SerialiserModule();
m_archiverModule = new InventoryArchiverModule();
part1
= new SceneObjectPart(
ownerId, shape, groupPosition, rotationOffset, offsetPosition);
part1.Name = partName;
object1 = new SceneObjectGroup(part1);
scene.AddNewSceneObject(object1, false);
}
UUID asset1Id = UUID.Parse("00000000-0000-0000-0000-000000000060");
AssetBase asset1 = AssetHelpers.CreateAsset(asset1Id, object1);
scene.AssetService.Store(asset1);
// Create item
UUID item1Id = UUID.Parse("00000000-0000-0000-0000-000000000080");
InventoryItemBase item1 = new InventoryItemBase();
item1.Name = "My Little Dog";
item1.AssetID = asset1.FullID;
item1.ID = item1Id;
InventoryFolderBase objsFolder
= InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, userId, "Objects")[0];
item1.Folder = objsFolder.ID;
scene.AddInventoryItem(item1);
MemoryStream archiveWriteStream = new MemoryStream();
archiverModule.OnInventoryArchiveSaved += SaveCompleted;
// Test saving a particular path
mre.Reset();
archiverModule.ArchiveInventory(
Guid.NewGuid(), userFirstName, userLastName, "Objects", userPassword, archiveWriteStream);
mre.WaitOne(60000, false);
byte[] archive = archiveWriteStream.ToArray();
MemoryStream archiveReadStream = new MemoryStream(archive);
TarArchiveReader tar = new TarArchiveReader(archiveReadStream);
//bool gotControlFile = false;
bool gotObject1File = false;
//bool gotObject2File = false;
string expectedObject1FileName = InventoryArchiveWriteRequest.CreateArchiveItemName(item1);
string expectedObject1FilePath = string.Format(
"{0}{1}{2}",
ArchiveConstants.INVENTORY_PATH,
InventoryArchiveWriteRequest.CreateArchiveFolderName(objsFolder),
expectedObject1FileName);
string filePath;
TarArchiveReader.TarEntryType tarEntryType;
// Console.WriteLine("Reading archive");
while (tar.ReadEntry(out filePath, out tarEntryType) != null)
{
// Console.WriteLine("Got {0}", filePath);
// if (ArchiveConstants.CONTROL_FILE_PATH == filePath)
// {
// gotControlFile = true;
// }
if (filePath.StartsWith(ArchiveConstants.INVENTORY_PATH) && filePath.EndsWith(".xml"))
{
// string fileName = filePath.Remove(0, "Objects/".Length);
//
// if (fileName.StartsWith(part1.Name))
// {
Assert.That(expectedObject1FilePath, Is.EqualTo(filePath));
gotObject1File = true;
// }
// else if (fileName.StartsWith(part2.Name))
// {
// Assert.That(fileName, Is.EqualTo(expectedObject2FileName));
// gotObject2File = true;
// }
}
}
// Assert.That(gotControlFile, Is.True, "No control file in archive");
Assert.That(gotObject1File, Is.True, "No item1 file in archive");
// Assert.That(gotObject2File, Is.True, "No object2 file in archive");
// TODO: Test presence of more files and contents of files.
m_scene = SceneSetupHelpers.SetupScene("Inventory");
SceneSetupHelpers.SetupSceneModules(m_scene, serialiserModule, m_archiverModule);
}
/// <summary>
@ -249,17 +76,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
TestHelper.InMethod();
// log4net.Config.XmlConfigurator.Configure();
InventoryArchiverModule archiverModule = new InventoryArchiverModule();
Scene scene = SceneSetupHelpers.SetupScene("Inventory");
SceneSetupHelpers.SetupSceneModules(scene, archiverModule);
// Create user
string userFirstName = "Jock";
string userLastName = "Stirrup";
string userPassword = "troll";
UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000020");
UserProfileTestUtils.CreateUserWithInventory(scene, userFirstName, userLastName, userId, userPassword);
UserProfileTestUtils.CreateUserWithInventory(m_scene, userFirstName, userLastName, userId, userPassword);
// Create asset
SceneObjectGroup object1;
@ -278,12 +100,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
part1.Name = partName;
object1 = new SceneObjectGroup(part1);
scene.AddNewSceneObject(object1, false);
m_scene.AddNewSceneObject(object1, false);
}
UUID asset1Id = UUID.Parse("00000000-0000-0000-0000-000000000060");
AssetBase asset1 = AssetHelpers.CreateAsset(asset1Id, object1);
scene.AssetService.Store(asset1);
m_scene.AssetService.Store(asset1);
// Create item
UUID item1Id = UUID.Parse("00000000-0000-0000-0000-000000000080");
@ -293,15 +115,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
item1.AssetID = asset1.FullID;
item1.ID = item1Id;
InventoryFolderBase objsFolder
= InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, userId, "Objects")[0];
= InventoryArchiveUtils.FindFolderByPath(m_scene.InventoryService, userId, "Objects")[0];
item1.Folder = objsFolder.ID;
scene.AddInventoryItem(item1);
m_scene.AddInventoryItem(item1);
MemoryStream archiveWriteStream = new MemoryStream();
archiverModule.OnInventoryArchiveSaved += SaveCompleted;
m_archiverModule.OnInventoryArchiveSaved += SaveCompleted;
mre.Reset();
archiverModule.ArchiveInventory(
m_archiverModule.ArchiveInventory(
Guid.NewGuid(), userFirstName, userLastName, "Objects/" + item1Name, userPassword, archiveWriteStream);
mre.WaitOne(60000, false);
@ -357,473 +179,99 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
}
/// <summary>
/// Test that things work when the load path specified starts with a slash
/// </summary>
/// Test case where a creator account exists for the creator UUID embedded in item metadata and serialized
/// objects.
/// </summary>
[Test]
public void TestLoadIarPathStartsWithSlash()
public void TestLoadIarCreatorAccountPresent()
{
TestHelper.InMethod();
// log4net.Config.XmlConfigurator.Configure();
SerialiserModule serialiserModule = new SerialiserModule();
InventoryArchiverModule archiverModule = new InventoryArchiverModule();
Scene scene = SceneSetupHelpers.SetupScene("inventory");
SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule);
UserProfileTestUtils.CreateUserWithInventory(scene, m_ua1, "password");
archiverModule.DearchiveInventory(m_ua1.FirstName, m_ua1.LastName, "/Objects", "password", m_iarStream);
UserProfileTestUtils.CreateUserWithInventory(m_scene, m_uaLL1, "meowfood");
m_archiverModule.DearchiveInventory(m_uaLL1.FirstName, m_uaLL1.LastName, "/", "meowfood", m_iarStream);
InventoryItemBase foundItem1
= InventoryArchiveUtils.FindItemByPath(
scene.InventoryService, m_ua1.PrincipalID, "/Objects/" + m_item1Name);
Assert.That(foundItem1, Is.Not.Null, "Didn't find loaded item 1 in TestLoadIarFolderStartsWithSlash()");
}
/// <summary>
/// Test loading a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet) where
/// an account exists with the creator name.
/// </summary>
///
/// This test also does some deeper probing of loading into nested inventory structures
[Test]
public void TestLoadIarV0_1ExistingUsers()
{
TestHelper.InMethod();
//log4net.Config.XmlConfigurator.Configure();
SerialiserModule serialiserModule = new SerialiserModule();
InventoryArchiverModule archiverModule = new InventoryArchiverModule();
// Annoyingly, we have to set up a scene even though inventory loading has nothing to do with a scene
Scene scene = SceneSetupHelpers.SetupScene("inventory");
SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule);
= InventoryArchiveUtils.FindItemByPath(m_scene.InventoryService, m_uaLL1.PrincipalID, m_item1Name);
UserProfileTestUtils.CreateUserWithInventory(scene, m_ua1, "meowfood");
UserProfileTestUtils.CreateUserWithInventory(scene, m_ua2, "hampshire");
archiverModule.DearchiveInventory(m_ua1.FirstName, m_ua1.LastName, "/", "meowfood", m_iarStream);
InventoryItemBase foundItem1
= InventoryArchiveUtils.FindItemByPath(scene.InventoryService, m_ua1.PrincipalID, m_item1Name);
Assert.That(foundItem1, Is.Not.Null, "Didn't find loaded item 1");
// We have to disable this check since loaded items that did find users via OSPA resolution are now only storing the
// UUID, not the OSPA itself.
// Assert.That(
// foundItem1.CreatorId, Is.EqualTo(item1.CreatorId),
// "Loaded item non-uuid creator doesn't match original");
Assert.That(
foundItem1.CreatorId, Is.EqualTo(m_ua2.PrincipalID.ToString()),
"Loaded item non-uuid creator doesn't match original");
foundItem1.CreatorId, Is.EqualTo(m_uaLL1.PrincipalID.ToString()),
"Loaded item non-uuid creator doesn't match original");
Assert.That(
foundItem1.CreatorIdAsUuid, Is.EqualTo(m_ua2.PrincipalID),
foundItem1.CreatorIdAsUuid, Is.EqualTo(m_uaLL1.PrincipalID),
"Loaded item uuid creator doesn't match original");
Assert.That(foundItem1.Owner, Is.EqualTo(m_ua1.PrincipalID),
Assert.That(foundItem1.Owner, Is.EqualTo(m_uaLL1.PrincipalID),
"Loaded item owner doesn't match inventory reciever");
// Now try loading to a root child folder
UserInventoryTestUtils.CreateInventoryFolder(scene.InventoryService, m_ua1.PrincipalID, "xA");
MemoryStream archiveReadStream = new MemoryStream(m_iarStream.ToArray());
archiverModule.DearchiveInventory(m_ua1.FirstName, m_ua1.LastName, "xA", "meowfood", archiveReadStream);
InventoryItemBase foundItem2
= InventoryArchiveUtils.FindItemByPath(scene.InventoryService, m_ua1.PrincipalID, "xA/" + m_item1Name);
Assert.That(foundItem2, Is.Not.Null, "Didn't find loaded item 2");
// Now try loading to a more deeply nested folder
UserInventoryTestUtils.CreateInventoryFolder(scene.InventoryService, m_ua1.PrincipalID, "xB/xC");
archiveReadStream = new MemoryStream(archiveReadStream.ToArray());
archiverModule.DearchiveInventory(m_ua1.FirstName, m_ua1.LastName, "xB/xC", "meowfood", archiveReadStream);
InventoryItemBase foundItem3
= InventoryArchiveUtils.FindItemByPath(scene.InventoryService, m_ua1.PrincipalID, "xB/xC/" + m_item1Name);
Assert.That(foundItem3, Is.Not.Null, "Didn't find loaded item 3");
AssetBase asset1 = m_scene.AssetService.Get(foundItem1.AssetID.ToString());
string xmlData = Utils.BytesToString(asset1.Data);
SceneObjectGroup sog1 = SceneObjectSerializer.FromOriginalXmlFormat(xmlData);
Assert.That(sog1.RootPart.CreatorID, Is.EqualTo(m_uaLL1.PrincipalID));
}
/// <summary>
/// Test loading a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet) where
/// an account exists with the same name as the creator, though not the same id.
/// </summary>
[Test]
public void TestIarV0_1WithEscapedChars()
public void TestLoadIarV0_1SameNameCreator()
{
TestHelper.InMethod();
// log4net.Config.XmlConfigurator.Configure();
string itemName = "You & you are a mean/man/";
string humanEscapedItemName = @"You & you are a mean\/man\/";
string userPassword = "meowfood";
InventoryArchiverModule archiverModule = new InventoryArchiverModule();
Scene scene = SceneSetupHelpers.SetupScene("Inventory");
SceneSetupHelpers.SetupSceneModules(scene, archiverModule);
// Create user
string userFirstName = "Jock";
string userLastName = "Stirrup";
UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000020");
UserProfileTestUtils.CreateUserWithInventory(scene, userFirstName, userLastName, userId, "meowfood");
UserProfileTestUtils.CreateUserWithInventory(m_scene, m_uaMT, "meowfood");
UserProfileTestUtils.CreateUserWithInventory(m_scene, m_uaLL2, "hampshire");
// Create asset
SceneObjectGroup object1;
SceneObjectPart part1;
{
string partName = "part name";
UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000040");
PrimitiveBaseShape shape = PrimitiveBaseShape.CreateSphere();
Vector3 groupPosition = new Vector3(10, 20, 30);
Quaternion rotationOffset = new Quaternion(20, 30, 40, 50);
Vector3 offsetPosition = new Vector3(5, 10, 15);
part1
= new SceneObjectPart(
ownerId, shape, groupPosition, rotationOffset, offsetPosition);
part1.Name = partName;
object1 = new SceneObjectGroup(part1);
scene.AddNewSceneObject(object1, false);
}
UUID asset1Id = UUID.Parse("00000000-0000-0000-0000-000000000060");
AssetBase asset1 = AssetHelpers.CreateAsset(asset1Id, object1);
scene.AssetService.Store(asset1);
// Create item
UUID item1Id = UUID.Parse("00000000-0000-0000-0000-000000000080");
InventoryItemBase item1 = new InventoryItemBase();
item1.Name = itemName;
item1.AssetID = asset1.FullID;
item1.ID = item1Id;
InventoryFolderBase objsFolder
= InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, userId, "Objects")[0];
item1.Folder = objsFolder.ID;
scene.AddInventoryItem(item1);
MemoryStream archiveWriteStream = new MemoryStream();
archiverModule.OnInventoryArchiveSaved += SaveCompleted;
mre.Reset();
archiverModule.ArchiveInventory(
Guid.NewGuid(), userFirstName, userLastName, "Objects", userPassword, archiveWriteStream);
mre.WaitOne(60000, false);
// LOAD ITEM
MemoryStream archiveReadStream = new MemoryStream(archiveWriteStream.ToArray());
archiverModule.DearchiveInventory(userFirstName, userLastName, "Scripts", userPassword, archiveReadStream);
m_archiverModule.DearchiveInventory(m_uaMT.FirstName, m_uaMT.LastName, "/", "meowfood", m_iarStream);
InventoryItemBase foundItem1
= InventoryArchiveUtils.FindItemByPath(
scene.InventoryService, userId, "Scripts/Objects/" + humanEscapedItemName);
Assert.That(foundItem1, Is.Not.Null, "Didn't find loaded item 1");
// Assert.That(
// foundItem1.CreatorId, Is.EqualTo(userUuid),
// "Loaded item non-uuid creator doesn't match that of the loading user");
= InventoryArchiveUtils.FindItemByPath(m_scene.InventoryService, m_uaMT.PrincipalID, m_item1Name);
Assert.That(
foundItem1.Name, Is.EqualTo(itemName),
"Loaded item name doesn't match saved name");
foundItem1.CreatorId, Is.EqualTo(m_uaLL2.PrincipalID.ToString()),
"Loaded item non-uuid creator doesn't match original");
Assert.That(
foundItem1.CreatorIdAsUuid, Is.EqualTo(m_uaLL2.PrincipalID),
"Loaded item uuid creator doesn't match original");
Assert.That(foundItem1.Owner, Is.EqualTo(m_uaMT.PrincipalID),
"Loaded item owner doesn't match inventory reciever");
AssetBase asset1 = m_scene.AssetService.Get(foundItem1.AssetID.ToString());
string xmlData = Utils.BytesToString(asset1.Data);
SceneObjectGroup sog1 = SceneObjectSerializer.FromOriginalXmlFormat(xmlData);
Assert.That(sog1.RootPart.CreatorID, Is.EqualTo(m_uaLL2.PrincipalID));
}
/// <summary>
/// Test loading a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet) where
/// embedded creators do not exist in the system
/// the creator or an account with the creator's name does not exist within the system.
/// </summary>
///
/// This may possibly one day get overtaken by the as yet incomplete temporary profiles feature
/// (as tested in the a later commented out test)
/// This test is currently disabled
[Test]
public void TestLoadIarV0_1AbsentUsers()
public void TestLoadIarV0_1AbsentCreator()
{
TestHelper.InMethod();
//log4net.Config.XmlConfigurator.Configure();
// log4net.Config.XmlConfigurator.Configure();
string userFirstName = "Charlie";
string userLastName = "Chan";
UUID userUuid = UUID.Parse("00000000-0000-0000-0000-000000000999");
string userItemCreatorFirstName = "Bat";
string userItemCreatorLastName = "Man";
//UUID userItemCreatorUuid = UUID.Parse("00000000-0000-0000-0000-000000008888");
string itemName = "b.lsl";
string archiveItemName = InventoryArchiveWriteRequest.CreateArchiveItemName(itemName, UUID.Random());
MemoryStream archiveWriteStream = new MemoryStream();
TarArchiveWriter tar = new TarArchiveWriter(archiveWriteStream);
InventoryItemBase item1 = new InventoryItemBase();
item1.Name = itemName;
item1.AssetID = UUID.Random();
item1.GroupID = UUID.Random();
item1.CreatorId = OspResolver.MakeOspa(userItemCreatorFirstName, userItemCreatorLastName);
//item1.CreatorId = userUuid.ToString();
//item1.CreatorId = "00000000-0000-0000-0000-000000000444";
item1.Owner = UUID.Zero;
string item1FileName
= string.Format("{0}{1}", ArchiveConstants.INVENTORY_PATH, archiveItemName);
tar.WriteFile(item1FileName, UserInventoryItemSerializer.Serialize(item1, new Dictionary<string,object>(), null));
tar.Close();
MemoryStream archiveReadStream = new MemoryStream(archiveWriteStream.ToArray());
SerialiserModule serialiserModule = new SerialiserModule();
InventoryArchiverModule archiverModule = new InventoryArchiverModule();
// Annoyingly, we have to set up a scene even though inventory loading has nothing to do with a scene
Scene scene = SceneSetupHelpers.SetupScene("inventory");
SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule);
UserProfileTestUtils.CreateUserWithInventory(scene, userFirstName, userLastName, userUuid, "meowfood");
archiverModule.DearchiveInventory(userFirstName, userLastName, "/", "meowfood", archiveReadStream);
UserProfileTestUtils.CreateUserWithInventory(m_scene, m_uaMT, "password");
m_archiverModule.DearchiveInventory(m_uaMT.FirstName, m_uaMT.LastName, "/", "password", m_iarStream);
InventoryItemBase foundItem1
= InventoryArchiveUtils.FindItemByPath(scene.InventoryService, userUuid, itemName);
= InventoryArchiveUtils.FindItemByPath(m_scene.InventoryService, m_uaMT.PrincipalID, m_item1Name);
Assert.That(foundItem1, Is.Not.Null, "Didn't find loaded item 1");
// Assert.That(
// foundItem1.CreatorId, Is.EqualTo(userUuid),
// "Loaded item non-uuid creator doesn't match that of the loading user");
Assert.That(
foundItem1.CreatorIdAsUuid, Is.EqualTo(userUuid),
foundItem1.CreatorId, Is.EqualTo(m_uaMT.PrincipalID.ToString()),
"Loaded item non-uuid creator doesn't match that of the loading user");
Assert.That(
foundItem1.CreatorIdAsUuid, Is.EqualTo(m_uaMT.PrincipalID),
"Loaded item uuid creator doesn't match that of the loading user");
}
/// <summary>
/// Test loading a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet) where
/// no account exists with the creator name
/// </summary>
/// Disabled since temporary profiles have not yet been implemented.
///
//[Test]
//public void TestLoadIarV0_1TempProfiles()
//{
// TestHelper.InMethod();
// //log4net.Config.XmlConfigurator.Configure();
AssetBase asset1 = m_scene.AssetService.Get(foundItem1.AssetID.ToString());
string xmlData = Utils.BytesToString(asset1.Data);
SceneObjectGroup sog1 = SceneObjectSerializer.FromOriginalXmlFormat(xmlData);
// string userFirstName = "Dennis";
// string userLastName = "Menace";
// UUID userUuid = UUID.Parse("00000000-0000-0000-0000-000000000aaa");
// string user2FirstName = "Walter";
// string user2LastName = "Mitty";
// string itemName = "b.lsl";
// string archiveItemName = InventoryArchiveWriteRequest.CreateArchiveItemName(itemName, UUID.Random());
// MemoryStream archiveWriteStream = new MemoryStream();
// TarArchiveWriter tar = new TarArchiveWriter(archiveWriteStream);
// InventoryItemBase item1 = new InventoryItemBase();
// item1.Name = itemName;
// item1.AssetID = UUID.Random();
// item1.GroupID = UUID.Random();
// item1.CreatorId = OspResolver.MakeOspa(user2FirstName, user2LastName);
// item1.Owner = UUID.Zero;
// string item1FileName
// = string.Format("{0}{1}", ArchiveConstants.INVENTORY_PATH, archiveItemName);
// tar.WriteFile(item1FileName, UserInventoryItemSerializer.Serialize(item1));
// tar.Close();
// MemoryStream archiveReadStream = new MemoryStream(archiveWriteStream.ToArray());
// SerialiserModule serialiserModule = new SerialiserModule();
// InventoryArchiverModule archiverModule = new InventoryArchiverModule();
// // Annoyingly, we have to set up a scene even though inventory loading has nothing to do with a scene
// Scene scene = SceneSetupHelpers.SetupScene();
// IUserAdminService userAdminService = scene.CommsManager.UserAdminService;
// SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule);
// userAdminService.AddUser(
// userFirstName, userLastName, "meowfood", String.Empty, 1000, 1000, userUuid);
// archiverModule.DearchiveInventory(userFirstName, userLastName, "/", "troll", archiveReadStream);
// // Check that a suitable temporary user profile has been created.
// UserProfileData user2Profile
// = scene.CommsManager.UserService.GetUserProfile(
// OspResolver.HashName(user2FirstName + " " + user2LastName));
// Assert.That(user2Profile, Is.Not.Null);
// Assert.That(user2Profile.FirstName == user2FirstName);
// Assert.That(user2Profile.SurName == user2LastName);
// CachedUserInfo userInfo
// = scene.CommsManager.UserProfileCacheService.GetUserDetails(userFirstName, userLastName);
// userInfo.OnInventoryReceived += InventoryReceived;
// lock (this)
// {
// userInfo.FetchInventory();
// Monitor.Wait(this, 60000);
// }
// InventoryItemBase foundItem = userInfo.RootFolder.FindItemByPath(itemName);
// Assert.That(foundItem.CreatorId, Is.EqualTo(item1.CreatorId));
// Assert.That(
// foundItem.CreatorIdAsUuid, Is.EqualTo(OspResolver.HashName(user2FirstName + " " + user2LastName)));
// Assert.That(foundItem.Owner, Is.EqualTo(userUuid));
// Console.WriteLine("### Successfully completed {0} ###", MethodBase.GetCurrentMethod());
//}
/// <summary>
/// Test replication of an archive path to the user's inventory.
/// </summary>
[Test]
public void TestNewIarPath()
{
TestHelper.InMethod();
// log4net.Config.XmlConfigurator.Configure();
Scene scene = SceneSetupHelpers.SetupScene("inventory");
UserAccount ua1 = UserProfileTestUtils.CreateUserWithInventory(scene);
Dictionary <string, InventoryFolderBase> foldersCreated = new Dictionary<string, InventoryFolderBase>();
HashSet<InventoryNodeBase> nodesLoaded = new HashSet<InventoryNodeBase>();
string folder1Name = "1";
string folder2aName = "2a";
string folder2bName = "2b";
string folder1ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder1Name, UUID.Random());
string folder2aArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder2aName, UUID.Random());
string folder2bArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder2bName, UUID.Random());
string iarPath1 = string.Join("", new string[] { folder1ArchiveName, folder2aArchiveName });
string iarPath2 = string.Join("", new string[] { folder1ArchiveName, folder2bArchiveName });
{
// Test replication of path1
new InventoryArchiveReadRequest(scene, ua1, null, (Stream)null, false)
.ReplicateArchivePathToUserInventory(
iarPath1, scene.InventoryService.GetRootFolder(ua1.PrincipalID),
foldersCreated, nodesLoaded);
List<InventoryFolderBase> folder1Candidates
= InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, ua1.PrincipalID, folder1Name);
Assert.That(folder1Candidates.Count, Is.EqualTo(1));
InventoryFolderBase folder1 = folder1Candidates[0];
List<InventoryFolderBase> folder2aCandidates
= InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1, folder2aName);
Assert.That(folder2aCandidates.Count, Is.EqualTo(1));
}
{
// Test replication of path2
new InventoryArchiveReadRequest(scene, ua1, null, (Stream)null, false)
.ReplicateArchivePathToUserInventory(
iarPath2, scene.InventoryService.GetRootFolder(ua1.PrincipalID),
foldersCreated, nodesLoaded);
List<InventoryFolderBase> folder1Candidates
= InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, ua1.PrincipalID, folder1Name);
Assert.That(folder1Candidates.Count, Is.EqualTo(1));
InventoryFolderBase folder1 = folder1Candidates[0];
List<InventoryFolderBase> folder2aCandidates
= InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1, folder2aName);
Assert.That(folder2aCandidates.Count, Is.EqualTo(1));
List<InventoryFolderBase> folder2bCandidates
= InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1, folder2bName);
Assert.That(folder2bCandidates.Count, Is.EqualTo(1));
}
}
/// <summary>
/// Test replication of a partly existing archive path to the user's inventory. This should create
/// a duplicate path without the merge option.
/// </summary>
[Test]
public void TestPartExistingIarPath()
{
TestHelper.InMethod();
//log4net.Config.XmlConfigurator.Configure();
Scene scene = SceneSetupHelpers.SetupScene("inventory");
UserAccount ua1 = UserProfileTestUtils.CreateUserWithInventory(scene);
string folder1ExistingName = "a";
string folder2Name = "b";
InventoryFolderBase folder1
= UserInventoryTestUtils.CreateInventoryFolder(
scene.InventoryService, ua1.PrincipalID, folder1ExistingName);
string folder1ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder1ExistingName, UUID.Random());
string folder2ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder2Name, UUID.Random());
string itemArchivePath = string.Join("", new string[] { folder1ArchiveName, folder2ArchiveName });
new InventoryArchiveReadRequest(scene, ua1, null, (Stream)null, false)
.ReplicateArchivePathToUserInventory(
itemArchivePath, scene.InventoryService.GetRootFolder(ua1.PrincipalID),
new Dictionary<string, InventoryFolderBase>(), new HashSet<InventoryNodeBase>());
List<InventoryFolderBase> folder1PostCandidates
= InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, ua1.PrincipalID, folder1ExistingName);
Assert.That(folder1PostCandidates.Count, Is.EqualTo(2));
// FIXME: Temporarily, we're going to do something messy to make sure we pick up the created folder.
InventoryFolderBase folder1Post = null;
foreach (InventoryFolderBase folder in folder1PostCandidates)
{
if (folder.ID != folder1.ID)
{
folder1Post = folder;
break;
}
}
// Assert.That(folder1Post.ID, Is.EqualTo(folder1.ID));
List<InventoryFolderBase> folder2PostCandidates
= InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1Post, "b");
Assert.That(folder2PostCandidates.Count, Is.EqualTo(1));
}
/// <summary>
/// Test replication of a partly existing archive path to the user's inventory. This should create
/// a merged path.
/// </summary>
[Test]
public void TestMergeIarPath()
{
TestHelper.InMethod();
// log4net.Config.XmlConfigurator.Configure();
Scene scene = SceneSetupHelpers.SetupScene("inventory");
UserAccount ua1 = UserProfileTestUtils.CreateUserWithInventory(scene);
string folder1ExistingName = "a";
string folder2Name = "b";
InventoryFolderBase folder1
= UserInventoryTestUtils.CreateInventoryFolder(
scene.InventoryService, ua1.PrincipalID, folder1ExistingName);
string folder1ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder1ExistingName, UUID.Random());
string folder2ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder2Name, UUID.Random());
string itemArchivePath = string.Join("", new string[] { folder1ArchiveName, folder2ArchiveName });
new InventoryArchiveReadRequest(scene, ua1, folder1ExistingName, (Stream)null, true)
.ReplicateArchivePathToUserInventory(
itemArchivePath, scene.InventoryService.GetRootFolder(ua1.PrincipalID),
new Dictionary<string, InventoryFolderBase>(), new HashSet<InventoryNodeBase>());
List<InventoryFolderBase> folder1PostCandidates
= InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, ua1.PrincipalID, folder1ExistingName);
Assert.That(folder1PostCandidates.Count, Is.EqualTo(1));
Assert.That(folder1PostCandidates[0].ID, Is.EqualTo(folder1.ID));
List<InventoryFolderBase> folder2PostCandidates
= InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1PostCandidates[0], "b");
Assert.That(folder2PostCandidates.Count, Is.EqualTo(1));
Assert.That(sog1.RootPart.CreatorID, Is.EqualTo(m_uaMT.PrincipalID));
}
}
}

View File

@ -0,0 +1,478 @@
/*
* 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.
*/
using System;
using System.Collections.Generic;
using System.IO;
using System.Reflection;
using System.Threading;
using NUnit.Framework;
using OpenMetaverse;
using OpenSim.Data;
using OpenSim.Framework;
using OpenSim.Framework.Serialization;
using OpenSim.Framework.Serialization.External;
using OpenSim.Framework.Communications;
using OpenSim.Region.CoreModules.Avatar.Inventory.Archiver;
using OpenSim.Region.CoreModules.World.Serialiser;
using OpenSim.Region.Framework.Scenes;
using OpenSim.Region.Framework.Scenes.Serialization;
using OpenSim.Services.Interfaces;
using OpenSim.Tests.Common;
using OpenSim.Tests.Common.Mock;
using OpenSim.Tests.Common.Setup;
namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
{
[TestFixture]
public class PathTests : InventoryArchiveTestCase
{
/// <summary>
/// Test saving an inventory path to a V0.1 OpenSim Inventory Archive
/// (subject to change since there is no fixed format yet).
/// </summary>
[Test]
public void TestSavePathToIarV0_1()
{
TestHelper.InMethod();
// log4net.Config.XmlConfigurator.Configure();
InventoryArchiverModule archiverModule = new InventoryArchiverModule();
Scene scene = SceneSetupHelpers.SetupScene("Inventory");
SceneSetupHelpers.SetupSceneModules(scene, archiverModule);
// Create user
string userFirstName = "Jock";
string userLastName = "Stirrup";
string userPassword = "troll";
UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000020");
UserProfileTestUtils.CreateUserWithInventory(scene, userFirstName, userLastName, userId, userPassword);
// Create asset
SceneObjectGroup object1;
SceneObjectPart part1;
{
string partName = "My Little Dog Object";
UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000040");
PrimitiveBaseShape shape = PrimitiveBaseShape.CreateSphere();
Vector3 groupPosition = new Vector3(10, 20, 30);
Quaternion rotationOffset = new Quaternion(20, 30, 40, 50);
Vector3 offsetPosition = new Vector3(5, 10, 15);
part1 = new SceneObjectPart(ownerId, shape, groupPosition, rotationOffset, offsetPosition);
part1.Name = partName;
object1 = new SceneObjectGroup(part1);
scene.AddNewSceneObject(object1, false);
}
UUID asset1Id = UUID.Parse("00000000-0000-0000-0000-000000000060");
AssetBase asset1 = AssetHelpers.CreateAsset(asset1Id, object1);
scene.AssetService.Store(asset1);
// Create item
UUID item1Id = UUID.Parse("00000000-0000-0000-0000-000000000080");
InventoryItemBase item1 = new InventoryItemBase();
item1.Name = "My Little Dog";
item1.AssetID = asset1.FullID;
item1.ID = item1Id;
InventoryFolderBase objsFolder
= InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, userId, "Objects")[0];
item1.Folder = objsFolder.ID;
scene.AddInventoryItem(item1);
MemoryStream archiveWriteStream = new MemoryStream();
archiverModule.OnInventoryArchiveSaved += SaveCompleted;
// Test saving a particular path
mre.Reset();
archiverModule.ArchiveInventory(
Guid.NewGuid(), userFirstName, userLastName, "Objects", userPassword, archiveWriteStream);
mre.WaitOne(60000, false);
byte[] archive = archiveWriteStream.ToArray();
MemoryStream archiveReadStream = new MemoryStream(archive);
TarArchiveReader tar = new TarArchiveReader(archiveReadStream);
//bool gotControlFile = false;
bool gotObject1File = false;
//bool gotObject2File = false;
string expectedObject1FileName = InventoryArchiveWriteRequest.CreateArchiveItemName(item1);
string expectedObject1FilePath = string.Format(
"{0}{1}{2}",
ArchiveConstants.INVENTORY_PATH,
InventoryArchiveWriteRequest.CreateArchiveFolderName(objsFolder),
expectedObject1FileName);
string filePath;
TarArchiveReader.TarEntryType tarEntryType;
// Console.WriteLine("Reading archive");
while (tar.ReadEntry(out filePath, out tarEntryType) != null)
{
// Console.WriteLine("Got {0}", filePath);
// if (ArchiveConstants.CONTROL_FILE_PATH == filePath)
// {
// gotControlFile = true;
// }
if (filePath.StartsWith(ArchiveConstants.INVENTORY_PATH) && filePath.EndsWith(".xml"))
{
// string fileName = filePath.Remove(0, "Objects/".Length);
//
// if (fileName.StartsWith(part1.Name))
// {
Assert.That(expectedObject1FilePath, Is.EqualTo(filePath));
gotObject1File = true;
// }
// else if (fileName.StartsWith(part2.Name))
// {
// Assert.That(fileName, Is.EqualTo(expectedObject2FileName));
// gotObject2File = true;
// }
}
}
// Assert.That(gotControlFile, Is.True, "No control file in archive");
Assert.That(gotObject1File, Is.True, "No item1 file in archive");
// Assert.That(gotObject2File, Is.True, "No object2 file in archive");
// TODO: Test presence of more files and contents of files.
}
/// <summary>
/// Test loading an IAR to various different inventory paths.
/// </summary>
[Test]
public void TestLoadIarToInventoryPaths()
{
TestHelper.InMethod();
// log4net.Config.XmlConfigurator.Configure();
SerialiserModule serialiserModule = new SerialiserModule();
InventoryArchiverModule archiverModule = new InventoryArchiverModule();
// Annoyingly, we have to set up a scene even though inventory loading has nothing to do with a scene
Scene scene = SceneSetupHelpers.SetupScene("inventory");
SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule);
UserProfileTestUtils.CreateUserWithInventory(scene, m_uaMT, "meowfood");
UserProfileTestUtils.CreateUserWithInventory(scene, m_uaLL1, "hampshire");
archiverModule.DearchiveInventory(m_uaMT.FirstName, m_uaMT.LastName, "/", "meowfood", m_iarStream);
InventoryItemBase foundItem1
= InventoryArchiveUtils.FindItemByPath(scene.InventoryService, m_uaMT.PrincipalID, m_item1Name);
Assert.That(foundItem1, Is.Not.Null, "Didn't find loaded item 1");
// Now try loading to a root child folder
UserInventoryTestUtils.CreateInventoryFolder(scene.InventoryService, m_uaMT.PrincipalID, "xA");
MemoryStream archiveReadStream = new MemoryStream(m_iarStream.ToArray());
archiverModule.DearchiveInventory(m_uaMT.FirstName, m_uaMT.LastName, "xA", "meowfood", archiveReadStream);
InventoryItemBase foundItem2
= InventoryArchiveUtils.FindItemByPath(scene.InventoryService, m_uaMT.PrincipalID, "xA/" + m_item1Name);
Assert.That(foundItem2, Is.Not.Null, "Didn't find loaded item 2");
// Now try loading to a more deeply nested folder
UserInventoryTestUtils.CreateInventoryFolder(scene.InventoryService, m_uaMT.PrincipalID, "xB/xC");
archiveReadStream = new MemoryStream(archiveReadStream.ToArray());
archiverModule.DearchiveInventory(m_uaMT.FirstName, m_uaMT.LastName, "xB/xC", "meowfood", archiveReadStream);
InventoryItemBase foundItem3
= InventoryArchiveUtils.FindItemByPath(scene.InventoryService, m_uaMT.PrincipalID, "xB/xC/" + m_item1Name);
Assert.That(foundItem3, Is.Not.Null, "Didn't find loaded item 3");
}
/// <summary>
/// Test that things work when the load path specified starts with a slash
/// </summary>
[Test]
public void TestLoadIarPathStartsWithSlash()
{
TestHelper.InMethod();
// log4net.Config.XmlConfigurator.Configure();
SerialiserModule serialiserModule = new SerialiserModule();
InventoryArchiverModule archiverModule = new InventoryArchiverModule();
Scene scene = SceneSetupHelpers.SetupScene("inventory");
SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule);
UserProfileTestUtils.CreateUserWithInventory(scene, m_uaMT, "password");
archiverModule.DearchiveInventory(m_uaMT.FirstName, m_uaMT.LastName, "/Objects", "password", m_iarStream);
InventoryItemBase foundItem1
= InventoryArchiveUtils.FindItemByPath(
scene.InventoryService, m_uaMT.PrincipalID, "/Objects/" + m_item1Name);
Assert.That(foundItem1, Is.Not.Null, "Didn't find loaded item 1 in TestLoadIarFolderStartsWithSlash()");
}
[Test]
public void TestLoadIarPathWithEscapedChars()
{
TestHelper.InMethod();
// log4net.Config.XmlConfigurator.Configure();
string itemName = "You & you are a mean/man/";
string humanEscapedItemName = @"You & you are a mean\/man\/";
string userPassword = "meowfood";
InventoryArchiverModule archiverModule = new InventoryArchiverModule();
Scene scene = SceneSetupHelpers.SetupScene("Inventory");
SceneSetupHelpers.SetupSceneModules(scene, archiverModule);
// Create user
string userFirstName = "Jock";
string userLastName = "Stirrup";
UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000020");
UserProfileTestUtils.CreateUserWithInventory(scene, userFirstName, userLastName, userId, "meowfood");
// Create asset
SceneObjectGroup object1;
SceneObjectPart part1;
{
string partName = "part name";
UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000040");
PrimitiveBaseShape shape = PrimitiveBaseShape.CreateSphere();
Vector3 groupPosition = new Vector3(10, 20, 30);
Quaternion rotationOffset = new Quaternion(20, 30, 40, 50);
Vector3 offsetPosition = new Vector3(5, 10, 15);
part1
= new SceneObjectPart(
ownerId, shape, groupPosition, rotationOffset, offsetPosition);
part1.Name = partName;
object1 = new SceneObjectGroup(part1);
scene.AddNewSceneObject(object1, false);
}
UUID asset1Id = UUID.Parse("00000000-0000-0000-0000-000000000060");
AssetBase asset1 = AssetHelpers.CreateAsset(asset1Id, object1);
scene.AssetService.Store(asset1);
// Create item
UUID item1Id = UUID.Parse("00000000-0000-0000-0000-000000000080");
InventoryItemBase item1 = new InventoryItemBase();
item1.Name = itemName;
item1.AssetID = asset1.FullID;
item1.ID = item1Id;
InventoryFolderBase objsFolder
= InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, userId, "Objects")[0];
item1.Folder = objsFolder.ID;
scene.AddInventoryItem(item1);
MemoryStream archiveWriteStream = new MemoryStream();
archiverModule.OnInventoryArchiveSaved += SaveCompleted;
mre.Reset();
archiverModule.ArchiveInventory(
Guid.NewGuid(), userFirstName, userLastName, "Objects", userPassword, archiveWriteStream);
mre.WaitOne(60000, false);
// LOAD ITEM
MemoryStream archiveReadStream = new MemoryStream(archiveWriteStream.ToArray());
archiverModule.DearchiveInventory(userFirstName, userLastName, "Scripts", userPassword, archiveReadStream);
InventoryItemBase foundItem1
= InventoryArchiveUtils.FindItemByPath(
scene.InventoryService, userId, "Scripts/Objects/" + humanEscapedItemName);
Assert.That(foundItem1, Is.Not.Null, "Didn't find loaded item 1");
// Assert.That(
// foundItem1.CreatorId, Is.EqualTo(userUuid),
// "Loaded item non-uuid creator doesn't match that of the loading user");
Assert.That(
foundItem1.Name, Is.EqualTo(itemName),
"Loaded item name doesn't match saved name");
}
/// <summary>
/// Test replication of an archive path to the user's inventory.
/// </summary>
[Test]
public void TestNewIarPath()
{
TestHelper.InMethod();
// log4net.Config.XmlConfigurator.Configure();
Scene scene = SceneSetupHelpers.SetupScene("inventory");
UserAccount ua1 = UserProfileTestUtils.CreateUserWithInventory(scene);
Dictionary <string, InventoryFolderBase> foldersCreated = new Dictionary<string, InventoryFolderBase>();
HashSet<InventoryNodeBase> nodesLoaded = new HashSet<InventoryNodeBase>();
string folder1Name = "1";
string folder2aName = "2a";
string folder2bName = "2b";
string folder1ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder1Name, UUID.Random());
string folder2aArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder2aName, UUID.Random());
string folder2bArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder2bName, UUID.Random());
string iarPath1 = string.Join("", new string[] { folder1ArchiveName, folder2aArchiveName });
string iarPath2 = string.Join("", new string[] { folder1ArchiveName, folder2bArchiveName });
{
// Test replication of path1
new InventoryArchiveReadRequest(scene, ua1, null, (Stream)null, false)
.ReplicateArchivePathToUserInventory(
iarPath1, scene.InventoryService.GetRootFolder(ua1.PrincipalID),
foldersCreated, nodesLoaded);
List<InventoryFolderBase> folder1Candidates
= InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, ua1.PrincipalID, folder1Name);
Assert.That(folder1Candidates.Count, Is.EqualTo(1));
InventoryFolderBase folder1 = folder1Candidates[0];
List<InventoryFolderBase> folder2aCandidates
= InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1, folder2aName);
Assert.That(folder2aCandidates.Count, Is.EqualTo(1));
}
{
// Test replication of path2
new InventoryArchiveReadRequest(scene, ua1, null, (Stream)null, false)
.ReplicateArchivePathToUserInventory(
iarPath2, scene.InventoryService.GetRootFolder(ua1.PrincipalID),
foldersCreated, nodesLoaded);
List<InventoryFolderBase> folder1Candidates
= InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, ua1.PrincipalID, folder1Name);
Assert.That(folder1Candidates.Count, Is.EqualTo(1));
InventoryFolderBase folder1 = folder1Candidates[0];
List<InventoryFolderBase> folder2aCandidates
= InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1, folder2aName);
Assert.That(folder2aCandidates.Count, Is.EqualTo(1));
List<InventoryFolderBase> folder2bCandidates
= InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1, folder2bName);
Assert.That(folder2bCandidates.Count, Is.EqualTo(1));
}
}
/// <summary>
/// Test replication of a partly existing archive path to the user's inventory. This should create
/// a duplicate path without the merge option.
/// </summary>
[Test]
public void TestPartExistingIarPath()
{
TestHelper.InMethod();
//log4net.Config.XmlConfigurator.Configure();
Scene scene = SceneSetupHelpers.SetupScene("inventory");
UserAccount ua1 = UserProfileTestUtils.CreateUserWithInventory(scene);
string folder1ExistingName = "a";
string folder2Name = "b";
InventoryFolderBase folder1
= UserInventoryTestUtils.CreateInventoryFolder(
scene.InventoryService, ua1.PrincipalID, folder1ExistingName);
string folder1ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder1ExistingName, UUID.Random());
string folder2ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder2Name, UUID.Random());
string itemArchivePath = string.Join("", new string[] { folder1ArchiveName, folder2ArchiveName });
new InventoryArchiveReadRequest(scene, ua1, null, (Stream)null, false)
.ReplicateArchivePathToUserInventory(
itemArchivePath, scene.InventoryService.GetRootFolder(ua1.PrincipalID),
new Dictionary<string, InventoryFolderBase>(), new HashSet<InventoryNodeBase>());
List<InventoryFolderBase> folder1PostCandidates
= InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, ua1.PrincipalID, folder1ExistingName);
Assert.That(folder1PostCandidates.Count, Is.EqualTo(2));
// FIXME: Temporarily, we're going to do something messy to make sure we pick up the created folder.
InventoryFolderBase folder1Post = null;
foreach (InventoryFolderBase folder in folder1PostCandidates)
{
if (folder.ID != folder1.ID)
{
folder1Post = folder;
break;
}
}
// Assert.That(folder1Post.ID, Is.EqualTo(folder1.ID));
List<InventoryFolderBase> folder2PostCandidates
= InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1Post, "b");
Assert.That(folder2PostCandidates.Count, Is.EqualTo(1));
}
/// <summary>
/// Test replication of a partly existing archive path to the user's inventory. This should create
/// a merged path.
/// </summary>
[Test]
public void TestMergeIarPath()
{
TestHelper.InMethod();
// log4net.Config.XmlConfigurator.Configure();
Scene scene = SceneSetupHelpers.SetupScene("inventory");
UserAccount ua1 = UserProfileTestUtils.CreateUserWithInventory(scene);
string folder1ExistingName = "a";
string folder2Name = "b";
InventoryFolderBase folder1
= UserInventoryTestUtils.CreateInventoryFolder(
scene.InventoryService, ua1.PrincipalID, folder1ExistingName);
string folder1ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder1ExistingName, UUID.Random());
string folder2ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder2Name, UUID.Random());
string itemArchivePath = string.Join("", new string[] { folder1ArchiveName, folder2ArchiveName });
new InventoryArchiveReadRequest(scene, ua1, folder1ExistingName, (Stream)null, true)
.ReplicateArchivePathToUserInventory(
itemArchivePath, scene.InventoryService.GetRootFolder(ua1.PrincipalID),
new Dictionary<string, InventoryFolderBase>(), new HashSet<InventoryNodeBase>());
List<InventoryFolderBase> folder1PostCandidates
= InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, ua1.PrincipalID, folder1ExistingName);
Assert.That(folder1PostCandidates.Count, Is.EqualTo(1));
Assert.That(folder1PostCandidates[0].ID, Is.EqualTo(folder1.ID));
List<InventoryFolderBase> folder2PostCandidates
= InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1PostCandidates[0], "b");
Assert.That(folder2PostCandidates.Count, Is.EqualTo(1));
}
}
}

View File

@ -399,6 +399,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
if (!UpdateAgent(reg, finalDestination, agent))
{
// Region doesn't take it
m_log.WarnFormat(
"[ENTITY TRANSFER MODULE]: UpdateAgent failed on teleport of {0} to {1}. Returning avatar to source region.",
sp.Name, finalDestination.RegionName);
Fail(sp, finalDestination);
return;
}
@ -425,16 +429,18 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
// that the client contacted the destination before we send the attachments and close things here.
if (!WaitForCallback(sp.UUID))
{
Fail(sp, finalDestination);
m_log.WarnFormat(
"[ENTITY TRANSFER MODULE]: Teleport of {0} to {1} failed due to no callback from destination region. Returning avatar to source region.",
sp.Name, finalDestination.RegionName);
Fail(sp, finalDestination);
return;
}
// CrossAttachmentsIntoNewRegion is a synchronous call. We shouldn't need to wait after it
CrossAttachmentsIntoNewRegion(finalDestination, sp, true);
// Well, this is it. The agent is over there.
KillEntity(sp.Scene, sp.LocalId);
// May need to logout or other cleanup

View File

@ -75,7 +75,7 @@ namespace OpenSim.Region.CoreModules.World.LightShare
m_scene = scene;
m_scene.RegisterModuleInterface<IRegionModule>(this);
m_scene.EventManager.OnPluginConsole += EventManager_OnPluginConsole;
// ini file settings
try
{
@ -148,7 +148,7 @@ namespace OpenSim.Region.CoreModules.World.LightShare
public void SendProfileToClient(ScenePresence presence)
{
IClientAPI client = presence.ControllingClient;
if (m_enableWindlight)
if (m_enableWindlight && m_scene.RegionInfo.WindlightSettings.valid)
{
if (presence.IsChildAgent == false)
{
@ -165,7 +165,7 @@ namespace OpenSim.Region.CoreModules.World.LightShare
public void SendProfileToClient(ScenePresence presence, RegionLightShareData wl)
{
IClientAPI client = presence.ControllingClient;
if (m_enableWindlight)
if (m_enableWindlight && m_scene.RegionInfo.WindlightSettings.valid)
{
if (presence.IsChildAgent == false)
{
@ -229,7 +229,7 @@ namespace OpenSim.Region.CoreModules.World.LightShare
{
Command wlload = new Command("load", CommandIntentions.COMMAND_NON_HAZARDOUS, HandleLoad, "Load windlight profile from the database and broadcast");
Command wlenable = new Command("enable", CommandIntentions.COMMAND_NON_HAZARDOUS, HandleEnable, "Enable the windlight plugin");
Command wldisable = new Command("disable", CommandIntentions.COMMAND_NON_HAZARDOUS, HandleDisable, "Enable the windlight plugin");
Command wldisable = new Command("disable", CommandIntentions.COMMAND_NON_HAZARDOUS, HandleDisable, "Disable the windlight plugin");
m_commander.RegisterCommand("load", wlload);
m_commander.RegisterCommand("enable", wlenable);

View File

@ -978,6 +978,11 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
public void SendDetailedEstateData(UUID invoice, string estateName, uint estateID, uint parentEstate, uint estateFlags, uint sunPosition, UUID covenant, string abuseEmail, UUID estateOwner)
{
}
public void SendLandProperties(int sequence_id, bool snap_selection, int request_result, ILandObject lo, float simObjectBonusFactor, int parcelObjectCapacity, int simObjectCapacity, uint regionFlags)
{
}
public void SendLandProperties(int sequence_id, bool snap_selection, int request_result, LandData landData, float simObjectBonusFactor, int parcelObjectCapacity, int simObjectCapacity, uint regionFlags)

View File

@ -32,7 +32,6 @@ using System.Reflection;
using System.Threading;
using log4net.Config;
using NUnit.Framework;
using NUnit.Framework.SyntaxHelpers;
using OpenMetaverse;
using OpenSim.Framework;
using Nini.Config;

View File

@ -32,7 +32,6 @@ using System.Reflection;
using System.Threading;
using log4net.Config;
using NUnit.Framework;
using NUnit.Framework.SyntaxHelpers;
using OpenMetaverse;
using OpenSim.Framework;
using Nini.Config;

View File

@ -32,7 +32,6 @@ using System.Reflection;
using System.Threading;
using log4net.Config;
using NUnit.Framework;
using NUnit.Framework.SyntaxHelpers;
using OpenMetaverse;
using OpenMetaverse.Assets;
using OpenSim.Framework;

View File

@ -72,6 +72,7 @@ namespace OpenSim.Region.CoreModules.World.Land
protected Commander m_commander = new Commander("land");
protected IUserManagement m_userManager;
protected IPrimCountModule m_primCountModule;
// Minimum for parcels to work is 64m even if we don't actually use them.
#pragma warning disable 0429
@ -147,6 +148,7 @@ namespace OpenSim.Region.CoreModules.World.Land
public void RegionLoaded(Scene scene)
{
m_userManager = m_scene.RequestModuleInterface<IUserManagement>();
m_primCountModule = m_scene.RequestModuleInterface<IPrimCountModule>();
}
public void RemoveRegion(Scene scene)
@ -306,10 +308,14 @@ namespace OpenSim.Region.CoreModules.World.Land
/// <returns>The parcel created.</returns>
protected ILandObject CreateDefaultParcel()
{
ILandObject fullSimParcel = new LandObject(UUID.Zero, false, m_scene);
// m_log.DebugFormat(
// "[LAND MANAGEMENT MODULE]: Creating default parcel for region {0}", m_scene.RegionInfo.RegionName);
ILandObject fullSimParcel = new LandObject(UUID.Zero, false, m_scene);
fullSimParcel.SetLandBitmap(fullSimParcel.GetSquareLandBitmap(0, 0, (int)Constants.RegionSize, (int)Constants.RegionSize));
fullSimParcel.LandData.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner;
fullSimParcel.LandData.ClaimDate = Util.UnixTimeSinceEpoch();
return AddLandObject(fullSimParcel);
}
@ -579,7 +585,7 @@ namespace OpenSim.Region.CoreModules.World.Land
}
else
{
m_log.WarnFormat("[LAND]: Invalid local land ID {0}", landLocalID);
m_log.WarnFormat("[LAND MANAGEMENT MODULE]: Invalid local land ID {0}", landLocalID);
}
}
@ -590,6 +596,11 @@ namespace OpenSim.Region.CoreModules.World.Land
public ILandObject AddLandObject(ILandObject land)
{
ILandObject new_land = land.Copy();
// Only now can we add the prim counts to the land object - we rely on the global ID which is generated
// as a random UUID inside LandData initialization
if (m_primCountModule != null)
new_land.PrimCounts = m_primCountModule.GetPrimCounts(new_land.LandData.GlobalID);
lock (m_landList)
{
@ -630,7 +641,7 @@ namespace OpenSim.Region.CoreModules.World.Land
{
if (m_landIDList[x, y] == local_id)
{
m_log.WarnFormat("[LAND]: Not removing land object {0}; still being used at {1}, {2}",
m_log.WarnFormat("[LAND MANAGEMENT MODULE]: Not removing land object {0}; still being used at {1}, {2}",
local_id, x, y);
return;
//throw new Exception("Could not remove land object. Still being used at " + x + ", " + y);
@ -794,7 +805,7 @@ namespace OpenSim.Region.CoreModules.World.Land
ILandObject landUnderPrim = GetLandObject(position.X, position.Y);
if (landUnderPrim != null)
{
landUnderPrim.AddPrimToCount(obj);
((LandObject)landUnderPrim).AddPrimToCount(obj);
}
}
@ -851,6 +862,10 @@ namespace OpenSim.Region.CoreModules.World.Land
public void EventManagerOnParcelPrimCountUpdate()
{
// m_log.DebugFormat(
// "[LAND MANAGEMENT MODULE]: Triggered EventManagerOnParcelPrimCountUpdate() for {0}",
// m_scene.RegionInfo.RegionName);
ResetAllLandPrimCounts();
EntityBase[] entities = m_scene.Entities.GetEntities();
foreach (EntityBase obj in entities)
@ -1198,7 +1213,7 @@ namespace OpenSim.Region.CoreModules.World.Land
}
else
{
m_log.WarnFormat("[PARCEL]: Invalid land object {0} passed for parcel object owner request", local_id);
m_log.WarnFormat("[LAND MANAGEMENT MODULE]: Invalid land object {0} passed for parcel object owner request", local_id);
}
}
@ -1361,7 +1376,7 @@ namespace OpenSim.Region.CoreModules.World.Land
{
ILandObject new_land = new LandObject(data.OwnerID, data.IsGroupOwned, m_scene);
new_land.LandData = data.Copy();
new_land.SetLandBitmapFromByteArray();
new_land.SetLandBitmapFromByteArray();
AddLandObject(new_land);
}
@ -1426,7 +1441,7 @@ namespace OpenSim.Region.CoreModules.World.Land
{
IClientAPI client;
if (! m_scene.TryGetClient(agentID, out client)) {
m_log.WarnFormat("[LAND] unable to retrieve IClientAPI for {0}", agentID.ToString());
m_log.WarnFormat("[LAND MANAGEMENT MODULE]: Unable to retrieve IClientAPI for {0}", agentID);
return LLSDHelpers.SerialiseLLSDReply(new LLSDEmpty());
}
@ -1475,7 +1490,7 @@ namespace OpenSim.Region.CoreModules.World.Land
}
else
{
m_log.WarnFormat("[LAND] unable to find parcelID {0}", parcelID);
m_log.WarnFormat("[LAND MANAGEMENT MODULE]: Unable to find parcelID {0}", parcelID);
}
return LLSDHelpers.SerialiseLLSDReply(new LLSDEmpty());
}
@ -1533,17 +1548,17 @@ namespace OpenSim.Region.CoreModules.World.Land
}
catch (LLSD.LLSDParseException e)
{
m_log.ErrorFormat("[LAND] Fetch error: {0}", e.Message);
m_log.ErrorFormat("[LAND] ... in request {0}", request);
m_log.ErrorFormat("[LAND MANAGEMENT MODULE]: Fetch error: {0}", e.Message);
m_log.ErrorFormat("[LAND MANAGEMENT MODULE]: ... in request {0}", request);
}
catch(InvalidCastException)
catch (InvalidCastException)
{
m_log.ErrorFormat("[LAND] Wrong type in request {0}", request);
m_log.ErrorFormat("[LAND MANAGEMENT MODULE]: Wrong type in request {0}", request);
}
LLSDRemoteParcelResponse response = new LLSDRemoteParcelResponse();
response.parcel_id = parcelID;
m_log.DebugFormat("[LAND] got parcelID {0}", parcelID);
m_log.DebugFormat("[LAND MANAGEMENT MODULE]: Got parcelID {0}", parcelID);
return LLSDHelpers.SerialiseLLSDReply(response);
}
@ -1564,7 +1579,7 @@ namespace OpenSim.Region.CoreModules.World.Land
ExtendedLandData extLandData = new ExtendedLandData();
Util.ParseFakeParcelID(parcel, out extLandData.RegionHandle,
out extLandData.X, out extLandData.Y);
m_log.DebugFormat("[LAND] got parcelinfo request for regionHandle {0}, x/y {1}/{2}",
m_log.DebugFormat("[LAND MANAGEMENT MODULE]: Got parcelinfo request for regionHandle {0}, x/y {1}/{2}",
extLandData.RegionHandle, extLandData.X, extLandData.Y);
// for this region or for somewhere else?
@ -1605,7 +1620,7 @@ namespace OpenSim.Region.CoreModules.World.Land
info = m_scene.GridService.GetRegionByPosition(m_scene.RegionInfo.ScopeID, (int)x, (int)y);
}
// we need to transfer the fake parcelID, not the one in landData, so the viewer can match it to the landmark.
m_log.DebugFormat("[LAND] got parcelinfo for parcel {0} in region {1}; sending...",
m_log.DebugFormat("[LAND MANAGEMENT MODULE]: got parcelinfo for parcel {0} in region {1}; sending...",
data.LandData.Name, data.RegionHandle);
// HACK for now
RegionInfo r = new RegionInfo();
@ -1616,7 +1631,7 @@ namespace OpenSim.Region.CoreModules.World.Land
remoteClient.SendParcelInfo(r, data.LandData, parcelID, data.X, data.Y);
}
else
m_log.Debug("[LAND] got no parcelinfo; not sending");
m_log.Debug("[LAND MANAGEMENT MODULE]: got no parcelinfo; not sending");
}
public void setParcelOtherCleanTime(IClientAPI remoteClient, int localID, int otherCleanTime)

View File

@ -51,7 +51,7 @@ namespace OpenSim.Region.CoreModules.World.Land
private int m_lastSeqId = 0;
protected LandData m_landData = new LandData();
protected LandData m_landData = new LandData();
protected Scene m_scene;
protected List<SceneObjectGroup> primsOverMe = new List<SceneObjectGroup>();
protected Dictionary<uint, UUID> m_listTransactions = new Dictionary<uint, UUID>();
@ -79,6 +79,8 @@ namespace OpenSim.Region.CoreModules.World.Land
set { m_landData = value; }
}
public IPrimCounts PrimCounts { get; set; }
public UUID RegionUUID
{
@ -241,7 +243,7 @@ namespace OpenSim.Region.CoreModules.World.Land
}
remote_client.SendLandProperties(seq_id,
snap_selection, request_result, LandData,
snap_selection, request_result, this,
(float)m_scene.RegionInfo.RegionSettings.ObjectBonus,
GetParcelMaxPrimCount(this),
GetSimulatorMaxPrimCount(this), regionFlags);

View File

@ -45,14 +45,13 @@ namespace OpenSim.Region.CoreModules.World.Land
public int Owner = 0;
public int Group = 0;
public int Others = 0;
public Dictionary <UUID, int> Users =
new Dictionary <UUID, int>();
public int Selected = 0;
public Dictionary <UUID, int> Users = new Dictionary <UUID, int>();
}
public class PrimCountModule : IPrimCountModule, INonSharedRegionModule
{
private static readonly ILog m_log =
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private Scene m_Scene;
private Dictionary<UUID, PrimCounts> m_PrimCounts =
@ -64,10 +63,15 @@ namespace OpenSim.Region.CoreModules.World.Land
private Dictionary<UUID, ParcelCounts> m_ParcelCounts =
new Dictionary<UUID, ParcelCounts>();
// For now, a simple simwide taint to get this up. Later parcel based
// taint to allow recounting a parcel if only ownership has changed
// without recounting the whole sim.
/// <value>
/// For now, a simple simwide taint to get this up. Later parcel based
/// taint to allow recounting a parcel if only ownership has changed
/// without recounting the whole sim.
///
/// We start out tainted so that the first get call resets the various prim counts.
/// <value>
private bool m_Tainted = true;
private Object m_TaintLock = new Object();
public Type ReplaceableInterface
@ -82,13 +86,15 @@ namespace OpenSim.Region.CoreModules.World.Land
public void AddRegion(Scene scene)
{
m_Scene = scene;
m_Scene.RegisterModuleInterface<IPrimCountModule>(this);
m_Scene.EventManager.OnParcelPrimCountAdd +=
OnParcelPrimCountAdd;
m_Scene.EventManager.OnObjectAddedToScene += OnParcelPrimCountAdd;
m_Scene.EventManager.OnObjectBeingRemovedFromScene +=
OnObjectBeingRemovedFromScene;
m_Scene.EventManager.OnParcelPrimCountTainted +=
OnParcelPrimCountTainted;
m_Scene.EventManager.OnLandObjectAdded += delegate(ILandObject lo) { OnParcelPrimCountTainted(); };
}
public void RegionLoaded(Scene scene)
@ -116,6 +122,11 @@ namespace OpenSim.Region.CoreModules.World.Land
{
if (!m_Tainted)
AddObject(obj);
// else
// m_log.DebugFormat(
// "[PRIM COUNT MODULE]: Ignoring OnParcelPrimCountAdd() for {0} on {1} since count is tainted",
// obj.Name, m_Scene.RegionInfo.RegionName);
}
}
@ -126,11 +137,18 @@ namespace OpenSim.Region.CoreModules.World.Land
{
if (!m_Tainted)
RemoveObject(obj);
// else
// m_log.DebugFormat(
// "[PRIM COUNT MODULE]: Ignoring OnObjectBeingRemovedFromScene() for {0} on {1} since count is tainted",
// obj.Name, m_Scene.RegionInfo.RegionName);
}
}
private void OnParcelPrimCountTainted()
{
// m_log.DebugFormat(
// "[PRIM COUNT MODULE]: OnParcelPrimCountTainted() called on {0}", m_Scene.RegionInfo.RegionName);
lock (m_TaintLock)
m_Tainted = true;
}
@ -156,6 +174,8 @@ namespace OpenSim.Region.CoreModules.World.Land
// NOTE: Call under Taint Lock
private void AddObject(SceneObjectGroup obj)
{
// m_log.DebugFormat("[PRIM COUNT MODULE]: Adding object {0} {1} to prim count", obj.Name, obj.UUID);
if (obj.IsAttachment)
return;
if (((obj.RootPart.Flags & PrimFlags.TemporaryOnRez) != 0))
@ -164,6 +184,10 @@ namespace OpenSim.Region.CoreModules.World.Land
Vector3 pos = obj.AbsolutePosition;
ILandObject landObject = m_Scene.LandChannel.GetLandObject(pos.X, pos.Y);
LandData landData = landObject.LandData;
// m_log.DebugFormat(
// "[PRIM COUNT MODULE]: Object {0} is owned by {1} over land owned by {2}",
// obj.Name, obj.OwnerID, landData.OwnerID);
ParcelCounts parcelCounts;
if (m_ParcelCounts.TryGetValue(landData.GlobalID, out parcelCounts))
@ -195,16 +219,25 @@ namespace OpenSim.Region.CoreModules.World.Land
else
parcelCounts.Others += partCount;
}
if (obj.IsSelected)
parcelCounts.Selected += partCount;
}
}
// NOTE: Call under Taint Lock
private void RemoveObject(SceneObjectGroup obj)
{
// m_log.DebugFormat("[PRIM COUNT MODULE]: Removing object {0} {1} from prim count", obj.Name, obj.UUID);
// Currently this is being done by tainting the count instead.
}
public IPrimCounts GetPrimCounts(UUID parcelID)
{
// m_log.DebugFormat(
// "[PRIM COUNT MODULE]: GetPrimCounts for parcel {0} in {1}", parcelID, m_Scene.RegionInfo.RegionName);
PrimCounts primCounts;
lock (m_PrimCounts)
@ -218,8 +251,16 @@ namespace OpenSim.Region.CoreModules.World.Land
return primCounts;
}
/// <summary>
/// Get the number of prims on the parcel that are owned by the parcel owner.
/// </summary>
/// <param name="parcelID"></param>
/// <returns></returns>
public int GetOwnerCount(UUID parcelID)
{
int count = 0;
lock (m_TaintLock)
{
if (m_Tainted)
@ -227,13 +268,25 @@ namespace OpenSim.Region.CoreModules.World.Land
ParcelCounts counts;
if (m_ParcelCounts.TryGetValue(parcelID, out counts))
return counts.Owner;
count = counts.Owner;
}
return 0;
// m_log.DebugFormat(
// "[PRIM COUNT MODULE]: GetOwnerCount for parcel {0} in {1} returning {2}",
// parcelID, m_Scene.RegionInfo.RegionName, count);
return count;
}
/// <summary>
/// Get the number of prims on the parcel that have been set to the group that owns the parcel.
/// </summary>
/// <param name="parcelID"></param>
/// <returns></returns>
public int GetGroupCount(UUID parcelID)
{
int count = 0;
lock (m_TaintLock)
{
if (m_Tainted)
@ -241,13 +294,25 @@ namespace OpenSim.Region.CoreModules.World.Land
ParcelCounts counts;
if (m_ParcelCounts.TryGetValue(parcelID, out counts))
return counts.Group;
count = counts.Group;
}
return 0;
// m_log.DebugFormat(
// "[PRIM COUNT MODULE]: GetGroupCount for parcel {0} in {1} returning {2}",
// parcelID, m_Scene.RegionInfo.RegionName, count);
return count;
}
/// <summary>
/// Get the number of prims on the parcel that are not owned by the parcel owner or set to the parcel group.
/// </summary>
/// <param name="parcelID"></param>
/// <returns></returns>
public int GetOthersCount(UUID parcelID)
{
int count = 0;
lock (m_TaintLock)
{
if (m_Tainted)
@ -255,13 +320,82 @@ namespace OpenSim.Region.CoreModules.World.Land
ParcelCounts counts;
if (m_ParcelCounts.TryGetValue(parcelID, out counts))
return counts.Others;
count = counts.Others;
}
return 0;
// m_log.DebugFormat(
// "[PRIM COUNT MODULE]: GetOthersCount for parcel {0} in {1} returning {2}",
// parcelID, m_Scene.RegionInfo.RegionName, count);
return count;
}
/// <summary>
/// Get the number of selected prims.
/// </summary>
/// <param name="parcelID"></param>
/// <returns></returns>
public int GetSelectedCount(UUID parcelID)
{
int count = 0;
lock (m_TaintLock)
{
if (m_Tainted)
Recount();
ParcelCounts counts;
if (m_ParcelCounts.TryGetValue(parcelID, out counts))
count = counts.Selected;
}
// m_log.DebugFormat(
// "[PRIM COUNT MODULE]: GetSelectedCount for parcel {0} in {1} returning {2}",
// parcelID, m_Scene.RegionInfo.RegionName, count);
return count;
}
/// <summary>
/// Get the total count of owner, group and others prims on the parcel.
/// FIXME: Need to do selected prims once this is reimplemented.
/// </summary>
/// <param name="parcelID"></param>
/// <returns></returns>
public int GetTotalCount(UUID parcelID)
{
int count = 0;
lock (m_TaintLock)
{
if (m_Tainted)
Recount();
ParcelCounts counts;
if (m_ParcelCounts.TryGetValue(parcelID, out counts))
{
count = counts.Owner;
count += counts.Group;
count += counts.Others;
}
}
// m_log.DebugFormat(
// "[PRIM COUNT MODULE]: GetTotalCount for parcel {0} in {1} returning {2}",
// parcelID, m_Scene.RegionInfo.RegionName, count);
return count;
}
/// <summary>
/// Get the number of prims that are in the entire simulator for the owner of this parcel.
/// </summary>
/// <param name="parcelID"></param>
/// <returns></returns>
public int GetSimulatorCount(UUID parcelID)
{
int count = 0;
lock (m_TaintLock)
{
if (m_Tainted)
@ -272,14 +406,27 @@ namespace OpenSim.Region.CoreModules.World.Land
{
int val;
if (m_SimwideCounts.TryGetValue(owner, out val))
return val;
count = val;
}
}
return 0;
// m_log.DebugFormat(
// "[PRIM COUNT MODULE]: GetOthersCount for parcel {0} in {1} returning {2}",
// parcelID, m_Scene.RegionInfo.RegionName, count);
return count;
}
/// <summary>
/// Get the number of prims that a particular user owns on this parcel.
/// </summary>
/// <param name="parcelID"></param>
/// <param name="userID"></param>
/// <returns></returns>
public int GetUserCount(UUID parcelID, UUID userID)
{
int count = 0;
lock (m_TaintLock)
{
if (m_Tainted)
@ -290,27 +437,35 @@ namespace OpenSim.Region.CoreModules.World.Land
{
int val;
if (counts.Users.TryGetValue(userID, out val))
return val;
count = val;
}
}
return 0;
// m_log.DebugFormat(
// "[PRIM COUNT MODULE]: GetUserCount for user {0} in parcel {1} in region {2} returning {3}",
// userID, parcelID, m_Scene.RegionInfo.RegionName, count);
return count;
}
// NOTE: This method MUST be called while holding the taint lock!
private void Recount()
{
// m_log.DebugFormat("[PRIM COUNT MODULE]: Recounting prims on {0}", m_Scene.RegionInfo.RegionName);
m_OwnerMap.Clear();
m_SimwideCounts.Clear();
m_ParcelCounts.Clear();
List<ILandObject> land = m_Scene.LandChannel.AllParcels();
foreach (ILandObject l in land)
{
LandData landData = l.LandData;
m_OwnerMap[landData.GlobalID] = landData.OwnerID;
m_SimwideCounts[landData.OwnerID] = 0;
// m_log.DebugFormat("[PRIM COUNT MODULE]: Adding parcel count for {0}", landData.GlobalID);
m_ParcelCounts[landData.GlobalID] = new ParcelCounts();
}
@ -322,6 +477,7 @@ namespace OpenSim.Region.CoreModules.World.Land
if (!m_OwnerMap.ContainsKey(k))
m_PrimCounts.Remove(k);
}
m_Tainted = false;
}
}
@ -363,6 +519,22 @@ namespace OpenSim.Region.CoreModules.World.Land
return m_Parent.GetOthersCount(m_ParcelID);
}
}
public int Selected
{
get
{
return m_Parent.GetSelectedCount(m_ParcelID);
}
}
public int Total
{
get
{
return m_Parent.GetTotalCount(m_ParcelID);
}
}
public int Simulator
{

View File

@ -0,0 +1,188 @@
/*
* 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.
*/
using System;
using System.Collections.Generic;
using System.Reflection;
using log4net.Config;
using NUnit.Framework;
using OpenMetaverse;
using OpenMetaverse.Assets;
using OpenSim.Framework;
using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes;
using OpenSim.Tests.Common;
using OpenSim.Tests.Common.Mock;
using OpenSim.Tests.Common.Setup;
namespace OpenSim.Region.CoreModules.World.Land.Tests
{
[TestFixture]
public class PrimCountModuleTests
{
protected UUID m_userId = new UUID("00000000-0000-0000-0000-100000000000");
protected UUID m_dummyUserId = new UUID("99999999-9999-9999-9999-999999999999");
protected TestScene m_scene;
protected PrimCountModule m_pcm;
protected ILandObject m_lo;
[SetUp]
public void SetUp()
{
m_pcm = new PrimCountModule();
LandManagementModule lmm = new LandManagementModule();
m_scene = SceneSetupHelpers.SetupScene();
SceneSetupHelpers.SetupSceneModules(m_scene, lmm, m_pcm);
ILandObject lo = new LandObject(m_userId, false, m_scene);
lo.SetLandBitmap(lo.GetSquareLandBitmap(0, 0, (int)Constants.RegionSize, (int)Constants.RegionSize));
m_lo = lmm.AddLandObject(lo);
//scene.loadAllLandObjectsFromStorage(scene.RegionInfo.originRegionID);
}
/// <summary>
/// Test count after a parcel owner owned object is added.
/// </summary>
[Test]
public void TestAddOwnerObject()
{
TestHelper.InMethod();
// log4net.Config.XmlConfigurator.Configure();
IPrimCounts pc = m_lo.PrimCounts;
Assert.That(pc.Owner, Is.EqualTo(0));
Assert.That(pc.Group, Is.EqualTo(0));
Assert.That(pc.Others, Is.EqualTo(0));
Assert.That(pc.Total, Is.EqualTo(0));
Assert.That(pc.Selected, Is.EqualTo(0));
Assert.That(pc.Users[m_userId], Is.EqualTo(0));
Assert.That(pc.Users[m_dummyUserId], Is.EqualTo(0));
Assert.That(pc.Simulator, Is.EqualTo(0));
SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_userId, 0x01);
m_scene.AddNewSceneObject(sog, false);
Assert.That(pc.Owner, Is.EqualTo(3));
Assert.That(pc.Group, Is.EqualTo(0));
Assert.That(pc.Others, Is.EqualTo(0));
Assert.That(pc.Total, Is.EqualTo(3));
Assert.That(pc.Selected, Is.EqualTo(0));
Assert.That(pc.Users[m_userId], Is.EqualTo(3));
Assert.That(pc.Users[m_dummyUserId], Is.EqualTo(0));
Assert.That(pc.Simulator, Is.EqualTo(3));
// Add a second object and retest
SceneObjectGroup sog2 = SceneSetupHelpers.CreateSceneObject(2, m_userId, 0x10);
m_scene.AddNewSceneObject(sog2, false);
Assert.That(pc.Owner, Is.EqualTo(5));
Assert.That(pc.Group, Is.EqualTo(0));
Assert.That(pc.Others, Is.EqualTo(0));
Assert.That(pc.Total, Is.EqualTo(5));
Assert.That(pc.Selected, Is.EqualTo(0));
Assert.That(pc.Users[m_userId], Is.EqualTo(5));
Assert.That(pc.Users[m_dummyUserId], Is.EqualTo(0));
Assert.That(pc.Simulator, Is.EqualTo(5));
}
/// <summary>
/// Test count after a parcel owner owned copied object is added.
/// </summary>
[Test]
public void TestCopiedOwnerObject()
{
TestHelper.InMethod();
// log4net.Config.XmlConfigurator.Configure();
IPrimCounts pc = m_lo.PrimCounts;
SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_userId, 0x01);
m_scene.AddNewSceneObject(sog, false);
m_scene.SceneGraph.DuplicateObject(sog.LocalId, Vector3.Zero, 0, m_userId, UUID.Zero, Quaternion.Identity);
Assert.That(pc.Owner, Is.EqualTo(6));
Assert.That(pc.Group, Is.EqualTo(0));
Assert.That(pc.Others, Is.EqualTo(0));
Assert.That(pc.Total, Is.EqualTo(6));
Assert.That(pc.Selected, Is.EqualTo(0));
Assert.That(pc.Users[m_userId], Is.EqualTo(6));
Assert.That(pc.Users[m_dummyUserId], Is.EqualTo(0));
Assert.That(pc.Simulator, Is.EqualTo(6));
}
/// <summary>
/// Test count after a parcel owner owned object is removed.
/// </summary>
[Test]
public void TestRemoveOwnerObject()
{
TestHelper.InMethod();
// log4net.Config.XmlConfigurator.Configure();
IPrimCounts pc = m_lo.PrimCounts;
m_scene.AddNewSceneObject(SceneSetupHelpers.CreateSceneObject(1, m_userId, 0x1), false);
SceneObjectGroup sogToDelete = SceneSetupHelpers.CreateSceneObject(3, m_userId, 0x10);
m_scene.AddNewSceneObject(sogToDelete, false);
m_scene.DeleteSceneObject(sogToDelete, false);
Assert.That(pc.Owner, Is.EqualTo(1));
Assert.That(pc.Group, Is.EqualTo(0));
Assert.That(pc.Others, Is.EqualTo(0));
Assert.That(pc.Total, Is.EqualTo(1));
Assert.That(pc.Selected, Is.EqualTo(0));
Assert.That(pc.Users[m_userId], Is.EqualTo(1));
Assert.That(pc.Users[m_dummyUserId], Is.EqualTo(0));
Assert.That(pc.Simulator, Is.EqualTo(1));
}
/// <summary>
/// Test the count is correct after is has been tainted.
/// </summary>
[Test]
public void TestTaint()
{
TestHelper.InMethod();
IPrimCounts pc = m_lo.PrimCounts;
SceneObjectGroup sog = SceneSetupHelpers.CreateSceneObject(3, m_userId, 0x01);
m_scene.AddNewSceneObject(sog, false);
m_pcm.TaintPrimCount();
Assert.That(pc.Owner, Is.EqualTo(3));
Assert.That(pc.Group, Is.EqualTo(0));
Assert.That(pc.Others, Is.EqualTo(0));
Assert.That(pc.Total, Is.EqualTo(3));
Assert.That(pc.Selected, Is.EqualTo(0));
Assert.That(pc.Users[m_userId], Is.EqualTo(3));
Assert.That(pc.Users[m_dummyUserId], Is.EqualTo(0));
Assert.That(pc.Simulator, Is.EqualTo(3));
}
}
}

View File

@ -188,17 +188,17 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
}
catch (DllNotFoundException)
{
m_log.ErrorFormat("[TexturedMapTileRenderer]: OpenJpeg is not installed correctly on this system. Asset Data is emtpy for {0}", id);
m_log.ErrorFormat("[TexturedMapTileRenderer]: OpenJpeg is not installed correctly on this system. Asset Data is empty for {0}", id);
}
catch (IndexOutOfRangeException)
{
m_log.ErrorFormat("[TexturedMapTileRenderer]: OpenJpeg was unable to encode this. Asset Data is emtpy for {0}", id);
m_log.ErrorFormat("[TexturedMapTileRenderer]: OpenJpeg was unable to encode this. Asset Data is empty for {0}", id);
}
catch (Exception)
{
m_log.ErrorFormat("[TexturedMapTileRenderer]: OpenJpeg was unable to encode this. Asset Data is emtpy for {0}", id);
m_log.ErrorFormat("[TexturedMapTileRenderer]: OpenJpeg was unable to encode this. Asset Data is empty for {0}", id);
}
return null;

View File

@ -32,7 +32,6 @@ using System.Reflection;
using System.Threading;
using log4net.Config;
using NUnit.Framework;
using NUnit.Framework.SyntaxHelpers;
using OpenMetaverse;
using OpenMetaverse.Assets;
using OpenSim.Framework;

View File

@ -642,7 +642,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
/// implemented by callers.
/// </summary>
/// <param name="currentUser"></param>
/// <param name="objId"></param>
/// <param name="objId">This is a scene object group UUID</param>
/// <param name="denyOnLocked"></param>
/// <returns></returns>
protected bool GenericObjectPermission(UUID currentUser, UUID objId, bool denyOnLocked)
@ -1896,7 +1896,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
// "[PERMISSIONS]: Checking CanControlPrimMedia for {0} on {1} face {2} with control permissions {3}",
// agentID, primID, face, me.ControlPermissions);
return GenericPrimMediaPermission(part, agentID, me.ControlPermissions);
return GenericObjectPermission(agentID, part.ParentGroup.UUID, true);
}
private bool CanInteractWithPrimMedia(UUID agentID, UUID primID, int face)

View File

@ -30,7 +30,6 @@ using System.IO;
using System.Xml;
using log4net.Config;
using NUnit.Framework;
using NUnit.Framework.SyntaxHelpers;
using OpenMetaverse;
using OpenSim.Framework;
using OpenSim.Region.Framework.Scenes;

View File

@ -62,9 +62,20 @@ namespace OpenSim.Region.CoreModules.World.Terrain.FileLoaders
return LoadBitmap(new Bitmap(filename));
}
public ITerrainChannel LoadFile(string filename, int x, int y, int fileWidth, int fileHeight, int w, int h)
public virtual ITerrainChannel LoadFile(string filename, int offsetX, int offsetY, int fileWidth, int fileHeight, int w, int h)
{
throw new NotImplementedException();
Bitmap bitmap = new Bitmap(filename);
ITerrainChannel retval = new TerrainChannel(true);
for (int x = 0; x < retval.Width; x++)
{
for (int y = 0; y < retval.Height; y++)
{
retval[x, y] = bitmap.GetPixel(offsetX * retval.Width + x, (bitmap.Height - (retval.Height * (offsetY + 1))) + retval.Height - y - 1).GetBrightness() * 128;
}
}
return retval;
}
public virtual ITerrainChannel LoadStream(Stream stream)

View File

@ -100,8 +100,12 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
// service wasn't available; maybe still an old GridServer. Try the old API, though it will return only one region
regionInfos = new List<GridRegion>();
GridRegion info = m_scene.GridService.GetRegionByName(m_scene.RegionInfo.ScopeID, mapName);
if (info != null) regionInfos.Add(info);
if (info != null)
regionInfos.Add(info);
}
else if (regionInfos.Count == 0 && mapName.StartsWith("http://"))
remoteClient.SendAlertMessage("Hyperlink could not be established.");
m_log.DebugFormat("[MAPSEARCHMODULE]: search {0} returned {1} regions", mapName, regionInfos.Count);
List<MapBlockData> blocks = new List<MapBlockData>();
@ -113,7 +117,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
data = new MapBlockData();
data.Agents = 0;
data.Access = info.Access;
data.MapImageId = info.TerrainImage;
data.MapImageId = UUID.Zero; // could use info.TerrainImage but it seems to break viewer2
data.Name = info.RegionName;
data.RegionFlags = 0; // TODO not used?
data.WaterHeight = 0; // not used
@ -135,7 +139,9 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
data.Y = 0;
blocks.Add(data);
remoteClient.SendMapBlock(blocks, 0);
// not sure what the flags do here, but seems to be necessary
// to set to "2" for viewer 2
remoteClient.SendMapBlock(blocks, 2);
}
// private Scene GetClientScene(IClientAPI client)

View File

@ -916,7 +916,7 @@ namespace OpenSim.Region.Examples.SimpleModule
{
}
public void SendLandProperties(int sequence_id, bool snap_selection, int request_result, LandData landData, float simObjectBonusFactor, int parcelObjectCapacity, int simObjectCapacity, uint regionFlags)
public void SendLandProperties(int sequence_id, bool snap_selection, int request_result, ILandObject lo, float simObjectBonusFactor, int parcelObjectCapacity, int simObjectCapacity, uint regionFlags)
{
}

View File

@ -34,12 +34,68 @@ namespace OpenSim.Region.Framework.Interfaces
{
public interface IEstateDataService
{
/// <summary>
/// Load estate settings for a region.
/// </summary>
/// <param name="regionID"></param>
/// <param name="create">If true, then an estate is created if one is not found.</param>
/// <returns></returns>
EstateSettings LoadEstateSettings(UUID regionID, bool create);
/// <summary>
/// Load estate settings for an estate ID.
/// </summary>
/// <param name="estateID"></param>
/// <returns></returns>
EstateSettings LoadEstateSettings(int estateID);
/// <summary>
/// Load/Get all estate settings.
/// </summary>
/// <returns>An empty list if no estates were found.</returns>
List<EstateSettings> LoadEstateSettingsAll();
/// <summary>
/// Store estate settings.
/// </summary>
/// <remarks>
/// This is also called by EstateSettings.Save()</remarks>
/// <param name="es"></param>
void StoreEstateSettings(EstateSettings es);
/// <summary>
/// Get estate IDs.
/// </summary>
/// <param name="search">Name of estate to search for. This is the exact name, no parttern matching is done.</param>
/// <returns></returns>
List<int> GetEstates(string search);
/// <summary>
/// Get the IDs of all estates.
/// </summary>
/// <returns>An empty list if no estates were found.</returns>
List<int> GetEstatesAll();
/// <summary>
/// Link a region to an estate.
/// </summary>
/// <param name="regionID"></param>
/// <param name="estateID"></param>
/// <returns>true if the link succeeded, false otherwise</returns>
bool LinkRegion(UUID regionID, int estateID);
/// <summary>
/// Get the UUIDs of all the regions in an estate.
/// </summary>
/// <param name="estateID"></param>
/// <returns></returns>
List<UUID> GetRegions(int estateID);
/// <summary>
/// Delete an estate
/// </summary>
/// <param name="estateID"></param>
/// <returns>true if the delete succeeded, false otherwise</returns>
bool DeleteEstate(int estateID);
}
}
}

View File

@ -33,14 +33,74 @@ namespace OpenSim.Region.Framework.Interfaces
{
public interface IEstateDataStore
{
/// <summary>
/// Initialise the data store.
/// </summary>
/// <param name="connectstring"></param>
void Initialise(string connectstring);
/// <summary>
/// Load estate settings for a region.
/// </summary>
/// <param name="regionID"></param>
/// <param name="create">If true, then an estate is created if one is not found.</param>
/// <returns></returns>
EstateSettings LoadEstateSettings(UUID regionID, bool create);
/// <summary>
/// Load estate settings for an estate ID.
/// </summary>
/// <param name="estateID"></param>
/// <returns></returns>
EstateSettings LoadEstateSettings(int estateID);
/// <summary>
/// Load/Get all estate settings.
/// </summary>
/// <returns>An empty list if no estates were found.</returns>
List<EstateSettings> LoadEstateSettingsAll();
/// <summary>
/// Store estate settings.
/// </summary>
/// <remarks>
/// This is also called by EstateSettings.Save()</remarks>
/// <param name="es"></param>
void StoreEstateSettings(EstateSettings es);
/// <summary>
/// Get estate IDs.
/// </summary>
/// <param name="search">Name of estate to search for. This is the exact name, no parttern matching is done.</param>
/// <returns></returns>
List<int> GetEstates(string search);
/// <summary>
/// Get the IDs of all estates.
/// </summary>
/// <returns>An empty list if no estates were found.</returns>
List<int> GetEstatesAll();
/// <summary>
/// Link a region to an estate.
/// </summary>
/// <param name="regionID"></param>
/// <param name="estateID"></param>
/// <returns>true if the link succeeded, false otherwise</returns>
bool LinkRegion(UUID regionID, int estateID);
/// <summary>
/// Get the UUIDs of all the regions in an estate.
/// </summary>
/// <param name="estateID"></param>
/// <returns></returns>
List<UUID> GetRegions(int estateID);
/// <summary>
/// Delete an estate
/// </summary>
/// <param name="estateID"></param>
/// <returns>true if the delete succeeded, false otherwise</returns>
bool DeleteEstate(int estateID);
}
}
}

View File

@ -38,18 +38,4 @@ namespace OpenSim.Region.Framework.Interfaces
IPrimCounts GetPrimCounts(UUID parcelID);
}
public interface IPrimCounts
{
int Owner { get; }
int Group { get; }
int Others { get; }
int Simulator { get; }
IUserPrimCounts Users { get; }
}
public interface IUserPrimCounts
{
int this[UUID agentID] { get; }
}
}
}

View File

@ -482,7 +482,15 @@ namespace OpenSim.Region.Framework.Scenes
public delegate void GetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID);
public event EstateToolsSunUpdate OnEstateToolsSunUpdate;
/// <summary>
/// Triggered when an object is added to the scene.
/// </summary>
public event Action<SceneObjectGroup> OnObjectAddedToScene;
/// <summary>
/// Triggered when an object is removed from the scene.
/// </summary>
public delegate void ObjectBeingRemovedFromScene(SceneObjectGroup obj);
public event ObjectBeingRemovedFromScene OnObjectBeingRemovedFromScene;
@ -585,6 +593,7 @@ namespace OpenSim.Region.Framework.Scenes
public delegate void Attach(uint localID, UUID itemID, UUID avatarID);
public event Attach OnAttach;
/// <summary>
/// Called immediately after an object is loaded from storage.
/// </summary>
@ -1041,6 +1050,27 @@ namespace OpenSim.Region.Framework.Scenes
}
}
public void TriggerObjectAddedToScene(SceneObjectGroup obj)
{
Action<SceneObjectGroup> handler = OnObjectAddedToScene;
if (handler != null)
{
foreach (Action<SceneObjectGroup> d in handler.GetInvocationList())
{
try
{
d(obj);
}
catch (Exception e)
{
m_log.ErrorFormat(
"[EVENT MANAGER]: Delegate for TriggerObjectAddedToScene failed - continuing. {0} {1}",
e.Message, e.StackTrace);
}
}
}
}
public void TriggerObjectBeingRemovedFromScene(SceneObjectGroup obj)
{
ObjectBeingRemovedFromScene handlerObjectBeingRemovedFromScene = OnObjectBeingRemovedFromScene;

View File

@ -1570,7 +1570,7 @@ namespace OpenSim.Region.Framework.Scenes
//
while (m_regInfo.EstateSettings.EstateOwner == UUID.Zero && MainConsole.Instance != null)
{
MainConsole.Instance.Output("The current estate has no owner set.");
MainConsole.Instance.OutputFormat("Estate {0} has no owner set.", m_regInfo.EstateSettings.EstateName);
List<char> excluded = new List<char>(new char[1]{' '});
string first = MainConsole.Instance.CmdPrompt("Estate owner first name", "Test", excluded);
string last = MainConsole.Instance.CmdPrompt("Estate owner last name", "User", excluded);
@ -2494,8 +2494,14 @@ namespace OpenSim.Region.Framework.Scenes
/// If false, it is left to the caller to schedule the update
/// </param>
public bool AddNewSceneObject(SceneObjectGroup sceneObject, bool attachToBackup, bool sendClientUpdates)
{
return m_sceneGraph.AddNewSceneObject(sceneObject, attachToBackup, sendClientUpdates);
{
if (m_sceneGraph.AddNewSceneObject(sceneObject, attachToBackup, sendClientUpdates))
{
EventManager.TriggerObjectAddedToScene(sceneObject);
return true;
}
return false;
}
/// <summary>
@ -2512,7 +2518,13 @@ namespace OpenSim.Region.Framework.Scenes
public bool AddNewSceneObject(
SceneObjectGroup sceneObject, bool attachToBackup, Vector3 pos, Quaternion rot, Vector3 vel)
{
return m_sceneGraph.AddNewSceneObject(sceneObject, attachToBackup, pos, rot, vel);
if (m_sceneGraph.AddNewSceneObject(sceneObject, attachToBackup, pos, rot, vel))
{
EventManager.TriggerObjectAddedToScene(sceneObject);
return true;
}
return false;
}
/// <summary>

View File

@ -97,9 +97,21 @@ namespace OpenSim.Region.Framework.Scenes
protected internal object m_syncRoot = new object();
protected internal PhysicsScene _PhyScene;
protected internal Dictionary<uint, SceneObjectGroup> SceneObjectGroupsByLocalID = new Dictionary<uint, SceneObjectGroup>();
/// <summary>
/// Index the SceneObjectGroup for each part by the root part's UUID.
/// </summary>
protected internal Dictionary<UUID, SceneObjectGroup> SceneObjectGroupsByFullID = new Dictionary<UUID, SceneObjectGroup>();
/// <summary>
/// Index the SceneObjectGroup for each part by that part's UUID.
/// </summary>
protected internal Dictionary<UUID, SceneObjectGroup> SceneObjectGroupsByFullPartID = new Dictionary<UUID, SceneObjectGroup>();
/// <summary>
/// Index the SceneObjectGroup for each part by that part's local ID.
/// </summary>
protected internal Dictionary<uint, SceneObjectGroup> SceneObjectGroupsByLocalPartID = new Dictionary<uint, SceneObjectGroup>();
private Object m_updateLock = new Object();
@ -142,8 +154,10 @@ namespace OpenSim.Region.Framework.Scenes
lock (SceneObjectGroupsByFullID)
SceneObjectGroupsByFullID.Clear();
lock (SceneObjectGroupsByLocalID)
SceneObjectGroupsByLocalID.Clear();
lock (SceneObjectGroupsByFullPartID)
SceneObjectGroupsByFullPartID.Clear();
lock (SceneObjectGroupsByLocalPartID)
SceneObjectGroupsByLocalPartID.Clear();
Entities.Clear();
}
@ -361,6 +375,10 @@ namespace OpenSim.Region.Framework.Scenes
if (Entities.ContainsKey(sceneObject.UUID))
return false;
// m_log.DebugFormat(
// "[SCENEGRAPH]: Adding scene object {0} {1}, with {2} parts on {3}",
// sceneObject.Name, sceneObject.UUID, sceneObject.Parts.Length, m_parentScene.RegionInfo.RegionName);
SceneObjectPart[] children = sceneObject.Parts;
@ -395,17 +413,20 @@ namespace OpenSim.Region.Framework.Scenes
OnObjectCreate(sceneObject);
lock (SceneObjectGroupsByFullID)
{
SceneObjectGroupsByFullID[sceneObject.UUID] = sceneObject;
lock (SceneObjectGroupsByFullPartID)
{
SceneObjectGroupsByFullPartID[sceneObject.UUID] = sceneObject;
foreach (SceneObjectPart part in children)
SceneObjectGroupsByFullID[part.UUID] = sceneObject;
SceneObjectGroupsByFullPartID[part.UUID] = sceneObject;
}
lock (SceneObjectGroupsByLocalID)
lock (SceneObjectGroupsByLocalPartID)
{
SceneObjectGroupsByLocalID[sceneObject.LocalId] = sceneObject;
SceneObjectGroupsByLocalPartID[sceneObject.LocalId] = sceneObject;
foreach (SceneObjectPart part in children)
SceneObjectGroupsByLocalID[part.LocalId] = sceneObject;
SceneObjectGroupsByLocalPartID[part.LocalId] = sceneObject;
}
//SYMMETRIC SYNC: sending NewObject event, and sending it before calling ScheduleGroupForFullUpdate
@ -446,21 +467,24 @@ namespace OpenSim.Region.Framework.Scenes
if (OnObjectRemove != null)
OnObjectRemove(Entities[uuid]);
lock (SceneObjectGroupsByFullID)
SceneObjectGroupsByFullID.Remove(grp.UUID);
lock (SceneObjectGroupsByFullPartID)
{
SceneObjectPart[] parts = grp.Parts;
for (int i = 0; i < parts.Length; i++)
SceneObjectGroupsByFullID.Remove(parts[i].UUID);
SceneObjectGroupsByFullID.Remove(grp.RootPart.UUID);
SceneObjectGroupsByFullPartID.Remove(parts[i].UUID);
SceneObjectGroupsByFullPartID.Remove(grp.RootPart.UUID);
}
lock (SceneObjectGroupsByLocalID)
lock (SceneObjectGroupsByLocalPartID)
{
SceneObjectPart[] parts = grp.Parts;
for (int i = 0; i < parts.Length; i++)
SceneObjectGroupsByLocalID.Remove(parts[i].LocalId);
SceneObjectGroupsByLocalID.Remove(grp.RootPart.LocalId);
SceneObjectGroupsByLocalPartID.Remove(parts[i].LocalId);
SceneObjectGroupsByLocalPartID.Remove(grp.RootPart.LocalId);
}
return Entities.Remove(uuid);
@ -659,7 +683,7 @@ namespace OpenSim.Region.Framework.Scenes
if (!Entities.Remove(agentID))
{
m_log.WarnFormat(
"[SCENE]: Tried to remove non-existent scene presence with agent ID {0} from scene Entities list",
"[SCENEGRAPH]: Tried to remove non-existent scene presence with agent ID {0} from scene Entities list",
agentID);
}
@ -682,7 +706,7 @@ namespace OpenSim.Region.Framework.Scenes
}
else
{
m_log.WarnFormat("[SCENE]: Tried to remove non-existent scene presence with agent ID {0} from scene ScenePresences list", agentID);
m_log.WarnFormat("[SCENEGRAPH]: Tried to remove non-existent scene presence with agent ID {0} from scene ScenePresences list", agentID);
}
}
}
@ -886,14 +910,14 @@ namespace OpenSim.Region.Framework.Scenes
//m_log.DebugFormat("Entered GetGroupByPrim with localID {0}", localID);
SceneObjectGroup sog;
lock (SceneObjectGroupsByLocalID)
SceneObjectGroupsByLocalID.TryGetValue(localID, out sog);
lock (SceneObjectGroupsByLocalPartID)
SceneObjectGroupsByLocalPartID.TryGetValue(localID, out sog);
if (sog != null)
{
if (sog.HasChildPrim(localID))
return sog;
SceneObjectGroupsByLocalID.Remove(localID);
SceneObjectGroupsByLocalPartID.Remove(localID);
}
EntityBase[] entityList = GetEntities();
@ -905,8 +929,8 @@ namespace OpenSim.Region.Framework.Scenes
sog = (SceneObjectGroup)ent;
if (sog.HasChildPrim(localID))
{
lock (SceneObjectGroupsByLocalID)
SceneObjectGroupsByLocalID[localID] = sog;
lock (SceneObjectGroupsByLocalPartID)
SceneObjectGroupsByLocalPartID[localID] = sog;
return sog;
}
}
@ -923,16 +947,16 @@ namespace OpenSim.Region.Framework.Scenes
public SceneObjectGroup GetGroupByPrim(UUID fullID)
{
SceneObjectGroup sog;
lock (SceneObjectGroupsByFullID)
SceneObjectGroupsByFullID.TryGetValue(fullID, out sog);
lock (SceneObjectGroupsByFullPartID)
SceneObjectGroupsByFullPartID.TryGetValue(fullID, out sog);
if (sog != null)
{
if (sog.ContainsPart(fullID))
return sog;
lock (SceneObjectGroupsByFullID)
SceneObjectGroupsByFullID.Remove(fullID);
lock (SceneObjectGroupsByFullPartID)
SceneObjectGroupsByFullPartID.Remove(fullID);
}
EntityBase[] entityList = GetEntities();
@ -943,8 +967,8 @@ namespace OpenSim.Region.Framework.Scenes
sog = (SceneObjectGroup)ent;
if (sog.HasChildPrim(fullID))
{
lock (SceneObjectGroupsByFullID)
SceneObjectGroupsByFullID[fullID] = sog;
lock (SceneObjectGroupsByFullPartID)
SceneObjectGroupsByFullPartID[fullID] = sog;
return sog;
}
}
@ -1096,11 +1120,12 @@ namespace OpenSim.Region.Framework.Scenes
}
/// <summary>
/// Performs action on all scene object groups.
/// Performs action once on all scene object groups.
/// </summary>
/// <param name="action"></param>
protected internal void ForEachSOG(Action<SceneObjectGroup> action)
{
// FIXME: Need to lock here, really.
List<SceneObjectGroup> objlist = new List<SceneObjectGroup>(SceneObjectGroupsByFullID.Values);
foreach (SceneObjectGroup obj in objlist)
{
@ -1111,11 +1136,11 @@ namespace OpenSim.Region.Framework.Scenes
catch (Exception e)
{
// Catch it and move on. This includes situations where splist has inconsistent info
m_log.WarnFormat("[SCENE]: Problem processing action in ForEachSOG: ", e.ToString());
m_log.WarnFormat(
"[SCENEGRAPH]: Problem processing action in ForEachSOG: {0} {1}", e.Message, e.StackTrace);
}
}
}
/// <summary>
/// Performs action on all scene presences. This can ultimately run the actions in parallel but
@ -1135,8 +1160,8 @@ namespace OpenSim.Region.Framework.Scenes
}
catch (Exception e)
{
m_log.Info("[BUG] in " + m_parentScene.RegionInfo.RegionName + ": " + e.ToString());
m_log.Info("[BUG] Stack Trace: " + e.StackTrace);
m_log.Info("[SCENEGRAPH]: Error in " + m_parentScene.RegionInfo.RegionName + ": " + e.ToString());
m_log.Info("[SCENEGRAPH]: Stack Trace: " + e.StackTrace);
}
});
Parallel.ForEach<ScenePresence>(GetScenePresences(), protectedAction);
@ -1151,7 +1176,7 @@ namespace OpenSim.Region.Framework.Scenes
}
catch (Exception e)
{
m_log.Info("[BUG] in " + m_parentScene.RegionInfo.RegionName + ": " + e.ToString());
m_log.Error("[SCENEGRAPH]: Error in " + m_parentScene.RegionInfo.RegionName + ": " + e.ToString());
}
}
}
@ -1855,7 +1880,10 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="rot"></param>
public SceneObjectGroup DuplicateObject(uint originalPrimID, Vector3 offset, uint flags, UUID AgentID, UUID GroupID, Quaternion rot)
{
//m_log.DebugFormat("[SCENE]: Duplication of object {0} at offset {1} requested by agent {2}", originalPrim, offset, AgentID);
// m_log.DebugFormat(
// "[SCENE]: Duplication of object {0} at offset {1} requested by agent {2}",
// originalPrimID, offset, AgentID);
SceneObjectGroup original = GetGroupByPrim(originalPrimID);
if (original != null)
{
@ -1886,7 +1914,28 @@ namespace OpenSim.Region.Framework.Scenes
copy.RootPart.SalePrice = 10;
}
// FIXME: This section needs to be refactored so that it just calls AddSceneObject()
Entities.Add(copy);
lock (SceneObjectGroupsByFullID)
SceneObjectGroupsByFullID[copy.UUID] = copy;
SceneObjectPart[] children = copy.Parts;
lock (SceneObjectGroupsByFullPartID)
{
SceneObjectGroupsByFullPartID[copy.UUID] = copy;
foreach (SceneObjectPart part in children)
SceneObjectGroupsByFullPartID[part.UUID] = copy;
}
lock (SceneObjectGroupsByLocalPartID)
{
SceneObjectGroupsByLocalPartID[copy.LocalId] = copy;
foreach (SceneObjectPart part in children)
SceneObjectGroupsByLocalPartID[copy.LocalId] = copy;
}
// PROBABLE END OF FIXME
// Since we copy from a source group that is in selected
// state, but the copy is shown deselected in the viewer,
@ -2143,11 +2192,11 @@ namespace OpenSim.Region.Framework.Scenes
SceneObjectGroupsByFullID[part.UUID] = sceneObject;
}
lock (SceneObjectGroupsByLocalID)
lock (SceneObjectGroupsByLocalPartID)
{
SceneObjectGroupsByLocalID[sceneObject.LocalId] = sceneObject;
SceneObjectGroupsByLocalPartID[sceneObject.LocalId] = sceneObject;
foreach (SceneObjectPart part in children)
SceneObjectGroupsByLocalID[part.LocalId] = sceneObject;
SceneObjectGroupsByLocalPartID[part.LocalId] = sceneObject;
}
return updateResult;
@ -2164,11 +2213,11 @@ namespace OpenSim.Region.Framework.Scenes
SceneObjectGroupsByFullID[newPart.UUID] = parentGroup;
}
lock (SceneObjectGroupsByLocalID)
lock (SceneObjectGroupsByLocalPartID)
{
SceneObjectGroupsByLocalID[parentGroup.LocalId] = parentGroup;
SceneObjectGroupsByLocalPartID[parentGroup.LocalId] = parentGroup;
foreach (SceneObjectPart part in children)
SceneObjectGroupsByLocalID[newPart.LocalId] = parentGroup;
SceneObjectGroupsByLocalPartID[newPart.LocalId] = parentGroup;
}
}

View File

@ -1095,9 +1095,13 @@ namespace OpenSim.Region.Framework.Scenes
public Dictionary<UUID, string> GetScriptStates()
{
Dictionary<UUID, string> ret = new Dictionary<UUID, string>();
if (m_part.ParentGroup.Scene == null) // Group not in a scene
return ret;
IScriptModule[] engines = m_part.ParentGroup.Scene.RequestModuleInterfaces<IScriptModule>();
Dictionary<UUID, string> ret = new Dictionary<UUID, string>();
if (engines == null) // No engine at all
return ret;

View File

@ -34,7 +34,6 @@ using System.Timers;
using Timer=System.Timers.Timer;
using Nini.Config;
using NUnit.Framework;
using NUnit.Framework.SyntaxHelpers;
using OpenMetaverse;
using OpenSim.Framework;
using OpenSim.Framework.Communications;

View File

@ -32,7 +32,6 @@ using System.Text;
using System.Collections.Generic;
using Nini.Config;
using NUnit.Framework;
using NUnit.Framework.SyntaxHelpers;
using OpenMetaverse;
using OpenSim.Framework;
using OpenSim.Framework.Communications;

View File

@ -28,7 +28,6 @@
using System;
using System.Reflection;
using NUnit.Framework;
using NUnit.Framework.SyntaxHelpers;
using OpenMetaverse;
using OpenSim.Framework;
using OpenSim.Framework.Communications;

View File

@ -28,7 +28,6 @@
using System;
using System.Reflection;
using NUnit.Framework;
using NUnit.Framework.SyntaxHelpers;
using OpenMetaverse;
using OpenSim.Framework;
using OpenSim.Framework.Communications;

View File

@ -30,7 +30,6 @@ using System.Collections.Generic;
using System.Reflection;
using Nini.Config;
using NUnit.Framework;
using NUnit.Framework.SyntaxHelpers;
using OpenMetaverse;
using OpenSim.Framework;
using OpenSim.Framework.Communications;

View File

@ -29,7 +29,6 @@ using System;
using System.Collections.Generic;
using System.Reflection;
using NUnit.Framework;
using NUnit.Framework.SyntaxHelpers;
using OpenMetaverse;
using OpenSim.Framework;
using OpenSim.Framework.Communications;

View File

@ -30,7 +30,6 @@ using System.Collections.Generic;
using System.Reflection;
using Nini.Config;
using NUnit.Framework;
using NUnit.Framework.SyntaxHelpers;
using OpenMetaverse;
using OpenSim.Framework;
using OpenSim.Framework.Communications;

View File

@ -34,7 +34,6 @@ using System.Timers;
using Timer=System.Timers.Timer;
using Nini.Config;
using NUnit.Framework;
using NUnit.Framework.SyntaxHelpers;
using OpenMetaverse;
using OpenSim.Framework;
using OpenSim.Framework.Communications;

View File

@ -34,7 +34,6 @@ using System.Timers;
using Timer=System.Timers.Timer;
using Nini.Config;
using NUnit.Framework;
using NUnit.Framework.SyntaxHelpers;
using OpenMetaverse;
using OpenSim.Framework;
using OpenSim.Framework.Communications;

View File

@ -29,7 +29,6 @@ using System;
using System.Reflection;
using Nini.Config;
using NUnit.Framework;
using NUnit.Framework.SyntaxHelpers;
using OpenMetaverse;
using OpenSim.Framework;
using OpenSim.Framework.Communications;

View File

@ -34,7 +34,6 @@ using System.Timers;
using Timer=System.Timers.Timer;
using Nini.Config;
using NUnit.Framework;
using NUnit.Framework.SyntaxHelpers;
using OpenMetaverse;
using OpenMetaverse.Assets;
using OpenSim.Framework;

View File

@ -28,7 +28,6 @@
using System.Collections.Generic;
using System.Text;
using NUnit.Framework;
using NUnit.Framework.SyntaxHelpers;
using OpenMetaverse;
using OpenSim.Framework;
using OpenSim.Region.Framework.Scenes;

View File

@ -1254,7 +1254,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
}
public void SendLandProperties(int sequence_id, bool snap_selection, int request_result, LandData landData, float simObjectBonusFactor, int parcelObjectCapacity, int simObjectCapacity, uint regionFlags)
public void SendLandProperties(int sequence_id, bool snap_selection, int request_result, ILandObject lo, float simObjectBonusFactor, int parcelObjectCapacity, int simObjectCapacity, uint regionFlags)
{
}

View File

@ -29,7 +29,6 @@ using System;
using System.Reflection;
using Nini.Config;
using NUnit.Framework;
using NUnit.Framework.SyntaxHelpers;
using OpenMetaverse;
using OpenSim.Framework;
using OpenSim.Framework.Communications;

View File

@ -25,6 +25,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using OpenSim.Framework;
using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes;

View File

@ -929,7 +929,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC
{
}
public void SendLandProperties(int sequence_id, bool snap_selection, int request_result, LandData landData, float simObjectBonusFactor,int parcelObjectCapacity, int simObjectCapacity, uint regionFlags)
public void SendLandProperties(int sequence_id, bool snap_selection, int request_result, ILandObject lo, float simObjectBonusFactor,int parcelObjectCapacity, int simObjectCapacity, uint regionFlags)
{
}
public void SendLandAccessListData(List<UUID> avatars, uint accessFlag, int localLandID)

View File

@ -74,12 +74,23 @@ namespace OpenSim.Server.Handlers.Login
if (requestData != null)
{
if (requestData.ContainsKey("first") && requestData["first"] != null &&
requestData.ContainsKey("last") && requestData["last"] != null &&
requestData.ContainsKey("passwd") && requestData["passwd"] != null)
requestData.ContainsKey("last") && requestData["last"] != null && (
(requestData.ContainsKey("passwd") && requestData["passwd"] != null) ||
(!requestData.ContainsKey("passwd") && requestData.ContainsKey("web_login_key") && requestData["web_login_key"] != null && requestData["web_login_key"].ToString() != UUID.Zero.ToString())
))
{
string first = requestData["first"].ToString();
string last = requestData["last"].ToString();
string passwd = requestData["passwd"].ToString();
string passwd = null;
if (requestData.ContainsKey("passwd"))
{
passwd = requestData["passwd"].ToString();
}
else if (requestData.ContainsKey("web_login_key"))
{
passwd = "$1$" + requestData["web_login_key"].ToString();
m_log.InfoFormat("[LOGIN]: XMLRPC Login Req key {0}", passwd);
}
string startLocation = string.Empty;
UUID scopeID = UUID.Zero;
if (requestData["scope_id"] != null)
@ -103,7 +114,7 @@ namespace OpenSim.Server.Handlers.Login
string id0 = "Unknown";
if (requestData.Contains("id0") && requestData["id0"] != null)
id0 = requestData["id0"].ToString();
//m_log.InfoFormat("[LOGIN]: XMLRPC Login Requested for {0} {1}, starting in {2}, using {3}", first, last, startLocation, clientVersion);
LoginResponse reply = null;

View File

@ -31,6 +31,9 @@ using OpenSim.Services.Interfaces;
using log4net;
using Nini.Config;
using System.Reflection;
using OpenSim.Data;
using OpenSim.Framework;
using OpenSim.Framework.Console;
namespace OpenSim.Services.AuthenticationService
{
@ -43,17 +46,45 @@ namespace OpenSim.Services.AuthenticationService
public class WebkeyAuthenticationService :
AuthenticationServiceBase, IAuthenticationService
{
// private static readonly ILog m_log =
// LogManager.GetLogger(
// MethodBase.GetCurrentMethod().DeclaringType);
private static readonly ILog m_log =
LogManager.GetLogger(
MethodBase.GetCurrentMethod().DeclaringType);
public WebkeyAuthenticationService(IConfigSource config) :
base(config)
base(config)
{
}
public string Authenticate(UUID principalID, string password, int lifetime)
{
if (new UUID(password) == UUID.Zero)
{
m_log.DebugFormat("[AUTH SERVICE]: UUID.Zero is not a valid web_login_key on PrincipalID {0}", principalID);
}
else
{
AuthenticationData data = m_Database.Get(principalID);
if (data != null && data.Data != null)
{
if (data.Data.ContainsKey("webLoginKey"))
{
string key = data.Data["webLoginKey"].ToString();
if (key == password)
{
data.Data["webLoginKey"] = UUID.Zero.ToString();
m_Database.Store(data);
return GetToken(principalID, lifetime);
}
else
{
m_log.DebugFormat("[AUTH SERVICE]: web login auth failed, got PrincipalID {0} gave {1} instead of {2}", principalID, password, key);
}
}else{
m_log.DebugFormat("[AUTH SERVICE]: no col webLoginKey in passwd.db");
}
}
m_log.DebugFormat("[AUTH SERVICE]: PrincipalID {0} or its data not found", principalID);
}
return String.Empty;
}
}

View File

@ -0,0 +1,94 @@
/*
* 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.
*/
using System;
using System.Collections.Generic;
using OpenMetaverse;
using OpenSim.Services.Interfaces;
using log4net;
using Nini.Config;
using System.Reflection;
using OpenSim.Data;
using OpenSim.Framework;
using OpenSim.Framework.Console;
using OpenSim.Server.Base;
namespace OpenSim.Services.AuthenticationService
{
public class WebkeyOrPasswordAuthenticationService : AuthenticationServiceBase, IAuthenticationService
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private IConfigSource m_config;
private Dictionary<string, IAuthenticationService> m_svcChecks
= new Dictionary<string, IAuthenticationService>();
public WebkeyOrPasswordAuthenticationService(IConfigSource config)
: base(config)
{
this.m_config = config;
m_svcChecks["web_login_key"] = new WebkeyAuthenticationService(config);
m_svcChecks["password"] = new PasswordAuthenticationService(config);
}
public string Authenticate(UUID principalID, string password, int lifetime)
{
AuthenticationData data = m_Database.Get(principalID);
string result = String.Empty;
if (data != null && data.Data != null)
{
if (data.Data.ContainsKey("webLoginKey"))
{
m_log.DebugFormat("[AUTH SERVICE]: Attempting web key authentication for PrincipalID {0}", principalID);
result = m_svcChecks["web_login_key"].Authenticate(principalID, password, lifetime);
if (result == String.Empty)
{
m_log.DebugFormat("[AUTH SERVICE]: Web Login failed for PrincipalID {0}", principalID);
}
}
if (result == string.Empty && data.Data.ContainsKey("passwordHash") && data.Data.ContainsKey("passwordSalt"))
{
m_log.DebugFormat("[AUTH SERVICE]: Attempting password authentication for PrincipalID {0}", principalID);
result = m_svcChecks["password"].Authenticate(principalID, password, lifetime);
if (result == String.Empty)
{
m_log.DebugFormat("[AUTH SERVICE]: Password login failed for PrincipalID {0}", principalID);
}
}
if (result == string.Empty)
{
m_log.DebugFormat("[AUTH SERVICE]: Both password and webLoginKey-based authentication failed for PrincipalID {0}", principalID);
}
}
else
{
m_log.DebugFormat("[AUTH SERVICE]: PrincipalID {0} or its data not found", principalID);
}
return result;
}
}
}

View File

@ -90,6 +90,11 @@ namespace OpenSim.Services.Connectors
{
return m_database.LoadEstateSettings(estateID);
}
public List<EstateSettings> LoadEstateSettingsAll()
{
return m_database.LoadEstateSettingsAll();
}
public void StoreEstateSettings(EstateSettings es)
{
@ -100,6 +105,11 @@ namespace OpenSim.Services.Connectors
{
return m_database.GetEstates(search);
}
public List<int> GetEstatesAll()
{
return m_database.GetEstatesAll();
}
public bool LinkRegion(UUID regionID, int estateID)
{

View File

@ -79,9 +79,6 @@ namespace OpenSim.Services.Connectors.Simulation
return "agent/";
}
/// <summary>
///
/// </summary>
public bool CreateAgent(GridRegion destination, AgentCircuitData aCircuit, uint flags, out string reason)
{
// m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: CreateAgent start");
@ -109,6 +106,9 @@ namespace OpenSim.Services.Connectors.Simulation
if (result["Success"].AsBoolean())
return true;
m_log.WarnFormat(
"[REMOTE SIMULATION CONNECTOR]: Failed to create agent {0} {1} at remote simulator {1}",
aCircuit.firstname, aCircuit.lastname, destination.RegionName);
reason = result["Message"] != null ? result["Message"].AsString() : "error";
return false;
}

View File

@ -65,6 +65,8 @@ namespace OpenSim.Services.GridService
protected UUID m_ScopeID = UUID.Zero;
protected bool m_Check4096 = true;
protected string m_MapTileDirectory = string.Empty;
protected string m_ThisGatekeeper = string.Empty;
protected Uri m_ThisGatekeeperURI = null;
// Hyperlink regions are hyperlinks on the map
public readonly Dictionary<UUID, GridRegion> m_HyperlinkRegions = new Dictionary<UUID, GridRegion>();
@ -123,6 +125,16 @@ namespace OpenSim.Services.GridService
m_MapTileDirectory = gridConfig.GetString("MapTileDirectory", "maptiles");
m_ThisGatekeeper = gridConfig.GetString("Gatekeeper", string.Empty);
try
{
m_ThisGatekeeperURI = new Uri(m_ThisGatekeeper);
}
catch
{
m_log.WarnFormat("[HYPERGRID LINKER]: Malformed URL in [GridService], variable Gatekeeper = {0}", m_ThisGatekeeper);
}
m_GatekeeperConnector = new GatekeeperServiceConnector(m_AssetService);
m_log.Debug("[HYPERGRID LINKER]: Loaded all services...");
@ -246,6 +258,8 @@ namespace OpenSim.Services.GridService
remoteRegionName, xloc / Constants.RegionSize, yloc / Constants.RegionSize);
reason = string.Empty;
Uri uri = null;
regInfo = new GridRegion();
if ( externalPort > 0)
regInfo.HttpPort = externalPort;
@ -256,8 +270,17 @@ namespace OpenSim.Services.GridService
else
regInfo.ExternalHostName = "0.0.0.0";
if ( serverURI != null)
{
regInfo.ServerURI = serverURI;
try
{
uri = new Uri(serverURI);
regInfo.ExternalHostName = uri.Host;
regInfo.HttpPort = (uint)uri.Port;
}
catch {}
}
if ( remoteRegionName != string.Empty )
regInfo.RegionName = remoteRegionName;
@ -266,6 +289,18 @@ namespace OpenSim.Services.GridService
regInfo.ScopeID = scopeID;
regInfo.EstateOwner = ownerID;
// Make sure we're not hyperlinking to regions on this grid!
if (m_ThisGatekeeperURI != null)
{
if (regInfo.ExternalHostName == m_ThisGatekeeperURI.Host && regInfo.HttpPort == m_ThisGatekeeperURI.Port)
{
reason = "Cannot hyperlink to regions on the same grid";
return false;
}
}
else
m_log.WarnFormat("[HYPERGRID LINKER]: Please set this grid's Gatekeeper's address in [GridService]!");
// Check for free coordinates
GridRegion region = m_GridService.GetRegionByPosition(regInfo.ScopeID, regInfo.RegionLocX, regInfo.RegionLocY);
if (region != null)

View File

@ -40,6 +40,13 @@ namespace OpenSim.Services.Interfaces
#region Agents
/// <summary>
/// Ask the simulator hosting the destination to create an agent on that region.
/// </summary>
/// <param name="destination"></param>
/// <param name="aCircuit"></param>
/// <param name="flags"></param>
/// <param name="reason">Reason message in the event of a failure.</param>
bool CreateAgent(GridRegion destination, AgentCircuitData aCircuit, uint flags, out string reason);
/// <summary>

View File

@ -27,6 +27,7 @@
using System;
using NUnit.Framework;
using NUnit.Framework.Constraints;
namespace OpenSim.Tests.Common
{

View File

@ -964,7 +964,7 @@ namespace OpenSim.Tests.Common.Mock
{
}
public void SendLandProperties(int sequence_id, bool snap_selection, int request_result, LandData landData, float simObjectBonusFactor, int parcelObjectCapacity, int simObjectCapacity, uint regionFlags)
public void SendLandProperties(int sequence_id, bool snap_selection, int request_result, ILandObject lo, float simObjectBonusFactor, int parcelObjectCapacity, int simObjectCapacity, uint regionFlags)
{
}

View File

@ -68,7 +68,7 @@ namespace OpenSim.Tests.Common
return CreateAsset(
assetUuid,
AssetType.Object,
Encoding.ASCII.GetBytes(SceneObjectSerializer.ToXml2Format(sog)),
Encoding.ASCII.GetBytes(SceneObjectSerializer.ToOriginalXmlFormat(sog)),
sog.OwnerID);
}

View File

@ -57,21 +57,12 @@ namespace OpenSim.Tests.Common.Setup
/// </summary>
public class SceneSetupHelpers
{
// These static variables in order to allow regions to be linked by shared modules and same
// CommunicationsManager.
private static ISharedRegionModule m_assetService = null;
// private static ISharedRegionModule m_authenticationService = null;
private static ISharedRegionModule m_inventoryService = null;
private static ISharedRegionModule m_gridService = null;
private static ISharedRegionModule m_userAccountService = null;
private static ISharedRegionModule m_presenceService = null;
/// <summary>
/// Set up a test scene
/// </summary>
///
/// <remarks>
/// Automatically starts service threads, as would the normal runtime.
///
/// </remarks>
/// <returns></returns>
public static TestScene SetupScene()
{
@ -86,24 +77,9 @@ namespace OpenSim.Tests.Common.Setup
/// <returns></returns>
public static TestScene SetupScene(String realServices)
{
return SetupScene(
"Unit test region", UUID.Random(), 1000, 1000, realServices);
return SetupScene("Unit test region", UUID.Random(), 1000, 1000, realServices);
}
// REFACTORING PROBLEM. No idea what the difference is with the previous one
///// <summary>
///// Set up a test scene
///// </summary>
/////
///// <param name="realServices">Starts real inventory and asset services, as opposed to mock ones, if true</param>
///// <param name="cm">This should be the same if simulating two scenes within a standalone</param>
///// <returns></returns>
//public static TestScene SetupScene(String realServices)
//{
// return SetupScene(
// "Unit test region", UUID.Random(), 1000, 1000, "");
//}
/// <summary>
/// Set up a test scene
/// </summary>
@ -115,7 +91,7 @@ namespace OpenSim.Tests.Common.Setup
/// <returns></returns>
public static TestScene SetupScene(string name, UUID id, uint x, uint y)
{
return SetupScene(name, id, x, y,"");
return SetupScene(name, id, x, y, "");
}
/// <summary>
@ -156,27 +132,21 @@ namespace OpenSim.Tests.Common.Setup
testScene.AddModule(godsModule.Name, godsModule);
realServices = realServices.ToLower();
if (realServices.Contains("asset"))
StartAssetService(testScene, true);
else
StartAssetService(testScene, false);
LocalAssetServicesConnector assetService = StartAssetService(testScene, realServices.Contains("asset"));
// For now, always started a 'real' authentication service
StartAuthenticationService(testScene, true);
if (realServices.Contains("inventory"))
StartInventoryService(testScene, true);
else
StartInventoryService(testScene, false);
LocalInventoryServicesConnector inventoryService = StartInventoryService(testScene, realServices.Contains("inventory"));
StartGridService(testScene, true);
LocalUserAccountServicesConnector userAccountService = StartUserAccountService(testScene);
LocalPresenceServicesConnector presenceService = StartPresenceService(testScene);
StartGridService(testScene, true);
StartUserAccountService(testScene);
StartPresenceService(testScene);
m_inventoryService.PostInitialise();
m_assetService.PostInitialise();
m_userAccountService.PostInitialise();
m_presenceService.PostInitialise();
inventoryService.PostInitialise();
assetService.PostInitialise();
userAccountService.PostInitialise();
presenceService.PostInitialise();
testScene.RegionInfo.EstateSettings.EstateOwner = UUID.Random();
testScene.SetModuleInterfaces();
@ -188,24 +158,15 @@ namespace OpenSim.Tests.Common.Setup
testScene.PhysicsScene
= physicsPluginManager.GetPhysicsScene("basicphysics", "ZeroMesher", new IniConfigSource(), "test");
// It's really not a good idea to use static variables as they carry over between tests, leading to
// problems that are extremely hard to debug. Really, these static fields need to be eliminated -
// tests using multiple regions that need to share modules need to find another solution.
m_assetService = null;
m_inventoryService = null;
m_gridService = null;
m_userAccountService = null;
m_presenceService = null;
testScene.RegionInfo.EstateSettings = new EstateSettings();
testScene.LoginsDisabled = false;
return testScene;
}
private static void StartAssetService(Scene testScene, bool real)
private static LocalAssetServicesConnector StartAssetService(Scene testScene, bool real)
{
ISharedRegionModule assetService = new LocalAssetServicesConnector();
LocalAssetServicesConnector assetService = new LocalAssetServicesConnector();
IConfigSource config = new IniConfigSource();
config.AddConfig("Modules");
config.AddConfig("AssetService");
@ -219,7 +180,8 @@ namespace OpenSim.Tests.Common.Setup
assetService.AddRegion(testScene);
assetService.RegionLoaded(testScene);
testScene.AddRegionModule(assetService.Name, assetService);
m_assetService = assetService;
return assetService;
}
private static void StartAuthenticationService(Scene testScene, bool real)
@ -243,9 +205,9 @@ namespace OpenSim.Tests.Common.Setup
//m_authenticationService = service;
}
private static void StartInventoryService(Scene testScene, bool real)
private static LocalInventoryServicesConnector StartInventoryService(Scene testScene, bool real)
{
ISharedRegionModule inventoryService = new LocalInventoryServicesConnector();
LocalInventoryServicesConnector inventoryService = new LocalInventoryServicesConnector();
IConfigSource config = new IniConfigSource();
config.AddConfig("Modules");
config.AddConfig("InventoryService");
@ -265,10 +227,11 @@ namespace OpenSim.Tests.Common.Setup
inventoryService.AddRegion(testScene);
inventoryService.RegionLoaded(testScene);
testScene.AddRegionModule(inventoryService.Name, inventoryService);
m_inventoryService = inventoryService;
return inventoryService;
}
private static void StartGridService(Scene testScene, bool real)
private static LocalGridServicesConnector StartGridService(Scene testScene, bool real)
{
IConfigSource config = new IniConfigSource();
config.AddConfig("Modules");
@ -277,24 +240,25 @@ namespace OpenSim.Tests.Common.Setup
config.Configs["GridService"].Set("StorageProvider", "OpenSim.Data.Null.dll:NullRegionData");
if (real)
config.Configs["GridService"].Set("LocalServiceModule", "OpenSim.Services.GridService.dll:GridService");
if (m_gridService == null)
{
ISharedRegionModule gridService = new LocalGridServicesConnector();
gridService.Initialise(config);
m_gridService = gridService;
}
LocalGridServicesConnector gridService = new LocalGridServicesConnector();
gridService.Initialise(config);
//else
// config.Configs["GridService"].Set("LocalServiceModule", "OpenSim.Tests.Common.dll:TestGridService");
m_gridService.AddRegion(testScene);
m_gridService.RegionLoaded(testScene);
gridService.AddRegion(testScene);
gridService.RegionLoaded(testScene);
//testScene.AddRegionModule(m_gridService.Name, m_gridService);
return gridService;
}
/// <summary>
/// Start a user account service
/// </summary>
/// <param name="testScene"></param>
private static void StartUserAccountService(Scene testScene)
/// <returns></returns>
private static LocalUserAccountServicesConnector StartUserAccountService(Scene testScene)
{
IConfigSource config = new IniConfigSource();
config.AddConfig("Modules");
@ -304,23 +268,21 @@ namespace OpenSim.Tests.Common.Setup
config.Configs["UserAccountService"].Set(
"LocalServiceModule", "OpenSim.Services.UserAccountService.dll:UserAccountService");
if (m_userAccountService == null)
{
ISharedRegionModule userAccountService = new LocalUserAccountServicesConnector();
userAccountService.Initialise(config);
m_userAccountService = userAccountService;
}
LocalUserAccountServicesConnector userAccountService = new LocalUserAccountServicesConnector();
userAccountService.Initialise(config);
m_userAccountService.AddRegion(testScene);
m_userAccountService.RegionLoaded(testScene);
testScene.AddRegionModule(m_userAccountService.Name, m_userAccountService);
userAccountService.AddRegion(testScene);
userAccountService.RegionLoaded(testScene);
testScene.AddRegionModule(userAccountService.Name, userAccountService);
return userAccountService;
}
/// <summary>
/// Start a presence service
/// </summary>
/// <param name="testScene"></param>
private static void StartPresenceService(Scene testScene)
private static LocalPresenceServicesConnector StartPresenceService(Scene testScene)
{
IConfigSource config = new IniConfigSource();
config.AddConfig("Modules");
@ -330,16 +292,14 @@ namespace OpenSim.Tests.Common.Setup
config.Configs["PresenceService"].Set(
"LocalServiceModule", "OpenSim.Services.PresenceService.dll:PresenceService");
if (m_presenceService == null)
{
ISharedRegionModule presenceService = new LocalPresenceServicesConnector();
presenceService.Initialise(config);
m_presenceService = presenceService;
}
LocalPresenceServicesConnector presenceService = new LocalPresenceServicesConnector();
presenceService.Initialise(config);
m_presenceService.AddRegion(testScene);
m_presenceService.RegionLoaded(testScene);
testScene.AddRegionModule(m_presenceService.Name, m_presenceService);
presenceService.AddRegion(testScene);
presenceService.RegionLoaded(testScene);
testScene.AddRegionModule(presenceService.Name, presenceService);
return presenceService;
}
/// <summary>
@ -436,7 +396,7 @@ namespace OpenSim.Tests.Common.Setup
/// <summary>
/// Add a root agent.
/// </summary>
///
/// <remarks>
/// This function
///
/// 1) Tells the scene that an agent is coming. Normally, the login service (local if standalone, from the
@ -447,7 +407,7 @@ namespace OpenSim.Tests.Common.Setup
///
/// This function performs actions equivalent with notifying the scene that an agent is
/// coming and then actually connecting the agent to the scene. The one step missed out is the very first
///
/// </remarks>
/// <param name="scene"></param>
/// <param name="agentData"></param>
/// <returns></returns>
@ -494,9 +454,7 @@ namespace OpenSim.Tests.Common.Setup
/// <returns></returns>
public static SceneObjectPart AddSceneObject(Scene scene, string name)
{
SceneObjectPart part
= new SceneObjectPart(UUID.Zero, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero);
part.Name = name;
SceneObjectPart part = CreateSceneObjectPart(name, UUID.Random(), UUID.Zero);
//part.UpdatePrimFlags(false, false, true);
//part.ObjectFlags |= (uint)PrimFlags.Phantom;
@ -505,5 +463,62 @@ namespace OpenSim.Tests.Common.Setup
return part;
}
/// <summary>
/// Create a scene object part.
/// </summary>
/// <param name="name"></param>
/// <param name="id"></param>
/// <param name="ownerId"></param>
/// <returns></returns>
public static SceneObjectPart CreateSceneObjectPart(string name, UUID id, UUID ownerId)
{
return new SceneObjectPart(
ownerId, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero)
{ Name = name, UUID = id };
}
/// <summary>
/// Create a scene object but do not add it to the scene.
/// </summary>
/// <remarks>
/// UUID always starts at 00000000-0000-0000-0000-000000000001
/// </remarks>
/// <param name="parts">The number of parts that should be in the scene object</param>
/// <param name="ownerId"></param>
/// <returns></returns>
public static SceneObjectGroup CreateSceneObject(int parts, UUID ownerId)
{
return CreateSceneObject(parts, ownerId, 0x1);
}
/// <summary>
/// Create a scene object but do not add it to the scene.
/// </summary>
/// <param name="parts">The number of parts that should be in the scene object</param>
/// <param name="ownerId"></param>
/// <param name="uuidTail">
/// The hexadecimal last part of the UUID for parts created. A UUID of the form "00000000-0000-0000-0000-{0:XD12}"
/// will be given to the root part, and incremented for each part thereafter.
/// </param>
/// <returns></returns>
public static SceneObjectGroup CreateSceneObject(int parts, UUID ownerId, int uuidTail)
{
string rawSogId = string.Format("00000000-0000-0000-0000-{0:X12}", uuidTail);
SceneObjectGroup sog
= new SceneObjectGroup(
CreateSceneObjectPart("part0", new UUID(rawSogId), ownerId));
if (parts > 1)
for (int i = 1; i < parts; i++)
sog.AddPart(
CreateSceneObjectPart(
string.Format("obj{0}", i),
new UUID(string.Format("00000000-0000-0000-0000-{0:X12}", uuidTail + i)),
ownerId));
return sog;
}
}
}
}

View File

@ -27,11 +27,10 @@
using System;
using System.Diagnostics;
using NUnit.Framework;
namespace OpenSim.Tests.Common
{
public delegate void TestDelegate();
public class TestHelper
{
public static bool AssertThisDelegateCausesArgumentException(TestDelegate d)

View File

@ -28,6 +28,7 @@
using System;
using OpenMetaverse;
using NUnit.Framework;
using NUnit.Framework.Constraints;
namespace OpenSim.Tests.Common
{

View File

@ -2,23 +2,14 @@
== Running Tests ==
On Linux:
On Linux you will need to have NUnit installed (http://www.nunit.org).
This is commonly available in distribution package repositories.
When this is installed, run the command
> nant test
This will print out to the console the test state.
On Windows: Please see the TESTING ON WINDOWS section below.
Also, every checkin will run tests that are kicked off by bamboo.
Results are posted here: http://www.opensimulator.org:8085/ as well as
to #opensim-dev IRC channel.
== Writing Tests ==
Tests are written to run under NUnit. For more information on NUnit
please see: http://www.nunit.org/index.php
Please see the TESTING ON WINDOWS section below for Windows instructions.
== Adding Tests ==
@ -32,70 +23,15 @@ that if you are writing tests they end up in a "Tests" sub-directory
of the directory where the code you are testing resides.
If you have added a new test assembly that hasn't existed before you
must list it in both ".nant/local.include" and ".nant/bamboo.build"
must list it in both ".nant/local.include"
for it to be accessible to Linux users and to the continuous
integration system.
=== The Gory Details ===
The following is the original document which started off this
document. It should probably be better integrated with the new info.
==UPDATE==
The text immediately following is an update to the testing documentation. The
update is written on 2008.08.30 and is copied from an email to the opensim-dev
mailing list[1]. The information below the update, beginning with the section
titled TESTING, is still relevant, so please read this document in its
entirety.
Mike Mazur
[1] https://lists.berlios.de/pipermail/opensim-dev/2008-August/002695.html
"""
The tests are contained in certain DLLs. At the time of writing, these DLLs
have tests in them:
OpenSim.Region.ScriptEngine.Common.Tests.dll
OpenSim.Region.ScriptEngine.Shared.CodeTools.Tests.dll
OpenSim.Region.ScriptEngine.Shared.Tests.dll
OpenSim.Framework.Tests.dll OpenSim.Region.CoreModules.dll
OpenSim.Region.Physics.OdePlugin.dll[2]
The console command used to run the tests is `nunit-console` (or
`nunit-console2` on some systems). This command takes a listing of DLLs to
inspect for tests.
Currently Bamboo's[3] build file (.nant/bamboo.build) lists only those DLLs
for nunit-console to use. However it would be equally correct to simply pass
in all DLLs in bin/; those without tests are just skipped.
The nunit-console command generates a file TestResults.txt by default. This is
an XML file containing a listing of all DLLs inspected, tests executed,
successes, failures, etc. If nunit-console is passed in all DLLs in bin/, this
file bloats with lots of entries like this:
<test-suite name="/home/mike/source/workspace/bin/OpenSim.Grid.Communications.OGS1.dll" success="True" time="0.000" asserts="0">
<results />
</test-suite>
<test-suite name="/home/mike/source/workspace/bin/OpenSim.Region.ClientStack.dll" success="True" time="0.000" asserts="0">
<results />
</test-suite>
Therefore it makes more sense to me to specify the DLLs when running
nunit-console.
[2] Note that OpenSim.Region.Physics.OdePlugin.dll is in bin/Physics/ and
needs to be first copied to bin/ before nunit-console is executed.
[3] http://opensimulator.org:8085/
"""
==TESTING ON WINDOWS==
To use nunit testing on opensim code, you have a variety of methods. The
easiast methods involve using IDE capabilities to test code. Using
VS2005/2008 I recommend using the testing capabilities of Resarper(commercial)
VS2005/2008 I recommend using the testing capabilities of Resharper(commercial)
or TestDriven.Net(free). Both will recognize nunit tests within your
application and allow you to test them individually, or all at once, etc. You
will also be able to step into debug mode into a test through these add-ins
@ -133,6 +69,3 @@ Example
nunit-console2 OpenSim.Framework.Tests.dll (on linux)
nunit-console OpenSim.Framework.Tests.dll (on windows)
For more information on testing contact the autor of this testing readme: Daedius Moskvitch ( daedius @@@@ daedius com)

View File

@ -0,0 +1,4 @@
<configuration>
<dllmap os="!windows,osx" cpu="x86-64,ia64" wordsize="64" dll="sqlite3" target="./libsqlite3_64.so" />
<dllmap os="!windows,osx" cpu="x86" wordsize="32" dll="sqlite3" target="./libsqlite3_32.so" />
</configuration>

Binary file not shown.

View File

@ -45,6 +45,12 @@
;; Directory for map tile images of linked regions
; MapTileDirectory = "./maptiles"
; === HG ONLY ===
;; change this to the address of your Gatekeeper service
;; (usually bundled with the rest of the services in one
;; Robust server in port 8002, but not always)
Gatekeeper="http://mygridserver.com:8002"
[AvatarService]
;
; change this to your grid-wide grid server

Some files were not shown because too many files have changed in this diff Show More