aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data
diff options
context:
space:
mode:
authorBlueWall2011-03-21 22:06:43 -0400
committerBlueWall2011-03-21 22:06:43 -0400
commite3c327a305dcf795f372b940f34538a19bf92218 (patch)
treeb034355a12c4d87410809aa19bf6015e611e1e22 /OpenSim/Data
parentMerge branch 'master' of /home/opensim/src/OpenSim/Core (diff)
parentThanks Kevin Cozens for a patch that: (diff)
downloadopensim-SC-e3c327a305dcf795f372b940f34538a19bf92218.zip
opensim-SC-e3c327a305dcf795f372b940f34538a19bf92218.tar.gz
opensim-SC-e3c327a305dcf795f372b940f34538a19bf92218.tar.bz2
opensim-SC-e3c327a305dcf795f372b940f34538a19bf92218.tar.xz
Merge branch 'master' of /home/opensim/src/OpenSim/Core
Diffstat (limited to 'OpenSim/Data')
-rw-r--r--OpenSim/Data/MySQL/MySQLAssetData.cs10
-rw-r--r--OpenSim/Data/MySQL/MySQLAuthenticationData.cs8
-rw-r--r--OpenSim/Data/MySQL/MySQLEstateData.cs8
-rw-r--r--OpenSim/Data/MySQL/MySQLGenericTableHandler.cs7
-rw-r--r--OpenSim/Data/MySQL/MySQLRegionData.cs9
-rw-r--r--OpenSim/Data/MySQL/MySQLSimulationData.cs8
-rw-r--r--OpenSim/Data/Null/NullRegionData.cs48
-rw-r--r--OpenSim/Data/Null/NullUserAccountData.cs65
-rw-r--r--OpenSim/Data/Tests/AssetTests.cs25
-rw-r--r--OpenSim/Data/Tests/EstateTests.cs32
-rw-r--r--OpenSim/Data/Tests/InventoryTests.cs41
-rw-r--r--OpenSim/Data/Tests/PropertyCompareConstraint.cs1
-rw-r--r--OpenSim/Data/Tests/PropertyScrambler.cs2
-rw-r--r--OpenSim/Data/Tests/RegionTests.cs99
14 files changed, 240 insertions, 123 deletions
diff --git a/OpenSim/Data/MySQL/MySQLAssetData.cs b/OpenSim/Data/MySQL/MySQLAssetData.cs
index ed92f3e..e740232 100644
--- a/OpenSim/Data/MySQL/MySQLAssetData.cs
+++ b/OpenSim/Data/MySQL/MySQLAssetData.cs
@@ -47,6 +47,11 @@ namespace OpenSim.Data.MySQL
47 private string m_connectionString; 47 private string m_connectionString;
48 private object m_dbLock = new object(); 48 private object m_dbLock = new object();
49 49
50 protected virtual Assembly Assembly
51 {
52 get { return GetType().Assembly; }
53 }
54
50 #region IPlugin Members 55 #region IPlugin Members
51 56
52 public override string Version { get { return "1.0.0.0"; } } 57 public override string Version { get { return "1.0.0.0"; } }
@@ -66,13 +71,10 @@ namespace OpenSim.Data.MySQL
66 { 71 {
67 m_connectionString = connect; 72 m_connectionString = connect;
68 73
69 // This actually does the roll forward assembly stuff
70 Assembly assem = GetType().Assembly;
71
72 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) 74 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
73 { 75 {
74 dbcon.Open(); 76 dbcon.Open();
75 Migration m = new Migration(dbcon, assem, "AssetStore"); 77 Migration m = new Migration(dbcon, Assembly, "AssetStore");
76 m.Update(); 78 m.Update();
77 } 79 }
78 } 80 }
diff --git a/OpenSim/Data/MySQL/MySQLAuthenticationData.cs b/OpenSim/Data/MySQL/MySQLAuthenticationData.cs
index 5056aee..8d82f61 100644
--- a/OpenSim/Data/MySQL/MySQLAuthenticationData.cs
+++ b/OpenSim/Data/MySQL/MySQLAuthenticationData.cs
@@ -28,6 +28,7 @@
28using System; 28using System;
29using System.Collections; 29using System.Collections;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Reflection;
31using System.Data; 32using System.Data;
32using OpenMetaverse; 33using OpenMetaverse;
33using OpenSim.Framework; 34using OpenSim.Framework;
@@ -42,6 +43,11 @@ namespace OpenSim.Data.MySQL
42 private int m_LastExpire; 43 private int m_LastExpire;
43 // private string m_connectionString; 44 // private string m_connectionString;
44 45
46 protected virtual Assembly Assembly
47 {
48 get { return GetType().Assembly; }
49 }
50
45 public MySqlAuthenticationData(string connectionString, string realm) 51 public MySqlAuthenticationData(string connectionString, string realm)
46 : base(connectionString) 52 : base(connectionString)
47 { 53 {
@@ -51,7 +57,7 @@ namespace OpenSim.Data.MySQL
51 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) 57 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
52 { 58 {
53 dbcon.Open(); 59 dbcon.Open();
54 Migration m = new Migration(dbcon, GetType().Assembly, "AuthStore"); 60 Migration m = new Migration(dbcon, Assembly, "AuthStore");
55 m.Update(); 61 m.Update();
56 } 62 }
57 } 63 }
diff --git a/OpenSim/Data/MySQL/MySQLEstateData.cs b/OpenSim/Data/MySQL/MySQLEstateData.cs
index c42c687..de72a6a 100644
--- a/OpenSim/Data/MySQL/MySQLEstateData.cs
+++ b/OpenSim/Data/MySQL/MySQLEstateData.cs
@@ -54,6 +54,11 @@ namespace OpenSim.Data.MySQL
54 private Dictionary<string, FieldInfo> m_FieldMap = 54 private Dictionary<string, FieldInfo> m_FieldMap =
55 new Dictionary<string, FieldInfo>(); 55 new Dictionary<string, FieldInfo>();
56 56
57 protected virtual Assembly Assembly
58 {
59 get { return GetType().Assembly; }
60 }
61
57 public MySQLEstateStore() 62 public MySQLEstateStore()
58 { 63 {
59 } 64 }
@@ -82,8 +87,7 @@ namespace OpenSim.Data.MySQL
82 { 87 {
83 dbcon.Open(); 88 dbcon.Open();
84 89
85 Assembly assem = GetType().Assembly; 90 Migration m = new Migration(dbcon, Assembly, "EstateStore");
86 Migration m = new Migration(dbcon, assem, "EstateStore");
87 m.Update(); 91 m.Update();
88 92
89 Type t = typeof(EstateSettings); 93 Type t = typeof(EstateSettings);
diff --git a/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs b/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs
index 7c23a47..8efe4e9 100644
--- a/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs
+++ b/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs
@@ -46,6 +46,11 @@ namespace OpenSim.Data.MySQL
46 protected string m_Realm; 46 protected string m_Realm;
47 protected FieldInfo m_DataField = null; 47 protected FieldInfo m_DataField = null;
48 48
49 protected virtual Assembly Assembly
50 {
51 get { return GetType().Assembly; }
52 }
53
49 public MySQLGenericTableHandler(string connectionString, 54 public MySQLGenericTableHandler(string connectionString,
50 string realm, string storeName) : base(connectionString) 55 string realm, string storeName) : base(connectionString)
51 { 56 {
@@ -57,7 +62,7 @@ namespace OpenSim.Data.MySQL
57 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) 62 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
58 { 63 {
59 dbcon.Open(); 64 dbcon.Open();
60 Migration m = new Migration(dbcon, GetType().Assembly, storeName); 65 Migration m = new Migration(dbcon, Assembly, storeName);
61 m.Update(); 66 m.Update();
62 } 67 }
63 } 68 }
diff --git a/OpenSim/Data/MySQL/MySQLRegionData.cs b/OpenSim/Data/MySQL/MySQLRegionData.cs
index d04e3dc..c20c392 100644
--- a/OpenSim/Data/MySQL/MySQLRegionData.cs
+++ b/OpenSim/Data/MySQL/MySQLRegionData.cs
@@ -29,6 +29,8 @@ using System;
29using System.Collections; 29using System.Collections;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Data; 31using System.Data;
32using System.Reflection;
33
32using OpenMetaverse; 34using OpenMetaverse;
33using OpenSim.Framework; 35using OpenSim.Framework;
34using OpenSim.Data; 36using OpenSim.Data;
@@ -42,6 +44,11 @@ namespace OpenSim.Data.MySQL
42 private List<string> m_ColumnNames; 44 private List<string> m_ColumnNames;
43 //private string m_connectionString; 45 //private string m_connectionString;
44 46
47 protected virtual Assembly Assembly
48 {
49 get { return GetType().Assembly; }
50 }
51
45 public MySqlRegionData(string connectionString, string realm) 52 public MySqlRegionData(string connectionString, string realm)
46 : base(connectionString) 53 : base(connectionString)
47 { 54 {
@@ -51,7 +58,7 @@ namespace OpenSim.Data.MySQL
51 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) 58 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
52 { 59 {
53 dbcon.Open(); 60 dbcon.Open();
54 Migration m = new Migration(dbcon, GetType().Assembly, "GridStore"); 61 Migration m = new Migration(dbcon, Assembly, "GridStore");
55 m.Update(); 62 m.Update();
56 } 63 }
57 } 64 }
diff --git a/OpenSim/Data/MySQL/MySQLSimulationData.cs b/OpenSim/Data/MySQL/MySQLSimulationData.cs
index 02997b3..e14d775 100644
--- a/OpenSim/Data/MySQL/MySQLSimulationData.cs
+++ b/OpenSim/Data/MySQL/MySQLSimulationData.cs
@@ -52,6 +52,11 @@ namespace OpenSim.Data.MySQL
52 private string m_connectionString; 52 private string m_connectionString;
53 private object m_dbLock = new object(); 53 private object m_dbLock = new object();
54 54
55 protected virtual Assembly Assembly
56 {
57 get { return GetType().Assembly; }
58 }
59
55 public MySQLSimulationData() 60 public MySQLSimulationData()
56 { 61 {
57 } 62 }
@@ -71,8 +76,7 @@ namespace OpenSim.Data.MySQL
71 76
72 // Apply new Migrations 77 // Apply new Migrations
73 // 78 //
74 Assembly assem = GetType().Assembly; 79 Migration m = new Migration(dbcon, Assembly, "RegionStore");
75 Migration m = new Migration(dbcon, assem, "RegionStore");
76 m.Update(); 80 m.Update();
77 81
78 // Clean dropped attachments 82 // Clean dropped attachments
diff --git a/OpenSim/Data/Null/NullRegionData.cs b/OpenSim/Data/Null/NullRegionData.cs
index 2065355..53e5207 100644
--- a/OpenSim/Data/Null/NullRegionData.cs
+++ b/OpenSim/Data/Null/NullRegionData.cs
@@ -51,28 +51,56 @@ namespace OpenSim.Data.Null
51 //Console.WriteLine("[XXX] NullRegionData constructor"); 51 //Console.WriteLine("[XXX] NullRegionData constructor");
52 } 52 }
53 53
54 private delegate bool Matcher(string value);
55
54 public List<RegionData> Get(string regionName, UUID scopeID) 56 public List<RegionData> Get(string regionName, UUID scopeID)
55 { 57 {
56 if (Instance != this) 58 if (Instance != this)
57 return Instance.Get(regionName, scopeID); 59 return Instance.Get(regionName, scopeID);
58 60
59 List<RegionData> ret = new List<RegionData>(); 61 string cleanName = regionName.ToLower();
60 62
61 foreach (RegionData r in m_regionData.Values) 63 // Handle SQL wildcards
64 const string wildcard = "%";
65 bool wildcardPrefix = false;
66 bool wildcardSuffix = false;
67 if (cleanName.Equals(wildcard))
62 { 68 {
63 if (regionName.Contains("%")) 69 wildcardPrefix = wildcardSuffix = true;
70 cleanName = string.Empty;
71 }
72 else
73 {
74 if (cleanName.StartsWith(wildcard))
64 { 75 {
65 string cleanname = regionName.Replace("%", ""); 76 wildcardPrefix = true;
66 m_log.DebugFormat("[NULL REGION DATA]: comparing {0} to {1}", cleanname.ToLower(), r.RegionName.ToLower()); 77 cleanName = cleanName.Substring(1);
67 if (r.RegionName.ToLower().Contains(cleanname.ToLower()))
68 ret.Add(r);
69 } 78 }
70 else 79 if (regionName.EndsWith(wildcard))
71 { 80 {
72 if (r.RegionName.ToLower() == regionName.ToLower()) 81 wildcardSuffix = true;
73 ret.Add(r); 82 cleanName = cleanName.Remove(cleanName.Length - 1);
74 } 83 }
75 } 84 }
85 Matcher queryMatch;
86 if (wildcardPrefix && wildcardSuffix)
87 queryMatch = delegate(string s) { return s.Contains(cleanName); };
88 else if (wildcardSuffix)
89 queryMatch = delegate(string s) { return s.StartsWith(cleanName); };
90 else if (wildcardPrefix)
91 queryMatch = delegate(string s) { return s.EndsWith(cleanName); };
92 else
93 queryMatch = delegate(string s) { return s.Equals(cleanName); };
94
95 // Find region data
96 List<RegionData> ret = new List<RegionData>();
97
98 foreach (RegionData r in m_regionData.Values)
99 {
100 m_log.DebugFormat("[NULL REGION DATA]: comparing {0} to {1}", cleanName, r.RegionName.ToLower());
101 if (queryMatch(r.RegionName.ToLower()))
102 ret.Add(r);
103 }
76 104
77 if (ret.Count > 0) 105 if (ret.Count > 0)
78 return ret; 106 return ret;
diff --git a/OpenSim/Data/Null/NullUserAccountData.cs b/OpenSim/Data/Null/NullUserAccountData.cs
index ede23fb..ec54dba 100644
--- a/OpenSim/Data/Null/NullUserAccountData.cs
+++ b/OpenSim/Data/Null/NullUserAccountData.cs
@@ -28,6 +28,9 @@
28using System; 28using System;
29using System.Collections; 29using System.Collections;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Reflection;
32using System.Text;
33using log4net;
31using OpenMetaverse; 34using OpenMetaverse;
32using OpenSim.Framework; 35using OpenSim.Framework;
33using OpenSim.Data; 36using OpenSim.Data;
@@ -36,12 +39,17 @@ namespace OpenSim.Data.Null
36{ 39{
37 public class NullUserAccountData : IUserAccountData 40 public class NullUserAccountData : IUserAccountData
38 { 41 {
39 private static Dictionary<UUID, UserAccountData> m_DataByUUID = new Dictionary<UUID, UserAccountData>(); 42 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
40 private static Dictionary<string, UserAccountData> m_DataByName = new Dictionary<string, UserAccountData>(); 43
41 private static Dictionary<string, UserAccountData> m_DataByEmail = new Dictionary<string, UserAccountData>(); 44 private Dictionary<UUID, UserAccountData> m_DataByUUID = new Dictionary<UUID, UserAccountData>();
45 private Dictionary<string, UserAccountData> m_DataByName = new Dictionary<string, UserAccountData>();
46 private Dictionary<string, UserAccountData> m_DataByEmail = new Dictionary<string, UserAccountData>();
42 47
43 public NullUserAccountData(string connectionString, string realm) 48 public NullUserAccountData(string connectionString, string realm)
44 { 49 {
50// m_log.DebugFormat(
51// "[NULL USER ACCOUNT DATA]: Initializing new NullUserAccountData with connectionString [{0}], realm [{1}]",
52// connectionString, realm);
45 } 53 }
46 54
47 /// <summary> 55 /// <summary>
@@ -54,6 +62,15 @@ namespace OpenSim.Data.Null
54 /// <returns></returns> 62 /// <returns></returns>
55 public UserAccountData[] Get(string[] fields, string[] values) 63 public UserAccountData[] Get(string[] fields, string[] values)
56 { 64 {
65// if (m_log.IsDebugEnabled)
66// {
67// m_log.DebugFormat(
68// "[NULL USER ACCOUNT DATA]: Called Get with fields [{0}], values [{1}]",
69// string.Join(", ", fields), string.Join(", ", values));
70// }
71
72 UserAccountData[] userAccounts = new UserAccountData[0];
73
57 List<string> fieldsLst = new List<string>(fields); 74 List<string> fieldsLst = new List<string>(fields);
58 if (fieldsLst.Contains("PrincipalID")) 75 if (fieldsLst.Contains("PrincipalID"))
59 { 76 {
@@ -61,41 +78,61 @@ namespace OpenSim.Data.Null
61 UUID id = UUID.Zero; 78 UUID id = UUID.Zero;
62 if (UUID.TryParse(values[i], out id)) 79 if (UUID.TryParse(values[i], out id))
63 if (m_DataByUUID.ContainsKey(id)) 80 if (m_DataByUUID.ContainsKey(id))
64 return new UserAccountData[] { m_DataByUUID[id] }; 81 userAccounts = new UserAccountData[] { m_DataByUUID[id] };
65 } 82 }
66 if (fieldsLst.Contains("FirstName") && fieldsLst.Contains("LastName")) 83 else if (fieldsLst.Contains("FirstName") && fieldsLst.Contains("LastName"))
67 { 84 {
68 int findex = fieldsLst.IndexOf("FirstName"); 85 int findex = fieldsLst.IndexOf("FirstName");
69 int lindex = fieldsLst.IndexOf("LastName"); 86 int lindex = fieldsLst.IndexOf("LastName");
70 if (m_DataByName.ContainsKey(values[findex] + " " + values[lindex])) 87 if (m_DataByName.ContainsKey(values[findex] + " " + values[lindex]))
71 return new UserAccountData[] { m_DataByName[values[findex] + " " + values[lindex]] }; 88 {
72 } 89 userAccounts = new UserAccountData[] { m_DataByName[values[findex] + " " + values[lindex]] };
73 if (fieldsLst.Contains("Email")) 90 }
91 }
92 else if (fieldsLst.Contains("Email"))
74 { 93 {
75 int i = fieldsLst.IndexOf("Email"); 94 int i = fieldsLst.IndexOf("Email");
76 if (m_DataByEmail.ContainsKey(values[i])) 95 if (m_DataByEmail.ContainsKey(values[i]))
77 return new UserAccountData[] { m_DataByEmail[values[i]] }; 96 userAccounts = new UserAccountData[] { m_DataByEmail[values[i]] };
78 } 97 }
79 98
80 // Fail 99// if (m_log.IsDebugEnabled)
81 return new UserAccountData[0]; 100// {
101// StringBuilder sb = new StringBuilder();
102// foreach (UserAccountData uad in userAccounts)
103// sb.AppendFormat("({0} {1} {2}) ", uad.FirstName, uad.LastName, uad.PrincipalID);
104//
105// m_log.DebugFormat(
106// "[NULL USER ACCOUNT DATA]: Returning {0} user accounts out of {1}: [{2}]", userAccounts.Length, m_DataByName.Count, sb);
107// }
108
109 return userAccounts;
82 } 110 }
83 111
84 public bool Store(UserAccountData data) 112 public bool Store(UserAccountData data)
85 { 113 {
86 if (data == null) 114 if (data == null)
87 return false; 115 return false;
88 116
117 m_log.DebugFormat(
118 "[NULL USER ACCOUNT DATA]: Storing user account {0} {1} {2} {3}",
119 data.FirstName, data.LastName, data.PrincipalID, this.GetHashCode());
120
89 m_DataByUUID[data.PrincipalID] = data; 121 m_DataByUUID[data.PrincipalID] = data;
90 m_DataByName[data.FirstName + " " + data.LastName] = data; 122 m_DataByName[data.FirstName + " " + data.LastName] = data;
91 if (data.Data.ContainsKey("Email") && data.Data["Email"] != null && data.Data["Email"] != string.Empty) 123 if (data.Data.ContainsKey("Email") && data.Data["Email"] != null && data.Data["Email"] != string.Empty)
92 m_DataByEmail[data.Data["Email"]] = data; 124 m_DataByEmail[data.Data["Email"]] = data;
125
126// m_log.DebugFormat("m_DataByUUID count is {0}, m_DataByName count is {1}", m_DataByUUID.Count, m_DataByName.Count);
93 127
94 return true; 128 return true;
95 } 129 }
96 130
97 public UserAccountData[] GetUsers(UUID scopeID, string query) 131 public UserAccountData[] GetUsers(UUID scopeID, string query)
98 { 132 {
133// m_log.DebugFormat(
134// "[NULL USER ACCOUNT DATA]: Called GetUsers with scope [{0}], query [{1}]", scopeID, query);
135
99 string[] words = query.Split(new char[] { ' ' }); 136 string[] words = query.Split(new char[] { ' ' });
100 137
101 for (int i = 0; i < words.Length; i++) 138 for (int i = 0; i < words.Length; i++)
diff --git a/OpenSim/Data/Tests/AssetTests.cs b/OpenSim/Data/Tests/AssetTests.cs
index 800b9bf..b5ae244 100644
--- a/OpenSim/Data/Tests/AssetTests.cs
+++ b/OpenSim/Data/Tests/AssetTests.cs
@@ -32,13 +32,10 @@ using NUnit.Framework;
32using NUnit.Framework.Constraints; 32using NUnit.Framework.Constraints;
33using OpenMetaverse; 33using OpenMetaverse;
34using OpenSim.Framework; 34using OpenSim.Framework;
35using OpenSim.Tests.Common;
35using System.Data.Common; 36using System.Data.Common;
36using log4net; 37using log4net;
37 38
38#if !NUNIT25
39using NUnit.Framework.SyntaxHelpers;
40#endif
41
42// DBMS-specific: 39// DBMS-specific:
43using MySql.Data.MySqlClient; 40using MySql.Data.MySqlClient;
44using OpenSim.Data.MySQL; 41using OpenSim.Data.MySQL;
@@ -51,15 +48,6 @@ using OpenSim.Data.SQLite;
51 48
52namespace OpenSim.Data.Tests 49namespace OpenSim.Data.Tests
53{ 50{
54
55#if NUNIT25
56
57 [TestFixture(typeof(MySqlConnection), typeof(MySQLAssetData), Description="Basic Asset store tests (MySQL)")]
58 [TestFixture(typeof(SqlConnection), typeof(MSSQLAssetData), Description = "Basic Asset store tests (MS SQL Server)")]
59 [TestFixture(typeof(SqliteConnection), typeof(SQLiteAssetData), Description = "Basic Asset store tests (SQLite)")]
60
61#else
62
63 [TestFixture(Description = "Asset store tests (SQLite)")] 51 [TestFixture(Description = "Asset store tests (SQLite)")]
64 public class SQLiteAssetTests : AssetTests<SqliteConnection, SQLiteAssetData> 52 public class SQLiteAssetTests : AssetTests<SqliteConnection, SQLiteAssetData>
65 { 53 {
@@ -75,9 +63,6 @@ namespace OpenSim.Data.Tests
75 { 63 {
76 } 64 }
77 65
78#endif
79
80
81 public class AssetTests<TConn, TAssetData> : BasicDataServiceTest<TConn, TAssetData> 66 public class AssetTests<TConn, TAssetData> : BasicDataServiceTest<TConn, TAssetData>
82 where TConn : DbConnection, new() 67 where TConn : DbConnection, new()
83 where TAssetData : AssetDataBase, new() 68 where TAssetData : AssetDataBase, new()
@@ -121,6 +106,8 @@ namespace OpenSim.Data.Tests
121 [Test] 106 [Test]
122 public void T001_LoadEmpty() 107 public void T001_LoadEmpty()
123 { 108 {
109 TestHelper.InMethod();
110
124 Assert.That(m_db.ExistsAsset(uuid1), Is.False); 111 Assert.That(m_db.ExistsAsset(uuid1), Is.False);
125 Assert.That(m_db.ExistsAsset(uuid2), Is.False); 112 Assert.That(m_db.ExistsAsset(uuid2), Is.False);
126 Assert.That(m_db.ExistsAsset(uuid3), Is.False); 113 Assert.That(m_db.ExistsAsset(uuid3), Is.False);
@@ -129,6 +116,8 @@ namespace OpenSim.Data.Tests
129 [Test] 116 [Test]
130 public void T010_StoreReadVerifyAssets() 117 public void T010_StoreReadVerifyAssets()
131 { 118 {
119 TestHelper.InMethod();
120
132 AssetBase a1 = new AssetBase(uuid1, "asset one", (sbyte)AssetType.Texture, critter1.ToString()); 121 AssetBase a1 = new AssetBase(uuid1, "asset one", (sbyte)AssetType.Texture, critter1.ToString());
133 AssetBase a2 = new AssetBase(uuid2, "asset two", (sbyte)AssetType.Texture, critter2.ToString()); 122 AssetBase a2 = new AssetBase(uuid2, "asset two", (sbyte)AssetType.Texture, critter2.ToString());
134 AssetBase a3 = new AssetBase(uuid3, "asset three", (sbyte)AssetType.Texture, critter3.ToString()); 123 AssetBase a3 = new AssetBase(uuid3, "asset three", (sbyte)AssetType.Texture, critter3.ToString());
@@ -194,6 +183,8 @@ namespace OpenSim.Data.Tests
194 [Test] 183 [Test]
195 public void T020_CheckForWeirdCreatorID() 184 public void T020_CheckForWeirdCreatorID()
196 { 185 {
186 TestHelper.InMethod();
187
197 // It is expected that eventually the CreatorID might be an arbitrary string (an URI) 188 // It is expected that eventually the CreatorID might be an arbitrary string (an URI)
198 // rather than a valid UUID (?). This test is to make sure that the database layer does not 189 // rather than a valid UUID (?). This test is to make sure that the database layer does not
199 // attempt to convert CreatorID to GUID, but just passes it both ways as a string. 190 // attempt to convert CreatorID to GUID, but just passes it both ways as a string.
@@ -218,4 +209,4 @@ namespace OpenSim.Data.Tests
218 Assert.That(a3a, Constraints.PropertyCompareConstraint(a3)); 209 Assert.That(a3a, Constraints.PropertyCompareConstraint(a3));
219 } 210 }
220 } 211 }
221} 212} \ No newline at end of file
diff --git a/OpenSim/Data/Tests/EstateTests.cs b/OpenSim/Data/Tests/EstateTests.cs
index fbf8ba6..8d332da 100644
--- a/OpenSim/Data/Tests/EstateTests.cs
+++ b/OpenSim/Data/Tests/EstateTests.cs
@@ -28,10 +28,10 @@
28using System; 28using System;
29using log4net.Config; 29using log4net.Config;
30using NUnit.Framework; 30using NUnit.Framework;
31using NUnit.Framework.SyntaxHelpers;
32using OpenMetaverse; 31using OpenMetaverse;
33using OpenSim.Framework; 32using OpenSim.Framework;
34using OpenSim.Region.Framework.Interfaces; 33using OpenSim.Region.Framework.Interfaces;
34using OpenSim.Tests.Common;
35using System.Text; 35using System.Text;
36using log4net; 36using log4net;
37using System.Reflection; 37using System.Reflection;
@@ -49,15 +49,6 @@ using OpenSim.Data.SQLite;
49 49
50namespace OpenSim.Data.Tests 50namespace OpenSim.Data.Tests
51{ 51{
52
53#if NUNIT25
54
55 [TestFixture(typeof(MySqlConnection), typeof(MySQLEstateStore), Description = "Estate store tests (MySQL)")]
56 [TestFixture(typeof(SqlConnection), typeof(MSSQLEstateStore), Description = "Estate store tests (MS SQL Server)")]
57 [TestFixture(typeof(SqliteConnection), typeof(SQLiteEstateStore), Description = "Estate store tests (SQLite)")]
58
59#else
60
61 [TestFixture(Description = "Estate store tests (SQLite)")] 52 [TestFixture(Description = "Estate store tests (SQLite)")]
62 public class SQLiteEstateTests : EstateTests<SqliteConnection, SQLiteEstateStore> 53 public class SQLiteEstateTests : EstateTests<SqliteConnection, SQLiteEstateStore>
63 { 54 {
@@ -73,8 +64,6 @@ namespace OpenSim.Data.Tests
73 { 64 {
74 } 65 }
75 66
76#endif
77
78 public class EstateTests<TConn, TEstateStore> : BasicDataServiceTest<TConn, TEstateStore> 67 public class EstateTests<TConn, TEstateStore> : BasicDataServiceTest<TConn, TEstateStore>
79 where TConn : DbConnection, new() 68 where TConn : DbConnection, new()
80 where TEstateStore : class, IEstateDataStore, new() 69 where TEstateStore : class, IEstateDataStore, new()
@@ -118,6 +107,8 @@ namespace OpenSim.Data.Tests
118 [Test] 107 [Test]
119 public void T010_EstateSettingsSimpleStorage_MinimumParameterSet() 108 public void T010_EstateSettingsSimpleStorage_MinimumParameterSet()
120 { 109 {
110 TestHelper.InMethod();
111
121 EstateSettingsSimpleStorage( 112 EstateSettingsSimpleStorage(
122 REGION_ID, 113 REGION_ID,
123 DataTestUtil.STRING_MIN, 114 DataTestUtil.STRING_MIN,
@@ -149,6 +140,8 @@ namespace OpenSim.Data.Tests
149 [Test] 140 [Test]
150 public void T011_EstateSettingsSimpleStorage_MaximumParameterSet() 141 public void T011_EstateSettingsSimpleStorage_MaximumParameterSet()
151 { 142 {
143 TestHelper.InMethod();
144
152 EstateSettingsSimpleStorage( 145 EstateSettingsSimpleStorage(
153 REGION_ID, 146 REGION_ID,
154 DataTestUtil.STRING_MAX(64), 147 DataTestUtil.STRING_MAX(64),
@@ -180,6 +173,8 @@ namespace OpenSim.Data.Tests
180 [Test] 173 [Test]
181 public void T012_EstateSettingsSimpleStorage_AccurateParameterSet() 174 public void T012_EstateSettingsSimpleStorage_AccurateParameterSet()
182 { 175 {
176 TestHelper.InMethod();
177
183 EstateSettingsSimpleStorage( 178 EstateSettingsSimpleStorage(
184 REGION_ID, 179 REGION_ID,
185 DataTestUtil.STRING_MAX(1), 180 DataTestUtil.STRING_MAX(1),
@@ -211,6 +206,8 @@ namespace OpenSim.Data.Tests
211 [Test] 206 [Test]
212 public void T012_EstateSettingsRandomStorage() 207 public void T012_EstateSettingsRandomStorage()
213 { 208 {
209 TestHelper.InMethod();
210
214 // Letting estate store generate rows to database for us 211 // Letting estate store generate rows to database for us
215 EstateSettings originalSettings = db.LoadEstateSettings(REGION_ID, true); 212 EstateSettings originalSettings = db.LoadEstateSettings(REGION_ID, true);
216 new PropertyScrambler<EstateSettings>() 213 new PropertyScrambler<EstateSettings>()
@@ -230,6 +227,8 @@ namespace OpenSim.Data.Tests
230 [Test] 227 [Test]
231 public void T020_EstateSettingsManagerList() 228 public void T020_EstateSettingsManagerList()
232 { 229 {
230 TestHelper.InMethod();
231
233 // Letting estate store generate rows to database for us 232 // Letting estate store generate rows to database for us
234 EstateSettings originalSettings = db.LoadEstateSettings(REGION_ID, true); 233 EstateSettings originalSettings = db.LoadEstateSettings(REGION_ID, true);
235 234
@@ -249,6 +248,8 @@ namespace OpenSim.Data.Tests
249 [Test] 248 [Test]
250 public void T021_EstateSettingsUserList() 249 public void T021_EstateSettingsUserList()
251 { 250 {
251 TestHelper.InMethod();
252
252 // Letting estate store generate rows to database for us 253 // Letting estate store generate rows to database for us
253 EstateSettings originalSettings = db.LoadEstateSettings(REGION_ID, true); 254 EstateSettings originalSettings = db.LoadEstateSettings(REGION_ID, true);
254 255
@@ -268,6 +269,8 @@ namespace OpenSim.Data.Tests
268 [Test] 269 [Test]
269 public void T022_EstateSettingsGroupList() 270 public void T022_EstateSettingsGroupList()
270 { 271 {
272 TestHelper.InMethod();
273
271 // Letting estate store generate rows to database for us 274 // Letting estate store generate rows to database for us
272 EstateSettings originalSettings = db.LoadEstateSettings(REGION_ID, true); 275 EstateSettings originalSettings = db.LoadEstateSettings(REGION_ID, true);
273 276
@@ -287,6 +290,8 @@ namespace OpenSim.Data.Tests
287 [Test] 290 [Test]
288 public void T022_EstateSettingsBanList() 291 public void T022_EstateSettingsBanList()
289 { 292 {
293 TestHelper.InMethod();
294
290 // Letting estate store generate rows to database for us 295 // Letting estate store generate rows to database for us
291 EstateSettings originalSettings = db.LoadEstateSettings(REGION_ID, true); 296 EstateSettings originalSettings = db.LoadEstateSettings(REGION_ID, true);
292 297
@@ -520,6 +525,5 @@ namespace OpenSim.Data.Tests
520 } 525 }
521 526
522 #endregion 527 #endregion
523
524 } 528 }
525} 529} \ No newline at end of file
diff --git a/OpenSim/Data/Tests/InventoryTests.cs b/OpenSim/Data/Tests/InventoryTests.cs
index 9c2a2d6..cf3bac1 100644
--- a/OpenSim/Data/Tests/InventoryTests.cs
+++ b/OpenSim/Data/Tests/InventoryTests.cs
@@ -25,14 +25,12 @@
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28// #define NUNIT25
29
30using System; 28using System;
31using log4net.Config; 29using log4net.Config;
32using NUnit.Framework; 30using NUnit.Framework;
33using NUnit.Framework.SyntaxHelpers;
34using OpenMetaverse; 31using OpenMetaverse;
35using OpenSim.Framework; 32using OpenSim.Framework;
33using OpenSim.Tests.Common;
36using log4net; 34using log4net;
37using System.Reflection; 35using System.Reflection;
38using System.Data.Common; 36using System.Data.Common;
@@ -49,14 +47,6 @@ using OpenSim.Data.SQLite;
49 47
50namespace OpenSim.Data.Tests 48namespace OpenSim.Data.Tests
51{ 49{
52#if NUNIT25
53
54 [TestFixture(typeof(SqliteConnection), typeof(SQLiteInventoryStore), Description = "Inventory store tests (SQLite)")]
55 [TestFixture(typeof(MySqlConnection), typeof(MySQLInventoryData), Description = "Inventory store tests (MySQL)")]
56 [TestFixture(typeof(SqlConnection), typeof(MSSQLInventoryData), Description = "Inventory store tests (MS SQL Server)")]
57
58#else
59
60 [TestFixture(Description = "Inventory store tests (SQLite)")] 50 [TestFixture(Description = "Inventory store tests (SQLite)")]
61 public class SQLiteInventoryTests : InventoryTests<SqliteConnection, SQLiteInventoryStore> 51 public class SQLiteInventoryTests : InventoryTests<SqliteConnection, SQLiteInventoryStore>
62 { 52 {
@@ -71,7 +61,6 @@ namespace OpenSim.Data.Tests
71 public class MSSQLInventoryTests : InventoryTests<SqlConnection, MSSQLInventoryData> 61 public class MSSQLInventoryTests : InventoryTests<SqlConnection, MSSQLInventoryData>
72 { 62 {
73 } 63 }
74#endif
75 64
76 public class InventoryTests<TConn, TInvStore> : BasicDataServiceTest<TConn, TInvStore> 65 public class InventoryTests<TConn, TInvStore> : BasicDataServiceTest<TConn, TInvStore>
77 where TConn : DbConnection, new() 66 where TConn : DbConnection, new()
@@ -125,6 +114,8 @@ namespace OpenSim.Data.Tests
125 [Test] 114 [Test]
126 public void T001_LoadEmpty() 115 public void T001_LoadEmpty()
127 { 116 {
117 TestHelper.InMethod();
118
128 Assert.That(db.getInventoryFolder(zero), Is.Null); 119 Assert.That(db.getInventoryFolder(zero), Is.Null);
129 Assert.That(db.getInventoryFolder(folder1), Is.Null); 120 Assert.That(db.getInventoryFolder(folder1), Is.Null);
130 Assert.That(db.getInventoryFolder(folder2), Is.Null); 121 Assert.That(db.getInventoryFolder(folder2), Is.Null);
@@ -143,6 +134,8 @@ namespace OpenSim.Data.Tests
143 [Test] 134 [Test]
144 public void T010_FolderNonParent() 135 public void T010_FolderNonParent()
145 { 136 {
137 TestHelper.InMethod();
138
146 InventoryFolderBase f1 = NewFolder(folder2, folder1, owner1, name2); 139 InventoryFolderBase f1 = NewFolder(folder2, folder1, owner1, name2);
147 // the folder will go in 140 // the folder will go in
148 db.addInventoryFolder(f1); 141 db.addInventoryFolder(f1);
@@ -153,6 +146,8 @@ namespace OpenSim.Data.Tests
153 [Test] 146 [Test]
154 public void T011_FolderCreate() 147 public void T011_FolderCreate()
155 { 148 {
149 TestHelper.InMethod();
150
156 InventoryFolderBase f1 = NewFolder(folder1, zero, owner1, name1); 151 InventoryFolderBase f1 = NewFolder(folder1, zero, owner1, name1);
157 // TODO: this is probably wrong behavior, but is what we have 152 // TODO: this is probably wrong behavior, but is what we have
158 // db.updateInventoryFolder(f1); 153 // db.updateInventoryFolder(f1);
@@ -165,7 +160,7 @@ namespace OpenSim.Data.Tests
165 db.addInventoryFolder(f1); 160 db.addInventoryFolder(f1);
166 InventoryFolderBase f1a = db.getUserRootFolder(owner1); 161 InventoryFolderBase f1a = db.getUserRootFolder(owner1);
167 Assert.That(folder1, Is.EqualTo(f1a.ID), "Assert.That(folder1, Is.EqualTo(f1a.ID))"); 162 Assert.That(folder1, Is.EqualTo(f1a.ID), "Assert.That(folder1, Is.EqualTo(f1a.ID))");
168 Assert.That(name1, Text.Matches(f1a.Name), "Assert.That(name1, Text.Matches(f1a.Name))"); 163 Assert.That(name1, Is.StringMatching(f1a.Name), "Assert.That(name1, Text.Matches(f1a.Name))");
169 } 164 }
170 165
171 // we now have the following tree 166 // we now have the following tree
@@ -176,6 +171,8 @@ namespace OpenSim.Data.Tests
176 [Test] 171 [Test]
177 public void T012_FolderList() 172 public void T012_FolderList()
178 { 173 {
174 TestHelper.InMethod();
175
179 InventoryFolderBase f2 = NewFolder(folder3, folder1, owner1, name3); 176 InventoryFolderBase f2 = NewFolder(folder3, folder1, owner1, name3);
180 db.addInventoryFolder(f2); 177 db.addInventoryFolder(f2);
181 178
@@ -190,6 +187,8 @@ namespace OpenSim.Data.Tests
190 [Test] 187 [Test]
191 public void T013_FolderHierarchy() 188 public void T013_FolderHierarchy()
192 { 189 {
190 TestHelper.InMethod();
191
193 int n = db.getFolderHierarchy(zero).Count; // (for dbg - easier to see what's returned) 192 int n = db.getFolderHierarchy(zero).Count; // (for dbg - easier to see what's returned)
194 Assert.That(n, Is.EqualTo(0), "Assert.That(db.getFolderHierarchy(zero).Count, Is.EqualTo(0))"); 193 Assert.That(n, Is.EqualTo(0), "Assert.That(db.getFolderHierarchy(zero).Count, Is.EqualTo(0))");
195 n = db.getFolderHierarchy(folder1).Count; 194 n = db.getFolderHierarchy(folder1).Count;
@@ -203,6 +202,8 @@ namespace OpenSim.Data.Tests
203 [Test] 202 [Test]
204 public void T014_MoveFolder() 203 public void T014_MoveFolder()
205 { 204 {
205 TestHelper.InMethod();
206
206 InventoryFolderBase f2 = db.getInventoryFolder(folder2); 207 InventoryFolderBase f2 = db.getInventoryFolder(folder2);
207 f2.ParentID = folder3; 208 f2.ParentID = folder3;
208 db.moveInventoryFolder(f2); 209 db.moveInventoryFolder(f2);
@@ -217,6 +218,8 @@ namespace OpenSim.Data.Tests
217 [Test] 218 [Test]
218 public void T015_FolderHierarchy() 219 public void T015_FolderHierarchy()
219 { 220 {
221 TestHelper.InMethod();
222
220 Assert.That(db.getFolderHierarchy(zero).Count, Is.EqualTo(0), "Assert.That(db.getFolderHierarchy(zero).Count, Is.EqualTo(0))"); 223 Assert.That(db.getFolderHierarchy(zero).Count, Is.EqualTo(0), "Assert.That(db.getFolderHierarchy(zero).Count, Is.EqualTo(0))");
221 Assert.That(db.getFolderHierarchy(folder1).Count, Is.EqualTo(2), "Assert.That(db.getFolderHierarchy(folder1).Count, Is.EqualTo(2))"); 224 Assert.That(db.getFolderHierarchy(folder1).Count, Is.EqualTo(2), "Assert.That(db.getFolderHierarchy(folder1).Count, Is.EqualTo(2))");
222 Assert.That(db.getFolderHierarchy(folder2).Count, Is.EqualTo(0), "Assert.That(db.getFolderHierarchy(folder2).Count, Is.EqualTo(0))"); 225 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
228 [Test] 231 [Test]
229 public void T100_NoItems() 232 public void T100_NoItems()
230 { 233 {
234 TestHelper.InMethod();
235
231 Assert.That(db.getInventoryInFolder(zero).Count, Is.EqualTo(0), "Assert.That(db.getInventoryInFolder(zero).Count, Is.EqualTo(0))"); 236 Assert.That(db.getInventoryInFolder(zero).Count, Is.EqualTo(0), "Assert.That(db.getInventoryInFolder(zero).Count, Is.EqualTo(0))");
232 Assert.That(db.getInventoryInFolder(folder1).Count, Is.EqualTo(0), "Assert.That(db.getInventoryInFolder(folder1).Count, Is.EqualTo(0))"); 237 Assert.That(db.getInventoryInFolder(folder1).Count, Is.EqualTo(0), "Assert.That(db.getInventoryInFolder(folder1).Count, Is.EqualTo(0))");
233 Assert.That(db.getInventoryInFolder(folder2).Count, Is.EqualTo(0), "Assert.That(db.getInventoryInFolder(folder2).Count, Is.EqualTo(0))"); 238 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
240 [Test] 245 [Test]
241 public void T101_CreatItems() 246 public void T101_CreatItems()
242 { 247 {
248 TestHelper.InMethod();
249
243 db.addInventoryItem(NewItem(item1, folder3, owner1, iname1, asset1)); 250 db.addInventoryItem(NewItem(item1, folder3, owner1, iname1, asset1));
244 db.addInventoryItem(NewItem(item2, folder3, owner1, iname2, asset2)); 251 db.addInventoryItem(NewItem(item2, folder3, owner1, iname2, asset2));
245 db.addInventoryItem(NewItem(item3, folder3, owner1, iname3, asset3)); 252 db.addInventoryItem(NewItem(item3, folder3, owner1, iname3, asset3));
@@ -249,6 +256,8 @@ namespace OpenSim.Data.Tests
249 [Test] 256 [Test]
250 public void T102_CompareItems() 257 public void T102_CompareItems()
251 { 258 {
259 TestHelper.InMethod();
260
252 InventoryItemBase i1 = db.getInventoryItem(item1); 261 InventoryItemBase i1 = db.getInventoryItem(item1);
253 InventoryItemBase i2 = db.getInventoryItem(item2); 262 InventoryItemBase i2 = db.getInventoryItem(item2);
254 InventoryItemBase i3 = db.getInventoryItem(item3); 263 InventoryItemBase i3 = db.getInventoryItem(item3);
@@ -266,6 +275,8 @@ namespace OpenSim.Data.Tests
266 [Test] 275 [Test]
267 public void T103_UpdateItem() 276 public void T103_UpdateItem()
268 { 277 {
278 TestHelper.InMethod();
279
269 // TODO: probably shouldn't have the ability to have an 280 // TODO: probably shouldn't have the ability to have an
270 // owner of an item in a folder not owned by the user 281 // owner of an item in a folder not owned by the user
271 282
@@ -284,6 +295,8 @@ namespace OpenSim.Data.Tests
284 [Test] 295 [Test]
285 public void T104_RandomUpdateItem() 296 public void T104_RandomUpdateItem()
286 { 297 {
298 TestHelper.InMethod();
299
287 PropertyScrambler<InventoryFolderBase> folderScrambler = 300 PropertyScrambler<InventoryFolderBase> folderScrambler =
288 new PropertyScrambler<InventoryFolderBase>() 301 new PropertyScrambler<InventoryFolderBase>()
289 .DontScramble(x => x.Owner) 302 .DontScramble(x => x.Owner)
@@ -341,6 +354,8 @@ namespace OpenSim.Data.Tests
341 [Test] 354 [Test]
342 public void T999_StillNull() 355 public void T999_StillNull()
343 { 356 {
357 TestHelper.InMethod();
358
344 // After all tests are run, these should still return no results 359 // After all tests are run, these should still return no results
345 Assert.That(db.getInventoryFolder(zero), Is.Null); 360 Assert.That(db.getInventoryFolder(zero), Is.Null);
346 Assert.That(db.getInventoryItem(zero), Is.Null); 361 Assert.That(db.getInventoryItem(zero), Is.Null);
diff --git a/OpenSim/Data/Tests/PropertyCompareConstraint.cs b/OpenSim/Data/Tests/PropertyCompareConstraint.cs
index f3d41df..6c79bda 100644
--- a/OpenSim/Data/Tests/PropertyCompareConstraint.cs
+++ b/OpenSim/Data/Tests/PropertyCompareConstraint.cs
@@ -34,7 +34,6 @@ using System.Linq.Expressions;
34using System.Reflection; 34using System.Reflection;
35using NUnit.Framework; 35using NUnit.Framework;
36using NUnit.Framework.Constraints; 36using NUnit.Framework.Constraints;
37using NUnit.Framework.SyntaxHelpers;
38using OpenMetaverse; 37using OpenMetaverse;
39using OpenSim.Framework; 38using OpenSim.Framework;
40 39
diff --git a/OpenSim/Data/Tests/PropertyScrambler.cs b/OpenSim/Data/Tests/PropertyScrambler.cs
index 132294a..c5d40c2 100644
--- a/OpenSim/Data/Tests/PropertyScrambler.cs
+++ b/OpenSim/Data/Tests/PropertyScrambler.cs
@@ -32,13 +32,11 @@ using System.Linq.Expressions;
32using System.Reflection; 32using System.Reflection;
33using System.Text; 33using System.Text;
34using NUnit.Framework; 34using NUnit.Framework;
35using NUnit.Framework.SyntaxHelpers;
36using OpenMetaverse; 35using OpenMetaverse;
37using OpenSim.Framework; 36using OpenSim.Framework;
38 37
39namespace OpenSim.Data.Tests 38namespace OpenSim.Data.Tests
40{ 39{
41
42 //This is generic so that the lambda expressions will work right in IDEs. 40 //This is generic so that the lambda expressions will work right in IDEs.
43 public class PropertyScrambler<T> 41 public class PropertyScrambler<T>
44 { 42 {
diff --git a/OpenSim/Data/Tests/RegionTests.cs b/OpenSim/Data/Tests/RegionTests.cs
index 23d498d..44cf1ab 100644
--- a/OpenSim/Data/Tests/RegionTests.cs
+++ b/OpenSim/Data/Tests/RegionTests.cs
@@ -31,11 +31,11 @@ using System.Drawing;
31using System.Text; 31using System.Text;
32using log4net.Config; 32using log4net.Config;
33using NUnit.Framework; 33using NUnit.Framework;
34using NUnit.Framework.SyntaxHelpers;
35using OpenMetaverse; 34using OpenMetaverse;
36using OpenSim.Framework; 35using OpenSim.Framework;
37using OpenSim.Region.Framework.Interfaces; 36using OpenSim.Region.Framework.Interfaces;
38using OpenSim.Region.Framework.Scenes; 37using OpenSim.Region.Framework.Scenes;
38using OpenSim.Tests.Common;
39using log4net; 39using log4net;
40using System.Reflection; 40using System.Reflection;
41using System.Data.Common; 41using System.Data.Common;
@@ -52,14 +52,6 @@ using OpenSim.Data.SQLite;
52 52
53namespace OpenSim.Data.Tests 53namespace OpenSim.Data.Tests
54{ 54{
55#if NUNIT25
56
57 [TestFixture(typeof(SqliteConnection), typeof(SQLiteRegionData), Description = "Region store tests (SQLite)")]
58 [TestFixture(typeof(MySqlConnection), typeof(MySqlRegionData), Description = "Region store tests (MySQL)")]
59 [TestFixture(typeof(SqlConnection), typeof(MSSQLRegionData), Description = "Region store tests (MS SQL Server)")]
60
61#else
62
63 [TestFixture(Description = "Region store tests (SQLite)")] 55 [TestFixture(Description = "Region store tests (SQLite)")]
64 public class SQLiteRegionTests : RegionTests<SqliteConnection, SQLiteSimulationData> 56 public class SQLiteRegionTests : RegionTests<SqliteConnection, SQLiteSimulationData>
65 { 57 {
@@ -75,8 +67,6 @@ namespace OpenSim.Data.Tests
75 { 67 {
76 } 68 }
77 69
78#endif
79
80 public class RegionTests<TConn, TRegStore> : BasicDataServiceTest<TConn, TRegStore> 70 public class RegionTests<TConn, TRegStore> : BasicDataServiceTest<TConn, TRegStore>
81 where TConn : DbConnection, new() 71 where TConn : DbConnection, new()
82 where TRegStore : class, ISimulationDataStore, new() 72 where TRegStore : class, ISimulationDataStore, new()
@@ -131,15 +121,18 @@ namespace OpenSim.Data.Tests
131 string[] reg_tables = new string[] { 121 string[] reg_tables = new string[] {
132 "prims", "primshapes", "primitems", "terrain", "land", "landaccesslist", "regionban", "regionsettings" 122 "prims", "primshapes", "primitems", "terrain", "land", "landaccesslist", "regionban", "regionsettings"
133 }; 123 };
124
134 if (m_rebuildDB) 125 if (m_rebuildDB)
135 { 126 {
136 DropTables(reg_tables); 127 DropTables(reg_tables);
137 ResetMigrations("RegionStore"); 128 ResetMigrations("RegionStore");
138 }else 129 }
130 else
131 {
139 ClearTables(reg_tables); 132 ClearTables(reg_tables);
133 }
140 } 134 }
141 135
142
143 // Test Plan 136 // Test Plan
144 // Prims 137 // Prims
145 // - empty test - 001 138 // - empty test - 001
@@ -158,6 +151,8 @@ namespace OpenSim.Data.Tests
158 [Test] 151 [Test]
159 public void T001_LoadEmpty() 152 public void T001_LoadEmpty()
160 { 153 {
154 TestHelper.InMethod();
155
161 List<SceneObjectGroup> objs = db.LoadObjects(region1); 156 List<SceneObjectGroup> objs = db.LoadObjects(region1);
162 List<SceneObjectGroup> objs3 = db.LoadObjects(region3); 157 List<SceneObjectGroup> objs3 = db.LoadObjects(region3);
163 List<LandData> land = db.LoadLandObjects(region1); 158 List<LandData> land = db.LoadLandObjects(region1);
@@ -174,6 +169,8 @@ namespace OpenSim.Data.Tests
174 [Test] 169 [Test]
175 public void T010_StoreSimpleObject() 170 public void T010_StoreSimpleObject()
176 { 171 {
172 TestHelper.InMethod();
173
177 SceneObjectGroup sog = NewSOG("object1", prim1, region1); 174 SceneObjectGroup sog = NewSOG("object1", prim1, region1);
178 SceneObjectGroup sog2 = NewSOG("object2", prim2, region1); 175 SceneObjectGroup sog2 = NewSOG("object2", prim2, region1);
179 176
@@ -207,6 +204,8 @@ namespace OpenSim.Data.Tests
207 [Test] 204 [Test]
208 public void T011_ObjectNames() 205 public void T011_ObjectNames()
209 { 206 {
207 TestHelper.InMethod();
208
210 List<SceneObjectGroup> objs = db.LoadObjects(region1); 209 List<SceneObjectGroup> objs = db.LoadObjects(region1);
211 foreach (SceneObjectGroup sog in objs) 210 foreach (SceneObjectGroup sog in objs)
212 { 211 {
@@ -219,6 +218,8 @@ namespace OpenSim.Data.Tests
219 [Test] 218 [Test]
220 public void T012_SceneParts() 219 public void T012_SceneParts()
221 { 220 {
221 TestHelper.InMethod();
222
222 UUID tmp0 = UUID.Random(); 223 UUID tmp0 = UUID.Random();
223 UUID tmp1 = UUID.Random(); 224 UUID tmp1 = UUID.Random();
224 UUID tmp2 = UUID.Random(); 225 UUID tmp2 = UUID.Random();
@@ -252,6 +253,8 @@ namespace OpenSim.Data.Tests
252 [Test] 253 [Test]
253 public void T013_DatabasePersistency() 254 public void T013_DatabasePersistency()
254 { 255 {
256 TestHelper.InMethod();
257
255 // Sets all ScenePart parameters, stores and retrieves them, then check for consistency with initial data 258 // Sets all ScenePart parameters, stores and retrieves them, then check for consistency with initial data
256 // The commented Asserts are the ones that are unchangeable (when storing on the database, their "Set" values are ignored 259 // The commented Asserts are the ones that are unchangeable (when storing on the database, their "Set" values are ignored
257 // The ObjectFlags is an exception, if it is entered incorrectly, the object IS REJECTED on the database silently. 260 // 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
427 [Test] 430 [Test]
428 public void T014_UpdateObject() 431 public void T014_UpdateObject()
429 { 432 {
433 TestHelper.InMethod();
434
430 string text1 = "object1 text"; 435 string text1 = "object1 text";
431 SceneObjectGroup sog = FindSOG("object1", region1); 436 SceneObjectGroup sog = FindSOG("object1", region1);
432 sog.RootPart.Text = text1; 437 sog.RootPart.Text = text1;
@@ -528,15 +533,20 @@ namespace OpenSim.Data.Tests
528 Assert.That(clickaction,Is.EqualTo(p.ClickAction), "Assert.That(clickaction,Is.EqualTo(p.ClickAction))"); 533 Assert.That(clickaction,Is.EqualTo(p.ClickAction), "Assert.That(clickaction,Is.EqualTo(p.ClickAction))");
529 Assert.That(scale,Is.EqualTo(p.Scale), "Assert.That(scale,Is.EqualTo(p.Scale))"); 534 Assert.That(scale,Is.EqualTo(p.Scale), "Assert.That(scale,Is.EqualTo(p.Scale))");
530 } 535 }
531 536
537 /// <summary>
538 /// Test storage and retrieval of a scene object with a large number of parts.
539 /// </summary>
532 [Test] 540 [Test]
533 public void T015_LargeSceneObjects() 541 public void T015_LargeSceneObjects()
534 { 542 {
543 TestHelper.InMethod();
544
535 UUID id = UUID.Random(); 545 UUID id = UUID.Random();
536 Dictionary<UUID, SceneObjectPart> mydic = new Dictionary<UUID, SceneObjectPart>(); 546 Dictionary<UUID, SceneObjectPart> mydic = new Dictionary<UUID, SceneObjectPart>();
537 SceneObjectGroup sog = NewSOG("Test SOG", id, region4); 547 SceneObjectGroup sog = NewSOG("Test SOG", id, region4);
538 mydic.Add(sog.RootPart.UUID,sog.RootPart); 548 mydic.Add(sog.RootPart.UUID,sog.RootPart);
539 for (int i=0;i<30;i++) 549 for (int i = 0; i < 30; i++)
540 { 550 {
541 UUID tmp = UUID.Random(); 551 UUID tmp = UUID.Random();
542 SceneObjectPart sop = NewSOP(("Test SOP " + i.ToString()),tmp); 552 SceneObjectPart sop = NewSOP(("Test SOP " + i.ToString()),tmp);
@@ -555,13 +565,14 @@ namespace OpenSim.Data.Tests
555 sop.Acceleration = accel; 565 sop.Acceleration = accel;
556 566
557 mydic.Add(tmp,sop); 567 mydic.Add(tmp,sop);
558 sog.AddPart(sop); 568 sog.AddPart(sop);
559 db.StoreObject(sog, region4);
560 } 569 }
561 570
571 db.StoreObject(sog, region4);
572
562 SceneObjectGroup retsog = FindSOG("Test SOG", region4); 573 SceneObjectGroup retsog = FindSOG("Test SOG", region4);
563 SceneObjectPart[] parts = retsog.Parts; 574 SceneObjectPart[] parts = retsog.Parts;
564 for (int i=0;i<30;i++) 575 for (int i = 0; i < 30; i++)
565 { 576 {
566 SceneObjectPart cursop = mydic[parts[i].UUID]; 577 SceneObjectPart cursop = mydic[parts[i].UUID];
567 Assert.That(cursop.GroupPosition,Is.EqualTo(parts[i].GroupPosition), "Assert.That(cursop.GroupPosition,Is.EqualTo(parts[i].GroupPosition))"); 578 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
576 //[Test] 587 //[Test]
577 public void T016_RandomSogWithSceneParts() 588 public void T016_RandomSogWithSceneParts()
578 { 589 {
590 TestHelper.InMethod();
591
579 PropertyScrambler<SceneObjectPart> scrambler = 592 PropertyScrambler<SceneObjectPart> scrambler =
580 new PropertyScrambler<SceneObjectPart>() 593 new PropertyScrambler<SceneObjectPart>()
581 .DontScramble(x => x.UUID); 594 .DontScramble(x => x.UUID);
@@ -642,15 +655,16 @@ namespace OpenSim.Data.Tests
642 return sog; 655 return sog;
643 } 656 }
644 657
645
646 // NOTE: it is a bad practice to rely on some of the previous tests having been run before. 658 // NOTE: it is a bad practice to rely on some of the previous tests having been run before.
647 // If the tests are run manually, one at a time, each starts with full class init (DB cleared). 659 // If the tests are run manually, one at a time, each starts with full class init (DB cleared).
648 // Even when all tests are run, NUnit 2.5+ no longer guarantee a specific test order. 660 // Even when all tests are run, NUnit 2.5+ no longer guarantee a specific test order.
649 // We shouldn't expect to find anything in the DB if we haven't put it there *in the same test*! 661 // We shouldn't expect to find anything in the DB if we haven't put it there *in the same test*!
650 662
651 [Test] 663 [Test]
652 public void T020_PrimInventoryEmpty() 664 public void T020_PrimInventoryEmpty()
653 { 665 {
666 TestHelper.InMethod();
667
654 SceneObjectGroup sog = GetMySOG("object1"); 668 SceneObjectGroup sog = GetMySOG("object1");
655 TaskInventoryItem t = sog.GetInventoryItem(sog.RootPart.LocalId, item1); 669 TaskInventoryItem t = sog.GetInventoryItem(sog.RootPart.LocalId, item1);
656 Assert.That(t, Is.Null); 670 Assert.That(t, Is.Null);
@@ -670,10 +684,11 @@ namespace OpenSim.Data.Tests
670 db.StorePrimInventory(sog.RootPart.UUID, list); 684 db.StorePrimInventory(sog.RootPart.UUID, list);
671 } 685 }
672 686
673
674 [Test] 687 [Test]
675 public void T021_PrimInventoryBasic() 688 public void T021_PrimInventoryBasic()
676 { 689 {
690 TestHelper.InMethod();
691
677 SceneObjectGroup sog = GetMySOG("object1"); 692 SceneObjectGroup sog = GetMySOG("object1");
678 InventoryItemBase i = NewItem(item1, zero, zero, itemname1, zero); 693 InventoryItemBase i = NewItem(item1, zero, zero, itemname1, zero);
679 694
@@ -701,20 +716,19 @@ namespace OpenSim.Data.Tests
701 Assert.That(t2.Name, Is.EqualTo("My New Name"), "Assert.That(t.Name, Is.EqualTo(\"My New Name\"))"); 716 Assert.That(t2.Name, Is.EqualTo("My New Name"), "Assert.That(t.Name, Is.EqualTo(\"My New Name\"))");
702 717
703 // Removing inventory 718 // Removing inventory
704
705 List<TaskInventoryItem> list = new List<TaskInventoryItem>(); 719 List<TaskInventoryItem> list = new List<TaskInventoryItem>();
706 db.StorePrimInventory(prim1, list); 720 db.StorePrimInventory(prim1, list);
707 721
708 sog = FindSOG("object1", region1); 722 sog = FindSOG("object1", region1);
709 t = sog.GetInventoryItem(sog.RootPart.LocalId, item1); 723 t = sog.GetInventoryItem(sog.RootPart.LocalId, item1);
710 Assert.That(t, Is.Null); 724 Assert.That(t, Is.Null);
711
712 } 725 }
713
714 726
715 [Test] 727 [Test]
716 public void T025_PrimInventoryPersistency() 728 public void T025_PrimInventoryPersistency()
717 { 729 {
730 TestHelper.InMethod();
731
718 InventoryItemBase i = new InventoryItemBase(); 732 InventoryItemBase i = new InventoryItemBase();
719 UUID id = UUID.Random(); 733 UUID id = UUID.Random();
720 i.ID = id; 734 i.ID = id;
@@ -786,6 +800,8 @@ namespace OpenSim.Data.Tests
786 [ExpectedException(typeof(ArgumentException))] 800 [ExpectedException(typeof(ArgumentException))]
787 public void T026_PrimInventoryMany() 801 public void T026_PrimInventoryMany()
788 { 802 {
803 TestHelper.InMethod();
804
789 UUID i1,i2,i3,i4; 805 UUID i1,i2,i3,i4;
790 i1 = UUID.Random(); 806 i1 = UUID.Random();
791 i2 = UUID.Random(); 807 i2 = UUID.Random();
@@ -816,15 +832,18 @@ namespace OpenSim.Data.Tests
816 [Test] 832 [Test]
817 public void T052_RemoveObject() 833 public void T052_RemoveObject()
818 { 834 {
835 TestHelper.InMethod();
836
819 db.RemoveObject(prim1, region1); 837 db.RemoveObject(prim1, region1);
820 SceneObjectGroup sog = FindSOG("object1", region1); 838 SceneObjectGroup sog = FindSOG("object1", region1);
821 Assert.That(sog, Is.Null); 839 Assert.That(sog, Is.Null);
822 } 840 }
823 841
824
825 [Test] 842 [Test]
826 public void T100_DefaultRegionInfo() 843 public void T100_DefaultRegionInfo()
827 { 844 {
845 TestHelper.InMethod();
846
828 RegionSettings r1 = db.LoadRegionSettings(region1); 847 RegionSettings r1 = db.LoadRegionSettings(region1);
829 Assert.That(r1.RegionUUID, Is.EqualTo(region1), "Assert.That(r1.RegionUUID, Is.EqualTo(region1))"); 848 Assert.That(r1.RegionUUID, Is.EqualTo(region1), "Assert.That(r1.RegionUUID, Is.EqualTo(region1))");
830 849
@@ -835,6 +854,8 @@ namespace OpenSim.Data.Tests
835 [Test] 854 [Test]
836 public void T101_UpdateRegionInfo() 855 public void T101_UpdateRegionInfo()
837 { 856 {
857 TestHelper.InMethod();
858
838 int agentlimit = random.Next(); 859 int agentlimit = random.Next();
839 double objectbonus = random.Next(); 860 double objectbonus = random.Next();
840 int maturity = random.Next(); 861 int maturity = random.Next();
@@ -933,13 +954,14 @@ namespace OpenSim.Data.Tests
933 //Assert.That(r1a.TerrainImageID,Is.EqualTo(terimgid), "Assert.That(r1a.TerrainImageID,Is.EqualTo(terimgid))"); 954 //Assert.That(r1a.TerrainImageID,Is.EqualTo(terimgid), "Assert.That(r1a.TerrainImageID,Is.EqualTo(terimgid))");
934 Assert.That(r1a.FixedSun,Is.True); 955 Assert.That(r1a.FixedSun,Is.True);
935 Assert.That(r1a.SunPosition, Is.EqualTo(sunpos), "Assert.That(r1a.SunPosition, Is.EqualTo(sunpos))"); 956 Assert.That(r1a.SunPosition, Is.EqualTo(sunpos), "Assert.That(r1a.SunPosition, Is.EqualTo(sunpos))");
936 Assert.That(r1a.Covenant, Is.EqualTo(cov), "Assert.That(r1a.Covenant, Is.EqualTo(cov))"); 957 Assert.That(r1a.Covenant, Is.EqualTo(cov), "Assert.That(r1a.Covenant, Is.EqualTo(cov))");
937
938 } 958 }
939 959
940 [Test] 960 [Test]
941 public void T300_NoTerrain() 961 public void T300_NoTerrain()
942 { 962 {
963 TestHelper.InMethod();
964
943 Assert.That(db.LoadTerrain(zero), Is.Null); 965 Assert.That(db.LoadTerrain(zero), Is.Null);
944 Assert.That(db.LoadTerrain(region1), Is.Null); 966 Assert.That(db.LoadTerrain(region1), Is.Null);
945 Assert.That(db.LoadTerrain(region2), Is.Null); 967 Assert.That(db.LoadTerrain(region2), Is.Null);
@@ -949,6 +971,8 @@ namespace OpenSim.Data.Tests
949 [Test] 971 [Test]
950 public void T301_CreateTerrain() 972 public void T301_CreateTerrain()
951 { 973 {
974 TestHelper.InMethod();
975
952 double[,] t1 = GenTerrain(height1); 976 double[,] t1 = GenTerrain(height1);
953 db.StoreTerrain(t1, region1); 977 db.StoreTerrain(t1, region1);
954 978
@@ -961,6 +985,8 @@ namespace OpenSim.Data.Tests
961 [Test] 985 [Test]
962 public void T302_FetchTerrain() 986 public void T302_FetchTerrain()
963 { 987 {
988 TestHelper.InMethod();
989
964 double[,] baseterrain1 = GenTerrain(height1); 990 double[,] baseterrain1 = GenTerrain(height1);
965 double[,] baseterrain2 = GenTerrain(height2); 991 double[,] baseterrain2 = GenTerrain(height2);
966 double[,] t1 = db.LoadTerrain(region1); 992 double[,] t1 = db.LoadTerrain(region1);
@@ -971,6 +997,8 @@ namespace OpenSim.Data.Tests
971 [Test] 997 [Test]
972 public void T303_UpdateTerrain() 998 public void T303_UpdateTerrain()
973 { 999 {
1000 TestHelper.InMethod();
1001
974 double[,] baseterrain1 = GenTerrain(height1); 1002 double[,] baseterrain1 = GenTerrain(height1);
975 double[,] baseterrain2 = GenTerrain(height2); 1003 double[,] baseterrain2 = GenTerrain(height2);
976 db.StoreTerrain(baseterrain2, region1); 1004 db.StoreTerrain(baseterrain2, region1);
@@ -983,6 +1011,8 @@ namespace OpenSim.Data.Tests
983 [Test] 1011 [Test]
984 public void T400_EmptyLand() 1012 public void T400_EmptyLand()
985 { 1013 {
1014 TestHelper.InMethod();
1015
986 Assert.That(db.LoadLandObjects(zero).Count, Is.EqualTo(0), "Assert.That(db.LoadLandObjects(zero).Count, Is.EqualTo(0))"); 1016 Assert.That(db.LoadLandObjects(zero).Count, Is.EqualTo(0), "Assert.That(db.LoadLandObjects(zero).Count, Is.EqualTo(0))");
987 Assert.That(db.LoadLandObjects(region1).Count, Is.EqualTo(0), "Assert.That(db.LoadLandObjects(region1).Count, Is.EqualTo(0))"); 1017 Assert.That(db.LoadLandObjects(region1).Count, Is.EqualTo(0), "Assert.That(db.LoadLandObjects(region1).Count, Is.EqualTo(0))");
988 Assert.That(db.LoadLandObjects(region2).Count, Is.EqualTo(0), "Assert.That(db.LoadLandObjects(region2).Count, Is.EqualTo(0))"); 1018 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
1018 return true; 1048 return true;
1019 } 1049 }
1020 1050
1021
1022 private SceneObjectGroup FindSOG(string name, UUID r) 1051 private SceneObjectGroup FindSOG(string name, UUID r)
1023 { 1052 {
1024 List<SceneObjectGroup> objs = db.LoadObjects(r); 1053 List<SceneObjectGroup> objs = db.LoadObjects(r);
1025 foreach (SceneObjectGroup sog in objs) 1054 foreach (SceneObjectGroup sog in objs)
1026 { 1055 if (sog.Name == name)
1027 SceneObjectPart p = sog.RootPart;
1028 if (p.Name == name) {
1029 RegionInfo regionInfo = new RegionInfo();
1030 regionInfo.RegionID = r;
1031 regionInfo.RegionLocX = 0;
1032 regionInfo.RegionLocY = 0;
1033
1034 Scene scene = new Scene(regionInfo);
1035 sog.SetScene(scene);
1036
1037 return sog; 1056 return sog;
1038 }
1039 }
1040 1057
1041 return null; 1058 return null;
1042 } 1059 }