aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to '')
-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/NullUserAccountData.cs65
-rw-r--r--OpenSim/Data/Tests/AssetTests.cs18
-rw-r--r--OpenSim/Data/Tests/EstateTests.cs15
-rw-r--r--OpenSim/Data/Tests/InventoryTests.cs12
-rw-r--r--OpenSim/Data/Tests/PropertyCompareConstraint.cs1
-rw-r--r--OpenSim/Data/Tests/PropertyScrambler.cs2
-rw-r--r--OpenSim/Data/Tests/RegionTests.cs11
-rw-r--r--OpenSim/Framework/PrimitiveBaseShape.cs2
-rw-r--r--OpenSim/Framework/Serialization/External/OspResolver.cs19
-rw-r--r--OpenSim/Framework/Servers/Tests/OSHttpTests.cs1
-rw-r--r--OpenSim/Framework/Tests/AnimationTests.cs1
-rw-r--r--OpenSim/Framework/Tests/PrimeNumberHelperTests.cs3
-rw-r--r--OpenSim/Framework/Tests/UtilTest.cs1
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs2
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs14
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveTestCase.cs155
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs612
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/PathTests.cs480
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs12
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/Tests/GridConnectorsTests.cs1
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/Tests/PresenceConnectorsTests.cs1
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs22
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs1
-rw-r--r--OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs60
-rw-r--r--OpenSim/Region/CoreModules/World/Media/Moap/Tests/MoapTests.cs102
-rw-r--r--OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs1
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/AttachmentTests.cs1
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs1
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs1
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs1
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs1
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs1
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserGroupTests.cs1
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs1
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs1
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/StandaloneTeleportTests.cs1
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs1
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs1
-rw-r--r--OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs2
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs14
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/SimianGroupsServicesConnectorModule.cs2
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/Tests/GroupsModuleTests.cs1
-rw-r--r--OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs6
-rw-r--r--OpenSim/Services/HypergridService/UserAgentService.cs2
-rw-r--r--OpenSim/Services/Interfaces/ISimulationService.cs7
-rw-r--r--OpenSim/Tests/Common/DoubleToleranceConstraint.cs1
-rw-r--r--OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs140
-rw-r--r--OpenSim/Tests/Common/TestHelper.cs3
-rw-r--r--OpenSim/Tests/Common/VectorToleranceConstraint.cs1
55 files changed, 1010 insertions, 845 deletions
diff --git a/OpenSim/Data/MySQL/MySQLAssetData.cs b/OpenSim/Data/MySQL/MySQLAssetData.cs
index 0b0a638..94e2da4 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/NullUserAccountData.cs b/OpenSim/Data/Null/NullUserAccountData.cs
index 772d821..241616b 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..32f74a9 100644
--- a/OpenSim/Data/Tests/AssetTests.cs
+++ b/OpenSim/Data/Tests/AssetTests.cs
@@ -35,10 +35,6 @@ using OpenSim.Framework;
35using System.Data.Common; 35using System.Data.Common;
36using log4net; 36using log4net;
37 37
38#if !NUNIT25
39using NUnit.Framework.SyntaxHelpers;
40#endif
41
42// DBMS-specific: 38// DBMS-specific:
43using MySql.Data.MySqlClient; 39using MySql.Data.MySqlClient;
44using OpenSim.Data.MySQL; 40using OpenSim.Data.MySQL;
@@ -51,15 +47,6 @@ using OpenSim.Data.SQLite;
51 47
52namespace OpenSim.Data.Tests 48namespace OpenSim.Data.Tests
53{ 49{
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)")] 50 [TestFixture(Description = "Asset store tests (SQLite)")]
64 public class SQLiteAssetTests : AssetTests<SqliteConnection, SQLiteAssetData> 51 public class SQLiteAssetTests : AssetTests<SqliteConnection, SQLiteAssetData>
65 { 52 {
@@ -75,9 +62,6 @@ namespace OpenSim.Data.Tests
75 { 62 {
76 } 63 }
77 64
78#endif
79
80
81 public class AssetTests<TConn, TAssetData> : BasicDataServiceTest<TConn, TAssetData> 65 public class AssetTests<TConn, TAssetData> : BasicDataServiceTest<TConn, TAssetData>
82 where TConn : DbConnection, new() 66 where TConn : DbConnection, new()
83 where TAssetData : AssetDataBase, new() 67 where TAssetData : AssetDataBase, new()
@@ -218,4 +202,4 @@ namespace OpenSim.Data.Tests
218 Assert.That(a3a, Constraints.PropertyCompareConstraint(a3)); 202 Assert.That(a3a, Constraints.PropertyCompareConstraint(a3));
219 } 203 }
220 } 204 }
221} 205} \ No newline at end of file
diff --git a/OpenSim/Data/Tests/EstateTests.cs b/OpenSim/Data/Tests/EstateTests.cs
index fbf8ba6..3354e28 100644
--- a/OpenSim/Data/Tests/EstateTests.cs
+++ b/OpenSim/Data/Tests/EstateTests.cs
@@ -28,7 +28,6 @@
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;
@@ -49,15 +48,6 @@ using OpenSim.Data.SQLite;
49 48
50namespace OpenSim.Data.Tests 49namespace OpenSim.Data.Tests
51{ 50{
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)")] 51 [TestFixture(Description = "Estate store tests (SQLite)")]
62 public class SQLiteEstateTests : EstateTests<SqliteConnection, SQLiteEstateStore> 52 public class SQLiteEstateTests : EstateTests<SqliteConnection, SQLiteEstateStore>
63 { 53 {
@@ -73,8 +63,6 @@ namespace OpenSim.Data.Tests
73 { 63 {
74 } 64 }
75 65
76#endif
77
78 public class EstateTests<TConn, TEstateStore> : BasicDataServiceTest<TConn, TEstateStore> 66 public class EstateTests<TConn, TEstateStore> : BasicDataServiceTest<TConn, TEstateStore>
79 where TConn : DbConnection, new() 67 where TConn : DbConnection, new()
80 where TEstateStore : class, IEstateDataStore, new() 68 where TEstateStore : class, IEstateDataStore, new()
@@ -520,6 +508,5 @@ namespace OpenSim.Data.Tests
520 } 508 }
521 509
522 #endregion 510 #endregion
523
524 } 511 }
525} 512} \ No newline at end of file
diff --git a/OpenSim/Data/Tests/InventoryTests.cs b/OpenSim/Data/Tests/InventoryTests.cs
index 9c2a2d6..758f970 100644
--- a/OpenSim/Data/Tests/InventoryTests.cs
+++ b/OpenSim/Data/Tests/InventoryTests.cs
@@ -25,12 +25,9 @@
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;
36using log4net; 33using log4net;
@@ -49,14 +46,6 @@ using OpenSim.Data.SQLite;
49 46
50namespace OpenSim.Data.Tests 47namespace OpenSim.Data.Tests
51{ 48{
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)")] 49 [TestFixture(Description = "Inventory store tests (SQLite)")]
61 public class SQLiteInventoryTests : InventoryTests<SqliteConnection, SQLiteInventoryStore> 50 public class SQLiteInventoryTests : InventoryTests<SqliteConnection, SQLiteInventoryStore>
62 { 51 {
@@ -71,7 +60,6 @@ namespace OpenSim.Data.Tests
71 public class MSSQLInventoryTests : InventoryTests<SqlConnection, MSSQLInventoryData> 60 public class MSSQLInventoryTests : InventoryTests<SqlConnection, MSSQLInventoryData>
72 { 61 {
73 } 62 }
74#endif
75 63
76 public class InventoryTests<TConn, TInvStore> : BasicDataServiceTest<TConn, TInvStore> 64 public class InventoryTests<TConn, TInvStore> : BasicDataServiceTest<TConn, TInvStore>
77 where TConn : DbConnection, new() 65 where TConn : DbConnection, new()
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..9598716 100644
--- a/OpenSim/Data/Tests/RegionTests.cs
+++ b/OpenSim/Data/Tests/RegionTests.cs
@@ -31,7 +31,6 @@ 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;
@@ -52,14 +51,6 @@ using OpenSim.Data.SQLite;
52 51
53namespace OpenSim.Data.Tests 52namespace OpenSim.Data.Tests
54{ 53{
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)")] 54 [TestFixture(Description = "Region store tests (SQLite)")]
64 public class SQLiteRegionTests : RegionTests<SqliteConnection, SQLiteSimulationData> 55 public class SQLiteRegionTests : RegionTests<SqliteConnection, SQLiteSimulationData>
65 { 56 {
@@ -75,8 +66,6 @@ namespace OpenSim.Data.Tests
75 { 66 {
76 } 67 }
77 68
78#endif
79
80 public class RegionTests<TConn, TRegStore> : BasicDataServiceTest<TConn, TRegStore> 69 public class RegionTests<TConn, TRegStore> : BasicDataServiceTest<TConn, TRegStore>
81 where TConn : DbConnection, new() 70 where TConn : DbConnection, new()
82 where TRegStore : class, ISimulationDataStore, new() 71 where TRegStore : class, ISimulationDataStore, new()
diff --git a/OpenSim/Framework/PrimitiveBaseShape.cs b/OpenSim/Framework/PrimitiveBaseShape.cs
index 9a38f23..44f484e 100644
--- a/OpenSim/Framework/PrimitiveBaseShape.cs
+++ b/OpenSim/Framework/PrimitiveBaseShape.cs
@@ -250,7 +250,7 @@ namespace OpenSim.Framework
250 { 250 {
251 get 251 get
252 { 252 {
253 //m_log.DebugFormat("[SHAPE]: get m_textureEntry length {0}", m_textureEntry.Length); 253// m_log.DebugFormat("[SHAPE]: get m_textureEntry length {0}", m_textureEntry.Length);
254 try { return new Primitive.TextureEntry(m_textureEntry, 0, m_textureEntry.Length); } 254 try { return new Primitive.TextureEntry(m_textureEntry, 0, m_textureEntry.Length); }
255 catch { } 255 catch { }
256 256
diff --git a/OpenSim/Framework/Serialization/External/OspResolver.cs b/OpenSim/Framework/Serialization/External/OspResolver.cs
index 7e3dd1b..d31d27c 100644
--- a/OpenSim/Framework/Serialization/External/OspResolver.cs
+++ b/OpenSim/Framework/Serialization/External/OspResolver.cs
@@ -66,6 +66,8 @@ namespace OpenSim.Framework.Serialization
66 UserAccount account = userService.GetUserAccount(UUID.Zero, userId); 66 UserAccount account = userService.GetUserAccount(UUID.Zero, userId);
67 if (account != null) 67 if (account != null)
68 return MakeOspa(account.FirstName, account.LastName); 68 return MakeOspa(account.FirstName, account.LastName);
69// else
70// m_log.WarnFormat("[OSP RESOLVER]: No user account for {0}", userId);
69 71
70 return null; 72 return null;
71 } 73 }
@@ -77,6 +79,8 @@ namespace OpenSim.Framework.Serialization
77 /// <returns></returns> 79 /// <returns></returns>
78 public static string MakeOspa(string firstName, string lastName) 80 public static string MakeOspa(string firstName, string lastName)
79 { 81 {
82// m_log.DebugFormat("[OSP RESOLVER]: Making OSPA for {0} {1}", firstName, lastName);
83
80 return 84 return
81 OSPA_PREFIX + OSPA_NAME_KEY + OSPA_PAIR_SEPARATOR + firstName + OSPA_NAME_VALUE_SEPARATOR + lastName; 85 OSPA_PREFIX + OSPA_NAME_KEY + OSPA_PAIR_SEPARATOR + firstName + OSPA_NAME_VALUE_SEPARATOR + lastName;
82 } 86 }
@@ -97,7 +101,10 @@ namespace OpenSim.Framework.Serialization
97 public static UUID ResolveOspa(string ospa, IUserAccountService userService) 101 public static UUID ResolveOspa(string ospa, IUserAccountService userService)
98 { 102 {
99 if (!ospa.StartsWith(OSPA_PREFIX)) 103 if (!ospa.StartsWith(OSPA_PREFIX))
100 return UUID.Zero; 104 {
105// m_log.DebugFormat("[OSP RESOLVER]: ResolveOspa() got unrecognized format [{0}]", ospa);
106 return UUID.Zero;
107 }
101 108
102// m_log.DebugFormat("[OSP RESOLVER]: Resolving {0}", ospa); 109// m_log.DebugFormat("[OSP RESOLVER]: Resolving {0}", ospa);
103 110
@@ -161,7 +168,17 @@ namespace OpenSim.Framework.Serialization
161 168
162 UserAccount account = userService.GetUserAccount(UUID.Zero, firstName, lastName); 169 UserAccount account = userService.GetUserAccount(UUID.Zero, firstName, lastName);
163 if (account != null) 170 if (account != null)
171 {
172// m_log.DebugFormat(
173// "[OSP RESOLVER]: Found user account with uuid {0} for {1} {2}",
174// account.PrincipalID, firstName, lastName);
175
164 return account.PrincipalID; 176 return account.PrincipalID;
177 }
178// else
179// {
180// m_log.DebugFormat("[OSP RESOLVER]: No resolved OSPA user account for {0}", name);
181// }
165 182
166 // XXX: Disable temporary user profile creation for now as implementation is incomplete - justincc 183 // XXX: Disable temporary user profile creation for now as implementation is incomplete - justincc
167 /* 184 /*
diff --git a/OpenSim/Framework/Servers/Tests/OSHttpTests.cs b/OpenSim/Framework/Servers/Tests/OSHttpTests.cs
index e62407a..dc4eb8f 100644
--- a/OpenSim/Framework/Servers/Tests/OSHttpTests.cs
+++ b/OpenSim/Framework/Servers/Tests/OSHttpTests.cs
@@ -34,7 +34,6 @@ using System.Text;
34using HttpServer; 34using HttpServer;
35using HttpServer.FormDecoders; 35using HttpServer.FormDecoders;
36using NUnit.Framework; 36using NUnit.Framework;
37using NUnit.Framework.SyntaxHelpers;
38using OpenSim.Framework.Servers.HttpServer; 37using OpenSim.Framework.Servers.HttpServer;
39 38
40namespace OpenSim.Framework.Servers.Tests 39namespace OpenSim.Framework.Servers.Tests
diff --git a/OpenSim/Framework/Tests/AnimationTests.cs b/OpenSim/Framework/Tests/AnimationTests.cs
index 719ddce..9aa95af 100644
--- a/OpenSim/Framework/Tests/AnimationTests.cs
+++ b/OpenSim/Framework/Tests/AnimationTests.cs
@@ -28,7 +28,6 @@
28using System; 28using System;
29using System.Reflection; 29using System.Reflection;
30using NUnit.Framework; 30using NUnit.Framework;
31using NUnit.Framework.SyntaxHelpers;
32using OpenMetaverse; 31using OpenMetaverse;
33using OpenMetaverse.StructuredData; 32using OpenMetaverse.StructuredData;
34using OpenSim.Framework; 33using OpenSim.Framework;
diff --git a/OpenSim/Framework/Tests/PrimeNumberHelperTests.cs b/OpenSim/Framework/Tests/PrimeNumberHelperTests.cs
index d741f91..36bc6e7 100644
--- a/OpenSim/Framework/Tests/PrimeNumberHelperTests.cs
+++ b/OpenSim/Framework/Tests/PrimeNumberHelperTests.cs
@@ -28,7 +28,6 @@
28using System; 28using System;
29using System.Reflection; 29using System.Reflection;
30using NUnit.Framework; 30using NUnit.Framework;
31using NUnit.Framework.SyntaxHelpers;
32using OpenMetaverse; 31using OpenMetaverse;
33using OpenMetaverse.StructuredData; 32using OpenMetaverse.StructuredData;
34using OpenSim.Framework; 33using OpenSim.Framework;
@@ -38,8 +37,6 @@ namespace OpenSim.Framework.Tests
38 [TestFixture] 37 [TestFixture]
39 public class PrimeNumberHelperTests 38 public class PrimeNumberHelperTests
40 { 39 {
41
42
43 [Test] 40 [Test]
44 public void TestGetPrime() 41 public void TestGetPrime()
45 { 42 {
diff --git a/OpenSim/Framework/Tests/UtilTest.cs b/OpenSim/Framework/Tests/UtilTest.cs
index 89f5c0c..5eac411 100644
--- a/OpenSim/Framework/Tests/UtilTest.cs
+++ b/OpenSim/Framework/Tests/UtilTest.cs
@@ -27,7 +27,6 @@
27 27
28using System; 28using System;
29using NUnit.Framework; 29using NUnit.Framework;
30using NUnit.Framework.SyntaxHelpers;
31using OpenMetaverse; 30using OpenMetaverse;
32using OpenSim.Tests.Common; 31using OpenSim.Tests.Common;
33 32
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
index 6030706..7849d88 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
@@ -400,6 +400,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
400 UUID ospResolvedId = OspResolver.ResolveOspa(item.CreatorId, m_scene.UserAccountService); 400 UUID ospResolvedId = OspResolver.ResolveOspa(item.CreatorId, m_scene.UserAccountService);
401 if (UUID.Zero != ospResolvedId) // The user exists in this grid 401 if (UUID.Zero != ospResolvedId) // The user exists in this grid
402 { 402 {
403// m_log.DebugFormat("[INVENTORY ARCHIVER]: Found creator {0} via OSPA resolution", ospResolvedId);
404
403 item.CreatorIdAsUuid = ospResolvedId; 405 item.CreatorIdAsUuid = ospResolvedId;
404 406
405 // XXX: For now, don't preserve the OSPA in the creator id (which actually gets persisted to the 407 // XXX: For now, don't preserve the OSPA in the creator id (which actually gets persisted to the
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs
index a71def7..613f0ed 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs
@@ -109,9 +109,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
109 109
110 scene.AddCommand( 110 scene.AddCommand(
111 this, "load iar", 111 this, "load iar",
112 "load iar [--merge] <first> <last> <inventory path> <password> [<IAR path>]", 112 "load iar [-m|--merge] <first> <last> <inventory path> <password> [<IAR path>]",
113 "Load user inventory archive (IAR).", 113 "Load user inventory archive (IAR).",
114 "--merge is an option which merges the loaded IAR with existing inventory folders where possible, rather than always creating new ones" 114 "-m|--merge is an option which merges the loaded IAR with existing inventory folders where possible, rather than always creating new ones"
115 + "<first> is user's first name." + Environment.NewLine 115 + "<first> is user's first name." + Environment.NewLine
116 + "<last> is user's last name." + Environment.NewLine 116 + "<last> is user's last name." + Environment.NewLine
117 + "<inventory path> is the path inside the user's inventory where the IAR should be loaded." + Environment.NewLine 117 + "<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
181 catch (EntryPointNotFoundException e) 181 catch (EntryPointNotFoundException e)
182 { 182 {
183 m_log.ErrorFormat( 183 m_log.ErrorFormat(
184 "[ARCHIVER]: Mismatch between Mono and zlib1g library version when trying to create compression stream." 184 "[INVENTORY ARCHIVER]: Mismatch between Mono and zlib1g library version when trying to create compression stream."
185 + "If you've manually installed Mono, have you appropriately updated zlib1g as well?"); 185 + "If you've manually installed Mono, have you appropriately updated zlib1g as well?");
186 m_log.Error(e); 186 m_log.Error(e);
187 187
@@ -221,7 +221,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
221 catch (EntryPointNotFoundException e) 221 catch (EntryPointNotFoundException e)
222 { 222 {
223 m_log.ErrorFormat( 223 m_log.ErrorFormat(
224 "[ARCHIVER]: Mismatch between Mono and zlib1g library version when trying to create compression stream." 224 "[INVENTORY ARCHIVER]: Mismatch between Mono and zlib1g library version when trying to create compression stream."
225 + "If you've manually installed Mono, have you appropriately updated zlib1g as well?"); 225 + "If you've manually installed Mono, have you appropriately updated zlib1g as well?");
226 m_log.Error(e); 226 m_log.Error(e);
227 227
@@ -269,7 +269,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
269 catch (EntryPointNotFoundException e) 269 catch (EntryPointNotFoundException e)
270 { 270 {
271 m_log.ErrorFormat( 271 m_log.ErrorFormat(
272 "[ARCHIVER]: Mismatch between Mono and zlib1g library version when trying to create compression stream." 272 "[INVENTORY ARCHIVER]: Mismatch between Mono and zlib1g library version when trying to create compression stream."
273 + "If you've manually installed Mono, have you appropriately updated zlib1g as well?"); 273 + "If you've manually installed Mono, have you appropriately updated zlib1g as well?");
274 m_log.Error(e); 274 m_log.Error(e);
275 275
@@ -317,7 +317,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
317 catch (EntryPointNotFoundException e) 317 catch (EntryPointNotFoundException e)
318 { 318 {
319 m_log.ErrorFormat( 319 m_log.ErrorFormat(
320 "[ARCHIVER]: Mismatch between Mono and zlib1g library version when trying to create compression stream." 320 "[INVENTORY ARCHIVER]: Mismatch between Mono and zlib1g library version when trying to create compression stream."
321 + "If you've manually installed Mono, have you appropriately updated zlib1g as well?"); 321 + "If you've manually installed Mono, have you appropriately updated zlib1g as well?");
322 m_log.Error(e); 322 m_log.Error(e);
323 323
@@ -358,7 +358,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
358 if (mainParams.Count < 6) 358 if (mainParams.Count < 6)
359 { 359 {
360 m_log.Error( 360 m_log.Error(
361 "[INVENTORY ARCHIVER]: usage is load iar [--merge] <first name> <last name> <inventory path> <user password> [<load file path>]"); 361 "[INVENTORY ARCHIVER]: usage is load iar [-m|--merge] <first name> <last name> <inventory path> <user password> [<load file path>]");
362 return; 362 return;
363 } 363 }
364 364
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveTestCase.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveTestCase.cs
new file mode 100644
index 0000000..dcafc49
--- /dev/null
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveTestCase.cs
@@ -0,0 +1,155 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using System.IO;
31using System.Reflection;
32using System.Threading;
33using NUnit.Framework;
34using OpenMetaverse;
35using OpenSim.Data;
36using OpenSim.Framework;
37using OpenSim.Framework.Serialization;
38using OpenSim.Framework.Serialization.External;
39using OpenSim.Framework.Communications;
40using OpenSim.Region.CoreModules.Avatar.Inventory.Archiver;
41using OpenSim.Region.CoreModules.World.Serialiser;
42using OpenSim.Region.Framework.Scenes;
43using OpenSim.Region.Framework.Scenes.Serialization;
44using OpenSim.Services.Interfaces;
45using OpenSim.Tests.Common;
46using OpenSim.Tests.Common.Mock;
47using OpenSim.Tests.Common.Setup;
48
49namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
50{
51 [TestFixture]
52 public class InventoryArchiveTestCase
53 {
54 protected ManualResetEvent mre = new ManualResetEvent(false);
55
56 /// <summary>
57 /// A raw array of bytes that we'll use to create an IAR memory stream suitable for isolated use in each test.
58 /// </summary>
59 protected byte[] m_iarStreamBytes;
60
61 /// <summary>
62 /// Stream of data representing a common IAR for load tests.
63 /// </summary>
64 protected MemoryStream m_iarStream;
65
66 protected UserAccount m_ua1
67 = new UserAccount {
68 PrincipalID = UUID.Parse("00000000-0000-0000-0000-000000000555"),
69 FirstName = "Mr",
70 LastName = "Tiddles" };
71 protected UserAccount m_ua2
72 = new UserAccount {
73 PrincipalID = UUID.Parse("00000000-0000-0000-0000-000000000666"),
74 FirstName = "Lord",
75 LastName = "Lucan" };
76 protected UserAccount m_ua3
77 = new UserAccount {
78 PrincipalID = UUID.Parse("00000000-0000-0000-0000-000000000777"),
79 FirstName = "Lord",
80 LastName = "Lucan" };
81 protected string m_item1Name = "Ray Gun Item";
82
83 [SetUp]
84 public void SetUp()
85 {
86 m_iarStream = new MemoryStream(m_iarStreamBytes);
87 }
88
89 [TestFixtureSetUp]
90 public void FixtureSetup()
91 {
92 ConstructDefaultIarBytesForTestLoad();
93 }
94
95 protected void ConstructDefaultIarBytesForTestLoad()
96 {
97// log4net.Config.XmlConfigurator.Configure();
98
99 Scene scene = SceneSetupHelpers.SetupScene("Inventory");
100 UserProfileTestUtils.CreateUserWithInventory(scene, m_ua2, "hampshire");
101
102 MemoryStream archiveWriteStream = new MemoryStream();
103 TarArchiveWriter tar = new TarArchiveWriter(archiveWriteStream);
104
105 // Create asset
106 SceneObjectGroup object1;
107 SceneObjectPart part1;
108 {
109 string partName = "Ray Gun Object";
110 UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000040");
111 PrimitiveBaseShape shape = PrimitiveBaseShape.CreateSphere();
112 Vector3 groupPosition = new Vector3(10, 20, 30);
113 Quaternion rotationOffset = new Quaternion(20, 30, 40, 50);
114 Vector3 offsetPosition = new Vector3(5, 10, 15);
115
116 part1
117 = new SceneObjectPart(
118 ownerId, shape, groupPosition, rotationOffset, offsetPosition);
119 part1.Name = partName;
120
121 object1 = new SceneObjectGroup(part1);
122 scene.AddNewSceneObject(object1, false);
123 }
124
125 UUID asset1Id = UUID.Parse("00000000-0000-0000-0000-000000000060");
126 AssetBase asset1 = AssetHelpers.CreateAsset(asset1Id, object1);
127 scene.AssetService.Store(asset1);
128
129 // Create item
130 InventoryItemBase item1 = new InventoryItemBase();
131 item1.Name = m_item1Name;
132 item1.AssetID = asset1.FullID;
133 item1.GroupID = UUID.Random();
134 item1.CreatorIdAsUuid = m_ua2.PrincipalID;
135 item1.Owner = UUID.Zero;
136
137 string archiveItem1Name = InventoryArchiveWriteRequest.CreateArchiveItemName(m_item1Name, UUID.Random());
138 string archiveItem1Path = string.Format("{0}{1}", ArchiveConstants.INVENTORY_PATH, archiveItem1Name);
139 tar.WriteFile(
140 archiveItem1Path,
141 UserInventoryItemSerializer.Serialize(
142 item1, new Dictionary<string, object>(), scene.UserAccountService));
143 tar.Close();
144
145 m_iarStreamBytes = archiveWriteStream.ToArray();
146 }
147
148 protected void SaveCompleted(
149 Guid id, bool succeeded, UserAccount userInfo, string invPath, Stream saveStream,
150 Exception reportedException)
151 {
152 mre.Set();
153 }
154 }
155} \ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
index 76d0b85..b52014b 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
@@ -31,7 +31,6 @@ using System.IO;
31using System.Reflection; 31using System.Reflection;
32using System.Threading; 32using System.Threading;
33using NUnit.Framework; 33using NUnit.Framework;
34using NUnit.Framework.SyntaxHelpers;
35using OpenMetaverse; 34using OpenMetaverse;
36using OpenSim.Data; 35using OpenSim.Data;
37using OpenSim.Framework; 36using OpenSim.Framework;
@@ -50,184 +49,8 @@ using OpenSim.Tests.Common.Setup;
50namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests 49namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
51{ 50{
52 [TestFixture] 51 [TestFixture]
53 public class InventoryArchiverTests 52 public class InventoryArchiverTests : InventoryArchiveTestCase
54 { 53 {
55 protected ManualResetEvent mre = new ManualResetEvent(false);
56
57 /// <summary>
58 /// Stream of data representing a common IAR that can be reused in load tests.
59 /// </summary>
60 protected MemoryStream m_iarStream;
61
62 protected UserAccount m_ua1
63 = new UserAccount {
64 PrincipalID = UUID.Parse("00000000-0000-0000-0000-000000000555"),
65 FirstName = "Mr",
66 LastName = "Tiddles" };
67 protected UserAccount m_ua2
68 = new UserAccount {
69 PrincipalID = UUID.Parse("00000000-0000-0000-0000-000000000666"),
70 FirstName = "Lord",
71 LastName = "Lucan" };
72 string m_item1Name = "b.lsl";
73
74 private void SaveCompleted(
75 Guid id, bool succeeded, UserAccount userInfo, string invPath, Stream saveStream,
76 Exception reportedException)
77 {
78 mre.Set();
79 }
80
81 [SetUp]
82 public void Init()
83 {
84 ConstructDefaultIarForTestLoad();
85 }
86
87 protected void ConstructDefaultIarForTestLoad()
88 {
89 string archiveItemName = InventoryArchiveWriteRequest.CreateArchiveItemName(m_item1Name, UUID.Random());
90
91 MemoryStream archiveWriteStream = new MemoryStream();
92 TarArchiveWriter tar = new TarArchiveWriter(archiveWriteStream);
93
94 InventoryItemBase item1 = new InventoryItemBase();
95 item1.Name = m_item1Name;
96 item1.AssetID = UUID.Random();
97 item1.GroupID = UUID.Random();
98 //item1.CreatorId = OspResolver.MakeOspa(m_ua2.FirstName, m_ua2.LastName);
99 //item1.CreatorId = userUuid.ToString();
100 item1.CreatorId = m_ua2.PrincipalID.ToString();
101 item1.Owner = UUID.Zero;
102
103 Scene scene = SceneSetupHelpers.SetupScene("Inventory");
104 UserProfileTestUtils.CreateUserWithInventory(scene, m_ua2, "hampshire");
105
106 string item1FileName
107 = string.Format("{0}{1}", ArchiveConstants.INVENTORY_PATH, archiveItemName);
108 tar.WriteFile(item1FileName, UserInventoryItemSerializer.Serialize(item1, new Dictionary<string, object>(), scene.UserAccountService));
109 tar.Close();
110 m_iarStream = new MemoryStream(archiveWriteStream.ToArray());
111 }
112
113 /// <summary>
114 /// Test saving an inventory path to a V0.1 OpenSim Inventory Archive
115 /// (subject to change since there is no fixed format yet).
116 /// </summary>
117 [Test]
118 public void TestSavePathToIarV0_1()
119 {
120 TestHelper.InMethod();
121// log4net.Config.XmlConfigurator.Configure();
122
123 InventoryArchiverModule archiverModule = new InventoryArchiverModule();
124
125 Scene scene = SceneSetupHelpers.SetupScene("Inventory");
126 SceneSetupHelpers.SetupSceneModules(scene, archiverModule);
127
128 // Create user
129 string userFirstName = "Jock";
130 string userLastName = "Stirrup";
131 string userPassword = "troll";
132 UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000020");
133 UserProfileTestUtils.CreateUserWithInventory(scene, userFirstName, userLastName, userId, userPassword);
134
135 // Create asset
136 SceneObjectGroup object1;
137 SceneObjectPart part1;
138 {
139 string partName = "My Little Dog Object";
140 UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000040");
141 PrimitiveBaseShape shape = PrimitiveBaseShape.CreateSphere();
142 Vector3 groupPosition = new Vector3(10, 20, 30);
143 Quaternion rotationOffset = new Quaternion(20, 30, 40, 50);
144 Vector3 offsetPosition = new Vector3(5, 10, 15);
145
146 part1
147 = new SceneObjectPart(
148 ownerId, shape, groupPosition, rotationOffset, offsetPosition);
149 part1.Name = partName;
150
151 object1 = new SceneObjectGroup(part1);
152 scene.AddNewSceneObject(object1, false);
153 }
154
155 UUID asset1Id = UUID.Parse("00000000-0000-0000-0000-000000000060");
156 AssetBase asset1 = AssetHelpers.CreateAsset(asset1Id, object1);
157 scene.AssetService.Store(asset1);
158
159 // Create item
160 UUID item1Id = UUID.Parse("00000000-0000-0000-0000-000000000080");
161 InventoryItemBase item1 = new InventoryItemBase();
162 item1.Name = "My Little Dog";
163 item1.AssetID = asset1.FullID;
164 item1.ID = item1Id;
165 InventoryFolderBase objsFolder
166 = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, userId, "Objects")[0];
167 item1.Folder = objsFolder.ID;
168 scene.AddInventoryItem(item1);
169
170 MemoryStream archiveWriteStream = new MemoryStream();
171 archiverModule.OnInventoryArchiveSaved += SaveCompleted;
172
173 // Test saving a particular path
174 mre.Reset();
175 archiverModule.ArchiveInventory(
176 Guid.NewGuid(), userFirstName, userLastName, "Objects", userPassword, archiveWriteStream);
177 mre.WaitOne(60000, false);
178
179 byte[] archive = archiveWriteStream.ToArray();
180 MemoryStream archiveReadStream = new MemoryStream(archive);
181 TarArchiveReader tar = new TarArchiveReader(archiveReadStream);
182
183 //bool gotControlFile = false;
184 bool gotObject1File = false;
185 //bool gotObject2File = false;
186 string expectedObject1FileName = InventoryArchiveWriteRequest.CreateArchiveItemName(item1);
187 string expectedObject1FilePath = string.Format(
188 "{0}{1}{2}",
189 ArchiveConstants.INVENTORY_PATH,
190 InventoryArchiveWriteRequest.CreateArchiveFolderName(objsFolder),
191 expectedObject1FileName);
192
193 string filePath;
194 TarArchiveReader.TarEntryType tarEntryType;
195
196// Console.WriteLine("Reading archive");
197
198 while (tar.ReadEntry(out filePath, out tarEntryType) != null)
199 {
200// Console.WriteLine("Got {0}", filePath);
201
202// if (ArchiveConstants.CONTROL_FILE_PATH == filePath)
203// {
204// gotControlFile = true;
205// }
206
207 if (filePath.StartsWith(ArchiveConstants.INVENTORY_PATH) && filePath.EndsWith(".xml"))
208 {
209// string fileName = filePath.Remove(0, "Objects/".Length);
210//
211// if (fileName.StartsWith(part1.Name))
212// {
213 Assert.That(expectedObject1FilePath, Is.EqualTo(filePath));
214 gotObject1File = true;
215// }
216// else if (fileName.StartsWith(part2.Name))
217// {
218// Assert.That(fileName, Is.EqualTo(expectedObject2FileName));
219// gotObject2File = true;
220// }
221 }
222 }
223
224// Assert.That(gotControlFile, Is.True, "No control file in archive");
225 Assert.That(gotObject1File, Is.True, "No item1 file in archive");
226// Assert.That(gotObject2File, Is.True, "No object2 file in archive");
227
228 // TODO: Test presence of more files and contents of files.
229 }
230
231 /// <summary> 54 /// <summary>
232 /// Test saving a single inventory item to a V0.1 OpenSim Inventory Archive 55 /// Test saving a single inventory item to a V0.1 OpenSim Inventory Archive
233 /// (subject to change since there is no fixed format yet). 56 /// (subject to change since there is no fixed format yet).
@@ -346,40 +169,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
346 } 169 }
347 170
348 /// <summary> 171 /// <summary>
349 /// Test that things work when the load path specified starts with a slash
350 /// </summary>
351 [Test]
352 public void TestLoadIarPathStartsWithSlash()
353 {
354 TestHelper.InMethod();
355// log4net.Config.XmlConfigurator.Configure();
356
357 SerialiserModule serialiserModule = new SerialiserModule();
358 InventoryArchiverModule archiverModule = new InventoryArchiverModule();
359 Scene scene = SceneSetupHelpers.SetupScene("inventory");
360 SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule);
361
362 UserProfileTestUtils.CreateUserWithInventory(scene, m_ua1, "password");
363 archiverModule.DearchiveInventory(m_ua1.FirstName, m_ua1.LastName, "/Objects", "password", m_iarStream);
364
365 InventoryItemBase foundItem1
366 = InventoryArchiveUtils.FindItemByPath(
367 scene.InventoryService, m_ua1.PrincipalID, "/Objects/" + m_item1Name);
368
369 Assert.That(foundItem1, Is.Not.Null, "Didn't find loaded item 1 in TestLoadIarFolderStartsWithSlash()");
370 }
371
372 /// <summary>
373 /// Test loading a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet) where 172 /// Test loading a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet) where
374 /// an account exists with the creator name. 173 /// an account exists with the same name as the creator, though not the same id.
375 /// </summary> 174 /// </summary>
376 ///
377 /// This test also does some deeper probing of loading into nested inventory structures
378 [Test] 175 [Test]
379 public void TestLoadIarV0_1ExistingUsers() 176 public void TestLoadIarV0_1SameNameCreator()
380 { 177 {
381 TestHelper.InMethod(); 178 TestHelper.InMethod();
382 //log4net.Config.XmlConfigurator.Configure(); 179// log4net.Config.XmlConfigurator.Configure();
383 180
384 SerialiserModule serialiserModule = new SerialiserModule(); 181 SerialiserModule serialiserModule = new SerialiserModule();
385 InventoryArchiverModule archiverModule = new InventoryArchiverModule(); 182 InventoryArchiverModule archiverModule = new InventoryArchiverModule();
@@ -390,14 +187,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
390 SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule); 187 SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule);
391 188
392 UserProfileTestUtils.CreateUserWithInventory(scene, m_ua1, "meowfood"); 189 UserProfileTestUtils.CreateUserWithInventory(scene, m_ua1, "meowfood");
393 UserProfileTestUtils.CreateUserWithInventory(scene, m_ua2, "hampshire"); 190 UserProfileTestUtils.CreateUserWithInventory(scene, m_ua3, "hampshire");
394 191
395 archiverModule.DearchiveInventory(m_ua1.FirstName, m_ua1.LastName, "/", "meowfood", m_iarStream); 192 archiverModule.DearchiveInventory(m_ua1.FirstName, m_ua1.LastName, "/", "meowfood", m_iarStream);
396
397 InventoryItemBase foundItem1 193 InventoryItemBase foundItem1
398 = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, m_ua1.PrincipalID, m_item1Name); 194 = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, m_ua1.PrincipalID, m_item1Name);
399
400 Assert.That(foundItem1, Is.Not.Null, "Didn't find loaded item 1");
401 195
402// We have to disable this check since loaded items that did find users via OSPA resolution are now only storing the 196// We have to disable this check since loaded items that did find users via OSPA resolution are now only storing the
403// UUID, not the OSPA itself. 197// UUID, not the OSPA itself.
@@ -405,415 +199,43 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
405// foundItem1.CreatorId, Is.EqualTo(item1.CreatorId), 199// foundItem1.CreatorId, Is.EqualTo(item1.CreatorId),
406// "Loaded item non-uuid creator doesn't match original"); 200// "Loaded item non-uuid creator doesn't match original");
407 Assert.That( 201 Assert.That(
408 foundItem1.CreatorId, Is.EqualTo(m_ua2.PrincipalID.ToString()), 202 foundItem1.CreatorId, Is.EqualTo(m_ua3.PrincipalID.ToString()),
409 "Loaded item non-uuid creator doesn't match original"); 203 "Loaded item non-uuid creator doesn't match original");
410
411 Assert.That( 204 Assert.That(
412 foundItem1.CreatorIdAsUuid, Is.EqualTo(m_ua2.PrincipalID), 205 foundItem1.CreatorIdAsUuid, Is.EqualTo(m_ua3.PrincipalID),
413 "Loaded item uuid creator doesn't match original"); 206 "Loaded item uuid creator doesn't match original");
414 Assert.That(foundItem1.Owner, Is.EqualTo(m_ua1.PrincipalID), 207 Assert.That(foundItem1.Owner, Is.EqualTo(m_ua1.PrincipalID),
415 "Loaded item owner doesn't match inventory reciever"); 208 "Loaded item owner doesn't match inventory reciever");
416
417 // Now try loading to a root child folder
418 UserInventoryTestUtils.CreateInventoryFolder(scene.InventoryService, m_ua1.PrincipalID, "xA");
419 MemoryStream archiveReadStream = new MemoryStream(m_iarStream.ToArray());
420 archiverModule.DearchiveInventory(m_ua1.FirstName, m_ua1.LastName, "xA", "meowfood", archiveReadStream);
421
422 InventoryItemBase foundItem2
423 = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, m_ua1.PrincipalID, "xA/" + m_item1Name);
424 Assert.That(foundItem2, Is.Not.Null, "Didn't find loaded item 2");
425
426 // Now try loading to a more deeply nested folder
427 UserInventoryTestUtils.CreateInventoryFolder(scene.InventoryService, m_ua1.PrincipalID, "xB/xC");
428 archiveReadStream = new MemoryStream(archiveReadStream.ToArray());
429 archiverModule.DearchiveInventory(m_ua1.FirstName, m_ua1.LastName, "xB/xC", "meowfood", archiveReadStream);
430
431 InventoryItemBase foundItem3
432 = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, m_ua1.PrincipalID, "xB/xC/" + m_item1Name);
433 Assert.That(foundItem3, Is.Not.Null, "Didn't find loaded item 3");
434 }
435
436 [Test]
437 public void TestIarV0_1WithEscapedChars()
438 {
439 TestHelper.InMethod();
440// log4net.Config.XmlConfigurator.Configure();
441
442 string itemName = "You & you are a mean/man/";
443 string humanEscapedItemName = @"You & you are a mean\/man\/";
444 string userPassword = "meowfood";
445
446 InventoryArchiverModule archiverModule = new InventoryArchiverModule();
447
448 Scene scene = SceneSetupHelpers.SetupScene("Inventory");
449 SceneSetupHelpers.SetupSceneModules(scene, archiverModule);
450
451 // Create user
452 string userFirstName = "Jock";
453 string userLastName = "Stirrup";
454 UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000020");
455 UserProfileTestUtils.CreateUserWithInventory(scene, userFirstName, userLastName, userId, "meowfood");
456
457 // Create asset
458 SceneObjectGroup object1;
459 SceneObjectPart part1;
460 {
461 string partName = "part name";
462 UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000040");
463 PrimitiveBaseShape shape = PrimitiveBaseShape.CreateSphere();
464 Vector3 groupPosition = new Vector3(10, 20, 30);
465 Quaternion rotationOffset = new Quaternion(20, 30, 40, 50);
466 Vector3 offsetPosition = new Vector3(5, 10, 15);
467
468 part1
469 = new SceneObjectPart(
470 ownerId, shape, groupPosition, rotationOffset, offsetPosition);
471 part1.Name = partName;
472
473 object1 = new SceneObjectGroup(part1);
474 scene.AddNewSceneObject(object1, false);
475 }
476
477 UUID asset1Id = UUID.Parse("00000000-0000-0000-0000-000000000060");
478 AssetBase asset1 = AssetHelpers.CreateAsset(asset1Id, object1);
479 scene.AssetService.Store(asset1);
480
481 // Create item
482 UUID item1Id = UUID.Parse("00000000-0000-0000-0000-000000000080");
483 InventoryItemBase item1 = new InventoryItemBase();
484 item1.Name = itemName;
485 item1.AssetID = asset1.FullID;
486 item1.ID = item1Id;
487 InventoryFolderBase objsFolder
488 = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, userId, "Objects")[0];
489 item1.Folder = objsFolder.ID;
490 scene.AddInventoryItem(item1);
491
492 MemoryStream archiveWriteStream = new MemoryStream();
493 archiverModule.OnInventoryArchiveSaved += SaveCompleted;
494
495 mre.Reset();
496 archiverModule.ArchiveInventory(
497 Guid.NewGuid(), userFirstName, userLastName, "Objects", userPassword, archiveWriteStream);
498 mre.WaitOne(60000, false);
499
500 // LOAD ITEM
501 MemoryStream archiveReadStream = new MemoryStream(archiveWriteStream.ToArray());
502
503 archiverModule.DearchiveInventory(userFirstName, userLastName, "Scripts", userPassword, archiveReadStream);
504
505 InventoryItemBase foundItem1
506 = InventoryArchiveUtils.FindItemByPath(
507 scene.InventoryService, userId, "Scripts/Objects/" + humanEscapedItemName);
508
509 Assert.That(foundItem1, Is.Not.Null, "Didn't find loaded item 1");
510// Assert.That(
511// foundItem1.CreatorId, Is.EqualTo(userUuid),
512// "Loaded item non-uuid creator doesn't match that of the loading user");
513 Assert.That(
514 foundItem1.Name, Is.EqualTo(itemName),
515 "Loaded item name doesn't match saved name");
516 } 209 }
517 210
518 /// <summary> 211 /// <summary>
519 /// Test loading a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet) where 212 /// Test loading a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet) where
520 /// embedded creators do not exist in the system 213 /// the creator or an account with the creator's name does not exist within the system.
521 /// </summary> 214 /// </summary>
522 ///
523 /// This may possibly one day get overtaken by the as yet incomplete temporary profiles feature
524 /// (as tested in the a later commented out test)
525 /// This test is currently disabled
526 [Test] 215 [Test]
527 public void TestLoadIarV0_1AbsentUsers() 216 public void TestLoadIarV0_1AbsentCreator()
528 { 217 {
529 TestHelper.InMethod(); 218 TestHelper.InMethod();
530 //log4net.Config.XmlConfigurator.Configure(); 219// log4net.Config.XmlConfigurator.Configure();
531
532 string userFirstName = "Charlie";
533 string userLastName = "Chan";
534 UUID userUuid = UUID.Parse("00000000-0000-0000-0000-000000000999");
535 string userItemCreatorFirstName = "Bat";
536 string userItemCreatorLastName = "Man";
537 //UUID userItemCreatorUuid = UUID.Parse("00000000-0000-0000-0000-000000008888");
538
539 string itemName = "b.lsl";
540 string archiveItemName = InventoryArchiveWriteRequest.CreateArchiveItemName(itemName, UUID.Random());
541
542 MemoryStream archiveWriteStream = new MemoryStream();
543 TarArchiveWriter tar = new TarArchiveWriter(archiveWriteStream);
544
545 InventoryItemBase item1 = new InventoryItemBase();
546 item1.Name = itemName;
547 item1.AssetID = UUID.Random();
548 item1.GroupID = UUID.Random();
549 item1.CreatorId = OspResolver.MakeOspa(userItemCreatorFirstName, userItemCreatorLastName);
550 //item1.CreatorId = userUuid.ToString();
551 //item1.CreatorId = "00000000-0000-0000-0000-000000000444";
552 item1.Owner = UUID.Zero;
553 220
554 string item1FileName
555 = string.Format("{0}{1}", ArchiveConstants.INVENTORY_PATH, archiveItemName);
556 tar.WriteFile(item1FileName, UserInventoryItemSerializer.Serialize(item1, new Dictionary<string,object>(), null));
557 tar.Close();
558
559 MemoryStream archiveReadStream = new MemoryStream(archiveWriteStream.ToArray());
560 SerialiserModule serialiserModule = new SerialiserModule(); 221 SerialiserModule serialiserModule = new SerialiserModule();
561 InventoryArchiverModule archiverModule = new InventoryArchiverModule(); 222 InventoryArchiverModule archiverModule = new InventoryArchiverModule();
562
563 // Annoyingly, we have to set up a scene even though inventory loading has nothing to do with a scene
564 Scene scene = SceneSetupHelpers.SetupScene("inventory"); 223 Scene scene = SceneSetupHelpers.SetupScene("inventory");
565
566 SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule); 224 SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule);
567 UserProfileTestUtils.CreateUserWithInventory(scene, userFirstName, userLastName, userUuid, "meowfood");
568 225
569 archiverModule.DearchiveInventory(userFirstName, userLastName, "/", "meowfood", archiveReadStream); 226 UserProfileTestUtils.CreateUserWithInventory(scene, m_ua1, "password");
227 archiverModule.DearchiveInventory(m_ua1.FirstName, m_ua1.LastName, "/", "password", m_iarStream);
570 228
571 InventoryItemBase foundItem1 229 InventoryItemBase foundItem1
572 = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, userUuid, itemName); 230 = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, m_ua1.PrincipalID, m_item1Name);
573 231
574 Assert.That(foundItem1, Is.Not.Null, "Didn't find loaded item 1"); 232 Assert.That(foundItem1, Is.Not.Null, "Didn't find loaded item 1");
575// Assert.That( 233// Assert.That(
576// foundItem1.CreatorId, Is.EqualTo(userUuid), 234// foundItem1.CreatorId, Is.EqualTo(userUuid),
577// "Loaded item non-uuid creator doesn't match that of the loading user"); 235// "Loaded item non-uuid creator doesn't match that of the loading user");
578 Assert.That( 236 Assert.That(
579 foundItem1.CreatorIdAsUuid, Is.EqualTo(userUuid), 237 foundItem1.CreatorIdAsUuid, Is.EqualTo(m_ua1.PrincipalID),
580 "Loaded item uuid creator doesn't match that of the loading user"); 238 "Loaded item uuid creator doesn't match that of the loading user");
581 } 239 }
582
583 /// <summary>
584 /// Test loading a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet) where
585 /// no account exists with the creator name
586 /// </summary>
587 /// Disabled since temporary profiles have not yet been implemented.
588 ///
589 //[Test]
590 //public void TestLoadIarV0_1TempProfiles()
591 //{
592 // TestHelper.InMethod();
593
594 // //log4net.Config.XmlConfigurator.Configure();
595
596 // string userFirstName = "Dennis";
597 // string userLastName = "Menace";
598 // UUID userUuid = UUID.Parse("00000000-0000-0000-0000-000000000aaa");
599 // string user2FirstName = "Walter";
600 // string user2LastName = "Mitty";
601
602 // string itemName = "b.lsl";
603 // string archiveItemName = InventoryArchiveWriteRequest.CreateArchiveItemName(itemName, UUID.Random());
604
605 // MemoryStream archiveWriteStream = new MemoryStream();
606 // TarArchiveWriter tar = new TarArchiveWriter(archiveWriteStream);
607
608 // InventoryItemBase item1 = new InventoryItemBase();
609 // item1.Name = itemName;
610 // item1.AssetID = UUID.Random();
611 // item1.GroupID = UUID.Random();
612 // item1.CreatorId = OspResolver.MakeOspa(user2FirstName, user2LastName);
613 // item1.Owner = UUID.Zero;
614
615 // string item1FileName
616 // = string.Format("{0}{1}", ArchiveConstants.INVENTORY_PATH, archiveItemName);
617 // tar.WriteFile(item1FileName, UserInventoryItemSerializer.Serialize(item1));
618 // tar.Close();
619
620 // MemoryStream archiveReadStream = new MemoryStream(archiveWriteStream.ToArray());
621 // SerialiserModule serialiserModule = new SerialiserModule();
622 // InventoryArchiverModule archiverModule = new InventoryArchiverModule();
623
624 // // Annoyingly, we have to set up a scene even though inventory loading has nothing to do with a scene
625 // Scene scene = SceneSetupHelpers.SetupScene();
626 // IUserAdminService userAdminService = scene.CommsManager.UserAdminService;
627
628 // SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule);
629 // userAdminService.AddUser(
630 // userFirstName, userLastName, "meowfood", String.Empty, 1000, 1000, userUuid);
631
632 // archiverModule.DearchiveInventory(userFirstName, userLastName, "/", "troll", archiveReadStream);
633
634 // // Check that a suitable temporary user profile has been created.
635 // UserProfileData user2Profile
636 // = scene.CommsManager.UserService.GetUserProfile(
637 // OspResolver.HashName(user2FirstName + " " + user2LastName));
638 // Assert.That(user2Profile, Is.Not.Null);
639 // Assert.That(user2Profile.FirstName == user2FirstName);
640 // Assert.That(user2Profile.SurName == user2LastName);
641
642 // CachedUserInfo userInfo
643 // = scene.CommsManager.UserProfileCacheService.GetUserDetails(userFirstName, userLastName);
644 // userInfo.OnInventoryReceived += InventoryReceived;
645
646 // lock (this)
647 // {
648 // userInfo.FetchInventory();
649 // Monitor.Wait(this, 60000);
650 // }
651
652 // InventoryItemBase foundItem = userInfo.RootFolder.FindItemByPath(itemName);
653
654 // Assert.That(foundItem.CreatorId, Is.EqualTo(item1.CreatorId));
655 // Assert.That(
656 // foundItem.CreatorIdAsUuid, Is.EqualTo(OspResolver.HashName(user2FirstName + " " + user2LastName)));
657 // Assert.That(foundItem.Owner, Is.EqualTo(userUuid));
658
659 // Console.WriteLine("### Successfully completed {0} ###", MethodBase.GetCurrentMethod());
660 //}
661
662 /// <summary>
663 /// Test replication of an archive path to the user's inventory.
664 /// </summary>
665 [Test]
666 public void TestNewIarPath()
667 {
668 TestHelper.InMethod();
669// log4net.Config.XmlConfigurator.Configure();
670
671 Scene scene = SceneSetupHelpers.SetupScene("inventory");
672 UserAccount ua1 = UserProfileTestUtils.CreateUserWithInventory(scene);
673
674 Dictionary <string, InventoryFolderBase> foldersCreated = new Dictionary<string, InventoryFolderBase>();
675 HashSet<InventoryNodeBase> nodesLoaded = new HashSet<InventoryNodeBase>();
676
677 string folder1Name = "1";
678 string folder2aName = "2a";
679 string folder2bName = "2b";
680
681 string folder1ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder1Name, UUID.Random());
682 string folder2aArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder2aName, UUID.Random());
683 string folder2bArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder2bName, UUID.Random());
684
685 string iarPath1 = string.Join("", new string[] { folder1ArchiveName, folder2aArchiveName });
686 string iarPath2 = string.Join("", new string[] { folder1ArchiveName, folder2bArchiveName });
687
688 {
689 // Test replication of path1
690 new InventoryArchiveReadRequest(scene, ua1, null, (Stream)null, false)
691 .ReplicateArchivePathToUserInventory(
692 iarPath1, scene.InventoryService.GetRootFolder(ua1.PrincipalID),
693 foldersCreated, nodesLoaded);
694
695 List<InventoryFolderBase> folder1Candidates
696 = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, ua1.PrincipalID, folder1Name);
697 Assert.That(folder1Candidates.Count, Is.EqualTo(1));
698
699 InventoryFolderBase folder1 = folder1Candidates[0];
700 List<InventoryFolderBase> folder2aCandidates
701 = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1, folder2aName);
702 Assert.That(folder2aCandidates.Count, Is.EqualTo(1));
703 }
704
705 {
706 // Test replication of path2
707 new InventoryArchiveReadRequest(scene, ua1, null, (Stream)null, false)
708 .ReplicateArchivePathToUserInventory(
709 iarPath2, scene.InventoryService.GetRootFolder(ua1.PrincipalID),
710 foldersCreated, nodesLoaded);
711
712 List<InventoryFolderBase> folder1Candidates
713 = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, ua1.PrincipalID, folder1Name);
714 Assert.That(folder1Candidates.Count, Is.EqualTo(1));
715
716 InventoryFolderBase folder1 = folder1Candidates[0];
717
718 List<InventoryFolderBase> folder2aCandidates
719 = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1, folder2aName);
720 Assert.That(folder2aCandidates.Count, Is.EqualTo(1));
721
722 List<InventoryFolderBase> folder2bCandidates
723 = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1, folder2bName);
724 Assert.That(folder2bCandidates.Count, Is.EqualTo(1));
725 }
726 }
727
728 /// <summary>
729 /// Test replication of a partly existing archive path to the user's inventory. This should create
730 /// a duplicate path without the merge option.
731 /// </summary>
732 [Test]
733 public void TestPartExistingIarPath()
734 {
735 TestHelper.InMethod();
736 //log4net.Config.XmlConfigurator.Configure();
737
738 Scene scene = SceneSetupHelpers.SetupScene("inventory");
739 UserAccount ua1 = UserProfileTestUtils.CreateUserWithInventory(scene);
740
741 string folder1ExistingName = "a";
742 string folder2Name = "b";
743
744 InventoryFolderBase folder1
745 = UserInventoryTestUtils.CreateInventoryFolder(
746 scene.InventoryService, ua1.PrincipalID, folder1ExistingName);
747
748 string folder1ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder1ExistingName, UUID.Random());
749 string folder2ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder2Name, UUID.Random());
750
751 string itemArchivePath = string.Join("", new string[] { folder1ArchiveName, folder2ArchiveName });
752
753 new InventoryArchiveReadRequest(scene, ua1, null, (Stream)null, false)
754 .ReplicateArchivePathToUserInventory(
755 itemArchivePath, scene.InventoryService.GetRootFolder(ua1.PrincipalID),
756 new Dictionary<string, InventoryFolderBase>(), new HashSet<InventoryNodeBase>());
757
758 List<InventoryFolderBase> folder1PostCandidates
759 = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, ua1.PrincipalID, folder1ExistingName);
760 Assert.That(folder1PostCandidates.Count, Is.EqualTo(2));
761
762 // FIXME: Temporarily, we're going to do something messy to make sure we pick up the created folder.
763 InventoryFolderBase folder1Post = null;
764 foreach (InventoryFolderBase folder in folder1PostCandidates)
765 {
766 if (folder.ID != folder1.ID)
767 {
768 folder1Post = folder;
769 break;
770 }
771 }
772// Assert.That(folder1Post.ID, Is.EqualTo(folder1.ID));
773
774 List<InventoryFolderBase> folder2PostCandidates
775 = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1Post, "b");
776 Assert.That(folder2PostCandidates.Count, Is.EqualTo(1));
777 }
778
779 /// <summary>
780 /// Test replication of a partly existing archive path to the user's inventory. This should create
781 /// a merged path.
782 /// </summary>
783 [Test]
784 public void TestMergeIarPath()
785 {
786 TestHelper.InMethod();
787// log4net.Config.XmlConfigurator.Configure();
788
789 Scene scene = SceneSetupHelpers.SetupScene("inventory");
790 UserAccount ua1 = UserProfileTestUtils.CreateUserWithInventory(scene);
791
792 string folder1ExistingName = "a";
793 string folder2Name = "b";
794
795 InventoryFolderBase folder1
796 = UserInventoryTestUtils.CreateInventoryFolder(
797 scene.InventoryService, ua1.PrincipalID, folder1ExistingName);
798
799 string folder1ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder1ExistingName, UUID.Random());
800 string folder2ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder2Name, UUID.Random());
801
802 string itemArchivePath = string.Join("", new string[] { folder1ArchiveName, folder2ArchiveName });
803
804 new InventoryArchiveReadRequest(scene, ua1, folder1ExistingName, (Stream)null, true)
805 .ReplicateArchivePathToUserInventory(
806 itemArchivePath, scene.InventoryService.GetRootFolder(ua1.PrincipalID),
807 new Dictionary<string, InventoryFolderBase>(), new HashSet<InventoryNodeBase>());
808
809 List<InventoryFolderBase> folder1PostCandidates
810 = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, ua1.PrincipalID, folder1ExistingName);
811 Assert.That(folder1PostCandidates.Count, Is.EqualTo(1));
812 Assert.That(folder1PostCandidates[0].ID, Is.EqualTo(folder1.ID));
813
814 List<InventoryFolderBase> folder2PostCandidates
815 = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1PostCandidates[0], "b");
816 Assert.That(folder2PostCandidates.Count, Is.EqualTo(1));
817 }
818 } 240 }
819} \ No newline at end of file 241} \ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/PathTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/PathTests.cs
new file mode 100644
index 0000000..1220a70
--- /dev/null
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/PathTests.cs
@@ -0,0 +1,480 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using System.IO;
31using System.Reflection;
32using System.Threading;
33using NUnit.Framework;
34using OpenMetaverse;
35using OpenSim.Data;
36using OpenSim.Framework;
37using OpenSim.Framework.Serialization;
38using OpenSim.Framework.Serialization.External;
39using OpenSim.Framework.Communications;
40using OpenSim.Region.CoreModules.Avatar.Inventory.Archiver;
41using OpenSim.Region.CoreModules.World.Serialiser;
42using OpenSim.Region.Framework.Scenes;
43using OpenSim.Region.Framework.Scenes.Serialization;
44using OpenSim.Services.Interfaces;
45using OpenSim.Tests.Common;
46using OpenSim.Tests.Common.Mock;
47using OpenSim.Tests.Common.Setup;
48
49namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
50{
51 [TestFixture]
52 public class PathTests : InventoryArchiveTestCase
53 {
54 /// <summary>
55 /// Test saving an inventory path to a V0.1 OpenSim Inventory Archive
56 /// (subject to change since there is no fixed format yet).
57 /// </summary>
58 [Test]
59 public void TestSavePathToIarV0_1()
60 {
61 TestHelper.InMethod();
62// log4net.Config.XmlConfigurator.Configure();
63
64 InventoryArchiverModule archiverModule = new InventoryArchiverModule();
65
66 Scene scene = SceneSetupHelpers.SetupScene("Inventory");
67 SceneSetupHelpers.SetupSceneModules(scene, archiverModule);
68
69 // Create user
70 string userFirstName = "Jock";
71 string userLastName = "Stirrup";
72 string userPassword = "troll";
73 UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000020");
74 UserProfileTestUtils.CreateUserWithInventory(scene, userFirstName, userLastName, userId, userPassword);
75
76 // Create asset
77 SceneObjectGroup object1;
78 SceneObjectPart part1;
79 {
80 string partName = "My Little Dog Object";
81 UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000040");
82 PrimitiveBaseShape shape = PrimitiveBaseShape.CreateSphere();
83 Vector3 groupPosition = new Vector3(10, 20, 30);
84 Quaternion rotationOffset = new Quaternion(20, 30, 40, 50);
85 Vector3 offsetPosition = new Vector3(5, 10, 15);
86
87 part1
88 = new SceneObjectPart(
89 ownerId, shape, groupPosition, rotationOffset, offsetPosition);
90 part1.Name = partName;
91
92 object1 = new SceneObjectGroup(part1);
93 scene.AddNewSceneObject(object1, false);
94 }
95
96 UUID asset1Id = UUID.Parse("00000000-0000-0000-0000-000000000060");
97 AssetBase asset1 = AssetHelpers.CreateAsset(asset1Id, object1);
98 scene.AssetService.Store(asset1);
99
100 // Create item
101 UUID item1Id = UUID.Parse("00000000-0000-0000-0000-000000000080");
102 InventoryItemBase item1 = new InventoryItemBase();
103 item1.Name = "My Little Dog";
104 item1.AssetID = asset1.FullID;
105 item1.ID = item1Id;
106 InventoryFolderBase objsFolder
107 = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, userId, "Objects")[0];
108 item1.Folder = objsFolder.ID;
109 scene.AddInventoryItem(item1);
110
111 MemoryStream archiveWriteStream = new MemoryStream();
112 archiverModule.OnInventoryArchiveSaved += SaveCompleted;
113
114 // Test saving a particular path
115 mre.Reset();
116 archiverModule.ArchiveInventory(
117 Guid.NewGuid(), userFirstName, userLastName, "Objects", userPassword, archiveWriteStream);
118 mre.WaitOne(60000, false);
119
120 byte[] archive = archiveWriteStream.ToArray();
121 MemoryStream archiveReadStream = new MemoryStream(archive);
122 TarArchiveReader tar = new TarArchiveReader(archiveReadStream);
123
124 //bool gotControlFile = false;
125 bool gotObject1File = false;
126 //bool gotObject2File = false;
127 string expectedObject1FileName = InventoryArchiveWriteRequest.CreateArchiveItemName(item1);
128 string expectedObject1FilePath = string.Format(
129 "{0}{1}{2}",
130 ArchiveConstants.INVENTORY_PATH,
131 InventoryArchiveWriteRequest.CreateArchiveFolderName(objsFolder),
132 expectedObject1FileName);
133
134 string filePath;
135 TarArchiveReader.TarEntryType tarEntryType;
136
137// Console.WriteLine("Reading archive");
138
139 while (tar.ReadEntry(out filePath, out tarEntryType) != null)
140 {
141// Console.WriteLine("Got {0}", filePath);
142
143// if (ArchiveConstants.CONTROL_FILE_PATH == filePath)
144// {
145// gotControlFile = true;
146// }
147
148 if (filePath.StartsWith(ArchiveConstants.INVENTORY_PATH) && filePath.EndsWith(".xml"))
149 {
150// string fileName = filePath.Remove(0, "Objects/".Length);
151//
152// if (fileName.StartsWith(part1.Name))
153// {
154 Assert.That(expectedObject1FilePath, Is.EqualTo(filePath));
155 gotObject1File = true;
156// }
157// else if (fileName.StartsWith(part2.Name))
158// {
159// Assert.That(fileName, Is.EqualTo(expectedObject2FileName));
160// gotObject2File = true;
161// }
162 }
163 }
164
165// Assert.That(gotControlFile, Is.True, "No control file in archive");
166 Assert.That(gotObject1File, Is.True, "No item1 file in archive");
167// Assert.That(gotObject2File, Is.True, "No object2 file in archive");
168
169 // TODO: Test presence of more files and contents of files.
170 }
171
172 /// <summary>
173 /// Test loading an IAR to various different inventory paths.
174 /// </summary>
175 [Test]
176 public void TestLoadIarToInventoryPaths()
177 {
178 TestHelper.InMethod();
179// log4net.Config.XmlConfigurator.Configure();
180
181 SerialiserModule serialiserModule = new SerialiserModule();
182 InventoryArchiverModule archiverModule = new InventoryArchiverModule();
183
184 // Annoyingly, we have to set up a scene even though inventory loading has nothing to do with a scene
185 Scene scene = SceneSetupHelpers.SetupScene("inventory");
186
187 SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule);
188
189 UserProfileTestUtils.CreateUserWithInventory(scene, m_ua1, "meowfood");
190 UserProfileTestUtils.CreateUserWithInventory(scene, m_ua2, "hampshire");
191
192 archiverModule.DearchiveInventory(m_ua1.FirstName, m_ua1.LastName, "/", "meowfood", m_iarStream);
193 InventoryItemBase foundItem1
194 = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, m_ua1.PrincipalID, m_item1Name);
195
196 Assert.That(foundItem1, Is.Not.Null, "Didn't find loaded item 1");
197
198 // Now try loading to a root child folder
199 UserInventoryTestUtils.CreateInventoryFolder(scene.InventoryService, m_ua1.PrincipalID, "xA");
200 MemoryStream archiveReadStream = new MemoryStream(m_iarStream.ToArray());
201 archiverModule.DearchiveInventory(m_ua1.FirstName, m_ua1.LastName, "xA", "meowfood", archiveReadStream);
202
203 InventoryItemBase foundItem2
204 = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, m_ua1.PrincipalID, "xA/" + m_item1Name);
205 Assert.That(foundItem2, Is.Not.Null, "Didn't find loaded item 2");
206
207 // Now try loading to a more deeply nested folder
208 UserInventoryTestUtils.CreateInventoryFolder(scene.InventoryService, m_ua1.PrincipalID, "xB/xC");
209 archiveReadStream = new MemoryStream(archiveReadStream.ToArray());
210 archiverModule.DearchiveInventory(m_ua1.FirstName, m_ua1.LastName, "xB/xC", "meowfood", archiveReadStream);
211
212 InventoryItemBase foundItem3
213 = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, m_ua1.PrincipalID, "xB/xC/" + m_item1Name);
214 Assert.That(foundItem3, Is.Not.Null, "Didn't find loaded item 3");
215 }
216
217 /// <summary>
218 /// Test that things work when the load path specified starts with a slash
219 /// </summary>
220 [Test]
221 public void TestLoadIarPathStartsWithSlash()
222 {
223 TestHelper.InMethod();
224// log4net.Config.XmlConfigurator.Configure();
225
226 SerialiserModule serialiserModule = new SerialiserModule();
227 InventoryArchiverModule archiverModule = new InventoryArchiverModule();
228 Scene scene = SceneSetupHelpers.SetupScene("inventory");
229 SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule);
230
231 UserProfileTestUtils.CreateUserWithInventory(scene, m_ua1, "password");
232 archiverModule.DearchiveInventory(m_ua1.FirstName, m_ua1.LastName, "/Objects", "password", m_iarStream);
233
234 InventoryItemBase foundItem1
235 = InventoryArchiveUtils.FindItemByPath(
236 scene.InventoryService, m_ua1.PrincipalID, "/Objects/" + m_item1Name);
237
238 Assert.That(foundItem1, Is.Not.Null, "Didn't find loaded item 1 in TestLoadIarFolderStartsWithSlash()");
239 }
240
241 [Test]
242 public void TestLoadIarPathWithEscapedChars()
243 {
244 TestHelper.InMethod();
245// log4net.Config.XmlConfigurator.Configure();
246
247 string itemName = "You & you are a mean/man/";
248 string humanEscapedItemName = @"You & you are a mean\/man\/";
249 string userPassword = "meowfood";
250
251 InventoryArchiverModule archiverModule = new InventoryArchiverModule();
252
253 Scene scene = SceneSetupHelpers.SetupScene("Inventory");
254 SceneSetupHelpers.SetupSceneModules(scene, archiverModule);
255
256 // Create user
257 string userFirstName = "Jock";
258 string userLastName = "Stirrup";
259 UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000020");
260 UserProfileTestUtils.CreateUserWithInventory(scene, userFirstName, userLastName, userId, "meowfood");
261
262 // Create asset
263 SceneObjectGroup object1;
264 SceneObjectPart part1;
265 {
266 string partName = "part name";
267 UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000040");
268 PrimitiveBaseShape shape = PrimitiveBaseShape.CreateSphere();
269 Vector3 groupPosition = new Vector3(10, 20, 30);
270 Quaternion rotationOffset = new Quaternion(20, 30, 40, 50);
271 Vector3 offsetPosition = new Vector3(5, 10, 15);
272
273 part1
274 = new SceneObjectPart(
275 ownerId, shape, groupPosition, rotationOffset, offsetPosition);
276 part1.Name = partName;
277
278 object1 = new SceneObjectGroup(part1);
279 scene.AddNewSceneObject(object1, false);
280 }
281
282 UUID asset1Id = UUID.Parse("00000000-0000-0000-0000-000000000060");
283 AssetBase asset1 = AssetHelpers.CreateAsset(asset1Id, object1);
284 scene.AssetService.Store(asset1);
285
286 // Create item
287 UUID item1Id = UUID.Parse("00000000-0000-0000-0000-000000000080");
288 InventoryItemBase item1 = new InventoryItemBase();
289 item1.Name = itemName;
290 item1.AssetID = asset1.FullID;
291 item1.ID = item1Id;
292 InventoryFolderBase objsFolder
293 = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, userId, "Objects")[0];
294 item1.Folder = objsFolder.ID;
295 scene.AddInventoryItem(item1);
296
297 MemoryStream archiveWriteStream = new MemoryStream();
298 archiverModule.OnInventoryArchiveSaved += SaveCompleted;
299
300 mre.Reset();
301 archiverModule.ArchiveInventory(
302 Guid.NewGuid(), userFirstName, userLastName, "Objects", userPassword, archiveWriteStream);
303 mre.WaitOne(60000, false);
304
305 // LOAD ITEM
306 MemoryStream archiveReadStream = new MemoryStream(archiveWriteStream.ToArray());
307
308 archiverModule.DearchiveInventory(userFirstName, userLastName, "Scripts", userPassword, archiveReadStream);
309
310 InventoryItemBase foundItem1
311 = InventoryArchiveUtils.FindItemByPath(
312 scene.InventoryService, userId, "Scripts/Objects/" + humanEscapedItemName);
313
314 Assert.That(foundItem1, Is.Not.Null, "Didn't find loaded item 1");
315// Assert.That(
316// foundItem1.CreatorId, Is.EqualTo(userUuid),
317// "Loaded item non-uuid creator doesn't match that of the loading user");
318 Assert.That(
319 foundItem1.Name, Is.EqualTo(itemName),
320 "Loaded item name doesn't match saved name");
321 }
322
323 /// <summary>
324 /// Test replication of an archive path to the user's inventory.
325 /// </summary>
326 [Test]
327 public void TestNewIarPath()
328 {
329 TestHelper.InMethod();
330// log4net.Config.XmlConfigurator.Configure();
331
332 Scene scene = SceneSetupHelpers.SetupScene("inventory");
333 UserAccount ua1 = UserProfileTestUtils.CreateUserWithInventory(scene);
334
335 Dictionary <string, InventoryFolderBase> foldersCreated = new Dictionary<string, InventoryFolderBase>();
336 HashSet<InventoryNodeBase> nodesLoaded = new HashSet<InventoryNodeBase>();
337
338 string folder1Name = "1";
339 string folder2aName = "2a";
340 string folder2bName = "2b";
341
342 string folder1ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder1Name, UUID.Random());
343 string folder2aArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder2aName, UUID.Random());
344 string folder2bArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder2bName, UUID.Random());
345
346 string iarPath1 = string.Join("", new string[] { folder1ArchiveName, folder2aArchiveName });
347 string iarPath2 = string.Join("", new string[] { folder1ArchiveName, folder2bArchiveName });
348
349 {
350 // Test replication of path1
351 new InventoryArchiveReadRequest(scene, ua1, null, (Stream)null, false)
352 .ReplicateArchivePathToUserInventory(
353 iarPath1, scene.InventoryService.GetRootFolder(ua1.PrincipalID),
354 foldersCreated, nodesLoaded);
355
356 List<InventoryFolderBase> folder1Candidates
357 = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, ua1.PrincipalID, folder1Name);
358 Assert.That(folder1Candidates.Count, Is.EqualTo(1));
359
360 InventoryFolderBase folder1 = folder1Candidates[0];
361 List<InventoryFolderBase> folder2aCandidates
362 = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1, folder2aName);
363 Assert.That(folder2aCandidates.Count, Is.EqualTo(1));
364 }
365
366 {
367 // Test replication of path2
368 new InventoryArchiveReadRequest(scene, ua1, null, (Stream)null, false)
369 .ReplicateArchivePathToUserInventory(
370 iarPath2, scene.InventoryService.GetRootFolder(ua1.PrincipalID),
371 foldersCreated, nodesLoaded);
372
373 List<InventoryFolderBase> folder1Candidates
374 = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, ua1.PrincipalID, folder1Name);
375 Assert.That(folder1Candidates.Count, Is.EqualTo(1));
376
377 InventoryFolderBase folder1 = folder1Candidates[0];
378
379 List<InventoryFolderBase> folder2aCandidates
380 = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1, folder2aName);
381 Assert.That(folder2aCandidates.Count, Is.EqualTo(1));
382
383 List<InventoryFolderBase> folder2bCandidates
384 = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1, folder2bName);
385 Assert.That(folder2bCandidates.Count, Is.EqualTo(1));
386 }
387 }
388
389 /// <summary>
390 /// Test replication of a partly existing archive path to the user's inventory. This should create
391 /// a duplicate path without the merge option.
392 /// </summary>
393 [Test]
394 public void TestPartExistingIarPath()
395 {
396 TestHelper.InMethod();
397 //log4net.Config.XmlConfigurator.Configure();
398
399 Scene scene = SceneSetupHelpers.SetupScene("inventory");
400 UserAccount ua1 = UserProfileTestUtils.CreateUserWithInventory(scene);
401
402 string folder1ExistingName = "a";
403 string folder2Name = "b";
404
405 InventoryFolderBase folder1
406 = UserInventoryTestUtils.CreateInventoryFolder(
407 scene.InventoryService, ua1.PrincipalID, folder1ExistingName);
408
409 string folder1ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder1ExistingName, UUID.Random());
410 string folder2ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder2Name, UUID.Random());
411
412 string itemArchivePath = string.Join("", new string[] { folder1ArchiveName, folder2ArchiveName });
413
414 new InventoryArchiveReadRequest(scene, ua1, null, (Stream)null, false)
415 .ReplicateArchivePathToUserInventory(
416 itemArchivePath, scene.InventoryService.GetRootFolder(ua1.PrincipalID),
417 new Dictionary<string, InventoryFolderBase>(), new HashSet<InventoryNodeBase>());
418
419 List<InventoryFolderBase> folder1PostCandidates
420 = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, ua1.PrincipalID, folder1ExistingName);
421 Assert.That(folder1PostCandidates.Count, Is.EqualTo(2));
422
423 // FIXME: Temporarily, we're going to do something messy to make sure we pick up the created folder.
424 InventoryFolderBase folder1Post = null;
425 foreach (InventoryFolderBase folder in folder1PostCandidates)
426 {
427 if (folder.ID != folder1.ID)
428 {
429 folder1Post = folder;
430 break;
431 }
432 }
433// Assert.That(folder1Post.ID, Is.EqualTo(folder1.ID));
434
435 List<InventoryFolderBase> folder2PostCandidates
436 = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1Post, "b");
437 Assert.That(folder2PostCandidates.Count, Is.EqualTo(1));
438 }
439
440 /// <summary>
441 /// Test replication of a partly existing archive path to the user's inventory. This should create
442 /// a merged path.
443 /// </summary>
444 [Test]
445 public void TestMergeIarPath()
446 {
447 TestHelper.InMethod();
448// log4net.Config.XmlConfigurator.Configure();
449
450 Scene scene = SceneSetupHelpers.SetupScene("inventory");
451 UserAccount ua1 = UserProfileTestUtils.CreateUserWithInventory(scene);
452
453 string folder1ExistingName = "a";
454 string folder2Name = "b";
455
456 InventoryFolderBase folder1
457 = UserInventoryTestUtils.CreateInventoryFolder(
458 scene.InventoryService, ua1.PrincipalID, folder1ExistingName);
459
460 string folder1ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder1ExistingName, UUID.Random());
461 string folder2ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder2Name, UUID.Random());
462
463 string itemArchivePath = string.Join("", new string[] { folder1ArchiveName, folder2ArchiveName });
464
465 new InventoryArchiveReadRequest(scene, ua1, folder1ExistingName, (Stream)null, true)
466 .ReplicateArchivePathToUserInventory(
467 itemArchivePath, scene.InventoryService.GetRootFolder(ua1.PrincipalID),
468 new Dictionary<string, InventoryFolderBase>(), new HashSet<InventoryNodeBase>());
469
470 List<InventoryFolderBase> folder1PostCandidates
471 = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, ua1.PrincipalID, folder1ExistingName);
472 Assert.That(folder1PostCandidates.Count, Is.EqualTo(1));
473 Assert.That(folder1PostCandidates[0].ID, Is.EqualTo(folder1.ID));
474
475 List<InventoryFolderBase> folder2PostCandidates
476 = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1PostCandidates[0], "b");
477 Assert.That(folder2PostCandidates.Count, Is.EqualTo(1));
478 }
479 }
480} \ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
index e622e0c..138556f 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
@@ -400,6 +400,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
400 if (!UpdateAgent(reg, finalDestination, agent)) 400 if (!UpdateAgent(reg, finalDestination, agent))
401 { 401 {
402 // Region doesn't take it 402 // Region doesn't take it
403 m_log.WarnFormat(
404 "[ENTITY TRANSFER MODULE]: UpdateAgent failed on teleport of {0} to {1}. Returning avatar to source region.",
405 sp.Name, finalDestination.RegionName);
406
403 Fail(sp, finalDestination); 407 Fail(sp, finalDestination);
404 return; 408 return;
405 } 409 }
@@ -426,16 +430,18 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
426 // that the client contacted the destination before we send the attachments and close things here. 430 // that the client contacted the destination before we send the attachments and close things here.
427 if (!WaitForCallback(sp.UUID)) 431 if (!WaitForCallback(sp.UUID))
428 { 432 {
429 Fail(sp, finalDestination); 433 m_log.WarnFormat(
434 "[ENTITY TRANSFER MODULE]: Teleport of {0} to {1} failed due to no callback from destination region. Returning avatar to source region.",
435 sp.Name, finalDestination.RegionName);
436
437 Fail(sp, finalDestination);
430 return; 438 return;
431 } 439 }
432 440
433
434 // CrossAttachmentsIntoNewRegion is a synchronous call. We shouldn't need to wait after it 441 // CrossAttachmentsIntoNewRegion is a synchronous call. We shouldn't need to wait after it
435 CrossAttachmentsIntoNewRegion(finalDestination, sp, true); 442 CrossAttachmentsIntoNewRegion(finalDestination, sp, true);
436 443
437 // Well, this is it. The agent is over there. 444 // Well, this is it. The agent is over there.
438
439 KillEntity(sp.Scene, sp.LocalId); 445 KillEntity(sp.Scene, sp.LocalId);
440 446
441 // May need to logout or other cleanup 447 // May need to logout or other cleanup
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/Tests/GridConnectorsTests.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/Tests/GridConnectorsTests.cs
index ebfba2b..7128d2b 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/Tests/GridConnectorsTests.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/Tests/GridConnectorsTests.cs
@@ -32,7 +32,6 @@ using System.Reflection;
32using System.Threading; 32using System.Threading;
33using log4net.Config; 33using log4net.Config;
34using NUnit.Framework; 34using NUnit.Framework;
35using NUnit.Framework.SyntaxHelpers;
36using OpenMetaverse; 35using OpenMetaverse;
37using OpenSim.Framework; 36using OpenSim.Framework;
38using Nini.Config; 37using Nini.Config;
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/Tests/PresenceConnectorsTests.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/Tests/PresenceConnectorsTests.cs
index ef910f4..e471f75 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/Tests/PresenceConnectorsTests.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Presence/Tests/PresenceConnectorsTests.cs
@@ -32,7 +32,6 @@ using System.Reflection;
32using System.Threading; 32using System.Threading;
33using log4net.Config; 33using log4net.Config;
34using NUnit.Framework; 34using NUnit.Framework;
35using NUnit.Framework.SyntaxHelpers;
36using OpenMetaverse; 35using OpenMetaverse;
37using OpenSim.Framework; 36using OpenSim.Framework;
38using Nini.Config; 37using Nini.Config;
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs
index e1eee3b..97833f3 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs
@@ -192,15 +192,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
192 return false; 192 return false;
193 193
194 // Try local first 194 // Try local first
195 if (m_localBackend.UpdateAgent(destination, cAgentData)) 195 if (m_localBackend.IsLocalRegion(destination.RegionHandle))
196 return true; 196 return m_localBackend.UpdateAgent(destination, cAgentData);
197
198 // else do the remote thing
199 if (!m_localBackend.IsLocalRegion(destination.RegionHandle))
200 return m_remoteConnector.UpdateAgent(destination, cAgentData);
201
202 return false;
203 197
198 return m_remoteConnector.UpdateAgent(destination, cAgentData);
204 } 199 }
205 200
206 public bool UpdateAgent(GridRegion destination, AgentPosition cAgentData) 201 public bool UpdateAgent(GridRegion destination, AgentPosition cAgentData)
@@ -209,15 +204,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
209 return false; 204 return false;
210 205
211 // Try local first 206 // Try local first
212 if (m_localBackend.UpdateAgent(destination, cAgentData)) 207 if (m_localBackend.IsLocalRegion(destination.RegionHandle))
213 return true; 208 return m_localBackend.UpdateAgent(destination, cAgentData);
214
215 // else do the remote thing
216 if (!m_localBackend.IsLocalRegion(destination.RegionHandle))
217 return m_remoteConnector.UpdateAgent(destination, cAgentData);
218
219 return false;
220 209
210 return m_remoteConnector.UpdateAgent(destination, cAgentData);
221 } 211 }
222 212
223 public bool RetrieveAgent(GridRegion destination, UUID id, out IAgentData agent) 213 public bool RetrieveAgent(GridRegion destination, UUID id, out IAgentData agent)
diff --git a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs
index 04b6e3d..e2760a2 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs
@@ -32,7 +32,6 @@ using System.Reflection;
32using System.Threading; 32using System.Threading;
33using log4net.Config; 33using log4net.Config;
34using NUnit.Framework; 34using NUnit.Framework;
35using NUnit.Framework.SyntaxHelpers;
36using OpenMetaverse; 35using OpenMetaverse;
37using OpenMetaverse.Assets; 36using OpenMetaverse.Assets;
38using OpenSim.Framework; 37using OpenSim.Framework;
diff --git a/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs b/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs
index 7c5d044..898ca4a 100644
--- a/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs
+++ b/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs
@@ -50,7 +50,7 @@ using Caps = OpenSim.Framework.Capabilities.Caps;
50using OSDArray = OpenMetaverse.StructuredData.OSDArray; 50using OSDArray = OpenMetaverse.StructuredData.OSDArray;
51using OSDMap = OpenMetaverse.StructuredData.OSDMap; 51using OSDMap = OpenMetaverse.StructuredData.OSDMap;
52 52
53namespace OpenSim.Region.CoreModules.Media.Moap 53namespace OpenSim.Region.CoreModules.World.Media.Moap
54{ 54{
55 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "MoapModule")] 55 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "MoapModule")]
56 public class MoapModule : INonSharedRegionModule, IMoapModule 56 public class MoapModule : INonSharedRegionModule, IMoapModule
@@ -225,24 +225,62 @@ namespace OpenSim.Region.CoreModules.Media.Moap
225 return me; 225 return me;
226 } 226 }
227 227
228 /// <summary>
229 /// Set the media entry on the face of the given part.
230 /// </summary>
231 /// <param name="part">/param>
232 /// <param name="face"></param>
233 /// <param name="me">If null, then the media entry is cleared.</param>
228 public void SetMediaEntry(SceneObjectPart part, int face, MediaEntry me) 234 public void SetMediaEntry(SceneObjectPart part, int face, MediaEntry me)
229 { 235 {
236// m_log.DebugFormat("[MOAP]: SetMediaEntry for {0}, face {1}", part.Name, face);
237
230 CheckFaceParam(part, face); 238 CheckFaceParam(part, face);
231 239
232 if (null == part.Shape.Media) 240 if (null == part.Shape.Media)
233 part.Shape.Media = new PrimitiveBaseShape.MediaList(new MediaEntry[part.GetNumberOfSides()]); 241 {
234 242 if (me == null)
243 return;
244 else
245 part.Shape.Media = new PrimitiveBaseShape.MediaList(new MediaEntry[part.GetNumberOfSides()]);
246 }
247
235 lock (part.Shape.Media) 248 lock (part.Shape.Media)
236 part.Shape.Media[face] = me; 249 part.Shape.Media[face] = me;
237 250
238 UpdateMediaUrl(part, UUID.Zero); 251 UpdateMediaUrl(part, UUID.Zero);
252
253 SetPartMediaFlags(part, face, me != null);
254
239 part.ScheduleFullUpdate(); 255 part.ScheduleFullUpdate();
240 part.TriggerScriptChangedEvent(Changed.MEDIA); 256 part.TriggerScriptChangedEvent(Changed.MEDIA);
241 } 257 }
242 258
259 /// <summary>
260 /// Clear the media entry from the face of the given part.
261 /// </summary>
262 /// <param name="part"></param>
263 /// <param name="face"></param>
243 public void ClearMediaEntry(SceneObjectPart part, int face) 264 public void ClearMediaEntry(SceneObjectPart part, int face)
244 { 265 {
245 SetMediaEntry(part, face, null); 266 SetMediaEntry(part, face, null);
267 }
268
269 /// <summary>
270 /// Set the media flags on the texture face of the given part.
271 /// </summary>
272 /// <remarks>
273 /// The fact that we need a separate function to do what should be a simple one line operation is BUTT UGLY.
274 /// </remarks>
275 /// <param name="part"></param>
276 /// <param name="face"></param>
277 /// <param name="flag"></param>
278 protected void SetPartMediaFlags(SceneObjectPart part, int face, bool flag)
279 {
280 Primitive.TextureEntry te = part.Shape.Textures;
281 Primitive.TextureEntryFace teFace = te.CreateFace((uint)face);
282 teFace.MediaFlags = flag;
283 part.Shape.Textures = te;
246 } 284 }
247 285
248 /// <summary> 286 /// <summary>
@@ -333,7 +371,7 @@ namespace OpenSim.Region.CoreModules.Media.Moap
333 } 371 }
334 372
335// m_log.DebugFormat("[MOAP]: Received {0} media entries for prim {1}", omu.FaceMedia.Length, primId); 373// m_log.DebugFormat("[MOAP]: Received {0} media entries for prim {1}", omu.FaceMedia.Length, primId);
336 374//
337// for (int i = 0; i < omu.FaceMedia.Length; i++) 375// for (int i = 0; i < omu.FaceMedia.Length; i++)
338// { 376// {
339// MediaEntry me = omu.FaceMedia[i]; 377// MediaEntry me = omu.FaceMedia[i];
@@ -368,10 +406,7 @@ namespace OpenSim.Region.CoreModules.Media.Moap
368 // FIXME: Race condition here since some other texture entry manipulator may overwrite/get 406 // FIXME: Race condition here since some other texture entry manipulator may overwrite/get
369 // overwritten. Unfortunately, PrimitiveBaseShape does not allow us to change texture entry 407 // overwritten. Unfortunately, PrimitiveBaseShape does not allow us to change texture entry
370 // directly. 408 // directly.
371 Primitive.TextureEntry te = part.Shape.Textures; 409 SetPartMediaFlags(part, i, true);
372 Primitive.TextureEntryFace face = te.CreateFace((uint)i);
373 face.MediaFlags = true;
374 part.Shape.Textures = te;
375// m_log.DebugFormat( 410// m_log.DebugFormat(
376// "[MOAP]: Media flags for face {0} is {1}", 411// "[MOAP]: Media flags for face {0} is {1}",
377// i, part.Shape.Textures.FaceTextures[i].MediaFlags); 412// i, part.Shape.Textures.FaceTextures[i].MediaFlags);
@@ -380,6 +415,8 @@ namespace OpenSim.Region.CoreModules.Media.Moap
380 } 415 }
381 else 416 else
382 { 417 {
418// m_log.DebugFormat("[MOAP]: Setting existing media list for {0}", part.Name);
419
383 // We need to go through the media textures one at a time to make sure that we have permission 420 // We need to go through the media textures one at a time to make sure that we have permission
384 // to change them 421 // to change them
385 422
@@ -401,8 +438,7 @@ namespace OpenSim.Region.CoreModules.Media.Moap
401 if (null == media[i]) 438 if (null == media[i])
402 continue; 439 continue;
403 440
404 Primitive.TextureEntryFace face = te.CreateFace((uint)i); 441 SetPartMediaFlags(part, i, true);
405 face.MediaFlags = true;
406 442
407 // m_log.DebugFormat( 443 // m_log.DebugFormat(
408 // "[MOAP]: Media flags for face {0} is {1}", 444 // "[MOAP]: Media flags for face {0} is {1}",
diff --git a/OpenSim/Region/CoreModules/World/Media/Moap/Tests/MoapTests.cs b/OpenSim/Region/CoreModules/World/Media/Moap/Tests/MoapTests.cs
new file mode 100644
index 0000000..5b85830
--- /dev/null
+++ b/OpenSim/Region/CoreModules/World/Media/Moap/Tests/MoapTests.cs
@@ -0,0 +1,102 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using System.IO;
31using System.Reflection;
32using System.Threading;
33using log4net.Config;
34using NUnit.Framework;
35using OpenMetaverse;
36using OpenMetaverse.Assets;
37using OpenSim.Framework;
38using OpenSim.Region.CoreModules.World.Media.Moap;
39using OpenSim.Region.Framework.Scenes;
40using OpenSim.Region.Framework.Scenes.Serialization;
41using OpenSim.Tests.Common;
42using OpenSim.Tests.Common.Mock;
43using OpenSim.Tests.Common.Setup;
44
45namespace OpenSim.Region.CoreModules.World.Media.Moap.Tests
46{
47 [TestFixture]
48 public class MoapTests
49 {
50 protected TestScene m_scene;
51 protected MoapModule m_module;
52
53 [SetUp]
54 public void SetUp()
55 {
56 m_module = new MoapModule();
57 m_scene = SceneSetupHelpers.SetupScene();
58 SceneSetupHelpers.SetupSceneModules(m_scene, m_module);
59 }
60
61 [Test]
62 public void TestClearMediaUrl()
63 {
64 TestHelper.InMethod();
65// log4net.Config.XmlConfigurator.Configure();
66
67 SceneObjectPart part = SceneSetupHelpers.AddSceneObject(m_scene);
68 MediaEntry me = new MediaEntry();
69
70 m_module.SetMediaEntry(part, 1, me);
71 m_module.ClearMediaEntry(part, 1);
72
73 Assert.That(part.Shape.Media[1], Is.EqualTo(null));
74
75 // Although we've cleared one face, other faces may still be present. So we need to check for an
76 // update media url version
77 Assert.That(part.MediaUrl, Is.EqualTo("x-mv:0000000001/" + UUID.Zero));
78
79 // By changing media flag to false, the face texture once again becomes identical to the DefaultTexture.
80 // Therefore, when libOMV reserializes it, it disappears and we are left with no face texture in this slot.
81 // Not at all confusing, eh?
82 Assert.That(part.Shape.Textures.FaceTextures[1], Is.Null);
83 }
84
85 [Test]
86 public void TestSetMediaUrl()
87 {
88 TestHelper.InMethod();
89
90 string homeUrl = "opensimulator.org";
91
92 SceneObjectPart part = SceneSetupHelpers.AddSceneObject(m_scene);
93 MediaEntry me = new MediaEntry() { HomeURL = homeUrl };
94
95 m_module.SetMediaEntry(part, 1, me);
96
97 Assert.That(part.Shape.Media[1].HomeURL, Is.EqualTo(homeUrl));
98 Assert.That(part.MediaUrl, Is.EqualTo("x-mv:0000000000/" + UUID.Zero));
99 Assert.That(part.Shape.Textures.FaceTextures[1].MediaFlags, Is.True);
100 }
101 }
102} \ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs b/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs
index f10e848..dafaa0c 100644
--- a/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs
+++ b/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs
@@ -30,7 +30,6 @@ using System.IO;
30using System.Xml; 30using System.Xml;
31using log4net.Config; 31using log4net.Config;
32using NUnit.Framework; 32using NUnit.Framework;
33using NUnit.Framework.SyntaxHelpers;
34using OpenMetaverse; 33using OpenMetaverse;
35using OpenSim.Framework; 34using OpenSim.Framework;
36using OpenSim.Region.Framework.Scenes; 35using OpenSim.Region.Framework.Scenes;
diff --git a/OpenSim/Region/Framework/Scenes/Tests/AttachmentTests.cs b/OpenSim/Region/Framework/Scenes/Tests/AttachmentTests.cs
index af44640..855b589 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/AttachmentTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/AttachmentTests.cs
@@ -34,7 +34,6 @@ using System.Timers;
34using Timer=System.Timers.Timer; 34using Timer=System.Timers.Timer;
35using Nini.Config; 35using Nini.Config;
36using NUnit.Framework; 36using NUnit.Framework;
37using NUnit.Framework.SyntaxHelpers;
38using OpenMetaverse; 37using OpenMetaverse;
39using OpenSim.Framework; 38using OpenSim.Framework;
40using OpenSim.Framework.Communications; 39using OpenSim.Framework.Communications;
diff --git a/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs b/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs
index b3c3e22..667b74e 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/EntityManagerTests.cs
@@ -32,7 +32,6 @@ using System.Text;
32using System.Collections.Generic; 32using System.Collections.Generic;
33using Nini.Config; 33using Nini.Config;
34using NUnit.Framework; 34using NUnit.Framework;
35using NUnit.Framework.SyntaxHelpers;
36using OpenMetaverse; 35using OpenMetaverse;
37using OpenSim.Framework; 36using OpenSim.Framework;
38using OpenSim.Framework.Communications; 37using OpenSim.Framework.Communications;
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs
index 9244bc3..ca635d7 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs
@@ -28,7 +28,6 @@
28using System; 28using System;
29using System.Reflection; 29using System.Reflection;
30using NUnit.Framework; 30using NUnit.Framework;
31using NUnit.Framework.SyntaxHelpers;
32using OpenMetaverse; 31using OpenMetaverse;
33using OpenSim.Framework; 32using OpenSim.Framework;
34using OpenSim.Framework.Communications; 33using OpenSim.Framework.Communications;
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs
index 4969b09..a6a95ef 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs
@@ -28,7 +28,6 @@
28using System; 28using System;
29using System.Reflection; 29using System.Reflection;
30using NUnit.Framework; 30using NUnit.Framework;
31using NUnit.Framework.SyntaxHelpers;
32using OpenMetaverse; 31using OpenMetaverse;
33using OpenSim.Framework; 32using OpenSim.Framework;
34using OpenSim.Framework.Communications; 33using OpenSim.Framework.Communications;
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs
index 39116b6..0d26026 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectDeRezTests.cs
@@ -30,7 +30,6 @@ using System.Collections.Generic;
30using System.Reflection; 30using System.Reflection;
31using Nini.Config; 31using Nini.Config;
32using NUnit.Framework; 32using NUnit.Framework;
33using NUnit.Framework.SyntaxHelpers;
34using OpenMetaverse; 33using OpenMetaverse;
35using OpenSim.Framework; 34using OpenSim.Framework;
36using OpenSim.Framework.Communications; 35using OpenSim.Framework.Communications;
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs
index b84298f..bdfcd1d 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs
@@ -29,7 +29,6 @@ using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Reflection; 30using System.Reflection;
31using NUnit.Framework; 31using NUnit.Framework;
32using NUnit.Framework.SyntaxHelpers;
33using OpenMetaverse; 32using OpenMetaverse;
34using OpenSim.Framework; 33using OpenSim.Framework;
35using OpenSim.Framework.Communications; 34using OpenSim.Framework.Communications;
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserGroupTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserGroupTests.cs
index c78038f..8876a43 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserGroupTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectUserGroupTests.cs
@@ -30,7 +30,6 @@ using System.Collections.Generic;
30using System.Reflection; 30using System.Reflection;
31using Nini.Config; 31using Nini.Config;
32using NUnit.Framework; 32using NUnit.Framework;
33using NUnit.Framework.SyntaxHelpers;
34using OpenMetaverse; 33using OpenMetaverse;
35using OpenSim.Framework; 34using OpenSim.Framework;
36using OpenSim.Framework.Communications; 35using OpenSim.Framework.Communications;
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs
index fd2d6fa..efb757f 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs
@@ -34,7 +34,6 @@ using System.Timers;
34using Timer=System.Timers.Timer; 34using Timer=System.Timers.Timer;
35using Nini.Config; 35using Nini.Config;
36using NUnit.Framework; 36using NUnit.Framework;
37using NUnit.Framework.SyntaxHelpers;
38using OpenMetaverse; 37using OpenMetaverse;
39using OpenSim.Framework; 38using OpenSim.Framework;
40using OpenSim.Framework.Communications; 39using OpenSim.Framework.Communications;
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs
index 9aba8a8..abcce66 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs
@@ -34,7 +34,6 @@ using System.Timers;
34using Timer=System.Timers.Timer; 34using Timer=System.Timers.Timer;
35using Nini.Config; 35using Nini.Config;
36using NUnit.Framework; 36using NUnit.Framework;
37using NUnit.Framework.SyntaxHelpers;
38using OpenMetaverse; 37using OpenMetaverse;
39using OpenSim.Framework; 38using OpenSim.Framework;
40using OpenSim.Framework.Communications; 39using OpenSim.Framework.Communications;
diff --git a/OpenSim/Region/Framework/Scenes/Tests/StandaloneTeleportTests.cs b/OpenSim/Region/Framework/Scenes/Tests/StandaloneTeleportTests.cs
index cafe48a..8588f7f 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/StandaloneTeleportTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/StandaloneTeleportTests.cs
@@ -29,7 +29,6 @@ using System;
29using System.Reflection; 29using System.Reflection;
30using Nini.Config; 30using Nini.Config;
31using NUnit.Framework; 31using NUnit.Framework;
32using NUnit.Framework.SyntaxHelpers;
33using OpenMetaverse; 32using OpenMetaverse;
34using OpenSim.Framework; 33using OpenSim.Framework;
35using OpenSim.Framework.Communications; 34using OpenSim.Framework.Communications;
diff --git a/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs
index fe59d4f..8138bcc 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs
@@ -34,7 +34,6 @@ using System.Timers;
34using Timer=System.Timers.Timer; 34using Timer=System.Timers.Timer;
35using Nini.Config; 35using Nini.Config;
36using NUnit.Framework; 36using NUnit.Framework;
37using NUnit.Framework.SyntaxHelpers;
38using OpenMetaverse; 37using OpenMetaverse;
39using OpenMetaverse.Assets; 38using OpenMetaverse.Assets;
40using OpenSim.Framework; 39using OpenSim.Framework;
diff --git a/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs b/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs
index 5e6124b..6b70865 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs
@@ -28,7 +28,6 @@
28using System.Collections.Generic; 28using System.Collections.Generic;
29using System.Text; 29using System.Text;
30using NUnit.Framework; 30using NUnit.Framework;
31using NUnit.Framework.SyntaxHelpers;
32using OpenMetaverse; 31using OpenMetaverse;
33using OpenSim.Framework; 32using OpenSim.Framework;
34using OpenSim.Region.Framework.Scenes; 33using OpenSim.Region.Framework.Scenes;
diff --git a/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs b/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs
index dfeecb1..6a24cc1 100644
--- a/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs
+++ b/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs
@@ -51,7 +51,7 @@ namespace OpenSim.Region.CoreModules.UDP.Linden
51 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "LindenUDPInfoModule")] 51 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "LindenUDPInfoModule")]
52 public class LindenUDPInfoModule : ISharedRegionModule 52 public class LindenUDPInfoModule : ISharedRegionModule
53 { 53 {
54 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 54// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
55 55
56 protected Dictionary<UUID, Scene> m_scenes = new Dictionary<UUID, Scene>(); 56 protected Dictionary<UUID, Scene> m_scenes = new Dictionary<UUID, Scene>();
57 57
diff --git a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs
index d75e25d..7deb32f 100644
--- a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs
@@ -92,7 +92,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
92 private static string m_freeSwitchUrlResetPassword; 92 private static string m_freeSwitchUrlResetPassword;
93 private uint m_freeSwitchServicePort; 93 private uint m_freeSwitchServicePort;
94 private string m_openSimWellKnownHTTPAddress; 94 private string m_openSimWellKnownHTTPAddress;
95 private string m_freeSwitchContext; 95// private string m_freeSwitchContext;
96 96
97 private readonly Dictionary<string, string> m_UUIDName = new Dictionary<string, string>(); 97 private readonly Dictionary<string, string> m_UUIDName = new Dictionary<string, string>();
98 private Dictionary<string, string> m_ParcelAddress = new Dictionary<string, string>(); 98 private Dictionary<string, string> m_ParcelAddress = new Dictionary<string, string>();
@@ -144,7 +144,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
144 m_freeSwitchDefaultWellKnownIP = map["DefaultWellKnownIP"].AsString(); 144 m_freeSwitchDefaultWellKnownIP = map["DefaultWellKnownIP"].AsString();
145 m_freeSwitchDefaultTimeout = map["DefaultTimeout"].AsInteger(); 145 m_freeSwitchDefaultTimeout = map["DefaultTimeout"].AsInteger();
146 m_freeSwitchUrlResetPassword = String.Empty; 146 m_freeSwitchUrlResetPassword = String.Empty;
147 m_freeSwitchContext = map["Context"].AsString(); 147// m_freeSwitchContext = map["Context"].AsString();
148 148
149 if (String.IsNullOrEmpty(m_freeSwitchRealm) || 149 if (String.IsNullOrEmpty(m_freeSwitchRealm) ||
150 String.IsNullOrEmpty(m_freeSwitchAPIPrefix)) 150 String.IsNullOrEmpty(m_freeSwitchAPIPrefix))
@@ -662,7 +662,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
662 resp.Append("</buddies><groups></groups></body></level0></response>"); 662 resp.Append("</buddies><groups></groups></body></level0></response>");
663 663
664 response["str_response_string"] = resp.ToString(); 664 response["str_response_string"] = resp.ToString();
665 Regex normalizeEndLines = new Regex(@"\r\n", RegexOptions.Compiled | RegexOptions.Singleline | RegexOptions.Multiline); 665// Regex normalizeEndLines = new Regex(@"\r\n", RegexOptions.Compiled | RegexOptions.Singleline | RegexOptions.Multiline);
666 666
667 //m_log.DebugFormat("[FREESWITCH]: {0}", normalizeEndLines.Replace((string)response["str_response_string"],"")); 667 //m_log.DebugFormat("[FREESWITCH]: {0}", normalizeEndLines.Replace((string)response["str_response_string"],""));
668 return response; 668 return response;
@@ -670,10 +670,10 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
670 670
671 public Hashtable FreeSwitchSLVoiceSigninHTTPHandler(Hashtable request) 671 public Hashtable FreeSwitchSLVoiceSigninHTTPHandler(Hashtable request)
672 { 672 {
673// m_log.Debug("[FreeSwitchVoice] FreeSwitchSLVoiceSigninHTTPHandler called"); 673 //m_log.Debug("[FreeSwitchVoice] FreeSwitchSLVoiceSigninHTTPHandler called");
674 string requestbody = (string)request["body"]; 674// string requestbody = (string)request["body"];
675 string uri = (string)request["uri"]; 675// string uri = (string)request["uri"];
676 string contenttype = (string)request["content-type"]; 676// string contenttype = (string)request["content-type"];
677 677
678 Hashtable requestBody = ParseRequestBody((string)request["body"]); 678 Hashtable requestBody = ParseRequestBody((string)request["body"]);
679 679
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/SimianGroupsServicesConnectorModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/SimianGroupsServicesConnectorModule.cs
index 81725c5..02751ea 100644
--- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/SimianGroupsServicesConnectorModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/SimianGroupsServicesConnectorModule.cs
@@ -712,7 +712,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
712 if (m_debugEnabled) m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name); 712 if (m_debugEnabled) m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
713 713
714 GroupMembershipData data = null; 714 GroupMembershipData data = null;
715 bool foundData = false; 715// bool foundData = false;
716 716
717 OSDMap UserGroupMemberInfo; 717 OSDMap UserGroupMemberInfo;
718 if (SimianGetGenericEntry(agentID, "GroupMember", groupID.ToString(), out UserGroupMemberInfo)) 718 if (SimianGetGenericEntry(agentID, "GroupMember", groupID.ToString(), out UserGroupMemberInfo))
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/Tests/GroupsModuleTests.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/Tests/GroupsModuleTests.cs
index bc55b04..6de97b7 100644
--- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/Tests/GroupsModuleTests.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/Tests/GroupsModuleTests.cs
@@ -29,7 +29,6 @@ using System;
29using System.Reflection; 29using System.Reflection;
30using Nini.Config; 30using Nini.Config;
31using NUnit.Framework; 31using NUnit.Framework;
32using NUnit.Framework.SyntaxHelpers;
33using OpenMetaverse; 32using OpenMetaverse;
34using OpenSim.Framework; 33using OpenSim.Framework;
35using OpenSim.Framework.Communications; 34using OpenSim.Framework.Communications;
diff --git a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs
index 3c5ecc5..1c31402 100644
--- a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs
@@ -79,9 +79,6 @@ namespace OpenSim.Services.Connectors.Simulation
79 return "agent/"; 79 return "agent/";
80 } 80 }
81 81
82 /// <summary>
83 ///
84 /// </summary>
85 public bool CreateAgent(GridRegion destination, AgentCircuitData aCircuit, uint flags, out string reason) 82 public bool CreateAgent(GridRegion destination, AgentCircuitData aCircuit, uint flags, out string reason)
86 { 83 {
87 // m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: CreateAgent start"); 84 // m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: CreateAgent start");
@@ -109,6 +106,9 @@ namespace OpenSim.Services.Connectors.Simulation
109 if (result["Success"].AsBoolean()) 106 if (result["Success"].AsBoolean())
110 return true; 107 return true;
111 108
109 m_log.WarnFormat(
110 "[REMOTE SIMULATION CONNECTOR]: Failed to create agent {0} {1} at remote simulator {1}",
111 aCircuit.firstname, aCircuit.lastname, destination.RegionName);
112 reason = result["Message"] != null ? result["Message"].AsString() : "error"; 112 reason = result["Message"] != null ? result["Message"].AsString() : "error";
113 return false; 113 return false;
114 } 114 }
diff --git a/OpenSim/Services/HypergridService/UserAgentService.cs b/OpenSim/Services/HypergridService/UserAgentService.cs
index 12dda48..09e785f 100644
--- a/OpenSim/Services/HypergridService/UserAgentService.cs
+++ b/OpenSim/Services/HypergridService/UserAgentService.cs
@@ -253,7 +253,7 @@ namespace OpenSim.Services.HypergridService
253 253
254 TravelingAgentInfo travel = m_TravelingAgents[sessionID]; 254 TravelingAgentInfo travel = m_TravelingAgents[sessionID];
255 255
256 return travel.GridExternalName == thisGridExternalName; 256 return travel.GridExternalName.ToLower() == thisGridExternalName.ToLower();
257 } 257 }
258 258
259 public bool VerifyClient(UUID sessionID, string reportedIP) 259 public bool VerifyClient(UUID sessionID, string reportedIP)
diff --git a/OpenSim/Services/Interfaces/ISimulationService.cs b/OpenSim/Services/Interfaces/ISimulationService.cs
index 5bb24c5..f2184fc 100644
--- a/OpenSim/Services/Interfaces/ISimulationService.cs
+++ b/OpenSim/Services/Interfaces/ISimulationService.cs
@@ -40,6 +40,13 @@ namespace OpenSim.Services.Interfaces
40 40
41 #region Agents 41 #region Agents
42 42
43 /// <summary>
44 /// Ask the simulator hosting the destination to create an agent on that region.
45 /// </summary>
46 /// <param name="destination"></param>
47 /// <param name="aCircuit"></param>
48 /// <param name="flags"></param>
49 /// <param name="reason">Reason message in the event of a failure.</param>
43 bool CreateAgent(GridRegion destination, AgentCircuitData aCircuit, uint flags, out string reason); 50 bool CreateAgent(GridRegion destination, AgentCircuitData aCircuit, uint flags, out string reason);
44 51
45 /// <summary> 52 /// <summary>
diff --git a/OpenSim/Tests/Common/DoubleToleranceConstraint.cs b/OpenSim/Tests/Common/DoubleToleranceConstraint.cs
index c397a62..b2f2057 100644
--- a/OpenSim/Tests/Common/DoubleToleranceConstraint.cs
+++ b/OpenSim/Tests/Common/DoubleToleranceConstraint.cs
@@ -27,6 +27,7 @@
27 27
28using System; 28using System;
29using NUnit.Framework; 29using NUnit.Framework;
30using NUnit.Framework.Constraints;
30 31
31namespace OpenSim.Tests.Common 32namespace OpenSim.Tests.Common
32{ 33{
diff --git a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs
index 5be70bc..aa4b285 100644
--- a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs
+++ b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs
@@ -57,21 +57,12 @@ namespace OpenSim.Tests.Common.Setup
57 /// </summary> 57 /// </summary>
58 public class SceneSetupHelpers 58 public class SceneSetupHelpers
59 { 59 {
60 // These static variables in order to allow regions to be linked by shared modules and same
61 // CommunicationsManager.
62 private static ISharedRegionModule m_assetService = null;
63// private static ISharedRegionModule m_authenticationService = null;
64 private static ISharedRegionModule m_inventoryService = null;
65 private static ISharedRegionModule m_gridService = null;
66 private static ISharedRegionModule m_userAccountService = null;
67 private static ISharedRegionModule m_presenceService = null;
68
69 /// <summary> 60 /// <summary>
70 /// Set up a test scene 61 /// Set up a test scene
71 /// </summary> 62 /// </summary>
72 /// 63 /// <remarks>
73 /// Automatically starts service threads, as would the normal runtime. 64 /// Automatically starts service threads, as would the normal runtime.
74 /// 65 /// </remarks>
75 /// <returns></returns> 66 /// <returns></returns>
76 public static TestScene SetupScene() 67 public static TestScene SetupScene()
77 { 68 {
@@ -86,24 +77,9 @@ namespace OpenSim.Tests.Common.Setup
86 /// <returns></returns> 77 /// <returns></returns>
87 public static TestScene SetupScene(String realServices) 78 public static TestScene SetupScene(String realServices)
88 { 79 {
89 return SetupScene( 80 return SetupScene("Unit test region", UUID.Random(), 1000, 1000, realServices);
90 "Unit test region", UUID.Random(), 1000, 1000, realServices);
91 } 81 }
92 82
93 // REFACTORING PROBLEM. No idea what the difference is with the previous one
94 ///// <summary>
95 ///// Set up a test scene
96 ///// </summary>
97 /////
98 ///// <param name="realServices">Starts real inventory and asset services, as opposed to mock ones, if true</param>
99 ///// <param name="cm">This should be the same if simulating two scenes within a standalone</param>
100 ///// <returns></returns>
101 //public static TestScene SetupScene(String realServices)
102 //{
103 // return SetupScene(
104 // "Unit test region", UUID.Random(), 1000, 1000, "");
105 //}
106
107 /// <summary> 83 /// <summary>
108 /// Set up a test scene 84 /// Set up a test scene
109 /// </summary> 85 /// </summary>
@@ -115,7 +91,7 @@ namespace OpenSim.Tests.Common.Setup
115 /// <returns></returns> 91 /// <returns></returns>
116 public static TestScene SetupScene(string name, UUID id, uint x, uint y) 92 public static TestScene SetupScene(string name, UUID id, uint x, uint y)
117 { 93 {
118 return SetupScene(name, id, x, y,""); 94 return SetupScene(name, id, x, y, "");
119 } 95 }
120 96
121 /// <summary> 97 /// <summary>
@@ -156,27 +132,21 @@ namespace OpenSim.Tests.Common.Setup
156 testScene.AddModule(godsModule.Name, godsModule); 132 testScene.AddModule(godsModule.Name, godsModule);
157 realServices = realServices.ToLower(); 133 realServices = realServices.ToLower();
158 134
159 if (realServices.Contains("asset")) 135 LocalAssetServicesConnector assetService = StartAssetService(testScene, realServices.Contains("asset"));
160 StartAssetService(testScene, true);
161 else
162 StartAssetService(testScene, false);
163 136
164 // For now, always started a 'real' authentication service 137 // For now, always started a 'real' authentication service
165 StartAuthenticationService(testScene, true); 138 StartAuthenticationService(testScene, true);
166 139
167 if (realServices.Contains("inventory")) 140 LocalInventoryServicesConnector inventoryService = StartInventoryService(testScene, realServices.Contains("inventory"));
168 StartInventoryService(testScene, true); 141 StartGridService(testScene, true);
169 else 142 LocalUserAccountServicesConnector userAccountService = StartUserAccountService(testScene);
170 StartInventoryService(testScene, false); 143 LocalPresenceServicesConnector presenceService = StartPresenceService(testScene);
171
172 StartGridService(testScene, true);
173 StartUserAccountService(testScene);
174 StartPresenceService(testScene);
175 144
176 m_inventoryService.PostInitialise(); 145 inventoryService.PostInitialise();
177 m_assetService.PostInitialise(); 146 assetService.PostInitialise();
178 m_userAccountService.PostInitialise(); 147 userAccountService.PostInitialise();
179 m_presenceService.PostInitialise(); 148 presenceService.PostInitialise();
149
180 testScene.RegionInfo.EstateSettings.EstateOwner = UUID.Random(); 150 testScene.RegionInfo.EstateSettings.EstateOwner = UUID.Random();
181 testScene.SetModuleInterfaces(); 151 testScene.SetModuleInterfaces();
182 152
@@ -188,24 +158,15 @@ namespace OpenSim.Tests.Common.Setup
188 testScene.PhysicsScene 158 testScene.PhysicsScene
189 = physicsPluginManager.GetPhysicsScene("basicphysics", "ZeroMesher", new IniConfigSource(), "test"); 159 = physicsPluginManager.GetPhysicsScene("basicphysics", "ZeroMesher", new IniConfigSource(), "test");
190 160
191 // It's really not a good idea to use static variables as they carry over between tests, leading to
192 // problems that are extremely hard to debug. Really, these static fields need to be eliminated -
193 // tests using multiple regions that need to share modules need to find another solution.
194 m_assetService = null;
195 m_inventoryService = null;
196 m_gridService = null;
197 m_userAccountService = null;
198 m_presenceService = null;
199
200 testScene.RegionInfo.EstateSettings = new EstateSettings(); 161 testScene.RegionInfo.EstateSettings = new EstateSettings();
201 testScene.LoginsDisabled = false; 162 testScene.LoginsDisabled = false;
202 163
203 return testScene; 164 return testScene;
204 } 165 }
205 166
206 private static void StartAssetService(Scene testScene, bool real) 167 private static LocalAssetServicesConnector StartAssetService(Scene testScene, bool real)
207 { 168 {
208 ISharedRegionModule assetService = new LocalAssetServicesConnector(); 169 LocalAssetServicesConnector assetService = new LocalAssetServicesConnector();
209 IConfigSource config = new IniConfigSource(); 170 IConfigSource config = new IniConfigSource();
210 config.AddConfig("Modules"); 171 config.AddConfig("Modules");
211 config.AddConfig("AssetService"); 172 config.AddConfig("AssetService");
@@ -219,7 +180,8 @@ namespace OpenSim.Tests.Common.Setup
219 assetService.AddRegion(testScene); 180 assetService.AddRegion(testScene);
220 assetService.RegionLoaded(testScene); 181 assetService.RegionLoaded(testScene);
221 testScene.AddRegionModule(assetService.Name, assetService); 182 testScene.AddRegionModule(assetService.Name, assetService);
222 m_assetService = assetService; 183
184 return assetService;
223 } 185 }
224 186
225 private static void StartAuthenticationService(Scene testScene, bool real) 187 private static void StartAuthenticationService(Scene testScene, bool real)
@@ -243,9 +205,9 @@ namespace OpenSim.Tests.Common.Setup
243 //m_authenticationService = service; 205 //m_authenticationService = service;
244 } 206 }
245 207
246 private static void StartInventoryService(Scene testScene, bool real) 208 private static LocalInventoryServicesConnector StartInventoryService(Scene testScene, bool real)
247 { 209 {
248 ISharedRegionModule inventoryService = new LocalInventoryServicesConnector(); 210 LocalInventoryServicesConnector inventoryService = new LocalInventoryServicesConnector();
249 IConfigSource config = new IniConfigSource(); 211 IConfigSource config = new IniConfigSource();
250 config.AddConfig("Modules"); 212 config.AddConfig("Modules");
251 config.AddConfig("InventoryService"); 213 config.AddConfig("InventoryService");
@@ -265,10 +227,11 @@ namespace OpenSim.Tests.Common.Setup
265 inventoryService.AddRegion(testScene); 227 inventoryService.AddRegion(testScene);
266 inventoryService.RegionLoaded(testScene); 228 inventoryService.RegionLoaded(testScene);
267 testScene.AddRegionModule(inventoryService.Name, inventoryService); 229 testScene.AddRegionModule(inventoryService.Name, inventoryService);
268 m_inventoryService = inventoryService; 230
231 return inventoryService;
269 } 232 }
270 233
271 private static void StartGridService(Scene testScene, bool real) 234 private static LocalGridServicesConnector StartGridService(Scene testScene, bool real)
272 { 235 {
273 IConfigSource config = new IniConfigSource(); 236 IConfigSource config = new IniConfigSource();
274 config.AddConfig("Modules"); 237 config.AddConfig("Modules");
@@ -277,24 +240,25 @@ namespace OpenSim.Tests.Common.Setup
277 config.Configs["GridService"].Set("StorageProvider", "OpenSim.Data.Null.dll:NullRegionData"); 240 config.Configs["GridService"].Set("StorageProvider", "OpenSim.Data.Null.dll:NullRegionData");
278 if (real) 241 if (real)
279 config.Configs["GridService"].Set("LocalServiceModule", "OpenSim.Services.GridService.dll:GridService"); 242 config.Configs["GridService"].Set("LocalServiceModule", "OpenSim.Services.GridService.dll:GridService");
280 if (m_gridService == null) 243
281 { 244 LocalGridServicesConnector gridService = new LocalGridServicesConnector();
282 ISharedRegionModule gridService = new LocalGridServicesConnector(); 245 gridService.Initialise(config);
283 gridService.Initialise(config); 246
284 m_gridService = gridService;
285 }
286 //else 247 //else
287 // config.Configs["GridService"].Set("LocalServiceModule", "OpenSim.Tests.Common.dll:TestGridService"); 248 // config.Configs["GridService"].Set("LocalServiceModule", "OpenSim.Tests.Common.dll:TestGridService");
288 m_gridService.AddRegion(testScene); 249 gridService.AddRegion(testScene);
289 m_gridService.RegionLoaded(testScene); 250 gridService.RegionLoaded(testScene);
290 //testScene.AddRegionModule(m_gridService.Name, m_gridService); 251 //testScene.AddRegionModule(m_gridService.Name, m_gridService);
252
253 return gridService;
291 } 254 }
292 255
293 /// <summary> 256 /// <summary>
294 /// Start a user account service 257 /// Start a user account service
295 /// </summary> 258 /// </summary>
296 /// <param name="testScene"></param> 259 /// <param name="testScene"></param>
297 private static void StartUserAccountService(Scene testScene) 260 /// <returns></returns>
261 private static LocalUserAccountServicesConnector StartUserAccountService(Scene testScene)
298 { 262 {
299 IConfigSource config = new IniConfigSource(); 263 IConfigSource config = new IniConfigSource();
300 config.AddConfig("Modules"); 264 config.AddConfig("Modules");
@@ -304,23 +268,21 @@ namespace OpenSim.Tests.Common.Setup
304 config.Configs["UserAccountService"].Set( 268 config.Configs["UserAccountService"].Set(
305 "LocalServiceModule", "OpenSim.Services.UserAccountService.dll:UserAccountService"); 269 "LocalServiceModule", "OpenSim.Services.UserAccountService.dll:UserAccountService");
306 270
307 if (m_userAccountService == null) 271 LocalUserAccountServicesConnector userAccountService = new LocalUserAccountServicesConnector();
308 { 272 userAccountService.Initialise(config);
309 ISharedRegionModule userAccountService = new LocalUserAccountServicesConnector();
310 userAccountService.Initialise(config);
311 m_userAccountService = userAccountService;
312 }
313 273
314 m_userAccountService.AddRegion(testScene); 274 userAccountService.AddRegion(testScene);
315 m_userAccountService.RegionLoaded(testScene); 275 userAccountService.RegionLoaded(testScene);
316 testScene.AddRegionModule(m_userAccountService.Name, m_userAccountService); 276 testScene.AddRegionModule(userAccountService.Name, userAccountService);
277
278 return userAccountService;
317 } 279 }
318 280
319 /// <summary> 281 /// <summary>
320 /// Start a presence service 282 /// Start a presence service
321 /// </summary> 283 /// </summary>
322 /// <param name="testScene"></param> 284 /// <param name="testScene"></param>
323 private static void StartPresenceService(Scene testScene) 285 private static LocalPresenceServicesConnector StartPresenceService(Scene testScene)
324 { 286 {
325 IConfigSource config = new IniConfigSource(); 287 IConfigSource config = new IniConfigSource();
326 config.AddConfig("Modules"); 288 config.AddConfig("Modules");
@@ -330,16 +292,14 @@ namespace OpenSim.Tests.Common.Setup
330 config.Configs["PresenceService"].Set( 292 config.Configs["PresenceService"].Set(
331 "LocalServiceModule", "OpenSim.Services.PresenceService.dll:PresenceService"); 293 "LocalServiceModule", "OpenSim.Services.PresenceService.dll:PresenceService");
332 294
333 if (m_presenceService == null) 295 LocalPresenceServicesConnector presenceService = new LocalPresenceServicesConnector();
334 { 296 presenceService.Initialise(config);
335 ISharedRegionModule presenceService = new LocalPresenceServicesConnector();
336 presenceService.Initialise(config);
337 m_presenceService = presenceService;
338 }
339 297
340 m_presenceService.AddRegion(testScene); 298 presenceService.AddRegion(testScene);
341 m_presenceService.RegionLoaded(testScene); 299 presenceService.RegionLoaded(testScene);
342 testScene.AddRegionModule(m_presenceService.Name, m_presenceService); 300 testScene.AddRegionModule(presenceService.Name, presenceService);
301
302 return presenceService;
343 } 303 }
344 304
345 /// <summary> 305 /// <summary>
@@ -436,7 +396,7 @@ namespace OpenSim.Tests.Common.Setup
436 /// <summary> 396 /// <summary>
437 /// Add a root agent. 397 /// Add a root agent.
438 /// </summary> 398 /// </summary>
439 /// 399 /// <remarks>
440 /// This function 400 /// This function
441 /// 401 ///
442 /// 1) Tells the scene that an agent is coming. Normally, the login service (local if standalone, from the 402 /// 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
447 /// 407 ///
448 /// This function performs actions equivalent with notifying the scene that an agent is 408 /// This function performs actions equivalent with notifying the scene that an agent is
449 /// coming and then actually connecting the agent to the scene. The one step missed out is the very first 409 /// coming and then actually connecting the agent to the scene. The one step missed out is the very first
450 /// 410 /// </remarks>
451 /// <param name="scene"></param> 411 /// <param name="scene"></param>
452 /// <param name="agentData"></param> 412 /// <param name="agentData"></param>
453 /// <returns></returns> 413 /// <returns></returns>
diff --git a/OpenSim/Tests/Common/TestHelper.cs b/OpenSim/Tests/Common/TestHelper.cs
index 9d53063..1722e59 100644
--- a/OpenSim/Tests/Common/TestHelper.cs
+++ b/OpenSim/Tests/Common/TestHelper.cs
@@ -27,11 +27,10 @@
27 27
28using System; 28using System;
29using System.Diagnostics; 29using System.Diagnostics;
30using NUnit.Framework;
30 31
31namespace OpenSim.Tests.Common 32namespace OpenSim.Tests.Common
32{ 33{
33 public delegate void TestDelegate();
34
35 public class TestHelper 34 public class TestHelper
36 { 35 {
37 public static bool AssertThisDelegateCausesArgumentException(TestDelegate d) 36 public static bool AssertThisDelegateCausesArgumentException(TestDelegate d)
diff --git a/OpenSim/Tests/Common/VectorToleranceConstraint.cs b/OpenSim/Tests/Common/VectorToleranceConstraint.cs
index 118cc70..2fa20ed 100644
--- a/OpenSim/Tests/Common/VectorToleranceConstraint.cs
+++ b/OpenSim/Tests/Common/VectorToleranceConstraint.cs
@@ -28,6 +28,7 @@
28using System; 28using System;
29using OpenMetaverse; 29using OpenMetaverse;
30using NUnit.Framework; 30using NUnit.Framework;
31using NUnit.Framework.Constraints;
31 32
32namespace OpenSim.Tests.Common 33namespace OpenSim.Tests.Common
33{ 34{