mirror of
https://github.com/opensim/opensim.git
synced 2026-08-08 10:15:33 +08:00
Merge branch 'master' into careminster-presence-refactor
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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++)
|
||||
|
||||
@@ -35,10 +35,6 @@ using OpenSim.Framework;
|
||||
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 +47,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 +62,6 @@ namespace OpenSim.Data.Tests
|
||||
{
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
public class AssetTests<TConn, TAssetData> : BasicDataServiceTest<TConn, TAssetData>
|
||||
where TConn : DbConnection, new()
|
||||
where TAssetData : AssetDataBase, new()
|
||||
@@ -218,4 +202,4 @@ namespace OpenSim.Data.Tests
|
||||
Assert.That(a3a, Constraints.PropertyCompareConstraint(a3));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -28,7 +28,6 @@
|
||||
using System;
|
||||
using log4net.Config;
|
||||
using NUnit.Framework;
|
||||
using NUnit.Framework.SyntaxHelpers;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
@@ -49,15 +48,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 +63,6 @@ namespace OpenSim.Data.Tests
|
||||
{
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
public class EstateTests<TConn, TEstateStore> : BasicDataServiceTest<TConn, TEstateStore>
|
||||
where TConn : DbConnection, new()
|
||||
where TEstateStore : class, IEstateDataStore, new()
|
||||
@@ -520,6 +508,5 @@ namespace OpenSim.Data.Tests
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -25,12 +25,9 @@
|
||||
* 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 log4net;
|
||||
@@ -49,14 +46,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 +60,6 @@ namespace OpenSim.Data.Tests
|
||||
public class MSSQLInventoryTests : InventoryTests<SqlConnection, MSSQLInventoryData>
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
public class InventoryTests<TConn, TInvStore> : BasicDataServiceTest<TConn, TInvStore>
|
||||
where TConn : DbConnection, new()
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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>
|
||||
{
|
||||
|
||||
@@ -31,7 +31,6 @@ 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;
|
||||
@@ -52,14 +51,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 +66,6 @@ namespace OpenSim.Data.Tests
|
||||
{
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
public class RegionTests<TConn, TRegStore> : BasicDataServiceTest<TConn, TRegStore>
|
||||
where TConn : DbConnection, new()
|
||||
where TRegStore : class, ISimulationDataStore, new()
|
||||
|
||||
Reference in New Issue
Block a user