aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorBlueWall2011-03-21 22:06:43 -0400
committerBlueWall2011-03-21 22:06:43 -0400
commite3c327a305dcf795f372b940f34538a19bf92218 (patch)
treeb034355a12c4d87410809aa19bf6015e611e1e22
parentMerge branch 'master' of /home/opensim/src/OpenSim/Core (diff)
parentThanks Kevin Cozens for a patch that: (diff)
downloadopensim-SC_OLD-e3c327a305dcf795f372b940f34538a19bf92218.zip
opensim-SC_OLD-e3c327a305dcf795f372b940f34538a19bf92218.tar.gz
opensim-SC_OLD-e3c327a305dcf795f372b940f34538a19bf92218.tar.bz2
opensim-SC_OLD-e3c327a305dcf795f372b940f34538a19bf92218.tar.xz
Merge branch 'master' of /home/opensim/src/OpenSim/Core
-rw-r--r--CONTRIBUTORS.txt2
-rw-r--r--OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs6
-rw-r--r--OpenSim/Data/MySQL/MySQLAssetData.cs10
-rw-r--r--OpenSim/Data/MySQL/MySQLAuthenticationData.cs8
-rw-r--r--OpenSim/Data/MySQL/MySQLEstateData.cs8
-rw-r--r--OpenSim/Data/MySQL/MySQLGenericTableHandler.cs7
-rw-r--r--OpenSim/Data/MySQL/MySQLRegionData.cs9
-rw-r--r--OpenSim/Data/MySQL/MySQLSimulationData.cs8
-rw-r--r--OpenSim/Data/Null/NullRegionData.cs48
-rw-r--r--OpenSim/Data/Null/NullUserAccountData.cs65
-rw-r--r--OpenSim/Data/Tests/AssetTests.cs25
-rw-r--r--OpenSim/Data/Tests/EstateTests.cs32
-rw-r--r--OpenSim/Data/Tests/InventoryTests.cs41
-rw-r--r--OpenSim/Data/Tests/PropertyCompareConstraint.cs1
-rw-r--r--OpenSim/Data/Tests/PropertyScrambler.cs2
-rw-r--r--OpenSim/Data/Tests/RegionTests.cs99
-rw-r--r--OpenSim/Framework/Capabilities/Caps.cs1
-rw-r--r--OpenSim/Framework/PrimitiveBaseShape.cs2
-rw-r--r--OpenSim/Framework/Serialization/External/OspResolver.cs19
-rw-r--r--OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs42
-rw-r--r--OpenSim/Framework/Servers/HttpServer/OSHttpHandler.cs2
-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/Framework/UndoStack.cs2
-rw-r--r--OpenSim/Framework/Util.cs13
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs2
-rw-r--r--OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs21
-rw-r--r--OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs60
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs215
-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.cs680
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/PathTests.cs478
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs59
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs4
-rw-r--r--OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs5
-rw-r--r--OpenSim/Region/CoreModules/LightShare/LightShareModule.cs4
-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/LocalSimulationConnector.cs5
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs29
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs1
-rw-r--r--OpenSim/Region/CoreModules/World/LegacyMap/TexturedMapTileRenderer.cs6
-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/Permissions/PermissionsModule.cs4
-rw-r--r--OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs1
-rw-r--r--OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs6
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs342
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneGraph.cs3
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs8
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs52
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/AttachmentTests.cs173
-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.cs137
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs70
-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.cs12
-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/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs40
-rw-r--r--OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs4
-rw-r--r--OpenSim/Server/Handlers/Simulation/AgentHandlers.cs11
-rw-r--r--OpenSim/Services/AuthenticationService/PasswordAuthenticationService.cs2
-rw-r--r--OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs27
-rw-r--r--OpenSim/Services/GridService/GridService.cs12
-rw-r--r--OpenSim/Services/GridService/HypergridLinker.cs2
-rw-r--r--OpenSim/Services/HypergridService/UserAgentService.cs2
-rw-r--r--OpenSim/Services/Interfaces/ISimulationService.cs9
-rw-r--r--OpenSim/Tests/Common/DoubleToleranceConstraint.cs1
-rw-r--r--OpenSim/Tests/Common/Mock/TestClient.cs7
-rw-r--r--OpenSim/Tests/Common/Setup/AssetHelpers.cs2
-rw-r--r--OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs213
-rw-r--r--OpenSim/Tests/Common/TestHelper.cs3
-rw-r--r--OpenSim/Tests/Common/VectorToleranceConstraint.cs1
-rw-r--r--TESTING.txt81
-rw-r--r--bin/HttpServer_OpenSim.dllbin115712 -> 115712 bytes
-rw-r--r--bin/HttpServer_OpenSim.pdbbin409088 -> 409088 bytes
-rw-r--r--bin/MySql.Data.dllbin360448 -> 353792 bytes
-rw-r--r--bin/OpenSimDefaults.ini7
-rw-r--r--bin/Robust.HG.ini.example2
-rw-r--r--bin/config-include/GridCommon.ini.example2
-rw-r--r--bin/config-include/StandaloneCommon.ini.example2
-rw-r--r--bin/nunit.framework.dllbin77824 -> 135168 bytes
-rw-r--r--prebuild.xml1
97 files changed, 2109 insertions, 1508 deletions
diff --git a/CONTRIBUTORS.txt b/CONTRIBUTORS.txt
index 38343a4..a0af1ca 100644
--- a/CONTRIBUTORS.txt
+++ b/CONTRIBUTORS.txt
@@ -28,7 +28,7 @@ people that make the day to day of OpenSim happen.
28* Diva (Crista Lopes, University of California, Irvine) 28* Diva (Crista Lopes, University of California, Irvine)
29* nlin (3Di) 29* nlin (3Di)
30* Arthur Rodrigo S Valadares (IBM) 30* Arthur Rodrigo S Valadares (IBM)
31 31* BlueWall (James Hughes)
32 32
33= Past Open Sim Developers = 33= Past Open Sim Developers =
34These folks are alumns of the OpenSim core group, but are now 34These folks are alumns of the OpenSim core group, but are now
diff --git a/OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs b/OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs
index b415662..536f167 100644
--- a/OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs
+++ b/OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs
@@ -2129,17 +2129,17 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
2129 } 2129 }
2130 catch (DllNotFoundException) 2130 catch (DllNotFoundException)
2131 { 2131 {
2132 Rest.Log.ErrorFormat("OpenJpeg is not installed correctly on this system. Asset Data is emtpy for {0}", ic.Item.Name); 2132 Rest.Log.ErrorFormat("OpenJpeg is not installed correctly on this system. Asset Data is empty for {0}", ic.Item.Name);
2133 ic.Asset.Data = new Byte[0]; 2133 ic.Asset.Data = new Byte[0];
2134 } 2134 }
2135 catch (IndexOutOfRangeException) 2135 catch (IndexOutOfRangeException)
2136 { 2136 {
2137 Rest.Log.ErrorFormat("OpenJpeg was unable to encode this. Asset Data is emtpy for {0}", ic.Item.Name); 2137 Rest.Log.ErrorFormat("OpenJpeg was unable to encode this. Asset Data is empty for {0}", ic.Item.Name);
2138 ic.Asset.Data = new Byte[0]; 2138 ic.Asset.Data = new Byte[0];
2139 } 2139 }
2140 catch (Exception) 2140 catch (Exception)
2141 { 2141 {
2142 Rest.Log.ErrorFormat("OpenJpeg was unable to encode this. Asset Data is emtpy for {0}", ic.Item.Name); 2142 Rest.Log.ErrorFormat("OpenJpeg was unable to encode this. Asset Data is empty for {0}", ic.Item.Name);
2143 ic.Asset.Data = new Byte[0]; 2143 ic.Asset.Data = new Byte[0];
2144 } 2144 }
2145 } 2145 }
diff --git a/OpenSim/Data/MySQL/MySQLAssetData.cs b/OpenSim/Data/MySQL/MySQLAssetData.cs
index ed92f3e..e740232 100644
--- a/OpenSim/Data/MySQL/MySQLAssetData.cs
+++ b/OpenSim/Data/MySQL/MySQLAssetData.cs
@@ -47,6 +47,11 @@ namespace OpenSim.Data.MySQL
47 private string m_connectionString; 47 private string m_connectionString;
48 private object m_dbLock = new object(); 48 private object m_dbLock = new object();
49 49
50 protected virtual Assembly Assembly
51 {
52 get { return GetType().Assembly; }
53 }
54
50 #region IPlugin Members 55 #region IPlugin Members
51 56
52 public override string Version { get { return "1.0.0.0"; } } 57 public override string Version { get { return "1.0.0.0"; } }
@@ -66,13 +71,10 @@ namespace OpenSim.Data.MySQL
66 { 71 {
67 m_connectionString = connect; 72 m_connectionString = connect;
68 73
69 // This actually does the roll forward assembly stuff
70 Assembly assem = GetType().Assembly;
71
72 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) 74 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
73 { 75 {
74 dbcon.Open(); 76 dbcon.Open();
75 Migration m = new Migration(dbcon, assem, "AssetStore"); 77 Migration m = new Migration(dbcon, Assembly, "AssetStore");
76 m.Update(); 78 m.Update();
77 } 79 }
78 } 80 }
diff --git a/OpenSim/Data/MySQL/MySQLAuthenticationData.cs b/OpenSim/Data/MySQL/MySQLAuthenticationData.cs
index 5056aee..8d82f61 100644
--- a/OpenSim/Data/MySQL/MySQLAuthenticationData.cs
+++ b/OpenSim/Data/MySQL/MySQLAuthenticationData.cs
@@ -28,6 +28,7 @@
28using System; 28using System;
29using System.Collections; 29using System.Collections;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Reflection;
31using System.Data; 32using System.Data;
32using OpenMetaverse; 33using OpenMetaverse;
33using OpenSim.Framework; 34using OpenSim.Framework;
@@ -42,6 +43,11 @@ namespace OpenSim.Data.MySQL
42 private int m_LastExpire; 43 private int m_LastExpire;
43 // private string m_connectionString; 44 // private string m_connectionString;
44 45
46 protected virtual Assembly Assembly
47 {
48 get { return GetType().Assembly; }
49 }
50
45 public MySqlAuthenticationData(string connectionString, string realm) 51 public MySqlAuthenticationData(string connectionString, string realm)
46 : base(connectionString) 52 : base(connectionString)
47 { 53 {
@@ -51,7 +57,7 @@ namespace OpenSim.Data.MySQL
51 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) 57 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
52 { 58 {
53 dbcon.Open(); 59 dbcon.Open();
54 Migration m = new Migration(dbcon, GetType().Assembly, "AuthStore"); 60 Migration m = new Migration(dbcon, Assembly, "AuthStore");
55 m.Update(); 61 m.Update();
56 } 62 }
57 } 63 }
diff --git a/OpenSim/Data/MySQL/MySQLEstateData.cs b/OpenSim/Data/MySQL/MySQLEstateData.cs
index c42c687..de72a6a 100644
--- a/OpenSim/Data/MySQL/MySQLEstateData.cs
+++ b/OpenSim/Data/MySQL/MySQLEstateData.cs
@@ -54,6 +54,11 @@ namespace OpenSim.Data.MySQL
54 private Dictionary<string, FieldInfo> m_FieldMap = 54 private Dictionary<string, FieldInfo> m_FieldMap =
55 new Dictionary<string, FieldInfo>(); 55 new Dictionary<string, FieldInfo>();
56 56
57 protected virtual Assembly Assembly
58 {
59 get { return GetType().Assembly; }
60 }
61
57 public MySQLEstateStore() 62 public MySQLEstateStore()
58 { 63 {
59 } 64 }
@@ -82,8 +87,7 @@ namespace OpenSim.Data.MySQL
82 { 87 {
83 dbcon.Open(); 88 dbcon.Open();
84 89
85 Assembly assem = GetType().Assembly; 90 Migration m = new Migration(dbcon, Assembly, "EstateStore");
86 Migration m = new Migration(dbcon, assem, "EstateStore");
87 m.Update(); 91 m.Update();
88 92
89 Type t = typeof(EstateSettings); 93 Type t = typeof(EstateSettings);
diff --git a/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs b/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs
index 7c23a47..8efe4e9 100644
--- a/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs
+++ b/OpenSim/Data/MySQL/MySQLGenericTableHandler.cs
@@ -46,6 +46,11 @@ namespace OpenSim.Data.MySQL
46 protected string m_Realm; 46 protected string m_Realm;
47 protected FieldInfo m_DataField = null; 47 protected FieldInfo m_DataField = null;
48 48
49 protected virtual Assembly Assembly
50 {
51 get { return GetType().Assembly; }
52 }
53
49 public MySQLGenericTableHandler(string connectionString, 54 public MySQLGenericTableHandler(string connectionString,
50 string realm, string storeName) : base(connectionString) 55 string realm, string storeName) : base(connectionString)
51 { 56 {
@@ -57,7 +62,7 @@ namespace OpenSim.Data.MySQL
57 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) 62 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
58 { 63 {
59 dbcon.Open(); 64 dbcon.Open();
60 Migration m = new Migration(dbcon, GetType().Assembly, storeName); 65 Migration m = new Migration(dbcon, Assembly, storeName);
61 m.Update(); 66 m.Update();
62 } 67 }
63 } 68 }
diff --git a/OpenSim/Data/MySQL/MySQLRegionData.cs b/OpenSim/Data/MySQL/MySQLRegionData.cs
index d04e3dc..c20c392 100644
--- a/OpenSim/Data/MySQL/MySQLRegionData.cs
+++ b/OpenSim/Data/MySQL/MySQLRegionData.cs
@@ -29,6 +29,8 @@ using System;
29using System.Collections; 29using System.Collections;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Data; 31using System.Data;
32using System.Reflection;
33
32using OpenMetaverse; 34using OpenMetaverse;
33using OpenSim.Framework; 35using OpenSim.Framework;
34using OpenSim.Data; 36using OpenSim.Data;
@@ -42,6 +44,11 @@ namespace OpenSim.Data.MySQL
42 private List<string> m_ColumnNames; 44 private List<string> m_ColumnNames;
43 //private string m_connectionString; 45 //private string m_connectionString;
44 46
47 protected virtual Assembly Assembly
48 {
49 get { return GetType().Assembly; }
50 }
51
45 public MySqlRegionData(string connectionString, string realm) 52 public MySqlRegionData(string connectionString, string realm)
46 : base(connectionString) 53 : base(connectionString)
47 { 54 {
@@ -51,7 +58,7 @@ namespace OpenSim.Data.MySQL
51 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) 58 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
52 { 59 {
53 dbcon.Open(); 60 dbcon.Open();
54 Migration m = new Migration(dbcon, GetType().Assembly, "GridStore"); 61 Migration m = new Migration(dbcon, Assembly, "GridStore");
55 m.Update(); 62 m.Update();
56 } 63 }
57 } 64 }
diff --git a/OpenSim/Data/MySQL/MySQLSimulationData.cs b/OpenSim/Data/MySQL/MySQLSimulationData.cs
index 02997b3..e14d775 100644
--- a/OpenSim/Data/MySQL/MySQLSimulationData.cs
+++ b/OpenSim/Data/MySQL/MySQLSimulationData.cs
@@ -52,6 +52,11 @@ namespace OpenSim.Data.MySQL
52 private string m_connectionString; 52 private string m_connectionString;
53 private object m_dbLock = new object(); 53 private object m_dbLock = new object();
54 54
55 protected virtual Assembly Assembly
56 {
57 get { return GetType().Assembly; }
58 }
59
55 public MySQLSimulationData() 60 public MySQLSimulationData()
56 { 61 {
57 } 62 }
@@ -71,8 +76,7 @@ namespace OpenSim.Data.MySQL
71 76
72 // Apply new Migrations 77 // Apply new Migrations
73 // 78 //
74 Assembly assem = GetType().Assembly; 79 Migration m = new Migration(dbcon, Assembly, "RegionStore");
75 Migration m = new Migration(dbcon, assem, "RegionStore");
76 m.Update(); 80 m.Update();
77 81
78 // Clean dropped attachments 82 // Clean dropped attachments
diff --git a/OpenSim/Data/Null/NullRegionData.cs b/OpenSim/Data/Null/NullRegionData.cs
index 2065355..53e5207 100644
--- a/OpenSim/Data/Null/NullRegionData.cs
+++ b/OpenSim/Data/Null/NullRegionData.cs
@@ -51,28 +51,56 @@ namespace OpenSim.Data.Null
51 //Console.WriteLine("[XXX] NullRegionData constructor"); 51 //Console.WriteLine("[XXX] NullRegionData constructor");
52 } 52 }
53 53
54 private delegate bool Matcher(string value);
55
54 public List<RegionData> Get(string regionName, UUID scopeID) 56 public List<RegionData> Get(string regionName, UUID scopeID)
55 { 57 {
56 if (Instance != this) 58 if (Instance != this)
57 return Instance.Get(regionName, scopeID); 59 return Instance.Get(regionName, scopeID);
58 60
59 List<RegionData> ret = new List<RegionData>(); 61 string cleanName = regionName.ToLower();
60 62
61 foreach (RegionData r in m_regionData.Values) 63 // Handle SQL wildcards
64 const string wildcard = "%";
65 bool wildcardPrefix = false;
66 bool wildcardSuffix = false;
67 if (cleanName.Equals(wildcard))
62 { 68 {
63 if (regionName.Contains("%")) 69 wildcardPrefix = wildcardSuffix = true;
70 cleanName = string.Empty;
71 }
72 else
73 {
74 if (cleanName.StartsWith(wildcard))
64 { 75 {
65 string cleanname = regionName.Replace("%", ""); 76 wildcardPrefix = true;
66 m_log.DebugFormat("[NULL REGION DATA]: comparing {0} to {1}", cleanname.ToLower(), r.RegionName.ToLower()); 77 cleanName = cleanName.Substring(1);
67 if (r.RegionName.ToLower().Contains(cleanname.ToLower()))
68 ret.Add(r);
69 } 78 }
70 else 79 if (regionName.EndsWith(wildcard))
71 { 80 {
72 if (r.RegionName.ToLower() == regionName.ToLower()) 81 wildcardSuffix = true;
73 ret.Add(r); 82 cleanName = cleanName.Remove(cleanName.Length - 1);
74 } 83 }
75 } 84 }
85 Matcher queryMatch;
86 if (wildcardPrefix && wildcardSuffix)
87 queryMatch = delegate(string s) { return s.Contains(cleanName); };
88 else if (wildcardSuffix)
89 queryMatch = delegate(string s) { return s.StartsWith(cleanName); };
90 else if (wildcardPrefix)
91 queryMatch = delegate(string s) { return s.EndsWith(cleanName); };
92 else
93 queryMatch = delegate(string s) { return s.Equals(cleanName); };
94
95 // Find region data
96 List<RegionData> ret = new List<RegionData>();
97
98 foreach (RegionData r in m_regionData.Values)
99 {
100 m_log.DebugFormat("[NULL REGION DATA]: comparing {0} to {1}", cleanName, r.RegionName.ToLower());
101 if (queryMatch(r.RegionName.ToLower()))
102 ret.Add(r);
103 }
76 104
77 if (ret.Count > 0) 105 if (ret.Count > 0)
78 return ret; 106 return ret;
diff --git a/OpenSim/Data/Null/NullUserAccountData.cs b/OpenSim/Data/Null/NullUserAccountData.cs
index ede23fb..ec54dba 100644
--- a/OpenSim/Data/Null/NullUserAccountData.cs
+++ b/OpenSim/Data/Null/NullUserAccountData.cs
@@ -28,6 +28,9 @@
28using System; 28using System;
29using System.Collections; 29using System.Collections;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Reflection;
32using System.Text;
33using log4net;
31using OpenMetaverse; 34using OpenMetaverse;
32using OpenSim.Framework; 35using OpenSim.Framework;
33using OpenSim.Data; 36using OpenSim.Data;
@@ -36,12 +39,17 @@ namespace OpenSim.Data.Null
36{ 39{
37 public class NullUserAccountData : IUserAccountData 40 public class NullUserAccountData : IUserAccountData
38 { 41 {
39 private static Dictionary<UUID, UserAccountData> m_DataByUUID = new Dictionary<UUID, UserAccountData>(); 42 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
40 private static Dictionary<string, UserAccountData> m_DataByName = new Dictionary<string, UserAccountData>(); 43
41 private static Dictionary<string, UserAccountData> m_DataByEmail = new Dictionary<string, UserAccountData>(); 44 private Dictionary<UUID, UserAccountData> m_DataByUUID = new Dictionary<UUID, UserAccountData>();
45 private Dictionary<string, UserAccountData> m_DataByName = new Dictionary<string, UserAccountData>();
46 private Dictionary<string, UserAccountData> m_DataByEmail = new Dictionary<string, UserAccountData>();
42 47
43 public NullUserAccountData(string connectionString, string realm) 48 public NullUserAccountData(string connectionString, string realm)
44 { 49 {
50// m_log.DebugFormat(
51// "[NULL USER ACCOUNT DATA]: Initializing new NullUserAccountData with connectionString [{0}], realm [{1}]",
52// connectionString, realm);
45 } 53 }
46 54
47 /// <summary> 55 /// <summary>
@@ -54,6 +62,15 @@ namespace OpenSim.Data.Null
54 /// <returns></returns> 62 /// <returns></returns>
55 public UserAccountData[] Get(string[] fields, string[] values) 63 public UserAccountData[] Get(string[] fields, string[] values)
56 { 64 {
65// if (m_log.IsDebugEnabled)
66// {
67// m_log.DebugFormat(
68// "[NULL USER ACCOUNT DATA]: Called Get with fields [{0}], values [{1}]",
69// string.Join(", ", fields), string.Join(", ", values));
70// }
71
72 UserAccountData[] userAccounts = new UserAccountData[0];
73
57 List<string> fieldsLst = new List<string>(fields); 74 List<string> fieldsLst = new List<string>(fields);
58 if (fieldsLst.Contains("PrincipalID")) 75 if (fieldsLst.Contains("PrincipalID"))
59 { 76 {
@@ -61,41 +78,61 @@ namespace OpenSim.Data.Null
61 UUID id = UUID.Zero; 78 UUID id = UUID.Zero;
62 if (UUID.TryParse(values[i], out id)) 79 if (UUID.TryParse(values[i], out id))
63 if (m_DataByUUID.ContainsKey(id)) 80 if (m_DataByUUID.ContainsKey(id))
64 return new UserAccountData[] { m_DataByUUID[id] }; 81 userAccounts = new UserAccountData[] { m_DataByUUID[id] };
65 } 82 }
66 if (fieldsLst.Contains("FirstName") && fieldsLst.Contains("LastName")) 83 else if (fieldsLst.Contains("FirstName") && fieldsLst.Contains("LastName"))
67 { 84 {
68 int findex = fieldsLst.IndexOf("FirstName"); 85 int findex = fieldsLst.IndexOf("FirstName");
69 int lindex = fieldsLst.IndexOf("LastName"); 86 int lindex = fieldsLst.IndexOf("LastName");
70 if (m_DataByName.ContainsKey(values[findex] + " " + values[lindex])) 87 if (m_DataByName.ContainsKey(values[findex] + " " + values[lindex]))
71 return new UserAccountData[] { m_DataByName[values[findex] + " " + values[lindex]] }; 88 {
72 } 89 userAccounts = new UserAccountData[] { m_DataByName[values[findex] + " " + values[lindex]] };
73 if (fieldsLst.Contains("Email")) 90 }
91 }
92 else if (fieldsLst.Contains("Email"))
74 { 93 {
75 int i = fieldsLst.IndexOf("Email"); 94 int i = fieldsLst.IndexOf("Email");
76 if (m_DataByEmail.ContainsKey(values[i])) 95 if (m_DataByEmail.ContainsKey(values[i]))
77 return new UserAccountData[] { m_DataByEmail[values[i]] }; 96 userAccounts = new UserAccountData[] { m_DataByEmail[values[i]] };
78 } 97 }
79 98
80 // Fail 99// if (m_log.IsDebugEnabled)
81 return new UserAccountData[0]; 100// {
101// StringBuilder sb = new StringBuilder();
102// foreach (UserAccountData uad in userAccounts)
103// sb.AppendFormat("({0} {1} {2}) ", uad.FirstName, uad.LastName, uad.PrincipalID);
104//
105// m_log.DebugFormat(
106// "[NULL USER ACCOUNT DATA]: Returning {0} user accounts out of {1}: [{2}]", userAccounts.Length, m_DataByName.Count, sb);
107// }
108
109 return userAccounts;
82 } 110 }
83 111
84 public bool Store(UserAccountData data) 112 public bool Store(UserAccountData data)
85 { 113 {
86 if (data == null) 114 if (data == null)
87 return false; 115 return false;
88 116
117 m_log.DebugFormat(
118 "[NULL USER ACCOUNT DATA]: Storing user account {0} {1} {2} {3}",
119 data.FirstName, data.LastName, data.PrincipalID, this.GetHashCode());
120
89 m_DataByUUID[data.PrincipalID] = data; 121 m_DataByUUID[data.PrincipalID] = data;
90 m_DataByName[data.FirstName + " " + data.LastName] = data; 122 m_DataByName[data.FirstName + " " + data.LastName] = data;
91 if (data.Data.ContainsKey("Email") && data.Data["Email"] != null && data.Data["Email"] != string.Empty) 123 if (data.Data.ContainsKey("Email") && data.Data["Email"] != null && data.Data["Email"] != string.Empty)
92 m_DataByEmail[data.Data["Email"]] = data; 124 m_DataByEmail[data.Data["Email"]] = data;
125
126// m_log.DebugFormat("m_DataByUUID count is {0}, m_DataByName count is {1}", m_DataByUUID.Count, m_DataByName.Count);
93 127
94 return true; 128 return true;
95 } 129 }
96 130
97 public UserAccountData[] GetUsers(UUID scopeID, string query) 131 public UserAccountData[] GetUsers(UUID scopeID, string query)
98 { 132 {
133// m_log.DebugFormat(
134// "[NULL USER ACCOUNT DATA]: Called GetUsers with scope [{0}], query [{1}]", scopeID, query);
135
99 string[] words = query.Split(new char[] { ' ' }); 136 string[] words = query.Split(new char[] { ' ' });
100 137
101 for (int i = 0; i < words.Length; i++) 138 for (int i = 0; i < words.Length; i++)
diff --git a/OpenSim/Data/Tests/AssetTests.cs b/OpenSim/Data/Tests/AssetTests.cs
index 800b9bf..b5ae244 100644
--- a/OpenSim/Data/Tests/AssetTests.cs
+++ b/OpenSim/Data/Tests/AssetTests.cs
@@ -32,13 +32,10 @@ using NUnit.Framework;
32using NUnit.Framework.Constraints; 32using NUnit.Framework.Constraints;
33using OpenMetaverse; 33using OpenMetaverse;
34using OpenSim.Framework; 34using OpenSim.Framework;
35using OpenSim.Tests.Common;
35using System.Data.Common; 36using System.Data.Common;
36using log4net; 37using log4net;
37 38
38#if !NUNIT25
39using NUnit.Framework.SyntaxHelpers;
40#endif
41
42// DBMS-specific: 39// DBMS-specific:
43using MySql.Data.MySqlClient; 40using MySql.Data.MySqlClient;
44using OpenSim.Data.MySQL; 41using OpenSim.Data.MySQL;
@@ -51,15 +48,6 @@ using OpenSim.Data.SQLite;
51 48
52namespace OpenSim.Data.Tests 49namespace OpenSim.Data.Tests
53{ 50{
54
55#if NUNIT25
56
57 [TestFixture(typeof(MySqlConnection), typeof(MySQLAssetData), Description="Basic Asset store tests (MySQL)")]
58 [TestFixture(typeof(SqlConnection), typeof(MSSQLAssetData), Description = "Basic Asset store tests (MS SQL Server)")]
59 [TestFixture(typeof(SqliteConnection), typeof(SQLiteAssetData), Description = "Basic Asset store tests (SQLite)")]
60
61#else
62
63 [TestFixture(Description = "Asset store tests (SQLite)")] 51 [TestFixture(Description = "Asset store tests (SQLite)")]
64 public class SQLiteAssetTests : AssetTests<SqliteConnection, SQLiteAssetData> 52 public class SQLiteAssetTests : AssetTests<SqliteConnection, SQLiteAssetData>
65 { 53 {
@@ -75,9 +63,6 @@ namespace OpenSim.Data.Tests
75 { 63 {
76 } 64 }
77 65
78#endif
79
80
81 public class AssetTests<TConn, TAssetData> : BasicDataServiceTest<TConn, TAssetData> 66 public class AssetTests<TConn, TAssetData> : BasicDataServiceTest<TConn, TAssetData>
82 where TConn : DbConnection, new() 67 where TConn : DbConnection, new()
83 where TAssetData : AssetDataBase, new() 68 where TAssetData : AssetDataBase, new()
@@ -121,6 +106,8 @@ namespace OpenSim.Data.Tests
121 [Test] 106 [Test]
122 public void T001_LoadEmpty() 107 public void T001_LoadEmpty()
123 { 108 {
109 TestHelper.InMethod();
110
124 Assert.That(m_db.ExistsAsset(uuid1), Is.False); 111 Assert.That(m_db.ExistsAsset(uuid1), Is.False);
125 Assert.That(m_db.ExistsAsset(uuid2), Is.False); 112 Assert.That(m_db.ExistsAsset(uuid2), Is.False);
126 Assert.That(m_db.ExistsAsset(uuid3), Is.False); 113 Assert.That(m_db.ExistsAsset(uuid3), Is.False);
@@ -129,6 +116,8 @@ namespace OpenSim.Data.Tests
129 [Test] 116 [Test]
130 public void T010_StoreReadVerifyAssets() 117 public void T010_StoreReadVerifyAssets()
131 { 118 {
119 TestHelper.InMethod();
120
132 AssetBase a1 = new AssetBase(uuid1, "asset one", (sbyte)AssetType.Texture, critter1.ToString()); 121 AssetBase a1 = new AssetBase(uuid1, "asset one", (sbyte)AssetType.Texture, critter1.ToString());
133 AssetBase a2 = new AssetBase(uuid2, "asset two", (sbyte)AssetType.Texture, critter2.ToString()); 122 AssetBase a2 = new AssetBase(uuid2, "asset two", (sbyte)AssetType.Texture, critter2.ToString());
134 AssetBase a3 = new AssetBase(uuid3, "asset three", (sbyte)AssetType.Texture, critter3.ToString()); 123 AssetBase a3 = new AssetBase(uuid3, "asset three", (sbyte)AssetType.Texture, critter3.ToString());
@@ -194,6 +183,8 @@ namespace OpenSim.Data.Tests
194 [Test] 183 [Test]
195 public void T020_CheckForWeirdCreatorID() 184 public void T020_CheckForWeirdCreatorID()
196 { 185 {
186 TestHelper.InMethod();
187
197 // It is expected that eventually the CreatorID might be an arbitrary string (an URI) 188 // It is expected that eventually the CreatorID might be an arbitrary string (an URI)
198 // rather than a valid UUID (?). This test is to make sure that the database layer does not 189 // rather than a valid UUID (?). This test is to make sure that the database layer does not
199 // attempt to convert CreatorID to GUID, but just passes it both ways as a string. 190 // attempt to convert CreatorID to GUID, but just passes it both ways as a string.
@@ -218,4 +209,4 @@ namespace OpenSim.Data.Tests
218 Assert.That(a3a, Constraints.PropertyCompareConstraint(a3)); 209 Assert.That(a3a, Constraints.PropertyCompareConstraint(a3));
219 } 210 }
220 } 211 }
221} 212} \ No newline at end of file
diff --git a/OpenSim/Data/Tests/EstateTests.cs b/OpenSim/Data/Tests/EstateTests.cs
index fbf8ba6..8d332da 100644
--- a/OpenSim/Data/Tests/EstateTests.cs
+++ b/OpenSim/Data/Tests/EstateTests.cs
@@ -28,10 +28,10 @@
28using System; 28using System;
29using log4net.Config; 29using log4net.Config;
30using NUnit.Framework; 30using NUnit.Framework;
31using NUnit.Framework.SyntaxHelpers;
32using OpenMetaverse; 31using OpenMetaverse;
33using OpenSim.Framework; 32using OpenSim.Framework;
34using OpenSim.Region.Framework.Interfaces; 33using OpenSim.Region.Framework.Interfaces;
34using OpenSim.Tests.Common;
35using System.Text; 35using System.Text;
36using log4net; 36using log4net;
37using System.Reflection; 37using System.Reflection;
@@ -49,15 +49,6 @@ using OpenSim.Data.SQLite;
49 49
50namespace OpenSim.Data.Tests 50namespace OpenSim.Data.Tests
51{ 51{
52
53#if NUNIT25
54
55 [TestFixture(typeof(MySqlConnection), typeof(MySQLEstateStore), Description = "Estate store tests (MySQL)")]
56 [TestFixture(typeof(SqlConnection), typeof(MSSQLEstateStore), Description = "Estate store tests (MS SQL Server)")]
57 [TestFixture(typeof(SqliteConnection), typeof(SQLiteEstateStore), Description = "Estate store tests (SQLite)")]
58
59#else
60
61 [TestFixture(Description = "Estate store tests (SQLite)")] 52 [TestFixture(Description = "Estate store tests (SQLite)")]
62 public class SQLiteEstateTests : EstateTests<SqliteConnection, SQLiteEstateStore> 53 public class SQLiteEstateTests : EstateTests<SqliteConnection, SQLiteEstateStore>
63 { 54 {
@@ -73,8 +64,6 @@ namespace OpenSim.Data.Tests
73 { 64 {
74 } 65 }
75 66
76#endif
77
78 public class EstateTests<TConn, TEstateStore> : BasicDataServiceTest<TConn, TEstateStore> 67 public class EstateTests<TConn, TEstateStore> : BasicDataServiceTest<TConn, TEstateStore>
79 where TConn : DbConnection, new() 68 where TConn : DbConnection, new()
80 where TEstateStore : class, IEstateDataStore, new() 69 where TEstateStore : class, IEstateDataStore, new()
@@ -118,6 +107,8 @@ namespace OpenSim.Data.Tests
118 [Test] 107 [Test]
119 public void T010_EstateSettingsSimpleStorage_MinimumParameterSet() 108 public void T010_EstateSettingsSimpleStorage_MinimumParameterSet()
120 { 109 {
110 TestHelper.InMethod();
111
121 EstateSettingsSimpleStorage( 112 EstateSettingsSimpleStorage(
122 REGION_ID, 113 REGION_ID,
123 DataTestUtil.STRING_MIN, 114 DataTestUtil.STRING_MIN,
@@ -149,6 +140,8 @@ namespace OpenSim.Data.Tests
149 [Test] 140 [Test]
150 public void T011_EstateSettingsSimpleStorage_MaximumParameterSet() 141 public void T011_EstateSettingsSimpleStorage_MaximumParameterSet()
151 { 142 {
143 TestHelper.InMethod();
144
152 EstateSettingsSimpleStorage( 145 EstateSettingsSimpleStorage(
153 REGION_ID, 146 REGION_ID,
154 DataTestUtil.STRING_MAX(64), 147 DataTestUtil.STRING_MAX(64),
@@ -180,6 +173,8 @@ namespace OpenSim.Data.Tests
180 [Test] 173 [Test]
181 public void T012_EstateSettingsSimpleStorage_AccurateParameterSet() 174 public void T012_EstateSettingsSimpleStorage_AccurateParameterSet()
182 { 175 {
176 TestHelper.InMethod();
177
183 EstateSettingsSimpleStorage( 178 EstateSettingsSimpleStorage(
184 REGION_ID, 179 REGION_ID,
185 DataTestUtil.STRING_MAX(1), 180 DataTestUtil.STRING_MAX(1),
@@ -211,6 +206,8 @@ namespace OpenSim.Data.Tests
211 [Test] 206 [Test]
212 public void T012_EstateSettingsRandomStorage() 207 public void T012_EstateSettingsRandomStorage()
213 { 208 {
209 TestHelper.InMethod();
210
214 // Letting estate store generate rows to database for us 211 // Letting estate store generate rows to database for us
215 EstateSettings originalSettings = db.LoadEstateSettings(REGION_ID, true); 212 EstateSettings originalSettings = db.LoadEstateSettings(REGION_ID, true);
216 new PropertyScrambler<EstateSettings>() 213 new PropertyScrambler<EstateSettings>()
@@ -230,6 +227,8 @@ namespace OpenSim.Data.Tests
230 [Test] 227 [Test]
231 public void T020_EstateSettingsManagerList() 228 public void T020_EstateSettingsManagerList()
232 { 229 {
230 TestHelper.InMethod();
231
233 // Letting estate store generate rows to database for us 232 // Letting estate store generate rows to database for us
234 EstateSettings originalSettings = db.LoadEstateSettings(REGION_ID, true); 233 EstateSettings originalSettings = db.LoadEstateSettings(REGION_ID, true);
235 234
@@ -249,6 +248,8 @@ namespace OpenSim.Data.Tests
249 [Test] 248 [Test]
250 public void T021_EstateSettingsUserList() 249 public void T021_EstateSettingsUserList()
251 { 250 {
251 TestHelper.InMethod();
252
252 // Letting estate store generate rows to database for us 253 // Letting estate store generate rows to database for us
253 EstateSettings originalSettings = db.LoadEstateSettings(REGION_ID, true); 254 EstateSettings originalSettings = db.LoadEstateSettings(REGION_ID, true);
254 255
@@ -268,6 +269,8 @@ namespace OpenSim.Data.Tests
268 [Test] 269 [Test]
269 public void T022_EstateSettingsGroupList() 270 public void T022_EstateSettingsGroupList()
270 { 271 {
272 TestHelper.InMethod();
273
271 // Letting estate store generate rows to database for us 274 // Letting estate store generate rows to database for us
272 EstateSettings originalSettings = db.LoadEstateSettings(REGION_ID, true); 275 EstateSettings originalSettings = db.LoadEstateSettings(REGION_ID, true);
273 276
@@ -287,6 +290,8 @@ namespace OpenSim.Data.Tests
287 [Test] 290 [Test]
288 public void T022_EstateSettingsBanList() 291 public void T022_EstateSettingsBanList()
289 { 292 {
293 TestHelper.InMethod();
294
290 // Letting estate store generate rows to database for us 295 // Letting estate store generate rows to database for us
291 EstateSettings originalSettings = db.LoadEstateSettings(REGION_ID, true); 296 EstateSettings originalSettings = db.LoadEstateSettings(REGION_ID, true);
292 297
@@ -520,6 +525,5 @@ namespace OpenSim.Data.Tests
520 } 525 }
521 526
522 #endregion 527 #endregion
523
524 } 528 }
525} 529} \ No newline at end of file
diff --git a/OpenSim/Data/Tests/InventoryTests.cs b/OpenSim/Data/Tests/InventoryTests.cs
index 9c2a2d6..cf3bac1 100644
--- a/OpenSim/Data/Tests/InventoryTests.cs
+++ b/OpenSim/Data/Tests/InventoryTests.cs
@@ -25,14 +25,12 @@
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28// #define NUNIT25
29
30using System; 28using System;
31using log4net.Config; 29using log4net.Config;
32using NUnit.Framework; 30using NUnit.Framework;
33using NUnit.Framework.SyntaxHelpers;
34using OpenMetaverse; 31using OpenMetaverse;
35using OpenSim.Framework; 32using OpenSim.Framework;
33using OpenSim.Tests.Common;
36using log4net; 34using log4net;
37using System.Reflection; 35using System.Reflection;
38using System.Data.Common; 36using System.Data.Common;
@@ -49,14 +47,6 @@ using OpenSim.Data.SQLite;
49 47
50namespace OpenSim.Data.Tests 48namespace OpenSim.Data.Tests
51{ 49{
52#if NUNIT25
53
54 [TestFixture(typeof(SqliteConnection), typeof(SQLiteInventoryStore), Description = "Inventory store tests (SQLite)")]
55 [TestFixture(typeof(MySqlConnection), typeof(MySQLInventoryData), Description = "Inventory store tests (MySQL)")]
56 [TestFixture(typeof(SqlConnection), typeof(MSSQLInventoryData), Description = "Inventory store tests (MS SQL Server)")]
57
58#else
59
60 [TestFixture(Description = "Inventory store tests (SQLite)")] 50 [TestFixture(Description = "Inventory store tests (SQLite)")]
61 public class SQLiteInventoryTests : InventoryTests<SqliteConnection, SQLiteInventoryStore> 51 public class SQLiteInventoryTests : InventoryTests<SqliteConnection, SQLiteInventoryStore>
62 { 52 {
@@ -71,7 +61,6 @@ namespace OpenSim.Data.Tests
71 public class MSSQLInventoryTests : InventoryTests<SqlConnection, MSSQLInventoryData> 61 public class MSSQLInventoryTests : InventoryTests<SqlConnection, MSSQLInventoryData>
72 { 62 {
73 } 63 }
74#endif
75 64
76 public class InventoryTests<TConn, TInvStore> : BasicDataServiceTest<TConn, TInvStore> 65 public class InventoryTests<TConn, TInvStore> : BasicDataServiceTest<TConn, TInvStore>
77 where TConn : DbConnection, new() 66 where TConn : DbConnection, new()
@@ -125,6 +114,8 @@ namespace OpenSim.Data.Tests
125 [Test] 114 [Test]
126 public void T001_LoadEmpty() 115 public void T001_LoadEmpty()
127 { 116 {
117 TestHelper.InMethod();
118
128 Assert.That(db.getInventoryFolder(zero), Is.Null); 119 Assert.That(db.getInventoryFolder(zero), Is.Null);
129 Assert.That(db.getInventoryFolder(folder1), Is.Null); 120 Assert.That(db.getInventoryFolder(folder1), Is.Null);
130 Assert.That(db.getInventoryFolder(folder2), Is.Null); 121 Assert.That(db.getInventoryFolder(folder2), Is.Null);
@@ -143,6 +134,8 @@ namespace OpenSim.Data.Tests
143 [Test] 134 [Test]
144 public void T010_FolderNonParent() 135 public void T010_FolderNonParent()
145 { 136 {
137 TestHelper.InMethod();
138
146 InventoryFolderBase f1 = NewFolder(folder2, folder1, owner1, name2); 139 InventoryFolderBase f1 = NewFolder(folder2, folder1, owner1, name2);
147 // the folder will go in 140 // the folder will go in
148 db.addInventoryFolder(f1); 141 db.addInventoryFolder(f1);
@@ -153,6 +146,8 @@ namespace OpenSim.Data.Tests
153 [Test] 146 [Test]
154 public void T011_FolderCreate() 147 public void T011_FolderCreate()
155 { 148 {
149 TestHelper.InMethod();
150
156 InventoryFolderBase f1 = NewFolder(folder1, zero, owner1, name1); 151 InventoryFolderBase f1 = NewFolder(folder1, zero, owner1, name1);
157 // TODO: this is probably wrong behavior, but is what we have 152 // TODO: this is probably wrong behavior, but is what we have
158 // db.updateInventoryFolder(f1); 153 // db.updateInventoryFolder(f1);
@@ -165,7 +160,7 @@ namespace OpenSim.Data.Tests
165 db.addInventoryFolder(f1); 160 db.addInventoryFolder(f1);
166 InventoryFolderBase f1a = db.getUserRootFolder(owner1); 161 InventoryFolderBase f1a = db.getUserRootFolder(owner1);
167 Assert.That(folder1, Is.EqualTo(f1a.ID), "Assert.That(folder1, Is.EqualTo(f1a.ID))"); 162 Assert.That(folder1, Is.EqualTo(f1a.ID), "Assert.That(folder1, Is.EqualTo(f1a.ID))");
168 Assert.That(name1, Text.Matches(f1a.Name), "Assert.That(name1, Text.Matches(f1a.Name))"); 163 Assert.That(name1, Is.StringMatching(f1a.Name), "Assert.That(name1, Text.Matches(f1a.Name))");
169 } 164 }
170 165
171 // we now have the following tree 166 // we now have the following tree
@@ -176,6 +171,8 @@ namespace OpenSim.Data.Tests
176 [Test] 171 [Test]
177 public void T012_FolderList() 172 public void T012_FolderList()
178 { 173 {
174 TestHelper.InMethod();
175
179 InventoryFolderBase f2 = NewFolder(folder3, folder1, owner1, name3); 176 InventoryFolderBase f2 = NewFolder(folder3, folder1, owner1, name3);
180 db.addInventoryFolder(f2); 177 db.addInventoryFolder(f2);
181 178
@@ -190,6 +187,8 @@ namespace OpenSim.Data.Tests
190 [Test] 187 [Test]
191 public void T013_FolderHierarchy() 188 public void T013_FolderHierarchy()
192 { 189 {
190 TestHelper.InMethod();
191
193 int n = db.getFolderHierarchy(zero).Count; // (for dbg - easier to see what's returned) 192 int n = db.getFolderHierarchy(zero).Count; // (for dbg - easier to see what's returned)
194 Assert.That(n, Is.EqualTo(0), "Assert.That(db.getFolderHierarchy(zero).Count, Is.EqualTo(0))"); 193 Assert.That(n, Is.EqualTo(0), "Assert.That(db.getFolderHierarchy(zero).Count, Is.EqualTo(0))");
195 n = db.getFolderHierarchy(folder1).Count; 194 n = db.getFolderHierarchy(folder1).Count;
@@ -203,6 +202,8 @@ namespace OpenSim.Data.Tests
203 [Test] 202 [Test]
204 public void T014_MoveFolder() 203 public void T014_MoveFolder()
205 { 204 {
205 TestHelper.InMethod();
206
206 InventoryFolderBase f2 = db.getInventoryFolder(folder2); 207 InventoryFolderBase f2 = db.getInventoryFolder(folder2);
207 f2.ParentID = folder3; 208 f2.ParentID = folder3;
208 db.moveInventoryFolder(f2); 209 db.moveInventoryFolder(f2);
@@ -217,6 +218,8 @@ namespace OpenSim.Data.Tests
217 [Test] 218 [Test]
218 public void T015_FolderHierarchy() 219 public void T015_FolderHierarchy()
219 { 220 {
221 TestHelper.InMethod();
222
220 Assert.That(db.getFolderHierarchy(zero).Count, Is.EqualTo(0), "Assert.That(db.getFolderHierarchy(zero).Count, Is.EqualTo(0))"); 223 Assert.That(db.getFolderHierarchy(zero).Count, Is.EqualTo(0), "Assert.That(db.getFolderHierarchy(zero).Count, Is.EqualTo(0))");
221 Assert.That(db.getFolderHierarchy(folder1).Count, Is.EqualTo(2), "Assert.That(db.getFolderHierarchy(folder1).Count, Is.EqualTo(2))"); 224 Assert.That(db.getFolderHierarchy(folder1).Count, Is.EqualTo(2), "Assert.That(db.getFolderHierarchy(folder1).Count, Is.EqualTo(2))");
222 Assert.That(db.getFolderHierarchy(folder2).Count, Is.EqualTo(0), "Assert.That(db.getFolderHierarchy(folder2).Count, Is.EqualTo(0))"); 225 Assert.That(db.getFolderHierarchy(folder2).Count, Is.EqualTo(0), "Assert.That(db.getFolderHierarchy(folder2).Count, Is.EqualTo(0))");
@@ -228,6 +231,8 @@ namespace OpenSim.Data.Tests
228 [Test] 231 [Test]
229 public void T100_NoItems() 232 public void T100_NoItems()
230 { 233 {
234 TestHelper.InMethod();
235
231 Assert.That(db.getInventoryInFolder(zero).Count, Is.EqualTo(0), "Assert.That(db.getInventoryInFolder(zero).Count, Is.EqualTo(0))"); 236 Assert.That(db.getInventoryInFolder(zero).Count, Is.EqualTo(0), "Assert.That(db.getInventoryInFolder(zero).Count, Is.EqualTo(0))");
232 Assert.That(db.getInventoryInFolder(folder1).Count, Is.EqualTo(0), "Assert.That(db.getInventoryInFolder(folder1).Count, Is.EqualTo(0))"); 237 Assert.That(db.getInventoryInFolder(folder1).Count, Is.EqualTo(0), "Assert.That(db.getInventoryInFolder(folder1).Count, Is.EqualTo(0))");
233 Assert.That(db.getInventoryInFolder(folder2).Count, Is.EqualTo(0), "Assert.That(db.getInventoryInFolder(folder2).Count, Is.EqualTo(0))"); 238 Assert.That(db.getInventoryInFolder(folder2).Count, Is.EqualTo(0), "Assert.That(db.getInventoryInFolder(folder2).Count, Is.EqualTo(0))");
@@ -240,6 +245,8 @@ namespace OpenSim.Data.Tests
240 [Test] 245 [Test]
241 public void T101_CreatItems() 246 public void T101_CreatItems()
242 { 247 {
248 TestHelper.InMethod();
249
243 db.addInventoryItem(NewItem(item1, folder3, owner1, iname1, asset1)); 250 db.addInventoryItem(NewItem(item1, folder3, owner1, iname1, asset1));
244 db.addInventoryItem(NewItem(item2, folder3, owner1, iname2, asset2)); 251 db.addInventoryItem(NewItem(item2, folder3, owner1, iname2, asset2));
245 db.addInventoryItem(NewItem(item3, folder3, owner1, iname3, asset3)); 252 db.addInventoryItem(NewItem(item3, folder3, owner1, iname3, asset3));
@@ -249,6 +256,8 @@ namespace OpenSim.Data.Tests
249 [Test] 256 [Test]
250 public void T102_CompareItems() 257 public void T102_CompareItems()
251 { 258 {
259 TestHelper.InMethod();
260
252 InventoryItemBase i1 = db.getInventoryItem(item1); 261 InventoryItemBase i1 = db.getInventoryItem(item1);
253 InventoryItemBase i2 = db.getInventoryItem(item2); 262 InventoryItemBase i2 = db.getInventoryItem(item2);
254 InventoryItemBase i3 = db.getInventoryItem(item3); 263 InventoryItemBase i3 = db.getInventoryItem(item3);
@@ -266,6 +275,8 @@ namespace OpenSim.Data.Tests
266 [Test] 275 [Test]
267 public void T103_UpdateItem() 276 public void T103_UpdateItem()
268 { 277 {
278 TestHelper.InMethod();
279
269 // TODO: probably shouldn't have the ability to have an 280 // TODO: probably shouldn't have the ability to have an
270 // owner of an item in a folder not owned by the user 281 // owner of an item in a folder not owned by the user
271 282
@@ -284,6 +295,8 @@ namespace OpenSim.Data.Tests
284 [Test] 295 [Test]
285 public void T104_RandomUpdateItem() 296 public void T104_RandomUpdateItem()
286 { 297 {
298 TestHelper.InMethod();
299
287 PropertyScrambler<InventoryFolderBase> folderScrambler = 300 PropertyScrambler<InventoryFolderBase> folderScrambler =
288 new PropertyScrambler<InventoryFolderBase>() 301 new PropertyScrambler<InventoryFolderBase>()
289 .DontScramble(x => x.Owner) 302 .DontScramble(x => x.Owner)
@@ -341,6 +354,8 @@ namespace OpenSim.Data.Tests
341 [Test] 354 [Test]
342 public void T999_StillNull() 355 public void T999_StillNull()
343 { 356 {
357 TestHelper.InMethod();
358
344 // After all tests are run, these should still return no results 359 // After all tests are run, these should still return no results
345 Assert.That(db.getInventoryFolder(zero), Is.Null); 360 Assert.That(db.getInventoryFolder(zero), Is.Null);
346 Assert.That(db.getInventoryItem(zero), Is.Null); 361 Assert.That(db.getInventoryItem(zero), Is.Null);
diff --git a/OpenSim/Data/Tests/PropertyCompareConstraint.cs b/OpenSim/Data/Tests/PropertyCompareConstraint.cs
index f3d41df..6c79bda 100644
--- a/OpenSim/Data/Tests/PropertyCompareConstraint.cs
+++ b/OpenSim/Data/Tests/PropertyCompareConstraint.cs
@@ -34,7 +34,6 @@ using System.Linq.Expressions;
34using System.Reflection; 34using System.Reflection;
35using NUnit.Framework; 35using NUnit.Framework;
36using NUnit.Framework.Constraints; 36using NUnit.Framework.Constraints;
37using NUnit.Framework.SyntaxHelpers;
38using OpenMetaverse; 37using OpenMetaverse;
39using OpenSim.Framework; 38using OpenSim.Framework;
40 39
diff --git a/OpenSim/Data/Tests/PropertyScrambler.cs b/OpenSim/Data/Tests/PropertyScrambler.cs
index 132294a..c5d40c2 100644
--- a/OpenSim/Data/Tests/PropertyScrambler.cs
+++ b/OpenSim/Data/Tests/PropertyScrambler.cs
@@ -32,13 +32,11 @@ using System.Linq.Expressions;
32using System.Reflection; 32using System.Reflection;
33using System.Text; 33using System.Text;
34using NUnit.Framework; 34using NUnit.Framework;
35using NUnit.Framework.SyntaxHelpers;
36using OpenMetaverse; 35using OpenMetaverse;
37using OpenSim.Framework; 36using OpenSim.Framework;
38 37
39namespace OpenSim.Data.Tests 38namespace OpenSim.Data.Tests
40{ 39{
41
42 //This is generic so that the lambda expressions will work right in IDEs. 40 //This is generic so that the lambda expressions will work right in IDEs.
43 public class PropertyScrambler<T> 41 public class PropertyScrambler<T>
44 { 42 {
diff --git a/OpenSim/Data/Tests/RegionTests.cs b/OpenSim/Data/Tests/RegionTests.cs
index 23d498d..44cf1ab 100644
--- a/OpenSim/Data/Tests/RegionTests.cs
+++ b/OpenSim/Data/Tests/RegionTests.cs
@@ -31,11 +31,11 @@ using System.Drawing;
31using System.Text; 31using System.Text;
32using log4net.Config; 32using log4net.Config;
33using NUnit.Framework; 33using NUnit.Framework;
34using NUnit.Framework.SyntaxHelpers;
35using OpenMetaverse; 34using OpenMetaverse;
36using OpenSim.Framework; 35using OpenSim.Framework;
37using OpenSim.Region.Framework.Interfaces; 36using OpenSim.Region.Framework.Interfaces;
38using OpenSim.Region.Framework.Scenes; 37using OpenSim.Region.Framework.Scenes;
38using OpenSim.Tests.Common;
39using log4net; 39using log4net;
40using System.Reflection; 40using System.Reflection;
41using System.Data.Common; 41using System.Data.Common;
@@ -52,14 +52,6 @@ using OpenSim.Data.SQLite;
52 52
53namespace OpenSim.Data.Tests 53namespace OpenSim.Data.Tests
54{ 54{
55#if NUNIT25
56
57 [TestFixture(typeof(SqliteConnection), typeof(SQLiteRegionData), Description = "Region store tests (SQLite)")]
58 [TestFixture(typeof(MySqlConnection), typeof(MySqlRegionData), Description = "Region store tests (MySQL)")]
59 [TestFixture(typeof(SqlConnection), typeof(MSSQLRegionData), Description = "Region store tests (MS SQL Server)")]
60
61#else
62
63 [TestFixture(Description = "Region store tests (SQLite)")] 55 [TestFixture(Description = "Region store tests (SQLite)")]
64 public class SQLiteRegionTests : RegionTests<SqliteConnection, SQLiteSimulationData> 56 public class SQLiteRegionTests : RegionTests<SqliteConnection, SQLiteSimulationData>
65 { 57 {
@@ -75,8 +67,6 @@ namespace OpenSim.Data.Tests
75 { 67 {
76 } 68 }
77 69
78#endif
79
80 public class RegionTests<TConn, TRegStore> : BasicDataServiceTest<TConn, TRegStore> 70 public class RegionTests<TConn, TRegStore> : BasicDataServiceTest<TConn, TRegStore>
81 where TConn : DbConnection, new() 71 where TConn : DbConnection, new()
82 where TRegStore : class, ISimulationDataStore, new() 72 where TRegStore : class, ISimulationDataStore, new()
@@ -131,15 +121,18 @@ namespace OpenSim.Data.Tests
131 string[] reg_tables = new string[] { 121 string[] reg_tables = new string[] {
132 "prims", "primshapes", "primitems", "terrain", "land", "landaccesslist", "regionban", "regionsettings" 122 "prims", "primshapes", "primitems", "terrain", "land", "landaccesslist", "regionban", "regionsettings"
133 }; 123 };
124
134 if (m_rebuildDB) 125 if (m_rebuildDB)
135 { 126 {
136 DropTables(reg_tables); 127 DropTables(reg_tables);
137 ResetMigrations("RegionStore"); 128 ResetMigrations("RegionStore");
138 }else 129 }
130 else
131 {
139 ClearTables(reg_tables); 132 ClearTables(reg_tables);
133 }
140 } 134 }
141 135
142
143 // Test Plan 136 // Test Plan
144 // Prims 137 // Prims
145 // - empty test - 001 138 // - empty test - 001
@@ -158,6 +151,8 @@ namespace OpenSim.Data.Tests
158 [Test] 151 [Test]
159 public void T001_LoadEmpty() 152 public void T001_LoadEmpty()
160 { 153 {
154 TestHelper.InMethod();
155
161 List<SceneObjectGroup> objs = db.LoadObjects(region1); 156 List<SceneObjectGroup> objs = db.LoadObjects(region1);
162 List<SceneObjectGroup> objs3 = db.LoadObjects(region3); 157 List<SceneObjectGroup> objs3 = db.LoadObjects(region3);
163 List<LandData> land = db.LoadLandObjects(region1); 158 List<LandData> land = db.LoadLandObjects(region1);
@@ -174,6 +169,8 @@ namespace OpenSim.Data.Tests
174 [Test] 169 [Test]
175 public void T010_StoreSimpleObject() 170 public void T010_StoreSimpleObject()
176 { 171 {
172 TestHelper.InMethod();
173
177 SceneObjectGroup sog = NewSOG("object1", prim1, region1); 174 SceneObjectGroup sog = NewSOG("object1", prim1, region1);
178 SceneObjectGroup sog2 = NewSOG("object2", prim2, region1); 175 SceneObjectGroup sog2 = NewSOG("object2", prim2, region1);
179 176
@@ -207,6 +204,8 @@ namespace OpenSim.Data.Tests
207 [Test] 204 [Test]
208 public void T011_ObjectNames() 205 public void T011_ObjectNames()
209 { 206 {
207 TestHelper.InMethod();
208
210 List<SceneObjectGroup> objs = db.LoadObjects(region1); 209 List<SceneObjectGroup> objs = db.LoadObjects(region1);
211 foreach (SceneObjectGroup sog in objs) 210 foreach (SceneObjectGroup sog in objs)
212 { 211 {
@@ -219,6 +218,8 @@ namespace OpenSim.Data.Tests
219 [Test] 218 [Test]
220 public void T012_SceneParts() 219 public void T012_SceneParts()
221 { 220 {
221 TestHelper.InMethod();
222
222 UUID tmp0 = UUID.Random(); 223 UUID tmp0 = UUID.Random();
223 UUID tmp1 = UUID.Random(); 224 UUID tmp1 = UUID.Random();
224 UUID tmp2 = UUID.Random(); 225 UUID tmp2 = UUID.Random();
@@ -252,6 +253,8 @@ namespace OpenSim.Data.Tests
252 [Test] 253 [Test]
253 public void T013_DatabasePersistency() 254 public void T013_DatabasePersistency()
254 { 255 {
256 TestHelper.InMethod();
257
255 // Sets all ScenePart parameters, stores and retrieves them, then check for consistency with initial data 258 // Sets all ScenePart parameters, stores and retrieves them, then check for consistency with initial data
256 // The commented Asserts are the ones that are unchangeable (when storing on the database, their "Set" values are ignored 259 // The commented Asserts are the ones that are unchangeable (when storing on the database, their "Set" values are ignored
257 // The ObjectFlags is an exception, if it is entered incorrectly, the object IS REJECTED on the database silently. 260 // The ObjectFlags is an exception, if it is entered incorrectly, the object IS REJECTED on the database silently.
@@ -427,6 +430,8 @@ namespace OpenSim.Data.Tests
427 [Test] 430 [Test]
428 public void T014_UpdateObject() 431 public void T014_UpdateObject()
429 { 432 {
433 TestHelper.InMethod();
434
430 string text1 = "object1 text"; 435 string text1 = "object1 text";
431 SceneObjectGroup sog = FindSOG("object1", region1); 436 SceneObjectGroup sog = FindSOG("object1", region1);
432 sog.RootPart.Text = text1; 437 sog.RootPart.Text = text1;
@@ -528,15 +533,20 @@ namespace OpenSim.Data.Tests
528 Assert.That(clickaction,Is.EqualTo(p.ClickAction), "Assert.That(clickaction,Is.EqualTo(p.ClickAction))"); 533 Assert.That(clickaction,Is.EqualTo(p.ClickAction), "Assert.That(clickaction,Is.EqualTo(p.ClickAction))");
529 Assert.That(scale,Is.EqualTo(p.Scale), "Assert.That(scale,Is.EqualTo(p.Scale))"); 534 Assert.That(scale,Is.EqualTo(p.Scale), "Assert.That(scale,Is.EqualTo(p.Scale))");
530 } 535 }
531 536
537 /// <summary>
538 /// Test storage and retrieval of a scene object with a large number of parts.
539 /// </summary>
532 [Test] 540 [Test]
533 public void T015_LargeSceneObjects() 541 public void T015_LargeSceneObjects()
534 { 542 {
543 TestHelper.InMethod();
544
535 UUID id = UUID.Random(); 545 UUID id = UUID.Random();
536 Dictionary<UUID, SceneObjectPart> mydic = new Dictionary<UUID, SceneObjectPart>(); 546 Dictionary<UUID, SceneObjectPart> mydic = new Dictionary<UUID, SceneObjectPart>();
537 SceneObjectGroup sog = NewSOG("Test SOG", id, region4); 547 SceneObjectGroup sog = NewSOG("Test SOG", id, region4);
538 mydic.Add(sog.RootPart.UUID,sog.RootPart); 548 mydic.Add(sog.RootPart.UUID,sog.RootPart);
539 for (int i=0;i<30;i++) 549 for (int i = 0; i < 30; i++)
540 { 550 {
541 UUID tmp = UUID.Random(); 551 UUID tmp = UUID.Random();
542 SceneObjectPart sop = NewSOP(("Test SOP " + i.ToString()),tmp); 552 SceneObjectPart sop = NewSOP(("Test SOP " + i.ToString()),tmp);
@@ -555,13 +565,14 @@ namespace OpenSim.Data.Tests
555 sop.Acceleration = accel; 565 sop.Acceleration = accel;
556 566
557 mydic.Add(tmp,sop); 567 mydic.Add(tmp,sop);
558 sog.AddPart(sop); 568 sog.AddPart(sop);
559 db.StoreObject(sog, region4);
560 } 569 }
561 570
571 db.StoreObject(sog, region4);
572
562 SceneObjectGroup retsog = FindSOG("Test SOG", region4); 573 SceneObjectGroup retsog = FindSOG("Test SOG", region4);
563 SceneObjectPart[] parts = retsog.Parts; 574 SceneObjectPart[] parts = retsog.Parts;
564 for (int i=0;i<30;i++) 575 for (int i = 0; i < 30; i++)
565 { 576 {
566 SceneObjectPart cursop = mydic[parts[i].UUID]; 577 SceneObjectPart cursop = mydic[parts[i].UUID];
567 Assert.That(cursop.GroupPosition,Is.EqualTo(parts[i].GroupPosition), "Assert.That(cursop.GroupPosition,Is.EqualTo(parts[i].GroupPosition))"); 578 Assert.That(cursop.GroupPosition,Is.EqualTo(parts[i].GroupPosition), "Assert.That(cursop.GroupPosition,Is.EqualTo(parts[i].GroupPosition))");
@@ -576,6 +587,8 @@ namespace OpenSim.Data.Tests
576 //[Test] 587 //[Test]
577 public void T016_RandomSogWithSceneParts() 588 public void T016_RandomSogWithSceneParts()
578 { 589 {
590 TestHelper.InMethod();
591
579 PropertyScrambler<SceneObjectPart> scrambler = 592 PropertyScrambler<SceneObjectPart> scrambler =
580 new PropertyScrambler<SceneObjectPart>() 593 new PropertyScrambler<SceneObjectPart>()
581 .DontScramble(x => x.UUID); 594 .DontScramble(x => x.UUID);
@@ -642,15 +655,16 @@ namespace OpenSim.Data.Tests
642 return sog; 655 return sog;
643 } 656 }
644 657
645
646 // NOTE: it is a bad practice to rely on some of the previous tests having been run before. 658 // NOTE: it is a bad practice to rely on some of the previous tests having been run before.
647 // If the tests are run manually, one at a time, each starts with full class init (DB cleared). 659 // If the tests are run manually, one at a time, each starts with full class init (DB cleared).
648 // Even when all tests are run, NUnit 2.5+ no longer guarantee a specific test order. 660 // Even when all tests are run, NUnit 2.5+ no longer guarantee a specific test order.
649 // We shouldn't expect to find anything in the DB if we haven't put it there *in the same test*! 661 // We shouldn't expect to find anything in the DB if we haven't put it there *in the same test*!
650 662
651 [Test] 663 [Test]
652 public void T020_PrimInventoryEmpty() 664 public void T020_PrimInventoryEmpty()
653 { 665 {
666 TestHelper.InMethod();
667
654 SceneObjectGroup sog = GetMySOG("object1"); 668 SceneObjectGroup sog = GetMySOG("object1");
655 TaskInventoryItem t = sog.GetInventoryItem(sog.RootPart.LocalId, item1); 669 TaskInventoryItem t = sog.GetInventoryItem(sog.RootPart.LocalId, item1);
656 Assert.That(t, Is.Null); 670 Assert.That(t, Is.Null);
@@ -670,10 +684,11 @@ namespace OpenSim.Data.Tests
670 db.StorePrimInventory(sog.RootPart.UUID, list); 684 db.StorePrimInventory(sog.RootPart.UUID, list);
671 } 685 }
672 686
673
674 [Test] 687 [Test]
675 public void T021_PrimInventoryBasic() 688 public void T021_PrimInventoryBasic()
676 { 689 {
690 TestHelper.InMethod();
691
677 SceneObjectGroup sog = GetMySOG("object1"); 692 SceneObjectGroup sog = GetMySOG("object1");
678 InventoryItemBase i = NewItem(item1, zero, zero, itemname1, zero); 693 InventoryItemBase i = NewItem(item1, zero, zero, itemname1, zero);
679 694
@@ -701,20 +716,19 @@ namespace OpenSim.Data.Tests
701 Assert.That(t2.Name, Is.EqualTo("My New Name"), "Assert.That(t.Name, Is.EqualTo(\"My New Name\"))"); 716 Assert.That(t2.Name, Is.EqualTo("My New Name"), "Assert.That(t.Name, Is.EqualTo(\"My New Name\"))");
702 717
703 // Removing inventory 718 // Removing inventory
704
705 List<TaskInventoryItem> list = new List<TaskInventoryItem>(); 719 List<TaskInventoryItem> list = new List<TaskInventoryItem>();
706 db.StorePrimInventory(prim1, list); 720 db.StorePrimInventory(prim1, list);
707 721
708 sog = FindSOG("object1", region1); 722 sog = FindSOG("object1", region1);
709 t = sog.GetInventoryItem(sog.RootPart.LocalId, item1); 723 t = sog.GetInventoryItem(sog.RootPart.LocalId, item1);
710 Assert.That(t, Is.Null); 724 Assert.That(t, Is.Null);
711
712 } 725 }
713
714 726
715 [Test] 727 [Test]
716 public void T025_PrimInventoryPersistency() 728 public void T025_PrimInventoryPersistency()
717 { 729 {
730 TestHelper.InMethod();
731
718 InventoryItemBase i = new InventoryItemBase(); 732 InventoryItemBase i = new InventoryItemBase();
719 UUID id = UUID.Random(); 733 UUID id = UUID.Random();
720 i.ID = id; 734 i.ID = id;
@@ -786,6 +800,8 @@ namespace OpenSim.Data.Tests
786 [ExpectedException(typeof(ArgumentException))] 800 [ExpectedException(typeof(ArgumentException))]
787 public void T026_PrimInventoryMany() 801 public void T026_PrimInventoryMany()
788 { 802 {
803 TestHelper.InMethod();
804
789 UUID i1,i2,i3,i4; 805 UUID i1,i2,i3,i4;
790 i1 = UUID.Random(); 806 i1 = UUID.Random();
791 i2 = UUID.Random(); 807 i2 = UUID.Random();
@@ -816,15 +832,18 @@ namespace OpenSim.Data.Tests
816 [Test] 832 [Test]
817 public void T052_RemoveObject() 833 public void T052_RemoveObject()
818 { 834 {
835 TestHelper.InMethod();
836
819 db.RemoveObject(prim1, region1); 837 db.RemoveObject(prim1, region1);
820 SceneObjectGroup sog = FindSOG("object1", region1); 838 SceneObjectGroup sog = FindSOG("object1", region1);
821 Assert.That(sog, Is.Null); 839 Assert.That(sog, Is.Null);
822 } 840 }
823 841
824
825 [Test] 842 [Test]
826 public void T100_DefaultRegionInfo() 843 public void T100_DefaultRegionInfo()
827 { 844 {
845 TestHelper.InMethod();
846
828 RegionSettings r1 = db.LoadRegionSettings(region1); 847 RegionSettings r1 = db.LoadRegionSettings(region1);
829 Assert.That(r1.RegionUUID, Is.EqualTo(region1), "Assert.That(r1.RegionUUID, Is.EqualTo(region1))"); 848 Assert.That(r1.RegionUUID, Is.EqualTo(region1), "Assert.That(r1.RegionUUID, Is.EqualTo(region1))");
830 849
@@ -835,6 +854,8 @@ namespace OpenSim.Data.Tests
835 [Test] 854 [Test]
836 public void T101_UpdateRegionInfo() 855 public void T101_UpdateRegionInfo()
837 { 856 {
857 TestHelper.InMethod();
858
838 int agentlimit = random.Next(); 859 int agentlimit = random.Next();
839 double objectbonus = random.Next(); 860 double objectbonus = random.Next();
840 int maturity = random.Next(); 861 int maturity = random.Next();
@@ -933,13 +954,14 @@ namespace OpenSim.Data.Tests
933 //Assert.That(r1a.TerrainImageID,Is.EqualTo(terimgid), "Assert.That(r1a.TerrainImageID,Is.EqualTo(terimgid))"); 954 //Assert.That(r1a.TerrainImageID,Is.EqualTo(terimgid), "Assert.That(r1a.TerrainImageID,Is.EqualTo(terimgid))");
934 Assert.That(r1a.FixedSun,Is.True); 955 Assert.That(r1a.FixedSun,Is.True);
935 Assert.That(r1a.SunPosition, Is.EqualTo(sunpos), "Assert.That(r1a.SunPosition, Is.EqualTo(sunpos))"); 956 Assert.That(r1a.SunPosition, Is.EqualTo(sunpos), "Assert.That(r1a.SunPosition, Is.EqualTo(sunpos))");
936 Assert.That(r1a.Covenant, Is.EqualTo(cov), "Assert.That(r1a.Covenant, Is.EqualTo(cov))"); 957 Assert.That(r1a.Covenant, Is.EqualTo(cov), "Assert.That(r1a.Covenant, Is.EqualTo(cov))");
937
938 } 958 }
939 959
940 [Test] 960 [Test]
941 public void T300_NoTerrain() 961 public void T300_NoTerrain()
942 { 962 {
963 TestHelper.InMethod();
964
943 Assert.That(db.LoadTerrain(zero), Is.Null); 965 Assert.That(db.LoadTerrain(zero), Is.Null);
944 Assert.That(db.LoadTerrain(region1), Is.Null); 966 Assert.That(db.LoadTerrain(region1), Is.Null);
945 Assert.That(db.LoadTerrain(region2), Is.Null); 967 Assert.That(db.LoadTerrain(region2), Is.Null);
@@ -949,6 +971,8 @@ namespace OpenSim.Data.Tests
949 [Test] 971 [Test]
950 public void T301_CreateTerrain() 972 public void T301_CreateTerrain()
951 { 973 {
974 TestHelper.InMethod();
975
952 double[,] t1 = GenTerrain(height1); 976 double[,] t1 = GenTerrain(height1);
953 db.StoreTerrain(t1, region1); 977 db.StoreTerrain(t1, region1);
954 978
@@ -961,6 +985,8 @@ namespace OpenSim.Data.Tests
961 [Test] 985 [Test]
962 public void T302_FetchTerrain() 986 public void T302_FetchTerrain()
963 { 987 {
988 TestHelper.InMethod();
989
964 double[,] baseterrain1 = GenTerrain(height1); 990 double[,] baseterrain1 = GenTerrain(height1);
965 double[,] baseterrain2 = GenTerrain(height2); 991 double[,] baseterrain2 = GenTerrain(height2);
966 double[,] t1 = db.LoadTerrain(region1); 992 double[,] t1 = db.LoadTerrain(region1);
@@ -971,6 +997,8 @@ namespace OpenSim.Data.Tests
971 [Test] 997 [Test]
972 public void T303_UpdateTerrain() 998 public void T303_UpdateTerrain()
973 { 999 {
1000 TestHelper.InMethod();
1001
974 double[,] baseterrain1 = GenTerrain(height1); 1002 double[,] baseterrain1 = GenTerrain(height1);
975 double[,] baseterrain2 = GenTerrain(height2); 1003 double[,] baseterrain2 = GenTerrain(height2);
976 db.StoreTerrain(baseterrain2, region1); 1004 db.StoreTerrain(baseterrain2, region1);
@@ -983,6 +1011,8 @@ namespace OpenSim.Data.Tests
983 [Test] 1011 [Test]
984 public void T400_EmptyLand() 1012 public void T400_EmptyLand()
985 { 1013 {
1014 TestHelper.InMethod();
1015
986 Assert.That(db.LoadLandObjects(zero).Count, Is.EqualTo(0), "Assert.That(db.LoadLandObjects(zero).Count, Is.EqualTo(0))"); 1016 Assert.That(db.LoadLandObjects(zero).Count, Is.EqualTo(0), "Assert.That(db.LoadLandObjects(zero).Count, Is.EqualTo(0))");
987 Assert.That(db.LoadLandObjects(region1).Count, Is.EqualTo(0), "Assert.That(db.LoadLandObjects(region1).Count, Is.EqualTo(0))"); 1017 Assert.That(db.LoadLandObjects(region1).Count, Is.EqualTo(0), "Assert.That(db.LoadLandObjects(region1).Count, Is.EqualTo(0))");
988 Assert.That(db.LoadLandObjects(region2).Count, Is.EqualTo(0), "Assert.That(db.LoadLandObjects(region2).Count, Is.EqualTo(0))"); 1018 Assert.That(db.LoadLandObjects(region2).Count, Is.EqualTo(0), "Assert.That(db.LoadLandObjects(region2).Count, Is.EqualTo(0))");
@@ -1018,25 +1048,12 @@ namespace OpenSim.Data.Tests
1018 return true; 1048 return true;
1019 } 1049 }
1020 1050
1021
1022 private SceneObjectGroup FindSOG(string name, UUID r) 1051 private SceneObjectGroup FindSOG(string name, UUID r)
1023 { 1052 {
1024 List<SceneObjectGroup> objs = db.LoadObjects(r); 1053 List<SceneObjectGroup> objs = db.LoadObjects(r);
1025 foreach (SceneObjectGroup sog in objs) 1054 foreach (SceneObjectGroup sog in objs)
1026 { 1055 if (sog.Name == name)
1027 SceneObjectPart p = sog.RootPart;
1028 if (p.Name == name) {
1029 RegionInfo regionInfo = new RegionInfo();
1030 regionInfo.RegionID = r;
1031 regionInfo.RegionLocX = 0;
1032 regionInfo.RegionLocY = 0;
1033
1034 Scene scene = new Scene(regionInfo);
1035 sog.SetScene(scene);
1036
1037 return sog; 1056 return sog;
1038 }
1039 }
1040 1057
1041 return null; 1058 return null;
1042 } 1059 }
diff --git a/OpenSim/Framework/Capabilities/Caps.cs b/OpenSim/Framework/Capabilities/Caps.cs
index c2f9c3a..3be97b5 100644
--- a/OpenSim/Framework/Capabilities/Caps.cs
+++ b/OpenSim/Framework/Capabilities/Caps.cs
@@ -181,7 +181,6 @@ namespace OpenSim.Framework.Capabilities
181 181
182 RegisterRegionServiceHandlers(capsBase); 182 RegisterRegionServiceHandlers(capsBase);
183 RegisterInventoryServiceHandlers(capsBase); 183 RegisterInventoryServiceHandlers(capsBase);
184
185 } 184 }
186 185
187 public void RegisterRegionServiceHandlers(string capsBase) 186 public void RegisterRegionServiceHandlers(string capsBase)
diff --git a/OpenSim/Framework/PrimitiveBaseShape.cs b/OpenSim/Framework/PrimitiveBaseShape.cs
index 927415e..7b5fb2e 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/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
index 4c35132..ccec9b7 100644
--- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
+++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
@@ -378,6 +378,22 @@ namespace OpenSim.Framework.Servers.HttpServer
378 /// <param name="response"></param> 378 /// <param name="response"></param>
379 public virtual void HandleRequest(OSHttpRequest request, OSHttpResponse response) 379 public virtual void HandleRequest(OSHttpRequest request, OSHttpResponse response)
380 { 380 {
381 if (request.HttpMethod == String.Empty) // Can't handle empty requests, not wasting a thread
382 {
383 try
384 {
385 SendHTML500(response);
386 }
387 catch
388 {
389 }
390
391 return;
392 }
393
394 string requestMethod = request.HttpMethod;
395 string uriString = request.RawUrl;
396
381 string reqnum = "unknown"; 397 string reqnum = "unknown";
382 int tickstart = Environment.TickCount; 398 int tickstart = Environment.TickCount;
383 399
@@ -495,7 +511,7 @@ namespace OpenSim.Framework.Servers.HttpServer
495 511
496 request.InputStream.Close(); 512 request.InputStream.Close();
497 513
498 // HTTP IN support. The script engine taes it from here 514 // HTTP IN support. The script engine takes it from here
499 // Nothing to worry about for us. 515 // Nothing to worry about for us.
500 // 516 //
501 if (buffer == null) 517 if (buffer == null)
@@ -609,19 +625,19 @@ namespace OpenSim.Framework.Servers.HttpServer
609 { 625 {
610 m_log.ErrorFormat("[BASE HTTP SERVER]: HandleRequest() threw ", e); 626 m_log.ErrorFormat("[BASE HTTP SERVER]: HandleRequest() threw ", e);
611 } 627 }
612 catch (InvalidOperationException e) 628 catch (Exception e)
613 { 629 {
614 m_log.ErrorFormat("[BASE HTTP SERVER]: HandleRequest() threw {0}", e); 630 m_log.ErrorFormat("[BASE HTTP SERVER]: HandleRequest() threw " + e.ToString());
615 SendHTML500(response); 631 SendHTML500(response);
616 } 632 }
617 finally 633 finally
618 { 634 {
619 // Every month or so this will wrap and give bad numbers, not really a problem 635 // Every month or so this will wrap and give bad numbers, not really a problem
620 // since its just for reporting, 200ms limit can be adjusted 636 // since its just for reporting, tickdiff limit can be adjusted
621 int tickdiff = Environment.TickCount - tickstart; 637 int tickdiff = Environment.TickCount - tickstart;
622 if (tickdiff > 500) 638 if (tickdiff > 3000)
623 m_log.InfoFormat( 639 m_log.InfoFormat(
624 "[BASE HTTP SERVER]: slow request <{0}> for {1} took {2} ms", reqnum, request.RawUrl, tickdiff); 640 "[BASE HTTP SERVER]: slow {0} request for {1} from {2} took {3} ms", requestMethod, uriString, request.RemoteIPEndPoint.ToString(), tickdiff);
625 } 641 }
626 } 642 }
627 643
@@ -785,7 +801,19 @@ namespace OpenSim.Framework.Servers.HttpServer
785 if (methodWasFound) 801 if (methodWasFound)
786 { 802 {
787 xmlRprcRequest.Params.Add(request.Url); // Param[2] 803 xmlRprcRequest.Params.Add(request.Url); // Param[2]
788 xmlRprcRequest.Params.Add(request.Headers.Get("X-Forwarded-For")); // Param[3] 804
805 string xff = "X-Forwarded-For";
806 string xfflower = xff.ToLower();
807 foreach (string s in request.Headers.AllKeys)
808 {
809 if (s != null && s.Equals(xfflower))
810 {
811 xff = xfflower;
812 break;
813 }
814 }
815 xmlRprcRequest.Params.Add(request.Headers.Get(xff)); // Param[3]
816
789 817
790 try 818 try
791 { 819 {
diff --git a/OpenSim/Framework/Servers/HttpServer/OSHttpHandler.cs b/OpenSim/Framework/Servers/HttpServer/OSHttpHandler.cs
index 129a544..2c2b47d 100644
--- a/OpenSim/Framework/Servers/HttpServer/OSHttpHandler.cs
+++ b/OpenSim/Framework/Servers/HttpServer/OSHttpHandler.cs
@@ -83,7 +83,7 @@ namespace OpenSim.Framework.Servers.HttpServer
83 /// <summary> 83 /// <summary>
84 /// Regular expression used to match against path of the 84 /// Regular expression used to match against path of the
85 /// incoming HTTP request. If you want to match any string 85 /// incoming HTTP request. If you want to match any string
86 /// either use '.*' or null. To match on the emtpy string use 86 /// either use '.*' or null. To match on the empty string use
87 /// '^$'. 87 /// '^$'.
88 /// </summary> 88 /// </summary>
89 public virtual Regex Path 89 public virtual Regex Path
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/Framework/UndoStack.cs b/OpenSim/Framework/UndoStack.cs
index 4d800ae..fde63b1 100644
--- a/OpenSim/Framework/UndoStack.cs
+++ b/OpenSim/Framework/UndoStack.cs
@@ -90,7 +90,7 @@ namespace OpenSim.Framework
90 return deleted; 90 return deleted;
91 } 91 }
92 else 92 else
93 throw new InvalidOperationException("Cannot pop from emtpy stack"); 93 throw new InvalidOperationException("Cannot pop from empty stack");
94 } 94 }
95 95
96 public T Peek() 96 public T Peek()
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs
index 533e53a..5a5046e 100644
--- a/OpenSim/Framework/Util.cs
+++ b/OpenSim/Framework/Util.cs
@@ -459,10 +459,17 @@ namespace OpenSim.Framework
459 /// <param name="oldy">Old region y-coord</param> 459 /// <param name="oldy">Old region y-coord</param>
460 /// <param name="newy">New region y-coord</param> 460 /// <param name="newy">New region y-coord</param>
461 /// <returns></returns> 461 /// <returns></returns>
462 public static bool IsOutsideView(uint oldx, uint newx, uint oldy, uint newy) 462 public static bool IsOutsideView(float drawdist, uint oldx, uint newx, uint oldy, uint newy)
463 { 463 {
464 // Eventually this will be a function of the draw distance / camera position too. 464 int dd = (int)((drawdist + Constants.RegionSize - 1) / Constants.RegionSize);
465 return (((int)Math.Abs((int)(oldx - newx)) > 1) || ((int)Math.Abs((int)(oldy - newy)) > 1)); 465
466 int startX = (int)oldx - dd;
467 int startY = (int)oldy - dd;
468
469 int endX = (int)oldx + dd;
470 int endY = (int)oldy + dd;
471
472 return (newx < startX || endX < newx || newy < startY || endY < newy);
466 } 473 }
467 474
468 public static string FieldToString(byte[] bytes) 475 public static string FieldToString(byte[] bytes)
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
index 584c577..583214c 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
@@ -845,7 +845,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
845 845
846 private void HandleUseCircuitCode(object o) 846 private void HandleUseCircuitCode(object o)
847 { 847 {
848 DateTime startTime = DateTime.Now; 848// DateTime startTime = DateTime.Now;
849 object[] array = (object[])o; 849 object[] array = (object[])o;
850 UDPPacketBuffer buffer = (UDPPacketBuffer)array[0]; 850 UDPPacketBuffer buffer = (UDPPacketBuffer)array[0];
851 UseCircuitCodePacket packet = (UseCircuitCodePacket)array[1]; 851 UseCircuitCodePacket packet = (UseCircuitCodePacket)array[1];
diff --git a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs
index 6ed4867..9adb68b 100644
--- a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs
+++ b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs
@@ -92,9 +92,9 @@ namespace Flotsam.RegionModules.AssetCache
92 // Expiration is expressed in hours. 92 // Expiration is expressed in hours.
93 private const double m_DefaultMemoryExpiration = 1.0; 93 private const double m_DefaultMemoryExpiration = 1.0;
94 private const double m_DefaultFileExpiration = 48; 94 private const double m_DefaultFileExpiration = 48;
95 private TimeSpan m_MemoryExpiration = TimeSpan.Zero; 95 private TimeSpan m_MemoryExpiration = TimeSpan.FromHours(m_DefaultMemoryExpiration);
96 private TimeSpan m_FileExpiration = TimeSpan.Zero; 96 private TimeSpan m_FileExpiration = TimeSpan.FromHours(m_DefaultFileExpiration);
97 private TimeSpan m_FileExpirationCleanupTimer = TimeSpan.Zero; 97 private TimeSpan m_FileExpirationCleanupTimer = TimeSpan.FromHours(m_DefaultFileExpiration);
98 98
99 private static int m_CacheDirectoryTiers = 1; 99 private static int m_CacheDirectoryTiers = 1;
100 private static int m_CacheDirectoryTierLen = 3; 100 private static int m_CacheDirectoryTierLen = 3;
@@ -147,7 +147,7 @@ namespace Flotsam.RegionModules.AssetCache
147 } 147 }
148 148
149 m_CacheDirectory = assetConfig.GetString("CacheDirectory", m_DefaultCacheDirectory); 149 m_CacheDirectory = assetConfig.GetString("CacheDirectory", m_DefaultCacheDirectory);
150 m_log.InfoFormat("[FLOTSAM ASSET CACHE]: Cache Directory", m_DefaultCacheDirectory); 150 m_log.InfoFormat("[FLOTSAM ASSET CACHE]: Cache Directory", m_CacheDirectory);
151 151
152 m_MemoryCacheEnabled = assetConfig.GetBoolean("MemoryCacheEnabled", false); 152 m_MemoryCacheEnabled = assetConfig.GetBoolean("MemoryCacheEnabled", false);
153 m_MemoryExpiration = TimeSpan.FromHours(assetConfig.GetDouble("MemoryCacheTimeout", m_DefaultMemoryExpiration)); 153 m_MemoryExpiration = TimeSpan.FromHours(assetConfig.GetDouble("MemoryCacheTimeout", m_DefaultMemoryExpiration));
@@ -245,16 +245,7 @@ namespace Flotsam.RegionModules.AssetCache
245 private void UpdateMemoryCache(string key, AssetBase asset) 245 private void UpdateMemoryCache(string key, AssetBase asset)
246 { 246 {
247 if (m_MemoryCacheEnabled) 247 if (m_MemoryCacheEnabled)
248 { 248 m_MemoryCache.AddOrUpdate(key, asset, m_MemoryExpiration);
249 if (m_MemoryExpiration > TimeSpan.Zero)
250 {
251 m_MemoryCache.AddOrUpdate(key, asset, m_MemoryExpiration);
252 }
253 else
254 {
255 m_MemoryCache.AddOrUpdate(key, asset, Double.MaxValue);
256 }
257 }
258 } 249 }
259 250
260 public void Cache(AssetBase asset) 251 public void Cache(AssetBase asset)
@@ -450,7 +441,7 @@ namespace Flotsam.RegionModules.AssetCache
450 private void CleanupExpiredFiles(object source, ElapsedEventArgs e) 441 private void CleanupExpiredFiles(object source, ElapsedEventArgs e)
451 { 442 {
452 if (m_LogLevel >= 2) 443 if (m_LogLevel >= 2)
453 m_log.DebugFormat("[FLOTSAM ASSET CACHE]: Checking for expired files older then {0}.", m_FileExpiration.ToString()); 444 m_log.DebugFormat("[FLOTSAM ASSET CACHE]: Checking for expired files older then {0}.", m_FileExpiration);
454 445
455 // Purge all files last accessed prior to this point 446 // Purge all files last accessed prior to this point
456 DateTime purgeLine = DateTime.Now - m_FileExpiration; 447 DateTime purgeLine = DateTime.Now - m_FileExpiration;
diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
index f8ce444..08ac624 100644
--- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
@@ -167,7 +167,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
167 } 167 }
168 } 168 }
169 169
170 m_log.InfoFormat("[AVFACTORY]: complete texture check for {0}", client.AgentId); 170 m_log.DebugFormat("[AVFACTORY]: complete texture check for {0}", client.AgentId);
171 171
172 // If we only found default textures, then the appearance is not cached 172 // If we only found default textures, then the appearance is not cached
173 return (defonly ? false : true); 173 return (defonly ? false : true);
diff --git a/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs b/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs
index 2b3d2a9..8a977c9 100644
--- a/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs
@@ -49,16 +49,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog
49 { 49 {
50 m_scene = scene; 50 m_scene = scene;
51 m_scene.RegisterModuleInterface<IDialogModule>(this); 51 m_scene.RegisterModuleInterface<IDialogModule>(this);
52 52
53 m_scene.AddCommand( 53 m_scene.AddCommand(
54 this, "alert", "alert <first> <last> <message>", 54 this, "alert", "alert <message>",
55 "Send an alert to a user", 55 "Send an alert to everyone",
56 HandleAlertConsoleCommand); 56 HandleAlertConsoleCommand);
57 57
58 m_scene.AddCommand( 58 m_scene.AddCommand(
59 this, "alert general", "alert [general] <message>", 59 this, "alert-user", "alert-user <first> <last> <message>",
60 "Send an alert to everyone", 60 "Send an alert to a user",
61 "If keyword 'general' is omitted, then <message> must be surrounded by quotation marks.",
62 HandleAlertConsoleCommand); 61 HandleAlertConsoleCommand);
63 } 62 }
64 63
@@ -177,55 +176,32 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog
177 { 176 {
178 if (m_scene.ConsoleScene() != null && m_scene.ConsoleScene() != m_scene) 177 if (m_scene.ConsoleScene() != null && m_scene.ConsoleScene() != m_scene)
179 return; 178 return;
180 179
181 bool isGeneral = false;
182 string firstName = string.Empty;
183 string lastName = string.Empty;
184 string message = string.Empty; 180 string message = string.Empty;
185 181
186 if (cmdparams.Length > 1) 182 if (cmdparams[0].ToLower().Equals("alert"))
187 {
188 firstName = cmdparams[1];
189 isGeneral = firstName.ToLower().Equals("general");
190 }
191 if (cmdparams.Length == 2 && !isGeneral)
192 { 183 {
193 // alert "message" 184 message = CombineParams(cmdparams, 1);
194 message = cmdparams[1]; 185 m_log.InfoFormat("[DIALOG]: Sending general alert in region {0} with message {1}",
195 isGeneral = true; 186 m_scene.RegionInfo.RegionName, message);
196 } 187 SendGeneralAlert(message);
197 else if (cmdparams.Length > 2 && isGeneral)
198 {
199 // alert general <message>
200 message = CombineParams(cmdparams, 2);
201 } 188 }
202 else if (cmdparams.Length > 3) 189 else if (cmdparams.Length > 3)
203 { 190 {
204 // alert <first> <last> <message> 191 string firstName = cmdparams[1];
205 lastName = cmdparams[2]; 192 string lastName = cmdparams[2];
206 message = CombineParams(cmdparams, 3); 193 message = CombineParams(cmdparams, 3);
194 m_log.InfoFormat(
195 "[DIALOG]: Sending alert in region {0} to {1} {2} with message {3}",
196 m_scene.RegionInfo.RegionName, firstName, lastName, message);
197 SendAlertToUser(firstName, lastName, message, false);
207 } 198 }
208 else 199 else
209 { 200 {
210 OpenSim.Framework.Console.MainConsole.Instance.Output( 201 OpenSim.Framework.Console.MainConsole.Instance.Output(
211 "Usage: alert \"message\" | alert general <message> | alert <first> <last> <message>"); 202 "Usage: alert <message> | alert-user <first> <last> <message>");
212 return; 203 return;
213 } 204 }
214
215 if (isGeneral)
216 {
217 m_log.InfoFormat(
218 "[DIALOG]: Sending general alert in region {0} with message {1}",
219 m_scene.RegionInfo.RegionName, message);
220 SendGeneralAlert(message);
221 }
222 else
223 {
224 m_log.InfoFormat(
225 "[DIALOG]: Sending alert in region {0} to {1} {2} with message {3}",
226 m_scene.RegionInfo.RegionName, firstName, lastName, message);
227 SendAlertToUser(firstName, lastName, message, false);
228 }
229 } 205 }
230 206
231 private string CombineParams(string[] commandParams, int pos) 207 private string CombineParams(string[] commandParams, int pos)
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
index 6030706..9b98de3 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
@@ -41,6 +41,7 @@ using OpenSim.Framework.Serialization;
41using OpenSim.Framework.Serialization.External; 41using OpenSim.Framework.Serialization.External;
42using OpenSim.Region.CoreModules.World.Archiver; 42using OpenSim.Region.CoreModules.World.Archiver;
43using OpenSim.Region.Framework.Scenes; 43using OpenSim.Region.Framework.Scenes;
44using OpenSim.Region.Framework.Scenes.Serialization;
44using OpenSim.Region.Framework.Interfaces; 45using OpenSim.Region.Framework.Interfaces;
45using OpenSim.Services.Interfaces; 46using OpenSim.Services.Interfaces;
46 47
@@ -75,6 +76,36 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
75 /// The stream from which the inventory archive will be loaded. 76 /// The stream from which the inventory archive will be loaded.
76 /// </value> 77 /// </value>
77 private Stream m_loadStream; 78 private Stream m_loadStream;
79
80 protected bool m_controlFileLoaded;
81 protected bool m_assetsLoaded;
82 protected bool m_inventoryNodesLoaded;
83
84 protected int m_successfulAssetRestores;
85 protected int m_failedAssetRestores;
86 protected int m_successfulItemRestores;
87
88 /// <summary>
89 /// Root destination folder for the IAR load.
90 /// </summary>
91 protected InventoryFolderBase m_rootDestinationFolder;
92
93 /// <summary>
94 /// Inventory nodes loaded from the iar.
95 /// </summary>
96 protected HashSet<InventoryNodeBase> m_loadedNodes = new HashSet<InventoryNodeBase>();
97
98 /// <summary>
99 /// In order to load identically named folders, we need to keep track of the folders that we have already
100 /// resolved.
101 /// </summary>
102 Dictionary <string, InventoryFolderBase> m_resolvedFolders = new Dictionary<string, InventoryFolderBase>();
103
104 /// <summary>
105 /// Record the creator id that should be associated with an asset. This is used to adjust asset creator ids
106 /// after OSP resolution (since OSP creators are only stored in the item
107 /// </summary>
108 protected Dictionary<UUID, UUID> m_creatorIdForAssetId = new Dictionary<UUID, UUID>();
78 109
79 public InventoryArchiveReadRequest( 110 public InventoryArchiveReadRequest(
80 Scene scene, UserAccount userInfo, string invPath, string loadPath, bool merge) 111 Scene scene, UserAccount userInfo, string invPath, string loadPath, bool merge)
@@ -100,20 +131,19 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
100 /// <summary> 131 /// <summary>
101 /// Execute the request 132 /// Execute the request
102 /// </summary> 133 /// </summary>
134 /// <remarks>
135 /// Only call this once. To load another IAR, construct another request object.
136 /// </remarks>
103 /// <returns> 137 /// <returns>
104 /// A list of the inventory nodes loaded. If folders were loaded then only the root folders are 138 /// A list of the inventory nodes loaded. If folders were loaded then only the root folders are
105 /// returned 139 /// returned
106 /// </returns> 140 /// </returns>
141 /// <exception cref="System.Exception">Thrown if load fails.</exception>
107 public HashSet<InventoryNodeBase> Execute() 142 public HashSet<InventoryNodeBase> Execute()
108 { 143 {
109 try 144 try
110 { 145 {
111 string filePath = "ERROR"; 146 string filePath = "ERROR";
112 int successfulAssetRestores = 0;
113 int failedAssetRestores = 0;
114 int successfulItemRestores = 0;
115
116 HashSet<InventoryNodeBase> loadedNodes = new HashSet<InventoryNodeBase>();
117 147
118 List<InventoryFolderBase> folderCandidates 148 List<InventoryFolderBase> folderCandidates
119 = InventoryArchiveUtils.FindFolderByPath( 149 = InventoryArchiveUtils.FindFolderByPath(
@@ -124,16 +154,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
124 // Possibly provide an option later on to automatically create this folder if it does not exist 154 // Possibly provide an option later on to automatically create this folder if it does not exist
125 m_log.ErrorFormat("[INVENTORY ARCHIVER]: Inventory path {0} does not exist", m_invPath); 155 m_log.ErrorFormat("[INVENTORY ARCHIVER]: Inventory path {0} does not exist", m_invPath);
126 156
127 return loadedNodes; 157 return m_loadedNodes;
128 } 158 }
129 159
130 InventoryFolderBase rootDestinationFolder = folderCandidates[0]; 160 m_rootDestinationFolder = folderCandidates[0];
131 archive = new TarArchiveReader(m_loadStream); 161 archive = new TarArchiveReader(m_loadStream);
132
133 // In order to load identically named folders, we need to keep track of the folders that we have already
134 // resolved
135 Dictionary <string, InventoryFolderBase> resolvedFolders = new Dictionary<string, InventoryFolderBase>();
136
137 byte[] data; 162 byte[] data;
138 TarArchiveReader.TarEntryType entryType; 163 TarArchiveReader.TarEntryType entryType;
139 164
@@ -142,45 +167,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
142 if (filePath == ArchiveConstants.CONTROL_FILE_PATH) 167 if (filePath == ArchiveConstants.CONTROL_FILE_PATH)
143 { 168 {
144 LoadControlFile(filePath, data); 169 LoadControlFile(filePath, data);
145 } 170 }
146 else if (filePath.StartsWith(ArchiveConstants.ASSETS_PATH)) 171 else if (filePath.StartsWith(ArchiveConstants.ASSETS_PATH))
147 { 172 {
148 if (LoadAsset(filePath, data)) 173 LoadAssetFile(filePath, data);
149 successfulAssetRestores++;
150 else
151 failedAssetRestores++;
152
153 if ((successfulAssetRestores) % 50 == 0)
154 m_log.DebugFormat(
155 "[INVENTORY ARCHIVER]: Loaded {0} assets...",
156 successfulAssetRestores);
157 } 174 }
158 else if (filePath.StartsWith(ArchiveConstants.INVENTORY_PATH)) 175 else if (filePath.StartsWith(ArchiveConstants.INVENTORY_PATH))
159 { 176 {
160 filePath = filePath.Substring(ArchiveConstants.INVENTORY_PATH.Length); 177 LoadInventoryFile(filePath, entryType, data);
161
162 // Trim off the file portion if we aren't already dealing with a directory path
163 if (TarArchiveReader.TarEntryType.TYPE_DIRECTORY != entryType)
164 filePath = filePath.Remove(filePath.LastIndexOf("/") + 1);
165
166 InventoryFolderBase foundFolder
167 = ReplicateArchivePathToUserInventory(
168 filePath, rootDestinationFolder, resolvedFolders, loadedNodes);
169
170 if (TarArchiveReader.TarEntryType.TYPE_DIRECTORY != entryType)
171 {
172 InventoryItemBase item = LoadItem(data, foundFolder);
173
174 if (item != null)
175 {
176 successfulItemRestores++;
177
178 // If we aren't loading the folder containing the item then well need to update the
179 // viewer separately for that item.
180 if (!loadedNodes.Contains(foundFolder))
181 loadedNodes.Add(item);
182 }
183 }
184 } 178 }
185 } 179 }
186 180
@@ -188,10 +182,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
188 182
189 m_log.DebugFormat( 183 m_log.DebugFormat(
190 "[INVENTORY ARCHIVER]: Successfully loaded {0} assets with {1} failures", 184 "[INVENTORY ARCHIVER]: Successfully loaded {0} assets with {1} failures",
191 successfulAssetRestores, failedAssetRestores); 185 m_successfulAssetRestores, m_failedAssetRestores);
192 m_log.InfoFormat("[INVENTORY ARCHIVER]: Successfully loaded {0} items", successfulItemRestores); 186 m_log.InfoFormat("[INVENTORY ARCHIVER]: Successfully loaded {0} items", m_successfulItemRestores);
193 187
194 return loadedNodes; 188 return m_loadedNodes;
195 } 189 }
196 finally 190 finally
197 { 191 {
@@ -400,9 +394,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
400 UUID ospResolvedId = OspResolver.ResolveOspa(item.CreatorId, m_scene.UserAccountService); 394 UUID ospResolvedId = OspResolver.ResolveOspa(item.CreatorId, m_scene.UserAccountService);
401 if (UUID.Zero != ospResolvedId) // The user exists in this grid 395 if (UUID.Zero != ospResolvedId) // The user exists in this grid
402 { 396 {
397// m_log.DebugFormat("[INVENTORY ARCHIVER]: Found creator {0} via OSPA resolution", ospResolvedId);
398
403 item.CreatorIdAsUuid = ospResolvedId; 399 item.CreatorIdAsUuid = ospResolvedId;
404 400
405 // XXX: For now, don't preserve the OSPA in the creator id (which actually gets persisted to the 401 // Don't preserve the OSPA in the creator id (which actually gets persisted to the
406 // database). Instead, replace with the UUID that we found. 402 // database). Instead, replace with the UUID that we found.
407 item.CreatorId = ospResolvedId.ToString(); 403 item.CreatorId = ospResolvedId.ToString();
408 404
@@ -410,7 +406,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
410 } 406 }
411 else if (item.CreatorData == null || item.CreatorData == String.Empty) 407 else if (item.CreatorData == null || item.CreatorData == String.Empty)
412 { 408 {
413 item.CreatorIdAsUuid = m_userInfo.PrincipalID; 409 item.CreatorId = m_userInfo.PrincipalID.ToString();
410 item.CreatorIdAsUuid = new UUID(item.CreatorId);
414 } 411 }
415 412
416 item.Owner = m_userInfo.PrincipalID; 413 item.Owner = m_userInfo.PrincipalID;
@@ -418,6 +415,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
418 // Reset folder ID to the one in which we want to load it 415 // Reset folder ID to the one in which we want to load it
419 item.Folder = loadFolder.ID; 416 item.Folder = loadFolder.ID;
420 417
418 // Record the creator id for the item's asset so that we can use it later, if necessary, when the asset
419 // is loaded.
420 // FIXME: This relies on the items coming before the assets in the TAR file. Need to create stronger
421 // checks for this, and maybe even an external tool for creating OARs which enforces this, rather than
422 // relying on native tar tools.
423 m_creatorIdForAssetId[item.AssetID] = item.CreatorIdAsUuid;
424
421 m_scene.AddInventoryItem(item); 425 m_scene.AddInventoryItem(item);
422 426
423 return item; 427 return item;
@@ -446,18 +450,38 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
446 } 450 }
447 451
448 string extension = filename.Substring(i); 452 string extension = filename.Substring(i);
449 string uuid = filename.Remove(filename.Length - extension.Length); 453 string rawUuid = filename.Remove(filename.Length - extension.Length);
454 UUID assetId = new UUID(rawUuid);
450 455
451 if (ArchiveConstants.EXTENSION_TO_ASSET_TYPE.ContainsKey(extension)) 456 if (ArchiveConstants.EXTENSION_TO_ASSET_TYPE.ContainsKey(extension))
452 { 457 {
453 sbyte assetType = ArchiveConstants.EXTENSION_TO_ASSET_TYPE[extension]; 458 sbyte assetType = ArchiveConstants.EXTENSION_TO_ASSET_TYPE[extension];
454 459
455 if (assetType == (sbyte)AssetType.Unknown) 460 if (assetType == (sbyte)AssetType.Unknown)
456 m_log.WarnFormat("[INVENTORY ARCHIVER]: Importing {0} byte asset {1} with unknown type", data.Length, uuid); 461 {
462 m_log.WarnFormat("[INVENTORY ARCHIVER]: Importing {0} byte asset {1} with unknown type", data.Length, assetId);
463 }
464 else if (assetType == (sbyte)AssetType.Object)
465 {
466 if (m_creatorIdForAssetId.ContainsKey(assetId))
467 {
468 string xmlData = Utils.BytesToString(data);
469 SceneObjectGroup sog = SceneObjectSerializer.FromOriginalXmlFormat(xmlData);
470 foreach (SceneObjectPart sop in sog.Parts)
471 {
472 if (sop.CreatorData == null || sop.CreatorData == "")
473 {
474 sop.CreatorID = m_creatorIdForAssetId[assetId];
475 }
476 }
477
478 data = Utils.StringToBytes(SceneObjectSerializer.ToOriginalXmlFormat(sog));
479 }
480 }
457 481
458 //m_log.DebugFormat("[INVENTORY ARCHIVER]: Importing asset {0}, type {1}", uuid, assetType); 482 //m_log.DebugFormat("[INVENTORY ARCHIVER]: Importing asset {0}, type {1}", uuid, assetType);
459 483
460 AssetBase asset = new AssetBase(new UUID(uuid), "RandomName", assetType, UUID.Zero.ToString()); 484 AssetBase asset = new AssetBase(assetId, "From IAR", assetType, UUID.Zero.ToString());
461 asset.Data = data; 485 asset.Data = data;
462 486
463 m_scene.AssetService.Store(asset); 487 m_scene.AssetService.Store(asset);
@@ -495,7 +519,88 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
495 majorVersion, MAX_MAJOR_VERSION)); 519 majorVersion, MAX_MAJOR_VERSION));
496 } 520 }
497 521
498 m_log.InfoFormat("[INVENTORY ARCHIVER]: Loading IAR with version {0}", version); 522 m_controlFileLoaded = true;
523 m_log.InfoFormat("[INVENTORY ARCHIVER]: Loading IAR with version {0}", version);
499 } 524 }
525
526 /// <summary>
527 /// Load inventory file
528 /// </summary>
529 /// <param name="path"></param>
530 /// <param name="entryType"></param>
531 /// <param name="data"></param>
532 protected void LoadInventoryFile(string path, TarArchiveReader.TarEntryType entryType, byte[] data)
533 {
534 if (!m_controlFileLoaded)
535 throw new Exception(
536 string.Format(
537 "The IAR you are trying to load does not list {0} before {1}. Aborting load",
538 ArchiveConstants.CONTROL_FILE_PATH, ArchiveConstants.INVENTORY_PATH));
539
540 if (m_assetsLoaded)
541 throw new Exception(
542 string.Format(
543 "The IAR you are trying to load does not list all {0} before {1}. Aborting load",
544 ArchiveConstants.INVENTORY_PATH, ArchiveConstants.ASSETS_PATH));
545
546 path = path.Substring(ArchiveConstants.INVENTORY_PATH.Length);
547
548 // Trim off the file portion if we aren't already dealing with a directory path
549 if (TarArchiveReader.TarEntryType.TYPE_DIRECTORY != entryType)
550 path = path.Remove(path.LastIndexOf("/") + 1);
551
552 InventoryFolderBase foundFolder
553 = ReplicateArchivePathToUserInventory(
554 path, m_rootDestinationFolder, m_resolvedFolders, m_loadedNodes);
555
556 if (TarArchiveReader.TarEntryType.TYPE_DIRECTORY != entryType)
557 {
558 InventoryItemBase item = LoadItem(data, foundFolder);
559
560 if (item != null)
561 {
562 m_successfulItemRestores++;
563
564 // If we aren't loading the folder containing the item then well need to update the
565 // viewer separately for that item.
566 if (!m_loadedNodes.Contains(foundFolder))
567 m_loadedNodes.Add(item);
568 }
569 }
570
571 m_inventoryNodesLoaded = true;
572 }
573
574 /// <summary>
575 /// Load asset file
576 /// </summary>
577 /// <param name="path"></param>
578 /// <param name="data"></param>
579 protected void LoadAssetFile(string path, byte[] data)
580 {
581 if (!m_controlFileLoaded)
582 throw new Exception(
583 string.Format(
584 "The IAR you are trying to load does not list {0} before {1}. Aborting load",
585 ArchiveConstants.CONTROL_FILE_PATH, ArchiveConstants.ASSETS_PATH));
586
587 if (!m_inventoryNodesLoaded)
588 throw new Exception(
589 string.Format(
590 "The IAR you are trying to load does not list all {0} before {1}. Aborting load",
591 ArchiveConstants.INVENTORY_PATH, ArchiveConstants.ASSETS_PATH));
592
593 if (LoadAsset(path, data))
594 m_successfulAssetRestores++;
595 else
596 m_failedAssetRestores++;
597
598 if ((m_successfulAssetRestores) % 50 == 0)
599 m_log.DebugFormat(
600 "[INVENTORY ARCHIVER]: Loaded {0} assets...",
601 m_successfulAssetRestores);
602
603 m_assetsLoaded = true;
604 }
500 } 605 }
501} \ No newline at end of file 606} \ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs
index 26edba4..576a154 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..e5127a0
--- /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_uaMT
67 = new UserAccount {
68 PrincipalID = UUID.Parse("00000000-0000-0000-0000-000000000555"),
69 FirstName = "Mr",
70 LastName = "Tiddles" };
71 protected UserAccount m_uaLL1
72 = new UserAccount {
73 PrincipalID = UUID.Parse("00000000-0000-0000-0000-000000000666"),
74 FirstName = "Lord",
75 LastName = "Lucan" };
76 protected UserAccount m_uaLL2
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 virtual 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 InventoryArchiverModule archiverModule = new InventoryArchiverModule();
100 Scene scene = SceneSetupHelpers.SetupScene("Inventory");
101 SceneSetupHelpers.SetupSceneModules(scene, archiverModule);
102
103 UserProfileTestUtils.CreateUserWithInventory(scene, m_uaLL1, "hampshire");
104
105 MemoryStream archiveWriteStream = new MemoryStream();
106
107 // Create asset
108 SceneObjectGroup object1;
109 SceneObjectPart part1;
110 {
111 string partName = "Ray Gun Object";
112 UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000040");
113 PrimitiveBaseShape shape = PrimitiveBaseShape.CreateSphere();
114 Vector3 groupPosition = new Vector3(10, 20, 30);
115 Quaternion rotationOffset = new Quaternion(20, 30, 40, 50);
116 Vector3 offsetPosition = new Vector3(5, 10, 15);
117
118 part1
119 = new SceneObjectPart(
120 ownerId, shape, groupPosition, rotationOffset, offsetPosition);
121 part1.Name = partName;
122
123 object1 = new SceneObjectGroup(part1);
124 scene.AddNewSceneObject(object1, false);
125 }
126
127 UUID asset1Id = UUID.Parse("00000000-0000-0000-0000-000000000060");
128 AssetBase asset1 = AssetHelpers.CreateAsset(asset1Id, object1);
129 scene.AssetService.Store(asset1);
130
131 // Create item
132 InventoryItemBase item1 = new InventoryItemBase();
133 item1.Name = m_item1Name;
134 item1.ID = UUID.Parse("00000000-0000-0000-0000-000000000020");
135 item1.AssetID = asset1.FullID;
136 item1.GroupID = UUID.Random();
137 item1.CreatorIdAsUuid = m_uaLL1.PrincipalID;
138 item1.Owner = m_uaLL1.PrincipalID;
139 item1.Folder = scene.InventoryService.GetRootFolder(m_uaLL1.PrincipalID).ID;
140 scene.AddInventoryItem(item1);
141
142 archiverModule.ArchiveInventory(
143 Guid.NewGuid(), m_uaLL1.FirstName, m_uaLL1.LastName, m_item1Name, "hampshire", archiveWriteStream);
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..7f156f8 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,182 +49,21 @@ 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); 54 protected TestScene m_scene;
56 55 protected InventoryArchiverModule m_archiverModule;
57 /// <summary> 56
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] 57 [SetUp]
82 public void Init() 58 public override void SetUp()
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 { 59 {
120 TestHelper.InMethod(); 60 base.SetUp();
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 61
135 // Create asset 62 SerialiserModule serialiserModule = new SerialiserModule();
136 SceneObjectGroup object1; 63 m_archiverModule = new InventoryArchiverModule();
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 64
228 // TODO: Test presence of more files and contents of files. 65 m_scene = SceneSetupHelpers.SetupScene("Inventory");
66 SceneSetupHelpers.SetupSceneModules(m_scene, serialiserModule, m_archiverModule);
229 } 67 }
230 68
231 /// <summary> 69 /// <summary>
@@ -238,17 +76,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
238 TestHelper.InMethod(); 76 TestHelper.InMethod();
239// log4net.Config.XmlConfigurator.Configure(); 77// log4net.Config.XmlConfigurator.Configure();
240 78
241 InventoryArchiverModule archiverModule = new InventoryArchiverModule();
242
243 Scene scene = SceneSetupHelpers.SetupScene("Inventory");
244 SceneSetupHelpers.SetupSceneModules(scene, archiverModule);
245
246 // Create user 79 // Create user
247 string userFirstName = "Jock"; 80 string userFirstName = "Jock";
248 string userLastName = "Stirrup"; 81 string userLastName = "Stirrup";
249 string userPassword = "troll"; 82 string userPassword = "troll";
250 UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000020"); 83 UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000020");
251 UserProfileTestUtils.CreateUserWithInventory(scene, userFirstName, userLastName, userId, userPassword); 84 UserProfileTestUtils.CreateUserWithInventory(m_scene, userFirstName, userLastName, userId, userPassword);
252 85
253 // Create asset 86 // Create asset
254 SceneObjectGroup object1; 87 SceneObjectGroup object1;
@@ -267,12 +100,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
267 part1.Name = partName; 100 part1.Name = partName;
268 101
269 object1 = new SceneObjectGroup(part1); 102 object1 = new SceneObjectGroup(part1);
270 scene.AddNewSceneObject(object1, false); 103 m_scene.AddNewSceneObject(object1, false);
271 } 104 }
272 105
273 UUID asset1Id = UUID.Parse("00000000-0000-0000-0000-000000000060"); 106 UUID asset1Id = UUID.Parse("00000000-0000-0000-0000-000000000060");
274 AssetBase asset1 = AssetHelpers.CreateAsset(asset1Id, object1); 107 AssetBase asset1 = AssetHelpers.CreateAsset(asset1Id, object1);
275 scene.AssetService.Store(asset1); 108 m_scene.AssetService.Store(asset1);
276 109
277 // Create item 110 // Create item
278 UUID item1Id = UUID.Parse("00000000-0000-0000-0000-000000000080"); 111 UUID item1Id = UUID.Parse("00000000-0000-0000-0000-000000000080");
@@ -282,15 +115,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
282 item1.AssetID = asset1.FullID; 115 item1.AssetID = asset1.FullID;
283 item1.ID = item1Id; 116 item1.ID = item1Id;
284 InventoryFolderBase objsFolder 117 InventoryFolderBase objsFolder
285 = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, userId, "Objects")[0]; 118 = InventoryArchiveUtils.FindFolderByPath(m_scene.InventoryService, userId, "Objects")[0];
286 item1.Folder = objsFolder.ID; 119 item1.Folder = objsFolder.ID;
287 scene.AddInventoryItem(item1); 120 m_scene.AddInventoryItem(item1);
288 121
289 MemoryStream archiveWriteStream = new MemoryStream(); 122 MemoryStream archiveWriteStream = new MemoryStream();
290 archiverModule.OnInventoryArchiveSaved += SaveCompleted; 123 m_archiverModule.OnInventoryArchiveSaved += SaveCompleted;
291 124
292 mre.Reset(); 125 mre.Reset();
293 archiverModule.ArchiveInventory( 126 m_archiverModule.ArchiveInventory(
294 Guid.NewGuid(), userFirstName, userLastName, "Objects/" + item1Name, userPassword, archiveWriteStream); 127 Guid.NewGuid(), userFirstName, userLastName, "Objects/" + item1Name, userPassword, archiveWriteStream);
295 mre.WaitOne(60000, false); 128 mre.WaitOne(60000, false);
296 129
@@ -346,474 +179,99 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
346 } 179 }
347 180
348 /// <summary> 181 /// <summary>
349 /// Test that things work when the load path specified starts with a slash 182 /// Test case where a creator account exists for the creator UUID embedded in item metadata and serialized
350 /// </summary> 183 /// objects.
184 /// </summary>
351 [Test] 185 [Test]
352 public void TestLoadIarPathStartsWithSlash() 186 public void TestLoadIarCreatorAccountPresent()
353 { 187 {
354 TestHelper.InMethod(); 188 TestHelper.InMethod();
355// log4net.Config.XmlConfigurator.Configure(); 189// 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 190
191 UserProfileTestUtils.CreateUserWithInventory(m_scene, m_uaLL1, "meowfood");
192
193 m_archiverModule.DearchiveInventory(m_uaLL1.FirstName, m_uaLL1.LastName, "/", "meowfood", m_iarStream);
365 InventoryItemBase foundItem1 194 InventoryItemBase foundItem1
366 = InventoryArchiveUtils.FindItemByPath( 195 = InventoryArchiveUtils.FindItemByPath(m_scene.InventoryService, m_uaLL1.PrincipalID, m_item1Name);
367 scene.InventoryService, m_ua1.PrincipalID, "/Objects/" + m_item1Name); 196
197 Assert.That(
198 foundItem1.CreatorId, Is.EqualTo(m_uaLL1.PrincipalID.ToString()),
199 "Loaded item non-uuid creator doesn't match original");
200 Assert.That(
201 foundItem1.CreatorIdAsUuid, Is.EqualTo(m_uaLL1.PrincipalID),
202 "Loaded item uuid creator doesn't match original");
203 Assert.That(foundItem1.Owner, Is.EqualTo(m_uaLL1.PrincipalID),
204 "Loaded item owner doesn't match inventory reciever");
368 205
369 Assert.That(foundItem1, Is.Not.Null, "Didn't find loaded item 1 in TestLoadIarFolderStartsWithSlash()"); 206 AssetBase asset1 = m_scene.AssetService.Get(foundItem1.AssetID.ToString());
207 string xmlData = Utils.BytesToString(asset1.Data);
208 SceneObjectGroup sog1 = SceneObjectSerializer.FromOriginalXmlFormat(xmlData);
209
210 Assert.That(sog1.RootPart.CreatorID, Is.EqualTo(m_uaLL1.PrincipalID));
370 } 211 }
371 212
372 /// <summary> 213 /// <summary>
373 /// Test loading a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet) where 214 /// 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. 215 /// an account exists with the same name as the creator, though not the same id.
375 /// </summary> 216 /// </summary>
376 ///
377 /// This test also does some deeper probing of loading into nested inventory structures
378 [Test] 217 [Test]
379 public void TestLoadIarV0_1ExistingUsers() 218 public void TestLoadIarV0_1SameNameCreator()
380 { 219 {
381 TestHelper.InMethod(); 220 TestHelper.InMethod();
382 //log4net.Config.XmlConfigurator.Configure(); 221// log4net.Config.XmlConfigurator.Configure();
383
384 SerialiserModule serialiserModule = new SerialiserModule();
385 InventoryArchiverModule archiverModule = new InventoryArchiverModule();
386
387 // Annoyingly, we have to set up a scene even though inventory loading has nothing to do with a scene
388 Scene scene = SceneSetupHelpers.SetupScene("inventory");
389
390 SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule);
391 222
392 UserProfileTestUtils.CreateUserWithInventory(scene, m_ua1, "meowfood"); 223 UserProfileTestUtils.CreateUserWithInventory(m_scene, m_uaMT, "meowfood");
393 UserProfileTestUtils.CreateUserWithInventory(scene, m_ua2, "hampshire"); 224 UserProfileTestUtils.CreateUserWithInventory(m_scene, m_uaLL2, "hampshire");
394 225
395 archiverModule.DearchiveInventory(m_ua1.FirstName, m_ua1.LastName, "/", "meowfood", m_iarStream); 226 m_archiverModule.DearchiveInventory(m_uaMT.FirstName, m_uaMT.LastName, "/", "meowfood", m_iarStream);
396
397 InventoryItemBase foundItem1 227 InventoryItemBase foundItem1
398 = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, m_ua1.PrincipalID, m_item1Name); 228 = InventoryArchiveUtils.FindItemByPath(m_scene.InventoryService, m_uaMT.PrincipalID, m_item1Name);
399
400 Assert.That(foundItem1, Is.Not.Null, "Didn't find loaded item 1");
401 229
402// 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.
404// Assert.That(
405// foundItem1.CreatorId, Is.EqualTo(item1.CreatorId),
406// "Loaded item non-uuid creator doesn't match original");
407 Assert.That( 230 Assert.That(
408 foundItem1.CreatorId, Is.EqualTo(m_ua2.PrincipalID.ToString()), 231 foundItem1.CreatorId, Is.EqualTo(m_uaLL2.PrincipalID.ToString()),
409 "Loaded item non-uuid creator doesn't match original"); 232 "Loaded item non-uuid creator doesn't match original");
410
411 Assert.That( 233 Assert.That(
412 foundItem1.CreatorIdAsUuid, Is.EqualTo(m_ua2.PrincipalID), 234 foundItem1.CreatorIdAsUuid, Is.EqualTo(m_uaLL2.PrincipalID),
413 "Loaded item uuid creator doesn't match original"); 235 "Loaded item uuid creator doesn't match original");
414 Assert.That(foundItem1.Owner, Is.EqualTo(m_ua1.PrincipalID), 236 Assert.That(foundItem1.Owner, Is.EqualTo(m_uaMT.PrincipalID),
415 "Loaded item owner doesn't match inventory reciever"); 237 "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 238
503 archiverModule.DearchiveInventory(userFirstName, userLastName, "Scripts", userPassword, archiveReadStream); 239 AssetBase asset1 = m_scene.AssetService.Get(foundItem1.AssetID.ToString());
504 240 string xmlData = Utils.BytesToString(asset1.Data);
505 InventoryItemBase foundItem1 241 SceneObjectGroup sog1 = SceneObjectSerializer.FromOriginalXmlFormat(xmlData);
506 = InventoryArchiveUtils.FindItemByPath(
507 scene.InventoryService, userId, "Scripts/Objects/" + humanEscapedItemName);
508 242
509 Assert.That(foundItem1, Is.Not.Null, "Didn't find loaded item 1"); 243 Assert.That(sog1.RootPart.CreatorID, Is.EqualTo(m_uaLL2.PrincipalID));
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 } 244 }
517 245
518 /// <summary> 246 /// <summary>
519 /// Test loading a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet) where 247 /// 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 248 /// the creator or an account with the creator's name does not exist within the system.
521 /// </summary> 249 /// </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] 250 [Test]
527 public void TestLoadIarV0_1AbsentUsers() 251 public void TestLoadIarV0_1AbsentCreator()
528 { 252 {
529 TestHelper.InMethod(); 253 TestHelper.InMethod();
530 //log4net.Config.XmlConfigurator.Configure(); 254// 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
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();
561 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");
565
566 SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule);
567 UserProfileTestUtils.CreateUserWithInventory(scene, userFirstName, userLastName, userUuid, "meowfood");
568 255
569 archiverModule.DearchiveInventory(userFirstName, userLastName, "/", "meowfood", archiveReadStream); 256 UserProfileTestUtils.CreateUserWithInventory(m_scene, m_uaMT, "password");
257 m_archiverModule.DearchiveInventory(m_uaMT.FirstName, m_uaMT.LastName, "/", "password", m_iarStream);
570 258
571 InventoryItemBase foundItem1 259 InventoryItemBase foundItem1
572 = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, userUuid, itemName); 260 = InventoryArchiveUtils.FindItemByPath(m_scene.InventoryService, m_uaMT.PrincipalID, m_item1Name);
573 261
574 Assert.That(foundItem1, Is.Not.Null, "Didn't find loaded item 1"); 262 Assert.That(foundItem1, Is.Not.Null, "Didn't find loaded item 1");
575// Assert.That(
576// foundItem1.CreatorId, Is.EqualTo(userUuid),
577// "Loaded item non-uuid creator doesn't match that of the loading user");
578 Assert.That( 263 Assert.That(
579 foundItem1.CreatorIdAsUuid, Is.EqualTo(userUuid), 264 foundItem1.CreatorId, Is.EqualTo(m_uaMT.PrincipalID.ToString()),
265 "Loaded item non-uuid creator doesn't match that of the loading user");
266 Assert.That(
267 foundItem1.CreatorIdAsUuid, Is.EqualTo(m_uaMT.PrincipalID),
580 "Loaded item uuid creator doesn't match that of the loading user"); 268 "Loaded item uuid creator doesn't match that of the loading user");
581 }
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 269
596 // string userFirstName = "Dennis"; 270 AssetBase asset1 = m_scene.AssetService.Get(foundItem1.AssetID.ToString());
597 // string userLastName = "Menace"; 271 string xmlData = Utils.BytesToString(asset1.Data);
598 // UUID userUuid = UUID.Parse("00000000-0000-0000-0000-000000000aaa"); 272 SceneObjectGroup sog1 = SceneObjectSerializer.FromOriginalXmlFormat(xmlData);
599 // string user2FirstName = "Walter";
600 // string user2LastName = "Mitty";
601 273
602 // string itemName = "b.lsl"; 274 Assert.That(sog1.RootPart.CreatorID, Is.EqualTo(m_uaMT.PrincipalID));
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 } 275 }
818 } 276 }
819} \ No newline at end of file 277} \ 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..0e8f647
--- /dev/null
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/PathTests.cs
@@ -0,0 +1,478 @@
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 = new SceneObjectPart(ownerId, shape, groupPosition, rotationOffset, offsetPosition);
88 part1.Name = partName;
89
90 object1 = new SceneObjectGroup(part1);
91 scene.AddNewSceneObject(object1, false);
92 }
93
94 UUID asset1Id = UUID.Parse("00000000-0000-0000-0000-000000000060");
95 AssetBase asset1 = AssetHelpers.CreateAsset(asset1Id, object1);
96 scene.AssetService.Store(asset1);
97
98 // Create item
99 UUID item1Id = UUID.Parse("00000000-0000-0000-0000-000000000080");
100 InventoryItemBase item1 = new InventoryItemBase();
101 item1.Name = "My Little Dog";
102 item1.AssetID = asset1.FullID;
103 item1.ID = item1Id;
104 InventoryFolderBase objsFolder
105 = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, userId, "Objects")[0];
106 item1.Folder = objsFolder.ID;
107 scene.AddInventoryItem(item1);
108
109 MemoryStream archiveWriteStream = new MemoryStream();
110 archiverModule.OnInventoryArchiveSaved += SaveCompleted;
111
112 // Test saving a particular path
113 mre.Reset();
114 archiverModule.ArchiveInventory(
115 Guid.NewGuid(), userFirstName, userLastName, "Objects", userPassword, archiveWriteStream);
116 mre.WaitOne(60000, false);
117
118 byte[] archive = archiveWriteStream.ToArray();
119 MemoryStream archiveReadStream = new MemoryStream(archive);
120 TarArchiveReader tar = new TarArchiveReader(archiveReadStream);
121
122 //bool gotControlFile = false;
123 bool gotObject1File = false;
124 //bool gotObject2File = false;
125 string expectedObject1FileName = InventoryArchiveWriteRequest.CreateArchiveItemName(item1);
126 string expectedObject1FilePath = string.Format(
127 "{0}{1}{2}",
128 ArchiveConstants.INVENTORY_PATH,
129 InventoryArchiveWriteRequest.CreateArchiveFolderName(objsFolder),
130 expectedObject1FileName);
131
132 string filePath;
133 TarArchiveReader.TarEntryType tarEntryType;
134
135// Console.WriteLine("Reading archive");
136
137 while (tar.ReadEntry(out filePath, out tarEntryType) != null)
138 {
139// Console.WriteLine("Got {0}", filePath);
140
141// if (ArchiveConstants.CONTROL_FILE_PATH == filePath)
142// {
143// gotControlFile = true;
144// }
145
146 if (filePath.StartsWith(ArchiveConstants.INVENTORY_PATH) && filePath.EndsWith(".xml"))
147 {
148// string fileName = filePath.Remove(0, "Objects/".Length);
149//
150// if (fileName.StartsWith(part1.Name))
151// {
152 Assert.That(expectedObject1FilePath, Is.EqualTo(filePath));
153 gotObject1File = true;
154// }
155// else if (fileName.StartsWith(part2.Name))
156// {
157// Assert.That(fileName, Is.EqualTo(expectedObject2FileName));
158// gotObject2File = true;
159// }
160 }
161 }
162
163// Assert.That(gotControlFile, Is.True, "No control file in archive");
164 Assert.That(gotObject1File, Is.True, "No item1 file in archive");
165// Assert.That(gotObject2File, Is.True, "No object2 file in archive");
166
167 // TODO: Test presence of more files and contents of files.
168 }
169
170 /// <summary>
171 /// Test loading an IAR to various different inventory paths.
172 /// </summary>
173 [Test]
174 public void TestLoadIarToInventoryPaths()
175 {
176 TestHelper.InMethod();
177// log4net.Config.XmlConfigurator.Configure();
178
179 SerialiserModule serialiserModule = new SerialiserModule();
180 InventoryArchiverModule archiverModule = new InventoryArchiverModule();
181
182 // Annoyingly, we have to set up a scene even though inventory loading has nothing to do with a scene
183 Scene scene = SceneSetupHelpers.SetupScene("inventory");
184
185 SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule);
186
187 UserProfileTestUtils.CreateUserWithInventory(scene, m_uaMT, "meowfood");
188 UserProfileTestUtils.CreateUserWithInventory(scene, m_uaLL1, "hampshire");
189
190 archiverModule.DearchiveInventory(m_uaMT.FirstName, m_uaMT.LastName, "/", "meowfood", m_iarStream);
191 InventoryItemBase foundItem1
192 = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, m_uaMT.PrincipalID, m_item1Name);
193
194 Assert.That(foundItem1, Is.Not.Null, "Didn't find loaded item 1");
195
196 // Now try loading to a root child folder
197 UserInventoryTestUtils.CreateInventoryFolder(scene.InventoryService, m_uaMT.PrincipalID, "xA");
198 MemoryStream archiveReadStream = new MemoryStream(m_iarStream.ToArray());
199 archiverModule.DearchiveInventory(m_uaMT.FirstName, m_uaMT.LastName, "xA", "meowfood", archiveReadStream);
200
201 InventoryItemBase foundItem2
202 = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, m_uaMT.PrincipalID, "xA/" + m_item1Name);
203 Assert.That(foundItem2, Is.Not.Null, "Didn't find loaded item 2");
204
205 // Now try loading to a more deeply nested folder
206 UserInventoryTestUtils.CreateInventoryFolder(scene.InventoryService, m_uaMT.PrincipalID, "xB/xC");
207 archiveReadStream = new MemoryStream(archiveReadStream.ToArray());
208 archiverModule.DearchiveInventory(m_uaMT.FirstName, m_uaMT.LastName, "xB/xC", "meowfood", archiveReadStream);
209
210 InventoryItemBase foundItem3
211 = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, m_uaMT.PrincipalID, "xB/xC/" + m_item1Name);
212 Assert.That(foundItem3, Is.Not.Null, "Didn't find loaded item 3");
213 }
214
215 /// <summary>
216 /// Test that things work when the load path specified starts with a slash
217 /// </summary>
218 [Test]
219 public void TestLoadIarPathStartsWithSlash()
220 {
221 TestHelper.InMethod();
222// log4net.Config.XmlConfigurator.Configure();
223
224 SerialiserModule serialiserModule = new SerialiserModule();
225 InventoryArchiverModule archiverModule = new InventoryArchiverModule();
226 Scene scene = SceneSetupHelpers.SetupScene("inventory");
227 SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule);
228
229 UserProfileTestUtils.CreateUserWithInventory(scene, m_uaMT, "password");
230 archiverModule.DearchiveInventory(m_uaMT.FirstName, m_uaMT.LastName, "/Objects", "password", m_iarStream);
231
232 InventoryItemBase foundItem1
233 = InventoryArchiveUtils.FindItemByPath(
234 scene.InventoryService, m_uaMT.PrincipalID, "/Objects/" + m_item1Name);
235
236 Assert.That(foundItem1, Is.Not.Null, "Didn't find loaded item 1 in TestLoadIarFolderStartsWithSlash()");
237 }
238
239 [Test]
240 public void TestLoadIarPathWithEscapedChars()
241 {
242 TestHelper.InMethod();
243// log4net.Config.XmlConfigurator.Configure();
244
245 string itemName = "You & you are a mean/man/";
246 string humanEscapedItemName = @"You & you are a mean\/man\/";
247 string userPassword = "meowfood";
248
249 InventoryArchiverModule archiverModule = new InventoryArchiverModule();
250
251 Scene scene = SceneSetupHelpers.SetupScene("Inventory");
252 SceneSetupHelpers.SetupSceneModules(scene, archiverModule);
253
254 // Create user
255 string userFirstName = "Jock";
256 string userLastName = "Stirrup";
257 UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000020");
258 UserProfileTestUtils.CreateUserWithInventory(scene, userFirstName, userLastName, userId, "meowfood");
259
260 // Create asset
261 SceneObjectGroup object1;
262 SceneObjectPart part1;
263 {
264 string partName = "part name";
265 UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000040");
266 PrimitiveBaseShape shape = PrimitiveBaseShape.CreateSphere();
267 Vector3 groupPosition = new Vector3(10, 20, 30);
268 Quaternion rotationOffset = new Quaternion(20, 30, 40, 50);
269 Vector3 offsetPosition = new Vector3(5, 10, 15);
270
271 part1
272 = new SceneObjectPart(
273 ownerId, shape, groupPosition, rotationOffset, offsetPosition);
274 part1.Name = partName;
275
276 object1 = new SceneObjectGroup(part1);
277 scene.AddNewSceneObject(object1, false);
278 }
279
280 UUID asset1Id = UUID.Parse("00000000-0000-0000-0000-000000000060");
281 AssetBase asset1 = AssetHelpers.CreateAsset(asset1Id, object1);
282 scene.AssetService.Store(asset1);
283
284 // Create item
285 UUID item1Id = UUID.Parse("00000000-0000-0000-0000-000000000080");
286 InventoryItemBase item1 = new InventoryItemBase();
287 item1.Name = itemName;
288 item1.AssetID = asset1.FullID;
289 item1.ID = item1Id;
290 InventoryFolderBase objsFolder
291 = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, userId, "Objects")[0];
292 item1.Folder = objsFolder.ID;
293 scene.AddInventoryItem(item1);
294
295 MemoryStream archiveWriteStream = new MemoryStream();
296 archiverModule.OnInventoryArchiveSaved += SaveCompleted;
297
298 mre.Reset();
299 archiverModule.ArchiveInventory(
300 Guid.NewGuid(), userFirstName, userLastName, "Objects", userPassword, archiveWriteStream);
301 mre.WaitOne(60000, false);
302
303 // LOAD ITEM
304 MemoryStream archiveReadStream = new MemoryStream(archiveWriteStream.ToArray());
305
306 archiverModule.DearchiveInventory(userFirstName, userLastName, "Scripts", userPassword, archiveReadStream);
307
308 InventoryItemBase foundItem1
309 = InventoryArchiveUtils.FindItemByPath(
310 scene.InventoryService, userId, "Scripts/Objects/" + humanEscapedItemName);
311
312 Assert.That(foundItem1, Is.Not.Null, "Didn't find loaded item 1");
313// Assert.That(
314// foundItem1.CreatorId, Is.EqualTo(userUuid),
315// "Loaded item non-uuid creator doesn't match that of the loading user");
316 Assert.That(
317 foundItem1.Name, Is.EqualTo(itemName),
318 "Loaded item name doesn't match saved name");
319 }
320
321 /// <summary>
322 /// Test replication of an archive path to the user's inventory.
323 /// </summary>
324 [Test]
325 public void TestNewIarPath()
326 {
327 TestHelper.InMethod();
328// log4net.Config.XmlConfigurator.Configure();
329
330 Scene scene = SceneSetupHelpers.SetupScene("inventory");
331 UserAccount ua1 = UserProfileTestUtils.CreateUserWithInventory(scene);
332
333 Dictionary <string, InventoryFolderBase> foldersCreated = new Dictionary<string, InventoryFolderBase>();
334 HashSet<InventoryNodeBase> nodesLoaded = new HashSet<InventoryNodeBase>();
335
336 string folder1Name = "1";
337 string folder2aName = "2a";
338 string folder2bName = "2b";
339
340 string folder1ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder1Name, UUID.Random());
341 string folder2aArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder2aName, UUID.Random());
342 string folder2bArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder2bName, UUID.Random());
343
344 string iarPath1 = string.Join("", new string[] { folder1ArchiveName, folder2aArchiveName });
345 string iarPath2 = string.Join("", new string[] { folder1ArchiveName, folder2bArchiveName });
346
347 {
348 // Test replication of path1
349 new InventoryArchiveReadRequest(scene, ua1, null, (Stream)null, false)
350 .ReplicateArchivePathToUserInventory(
351 iarPath1, scene.InventoryService.GetRootFolder(ua1.PrincipalID),
352 foldersCreated, nodesLoaded);
353
354 List<InventoryFolderBase> folder1Candidates
355 = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, ua1.PrincipalID, folder1Name);
356 Assert.That(folder1Candidates.Count, Is.EqualTo(1));
357
358 InventoryFolderBase folder1 = folder1Candidates[0];
359 List<InventoryFolderBase> folder2aCandidates
360 = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1, folder2aName);
361 Assert.That(folder2aCandidates.Count, Is.EqualTo(1));
362 }
363
364 {
365 // Test replication of path2
366 new InventoryArchiveReadRequest(scene, ua1, null, (Stream)null, false)
367 .ReplicateArchivePathToUserInventory(
368 iarPath2, scene.InventoryService.GetRootFolder(ua1.PrincipalID),
369 foldersCreated, nodesLoaded);
370
371 List<InventoryFolderBase> folder1Candidates
372 = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, ua1.PrincipalID, folder1Name);
373 Assert.That(folder1Candidates.Count, Is.EqualTo(1));
374
375 InventoryFolderBase folder1 = folder1Candidates[0];
376
377 List<InventoryFolderBase> folder2aCandidates
378 = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1, folder2aName);
379 Assert.That(folder2aCandidates.Count, Is.EqualTo(1));
380
381 List<InventoryFolderBase> folder2bCandidates
382 = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1, folder2bName);
383 Assert.That(folder2bCandidates.Count, Is.EqualTo(1));
384 }
385 }
386
387 /// <summary>
388 /// Test replication of a partly existing archive path to the user's inventory. This should create
389 /// a duplicate path without the merge option.
390 /// </summary>
391 [Test]
392 public void TestPartExistingIarPath()
393 {
394 TestHelper.InMethod();
395 //log4net.Config.XmlConfigurator.Configure();
396
397 Scene scene = SceneSetupHelpers.SetupScene("inventory");
398 UserAccount ua1 = UserProfileTestUtils.CreateUserWithInventory(scene);
399
400 string folder1ExistingName = "a";
401 string folder2Name = "b";
402
403 InventoryFolderBase folder1
404 = UserInventoryTestUtils.CreateInventoryFolder(
405 scene.InventoryService, ua1.PrincipalID, folder1ExistingName);
406
407 string folder1ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder1ExistingName, UUID.Random());
408 string folder2ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder2Name, UUID.Random());
409
410 string itemArchivePath = string.Join("", new string[] { folder1ArchiveName, folder2ArchiveName });
411
412 new InventoryArchiveReadRequest(scene, ua1, null, (Stream)null, false)
413 .ReplicateArchivePathToUserInventory(
414 itemArchivePath, scene.InventoryService.GetRootFolder(ua1.PrincipalID),
415 new Dictionary<string, InventoryFolderBase>(), new HashSet<InventoryNodeBase>());
416
417 List<InventoryFolderBase> folder1PostCandidates
418 = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, ua1.PrincipalID, folder1ExistingName);
419 Assert.That(folder1PostCandidates.Count, Is.EqualTo(2));
420
421 // FIXME: Temporarily, we're going to do something messy to make sure we pick up the created folder.
422 InventoryFolderBase folder1Post = null;
423 foreach (InventoryFolderBase folder in folder1PostCandidates)
424 {
425 if (folder.ID != folder1.ID)
426 {
427 folder1Post = folder;
428 break;
429 }
430 }
431// Assert.That(folder1Post.ID, Is.EqualTo(folder1.ID));
432
433 List<InventoryFolderBase> folder2PostCandidates
434 = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1Post, "b");
435 Assert.That(folder2PostCandidates.Count, Is.EqualTo(1));
436 }
437
438 /// <summary>
439 /// Test replication of a partly existing archive path to the user's inventory. This should create
440 /// a merged path.
441 /// </summary>
442 [Test]
443 public void TestMergeIarPath()
444 {
445 TestHelper.InMethod();
446// log4net.Config.XmlConfigurator.Configure();
447
448 Scene scene = SceneSetupHelpers.SetupScene("inventory");
449 UserAccount ua1 = UserProfileTestUtils.CreateUserWithInventory(scene);
450
451 string folder1ExistingName = "a";
452 string folder2Name = "b";
453
454 InventoryFolderBase folder1
455 = UserInventoryTestUtils.CreateInventoryFolder(
456 scene.InventoryService, ua1.PrincipalID, folder1ExistingName);
457
458 string folder1ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder1ExistingName, UUID.Random());
459 string folder2ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder2Name, UUID.Random());
460
461 string itemArchivePath = string.Join("", new string[] { folder1ArchiveName, folder2ArchiveName });
462
463 new InventoryArchiveReadRequest(scene, ua1, folder1ExistingName, (Stream)null, true)
464 .ReplicateArchivePathToUserInventory(
465 itemArchivePath, scene.InventoryService.GetRootFolder(ua1.PrincipalID),
466 new Dictionary<string, InventoryFolderBase>(), new HashSet<InventoryNodeBase>());
467
468 List<InventoryFolderBase> folder1PostCandidates
469 = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, ua1.PrincipalID, folder1ExistingName);
470 Assert.That(folder1PostCandidates.Count, Is.EqualTo(1));
471 Assert.That(folder1PostCandidates[0].ID, Is.EqualTo(folder1.ID));
472
473 List<InventoryFolderBase> folder2PostCandidates
474 = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1PostCandidates[0], "b");
475 Assert.That(folder2PostCandidates.Count, Is.EqualTo(1));
476 }
477 }
478} \ 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 1337143..c88be7d 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
@@ -284,9 +284,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
284 return; 284 return;
285 } 285 }
286 286
287 if (!m_aScene.SimulationService.QueryAccess(finalDestination, sp.ControllingClient.AgentId, Vector3.Zero)) 287 string reason;
288 if (!m_aScene.SimulationService.QueryAccess(finalDestination, sp.ControllingClient.AgentId, Vector3.Zero, out reason))
288 { 289 {
289 sp.ControllingClient.SendTeleportFailed("The destination region has refused access"); 290 sp.ControllingClient.SendTeleportFailed("Teleport failed: " + reason);
290 return; 291 return;
291 } 292 }
292 293
@@ -317,14 +318,12 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
317 agentCircuit.Id0 = currentAgentCircuit.Id0; 318 agentCircuit.Id0 = currentAgentCircuit.Id0;
318 } 319 }
319 320
320 if (NeedsNewAgent(oldRegionX, newRegionX, oldRegionY, newRegionY)) 321 if (NeedsNewAgent(sp.DrawDistance, oldRegionX, newRegionX, oldRegionY, newRegionY))
321 { 322 {
322 // brand new agent, let's create a new caps seed 323 // brand new agent, let's create a new caps seed
323 agentCircuit.CapsPath = CapsUtil.GetRandomCapsObjectPath(); 324 agentCircuit.CapsPath = CapsUtil.GetRandomCapsObjectPath();
324 } 325 }
325 326
326 string reason = String.Empty;
327
328 // Let's create an agent there if one doesn't exist yet. 327 // Let's create an agent there if one doesn't exist yet.
329 bool logout = false; 328 bool logout = false;
330 if (!CreateAgent(sp, reg, finalDestination, agentCircuit, teleportFlags, out reason, out logout)) 329 if (!CreateAgent(sp, reg, finalDestination, agentCircuit, teleportFlags, out reason, out logout))
@@ -337,7 +336,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
337 // OK, it got this agent. Let's close some child agents 336 // OK, it got this agent. Let's close some child agents
338 sp.CloseChildAgents(newRegionX, newRegionY); 337 sp.CloseChildAgents(newRegionX, newRegionY);
339 IClientIPEndpoint ipepClient; 338 IClientIPEndpoint ipepClient;
340 if (NeedsNewAgent(oldRegionX, newRegionX, oldRegionY, newRegionY)) 339 if (NeedsNewAgent(sp.DrawDistance, oldRegionX, newRegionX, oldRegionY, newRegionY))
341 { 340 {
342 //sp.ControllingClient.SendTeleportProgress(teleportFlags, "Creating agent..."); 341 //sp.ControllingClient.SendTeleportProgress(teleportFlags, "Creating agent...");
343 #region IP Translation for NAT 342 #region IP Translation for NAT
@@ -400,6 +399,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
400 if (!UpdateAgent(reg, finalDestination, agent)) 399 if (!UpdateAgent(reg, finalDestination, agent))
401 { 400 {
402 // Region doesn't take it 401 // Region doesn't take it
402 m_log.WarnFormat(
403 "[ENTITY TRANSFER MODULE]: UpdateAgent failed on teleport of {0} to {1}. Returning avatar to source region.",
404 sp.Name, finalDestination.RegionName);
405
403 Fail(sp, finalDestination); 406 Fail(sp, finalDestination);
404 return; 407 return;
405 } 408 }
@@ -426,16 +429,18 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
426 // that the client contacted the destination before we send the attachments and close things here. 429 // that the client contacted the destination before we send the attachments and close things here.
427 if (!WaitForCallback(sp.UUID)) 430 if (!WaitForCallback(sp.UUID))
428 { 431 {
429 Fail(sp, finalDestination); 432 m_log.WarnFormat(
433 "[ENTITY TRANSFER MODULE]: Teleport of {0} to {1} failed due to no callback from destination region. Returning avatar to source region.",
434 sp.Name, finalDestination.RegionName);
435
436 Fail(sp, finalDestination);
430 return; 437 return;
431 } 438 }
432 439
433
434 // CrossAttachmentsIntoNewRegion is a synchronous call. We shouldn't need to wait after it 440 // CrossAttachmentsIntoNewRegion is a synchronous call. We shouldn't need to wait after it
435 CrossAttachmentsIntoNewRegion(finalDestination, sp, true); 441 CrossAttachmentsIntoNewRegion(finalDestination, sp, true);
436 442
437 // Well, this is it. The agent is over there. 443 // Well, this is it. The agent is over there.
438
439 KillEntity(sp.Scene, sp.LocalId); 444 KillEntity(sp.Scene, sp.LocalId);
440 445
441 // May need to logout or other cleanup 446 // May need to logout or other cleanup
@@ -448,7 +453,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
448 453
449 // Finally, let's close this previously-known-as-root agent, when the jump is outside the view zone 454 // Finally, let's close this previously-known-as-root agent, when the jump is outside the view zone
450 455
451 if (NeedsClosing(oldRegionX, newRegionX, oldRegionY, newRegionY, reg)) 456 if (NeedsClosing(sp.DrawDistance, oldRegionX, newRegionX, oldRegionY, newRegionY, reg))
452 { 457 {
453 Thread.Sleep(5000); 458 Thread.Sleep(5000);
454 sp.Close(); 459 sp.Close();
@@ -522,14 +527,14 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
522 return region; 527 return region;
523 } 528 }
524 529
525 protected virtual bool NeedsNewAgent(uint oldRegionX, uint newRegionX, uint oldRegionY, uint newRegionY) 530 protected virtual bool NeedsNewAgent(float drawdist, uint oldRegionX, uint newRegionX, uint oldRegionY, uint newRegionY)
526 { 531 {
527 return Util.IsOutsideView(oldRegionX, newRegionX, oldRegionY, newRegionY); 532 return Util.IsOutsideView(drawdist, oldRegionX, newRegionX, oldRegionY, newRegionY);
528 } 533 }
529 534
530 protected virtual bool NeedsClosing(uint oldRegionX, uint newRegionX, uint oldRegionY, uint newRegionY, GridRegion reg) 535 protected virtual bool NeedsClosing(float drawdist, uint oldRegionX, uint newRegionX, uint oldRegionY, uint newRegionY, GridRegion reg)
531 { 536 {
532 return Util.IsOutsideView(oldRegionX, newRegionX, oldRegionY, newRegionY); 537 return Util.IsOutsideView(drawdist, oldRegionX, newRegionX, oldRegionY, newRegionY);
533 } 538 }
534 539
535 protected virtual bool IsOutsideRegion(Scene s, Vector3 pos) 540 protected virtual bool IsOutsideRegion(Scene s, Vector3 pos)
@@ -778,7 +783,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
778 783
779 GridRegion neighbourRegion = scene.GridService.GetRegionByPosition(scene.RegionInfo.ScopeID, (int)x, (int)y); 784 GridRegion neighbourRegion = scene.GridService.GetRegionByPosition(scene.RegionInfo.ScopeID, (int)x, (int)y);
780 785
781 if (!scene.SimulationService.QueryAccess(neighbourRegion, agent.ControllingClient.AgentId, newpos)) 786 string reason;
787 if (!scene.SimulationService.QueryAccess(neighbourRegion, agent.ControllingClient.AgentId, newpos, out reason))
782 { 788 {
783 agent.ControllingClient.SendAlertMessage("Cannot region cross into banned parcel"); 789 agent.ControllingClient.SendAlertMessage("Cannot region cross into banned parcel");
784 if (r == null) 790 if (r == null)
@@ -1045,7 +1051,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1045 1051
1046 if (m_regionInfo != null) 1052 if (m_regionInfo != null)
1047 { 1053 {
1048 neighbours = RequestNeighbours(sp.Scene, m_regionInfo.RegionLocX, m_regionInfo.RegionLocY); 1054 neighbours = RequestNeighbours(sp, m_regionInfo.RegionLocX, m_regionInfo.RegionLocY);
1049 } 1055 }
1050 else 1056 else
1051 { 1057 {
@@ -1272,8 +1278,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1272 /// <param name="pRegionLocX"></param> 1278 /// <param name="pRegionLocX"></param>
1273 /// <param name="pRegionLocY"></param> 1279 /// <param name="pRegionLocY"></param>
1274 /// <returns></returns> 1280 /// <returns></returns>
1275 protected List<GridRegion> RequestNeighbours(Scene pScene, uint pRegionLocX, uint pRegionLocY) 1281 protected List<GridRegion> RequestNeighbours(ScenePresence avatar, uint pRegionLocX, uint pRegionLocY)
1276 { 1282 {
1283 Scene pScene = avatar.Scene;
1277 RegionInfo m_regionInfo = pScene.RegionInfo; 1284 RegionInfo m_regionInfo = pScene.RegionInfo;
1278 1285
1279 Border[] northBorders = pScene.NorthBorders.ToArray(); 1286 Border[] northBorders = pScene.NorthBorders.ToArray();
@@ -1281,10 +1288,24 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1281 Border[] eastBorders = pScene.EastBorders.ToArray(); 1288 Border[] eastBorders = pScene.EastBorders.ToArray();
1282 Border[] westBorders = pScene.WestBorders.ToArray(); 1289 Border[] westBorders = pScene.WestBorders.ToArray();
1283 1290
1284 // Legacy one region. Provided for simplicity while testing the all inclusive method in the else statement. 1291 // Leaving this as a "megaregions" computation vs "non-megaregions" computation; it isn't
1292 // clear what should be done with a "far view" given that megaregions already extended the
1293 // view to include everything in the megaregion
1285 if (northBorders.Length <= 1 && southBorders.Length <= 1 && eastBorders.Length <= 1 && westBorders.Length <= 1) 1294 if (northBorders.Length <= 1 && southBorders.Length <= 1 && eastBorders.Length <= 1 && westBorders.Length <= 1)
1286 { 1295 {
1287 return pScene.GridService.GetNeighbours(m_regionInfo.ScopeID, m_regionInfo.RegionID); 1296 int dd = avatar.DrawDistance < Constants.RegionSize ? (int)Constants.RegionSize : (int)avatar.DrawDistance;
1297
1298 int startX = (int)pRegionLocX * (int)Constants.RegionSize - dd + (int)(Constants.RegionSize/2);
1299 int startY = (int)pRegionLocY * (int)Constants.RegionSize - dd + (int)(Constants.RegionSize/2);
1300
1301 int endX = (int)pRegionLocX * (int)Constants.RegionSize + dd + (int)(Constants.RegionSize/2);
1302 int endY = (int)pRegionLocY * (int)Constants.RegionSize + dd + (int)(Constants.RegionSize/2);
1303
1304 List<GridRegion> neighbours =
1305 avatar.Scene.GridService.GetRegionRange(m_regionInfo.ScopeID, startX, endX, startY, endY);
1306
1307 neighbours.RemoveAll(delegate(GridRegion r) { return r.RegionID == m_regionInfo.RegionID; });
1308 return neighbours;
1288 } 1309 }
1289 else 1310 else
1290 { 1311 {
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
index 35dcd95..79e76b4 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
@@ -130,9 +130,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
130 return region; 130 return region;
131 } 131 }
132 132
133 protected override bool NeedsClosing(uint oldRegionX, uint newRegionX, uint oldRegionY, uint newRegionY, GridRegion reg) 133 protected override bool NeedsClosing(float drawdist, uint oldRegionX, uint newRegionX, uint oldRegionY, uint newRegionY, GridRegion reg)
134 { 134 {
135 if (base.NeedsClosing(oldRegionX, newRegionX, oldRegionY, newRegionY, reg)) 135 if (base.NeedsClosing(drawdist, oldRegionX, newRegionX, oldRegionY, newRegionY, reg))
136 return true; 136 return true;
137 137
138 int flags = m_aScene.GridService.GetRegionFlags(m_aScene.RegionInfo.ScopeID, reg.RegionID); 138 int flags = m_aScene.GridService.GetRegionFlags(m_aScene.RegionInfo.ScopeID, reg.RegionID);
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
index 7bb8789..798547a 100644
--- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
@@ -148,6 +148,9 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
148 InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); 148 InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId);
149 item = m_Scene.InventoryService.GetItem(item); 149 item = m_Scene.InventoryService.GetItem(item);
150 150
151 if (item.Owner != remoteClient.AgentId)
152 return UUID.Zero;
153
151 if (item != null) 154 if (item != null)
152 { 155 {
153 if ((InventoryType)item.InvType == InventoryType.Notecard) 156 if ((InventoryType)item.InvType == InventoryType.Notecard)
@@ -524,6 +527,8 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
524 527
525 if (item != null) 528 if (item != null)
526 { 529 {
530 item.Owner = remoteClient.AgentId;
531
527 AssetBase rezAsset = m_Scene.AssetService.Get(item.AssetID.ToString()); 532 AssetBase rezAsset = m_Scene.AssetService.Get(item.AssetID.ToString());
528 533
529 if (rezAsset != null) 534 if (rezAsset != null)
diff --git a/OpenSim/Region/CoreModules/LightShare/LightShareModule.cs b/OpenSim/Region/CoreModules/LightShare/LightShareModule.cs
index 88f392d..00b0aa9 100644
--- a/OpenSim/Region/CoreModules/LightShare/LightShareModule.cs
+++ b/OpenSim/Region/CoreModules/LightShare/LightShareModule.cs
@@ -75,7 +75,7 @@ namespace OpenSim.Region.CoreModules.World.LightShare
75 m_scene = scene; 75 m_scene = scene;
76 m_scene.RegisterModuleInterface<IRegionModule>(this); 76 m_scene.RegisterModuleInterface<IRegionModule>(this);
77 m_scene.EventManager.OnPluginConsole += EventManager_OnPluginConsole; 77 m_scene.EventManager.OnPluginConsole += EventManager_OnPluginConsole;
78 78
79 // ini file settings 79 // ini file settings
80 try 80 try
81 { 81 {
@@ -229,7 +229,7 @@ namespace OpenSim.Region.CoreModules.World.LightShare
229 { 229 {
230 Command wlload = new Command("load", CommandIntentions.COMMAND_NON_HAZARDOUS, HandleLoad, "Load windlight profile from the database and broadcast"); 230 Command wlload = new Command("load", CommandIntentions.COMMAND_NON_HAZARDOUS, HandleLoad, "Load windlight profile from the database and broadcast");
231 Command wlenable = new Command("enable", CommandIntentions.COMMAND_NON_HAZARDOUS, HandleEnable, "Enable the windlight plugin"); 231 Command wlenable = new Command("enable", CommandIntentions.COMMAND_NON_HAZARDOUS, HandleEnable, "Enable the windlight plugin");
232 Command wldisable = new Command("disable", CommandIntentions.COMMAND_NON_HAZARDOUS, HandleDisable, "Enable the windlight plugin"); 232 Command wldisable = new Command("disable", CommandIntentions.COMMAND_NON_HAZARDOUS, HandleDisable, "Disable the windlight plugin");
233 233
234 m_commander.RegisterCommand("load", wlload); 234 m_commander.RegisterCommand("load", wlload);
235 m_commander.RegisterCommand("enable", wlenable); 235 m_commander.RegisterCommand("enable", wlenable);
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/Tests/GridConnectorsTests.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/Tests/GridConnectorsTests.cs
index e54ee02..18db9fa 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/LocalSimulationConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs
index 56720b7..a298b65 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs
@@ -257,15 +257,16 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
257 return false; 257 return false;
258 } 258 }
259 259
260 public bool QueryAccess(GridRegion destination, UUID id, Vector3 position) 260 public bool QueryAccess(GridRegion destination, UUID id, Vector3 position, out string reason)
261 { 261 {
262 reason = "Communications failure";
262 if (destination == null) 263 if (destination == null)
263 return false; 264 return false;
264 265
265 foreach (Scene s in m_sceneList) 266 foreach (Scene s in m_sceneList)
266 { 267 {
267 if (s.RegionInfo.RegionID == destination.RegionID) 268 if (s.RegionInfo.RegionID == destination.RegionID)
268 return s.QueryAccess(id, position); 269 return s.QueryAccess(id, position, out reason);
269 } 270 }
270 //m_log.Debug("[LOCAL COMMS]: region not found for QueryAccess"); 271 //m_log.Debug("[LOCAL COMMS]: region not found for QueryAccess");
271 return false; 272 return false;
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs
index c4919b3..67f4d60 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)
@@ -239,18 +229,19 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
239 229
240 } 230 }
241 231
242 public bool QueryAccess(GridRegion destination, UUID id, Vector3 position) 232 public bool QueryAccess(GridRegion destination, UUID id, Vector3 position, out string reason)
243 { 233 {
234 reason = "Communications failure";
244 if (destination == null) 235 if (destination == null)
245 return false; 236 return false;
246 237
247 // Try local first 238 // Try local first
248 if (m_localBackend.QueryAccess(destination, id, position)) 239 if (m_localBackend.QueryAccess(destination, id, position, out reason))
249 return true; 240 return true;
250 241
251 // else do the remote thing 242 // else do the remote thing
252 if (!m_localBackend.IsLocalRegion(destination.RegionHandle)) 243 if (!m_localBackend.IsLocalRegion(destination.RegionHandle))
253 return m_remoteConnector.QueryAccess(destination, id, position); 244 return m_remoteConnector.QueryAccess(destination, id, position, out reason);
254 245
255 return false; 246 return false;
256 247
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/LegacyMap/TexturedMapTileRenderer.cs b/OpenSim/Region/CoreModules/World/LegacyMap/TexturedMapTileRenderer.cs
index 071314a..aa14054 100644
--- a/OpenSim/Region/CoreModules/World/LegacyMap/TexturedMapTileRenderer.cs
+++ b/OpenSim/Region/CoreModules/World/LegacyMap/TexturedMapTileRenderer.cs
@@ -188,17 +188,17 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
188 } 188 }
189 catch (DllNotFoundException) 189 catch (DllNotFoundException)
190 { 190 {
191 m_log.ErrorFormat("[TexturedMapTileRenderer]: OpenJpeg is not installed correctly on this system. Asset Data is emtpy for {0}", id); 191 m_log.ErrorFormat("[TexturedMapTileRenderer]: OpenJpeg is not installed correctly on this system. Asset Data is empty for {0}", id);
192 192
193 } 193 }
194 catch (IndexOutOfRangeException) 194 catch (IndexOutOfRangeException)
195 { 195 {
196 m_log.ErrorFormat("[TexturedMapTileRenderer]: OpenJpeg was unable to encode this. Asset Data is emtpy for {0}", id); 196 m_log.ErrorFormat("[TexturedMapTileRenderer]: OpenJpeg was unable to encode this. Asset Data is empty for {0}", id);
197 197
198 } 198 }
199 catch (Exception) 199 catch (Exception)
200 { 200 {
201 m_log.ErrorFormat("[TexturedMapTileRenderer]: OpenJpeg was unable to encode this. Asset Data is emtpy for {0}", id); 201 m_log.ErrorFormat("[TexturedMapTileRenderer]: OpenJpeg was unable to encode this. Asset Data is empty for {0}", id);
202 202
203 } 203 }
204 return null; 204 return null;
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/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
index 364dd6c..170c35f 100644
--- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
+++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
@@ -642,7 +642,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
642 /// implemented by callers. 642 /// implemented by callers.
643 /// </summary> 643 /// </summary>
644 /// <param name="currentUser"></param> 644 /// <param name="currentUser"></param>
645 /// <param name="objId"></param> 645 /// <param name="objId">This is a scene object group UUID</param>
646 /// <param name="denyOnLocked"></param> 646 /// <param name="denyOnLocked"></param>
647 /// <returns></returns> 647 /// <returns></returns>
648 protected bool GenericObjectPermission(UUID currentUser, UUID objId, bool denyOnLocked) 648 protected bool GenericObjectPermission(UUID currentUser, UUID objId, bool denyOnLocked)
@@ -1896,7 +1896,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
1896// "[PERMISSIONS]: Checking CanControlPrimMedia for {0} on {1} face {2} with control permissions {3}", 1896// "[PERMISSIONS]: Checking CanControlPrimMedia for {0} on {1} face {2} with control permissions {3}",
1897// agentID, primID, face, me.ControlPermissions); 1897// agentID, primID, face, me.ControlPermissions);
1898 1898
1899 return GenericPrimMediaPermission(part, agentID, me.ControlPermissions); 1899 return GenericObjectPermission(agentID, part.ParentGroup.UUID, true);
1900 } 1900 }
1901 1901
1902 private bool CanInteractWithPrimMedia(UUID agentID, UUID primID, int face) 1902 private bool CanInteractWithPrimMedia(UUID agentID, UUID primID, int face)
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/CoreModules/World/WorldMap/MapSearchModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs
index a9e46d0..7bb7544 100644
--- a/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs
+++ b/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs
@@ -113,7 +113,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
113 data = new MapBlockData(); 113 data = new MapBlockData();
114 data.Agents = 0; 114 data.Agents = 0;
115 data.Access = info.Access; 115 data.Access = info.Access;
116 data.MapImageId = info.TerrainImage; 116 data.MapImageId = UUID.Zero; // could use info.TerrainImage but it seems to break viewer2
117 data.Name = info.RegionName; 117 data.Name = info.RegionName;
118 data.RegionFlags = 0; // TODO not used? 118 data.RegionFlags = 0; // TODO not used?
119 data.WaterHeight = 0; // not used 119 data.WaterHeight = 0; // not used
@@ -135,7 +135,9 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
135 data.Y = 0; 135 data.Y = 0;
136 blocks.Add(data); 136 blocks.Add(data);
137 137
138 remoteClient.SendMapBlock(blocks, 0); 138 // not sure what the flags do here, but seems to be necessary
139 // to set to "2" for viewer 2
140 remoteClient.SendMapBlock(blocks, 2);
139 } 141 }
140 142
141// private Scene GetClientScene(IClientAPI client) 143// private Scene GetClientScene(IClientAPI client)
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index e2d96d9..fcbcf59 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -321,6 +321,8 @@ namespace OpenSim.Region.Framework.Scenes
321 // Passing something to another avatar or a an object will already 321 // Passing something to another avatar or a an object will already
322 InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); 322 InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId);
323 item = InventoryService.GetItem(item); 323 item = InventoryService.GetItem(item);
324 if (item.Owner != remoteClient.AgentId)
325 return;
324 326
325 if (item != null) 327 if (item != null)
326 { 328 {
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 355671c..1a6a70b 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -83,6 +83,13 @@ namespace OpenSim.Region.Framework.Scenes
83 public bool m_useFlySlow; 83 public bool m_useFlySlow;
84 public bool m_usePreJump; 84 public bool m_usePreJump;
85 public bool m_seeIntoRegionFromNeighbor; 85 public bool m_seeIntoRegionFromNeighbor;
86
87 protected float m_defaultDrawDistance = 255.0f;
88 public float DefaultDrawDistance
89 {
90 get { return m_defaultDrawDistance; }
91 }
92
86 // TODO: need to figure out how allow client agents but deny 93 // TODO: need to figure out how allow client agents but deny
87 // root agents when ACL denies access to root agent 94 // root agents when ACL denies access to root agent
88 public bool m_strictAccessControl = true; 95 public bool m_strictAccessControl = true;
@@ -129,7 +136,16 @@ namespace OpenSim.Region.Framework.Scenes
129 protected ICapabilitiesModule m_capsModule; 136 protected ICapabilitiesModule m_capsModule;
130 // Central Update Loop 137 // Central Update Loop
131 protected int m_fps = 10; 138 protected int m_fps = 10;
132 protected uint m_frame; 139
140 /// <summary>
141 /// Current scene frame number
142 /// </summary>
143 public uint Frame
144 {
145 get;
146 protected set;
147 }
148
133 protected float m_timespan = 0.089f; 149 protected float m_timespan = 0.089f;
134 protected DateTime m_lastupdate = DateTime.UtcNow; 150 protected DateTime m_lastupdate = DateTime.UtcNow;
135 151
@@ -618,6 +634,8 @@ namespace OpenSim.Region.Framework.Scenes
618 // 634 //
619 IConfig startupConfig = m_config.Configs["Startup"]; 635 IConfig startupConfig = m_config.Configs["Startup"];
620 636
637 m_defaultDrawDistance = startupConfig.GetFloat("DefaultDrawDistance",m_defaultDrawDistance);
638
621 //Animation states 639 //Animation states
622 m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false); 640 m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false);
623 // TODO: Change default to true once the feature is supported 641 // TODO: Change default to true once the feature is supported
@@ -1183,7 +1201,8 @@ namespace OpenSim.Region.Framework.Scenes
1183 1201
1184 try 1202 try
1185 { 1203 {
1186 Update(); 1204 while (!shuttingdown)
1205 Update();
1187 1206
1188 m_lastUpdate = Util.EnvironmentTickCount(); 1207 m_lastUpdate = Util.EnvironmentTickCount();
1189 m_firstHeartbeat = false; 1208 m_firstHeartbeat = false;
@@ -1200,187 +1219,176 @@ namespace OpenSim.Region.Framework.Scenes
1200 Watchdog.RemoveThread(); 1219 Watchdog.RemoveThread();
1201 } 1220 }
1202 1221
1203 /// <summary>
1204 /// Performs per-frame updates on the scene, this should be the central scene loop
1205 /// </summary>
1206 public override void Update() 1222 public override void Update()
1207 { 1223 {
1208 float physicsFPS; 1224 TimeSpan SinceLastFrame = DateTime.UtcNow - m_lastupdate;
1209 int maintc; 1225 float physicsFPS = 0f;
1210 1226
1211 while (!shuttingdown) 1227 int maintc = Util.EnvironmentTickCount();
1228 int tmpFrameMS = maintc;
1229 tempOnRezMS = eventMS = backupMS = terrainMS = landMS = 0;
1230
1231 // Increment the frame counter
1232 ++Frame;
1233
1234 try
1212 { 1235 {
1213 TimeSpan SinceLastFrame = DateTime.UtcNow - m_lastupdate; 1236 // Check if any objects have reached their targets
1214 physicsFPS = 0f; 1237 CheckAtTargets();
1215 1238
1216 maintc = Util.EnvironmentTickCount(); 1239 // Update SceneObjectGroups that have scheduled themselves for updates
1217 int tmpFrameMS = maintc; 1240 // Objects queue their updates onto all scene presences
1218 tempOnRezMS = eventMS = backupMS = terrainMS = landMS = 0; 1241 if (Frame % m_update_objects == 0)
1242 m_sceneGraph.UpdateObjectGroups();
1219 1243
1220 // Increment the frame counter 1244 // Run through all ScenePresences looking for updates
1221 ++m_frame; 1245 // Presence updates and queued object updates for each presence are sent to clients
1246 if (Frame % m_update_presences == 0)
1247 m_sceneGraph.UpdatePresences();
1222 1248
1223 try 1249 // Coarse locations relate to positions of green dots on the mini-map (on a SecondLife client)
1250 if (Frame % m_update_coarse_locations == 0)
1224 { 1251 {
1225 // Check if any objects have reached their targets 1252 List<Vector3> coarseLocations;
1226 CheckAtTargets(); 1253 List<UUID> avatarUUIDs;
1254 SceneGraph.GetCoarseLocations(out coarseLocations, out avatarUUIDs, 60);
1255 // Send coarse locations to clients
1256 ForEachScenePresence(delegate(ScenePresence presence)
1257 {
1258 presence.SendCoarseLocations(coarseLocations, avatarUUIDs);
1259 });
1260 }
1227 1261
1228 // Update SceneObjectGroups that have scheduled themselves for updates 1262 int tmpPhysicsMS2 = Util.EnvironmentTickCount();
1229 // Objects queue their updates onto all scene presences 1263 if ((Frame % m_update_physics == 0) && m_physics_enabled)
1230 if (m_frame % m_update_objects == 0) 1264 m_sceneGraph.UpdatePreparePhysics();
1231 m_sceneGraph.UpdateObjectGroups(); 1265 physicsMS2 = Util.EnvironmentTickCountSubtract(tmpPhysicsMS2);
1232 1266
1233 // Run through all ScenePresences looking for updates 1267 // Apply any pending avatar force input to the avatar's velocity
1234 // Presence updates and queued object updates for each presence are sent to clients 1268 if (Frame % m_update_entitymovement == 0)
1235 if (m_frame % m_update_presences == 0) 1269 m_sceneGraph.UpdateScenePresenceMovement();
1236 m_sceneGraph.UpdatePresences();
1237 1270
1238 // Coarse locations relate to positions of green dots on the mini-map (on a SecondLife client) 1271 // Perform the main physics update. This will do the actual work of moving objects and avatars according to their
1239 if (m_frame % m_update_coarse_locations == 0) 1272 // velocity
1240 { 1273 int tmpPhysicsMS = Util.EnvironmentTickCount();
1241 List<Vector3> coarseLocations; 1274 if (Frame % m_update_physics == 0)
1242 List<UUID> avatarUUIDs; 1275 {
1243 SceneGraph.GetCoarseLocations(out coarseLocations, out avatarUUIDs, 60); 1276 if (m_physics_enabled)
1244 // Send coarse locations to clients 1277 physicsFPS = m_sceneGraph.UpdatePhysics(Math.Max(SinceLastFrame.TotalSeconds, m_timespan));
1245 ForEachScenePresence(delegate(ScenePresence presence) 1278 if (SynchronizeScene != null)
1246 { 1279 SynchronizeScene(this);
1247 presence.SendCoarseLocations(coarseLocations, avatarUUIDs); 1280 }
1248 }); 1281 physicsMS = Util.EnvironmentTickCountSubtract(tmpPhysicsMS);
1249 }
1250
1251 int tmpPhysicsMS2 = Util.EnvironmentTickCount();
1252 if ((m_frame % m_update_physics == 0) && m_physics_enabled)
1253 m_sceneGraph.UpdatePreparePhysics();
1254 physicsMS2 = Util.EnvironmentTickCountSubtract(tmpPhysicsMS2);
1255 1282
1256 // Apply any pending avatar force input to the avatar's velocity 1283 // Delete temp-on-rez stuff
1257 if (m_frame % m_update_entitymovement == 0) 1284 if (Frame % 1000 == 0 && !m_cleaningTemps)
1258 m_sceneGraph.UpdateScenePresenceMovement(); 1285 {
1286 int tmpTempOnRezMS = Util.EnvironmentTickCount();
1287 m_cleaningTemps = true;
1288 Util.FireAndForget(delegate { CleanTempObjects(); m_cleaningTemps = false; });
1289 tempOnRezMS = Util.EnvironmentTickCountSubtract(tmpTempOnRezMS);
1290 }
1259 1291
1260 // Perform the main physics update. This will do the actual work of moving objects and avatars according to their 1292 if (RegionStatus != RegionStatus.SlaveScene)
1261 // velocity 1293 {
1262 int tmpPhysicsMS = Util.EnvironmentTickCount(); 1294 if (Frame % m_update_events == 0)
1263 if (m_frame % m_update_physics == 0)
1264 { 1295 {
1265 if (m_physics_enabled) 1296 int evMS = Util.EnvironmentTickCount();
1266 physicsFPS = m_sceneGraph.UpdatePhysics(Math.Max(SinceLastFrame.TotalSeconds, m_timespan)); 1297 UpdateEvents();
1267 if (SynchronizeScene != null) 1298 eventMS = Util.EnvironmentTickCountSubtract(evMS); ;
1268 SynchronizeScene(this);
1269 } 1299 }
1270 physicsMS = Util.EnvironmentTickCountSubtract(tmpPhysicsMS);
1271 1300
1272 // Delete temp-on-rez stuff 1301 if (Frame % m_update_backup == 0)
1273 if (m_frame % 1000 == 0 && !m_cleaningTemps)
1274 { 1302 {
1275 int tmpTempOnRezMS = Util.EnvironmentTickCount(); 1303 int backMS = Util.EnvironmentTickCount();
1276 m_cleaningTemps = true; 1304 UpdateStorageBackup();
1277 Util.FireAndForget(delegate { CleanTempObjects(); m_cleaningTemps = false; }); 1305 backupMS = Util.EnvironmentTickCountSubtract(backMS);
1278 tempOnRezMS = Util.EnvironmentTickCountSubtract(tmpTempOnRezMS);
1279 } 1306 }
1280 1307
1281 if (RegionStatus != RegionStatus.SlaveScene) 1308 if (Frame % m_update_terrain == 0)
1282 { 1309 {
1283 if (m_frame % m_update_events == 0) 1310 int terMS = Util.EnvironmentTickCount();
1284 { 1311 UpdateTerrain();
1285 int evMS = Util.EnvironmentTickCount(); 1312 terrainMS = Util.EnvironmentTickCountSubtract(terMS);
1286 UpdateEvents(); 1313 }
1287 eventMS = Util.EnvironmentTickCountSubtract(evMS); ;
1288 }
1289
1290 if (m_frame % m_update_backup == 0)
1291 {
1292 int backMS = Util.EnvironmentTickCount();
1293 UpdateStorageBackup();
1294 backupMS = Util.EnvironmentTickCountSubtract(backMS);
1295 }
1296 1314
1297 if (m_frame % m_update_terrain == 0) 1315 //if (Frame % m_update_land == 0)
1298 { 1316 //{
1299 int terMS = Util.EnvironmentTickCount(); 1317 // int ldMS = Util.EnvironmentTickCount();
1300 UpdateTerrain(); 1318 // UpdateLand();
1301 terrainMS = Util.EnvironmentTickCountSubtract(terMS); 1319 // landMS = Util.EnvironmentTickCountSubtract(ldMS);
1302 } 1320 //}
1303 1321
1304 //if (m_frame % m_update_land == 0) 1322 frameMS = Util.EnvironmentTickCountSubtract(tmpFrameMS);
1305 //{ 1323 otherMS = tempOnRezMS + eventMS + backupMS + terrainMS + landMS;
1306 // int ldMS = Util.EnvironmentTickCount(); 1324 lastCompletedFrame = Util.EnvironmentTickCount();
1307 // UpdateLand(); 1325
1308 // landMS = Util.EnvironmentTickCountSubtract(ldMS); 1326 // if (Frame%m_update_avatars == 0)
1309 //} 1327 // UpdateInWorldTime();
1328 StatsReporter.AddPhysicsFPS(physicsFPS);
1329 StatsReporter.AddTimeDilation(TimeDilation);
1330 StatsReporter.AddFPS(1);
1331 StatsReporter.SetRootAgents(m_sceneGraph.GetRootAgentCount());
1332 StatsReporter.SetChildAgents(m_sceneGraph.GetChildAgentCount());
1333 StatsReporter.SetObjects(m_sceneGraph.GetTotalObjectsCount());
1334 StatsReporter.SetActiveObjects(m_sceneGraph.GetActiveObjectsCount());
1335 StatsReporter.addFrameMS(frameMS);
1336 StatsReporter.addPhysicsMS(physicsMS + physicsMS2);
1337 StatsReporter.addOtherMS(otherMS);
1338 StatsReporter.SetActiveScripts(m_sceneGraph.GetActiveScriptsCount());
1339 StatsReporter.addScriptLines(m_sceneGraph.GetScriptLPS());
1340 }
1310 1341
1311 frameMS = Util.EnvironmentTickCountSubtract(tmpFrameMS); 1342 if (LoginsDisabled && Frame == 20)
1312 otherMS = tempOnRezMS + eventMS + backupMS + terrainMS + landMS; 1343 {
1313 lastCompletedFrame = Util.EnvironmentTickCount(); 1344 // In 99.9% of cases it is a bad idea to manually force garbage collection. However,
1314 1345 // this is a rare case where we know we have just went through a long cycle of heap
1315 // if (m_frame%m_update_avatars == 0) 1346 // allocations, and there is no more work to be done until someone logs in
1316 // UpdateInWorldTime(); 1347 GC.Collect();
1317 StatsReporter.AddPhysicsFPS(physicsFPS);
1318 StatsReporter.AddTimeDilation(TimeDilation);
1319 StatsReporter.AddFPS(1);
1320 StatsReporter.SetRootAgents(m_sceneGraph.GetRootAgentCount());
1321 StatsReporter.SetChildAgents(m_sceneGraph.GetChildAgentCount());
1322 StatsReporter.SetObjects(m_sceneGraph.GetTotalObjectsCount());
1323 StatsReporter.SetActiveObjects(m_sceneGraph.GetActiveObjectsCount());
1324 StatsReporter.addFrameMS(frameMS);
1325 StatsReporter.addPhysicsMS(physicsMS + physicsMS2);
1326 StatsReporter.addOtherMS(otherMS);
1327 StatsReporter.SetActiveScripts(m_sceneGraph.GetActiveScriptsCount());
1328 StatsReporter.addScriptLines(m_sceneGraph.GetScriptLPS());
1329 }
1330 1348
1331 if (LoginsDisabled && m_frame == 20) 1349 IConfig startupConfig = m_config.Configs["Startup"];
1350 if (startupConfig == null || !startupConfig.GetBoolean("StartDisabled", false))
1332 { 1351 {
1333 // In 99.9% of cases it is a bad idea to manually force garbage collection. However, 1352 m_log.DebugFormat("[REGION]: Enabling logins for {0}", RegionInfo.RegionName);
1334 // this is a rare case where we know we have just went through a long cycle of heap 1353 LoginsDisabled = false;
1335 // allocations, and there is no more work to be done until someone logs in 1354 m_sceneGridService.InformNeighborsThatRegionisUp(RequestModuleInterface<INeighbourService>(), RegionInfo);
1336 GC.Collect();
1337
1338 IConfig startupConfig = m_config.Configs["Startup"];
1339 if (startupConfig == null || !startupConfig.GetBoolean("StartDisabled", false))
1340 {
1341 m_log.DebugFormat("[REGION]: Enabling logins for {0}", RegionInfo.RegionName);
1342 LoginsDisabled = false;
1343 m_sceneGridService.InformNeighborsThatRegionisUp(RequestModuleInterface<INeighbourService>(), RegionInfo);
1344 }
1345 } 1355 }
1346 } 1356 }
1347 catch (NotImplementedException) 1357 }
1348 { 1358 catch (NotImplementedException)
1349 throw; 1359 {
1350 } 1360 throw;
1351 catch (AccessViolationException e) 1361 }
1352 { 1362 catch (AccessViolationException e)
1353 m_log.Error("[REGION]: Failed with exception " + e.ToString() + " On Region: " + RegionInfo.RegionName); 1363 {
1354 } 1364 m_log.Error("[REGION]: Failed with exception " + e.ToString() + " On Region: " + RegionInfo.RegionName);
1355 //catch (NullReferenceException e) 1365 }
1356 //{ 1366 //catch (NullReferenceException e)
1357 // m_log.Error("[REGION]: Failed with exception " + e.ToString() + " On Region: " + RegionInfo.RegionName); 1367 //{
1358 //} 1368 // m_log.Error("[REGION]: Failed with exception " + e.ToString() + " On Region: " + RegionInfo.RegionName);
1359 catch (InvalidOperationException e) 1369 //}
1360 { 1370 catch (InvalidOperationException e)
1361 m_log.Error("[REGION]: Failed with exception " + e.ToString() + " On Region: " + RegionInfo.RegionName); 1371 {
1362 } 1372 m_log.Error("[REGION]: Failed with exception " + e.ToString() + " On Region: " + RegionInfo.RegionName);
1363 catch (Exception e) 1373 }
1364 { 1374 catch (Exception e)
1365 m_log.Error("[REGION]: Failed with exception " + e.ToString() + " On Region: " + RegionInfo.RegionName); 1375 {
1366 } 1376 m_log.Error("[REGION]: Failed with exception " + e.ToString() + " On Region: " + RegionInfo.RegionName);
1367 finally 1377 }
1368 { 1378 finally
1369 m_lastupdate = DateTime.UtcNow; 1379 {
1370 } 1380 m_lastupdate = DateTime.UtcNow;
1371 1381 }
1372 maintc = Util.EnvironmentTickCountSubtract(maintc);
1373 maintc = (int)(m_timespan * 1000) - maintc;
1374 1382
1375 if (maintc > 0) 1383 maintc = Util.EnvironmentTickCountSubtract(maintc);
1376 Thread.Sleep(maintc); 1384 maintc = (int)(m_timespan * 1000) - maintc;
1377 1385
1378 // Tell the watchdog that this thread is still alive 1386 if (maintc > 0)
1379 Watchdog.UpdateThread(); 1387 Thread.Sleep(maintc);
1380 }
1381 }
1382 1388
1383 1389 // Tell the watchdog that this thread is still alive
1390 Watchdog.UpdateThread();
1391 }
1384 1392
1385 public void AddGroupTarget(SceneObjectGroup grp) 1393 public void AddGroupTarget(SceneObjectGroup grp)
1386 { 1394 {
@@ -3011,7 +3019,9 @@ namespace OpenSim.Region.Framework.Scenes
3011 (childagentYN ? "child" : "root"), agentID, RegionInfo.RegionName); 3019 (childagentYN ? "child" : "root"), agentID, RegionInfo.RegionName);
3012 3020
3013 m_sceneGraph.removeUserCount(!childagentYN); 3021 m_sceneGraph.removeUserCount(!childagentYN);
3014 CapsModule.RemoveCapsHandler(agentID); 3022
3023 if (CapsModule != null)
3024 CapsModule.RemoveCapsHandler(agentID);
3015 3025
3016 // REFACTORING PROBLEM -- well not really a problem, but just to point out that whatever 3026 // REFACTORING PROBLEM -- well not really a problem, but just to point out that whatever
3017 // this method is doing is HORRIBLE!!! 3027 // this method is doing is HORRIBLE!!!
@@ -3200,7 +3210,7 @@ namespace OpenSim.Region.Framework.Scenes
3200 // TeleportFlags.ViaLandmark | TeleportFlags.ViaLocation | TeleportFlags.ViaLandmark | TeleportFlags.Default - Regular Teleport 3210 // TeleportFlags.ViaLandmark | TeleportFlags.ViaLocation | TeleportFlags.ViaLandmark | TeleportFlags.Default - Regular Teleport
3201 3211
3202 // Don't disable this log message - it's too helpful 3212 // Don't disable this log message - it's too helpful
3203 m_log.InfoFormat( 3213 m_log.DebugFormat(
3204 "[CONNECTION BEGIN]: Region {0} told of incoming {1} agent {2} {3} {4} (circuit code {5}, teleportflags {6})", 3214 "[CONNECTION BEGIN]: Region {0} told of incoming {1} agent {2} {3} {4} (circuit code {5}, teleportflags {6})",
3205 RegionInfo.RegionName, (agent.child ? "child" : "root"), agent.firstname, agent.lastname, 3215 RegionInfo.RegionName, (agent.child ? "child" : "root"), agent.firstname, agent.lastname,
3206 agent.AgentID, agent.circuitcode, teleportFlags); 3216 agent.AgentID, agent.circuitcode, teleportFlags);
@@ -3266,8 +3276,11 @@ namespace OpenSim.Region.Framework.Scenes
3266 RegionInfo.RegionName, (agent.child ? "child" : "root"), agent.firstname, agent.lastname, 3276 RegionInfo.RegionName, (agent.child ? "child" : "root"), agent.firstname, agent.lastname,
3267 agent.AgentID, agent.circuitcode); 3277 agent.AgentID, agent.circuitcode);
3268 3278
3269 CapsModule.NewUserConnection(agent); 3279 if (CapsModule != null)
3270 CapsModule.AddCapsHandler(agent.AgentID); 3280 {
3281 CapsModule.NewUserConnection(agent);
3282 CapsModule.AddCapsHandler(agent.AgentID);
3283 }
3271 } 3284 }
3272 else 3285 else
3273 { 3286 {
@@ -3282,7 +3295,9 @@ namespace OpenSim.Region.Framework.Scenes
3282 agent.AgentID, RegionInfo.RegionName); 3295 agent.AgentID, RegionInfo.RegionName);
3283 3296
3284 sp.AdjustKnownSeeds(); 3297 sp.AdjustKnownSeeds();
3285 CapsModule.NewUserConnection(agent); 3298
3299 if (CapsModule != null)
3300 CapsModule.NewUserConnection(agent);
3286 } 3301 }
3287 } 3302 }
3288 3303
@@ -3770,15 +3785,15 @@ namespace OpenSim.Region.Framework.Scenes
3770 public void RequestTeleportLocation(IClientAPI remoteClient, string regionName, Vector3 position, 3785 public void RequestTeleportLocation(IClientAPI remoteClient, string regionName, Vector3 position,
3771 Vector3 lookat, uint teleportFlags) 3786 Vector3 lookat, uint teleportFlags)
3772 { 3787 {
3773 GridRegion regionInfo = GridService.GetRegionByName(UUID.Zero, regionName); 3788 List<GridRegion> regions = GridService.GetRegionsByName(RegionInfo.ScopeID, regionName, 1);
3774 if (regionInfo == null) 3789 if (regions == null || regions.Count == 0)
3775 { 3790 {
3776 // can't find the region: Tell viewer and abort 3791 // can't find the region: Tell viewer and abort
3777 remoteClient.SendTeleportFailed("The region '" + regionName + "' could not be found."); 3792 remoteClient.SendTeleportFailed("The region '" + regionName + "' could not be found.");
3778 return; 3793 return;
3779 } 3794 }
3780 3795
3781 RequestTeleportLocation(remoteClient, regionInfo.RegionHandle, position, lookat, teleportFlags); 3796 RequestTeleportLocation(remoteClient, regions[0].RegionHandle, position, lookat, teleportFlags);
3782 } 3797 }
3783 3798
3784 /// <summary> 3799 /// <summary>
@@ -4923,8 +4938,9 @@ namespace OpenSim.Region.Framework.Scenes
4923 // from logging into the region, teleporting into the region 4938 // from logging into the region, teleporting into the region
4924 // or corssing the broder walking, but will NOT prevent 4939 // or corssing the broder walking, but will NOT prevent
4925 // child agent creation, thereby emulating the SL behavior. 4940 // child agent creation, thereby emulating the SL behavior.
4926 public bool QueryAccess(UUID agentID, Vector3 position) 4941 public bool QueryAccess(UUID agentID, Vector3 position, out string reason)
4927 { 4942 {
4943 reason = String.Empty;
4928 return true; 4944 return true;
4929 } 4945 }
4930 } 4946 }
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index 969ff13..734ba22 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -204,9 +204,10 @@ namespace OpenSim.Region.Framework.Scenes
204 for (int i = 0; i < Math.Min(presences.Count, maxLocations); ++i) 204 for (int i = 0; i < Math.Min(presences.Count, maxLocations); ++i)
205 { 205 {
206 ScenePresence sp = presences[i]; 206 ScenePresence sp = presences[i];
207
207 // If this presence is a child agent, we don't want its coarse locations 208 // If this presence is a child agent, we don't want its coarse locations
208 if (sp.IsChildAgent) 209 if (sp.IsChildAgent)
209 return; 210 continue;
210 211
211 if (sp.ParentID != 0) 212 if (sp.ParentID != 0)
212 { 213 {
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
index 67e59c6..fa404c0 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
@@ -1089,9 +1089,13 @@ namespace OpenSim.Region.Framework.Scenes
1089 1089
1090 public Dictionary<UUID, string> GetScriptStates() 1090 public Dictionary<UUID, string> GetScriptStates()
1091 { 1091 {
1092 Dictionary<UUID, string> ret = new Dictionary<UUID, string>();
1093
1094 if (m_part.ParentGroup.Scene == null) // Group not in a scene
1095 return ret;
1096
1092 IScriptModule[] engines = m_part.ParentGroup.Scene.RequestModuleInterfaces<IScriptModule>(); 1097 IScriptModule[] engines = m_part.ParentGroup.Scene.RequestModuleInterfaces<IScriptModule>();
1093 1098
1094 Dictionary<UUID, string> ret = new Dictionary<UUID, string>();
1095 if (engines == null) // No engine at all 1099 if (engines == null) // No engine at all
1096 return ret; 1100 return ret;
1097 1101
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index cd70de8..00a1487 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -626,7 +626,7 @@ namespace OpenSim.Region.Framework.Scenes
626 Utils.LongToUInts(handle, out x, out y); 626 Utils.LongToUInts(handle, out x, out y);
627 x = x / Constants.RegionSize; 627 x = x / Constants.RegionSize;
628 y = y / Constants.RegionSize; 628 y = y / Constants.RegionSize;
629 if (Util.IsOutsideView(x, Scene.RegionInfo.RegionLocX, y, Scene.RegionInfo.RegionLocY)) 629 if (Util.IsOutsideView(DrawDistance, x, Scene.RegionInfo.RegionLocX, y, Scene.RegionInfo.RegionLocY))
630 { 630 {
631 old.Add(handle); 631 old.Add(handle);
632 } 632 }
@@ -700,6 +700,7 @@ namespace OpenSim.Region.Framework.Scenes
700 700
701 private ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo) : this() 701 private ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo) : this()
702 { 702 {
703 m_DrawDistance = world.DefaultDrawDistance;
703 m_rootRegionHandle = reginfo.RegionHandle; 704 m_rootRegionHandle = reginfo.RegionHandle;
704 m_controllingClient = client; 705 m_controllingClient = client;
705 m_firstname = m_controllingClient.FirstName; 706 m_firstname = m_controllingClient.FirstName;
@@ -1161,7 +1162,9 @@ namespace OpenSim.Region.Framework.Scenes
1161 if (m_agentTransfer != null) 1162 if (m_agentTransfer != null)
1162 m_agentTransfer.EnableChildAgents(this); 1163 m_agentTransfer.EnableChildAgents(this);
1163 else 1164 else
1164 m_log.DebugFormat("[SCENE PRESENCE]: Unable to create child agents in neighbours, because AgentTransferModule is not active"); 1165 m_log.DebugFormat(
1166 "[SCENE PRESENCE]: Unable to create child agents in neighbours, because AgentTransferModule is not active for region {0}",
1167 m_scene.RegionInfo.RegionName);
1165 1168
1166 IFriendsModule friendsModule = m_scene.RequestModuleInterface<IFriendsModule>(); 1169 IFriendsModule friendsModule = m_scene.RequestModuleInterface<IFriendsModule>();
1167 if (friendsModule != null) 1170 if (friendsModule != null)
@@ -1277,7 +1280,11 @@ namespace OpenSim.Region.Framework.Scenes
1277 m_CameraUpAxis = agentData.CameraUpAxis; 1280 m_CameraUpAxis = agentData.CameraUpAxis;
1278 1281
1279 // The Agent's Draw distance setting 1282 // The Agent's Draw distance setting
1280 m_DrawDistance = agentData.Far; 1283 // When we get to the point of re-computing neighbors everytime this
1284 // changes, then start using the agent's drawdistance rather than the
1285 // region's draw distance.
1286 // m_DrawDistance = agentData.Far;
1287 m_DrawDistance = Scene.DefaultDrawDistance;
1281 1288
1282 // Check if Client has camera in 'follow cam' or 'build' mode. 1289 // Check if Client has camera in 'follow cam' or 'build' mode.
1283 Vector3 camdif = (Vector3.One * m_bodyRot - Vector3.One * CameraRotation); 1290 Vector3 camdif = (Vector3.One * m_bodyRot - Vector3.One * CameraRotation);
@@ -2435,7 +2442,7 @@ namespace OpenSim.Region.Framework.Scenes
2435 // If we are using the the cached appearance then send it out to everyone 2442 // If we are using the the cached appearance then send it out to everyone
2436 if (cachedappearance) 2443 if (cachedappearance)
2437 { 2444 {
2438 m_log.InfoFormat("[SCENEPRESENCE]: baked textures are in the cache for {0}", Name); 2445 m_log.DebugFormat("[SCENEPRESENCE]: baked textures are in the cache for {0}", Name);
2439 2446
2440 // If the avatars baked textures are all in the cache, then we have a 2447 // If the avatars baked textures are all in the cache, then we have a
2441 // complete appearance... send it out, if not, then we'll send it when 2448 // complete appearance... send it out, if not, then we'll send it when
@@ -2652,8 +2659,11 @@ namespace OpenSim.Region.Framework.Scenes
2652 #region Border Crossing Methods 2659 #region Border Crossing Methods
2653 2660
2654 /// <summary> 2661 /// <summary>
2655 /// Checks to see if the avatar is in range of a border and calls CrossToNewRegion 2662 /// Starts the process of moving an avatar into another region if they are crossing the border.
2656 /// </summary> 2663 /// </summary>
2664 /// <remarks>
2665 /// Also removes the avatar from the physical scene if transit has started.
2666 /// </remarks>
2657 protected void CheckForBorderCrossing() 2667 protected void CheckForBorderCrossing()
2658 { 2668 {
2659 if (IsChildAgent) 2669 if (IsChildAgent)
@@ -2721,7 +2731,6 @@ namespace OpenSim.Region.Framework.Scenes
2721 neighbor = HaveNeighbor(Cardinals.N, ref fix); 2731 neighbor = HaveNeighbor(Cardinals.N, ref fix);
2722 } 2732 }
2723 2733
2724
2725 // Makes sure avatar does not end up outside region 2734 // Makes sure avatar does not end up outside region
2726 if (neighbor <= 0) 2735 if (neighbor <= 0)
2727 { 2736 {
@@ -2776,6 +2785,13 @@ namespace OpenSim.Region.Framework.Scenes
2776 } 2785 }
2777 else 2786 else
2778 { 2787 {
2788 // We must remove the agent from the physical scene if it has been placed in transit. If we don't,
2789 // then this method continues to be called from ScenePresence.Update() until the handover of the client between
2790 // regions is completed. Since this handover can take more than 1000ms (due to the 1000ms
2791 // event queue polling response from the server), this results in the avatar pausing on the border
2792 // for the handover period.
2793 RemoveFromPhysicalScene();
2794
2779 // This constant has been inferred from experimentation 2795 // This constant has been inferred from experimentation
2780 // I'm not sure what this value should be, so I tried a few values. 2796 // I'm not sure what this value should be, so I tried a few values.
2781 timeStep = 0.04f; 2797 timeStep = 0.04f;
@@ -2787,6 +2803,15 @@ namespace OpenSim.Region.Framework.Scenes
2787 } 2803 }
2788 } 2804 }
2789 2805
2806 /// <summary>
2807 /// Checks whether this region has a neighbour in the given direction.
2808 /// </summary>
2809 /// <param name="car"></param>
2810 /// <param name="fix"></param>
2811 /// <returns>
2812 /// An integer which represents a compass point. N == 1, going clockwise until we reach NW == 8.
2813 /// Returns a positive integer if there is a region in that direction, a negative integer if not.
2814 /// </returns>
2790 protected int HaveNeighbor(Cardinals car, ref int[] fix) 2815 protected int HaveNeighbor(Cardinals car, ref int[] fix)
2791 { 2816 {
2792 uint neighbourx = m_regionInfo.RegionLocX; 2817 uint neighbourx = m_regionInfo.RegionLocX;
@@ -2893,7 +2918,7 @@ namespace OpenSim.Region.Framework.Scenes
2893 2918
2894 //m_log.Debug("---> x: " + x + "; newx:" + newRegionX + "; Abs:" + (int)Math.Abs((int)(x - newRegionX))); 2919 //m_log.Debug("---> x: " + x + "; newx:" + newRegionX + "; Abs:" + (int)Math.Abs((int)(x - newRegionX)));
2895 //m_log.Debug("---> y: " + y + "; newy:" + newRegionY + "; Abs:" + (int)Math.Abs((int)(y - newRegionY))); 2920 //m_log.Debug("---> y: " + y + "; newy:" + newRegionY + "; Abs:" + (int)Math.Abs((int)(y - newRegionY)));
2896 if (Util.IsOutsideView(x, newRegionX, y, newRegionY)) 2921 if (Util.IsOutsideView(DrawDistance, x, newRegionX, y, newRegionY))
2897 { 2922 {
2898 byebyeRegions.Add(handle); 2923 byebyeRegions.Add(handle);
2899 } 2924 }
@@ -2969,7 +2994,12 @@ namespace OpenSim.Region.Framework.Scenes
2969 2994
2970 Vector3 offset = new Vector3(shiftx, shifty, 0f); 2995 Vector3 offset = new Vector3(shiftx, shifty, 0f);
2971 2996
2972 m_DrawDistance = cAgentData.Far; 2997 // When we get to the point of re-computing neighbors everytime this
2998 // changes, then start using the agent's drawdistance rather than the
2999 // region's draw distance.
3000 // m_DrawDistance = cAgentData.Far;
3001 m_DrawDistance = Scene.DefaultDrawDistance;
3002
2973 if (cAgentData.Position != new Vector3(-1f, -1f, -1f)) // UGH!! 3003 if (cAgentData.Position != new Vector3(-1f, -1f, -1f)) // UGH!!
2974 m_pos = cAgentData.Position + offset; 3004 m_pos = cAgentData.Position + offset;
2975 3005
@@ -3119,7 +3149,11 @@ namespace OpenSim.Region.Framework.Scenes
3119 m_CameraLeftAxis = cAgent.LeftAxis; 3149 m_CameraLeftAxis = cAgent.LeftAxis;
3120 m_CameraUpAxis = cAgent.UpAxis; 3150 m_CameraUpAxis = cAgent.UpAxis;
3121 3151
3122 m_DrawDistance = cAgent.Far; 3152 // When we get to the point of re-computing neighbors everytime this
3153 // changes, then start using the agent's drawdistance rather than the
3154 // region's draw distance.
3155 // m_DrawDistance = cAgent.Far;
3156 m_DrawDistance = Scene.DefaultDrawDistance;
3123 3157
3124 if ((cAgent.Throttles != null) && cAgent.Throttles.Length > 0) 3158 if ((cAgent.Throttles != null) && cAgent.Throttles.Length > 0)
3125 ControllingClient.SetChildAgentThrottle(cAgent.Throttles); 3159 ControllingClient.SetChildAgentThrottle(cAgent.Throttles);
diff --git a/OpenSim/Region/Framework/Scenes/Tests/AttachmentTests.cs b/OpenSim/Region/Framework/Scenes/Tests/AttachmentTests.cs
new file mode 100644
index 0000000..855b589
--- /dev/null
+++ b/OpenSim/Region/Framework/Scenes/Tests/AttachmentTests.cs
@@ -0,0 +1,173 @@
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.Reflection;
31using System.Text;
32using System.Threading;
33using System.Timers;
34using Timer=System.Timers.Timer;
35using Nini.Config;
36using NUnit.Framework;
37using OpenMetaverse;
38using OpenSim.Framework;
39using OpenSim.Framework.Communications;
40using OpenSim.Region.Framework.Scenes;
41using OpenSim.Region.Framework.Interfaces;
42using OpenSim.Region.CoreModules.World.Serialiser;
43using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation;
44using OpenSim.Tests.Common;
45using OpenSim.Tests.Common.Mock;
46using OpenSim.Tests.Common.Setup;
47
48namespace OpenSim.Region.Framework.Scenes.Tests
49{
50 /// <summary>
51 /// Attachment tests
52 /// </summary>
53 [TestFixture]
54 public class AttachmentTests
55 {
56 public Scene scene, scene2;
57 public UUID agent1;
58 public static Random random;
59 public ulong region1, region2;
60 public AgentCircuitData acd1;
61 public SceneObjectGroup sog1, sog2, sog3;
62
63 [TestFixtureSetUp]
64 public void Init()
65 {
66 TestHelper.InMethod();
67
68 scene = SceneSetupHelpers.SetupScene("Neighbour x", UUID.Random(), 1000, 1000);
69 scene2 = SceneSetupHelpers.SetupScene("Neighbour x+1", UUID.Random(), 1001, 1000);
70
71 ISharedRegionModule interregionComms = new LocalSimulationConnectorModule();
72 interregionComms.Initialise(new IniConfigSource());
73 interregionComms.PostInitialise();
74 SceneSetupHelpers.SetupSceneModules(scene, new IniConfigSource(), interregionComms);
75 SceneSetupHelpers.SetupSceneModules(scene2, new IniConfigSource(), interregionComms);
76
77 agent1 = UUID.Random();
78 random = new Random();
79 sog1 = NewSOG(UUID.Random(), scene, agent1);
80 sog2 = NewSOG(UUID.Random(), scene, agent1);
81 sog3 = NewSOG(UUID.Random(), scene, agent1);
82
83 //ulong neighbourHandle = Utils.UIntsToLong((uint)(neighbourx * Constants.RegionSize), (uint)(neighboury * Constants.RegionSize));
84 region1 = scene.RegionInfo.RegionHandle;
85 region2 = scene2.RegionInfo.RegionHandle;
86
87 SceneSetupHelpers.AddRootAgent(scene, agent1);
88 }
89
90 [Test]
91 public void T030_TestAddAttachments()
92 {
93 TestHelper.InMethod();
94
95 ScenePresence presence = scene.GetScenePresence(agent1);
96
97 presence.AddAttachment(sog1);
98 presence.AddAttachment(sog2);
99 presence.AddAttachment(sog3);
100
101 Assert.That(presence.HasAttachments(), Is.True);
102 Assert.That(presence.ValidateAttachments(), Is.True);
103 }
104
105 [Test]
106 public void T031_RemoveAttachments()
107 {
108 TestHelper.InMethod();
109
110 ScenePresence presence = scene.GetScenePresence(agent1);
111 presence.RemoveAttachment(sog1);
112 presence.RemoveAttachment(sog2);
113 presence.RemoveAttachment(sog3);
114 Assert.That(presence.HasAttachments(), Is.False);
115 }
116
117 // I'm commenting this test because scene setup NEEDS InventoryService to
118 // be non-null
119 //[Test]
120 public void T032_CrossAttachments()
121 {
122 TestHelper.InMethod();
123
124 ScenePresence presence = scene.GetScenePresence(agent1);
125 ScenePresence presence2 = scene2.GetScenePresence(agent1);
126 presence2.AddAttachment(sog1);
127 presence2.AddAttachment(sog2);
128
129 ISharedRegionModule serialiser = new SerialiserModule();
130 SceneSetupHelpers.SetupSceneModules(scene, new IniConfigSource(), serialiser);
131 SceneSetupHelpers.SetupSceneModules(scene2, new IniConfigSource(), serialiser);
132
133 Assert.That(presence.HasAttachments(), Is.False, "Presence has attachments before cross");
134
135 //Assert.That(presence2.CrossAttachmentsIntoNewRegion(region1, true), Is.True, "Cross was not successful");
136 Assert.That(presence2.HasAttachments(), Is.False, "Presence2 objects were not deleted");
137 Assert.That(presence.HasAttachments(), Is.True, "Presence has not received new objects");
138 }
139
140 private SceneObjectGroup NewSOG(UUID uuid, Scene scene, UUID agent)
141 {
142 SceneObjectPart sop = new SceneObjectPart();
143 sop.Name = RandomName();
144 sop.Description = RandomName();
145 sop.Text = RandomName();
146 sop.SitName = RandomName();
147 sop.TouchName = RandomName();
148 sop.UUID = uuid;
149 sop.Shape = PrimitiveBaseShape.Default;
150 sop.Shape.State = 1;
151 sop.OwnerID = agent;
152
153 SceneObjectGroup sog = new SceneObjectGroup(sop);
154 sog.SetScene(scene);
155
156 return sog;
157 }
158
159 private static string RandomName()
160 {
161 StringBuilder name = new StringBuilder();
162 int size = random.Next(5,12);
163 char ch;
164 for (int i = 0; i < size; i++)
165 {
166 ch = Convert.ToChar(Convert.ToInt32(Math.Floor(26 * random.NextDouble() + 65))) ;
167 name.Append(ch);
168 }
169
170 return name.ToString();
171 }
172 }
173} \ No newline at end of file
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 ef52363..efb757f 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs
@@ -34,12 +34,12 @@ 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;
41using OpenSim.Region.Framework.Scenes; 40using OpenSim.Region.Framework.Scenes;
42using OpenSim.Region.Framework.Interfaces; 41using OpenSim.Region.Framework.Interfaces;
42using OpenSim.Region.CoreModules.Framework.EntityTransfer;
43using OpenSim.Region.CoreModules.World.Serialiser; 43using OpenSim.Region.CoreModules.World.Serialiser;
44using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation; 44using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation;
45using OpenSim.Tests.Common; 45using OpenSim.Tests.Common;
@@ -116,9 +116,6 @@ namespace OpenSim.Region.Framework.Scenes.Tests
116 agent.ChildrenCapSeeds = new Dictionary<ulong, string>(); 116 agent.ChildrenCapSeeds = new Dictionary<ulong, string>();
117 agent.child = true; 117 agent.child = true;
118 118
119 if (scene.PresenceService == null)
120 Console.WriteLine("Presence Service is null");
121
122 scene.PresenceService.LoginAgent(agent.AgentID.ToString(), agent.SessionID, agent.SecureSessionID); 119 scene.PresenceService.LoginAgent(agent.AgentID.ToString(), agent.SessionID, agent.SecureSessionID);
123 120
124 string reason; 121 string reason;
@@ -175,25 +172,6 @@ namespace OpenSim.Region.Framework.Scenes.Tests
175 172
176 Assert.That(neighbours.Count, Is.EqualTo(2)); 173 Assert.That(neighbours.Count, Is.EqualTo(2));
177 } 174 }
178
179 public void fixNullPresence()
180 {
181 string firstName = "testfirstname";
182
183 AgentCircuitData agent = new AgentCircuitData();
184 agent.AgentID = agent1;
185 agent.firstname = firstName;
186 agent.lastname = "testlastname";
187 agent.SessionID = UUID.Zero;
188 agent.SecureSessionID = UUID.Zero;
189 agent.circuitcode = 123;
190 agent.BaseFolder = UUID.Zero;
191 agent.InventoryFolder = UUID.Zero;
192 agent.startpos = Vector3.Zero;
193 agent.CapsPath = GetRandomCapsObjectPath();
194
195 acd1 = agent;
196 }
197 175
198 [Test] 176 [Test]
199 public void T013_TestRemoveNeighbourRegion() 177 public void T013_TestRemoveNeighbourRegion()
@@ -211,24 +189,36 @@ namespace OpenSim.Region.Framework.Scenes.Tests
211 CompleteAvatarMovement 189 CompleteAvatarMovement
212 */ 190 */
213 } 191 }
214 192
215 // I'm commenting this test, because this is not supposed to happen here 193 /// <summary>
216 //[Test] 194 /// Test that if a root agent logs into a region, a child agent is also established in the neighbouring region
217 public void T020_TestMakeRootAgent() 195 /// </summary>
196 /// <remarks>
197 /// Please note that unlike the other tests here, this doesn't rely on structures
198 /// </remarks>
199 [Test]
200 public void TestChildAgentEstablished()
218 { 201 {
219 TestHelper.InMethod(); 202 TestHelper.InMethod();
220 203// log4net.Config.XmlConfigurator.Configure();
221 ScenePresence presence = scene.GetScenePresence(agent1); 204
222 Assert.That(presence.IsChildAgent, Is.False, "Starts out as a root agent"); 205 UUID agent1Id = UUID.Parse("00000000-0000-0000-0000-000000000001");
223 206
224 presence.MakeChildAgent(); 207 TestScene myScene1 = SceneSetupHelpers.SetupScene("Neighbour y", UUID.Random(), 1000, 1000);
225 Assert.That(presence.IsChildAgent, Is.True, "Did not change to child agent after MakeChildAgent"); 208 TestScene myScene2 = SceneSetupHelpers.SetupScene("Neighbour y + 1", UUID.Random(), 1001, 1000);
226 209
227 // Accepts 0 but rejects Constants.RegionSize 210 IConfigSource configSource = new IniConfigSource();
228 Vector3 pos = new Vector3(0,unchecked(Constants.RegionSize-1),0); 211 configSource.AddConfig("Modules").Set("EntityTransferModule", "BasicEntityTransferModule");
229 presence.MakeRootAgent(pos,true); 212 EntityTransferModule etm = new EntityTransferModule();
230 Assert.That(presence.IsChildAgent, Is.False, "Did not go back to root agent"); 213
231 Assert.That(presence.AbsolutePosition, Is.EqualTo(pos), "Position is not the same one entered"); 214 SceneSetupHelpers.SetupSceneModules(myScene1, configSource, etm);
215
216 SceneSetupHelpers.AddRootAgent(myScene1, agent1Id);
217 ScenePresence childPresence = myScene2.GetScenePresence(agent1);
218
219 // TODO: Need to do a fair amount of work to allow synchronous establishment of child agents
220// Assert.That(childPresence, Is.Not.Null);
221// Assert.That(childPresence.IsChildAgent, Is.True);
232 } 222 }
233 223
234 // I'm commenting this test because it does not represent 224 // I'm commenting this test because it does not represent
@@ -333,63 +323,26 @@ namespace OpenSim.Region.Framework.Scenes.Tests
333 Assert.That(presence2.IsChildAgent, Is.True, "Did not return from region as expected."); 323 Assert.That(presence2.IsChildAgent, Is.True, "Did not return from region as expected.");
334 Assert.That(presence.IsChildAgent, Is.False, "Presence was not made root in old region again."); 324 Assert.That(presence.IsChildAgent, Is.False, "Presence was not made root in old region again.");
335 } 325 }
336 326
337 [Test] 327 public void fixNullPresence()
338 public void T030_TestAddAttachments()
339 {
340 TestHelper.InMethod();
341
342 ScenePresence presence = scene.GetScenePresence(agent1);
343
344 presence.AddAttachment(sog1);
345 presence.AddAttachment(sog2);
346 presence.AddAttachment(sog3);
347
348 Assert.That(presence.HasAttachments(), Is.True);
349 Assert.That(presence.ValidateAttachments(), Is.True);
350 }
351
352 [Test]
353 public void T031_RemoveAttachments()
354 {
355 TestHelper.InMethod();
356
357 ScenePresence presence = scene.GetScenePresence(agent1);
358 presence.RemoveAttachment(sog1);
359 presence.RemoveAttachment(sog2);
360 presence.RemoveAttachment(sog3);
361 Assert.That(presence.HasAttachments(), Is.False);
362 }
363
364 // I'm commenting this test because scene setup NEEDS InventoryService to
365 // be non-null
366 //[Test]
367 public void T032_CrossAttachments()
368 { 328 {
369 TestHelper.InMethod(); 329 string firstName = "testfirstname";
370
371 ScenePresence presence = scene.GetScenePresence(agent1);
372 ScenePresence presence2 = scene2.GetScenePresence(agent1);
373 presence2.AddAttachment(sog1);
374 presence2.AddAttachment(sog2);
375
376 ISharedRegionModule serialiser = new SerialiserModule();
377 SceneSetupHelpers.SetupSceneModules(scene, new IniConfigSource(), serialiser);
378 SceneSetupHelpers.SetupSceneModules(scene2, new IniConfigSource(), serialiser);
379
380 Assert.That(presence.HasAttachments(), Is.False, "Presence has attachments before cross");
381 330
382 //Assert.That(presence2.CrossAttachmentsIntoNewRegion(region1, true), Is.True, "Cross was not successful"); 331 AgentCircuitData agent = new AgentCircuitData();
383 Assert.That(presence2.HasAttachments(), Is.False, "Presence2 objects were not deleted"); 332 agent.AgentID = agent1;
384 Assert.That(presence.HasAttachments(), Is.True, "Presence has not received new objects"); 333 agent.firstname = firstName;
385 } 334 agent.lastname = "testlastname";
335 agent.SessionID = UUID.Zero;
336 agent.SecureSessionID = UUID.Zero;
337 agent.circuitcode = 123;
338 agent.BaseFolder = UUID.Zero;
339 agent.InventoryFolder = UUID.Zero;
340 agent.startpos = Vector3.Zero;
341 agent.CapsPath = GetRandomCapsObjectPath();
386 342
387 [TearDown] 343 acd1 = agent;
388 public void TearDown()
389 {
390 if (MainServer.Instance != null) MainServer.Instance.Stop();
391 } 344 }
392 345
393 public static string GetRandomCapsObjectPath() 346 public static string GetRandomCapsObjectPath()
394 { 347 {
395 UUID caps = UUID.Random(); 348 UUID caps = UUID.Random();
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs
new file mode 100644
index 0000000..abcce66
--- /dev/null
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs
@@ -0,0 +1,70 @@
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.Reflection;
31using System.Text;
32using System.Threading;
33using System.Timers;
34using Timer=System.Timers.Timer;
35using Nini.Config;
36using NUnit.Framework;
37using OpenMetaverse;
38using OpenSim.Framework;
39using OpenSim.Framework.Communications;
40using OpenSim.Region.Framework.Scenes;
41using OpenSim.Region.Framework.Interfaces;
42using OpenSim.Region.CoreModules.World.Serialiser;
43using OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation;
44using OpenSim.Tests.Common;
45using OpenSim.Tests.Common.Mock;
46using OpenSim.Tests.Common.Setup;
47
48namespace OpenSim.Region.Framework.Scenes.Tests
49{
50 /// <summary>
51 /// Scene presence tests
52 /// </summary>
53 [TestFixture]
54 public class SceneTests
55 {
56 /// <summary>
57 /// Very basic scene update test. Should become more elaborate with time.
58 /// </summary>
59 [Test]
60 public void TestUpdateScene()
61 {
62 TestHelper.InMethod();
63
64 Scene scene = SceneSetupHelpers.SetupScene();
65 scene.Update();
66
67 Assert.That(scene.Frame, Is.EqualTo(1));
68 }
69 }
70} \ No newline at end of file
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 e9c5453..05a1c3b 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;
@@ -671,9 +671,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice
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/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index 688dfe4..64931d0 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -681,10 +681,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
681 // 681 //
682 CheckThreatLevel(ThreatLevel.High, "osTeleportAgent"); 682 CheckThreatLevel(ThreatLevel.High, "osTeleportAgent");
683 683
684 TeleportAgent(agent, regionName, position, lookat); 684 TeleportAgent(agent, regionName, position, lookat, false);
685 } 685 }
686 686
687 private void TeleportAgent(string agent, string regionName, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat) 687 private void TeleportAgent(string agent, string regionName,
688 LSL_Types.Vector3 position, LSL_Types.Vector3 lookat, bool relaxRestrictions)
688 { 689 {
689 m_host.AddScriptLPS(1); 690 m_host.AddScriptLPS(1);
690 UUID agentId = new UUID(); 691 UUID agentId = new UUID();
@@ -693,25 +694,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
693 ScenePresence presence = World.GetScenePresence(agentId); 694 ScenePresence presence = World.GetScenePresence(agentId);
694 if (presence != null) 695 if (presence != null)
695 { 696 {
696 // agent must be over owners land to avoid abuse 697 // For osTeleportAgent, agent must be over owners land to avoid abuse
697 if (m_host.OwnerID 698 // For osTeleportOwner, this restriction isn't necessary
699 if (relaxRestrictions ||
700 m_host.OwnerID
698 == World.LandChannel.GetLandObject( 701 == World.LandChannel.GetLandObject(
699 presence.AbsolutePosition.X, presence.AbsolutePosition.Y).LandData.OwnerID) 702 presence.AbsolutePosition.X, presence.AbsolutePosition.Y).LandData.OwnerID)
700 { 703 {
701 // Check for hostname, attempt to make a HG link,
702 // and convert the regionName to the target region
703 if (regionName.Contains(".") && regionName.Contains(":"))
704 {
705 // Even though we use none of the results, we need to perform this call because it appears
706 // to have some the side effect of setting up hypergrid teleport locations.
707 World.GridService.GetRegionsByName(World.RegionInfo.ScopeID, regionName, 1);
708// List<GridRegion> regions = World.GridService.GetRegionsByName(World.RegionInfo.ScopeID, regionName, 1);
709
710 string[] parts = regionName.Split(new char[] { ':' });
711 if (parts.Length > 2)
712 regionName = parts[0] + ':' + parts[1] + "/ " + parts[2];
713 regionName = "http://" + regionName;
714 }
715 World.RequestTeleportLocation(presence.ControllingClient, regionName, 704 World.RequestTeleportLocation(presence.ControllingClient, regionName,
716 new Vector3((float)position.x, (float)position.y, (float)position.z), 705 new Vector3((float)position.x, (float)position.y, (float)position.z),
717 new Vector3((float)lookat.x, (float)lookat.y, (float)lookat.z), (uint)TPFlags.ViaLocation); 706 new Vector3((float)lookat.x, (float)lookat.y, (float)lookat.z), (uint)TPFlags.ViaLocation);
@@ -728,10 +717,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
728 // 717 //
729 CheckThreatLevel(ThreatLevel.High, "osTeleportAgent"); 718 CheckThreatLevel(ThreatLevel.High, "osTeleportAgent");
730 719
731 TeleportAgent(agent, regionX, regionY, position, lookat); 720 TeleportAgent(agent, regionX, regionY, position, lookat, false);
732 } 721 }
733 722
734 private void TeleportAgent(string agent, int regionX, int regionY, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat) 723 private void TeleportAgent(string agent, int regionX, int regionY,
724 LSL_Types.Vector3 position, LSL_Types.Vector3 lookat, bool relaxRestrictions)
735 { 725 {
736 ulong regionHandle = Util.UIntsToLong(((uint)regionX * (uint)Constants.RegionSize), ((uint)regionY * (uint)Constants.RegionSize)); 726 ulong regionHandle = Util.UIntsToLong(((uint)regionX * (uint)Constants.RegionSize), ((uint)regionY * (uint)Constants.RegionSize));
737 727
@@ -742,8 +732,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
742 ScenePresence presence = World.GetScenePresence(agentId); 732 ScenePresence presence = World.GetScenePresence(agentId);
743 if (presence != null) 733 if (presence != null)
744 { 734 {
745 // agent must be over owners land to avoid abuse 735 // For osTeleportAgent, agent must be over owners land to avoid abuse
746 if (m_host.OwnerID 736 // For osTeleportOwner, this restriction isn't necessary
737 if (relaxRestrictions ||
738 m_host.OwnerID
747 == World.LandChannel.GetLandObject( 739 == World.LandChannel.GetLandObject(
748 presence.AbsolutePosition.X, presence.AbsolutePosition.Y).LandData.OwnerID) 740 presence.AbsolutePosition.X, presence.AbsolutePosition.Y).LandData.OwnerID)
749 { 741 {
@@ -766,7 +758,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
766 // Threat level None because this is what can already be done with the World Map in the viewer 758 // Threat level None because this is what can already be done with the World Map in the viewer
767 CheckThreatLevel(ThreatLevel.None, "osTeleportOwner"); 759 CheckThreatLevel(ThreatLevel.None, "osTeleportOwner");
768 760
769 TeleportAgent(m_host.OwnerID.ToString(), regionName, position, lookat); 761 TeleportAgent(m_host.OwnerID.ToString(), regionName, position, lookat, true);
770 } 762 }
771 763
772 public void osTeleportOwner(LSL_Types.Vector3 position, LSL_Types.Vector3 lookat) 764 public void osTeleportOwner(LSL_Types.Vector3 position, LSL_Types.Vector3 lookat)
@@ -778,7 +770,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
778 { 770 {
779 CheckThreatLevel(ThreatLevel.None, "osTeleportOwner"); 771 CheckThreatLevel(ThreatLevel.None, "osTeleportOwner");
780 772
781 TeleportAgent(m_host.OwnerID.ToString(), regionX, regionY, position, lookat); 773 TeleportAgent(m_host.OwnerID.ToString(), regionX, regionY, position, lookat, true);
782 } 774 }
783 775
784 // Functions that get information from the agent itself. 776 // Functions that get information from the agent itself.
diff --git a/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs b/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs
index 913c6c9..edc0561 100644
--- a/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs
+++ b/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs
@@ -115,15 +115,15 @@ namespace OpenSim.Server.Handlers.Grid
115 case "get_region_flags": 115 case "get_region_flags":
116 return GetRegionFlags(request); 116 return GetRegionFlags(request);
117 } 117 }
118
118 m_log.DebugFormat("[GRID HANDLER]: unknown method {0} request {1}", method.Length, method); 119 m_log.DebugFormat("[GRID HANDLER]: unknown method {0} request {1}", method.Length, method);
119 } 120 }
120 catch (Exception e) 121 catch (Exception e)
121 { 122 {
122 m_log.DebugFormat("[GRID HANDLER]: Exception {0}", e); 123 m_log.ErrorFormat("[GRID HANDLER]: Exception {0} {1}", e.Message, e.StackTrace);
123 } 124 }
124 125
125 return FailureResult(); 126 return FailureResult();
126
127 } 127 }
128 128
129 #region Method-specific handlers 129 #region Method-specific handlers
diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs
index 6a23dee..372a59c 100644
--- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs
+++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs
@@ -341,10 +341,17 @@ namespace OpenSim.Server.Handlers.Simulation
341 GridRegion destination = new GridRegion(); 341 GridRegion destination = new GridRegion();
342 destination.RegionID = regionID; 342 destination.RegionID = regionID;
343 343
344 bool result = m_SimulationService.QueryAccess(destination, id, position); 344 string reason;
345 bool result = m_SimulationService.QueryAccess(destination, id, position, out reason);
345 346
346 responsedata["int_response_code"] = HttpStatusCode.OK; 347 responsedata["int_response_code"] = HttpStatusCode.OK;
347 responsedata["str_response_string"] = result.ToString(); 348
349 OSDMap resp = new OSDMap(2);
350
351 resp["success"] = OSD.FromBoolean(result);
352 resp["reason"] = OSD.FromString(reason);
353
354 responsedata["str_response_string"] = OSDParser.SerializeJsonString(resp);
348 } 355 }
349 356
350 protected virtual void DoAgentGet(Hashtable request, Hashtable responsedata, UUID id, UUID regionID) 357 protected virtual void DoAgentGet(Hashtable request, Hashtable responsedata, UUID id, UUID regionID)
diff --git a/OpenSim/Services/AuthenticationService/PasswordAuthenticationService.cs b/OpenSim/Services/AuthenticationService/PasswordAuthenticationService.cs
index 17619ff..2fc9248 100644
--- a/OpenSim/Services/AuthenticationService/PasswordAuthenticationService.cs
+++ b/OpenSim/Services/AuthenticationService/PasswordAuthenticationService.cs
@@ -71,7 +71,7 @@ namespace OpenSim.Services.AuthenticationService
71 string hashed = Util.Md5Hash(password + ":" + 71 string hashed = Util.Md5Hash(password + ":" +
72 data.Data["passwordSalt"].ToString()); 72 data.Data["passwordSalt"].ToString());
73 73
74 m_log.DebugFormat("[PASS AUTH]: got {0}; hashed = {1}; stored = {2}", password, hashed, data.Data["passwordHash"].ToString()); 74 //m_log.DebugFormat("[PASS AUTH]: got {0}; hashed = {1}; stored = {2}", password, hashed, data.Data["passwordHash"].ToString());
75 75
76 if (data.Data["passwordHash"].ToString() == hashed) 76 if (data.Data["passwordHash"].ToString() == hashed)
77 { 77 {
diff --git a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs
index cc6bffb..93b3ae6 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 }
@@ -185,7 +185,7 @@ namespace OpenSim.Services.Connectors.Simulation
185 } 185 }
186 186
187 // unreachable 187 // unreachable
188 return true; 188// return true;
189 } 189 }
190 190
191 /// <summary> 191 /// <summary>
@@ -256,8 +256,10 @@ namespace OpenSim.Services.Connectors.Simulation
256 256
257 /// <summary> 257 /// <summary>
258 /// </summary> 258 /// </summary>
259 public bool QueryAccess(GridRegion destination, UUID id, Vector3 position) 259 public bool QueryAccess(GridRegion destination, UUID id, Vector3 position, out string reason)
260 { 260 {
261 reason = "Failed to contact destination";
262
261 // m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: QueryAccess start, position={0}", position); 263 // m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: QueryAccess start, position={0}", position);
262 264
263 IPEndPoint ext = destination.ExternalEndPoint; 265 IPEndPoint ext = destination.ExternalEndPoint;
@@ -272,7 +274,11 @@ namespace OpenSim.Services.Connectors.Simulation
272 try 274 try
273 { 275 {
274 OSDMap result = WebUtil.ServiceOSDRequest(uri, request, "QUERYACCESS", 10000); 276 OSDMap result = WebUtil.ServiceOSDRequest(uri, request, "QUERYACCESS", 10000);
275 bool success = result["Success"].AsBoolean(); 277 bool success = result["success"].AsBoolean();
278 reason = result["reason"].AsString();
279
280 //m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: QueryAccess to {0} returned {1}", uri, success);
281
276 if (!success) 282 if (!success)
277 { 283 {
278 if (result.ContainsKey("Message")) 284 if (result.ContainsKey("Message"))
@@ -283,8 +289,17 @@ namespace OpenSim.Services.Connectors.Simulation
283 m_log.Info("[REMOTE SIMULATION CONNECTOR]: The above web util error was caused by a TP to a sim that doesn't support QUERYACCESS and can be ignored"); 289 m_log.Info("[REMOTE SIMULATION CONNECTOR]: The above web util error was caused by a TP to a sim that doesn't support QUERYACCESS and can be ignored");
284 return true; 290 return true;
285 } 291 }
292
293 reason = result["Message"];
294 }
295 else
296 {
297 reason = "Communications failure";
286 } 298 }
299
300 return false;
287 } 301 }
302
288 return success; 303 return success;
289 } 304 }
290 catch (Exception e) 305 catch (Exception e)
diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs
index aeff9b5..985d77b 100644
--- a/OpenSim/Services/GridService/GridService.cs
+++ b/OpenSim/Services/GridService/GridService.cs
@@ -271,6 +271,7 @@ namespace OpenSim.Services.GridService
271 { 271 {
272 List<GridRegion> rinfos = new List<GridRegion>(); 272 List<GridRegion> rinfos = new List<GridRegion>();
273 RegionData region = m_Database.Get(regionID, scopeID); 273 RegionData region = m_Database.Get(regionID, scopeID);
274
274 if (region != null) 275 if (region != null)
275 { 276 {
276 // Not really? Maybe? 277 // Not really? Maybe?
@@ -278,15 +279,24 @@ namespace OpenSim.Services.GridService
278 region.posX + (int)Constants.RegionSize + 1, region.posY + (int)Constants.RegionSize + 1, scopeID); 279 region.posX + (int)Constants.RegionSize + 1, region.posY + (int)Constants.RegionSize + 1, scopeID);
279 280
280 foreach (RegionData rdata in rdatas) 281 foreach (RegionData rdata in rdatas)
282 {
281 if (rdata.RegionID != regionID) 283 if (rdata.RegionID != regionID)
282 { 284 {
283 int flags = Convert.ToInt32(rdata.Data["flags"]); 285 int flags = Convert.ToInt32(rdata.Data["flags"]);
284 if ((flags & (int)Data.RegionFlags.Hyperlink) == 0) // no hyperlinks as neighbours 286 if ((flags & (int)Data.RegionFlags.Hyperlink) == 0) // no hyperlinks as neighbours
285 rinfos.Add(RegionData2RegionInfo(rdata)); 287 rinfos.Add(RegionData2RegionInfo(rdata));
286 } 288 }
289 }
287 290
291 m_log.DebugFormat("[GRID SERVICE]: region {0} has {1} neighbours", region.RegionName, rinfos.Count);
288 } 292 }
289 m_log.DebugFormat("[GRID SERVICE]: region {0} has {1} neighbours", region.RegionName, rinfos.Count); 293 else
294 {
295 m_log.WarnFormat(
296 "[GRID SERVICE]: GetNeighbours() called for scope {0}, region {1} but no such region found",
297 scopeID, regionID);
298 }
299
290 return rinfos; 300 return rinfos;
291 } 301 }
292 302
diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs
index 9d98c8f..12ea453 100644
--- a/OpenSim/Services/GridService/HypergridLinker.cs
+++ b/OpenSim/Services/GridService/HypergridLinker.cs
@@ -121,7 +121,7 @@ namespace OpenSim.Services.GridService
121 121
122 m_Check4096 = gridConfig.GetBoolean("Check4096", true); 122 m_Check4096 = gridConfig.GetBoolean("Check4096", true);
123 123
124 m_MapTileDirectory = gridConfig.GetString("MapTileDirectory", string.Empty); 124 m_MapTileDirectory = gridConfig.GetString("MapTileDirectory", "maptiles");
125 125
126 m_GatekeeperConnector = new GatekeeperServiceConnector(m_AssetService); 126 m_GatekeeperConnector = new GatekeeperServiceConnector(m_AssetService);
127 127
diff --git a/OpenSim/Services/HypergridService/UserAgentService.cs b/OpenSim/Services/HypergridService/UserAgentService.cs
index 3ead180..445d45e 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 48a2185..55c9cc5 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>
@@ -60,7 +67,7 @@ namespace OpenSim.Services.Interfaces
60 67
61 bool RetrieveAgent(GridRegion destination, UUID id, out IAgentData agent); 68 bool RetrieveAgent(GridRegion destination, UUID id, out IAgentData agent);
62 69
63 bool QueryAccess(GridRegion destination, UUID id, Vector3 position); 70 bool QueryAccess(GridRegion destination, UUID id, Vector3 position, out string reason);
64 71
65 /// <summary> 72 /// <summary>
66 /// Message from receiving region to departing region, telling it got contacted by the client. 73 /// Message from receiving region to departing region, telling it got contacted by the client.
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/Mock/TestClient.cs b/OpenSim/Tests/Common/Mock/TestClient.cs
index dc0d4de..ebe0a72 100644
--- a/OpenSim/Tests/Common/Mock/TestClient.cs
+++ b/OpenSim/Tests/Common/Mock/TestClient.cs
@@ -560,8 +560,11 @@ namespace OpenSim.Tests.Common.Mock
560 agentData.lastname = m_lastName; 560 agentData.lastname = m_lastName;
561 561
562 ICapabilitiesModule capsModule = m_scene.RequestModuleInterface<ICapabilitiesModule>(); 562 ICapabilitiesModule capsModule = m_scene.RequestModuleInterface<ICapabilitiesModule>();
563 agentData.CapsPath = capsModule.GetCapsPath(m_agentId); 563 if (capsModule != null)
564 agentData.ChildrenCapSeeds = new Dictionary<ulong, string>(capsModule.GetChildrenSeeds(m_agentId)); 564 {
565 agentData.CapsPath = capsModule.GetCapsPath(m_agentId);
566 agentData.ChildrenCapSeeds = new Dictionary<ulong, string>(capsModule.GetChildrenSeeds(m_agentId));
567 }
565 568
566 return agentData; 569 return agentData;
567 } 570 }
diff --git a/OpenSim/Tests/Common/Setup/AssetHelpers.cs b/OpenSim/Tests/Common/Setup/AssetHelpers.cs
index 8647cfe..ff4423f 100644
--- a/OpenSim/Tests/Common/Setup/AssetHelpers.cs
+++ b/OpenSim/Tests/Common/Setup/AssetHelpers.cs
@@ -68,7 +68,7 @@ namespace OpenSim.Tests.Common
68 return CreateAsset( 68 return CreateAsset(
69 assetUuid, 69 assetUuid,
70 AssetType.Object, 70 AssetType.Object,
71 Encoding.ASCII.GetBytes(SceneObjectSerializer.ToXml2Format(sog)), 71 Encoding.ASCII.GetBytes(SceneObjectSerializer.ToOriginalXmlFormat(sog)),
72 sog.OwnerID); 72 sog.OwnerID);
73 } 73 }
74 74
diff --git a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs
index 8b16496..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>
@@ -132,24 +108,11 @@ namespace OpenSim.Tests.Common.Setup
132 public static TestScene SetupScene( 108 public static TestScene SetupScene(
133 string name, UUID id, uint x, uint y, String realServices) 109 string name, UUID id, uint x, uint y, String realServices)
134 { 110 {
135 bool newScene = false;
136
137 Console.WriteLine("Setting up test scene {0}", name); 111 Console.WriteLine("Setting up test scene {0}", name);
138 112
139 // REFACTORING PROBLEM!
140 //// If cm is the same as our last commsManager used, this means the tester wants to link
141 //// regions. In this case, don't use the sameshared region modules and dont initialize them again.
142 //// Also, no need to start another MainServer and MainConsole instance.
143 //if (cm == null || cm != commsManager)
144 //{
145 // System.Console.WriteLine("Starting a brand new scene");
146 // newScene = true;
147 MainConsole.Instance = new MockConsole("TEST PROMPT");
148 // MainServer.Instance = new BaseHttpServer(980);
149 // commsManager = cm;
150 //}
151
152 // We must set up a console otherwise setup of some modules may fail 113 // We must set up a console otherwise setup of some modules may fail
114 MainConsole.Instance = new MockConsole("TEST PROMPT");
115
153 RegionInfo regInfo = new RegionInfo(x, y, new IPEndPoint(IPAddress.Loopback, 9000), "127.0.0.1"); 116 RegionInfo regInfo = new RegionInfo(x, y, new IPEndPoint(IPAddress.Loopback, 9000), "127.0.0.1");
154 regInfo.RegionName = name; 117 regInfo.RegionName = name;
155 regInfo.RegionID = id; 118 regInfo.RegionID = id;
@@ -164,55 +127,26 @@ namespace OpenSim.Tests.Common.Setup
164 TestScene testScene = new TestScene( 127 TestScene testScene = new TestScene(
165 regInfo, acm, scs, simDataService, estateDataService, null, false, false, false, configSource, null); 128 regInfo, acm, scs, simDataService, estateDataService, null, false, false, false, configSource, null);
166 129
167 INonSharedRegionModule capsModule = new CapabilitiesModule();
168 capsModule.Initialise(new IniConfigSource());
169 testScene.AddRegionModule(capsModule.Name, capsModule);
170 capsModule.AddRegion(testScene);
171
172 IRegionModule godsModule = new GodsModule(); 130 IRegionModule godsModule = new GodsModule();
173 godsModule.Initialise(testScene, new IniConfigSource()); 131 godsModule.Initialise(testScene, new IniConfigSource());
174 testScene.AddModule(godsModule.Name, godsModule); 132 testScene.AddModule(godsModule.Name, godsModule);
175 realServices = realServices.ToLower(); 133 realServices = realServices.ToLower();
176 // IConfigSource config = new IniConfigSource();
177 134
178 // If we have a brand new scene, need to initialize shared region modules 135 LocalAssetServicesConnector assetService = StartAssetService(testScene, realServices.Contains("asset"));
179 if ((m_assetService == null && m_inventoryService == null) || newScene)
180 {
181 if (realServices.Contains("asset"))
182 StartAssetService(testScene, true);
183 else
184 StartAssetService(testScene, false);
185
186 // For now, always started a 'real' authentication service
187 StartAuthenticationService(testScene, true);
188
189 if (realServices.Contains("inventory"))
190 StartInventoryService(testScene, true);
191 else
192 StartInventoryService(testScene, false);
193
194 StartGridService(testScene, true);
195 StartUserAccountService(testScene);
196 StartPresenceService(testScene);
197 }
198 // If not, make sure the shared module gets references to this new scene
199 else
200 {
201 m_assetService.AddRegion(testScene);
202 m_assetService.RegionLoaded(testScene);
203 m_inventoryService.AddRegion(testScene);
204 m_inventoryService.RegionLoaded(testScene);
205 m_userAccountService.AddRegion(testScene);
206 m_userAccountService.RegionLoaded(testScene);
207 m_presenceService.AddRegion(testScene);
208 m_presenceService.RegionLoaded(testScene);
209 136
210 } 137 // For now, always started a 'real' authentication service
138 StartAuthenticationService(testScene, true);
139
140 LocalInventoryServicesConnector inventoryService = StartInventoryService(testScene, realServices.Contains("inventory"));
141 StartGridService(testScene, true);
142 LocalUserAccountServicesConnector userAccountService = StartUserAccountService(testScene);
143 LocalPresenceServicesConnector presenceService = StartPresenceService(testScene);
211 144
212 m_inventoryService.PostInitialise(); 145 inventoryService.PostInitialise();
213 m_assetService.PostInitialise(); 146 assetService.PostInitialise();
214 m_userAccountService.PostInitialise(); 147 userAccountService.PostInitialise();
215 m_presenceService.PostInitialise(); 148 presenceService.PostInitialise();
149
216 testScene.RegionInfo.EstateSettings.EstateOwner = UUID.Random(); 150 testScene.RegionInfo.EstateSettings.EstateOwner = UUID.Random();
217 testScene.SetModuleInterfaces(); 151 testScene.SetModuleInterfaces();
218 152
@@ -224,24 +158,15 @@ namespace OpenSim.Tests.Common.Setup
224 testScene.PhysicsScene 158 testScene.PhysicsScene
225 = physicsPluginManager.GetPhysicsScene("basicphysics", "ZeroMesher", new IniConfigSource(), "test"); 159 = physicsPluginManager.GetPhysicsScene("basicphysics", "ZeroMesher", new IniConfigSource(), "test");
226 160
227 // It's really not a good idea to use static variables as they carry over between tests, leading to
228 // problems that are extremely hard to debug. Really, these static fields need to be eliminated -
229 // tests using multiple regions that need to share modules need to find another solution.
230 m_assetService = null;
231 m_inventoryService = null;
232 m_gridService = null;
233 m_userAccountService = null;
234 m_presenceService = null;
235
236 testScene.RegionInfo.EstateSettings = new EstateSettings(); 161 testScene.RegionInfo.EstateSettings = new EstateSettings();
237 testScene.LoginsDisabled = false; 162 testScene.LoginsDisabled = false;
238 163
239 return testScene; 164 return testScene;
240 } 165 }
241 166
242 private static void StartAssetService(Scene testScene, bool real) 167 private static LocalAssetServicesConnector StartAssetService(Scene testScene, bool real)
243 { 168 {
244 ISharedRegionModule assetService = new LocalAssetServicesConnector(); 169 LocalAssetServicesConnector assetService = new LocalAssetServicesConnector();
245 IConfigSource config = new IniConfigSource(); 170 IConfigSource config = new IniConfigSource();
246 config.AddConfig("Modules"); 171 config.AddConfig("Modules");
247 config.AddConfig("AssetService"); 172 config.AddConfig("AssetService");
@@ -255,7 +180,8 @@ namespace OpenSim.Tests.Common.Setup
255 assetService.AddRegion(testScene); 180 assetService.AddRegion(testScene);
256 assetService.RegionLoaded(testScene); 181 assetService.RegionLoaded(testScene);
257 testScene.AddRegionModule(assetService.Name, assetService); 182 testScene.AddRegionModule(assetService.Name, assetService);
258 m_assetService = assetService; 183
184 return assetService;
259 } 185 }
260 186
261 private static void StartAuthenticationService(Scene testScene, bool real) 187 private static void StartAuthenticationService(Scene testScene, bool real)
@@ -279,9 +205,9 @@ namespace OpenSim.Tests.Common.Setup
279 //m_authenticationService = service; 205 //m_authenticationService = service;
280 } 206 }
281 207
282 private static void StartInventoryService(Scene testScene, bool real) 208 private static LocalInventoryServicesConnector StartInventoryService(Scene testScene, bool real)
283 { 209 {
284 ISharedRegionModule inventoryService = new LocalInventoryServicesConnector(); 210 LocalInventoryServicesConnector inventoryService = new LocalInventoryServicesConnector();
285 IConfigSource config = new IniConfigSource(); 211 IConfigSource config = new IniConfigSource();
286 config.AddConfig("Modules"); 212 config.AddConfig("Modules");
287 config.AddConfig("InventoryService"); 213 config.AddConfig("InventoryService");
@@ -301,10 +227,11 @@ namespace OpenSim.Tests.Common.Setup
301 inventoryService.AddRegion(testScene); 227 inventoryService.AddRegion(testScene);
302 inventoryService.RegionLoaded(testScene); 228 inventoryService.RegionLoaded(testScene);
303 testScene.AddRegionModule(inventoryService.Name, inventoryService); 229 testScene.AddRegionModule(inventoryService.Name, inventoryService);
304 m_inventoryService = inventoryService; 230
231 return inventoryService;
305 } 232 }
306 233
307 private static void StartGridService(Scene testScene, bool real) 234 private static LocalGridServicesConnector StartGridService(Scene testScene, bool real)
308 { 235 {
309 IConfigSource config = new IniConfigSource(); 236 IConfigSource config = new IniConfigSource();
310 config.AddConfig("Modules"); 237 config.AddConfig("Modules");
@@ -313,24 +240,25 @@ namespace OpenSim.Tests.Common.Setup
313 config.Configs["GridService"].Set("StorageProvider", "OpenSim.Data.Null.dll:NullRegionData"); 240 config.Configs["GridService"].Set("StorageProvider", "OpenSim.Data.Null.dll:NullRegionData");
314 if (real) 241 if (real)
315 config.Configs["GridService"].Set("LocalServiceModule", "OpenSim.Services.GridService.dll:GridService"); 242 config.Configs["GridService"].Set("LocalServiceModule", "OpenSim.Services.GridService.dll:GridService");
316 if (m_gridService == null) 243
317 { 244 LocalGridServicesConnector gridService = new LocalGridServicesConnector();
318 ISharedRegionModule gridService = new LocalGridServicesConnector(); 245 gridService.Initialise(config);
319 gridService.Initialise(config); 246
320 m_gridService = gridService;
321 }
322 //else 247 //else
323 // config.Configs["GridService"].Set("LocalServiceModule", "OpenSim.Tests.Common.dll:TestGridService"); 248 // config.Configs["GridService"].Set("LocalServiceModule", "OpenSim.Tests.Common.dll:TestGridService");
324 m_gridService.AddRegion(testScene); 249 gridService.AddRegion(testScene);
325 m_gridService.RegionLoaded(testScene); 250 gridService.RegionLoaded(testScene);
326 //testScene.AddRegionModule(m_gridService.Name, m_gridService); 251 //testScene.AddRegionModule(m_gridService.Name, m_gridService);
252
253 return gridService;
327 } 254 }
328 255
329 /// <summary> 256 /// <summary>
330 /// Start a user account service 257 /// Start a user account service
331 /// </summary> 258 /// </summary>
332 /// <param name="testScene"></param> 259 /// <param name="testScene"></param>
333 private static void StartUserAccountService(Scene testScene) 260 /// <returns></returns>
261 private static LocalUserAccountServicesConnector StartUserAccountService(Scene testScene)
334 { 262 {
335 IConfigSource config = new IniConfigSource(); 263 IConfigSource config = new IniConfigSource();
336 config.AddConfig("Modules"); 264 config.AddConfig("Modules");
@@ -340,23 +268,21 @@ namespace OpenSim.Tests.Common.Setup
340 config.Configs["UserAccountService"].Set( 268 config.Configs["UserAccountService"].Set(
341 "LocalServiceModule", "OpenSim.Services.UserAccountService.dll:UserAccountService"); 269 "LocalServiceModule", "OpenSim.Services.UserAccountService.dll:UserAccountService");
342 270
343 if (m_userAccountService == null) 271 LocalUserAccountServicesConnector userAccountService = new LocalUserAccountServicesConnector();
344 { 272 userAccountService.Initialise(config);
345 ISharedRegionModule userAccountService = new LocalUserAccountServicesConnector();
346 userAccountService.Initialise(config);
347 m_userAccountService = userAccountService;
348 }
349 273
350 m_userAccountService.AddRegion(testScene); 274 userAccountService.AddRegion(testScene);
351 m_userAccountService.RegionLoaded(testScene); 275 userAccountService.RegionLoaded(testScene);
352 testScene.AddRegionModule(m_userAccountService.Name, m_userAccountService); 276 testScene.AddRegionModule(userAccountService.Name, userAccountService);
277
278 return userAccountService;
353 } 279 }
354 280
355 /// <summary> 281 /// <summary>
356 /// Start a presence service 282 /// Start a presence service
357 /// </summary> 283 /// </summary>
358 /// <param name="testScene"></param> 284 /// <param name="testScene"></param>
359 private static void StartPresenceService(Scene testScene) 285 private static LocalPresenceServicesConnector StartPresenceService(Scene testScene)
360 { 286 {
361 IConfigSource config = new IniConfigSource(); 287 IConfigSource config = new IniConfigSource();
362 config.AddConfig("Modules"); 288 config.AddConfig("Modules");
@@ -366,16 +292,14 @@ namespace OpenSim.Tests.Common.Setup
366 config.Configs["PresenceService"].Set( 292 config.Configs["PresenceService"].Set(
367 "LocalServiceModule", "OpenSim.Services.PresenceService.dll:PresenceService"); 293 "LocalServiceModule", "OpenSim.Services.PresenceService.dll:PresenceService");
368 294
369 if (m_presenceService == null) 295 LocalPresenceServicesConnector presenceService = new LocalPresenceServicesConnector();
370 { 296 presenceService.Initialise(config);
371 ISharedRegionModule presenceService = new LocalPresenceServicesConnector();
372 presenceService.Initialise(config);
373 m_presenceService = presenceService;
374 }
375 297
376 m_presenceService.AddRegion(testScene); 298 presenceService.AddRegion(testScene);
377 m_presenceService.RegionLoaded(testScene); 299 presenceService.RegionLoaded(testScene);
378 testScene.AddRegionModule(m_presenceService.Name, m_presenceService); 300 testScene.AddRegionModule(presenceService.Name, presenceService);
301
302 return presenceService;
379 } 303 }
380 304
381 /// <summary> 305 /// <summary>
@@ -472,7 +396,7 @@ namespace OpenSim.Tests.Common.Setup
472 /// <summary> 396 /// <summary>
473 /// Add a root agent. 397 /// Add a root agent.
474 /// </summary> 398 /// </summary>
475 /// 399 /// <remarks>
476 /// This function 400 /// This function
477 /// 401 ///
478 /// 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
@@ -483,7 +407,7 @@ namespace OpenSim.Tests.Common.Setup
483 /// 407 ///
484 /// 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
485 /// 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
486 /// 410 /// </remarks>
487 /// <param name="scene"></param> 411 /// <param name="scene"></param>
488 /// <param name="agentData"></param> 412 /// <param name="agentData"></param>
489 /// <returns></returns> 413 /// <returns></returns>
@@ -504,12 +428,10 @@ namespace OpenSim.Tests.Common.Setup
504 TestClient client = new TestClient(agentData, scene); 428 TestClient client = new TestClient(agentData, scene);
505 scene.AddNewClient(client); 429 scene.AddNewClient(client);
506 430
507 // Stage 3: Invoke agent crossing, which converts the child agent into a root agent (with appearance, 431 // Stage 3: Complete the entrance into the region. This converts the child agent into a root agent.
508 // inventory, etc.)
509 //scene.AgentCrossing(agentData.AgentID, new Vector3(90, 90, 90), false); OBSOLETE
510
511 ScenePresence scp = scene.GetScenePresence(agentData.AgentID); 432 ScenePresence scp = scene.GetScenePresence(agentData.AgentID);
512 scp.MakeRootAgent(new Vector3(90, 90, 90), true); 433 scp.CompleteMovement(client);
434 //scp.MakeRootAgent(new Vector3(90, 90, 90), true);
513 435
514 return client; 436 return client;
515 } 437 }
@@ -543,24 +465,5 @@ namespace OpenSim.Tests.Common.Setup
543 465
544 return part; 466 return part;
545 } 467 }
546
547 /// <summary>
548 /// Delete a scene object asynchronously
549 /// </summary>
550 /// <param name="scene"></param>
551 /// <param name="part"></param>
552 /// <param name="action"></param>
553 /// <param name="destinationId"></param>
554 /// <param name="client"></param>
555 public static void DeleteSceneObjectAsync(
556 TestScene scene, SceneObjectPart part, DeRezAction action, UUID destinationId, IClientAPI client)
557 {
558 // Turn off the timer on the async sog deleter - we'll crank it by hand within a unit test
559 AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter;
560 sogd.Enabled = false;
561
562 scene.DeRezObjects(client, new List<uint>() { part.LocalId }, UUID.Zero, action, destinationId);
563 sogd.InventoryDeQueueAndDelete();
564 }
565 } 468 }
566} 469}
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{
diff --git a/TESTING.txt b/TESTING.txt
index e0a7748..54fc976 100644
--- a/TESTING.txt
+++ b/TESTING.txt
@@ -2,23 +2,14 @@
2 2
3== Running Tests == 3== Running Tests ==
4 4
5On Linux: 5On Linux you will need to have NUnit installed (http://www.nunit.org).
6This is commonly available in distribution package repositories.
6 7
7 > nant test 8When this is installed, run the command
8
9This will print out to the console the test state.
10
11On Windows: Please see the TESTING ON WINDOWS section below.
12 9
10 > nant test
13 11
14Also, every checkin will run tests that are kicked off by bamboo. 12Please see the TESTING ON WINDOWS section below for Windows instructions.
15Results are posted here: http://www.opensimulator.org:8085/ as well as
16to #opensim-dev IRC channel.
17
18== Writing Tests ==
19
20Tests are written to run under NUnit. For more information on NUnit
21please see: http://www.nunit.org/index.php
22 13
23== Adding Tests == 14== Adding Tests ==
24 15
@@ -32,70 +23,15 @@ that if you are writing tests they end up in a "Tests" sub-directory
32of the directory where the code you are testing resides. 23of the directory where the code you are testing resides.
33 24
34If you have added a new test assembly that hasn't existed before you 25If you have added a new test assembly that hasn't existed before you
35must list it in both ".nant/local.include" and ".nant/bamboo.build" 26must list it in both ".nant/local.include"
36for it to be accessible to Linux users and to the continuous 27for it to be accessible to Linux users and to the continuous
37integration system. 28integration system.
38 29
39
40=== The Gory Details ===
41The following is the original document which started off this
42document. It should probably be better integrated with the new info.
43
44==UPDATE==
45
46The text immediately following is an update to the testing documentation. The
47update is written on 2008.08.30 and is copied from an email to the opensim-dev
48mailing list[1]. The information below the update, beginning with the section
49titled TESTING, is still relevant, so please read this document in its
50entirety.
51
52Mike Mazur
53
54[1] https://lists.berlios.de/pipermail/opensim-dev/2008-August/002695.html
55
56"""
57The tests are contained in certain DLLs. At the time of writing, these DLLs
58have tests in them:
59
60OpenSim.Region.ScriptEngine.Common.Tests.dll
61OpenSim.Region.ScriptEngine.Shared.CodeTools.Tests.dll
62OpenSim.Region.ScriptEngine.Shared.Tests.dll
63OpenSim.Framework.Tests.dll OpenSim.Region.CoreModules.dll
64OpenSim.Region.Physics.OdePlugin.dll[2]
65
66The console command used to run the tests is `nunit-console` (or
67`nunit-console2` on some systems). This command takes a listing of DLLs to
68inspect for tests.
69
70Currently Bamboo's[3] build file (.nant/bamboo.build) lists only those DLLs
71for nunit-console to use. However it would be equally correct to simply pass
72in all DLLs in bin/; those without tests are just skipped.
73
74The nunit-console command generates a file TestResults.txt by default. This is
75an XML file containing a listing of all DLLs inspected, tests executed,
76successes, failures, etc. If nunit-console is passed in all DLLs in bin/, this
77file bloats with lots of entries like this:
78
79 <test-suite name="/home/mike/source/workspace/bin/OpenSim.Grid.Communications.OGS1.dll" success="True" time="0.000" asserts="0">
80 <results />
81 </test-suite>
82 <test-suite name="/home/mike/source/workspace/bin/OpenSim.Region.ClientStack.dll" success="True" time="0.000" asserts="0">
83 <results />
84 </test-suite>
85
86Therefore it makes more sense to me to specify the DLLs when running
87nunit-console.
88
89[2] Note that OpenSim.Region.Physics.OdePlugin.dll is in bin/Physics/ and
90needs to be first copied to bin/ before nunit-console is executed.
91[3] http://opensimulator.org:8085/
92"""
93
94==TESTING ON WINDOWS== 30==TESTING ON WINDOWS==
95 31
96To use nunit testing on opensim code, you have a variety of methods. The 32To use nunit testing on opensim code, you have a variety of methods. The
97easiast methods involve using IDE capabilities to test code. Using 33easiast methods involve using IDE capabilities to test code. Using
98VS2005/2008 I recommend using the testing capabilities of Resarper(commercial) 34VS2005/2008 I recommend using the testing capabilities of Resharper(commercial)
99or TestDriven.Net(free). Both will recognize nunit tests within your 35or TestDriven.Net(free). Both will recognize nunit tests within your
100application and allow you to test them individually, or all at once, etc. You 36application and allow you to test them individually, or all at once, etc. You
101will also be able to step into debug mode into a test through these add-ins 37will also be able to step into debug mode into a test through these add-ins
@@ -133,6 +69,3 @@ Example
133 69
134nunit-console2 OpenSim.Framework.Tests.dll (on linux) 70nunit-console2 OpenSim.Framework.Tests.dll (on linux)
135nunit-console OpenSim.Framework.Tests.dll (on windows) 71nunit-console OpenSim.Framework.Tests.dll (on windows)
136
137For more information on testing contact the autor of this testing readme: Daedius Moskvitch ( daedius @@@@ daedius com)
138
diff --git a/bin/HttpServer_OpenSim.dll b/bin/HttpServer_OpenSim.dll
index a7a1303..95ea5dd 100644
--- a/bin/HttpServer_OpenSim.dll
+++ b/bin/HttpServer_OpenSim.dll
Binary files differ
diff --git a/bin/HttpServer_OpenSim.pdb b/bin/HttpServer_OpenSim.pdb
index c6f3b23..b6b77f7 100644
--- a/bin/HttpServer_OpenSim.pdb
+++ b/bin/HttpServer_OpenSim.pdb
Binary files differ
diff --git a/bin/MySql.Data.dll b/bin/MySql.Data.dll
index c28c618..992aa56 100644
--- a/bin/MySql.Data.dll
+++ b/bin/MySql.Data.dll
Binary files differ
diff --git a/bin/OpenSimDefaults.ini b/bin/OpenSimDefaults.ini
index 475d4a0..96ffb7e 100644
--- a/bin/OpenSimDefaults.ini
+++ b/bin/OpenSimDefaults.ini
@@ -94,6 +94,13 @@
94 ; Warning! Don't use this with regions that have existing content!, This will likely break them 94 ; Warning! Don't use this with regions that have existing content!, This will likely break them
95 CombineContiguousRegions = false 95 CombineContiguousRegions = false
96 96
97 ; Extend the region's draw distance; 255m is the default which includes
98 ; one neighbor on each side of the current region, 767m would go three
99 ; neighbors on each side for a total of 49 regions in view. Warning, unless
100 ; all the regions have the same drawdistance, you will end up with strange
101 ; effects because the agents that get closed may be inconsistent.
102 ; DefaultDrawDistance = 255.0
103
97 ; If you have only one region in an instance, or to avoid the many bugs 104 ; If you have only one region in an instance, or to avoid the many bugs
98 ; that you can trigger in modules by restarting a region, set this to 105 ; that you can trigger in modules by restarting a region, set this to
99 ; true to make the entire instance exit instead of restarting the region. 106 ; true to make the entire instance exit instead of restarting the region.
diff --git a/bin/Robust.HG.ini.example b/bin/Robust.HG.ini.example
index 9adf1ac..f12a143 100644
--- a/bin/Robust.HG.ini.example
+++ b/bin/Robust.HG.ini.example
@@ -72,7 +72,7 @@ ServiceConnectors = "8003/OpenSim.Server.Handlers.dll:AssetServiceConnector,8003
72 AssetService = "OpenSim.Services.AssetService.dll:AssetService" 72 AssetService = "OpenSim.Services.AssetService.dll:AssetService"
73 73
74 ;; Directory for map tile images of linked regions 74 ;; Directory for map tile images of linked regions
75 ; MapTileDirectory = "./" 75 ; MapTileDirectory = "./maptiles"
76 76
77 ;; Next, we can specify properties of regions, including default and fallback regions 77 ;; Next, we can specify properties of regions, including default and fallback regions
78 ;; The syntax is: Region_<RegionName> = "<flags>" 78 ;; The syntax is: Region_<RegionName> = "<flags>"
diff --git a/bin/config-include/GridCommon.ini.example b/bin/config-include/GridCommon.ini.example
index e1bcf00..4dc0e53 100644
--- a/bin/config-include/GridCommon.ini.example
+++ b/bin/config-include/GridCommon.ini.example
@@ -43,7 +43,7 @@
43 ;AllowHypergridMapSearch = true 43 ;AllowHypergridMapSearch = true
44 44
45 ;; Directory for map tile images of linked regions 45 ;; Directory for map tile images of linked regions
46 ; MapTileDirectory = "./" 46 ; MapTileDirectory = "./maptiles"
47 47
48[AvatarService] 48[AvatarService]
49 ; 49 ;
diff --git a/bin/config-include/StandaloneCommon.ini.example b/bin/config-include/StandaloneCommon.ini.example
index 213219c..816e9a6 100644
--- a/bin/config-include/StandaloneCommon.ini.example
+++ b/bin/config-include/StandaloneCommon.ini.example
@@ -70,7 +70,7 @@
70 ; Check4096 = true 70 ; Check4096 = true
71 71
72 ;; Directory for map tile images of remote regions 72 ;; Directory for map tile images of remote regions
73 ; MapTileDirectory = "./" 73 ; MapTileDirectory = "./maptiles"
74 74
75 ;; Next, we can specify properties of regions, including default and fallback regions 75 ;; Next, we can specify properties of regions, including default and fallback regions
76 ;; The syntax is: Region_<RegioName> = "<flags>" 76 ;; The syntax is: Region_<RegioName> = "<flags>"
diff --git a/bin/nunit.framework.dll b/bin/nunit.framework.dll
index d68d9f2..875e098 100644
--- a/bin/nunit.framework.dll
+++ b/bin/nunit.framework.dll
Binary files differ
diff --git a/prebuild.xml b/prebuild.xml
index cbe539e..b31812d 100644
--- a/prebuild.xml
+++ b/prebuild.xml
@@ -2927,6 +2927,7 @@
2927 <Match path="Avatar/Inventory/Archiver/Tests" pattern="*.cs" recurse="true"/> 2927 <Match path="Avatar/Inventory/Archiver/Tests" pattern="*.cs" recurse="true"/>
2928 <Match path="World/Archiver/Tests" pattern="*.cs" recurse="true"/> 2928 <Match path="World/Archiver/Tests" pattern="*.cs" recurse="true"/>
2929 <Match buildAction="EmbeddedResource" path="World/Archiver/Tests/Resources" pattern="*"/> 2929 <Match buildAction="EmbeddedResource" path="World/Archiver/Tests/Resources" pattern="*"/>
2930 <Match path="World/Media/Moap/Tests" pattern="*.cs" recurse="true"/>
2930 <Match path="World/Serialiser/Tests" pattern="*.cs" recurse="true"/> 2931 <Match path="World/Serialiser/Tests" pattern="*.cs" recurse="true"/>
2931 <Match path="World/Terrain/Tests" pattern="*.cs" recurse="true"/> 2932 <Match path="World/Terrain/Tests" pattern="*.cs" recurse="true"/>
2932 <Match path="ServiceConnectorsOut/Grid/Tests" pattern="*.cs" recurse="true"/> 2933 <Match path="ServiceConnectorsOut/Grid/Tests" pattern="*.cs" recurse="true"/>