diff options
author | Melanie | 2013-02-28 21:20:07 +0000 |
---|---|---|
committer | Melanie | 2013-02-28 21:20:07 +0000 |
commit | eb9458fd7e3a9098712f501cdcf05d71f741ec14 (patch) | |
tree | 1a719b0d89f22cefd04866db162694d0eb724d8d /OpenSim | |
parent | Merge branch 'master' into careminster (diff) | |
parent | Fix potential concurrency issue since the LSL notecard cache was not being ch... (diff) | |
download | opensim-SC-eb9458fd7e3a9098712f501cdcf05d71f741ec14.zip opensim-SC-eb9458fd7e3a9098712f501cdcf05d71f741ec14.tar.gz opensim-SC-eb9458fd7e3a9098712f501cdcf05d71f741ec14.tar.bz2 opensim-SC-eb9458fd7e3a9098712f501cdcf05d71f741ec14.tar.xz |
Merge branch 'master' into careminster
Conflicts:
OpenSim/Region/Framework/Scenes/SceneManager.cs
Diffstat (limited to '')
31 files changed, 478 insertions, 94 deletions
diff --git a/OpenSim/Addons/Groups/Hypergrid/HGGroupsServiceRobustConnector.cs b/OpenSim/Addons/Groups/Hypergrid/HGGroupsServiceRobustConnector.cs index 7cc9ff4..3584f78 100644 --- a/OpenSim/Addons/Groups/Hypergrid/HGGroupsServiceRobustConnector.cs +++ b/OpenSim/Addons/Groups/Hypergrid/HGGroupsServiceRobustConnector.cs | |||
@@ -65,7 +65,8 @@ namespace OpenSim.Groups | |||
65 | 65 | ||
66 | m_log.DebugFormat("[Groups.RobustHGConnector]: Starting with config name {0}", m_ConfigName); | 66 | m_log.DebugFormat("[Groups.RobustHGConnector]: Starting with config name {0}", m_ConfigName); |
67 | 67 | ||
68 | string homeURI = Util.GetConfigVarFromSections<string>(config, "HomeURI", new string[] { "Startup", m_ConfigName} ); //cnf.GetString("HomeURI", string.Empty); | 68 | string homeURI = Util.GetConfigVarFromSections<string>(config, "HomeURI", |
69 | new string[] { "Startup", "Hypergrid", m_ConfigName}, string.Empty); | ||
69 | if (homeURI == string.Empty) | 70 | if (homeURI == string.Empty) |
70 | throw new Exception(String.Format("[Groups.RobustHGConnector]: please provide the HomeURI [Startup] or in section {0}", m_ConfigName)); | 71 | throw new Exception(String.Format("[Groups.RobustHGConnector]: please provide the HomeURI [Startup] or in section {0}", m_ConfigName)); |
71 | 72 | ||
diff --git a/OpenSim/Data/MSSQL/MSSQLAssetData.cs b/OpenSim/Data/MSSQL/MSSQLAssetData.cs index c882555..12f2477 100644 --- a/OpenSim/Data/MSSQL/MSSQLAssetData.cs +++ b/OpenSim/Data/MSSQL/MSSQLAssetData.cs | |||
@@ -163,14 +163,18 @@ namespace OpenSim.Data.MSSQL | |||
163 | if (asset.Name.Length > 64) | 163 | if (asset.Name.Length > 64) |
164 | { | 164 | { |
165 | assetName = asset.Name.Substring(0, 64); | 165 | assetName = asset.Name.Substring(0, 64); |
166 | m_log.Warn("[ASSET DB]: Name field truncated from " + asset.Name.Length + " to " + assetName.Length + " characters on add"); | 166 | m_log.WarnFormat( |
167 | "[ASSET DB]: Name '{0}' for asset {1} truncated from {2} to {3} characters on add", | ||
168 | asset.Name, asset.ID, asset.Name.Length, assetName.Length); | ||
167 | } | 169 | } |
168 | 170 | ||
169 | string assetDescription = asset.Description; | 171 | string assetDescription = asset.Description; |
170 | if (asset.Description.Length > 64) | 172 | if (asset.Description.Length > 64) |
171 | { | 173 | { |
172 | assetDescription = asset.Description.Substring(0, 64); | 174 | assetDescription = asset.Description.Substring(0, 64); |
173 | m_log.Warn("[ASSET DB]: Description field truncated from " + asset.Description.Length + " to " + assetDescription.Length + " characters on add"); | 175 | m_log.WarnFormat( |
176 | "[ASSET DB]: Description '{0}' for asset {1} truncated from {2} to {3} characters on add", | ||
177 | asset.Description, asset.ID, asset.Description.Length, assetDescription.Length); | ||
174 | } | 178 | } |
175 | 179 | ||
176 | using (SqlConnection conn = new SqlConnection(m_connectionString)) | 180 | using (SqlConnection conn = new SqlConnection(m_connectionString)) |
diff --git a/OpenSim/Data/MySQL/MySQLAssetData.cs b/OpenSim/Data/MySQL/MySQLAssetData.cs index 20df234..21dd5aa 100644 --- a/OpenSim/Data/MySQL/MySQLAssetData.cs +++ b/OpenSim/Data/MySQL/MySQLAssetData.cs | |||
@@ -173,14 +173,18 @@ namespace OpenSim.Data.MySQL | |||
173 | if (asset.Name.Length > 64) | 173 | if (asset.Name.Length > 64) |
174 | { | 174 | { |
175 | assetName = asset.Name.Substring(0, 64); | 175 | assetName = asset.Name.Substring(0, 64); |
176 | m_log.Warn("[ASSET DB]: Name field truncated from " + asset.Name.Length + " to " + assetName.Length + " characters on add"); | 176 | m_log.WarnFormat( |
177 | "[ASSET DB]: Name '{0}' for asset {1} truncated from {2} to {3} characters on add", | ||
178 | asset.Name, asset.ID, asset.Name.Length, assetName.Length); | ||
177 | } | 179 | } |
178 | 180 | ||
179 | string assetDescription = asset.Description; | 181 | string assetDescription = asset.Description; |
180 | if (asset.Description.Length > 64) | 182 | if (asset.Description.Length > 64) |
181 | { | 183 | { |
182 | assetDescription = asset.Description.Substring(0, 64); | 184 | assetDescription = asset.Description.Substring(0, 64); |
183 | m_log.Warn("[ASSET DB]: Description field truncated from " + asset.Description.Length + " to " + assetDescription.Length + " characters on add"); | 185 | m_log.WarnFormat( |
186 | "[ASSET DB]: Description '{0}' for asset {1} truncated from {2} to {3} characters on add", | ||
187 | asset.Description, asset.ID, asset.Description.Length, assetDescription.Length); | ||
184 | } | 188 | } |
185 | 189 | ||
186 | try | 190 | try |
diff --git a/OpenSim/Data/MySQL/MySQLXAssetData.cs b/OpenSim/Data/MySQL/MySQLXAssetData.cs index 9a50373..d561c89 100644 --- a/OpenSim/Data/MySQL/MySQLXAssetData.cs +++ b/OpenSim/Data/MySQL/MySQLXAssetData.cs | |||
@@ -204,14 +204,18 @@ namespace OpenSim.Data.MySQL | |||
204 | if (asset.Name.Length > 64) | 204 | if (asset.Name.Length > 64) |
205 | { | 205 | { |
206 | assetName = asset.Name.Substring(0, 64); | 206 | assetName = asset.Name.Substring(0, 64); |
207 | m_log.Warn("[XASSET DB]: Name field truncated from " + asset.Name.Length + " to " + assetName.Length + " characters on add"); | 207 | m_log.WarnFormat( |
208 | "[XASSET DB]: Name '{0}' for asset {1} truncated from {2} to {3} characters on add", | ||
209 | asset.Name, asset.ID, asset.Name.Length, assetName.Length); | ||
208 | } | 210 | } |
209 | 211 | ||
210 | string assetDescription = asset.Description; | 212 | string assetDescription = asset.Description; |
211 | if (asset.Description.Length > 64) | 213 | if (asset.Description.Length > 64) |
212 | { | 214 | { |
213 | assetDescription = asset.Description.Substring(0, 64); | 215 | assetDescription = asset.Description.Substring(0, 64); |
214 | m_log.Warn("[XASSET DB]: Description field truncated from " + asset.Description.Length + " to " + assetDescription.Length + " characters on add"); | 216 | m_log.WarnFormat( |
217 | "[XASSET DB]: Description '{0}' for asset {1} truncated from {2} to {3} characters on add", | ||
218 | asset.Description, asset.ID, asset.Description.Length, assetDescription.Length); | ||
215 | } | 219 | } |
216 | 220 | ||
217 | if (m_enableCompression) | 221 | if (m_enableCompression) |
diff --git a/OpenSim/Data/SQLite/SQLiteAssetData.cs b/OpenSim/Data/SQLite/SQLiteAssetData.cs index b94a58c..82320ca 100644 --- a/OpenSim/Data/SQLite/SQLiteAssetData.cs +++ b/OpenSim/Data/SQLite/SQLiteAssetData.cs | |||
@@ -46,7 +46,7 @@ namespace OpenSim.Data.SQLite | |||
46 | /// </summary> | 46 | /// </summary> |
47 | public class SQLiteAssetData : AssetDataBase | 47 | public class SQLiteAssetData : AssetDataBase |
48 | { | 48 | { |
49 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 49 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
50 | 50 | ||
51 | private const string SelectAssetSQL = "select * from assets where UUID=:UUID"; | 51 | private const string SelectAssetSQL = "select * from assets where UUID=:UUID"; |
52 | private const string SelectAssetMetadataSQL = "select Name, Description, Type, Temporary, asset_flags, UUID, CreatorID from assets limit :start, :count"; | 52 | private const string SelectAssetMetadataSQL = "select Name, Description, Type, Temporary, asset_flags, UUID, CreatorID from assets limit :start, :count"; |
@@ -133,6 +133,24 @@ namespace OpenSim.Data.SQLite | |||
133 | /// <param name="asset">Asset Base</param> | 133 | /// <param name="asset">Asset Base</param> |
134 | override public bool StoreAsset(AssetBase asset) | 134 | override public bool StoreAsset(AssetBase asset) |
135 | { | 135 | { |
136 | string assetName = asset.Name; | ||
137 | if (asset.Name.Length > 64) | ||
138 | { | ||
139 | assetName = asset.Name.Substring(0, 64); | ||
140 | m_log.WarnFormat( | ||
141 | "[ASSET DB]: Name '{0}' for asset {1} truncated from {2} to {3} characters on add", | ||
142 | asset.Name, asset.ID, asset.Name.Length, assetName.Length); | ||
143 | } | ||
144 | |||
145 | string assetDescription = asset.Description; | ||
146 | if (asset.Description.Length > 64) | ||
147 | { | ||
148 | assetDescription = asset.Description.Substring(0, 64); | ||
149 | m_log.WarnFormat( | ||
150 | "[ASSET DB]: Description '{0}' for asset {1} truncated from {2} to {3} characters on add", | ||
151 | asset.Description, asset.ID, asset.Description.Length, assetDescription.Length); | ||
152 | } | ||
153 | |||
136 | //m_log.Info("[ASSET DB]: Creating Asset " + asset.FullID.ToString()); | 154 | //m_log.Info("[ASSET DB]: Creating Asset " + asset.FullID.ToString()); |
137 | if (ExistsAsset(asset.FullID)) | 155 | if (ExistsAsset(asset.FullID)) |
138 | { | 156 | { |
@@ -143,8 +161,8 @@ namespace OpenSim.Data.SQLite | |||
143 | using (SqliteCommand cmd = new SqliteCommand(UpdateAssetSQL, m_conn)) | 161 | using (SqliteCommand cmd = new SqliteCommand(UpdateAssetSQL, m_conn)) |
144 | { | 162 | { |
145 | cmd.Parameters.Add(new SqliteParameter(":UUID", asset.FullID.ToString())); | 163 | cmd.Parameters.Add(new SqliteParameter(":UUID", asset.FullID.ToString())); |
146 | cmd.Parameters.Add(new SqliteParameter(":Name", asset.Name)); | 164 | cmd.Parameters.Add(new SqliteParameter(":Name", assetName)); |
147 | cmd.Parameters.Add(new SqliteParameter(":Description", asset.Description)); | 165 | cmd.Parameters.Add(new SqliteParameter(":Description", assetDescription)); |
148 | cmd.Parameters.Add(new SqliteParameter(":Type", asset.Type)); | 166 | cmd.Parameters.Add(new SqliteParameter(":Type", asset.Type)); |
149 | cmd.Parameters.Add(new SqliteParameter(":Local", asset.Local)); | 167 | cmd.Parameters.Add(new SqliteParameter(":Local", asset.Local)); |
150 | cmd.Parameters.Add(new SqliteParameter(":Temporary", asset.Temporary)); | 168 | cmd.Parameters.Add(new SqliteParameter(":Temporary", asset.Temporary)); |
@@ -164,8 +182,8 @@ namespace OpenSim.Data.SQLite | |||
164 | using (SqliteCommand cmd = new SqliteCommand(InsertAssetSQL, m_conn)) | 182 | using (SqliteCommand cmd = new SqliteCommand(InsertAssetSQL, m_conn)) |
165 | { | 183 | { |
166 | cmd.Parameters.Add(new SqliteParameter(":UUID", asset.FullID.ToString())); | 184 | cmd.Parameters.Add(new SqliteParameter(":UUID", asset.FullID.ToString())); |
167 | cmd.Parameters.Add(new SqliteParameter(":Name", asset.Name)); | 185 | cmd.Parameters.Add(new SqliteParameter(":Name", assetName)); |
168 | cmd.Parameters.Add(new SqliteParameter(":Description", asset.Description)); | 186 | cmd.Parameters.Add(new SqliteParameter(":Description", assetDescription)); |
169 | cmd.Parameters.Add(new SqliteParameter(":Type", asset.Type)); | 187 | cmd.Parameters.Add(new SqliteParameter(":Type", asset.Type)); |
170 | cmd.Parameters.Add(new SqliteParameter(":Local", asset.Local)); | 188 | cmd.Parameters.Add(new SqliteParameter(":Local", asset.Local)); |
171 | cmd.Parameters.Add(new SqliteParameter(":Temporary", asset.Temporary)); | 189 | cmd.Parameters.Add(new SqliteParameter(":Temporary", asset.Temporary)); |
diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index e1cff69..a5b9443 100644 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs | |||
@@ -30,6 +30,7 @@ using System.Collections; | |||
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using System.Diagnostics; | 31 | using System.Diagnostics; |
32 | using System.IO; | 32 | using System.IO; |
33 | using System.Linq; | ||
33 | using System.Reflection; | 34 | using System.Reflection; |
34 | using System.Text; | 35 | using System.Text; |
35 | using System.Text.RegularExpressions; | 36 | using System.Text.RegularExpressions; |
@@ -808,16 +809,28 @@ namespace OpenSim | |||
808 | break; | 809 | break; |
809 | 810 | ||
810 | case "modules": | 811 | case "modules": |
811 | SceneManager.ForEachScene( | 812 | SceneManager.ForEachSelectedScene( |
812 | delegate(Scene scene) { | 813 | scene => |
813 | MainConsole.Instance.Output("Loaded region modules in" + scene.RegionInfo.RegionName + " are:"); | ||
814 | foreach (IRegionModuleBase module in scene.RegionModules.Values) | ||
815 | { | 814 | { |
816 | Type type = module.GetType().GetInterface("ISharedRegionModule"); | 815 | MainConsole.Instance.OutputFormat("Loaded region modules in {0} are:", scene.Name); |
817 | string module_type = type != null ? "Shared" : "Non-Shared"; | 816 | |
818 | MainConsole.Instance.OutputFormat("New Region Module ({0}): {1}", module_type, module.Name); | 817 | List<IRegionModuleBase> sharedModules = new List<IRegionModuleBase>(); |
818 | List<IRegionModuleBase> nonSharedModules = new List<IRegionModuleBase>(); | ||
819 | |||
820 | foreach (IRegionModuleBase module in scene.RegionModules.Values) | ||
821 | { | ||
822 | if (module.GetType().GetInterface("ISharedRegionModule") != null) | ||
823 | nonSharedModules.Add(module); | ||
824 | else | ||
825 | sharedModules.Add(module); | ||
826 | } | ||
827 | |||
828 | foreach (IRegionModuleBase module in sharedModules.OrderBy(m => m.Name)) | ||
829 | MainConsole.Instance.OutputFormat("New Region Module (Shared): {0}", module.Name); | ||
830 | |||
831 | foreach (IRegionModuleBase module in sharedModules.OrderBy(m => m.Name)) | ||
832 | MainConsole.Instance.OutputFormat("New Region Module (Non-Shared): {0}", module.Name); | ||
819 | } | 833 | } |
820 | } | ||
821 | ); | 834 | ); |
822 | 835 | ||
823 | MainConsole.Instance.Output(""); | 836 | MainConsole.Instance.Output(""); |
diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index 3f63534..7361f50 100644 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs | |||
@@ -752,7 +752,7 @@ namespace OpenSim | |||
752 | // listenIP = IPAddress.Parse("0.0.0.0"); | 752 | // listenIP = IPAddress.Parse("0.0.0.0"); |
753 | 753 | ||
754 | uint port = (uint) regionInfo.InternalEndPoint.Port; | 754 | uint port = (uint) regionInfo.InternalEndPoint.Port; |
755 | IClientNetworkServer clientNetworkServer; | 755 | |
756 | if (m_autoCreateClientStack) | 756 | if (m_autoCreateClientStack) |
757 | { | 757 | { |
758 | clientNetworkServers = m_clientStackManager.CreateServers( | 758 | clientNetworkServers = m_clientStackManager.CreateServers( |
diff --git a/OpenSim/Region/CoreModules/Avatar/Lure/HGLureModule.cs b/OpenSim/Region/CoreModules/Avatar/Lure/HGLureModule.cs index 22cdc80..6c9fd86 100644 --- a/OpenSim/Region/CoreModules/Avatar/Lure/HGLureModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Lure/HGLureModule.cs | |||
@@ -65,7 +65,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Lure | |||
65 | { | 65 | { |
66 | m_Enabled = true; | 66 | m_Enabled = true; |
67 | 67 | ||
68 | m_ThisGridURL = Util.GetConfigVarFromSections<string>(config, "GatekeeperURI", new string[] {"Startup", "Messaging"}); | 68 | m_ThisGridURL = Util.GetConfigVarFromSections<string>(config, "GatekeeperURI", |
69 | new string[] { "Startup", "Hypergrid", "Messaging" }, String.Empty); | ||
69 | // Legacy. Remove soon! | 70 | // Legacy. Remove soon! |
70 | m_ThisGridURL = config.Configs["Messaging"].GetString("Gatekeeper", m_ThisGridURL); | 71 | m_ThisGridURL = config.Configs["Messaging"].GetString("Gatekeeper", m_ThisGridURL); |
71 | m_log.DebugFormat("[LURE MODULE]: {0} enabled", Name); | 72 | m_log.DebugFormat("[LURE MODULE]: {0} enabled", Name); |
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs index 4f6b92e..b2b628d 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs | |||
@@ -88,8 +88,10 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
88 | IConfig thisModuleConfig = source.Configs["HGInventoryAccessModule"]; | 88 | IConfig thisModuleConfig = source.Configs["HGInventoryAccessModule"]; |
89 | if (thisModuleConfig != null) | 89 | if (thisModuleConfig != null) |
90 | { | 90 | { |
91 | m_HomeURI = Util.GetConfigVarFromSections<string>(source, "HomeURI", new string[] {"Startup", "HGInventoryAccessModule"}); | 91 | m_HomeURI = Util.GetConfigVarFromSections<string>(source, "HomeURI", |
92 | m_ThisGatekeeper = Util.GetConfigVarFromSections<string>(source, "GatekeeperURI", new string[] {"Startup", "HGInventoryAccessModule"}); | 92 | new string[] { "Startup", "Hypergrid", "HGInventoryAccessModule" }, String.Empty); |
93 | m_ThisGatekeeper = Util.GetConfigVarFromSections<string>(source, "GatekeeperURI", | ||
94 | new string[] { "Startup", "Hypergrid", "HGInventoryAccessModule" }, String.Empty); | ||
93 | // Legacy. Renove soon! | 95 | // Legacy. Renove soon! |
94 | m_ThisGatekeeper = thisModuleConfig.GetString("Gatekeeper", m_ThisGatekeeper); | 96 | m_ThisGatekeeper = thisModuleConfig.GetString("Gatekeeper", m_ThisGatekeeper); |
95 | 97 | ||
diff --git a/OpenSim/Region/DataSnapshot/DataSnapshotManager.cs b/OpenSim/Region/DataSnapshot/DataSnapshotManager.cs index e8bf194..32017a8 100644 --- a/OpenSim/Region/DataSnapshot/DataSnapshotManager.cs +++ b/OpenSim/Region/DataSnapshot/DataSnapshotManager.cs | |||
@@ -113,7 +113,8 @@ namespace OpenSim.Region.DataSnapshot | |||
113 | try | 113 | try |
114 | { | 114 | { |
115 | m_enabled = config.Configs["DataSnapshot"].GetBoolean("index_sims", m_enabled); | 115 | m_enabled = config.Configs["DataSnapshot"].GetBoolean("index_sims", m_enabled); |
116 | string gatekeeper = Util.GetConfigVarFromSections<string>(config, "GatekeeperURI", new string[] {"Startup", "GridService"}); | 116 | string gatekeeper = Util.GetConfigVarFromSections<string>(config, "GatekeeperURI", |
117 | new string[] { "Startup", "Hypergrid", "GridService" }, String.Empty); | ||
117 | // Legacy. Remove soon! | 118 | // Legacy. Remove soon! |
118 | if (string.IsNullOrEmpty(gatekeeper)) | 119 | if (string.IsNullOrEmpty(gatekeeper)) |
119 | { | 120 | { |
diff --git a/OpenSim/Region/Framework/Scenes/SceneManager.cs b/OpenSim/Region/Framework/Scenes/SceneManager.cs index 0e0b6c3..c307f7a 100644 --- a/OpenSim/Region/Framework/Scenes/SceneManager.cs +++ b/OpenSim/Region/Framework/Scenes/SceneManager.cs | |||
@@ -313,35 +313,30 @@ namespace OpenSim.Region.Framework.Scenes | |||
313 | 313 | ||
314 | public void SendCommandToPluginModules(string[] cmdparams) | 314 | public void SendCommandToPluginModules(string[] cmdparams) |
315 | { | 315 | { |
316 | ForEachCurrentScene(delegate(Scene scene) { scene.SendCommandToPlugins(cmdparams); }); | 316 | ForEachSelectedScene(delegate(Scene scene) { scene.SendCommandToPlugins(cmdparams); }); |
317 | } | 317 | } |
318 | 318 | ||
319 | public void SetBypassPermissionsOnCurrentScene(bool bypassPermissions) | 319 | public void SetBypassPermissionsOnCurrentScene(bool bypassPermissions) |
320 | { | 320 | { |
321 | ForEachCurrentScene(delegate(Scene scene) { scene.Permissions.SetBypassPermissions(bypassPermissions); }); | 321 | ForEachSelectedScene(delegate(Scene scene) { scene.Permissions.SetBypassPermissions(bypassPermissions); }); |
322 | } | 322 | } |
323 | 323 | ||
324 | private void ForEachCurrentScene(Action<Scene> func) | 324 | public void ForEachSelectedScene(Action<Scene> func) |
325 | { | 325 | { |
326 | if (CurrentScene == null) | 326 | if (CurrentScene == null) |
327 | { | 327 | ForEachScene(func); |
328 | List<Scene> sceneList = Scenes; | ||
329 | sceneList.ForEach(func); | ||
330 | } | ||
331 | else | 328 | else |
332 | { | ||
333 | func(CurrentScene); | 329 | func(CurrentScene); |
334 | } | ||
335 | } | 330 | } |
336 | 331 | ||
337 | public void RestartCurrentScene() | 332 | public void RestartCurrentScene() |
338 | { | 333 | { |
339 | ForEachCurrentScene(delegate(Scene scene) { scene.RestartNow(); }); | 334 | ForEachSelectedScene(delegate(Scene scene) { scene.RestartNow(); }); |
340 | } | 335 | } |
341 | 336 | ||
342 | public void BackupCurrentScene() | 337 | public void BackupCurrentScene() |
343 | { | 338 | { |
344 | ForEachCurrentScene(delegate(Scene scene) { scene.Backup(true); }); | 339 | ForEachSelectedScene(delegate(Scene scene) { scene.Backup(true); }); |
345 | } | 340 | } |
346 | 341 | ||
347 | public bool TrySetCurrentScene(string regionName) | 342 | public bool TrySetCurrentScene(string regionName) |
@@ -434,7 +429,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
434 | /// <param name="name">Name of avatar to debug</param> | 429 | /// <param name="name">Name of avatar to debug</param> |
435 | public void SetDebugPacketLevelOnCurrentScene(int newDebug, string name) | 430 | public void SetDebugPacketLevelOnCurrentScene(int newDebug, string name) |
436 | { | 431 | { |
437 | ForEachCurrentScene(scene => | 432 | ForEachSelectedScene(scene => |
438 | scene.ForEachScenePresence(sp => | 433 | scene.ForEachScenePresence(sp => |
439 | { | 434 | { |
440 | if (name == null || sp.Name == name) | 435 | if (name == null || sp.Name == name) |
@@ -453,7 +448,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
453 | { | 448 | { |
454 | List<ScenePresence> avatars = new List<ScenePresence>(); | 449 | List<ScenePresence> avatars = new List<ScenePresence>(); |
455 | 450 | ||
456 | ForEachCurrentScene( | 451 | ForEachSelectedScene( |
457 | delegate(Scene scene) | 452 | delegate(Scene scene) |
458 | { | 453 | { |
459 | scene.ForEachRootScenePresence(delegate(ScenePresence scenePresence) | 454 | scene.ForEachRootScenePresence(delegate(ScenePresence scenePresence) |
@@ -470,7 +465,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
470 | { | 465 | { |
471 | List<ScenePresence> presences = new List<ScenePresence>(); | 466 | List<ScenePresence> presences = new List<ScenePresence>(); |
472 | 467 | ||
473 | ForEachCurrentScene(delegate(Scene scene) | 468 | ForEachSelectedScene(delegate(Scene scene) |
474 | { | 469 | { |
475 | scene.ForEachScenePresence(delegate(ScenePresence sp) | 470 | scene.ForEachScenePresence(delegate(ScenePresence sp) |
476 | { | 471 | { |
@@ -494,12 +489,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
494 | 489 | ||
495 | public void ForceCurrentSceneClientUpdate() | 490 | public void ForceCurrentSceneClientUpdate() |
496 | { | 491 | { |
497 | ForEachCurrentScene(delegate(Scene scene) { scene.ForceClientUpdate(); }); | 492 | ForEachSelectedScene(delegate(Scene scene) { scene.ForceClientUpdate(); }); |
498 | } | 493 | } |
499 | 494 | ||
500 | public void HandleEditCommandOnCurrentScene(string[] cmdparams) | 495 | public void HandleEditCommandOnCurrentScene(string[] cmdparams) |
501 | { | 496 | { |
502 | ForEachCurrentScene(delegate(Scene scene) { scene.HandleEditCommand(cmdparams); }); | 497 | ForEachSelectedScene(delegate(Scene scene) { scene.HandleEditCommand(cmdparams); }); |
503 | } | 498 | } |
504 | 499 | ||
505 | public bool TryGetScenePresence(UUID avatarId, out ScenePresence avatar) | 500 | public bool TryGetScenePresence(UUID avatarId, out ScenePresence avatar) |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs index df819ec..6e0ea7d 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs | |||
@@ -130,7 +130,7 @@ namespace OpenSim.Region.Framework.Tests | |||
130 | SceneObjectPart sop1 = sog1.RootPart; | 130 | SceneObjectPart sop1 = sog1.RootPart; |
131 | TaskInventoryItem sopItem1 | 131 | TaskInventoryItem sopItem1 |
132 | = TaskInventoryHelpers.AddNotecard( | 132 | = TaskInventoryHelpers.AddNotecard( |
133 | scene, sop1, "ncItem", TestHelpers.ParseTail(0x800), TestHelpers.ParseTail(0x900)); | 133 | scene, sop1, "ncItem", TestHelpers.ParseTail(0x800), TestHelpers.ParseTail(0x900), "Hello World!"); |
134 | 134 | ||
135 | InventoryFolderBase folder | 135 | InventoryFolderBase folder |
136 | = InventoryArchiveUtils.FindFoldersByPath(scene.InventoryService, user1.PrincipalID, "Objects")[0]; | 136 | = InventoryArchiveUtils.FindFoldersByPath(scene.InventoryService, user1.PrincipalID, "Objects")[0]; |
@@ -162,7 +162,7 @@ namespace OpenSim.Region.Framework.Tests | |||
162 | SceneObjectPart sop1 = sog1.RootPart; | 162 | SceneObjectPart sop1 = sog1.RootPart; |
163 | TaskInventoryItem sopItem1 | 163 | TaskInventoryItem sopItem1 |
164 | = TaskInventoryHelpers.AddNotecard( | 164 | = TaskInventoryHelpers.AddNotecard( |
165 | scene, sop1, "ncItem", TestHelpers.ParseTail(0x800), TestHelpers.ParseTail(0x900)); | 165 | scene, sop1, "ncItem", TestHelpers.ParseTail(0x800), TestHelpers.ParseTail(0x900), "Hello World!"); |
166 | 166 | ||
167 | // Perform test | 167 | // Perform test |
168 | scene.MoveTaskInventoryItem(user1.PrincipalID, UUID.Zero, sop1, sopItem1.ItemID); | 168 | scene.MoveTaskInventoryItem(user1.PrincipalID, UUID.Zero, sop1, sopItem1.ItemID); |
diff --git a/OpenSim/Region/OptionalModules/Example/BareBonesNonShared/BareBonesNonSharedModule.cs b/OpenSim/Region/OptionalModules/Example/BareBonesNonShared/BareBonesNonSharedModule.cs index 7d37135..ad2fc7a 100644 --- a/OpenSim/Region/OptionalModules/Example/BareBonesNonShared/BareBonesNonSharedModule.cs +++ b/OpenSim/Region/OptionalModules/Example/BareBonesNonShared/BareBonesNonSharedModule.cs | |||
@@ -33,6 +33,11 @@ using Nini.Config; | |||
33 | using OpenSim.Region.Framework.Interfaces; | 33 | using OpenSim.Region.Framework.Interfaces; |
34 | using OpenSim.Region.Framework.Scenes; | 34 | using OpenSim.Region.Framework.Scenes; |
35 | 35 | ||
36 | // You will need to uncomment this line if you are adding a region module to some other assembly which does not already | ||
37 | // specify its assembly. Otherwise, the region modules in the assembly will not be picked up when OpenSimulator scans | ||
38 | // the available DLLs | ||
39 | //[assembly: Addin("MyModule", "1.0")] | ||
40 | |||
36 | namespace OpenSim.Region.OptionalModules.Example.BareBonesNonShared | 41 | namespace OpenSim.Region.OptionalModules.Example.BareBonesNonShared |
37 | { | 42 | { |
38 | /// <summary> | 43 | /// <summary> |
diff --git a/OpenSim/Region/OptionalModules/Example/BareBonesShared/BareBonesSharedModule.cs b/OpenSim/Region/OptionalModules/Example/BareBonesShared/BareBonesSharedModule.cs index 781fe95..bb9cbb7 100644 --- a/OpenSim/Region/OptionalModules/Example/BareBonesShared/BareBonesSharedModule.cs +++ b/OpenSim/Region/OptionalModules/Example/BareBonesShared/BareBonesSharedModule.cs | |||
@@ -33,6 +33,11 @@ using Nini.Config; | |||
33 | using OpenSim.Region.Framework.Interfaces; | 33 | using OpenSim.Region.Framework.Interfaces; |
34 | using OpenSim.Region.Framework.Scenes; | 34 | using OpenSim.Region.Framework.Scenes; |
35 | 35 | ||
36 | // You will need to uncomment this line if you are adding a region module to some other assembly which does not already | ||
37 | // specify its assembly. Otherwise, the region modules in the assembly will not be picked up when OpenSimulator scans | ||
38 | // the available DLLs | ||
39 | //[assembly: Addin("MyModule", "1.0")] | ||
40 | |||
36 | namespace OpenSim.Region.OptionalModules.Example.BareBonesShared | 41 | namespace OpenSim.Region.OptionalModules.Example.BareBonesShared |
37 | { | 42 | { |
38 | /// <summary> | 43 | /// <summary> |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index b67db20..29476b9 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -11728,14 +11728,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
11728 | return UUID.Zero.ToString(); | 11728 | return UUID.Zero.ToString(); |
11729 | } | 11729 | } |
11730 | 11730 | ||
11731 | string reqIdentifier = UUID.Random().ToString(); | ||
11732 | |||
11731 | // was: UUID tid = tid = AsyncCommands. | 11733 | // was: UUID tid = tid = AsyncCommands. |
11732 | UUID tid = AsyncCommands.DataserverPlugin.RegisterRequest(m_host.LocalId, m_item.ItemID, assetID.ToString()); | 11734 | UUID tid = AsyncCommands.DataserverPlugin.RegisterRequest(m_host.LocalId, m_item.ItemID, reqIdentifier); |
11733 | 11735 | ||
11734 | if (NotecardCache.IsCached(assetID)) | 11736 | if (NotecardCache.IsCached(assetID)) |
11735 | { | 11737 | { |
11736 | AsyncCommands. | 11738 | AsyncCommands.DataserverPlugin.DataserverReply(reqIdentifier, NotecardCache.GetLines(assetID).ToString()); |
11737 | DataserverPlugin.DataserverReply(assetID.ToString(), | 11739 | |
11738 | NotecardCache.GetLines(assetID).ToString()); | ||
11739 | ScriptSleep(100); | 11740 | ScriptSleep(100); |
11740 | return tid.ToString(); | 11741 | return tid.ToString(); |
11741 | } | 11742 | } |
@@ -11751,9 +11752,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
11751 | string data = Encoding.UTF8.GetString(a.Data); | 11752 | string data = Encoding.UTF8.GetString(a.Data); |
11752 | //m_log.Debug(data); | 11753 | //m_log.Debug(data); |
11753 | NotecardCache.Cache(id, data); | 11754 | NotecardCache.Cache(id, data); |
11754 | AsyncCommands. | 11755 | AsyncCommands.DataserverPlugin.DataserverReply(reqIdentifier, NotecardCache.GetLines(id).ToString()); |
11755 | DataserverPlugin.DataserverReply(id.ToString(), | ||
11756 | NotecardCache.GetLines(id).ToString()); | ||
11757 | }); | 11756 | }); |
11758 | 11757 | ||
11759 | ScriptSleep(100); | 11758 | ScriptSleep(100); |
@@ -11782,13 +11781,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
11782 | return UUID.Zero.ToString(); | 11781 | return UUID.Zero.ToString(); |
11783 | } | 11782 | } |
11784 | 11783 | ||
11784 | string reqIdentifier = UUID.Random().ToString(); | ||
11785 | |||
11785 | // was: UUID tid = tid = AsyncCommands. | 11786 | // was: UUID tid = tid = AsyncCommands. |
11786 | UUID tid = AsyncCommands.DataserverPlugin.RegisterRequest(m_host.LocalId, m_item.ItemID, assetID.ToString()); | 11787 | UUID tid = AsyncCommands.DataserverPlugin.RegisterRequest(m_host.LocalId, m_item.ItemID, reqIdentifier); |
11787 | 11788 | ||
11788 | if (NotecardCache.IsCached(assetID)) | 11789 | if (NotecardCache.IsCached(assetID)) |
11789 | { | 11790 | { |
11790 | AsyncCommands.DataserverPlugin.DataserverReply(assetID.ToString(), | 11791 | AsyncCommands.DataserverPlugin.DataserverReply( |
11791 | NotecardCache.GetLine(assetID, line, m_notecardLineReadCharsMax)); | 11792 | reqIdentifier, NotecardCache.GetLine(assetID, line, m_notecardLineReadCharsMax)); |
11793 | |||
11792 | ScriptSleep(100); | 11794 | ScriptSleep(100); |
11793 | return tid.ToString(); | 11795 | return tid.ToString(); |
11794 | } | 11796 | } |
@@ -11804,8 +11806,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
11804 | string data = Encoding.UTF8.GetString(a.Data); | 11806 | string data = Encoding.UTF8.GetString(a.Data); |
11805 | //m_log.Debug(data); | 11807 | //m_log.Debug(data); |
11806 | NotecardCache.Cache(id, data); | 11808 | NotecardCache.Cache(id, data); |
11807 | AsyncCommands.DataserverPlugin.DataserverReply(id.ToString(), | 11809 | AsyncCommands.DataserverPlugin.DataserverReply( |
11808 | NotecardCache.GetLine(id, line, m_notecardLineReadCharsMax)); | 11810 | reqIdentifier, NotecardCache.GetLine(assetID, line, m_notecardLineReadCharsMax)); |
11809 | }); | 11811 | }); |
11810 | 11812 | ||
11811 | ScriptSleep(100); | 11813 | ScriptSleep(100); |
@@ -13287,7 +13289,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
13287 | 13289 | ||
13288 | public static void Cache(UUID assetID, string text) | 13290 | public static void Cache(UUID assetID, string text) |
13289 | { | 13291 | { |
13290 | CacheCheck(); | 13292 | CheckCache(); |
13291 | 13293 | ||
13292 | lock (m_Notecards) | 13294 | lock (m_Notecards) |
13293 | { | 13295 | { |
@@ -13372,14 +13374,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
13372 | return line; | 13374 | return line; |
13373 | } | 13375 | } |
13374 | 13376 | ||
13375 | public static void CacheCheck() | 13377 | public static void CheckCache() |
13376 | { | 13378 | { |
13377 | foreach (UUID key in new List<UUID>(m_Notecards.Keys)) | 13379 | lock (m_Notecards) |
13378 | { | 13380 | { |
13379 | Notecard nc = m_Notecards[key]; | 13381 | foreach (UUID key in new List<UUID>(m_Notecards.Keys)) |
13380 | if (nc.lastRef.AddSeconds(30) < DateTime.Now) | 13382 | { |
13381 | m_Notecards.Remove(key); | 13383 | Notecard nc = m_Notecards[key]; |
13384 | if (nc.lastRef.AddSeconds(30) < DateTime.Now) | ||
13385 | m_Notecards.Remove(key); | ||
13386 | } | ||
13382 | } | 13387 | } |
13383 | } | 13388 | } |
13384 | } | 13389 | } |
13385 | } | 13390 | } \ No newline at end of file |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs index 2fe6948..d0922aa 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs | |||
@@ -29,7 +29,6 @@ using System; | |||
29 | using System.Reflection; | 29 | using System.Reflection; |
30 | using System.Collections; | 30 | using System.Collections; |
31 | using System.Collections.Generic; | 31 | using System.Collections.Generic; |
32 | using System.Reflection; | ||
33 | using System.Runtime.Remoting.Lifetime; | 32 | using System.Runtime.Remoting.Lifetime; |
34 | using System.Threading; | 33 | using System.Threading; |
35 | using log4net; | 34 | using log4net; |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 4c018d4..4a7f68b 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | |||
@@ -2173,7 +2173,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2173 | m_host.AddScriptLPS(1); | 2173 | m_host.AddScriptLPS(1); |
2174 | 2174 | ||
2175 | IConfigSource config = m_ScriptEngine.ConfigSource; | 2175 | IConfigSource config = m_ScriptEngine.ConfigSource; |
2176 | string HomeURI = Util.GetConfigVarFromSections<string>(config, "HomeURI", new string[]{"Startup"}); | 2176 | string HomeURI = Util.GetConfigVarFromSections<string>(config, "HomeURI", |
2177 | new string[] { "Startup", "Hypergrid" }, String.Empty); | ||
2177 | 2178 | ||
2178 | if (!string.IsNullOrEmpty(HomeURI)) | 2179 | if (!string.IsNullOrEmpty(HomeURI)) |
2179 | return HomeURI; | 2180 | return HomeURI; |
@@ -2194,7 +2195,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2194 | m_host.AddScriptLPS(1); | 2195 | m_host.AddScriptLPS(1); |
2195 | 2196 | ||
2196 | IConfigSource config = m_ScriptEngine.ConfigSource; | 2197 | IConfigSource config = m_ScriptEngine.ConfigSource; |
2197 | string gatekeeperURI = Util.GetConfigVarFromSections<string>(config, "GatekeeperURI", new string[] {"Startup"}); | 2198 | string gatekeeperURI = Util.GetConfigVarFromSections<string>(config, "GatekeeperURI", |
2199 | new string[] { "Startup", "Hypergrid" }, String.Empty); | ||
2198 | 2200 | ||
2199 | if (!string.IsNullOrEmpty(gatekeeperURI)) | 2201 | if (!string.IsNullOrEmpty(gatekeeperURI)) |
2200 | return gatekeeperURI; | 2202 | return gatekeeperURI; |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiLinkingTests.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiLinkingTests.cs index 5b57bbe..ac9f93b 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiLinkingTests.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiLinkingTests.cs | |||
@@ -93,7 +93,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
93 | // FIXME: This should really be a script item (with accompanying script) | 93 | // FIXME: This should really be a script item (with accompanying script) |
94 | TaskInventoryItem grp1Item | 94 | TaskInventoryItem grp1Item |
95 | = TaskInventoryHelpers.AddNotecard( | 95 | = TaskInventoryHelpers.AddNotecard( |
96 | m_scene, grp1.RootPart, "ncItem", TestHelpers.ParseTail(0x800), TestHelpers.ParseTail(0x900)); | 96 | m_scene, grp1.RootPart, "ncItem", TestHelpers.ParseTail(0x800), TestHelpers.ParseTail(0x900), "Hello World!"); |
97 | grp1Item.PermsMask |= ScriptBaseClass.PERMISSION_CHANGE_LINKS; | 97 | grp1Item.PermsMask |= ScriptBaseClass.PERMISSION_CHANGE_LINKS; |
98 | 98 | ||
99 | SceneObjectGroup grp2 = SceneHelpers.CreateSceneObject(2, ownerId, "grp2-", 0x20); | 99 | SceneObjectGroup grp2 = SceneHelpers.CreateSceneObject(2, ownerId, "grp2-", 0x20); |
@@ -127,7 +127,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
127 | // FIXME: This should really be a script item (with accompanying script) | 127 | // FIXME: This should really be a script item (with accompanying script) |
128 | TaskInventoryItem grp1Item | 128 | TaskInventoryItem grp1Item |
129 | = TaskInventoryHelpers.AddNotecard( | 129 | = TaskInventoryHelpers.AddNotecard( |
130 | m_scene, grp1.RootPart, "ncItem", TestHelpers.ParseTail(0x800), TestHelpers.ParseTail(0x900)); | 130 | m_scene, grp1.RootPart, "ncItem", TestHelpers.ParseTail(0x800), TestHelpers.ParseTail(0x900), "Hello World!"); |
131 | 131 | ||
132 | grp1Item.PermsMask |= ScriptBaseClass.PERMISSION_CHANGE_LINKS; | 132 | grp1Item.PermsMask |= ScriptBaseClass.PERMISSION_CHANGE_LINKS; |
133 | 133 | ||
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiNotecardTests.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiNotecardTests.cs new file mode 100644 index 0000000..c92bcdb --- /dev/null +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiNotecardTests.cs | |||
@@ -0,0 +1,270 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.IO; | ||
4 | using System.Net; | ||
5 | using System.Reflection; | ||
6 | using System.Text; | ||
7 | using log4net; | ||
8 | using Nini.Config; | ||
9 | using NUnit.Framework; | ||
10 | using OpenMetaverse; | ||
11 | using OpenSim.Framework; | ||
12 | using OpenSim.Framework.Servers; | ||
13 | using OpenSim.Framework.Servers.HttpServer; | ||
14 | using OpenSim.Region.CoreModules.Scripting.LSLHttp; | ||
15 | using OpenSim.Region.Framework.Scenes; | ||
16 | using OpenSim.Region.ScriptEngine.Shared; | ||
17 | using OpenSim.Region.ScriptEngine.Shared.Api; | ||
18 | using OpenSim.Region.ScriptEngine.Shared.ScriptBase; | ||
19 | using OpenSim.Services.Interfaces; | ||
20 | using OpenSim.Tests.Common; | ||
21 | using OpenSim.Tests.Common.Mock; | ||
22 | |||
23 | namespace OpenSim.Region.ScriptEngine.Shared.Tests | ||
24 | { | ||
25 | /// <summary> | ||
26 | /// Tests for notecard related functions in LSL | ||
27 | /// </summary> | ||
28 | [TestFixture] | ||
29 | public class LSL_ApiNotecardTests : OpenSimTestCase | ||
30 | { | ||
31 | private Scene m_scene; | ||
32 | private MockScriptEngine m_engine; | ||
33 | |||
34 | private SceneObjectGroup m_so; | ||
35 | private TaskInventoryItem m_scriptItem; | ||
36 | private LSL_Api m_lslApi; | ||
37 | |||
38 | [TestFixtureSetUp] | ||
39 | public void TestFixtureSetUp() | ||
40 | { | ||
41 | // Don't allow tests to be bamboozled by asynchronous events. Execute everything on the same thread. | ||
42 | Util.FireAndForgetMethod = FireAndForgetMethod.RegressionTest; | ||
43 | } | ||
44 | |||
45 | [TestFixtureTearDown] | ||
46 | public void TestFixureTearDown() | ||
47 | { | ||
48 | // We must set this back afterwards, otherwise later tests will fail since they're expecting multiple | ||
49 | // threads. Possibly, later tests should be rewritten so none of them require async stuff (which regression | ||
50 | // tests really shouldn't). | ||
51 | Util.FireAndForgetMethod = Util.DefaultFireAndForgetMethod; | ||
52 | } | ||
53 | |||
54 | [SetUp] | ||
55 | public override void SetUp() | ||
56 | { | ||
57 | base.SetUp(); | ||
58 | |||
59 | m_engine = new MockScriptEngine(); | ||
60 | |||
61 | m_scene = new SceneHelpers().SetupScene(); | ||
62 | SceneHelpers.SetupSceneModules(m_scene, new IniConfigSource(), m_engine); | ||
63 | |||
64 | m_so = SceneHelpers.AddSceneObject(m_scene); | ||
65 | m_scriptItem = TaskInventoryHelpers.AddScript(m_scene, m_so.RootPart); | ||
66 | |||
67 | // This is disconnected from the actual script - the mock engine does not set up any LSL_Api atm. | ||
68 | // Possibly this could be done and we could obtain it directly from the MockScriptEngine. | ||
69 | m_lslApi = new LSL_Api(); | ||
70 | m_lslApi.Initialize(m_engine, m_so.RootPart, m_scriptItem, null); | ||
71 | } | ||
72 | |||
73 | [Test] | ||
74 | public void TestLlGetNotecardLine() | ||
75 | { | ||
76 | TestHelpers.InMethod(); | ||
77 | |||
78 | string[] ncLines = { "One", "Two", "Three" }; | ||
79 | |||
80 | TaskInventoryItem ncItem | ||
81 | = TaskInventoryHelpers.AddNotecard(m_scene, m_so.RootPart, "nc", "1", "10", string.Join("\n", ncLines)); | ||
82 | |||
83 | AssertValidNotecardLine(ncItem.Name, 0, ncLines[0]); | ||
84 | AssertValidNotecardLine(ncItem.Name, 2, ncLines[2]); | ||
85 | AssertValidNotecardLine(ncItem.Name, 3, ScriptBaseClass.EOF); | ||
86 | AssertValidNotecardLine(ncItem.Name, 4, ScriptBaseClass.EOF); | ||
87 | |||
88 | // XXX: Is this correct or do we really expect no dataserver event to fire at all? | ||
89 | AssertValidNotecardLine(ncItem.Name, -1, ""); | ||
90 | AssertValidNotecardLine(ncItem.Name, -2, ""); | ||
91 | } | ||
92 | |||
93 | [Test] | ||
94 | public void TestLlGetNotecardLine_NoNotecard() | ||
95 | { | ||
96 | TestHelpers.InMethod(); | ||
97 | |||
98 | AssertInValidNotecardLine("nc", 0); | ||
99 | } | ||
100 | |||
101 | [Test] | ||
102 | public void TestLlGetNotecardLine_NotANotecard() | ||
103 | { | ||
104 | TestHelpers.InMethod(); | ||
105 | |||
106 | TaskInventoryItem ncItem = TaskInventoryHelpers.AddScript(m_scene, m_so.RootPart, "nc1", "Not important"); | ||
107 | |||
108 | AssertInValidNotecardLine(ncItem.Name, 0); | ||
109 | } | ||
110 | |||
111 | private void AssertValidNotecardLine(string ncName, int lineNumber, string assertLine) | ||
112 | { | ||
113 | string key = m_lslApi.llGetNotecardLine(ncName, lineNumber); | ||
114 | Assert.That(key, Is.Not.EqualTo(UUID.Zero.ToString())); | ||
115 | |||
116 | Assert.That(m_engine.PostedEvents.Count, Is.EqualTo(1)); | ||
117 | Assert.That(m_engine.PostedEvents.ContainsKey(m_scriptItem.ItemID)); | ||
118 | |||
119 | List<EventParams> events = m_engine.PostedEvents[m_scriptItem.ItemID]; | ||
120 | Assert.That(events.Count, Is.EqualTo(1)); | ||
121 | EventParams eventParams = events[0]; | ||
122 | |||
123 | Assert.That(eventParams.EventName, Is.EqualTo("dataserver")); | ||
124 | Assert.That(eventParams.Params[0].ToString(), Is.EqualTo(key)); | ||
125 | Assert.That(eventParams.Params[1].ToString(), Is.EqualTo(assertLine)); | ||
126 | |||
127 | m_engine.ClearPostedEvents(); | ||
128 | } | ||
129 | |||
130 | private void AssertInValidNotecardLine(string ncName, int lineNumber) | ||
131 | { | ||
132 | string key = m_lslApi.llGetNotecardLine(ncName, lineNumber); | ||
133 | Assert.That(key, Is.EqualTo(UUID.Zero.ToString())); | ||
134 | |||
135 | Assert.That(m_engine.PostedEvents.Count, Is.EqualTo(0)); | ||
136 | } | ||
137 | |||
138 | // [Test] | ||
139 | // public void TestLlReleaseUrl() | ||
140 | // { | ||
141 | // TestHelpers.InMethod(); | ||
142 | // | ||
143 | // m_lslApi.llRequestURL(); | ||
144 | // string returnedUri = m_engine.PostedEvents[m_scriptItem.ItemID][0].Params[2].ToString(); | ||
145 | // | ||
146 | // { | ||
147 | // // Check that the initial number of URLs is correct | ||
148 | // Assert.That(m_lslApi.llGetFreeURLs().value, Is.EqualTo(m_urlModule.TotalUrls - 1)); | ||
149 | // } | ||
150 | // | ||
151 | // { | ||
152 | // // Check releasing a non-url | ||
153 | // m_lslApi.llReleaseURL("GARBAGE"); | ||
154 | // Assert.That(m_lslApi.llGetFreeURLs().value, Is.EqualTo(m_urlModule.TotalUrls - 1)); | ||
155 | // } | ||
156 | // | ||
157 | // { | ||
158 | // // Check releasing a non-existing url | ||
159 | // m_lslApi.llReleaseURL("http://example.com"); | ||
160 | // Assert.That(m_lslApi.llGetFreeURLs().value, Is.EqualTo(m_urlModule.TotalUrls - 1)); | ||
161 | // } | ||
162 | // | ||
163 | // { | ||
164 | // // Check URL release | ||
165 | // m_lslApi.llReleaseURL(returnedUri); | ||
166 | // Assert.That(m_lslApi.llGetFreeURLs().value, Is.EqualTo(m_urlModule.TotalUrls)); | ||
167 | // | ||
168 | // HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(returnedUri); | ||
169 | // | ||
170 | // bool gotExpectedException = false; | ||
171 | // | ||
172 | // try | ||
173 | // { | ||
174 | // using (HttpWebResponse webResponse = (HttpWebResponse)webRequest.GetResponse()) | ||
175 | // {} | ||
176 | // } | ||
177 | // catch (WebException e) | ||
178 | // { | ||
179 | // using (HttpWebResponse response = (HttpWebResponse)e.Response) | ||
180 | // gotExpectedException = response.StatusCode == HttpStatusCode.NotFound; | ||
181 | // } | ||
182 | // | ||
183 | // Assert.That(gotExpectedException, Is.True); | ||
184 | // } | ||
185 | // | ||
186 | // { | ||
187 | // // Check releasing the same URL again | ||
188 | // m_lslApi.llReleaseURL(returnedUri); | ||
189 | // Assert.That(m_lslApi.llGetFreeURLs().value, Is.EqualTo(m_urlModule.TotalUrls)); | ||
190 | // } | ||
191 | // } | ||
192 | // | ||
193 | // [Test] | ||
194 | // public void TestLlRequestUrl() | ||
195 | // { | ||
196 | // TestHelpers.InMethod(); | ||
197 | // | ||
198 | // string requestId = m_lslApi.llRequestURL(); | ||
199 | // Assert.That(requestId, Is.Not.EqualTo(UUID.Zero.ToString())); | ||
200 | // string returnedUri; | ||
201 | // | ||
202 | // { | ||
203 | // // Check that URL is correctly set up | ||
204 | // Assert.That(m_lslApi.llGetFreeURLs().value, Is.EqualTo(m_urlModule.TotalUrls - 1)); | ||
205 | // | ||
206 | // Assert.That(m_engine.PostedEvents.ContainsKey(m_scriptItem.ItemID)); | ||
207 | // | ||
208 | // List<EventParams> events = m_engine.PostedEvents[m_scriptItem.ItemID]; | ||
209 | // Assert.That(events.Count, Is.EqualTo(1)); | ||
210 | // EventParams eventParams = events[0]; | ||
211 | // Assert.That(eventParams.EventName, Is.EqualTo("http_request")); | ||
212 | // | ||
213 | // UUID returnKey; | ||
214 | // string rawReturnKey = eventParams.Params[0].ToString(); | ||
215 | // string method = eventParams.Params[1].ToString(); | ||
216 | // returnedUri = eventParams.Params[2].ToString(); | ||
217 | // | ||
218 | // Assert.That(UUID.TryParse(rawReturnKey, out returnKey), Is.True); | ||
219 | // Assert.That(method, Is.EqualTo(ScriptBaseClass.URL_REQUEST_GRANTED)); | ||
220 | // Assert.That(Uri.IsWellFormedUriString(returnedUri, UriKind.Absolute), Is.True); | ||
221 | // } | ||
222 | // | ||
223 | // { | ||
224 | // // Check that request to URL works. | ||
225 | // string testResponse = "Hello World"; | ||
226 | // | ||
227 | // m_engine.ClearPostedEvents(); | ||
228 | // m_engine.PostEventHook | ||
229 | // += (itemId, evp) => m_lslApi.llHTTPResponse(evp.Params[0].ToString(), 200, testResponse); | ||
230 | // | ||
231 | //// Console.WriteLine("Trying {0}", returnedUri); | ||
232 | // HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(returnedUri); | ||
233 | // | ||
234 | // AssertHttpResponse(returnedUri, testResponse); | ||
235 | // | ||
236 | // Assert.That(m_engine.PostedEvents.ContainsKey(m_scriptItem.ItemID)); | ||
237 | // | ||
238 | // List<EventParams> events = m_engine.PostedEvents[m_scriptItem.ItemID]; | ||
239 | // Assert.That(events.Count, Is.EqualTo(1)); | ||
240 | // EventParams eventParams = events[0]; | ||
241 | // Assert.That(eventParams.EventName, Is.EqualTo("http_request")); | ||
242 | // | ||
243 | // UUID returnKey; | ||
244 | // string rawReturnKey = eventParams.Params[0].ToString(); | ||
245 | // string method = eventParams.Params[1].ToString(); | ||
246 | // string body = eventParams.Params[2].ToString(); | ||
247 | // | ||
248 | // Assert.That(UUID.TryParse(rawReturnKey, out returnKey), Is.True); | ||
249 | // Assert.That(method, Is.EqualTo("GET")); | ||
250 | // Assert.That(body, Is.EqualTo("")); | ||
251 | // } | ||
252 | // } | ||
253 | // | ||
254 | // private void AssertHttpResponse(string uri, string expectedResponse) | ||
255 | // { | ||
256 | // HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(uri); | ||
257 | // | ||
258 | // using (HttpWebResponse webResponse = (HttpWebResponse)webRequest.GetResponse()) | ||
259 | // { | ||
260 | // using (Stream stream = webResponse.GetResponseStream()) | ||
261 | // { | ||
262 | // using (StreamReader reader = new StreamReader(stream)) | ||
263 | // { | ||
264 | // Assert.That(reader.ReadToEnd(), Is.EqualTo(expectedResponse)); | ||
265 | // } | ||
266 | // } | ||
267 | // } | ||
268 | // } | ||
269 | } | ||
270 | } \ No newline at end of file | ||
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAttachmentTests.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAttachmentTests.cs index b2803a1..e422f5b 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAttachmentTests.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAttachmentTests.cs | |||
@@ -151,7 +151,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
151 | 151 | ||
152 | // Create an object embedded inside the first | 152 | // Create an object embedded inside the first |
153 | TaskInventoryHelpers.AddNotecard( | 153 | TaskInventoryHelpers.AddNotecard( |
154 | m_scene, inWorldObj.RootPart, taskInvObjItemName, taskInvObjItemId, TestHelpers.ParseTail(0x900)); | 154 | m_scene, inWorldObj.RootPart, taskInvObjItemName, taskInvObjItemId, TestHelpers.ParseTail(0x900), "Hello World!"); |
155 | 155 | ||
156 | bool exceptionCaught = false; | 156 | bool exceptionCaught = false; |
157 | 157 | ||
diff --git a/OpenSim/Server/Handlers/Grid/GridInfoHandlers.cs b/OpenSim/Server/Handlers/Grid/GridInfoHandlers.cs index d85aab0..346af32 100644 --- a/OpenSim/Server/Handlers/Grid/GridInfoHandlers.cs +++ b/OpenSim/Server/Handlers/Grid/GridInfoHandlers.cs | |||
@@ -177,7 +177,8 @@ namespace OpenSim.Server.Handlers.Grid | |||
177 | map[k] = OSD.FromString(_info[k].ToString()); | 177 | map[k] = OSD.FromString(_info[k].ToString()); |
178 | } | 178 | } |
179 | 179 | ||
180 | string HomeURI = Util.GetConfigVarFromSections<string>(m_Config, "HomeURI", new string[] {"Startup"}); | 180 | string HomeURI = Util.GetConfigVarFromSections<string>(m_Config, "HomeURI", |
181 | new string[] { "Startup", "Hypergrid" }, String.Empty); | ||
181 | 182 | ||
182 | if (!String.IsNullOrEmpty(HomeURI)) | 183 | if (!String.IsNullOrEmpty(HomeURI)) |
183 | map["home"] = OSD.FromString(HomeURI); | 184 | map["home"] = OSD.FromString(HomeURI); |
diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs index 80575ee..8335724 100644 --- a/OpenSim/Services/GridService/HypergridLinker.cs +++ b/OpenSim/Services/GridService/HypergridLinker.cs | |||
@@ -128,7 +128,8 @@ namespace OpenSim.Services.GridService | |||
128 | 128 | ||
129 | m_MapTileDirectory = gridConfig.GetString("MapTileDirectory", "maptiles"); | 129 | m_MapTileDirectory = gridConfig.GetString("MapTileDirectory", "maptiles"); |
130 | 130 | ||
131 | m_ThisGatekeeper = Util.GetConfigVarFromSections<string>(config, "GatekeeperURI", new string[] {"Startup", "GridService"}); | 131 | m_ThisGatekeeper = Util.GetConfigVarFromSections<string>(config, "GatekeeperURI", |
132 | new string[] { "Startup", "Hypergrid", "GridService" }, String.Empty); | ||
132 | // Legacy. Remove soon! | 133 | // Legacy. Remove soon! |
133 | m_ThisGatekeeper = gridConfig.GetString("Gatekeeper", m_ThisGatekeeper); | 134 | m_ThisGatekeeper = gridConfig.GetString("Gatekeeper", m_ThisGatekeeper); |
134 | try | 135 | try |
diff --git a/OpenSim/Services/HypergridService/GatekeeperService.cs b/OpenSim/Services/HypergridService/GatekeeperService.cs index c41d952..97a0afc 100644 --- a/OpenSim/Services/HypergridService/GatekeeperService.cs +++ b/OpenSim/Services/HypergridService/GatekeeperService.cs | |||
@@ -96,7 +96,8 @@ namespace OpenSim.Services.HypergridService | |||
96 | UUID.TryParse(scope, out m_ScopeID); | 96 | UUID.TryParse(scope, out m_ScopeID); |
97 | //m_WelcomeMessage = serverConfig.GetString("WelcomeMessage", "Welcome to OpenSim!"); | 97 | //m_WelcomeMessage = serverConfig.GetString("WelcomeMessage", "Welcome to OpenSim!"); |
98 | m_AllowTeleportsToAnyRegion = serverConfig.GetBoolean("AllowTeleportsToAnyRegion", true); | 98 | m_AllowTeleportsToAnyRegion = serverConfig.GetBoolean("AllowTeleportsToAnyRegion", true); |
99 | m_ExternalName = Util.GetConfigVarFromSections<string>(config, "GatekeeperURI", new string[] {"Startup", "GatekeeperService"}); | 99 | m_ExternalName = Util.GetConfigVarFromSections<string>(config, "GatekeeperURI", |
100 | new string[] { "Startup", "Hypergrid", "GatekeeperService" }, String.Empty); | ||
100 | m_ExternalName = serverConfig.GetString("ExternalName", m_ExternalName); | 101 | m_ExternalName = serverConfig.GetString("ExternalName", m_ExternalName); |
101 | if (m_ExternalName != string.Empty && !m_ExternalName.EndsWith("/")) | 102 | if (m_ExternalName != string.Empty && !m_ExternalName.EndsWith("/")) |
102 | m_ExternalName = m_ExternalName + "/"; | 103 | m_ExternalName = m_ExternalName + "/"; |
diff --git a/OpenSim/Services/HypergridService/HGInventoryService.cs b/OpenSim/Services/HypergridService/HGInventoryService.cs index 17e83cc..326e68d 100644 --- a/OpenSim/Services/HypergridService/HGInventoryService.cs +++ b/OpenSim/Services/HypergridService/HGInventoryService.cs | |||
@@ -81,7 +81,8 @@ namespace OpenSim.Services.HypergridService | |||
81 | if (m_UserAccountService == null) | 81 | if (m_UserAccountService == null) |
82 | throw new Exception(String.Format("Unable to create UserAccountService from {0}", userAccountsDll)); | 82 | throw new Exception(String.Format("Unable to create UserAccountService from {0}", userAccountsDll)); |
83 | 83 | ||
84 | m_HomeURL = Util.GetConfigVarFromSections<string>(config, "HomeURI", new string[] {"Startup", m_ConfigName}); | 84 | m_HomeURL = Util.GetConfigVarFromSections<string>(config, "HomeURI", |
85 | new string[] { "Startup", "Hypergrid", m_ConfigName }, String.Empty); | ||
85 | 86 | ||
86 | m_Cache = UserAccountCache.CreateUserAccountCache(m_UserAccountService); | 87 | m_Cache = UserAccountCache.CreateUserAccountCache(m_UserAccountService); |
87 | } | 88 | } |
diff --git a/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs b/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs index 776bf0c..eecf757 100644 --- a/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs +++ b/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs | |||
@@ -96,7 +96,8 @@ namespace OpenSim.Services.HypergridService | |||
96 | if (m_AvatarService == null) | 96 | if (m_AvatarService == null) |
97 | throw new Exception(String.Format("Unable to create m_AvatarService from {0}", avatarDll)); | 97 | throw new Exception(String.Format("Unable to create m_AvatarService from {0}", avatarDll)); |
98 | 98 | ||
99 | m_HomeURL = Util.GetConfigVarFromSections<string>(config, "HomeURI", new string[] {"Startup", m_ConfigName}); | 99 | m_HomeURL = Util.GetConfigVarFromSections<string>(config, "HomeURI", |
100 | new string[] { "Startup", "Hypergrid", m_ConfigName }, String.Empty); | ||
100 | 101 | ||
101 | // m_Cache = UserAccountCache.CreateUserAccountCache(m_UserAccountService); | 102 | // m_Cache = UserAccountCache.CreateUserAccountCache(m_UserAccountService); |
102 | } | 103 | } |
diff --git a/OpenSim/Services/HypergridService/UserAgentService.cs b/OpenSim/Services/HypergridService/UserAgentService.cs index 95876b8..ec76508 100644 --- a/OpenSim/Services/HypergridService/UserAgentService.cs +++ b/OpenSim/Services/HypergridService/UserAgentService.cs | |||
@@ -131,7 +131,8 @@ namespace OpenSim.Services.HypergridService | |||
131 | LoadDomainExceptionsFromConfig(serverConfig, "AllowExcept", m_TripsAllowedExceptions); | 131 | LoadDomainExceptionsFromConfig(serverConfig, "AllowExcept", m_TripsAllowedExceptions); |
132 | LoadDomainExceptionsFromConfig(serverConfig, "DisallowExcept", m_TripsDisallowedExceptions); | 132 | LoadDomainExceptionsFromConfig(serverConfig, "DisallowExcept", m_TripsDisallowedExceptions); |
133 | 133 | ||
134 | m_GridName = Util.GetConfigVarFromSections<string>(config, "GatekeeperURI", new string[] {"Startup", "UserAgentService"}); | 134 | m_GridName = Util.GetConfigVarFromSections<string>(config, "GatekeeperURI", |
135 | new string[] { "Startup", "Hypergrid", "UserAgentService" }, String.Empty); | ||
135 | if (string.IsNullOrEmpty(m_GridName)) // Legacy. Remove soon. | 136 | if (string.IsNullOrEmpty(m_GridName)) // Legacy. Remove soon. |
136 | { | 137 | { |
137 | m_GridName = serverConfig.GetString("ExternalName", string.Empty); | 138 | m_GridName = serverConfig.GetString("ExternalName", string.Empty); |
diff --git a/OpenSim/Services/LLLoginService/LLLoginService.cs b/OpenSim/Services/LLLoginService/LLLoginService.cs index 67f26c8..ede2353 100644 --- a/OpenSim/Services/LLLoginService/LLLoginService.cs +++ b/OpenSim/Services/LLLoginService/LLLoginService.cs | |||
@@ -110,7 +110,8 @@ namespace OpenSim.Services.LLLoginService | |||
110 | m_RequireInventory = m_LoginServerConfig.GetBoolean("RequireInventory", true); | 110 | m_RequireInventory = m_LoginServerConfig.GetBoolean("RequireInventory", true); |
111 | m_AllowRemoteSetLoginLevel = m_LoginServerConfig.GetBoolean("AllowRemoteSetLoginLevel", false); | 111 | m_AllowRemoteSetLoginLevel = m_LoginServerConfig.GetBoolean("AllowRemoteSetLoginLevel", false); |
112 | m_MinLoginLevel = m_LoginServerConfig.GetInt("MinLoginLevel", 0); | 112 | m_MinLoginLevel = m_LoginServerConfig.GetInt("MinLoginLevel", 0); |
113 | m_GatekeeperURL = Util.GetConfigVarFromSections<string>(config, "GatekeeperURI", new string[] {"Startup", "LoginService"}); | 113 | m_GatekeeperURL = Util.GetConfigVarFromSections<string>(config, "GatekeeperURI", |
114 | new string[] { "Startup", "Hypergrid", "LoginService" }, String.Empty); | ||
114 | m_MapTileURL = m_LoginServerConfig.GetString("MapTileURL", string.Empty); | 115 | m_MapTileURL = m_LoginServerConfig.GetString("MapTileURL", string.Empty); |
115 | m_ProfileURL = m_LoginServerConfig.GetString("ProfileServerURL", string.Empty); | 116 | m_ProfileURL = m_LoginServerConfig.GetString("ProfileServerURL", string.Empty); |
116 | m_OpenIDURL = m_LoginServerConfig.GetString("OpenIDServerURL", String.Empty); | 117 | m_OpenIDURL = m_LoginServerConfig.GetString("OpenIDServerURL", String.Empty); |
diff --git a/OpenSim/Tests/Common/Helpers/TaskInventoryHelpers.cs b/OpenSim/Tests/Common/Helpers/TaskInventoryHelpers.cs index 0a2b30a..bb4b55f 100644 --- a/OpenSim/Tests/Common/Helpers/TaskInventoryHelpers.cs +++ b/OpenSim/Tests/Common/Helpers/TaskInventoryHelpers.cs | |||
@@ -46,13 +46,32 @@ namespace OpenSim.Tests.Common | |||
46 | /// <param name="scene"></param> | 46 | /// <param name="scene"></param> |
47 | /// <param name="part"></param> | 47 | /// <param name="part"></param> |
48 | /// <param name="itemName"></param> | 48 | /// <param name="itemName"></param> |
49 | /// <param name="itemIDFrag">UUID or UUID stem</param> | ||
50 | /// <param name="assetIDFrag">UUID or UUID stem</param> | ||
51 | /// <param name="text">The tex to put in the notecard.</param> | ||
52 | /// <returns>The item that was added</returns> | ||
53 | public static TaskInventoryItem AddNotecard( | ||
54 | Scene scene, SceneObjectPart part, string itemName, string itemIDStem, string assetIDStem, string text) | ||
55 | { | ||
56 | return AddNotecard( | ||
57 | scene, part, itemName, TestHelpers.ParseStem(itemIDStem), TestHelpers.ParseStem(assetIDStem), text); | ||
58 | } | ||
59 | |||
60 | /// <summary> | ||
61 | /// Add a notecard item to the given part. | ||
62 | /// </summary> | ||
63 | /// <param name="scene"></param> | ||
64 | /// <param name="part"></param> | ||
65 | /// <param name="itemName"></param> | ||
49 | /// <param name="itemID"></param> | 66 | /// <param name="itemID"></param> |
50 | /// <param name="assetID"></param> | 67 | /// <param name="assetID"></param> |
68 | /// <param name="text">The tex to put in the notecard.</param> | ||
51 | /// <returns>The item that was added</returns> | 69 | /// <returns>The item that was added</returns> |
52 | public static TaskInventoryItem AddNotecard(Scene scene, SceneObjectPart part, string itemName, UUID itemID, UUID assetID) | 70 | public static TaskInventoryItem AddNotecard( |
71 | Scene scene, SceneObjectPart part, string itemName, UUID itemID, UUID assetID, string text) | ||
53 | { | 72 | { |
54 | AssetNotecard nc = new AssetNotecard(); | 73 | AssetNotecard nc = new AssetNotecard(); |
55 | nc.BodyText = "Hello World!"; | 74 | nc.BodyText = text; |
56 | nc.Encode(); | 75 | nc.Encode(); |
57 | 76 | ||
58 | AssetBase ncAsset | 77 | AssetBase ncAsset |
@@ -87,8 +106,8 @@ namespace OpenSim.Tests.Common | |||
87 | /// Add a simple script to the given part. | 106 | /// Add a simple script to the given part. |
88 | /// </summary> | 107 | /// </summary> |
89 | /// <remarks> | 108 | /// <remarks> |
90 | /// TODO: Accept input for item and asset IDs to avoid mysterious script failures that try to use any of these | 109 | /// TODO: Accept input for item and asset IDs so that we have completely replicatable regression tests rather |
91 | /// functions more than once in a test. | 110 | /// than a random component. |
92 | /// </remarks> | 111 | /// </remarks> |
93 | /// <param name="scene"></param> | 112 | /// <param name="scene"></param> |
94 | /// <param name="part"></param> | 113 | /// <param name="part"></param> |
@@ -102,8 +121,9 @@ namespace OpenSim.Tests.Common | |||
102 | ast.Source = scriptSource; | 121 | ast.Source = scriptSource; |
103 | ast.Encode(); | 122 | ast.Encode(); |
104 | 123 | ||
105 | UUID assetUuid = new UUID("00000000-0000-0000-1000-000000000000"); | 124 | UUID assetUuid = UUID.Random(); |
106 | UUID itemUuid = new UUID("00000000-0000-0000-1100-000000000000"); | 125 | UUID itemUuid = UUID.Random(); |
126 | |||
107 | AssetBase asset | 127 | AssetBase asset |
108 | = AssetHelpers.CreateAsset(assetUuid, AssetType.LSLText, ast.AssetData, UUID.Zero); | 128 | = AssetHelpers.CreateAsset(assetUuid, AssetType.LSLText, ast.AssetData, UUID.Zero); |
109 | scene.AssetService.Store(asset); | 129 | scene.AssetService.Store(asset); |
diff --git a/OpenSim/Tests/Common/Mock/MockScriptEngine.cs b/OpenSim/Tests/Common/Mock/MockScriptEngine.cs index 6a53fe7..b444241 100644 --- a/OpenSim/Tests/Common/Mock/MockScriptEngine.cs +++ b/OpenSim/Tests/Common/Mock/MockScriptEngine.cs | |||
@@ -31,6 +31,7 @@ using System.Collections.Generic; | |||
31 | using System.Reflection; | 31 | using System.Reflection; |
32 | using Nini.Config; | 32 | using Nini.Config; |
33 | using OpenMetaverse; | 33 | using OpenMetaverse; |
34 | using OpenSim.Framework; | ||
34 | using OpenSim.Region.Framework.Interfaces; | 35 | using OpenSim.Region.Framework.Interfaces; |
35 | using OpenSim.Region.Framework.Scenes; | 36 | using OpenSim.Region.Framework.Scenes; |
36 | using OpenSim.Region.ScriptEngine.Interfaces; | 37 | using OpenSim.Region.ScriptEngine.Interfaces; |
@@ -110,8 +111,11 @@ namespace OpenSim.Tests.Common | |||
110 | { | 111 | { |
111 | // Console.WriteLine("Posting event {0} for {1}", name, itemID); | 112 | // Console.WriteLine("Posting event {0} for {1}", name, itemID); |
112 | 113 | ||
113 | EventParams evParams = new EventParams(name, args, null); | 114 | return PostScriptEvent(itemID, new EventParams(name, args, null)); |
115 | } | ||
114 | 116 | ||
117 | public bool PostScriptEvent(UUID itemID, EventParams evParams) | ||
118 | { | ||
115 | List<EventParams> eventsForItem; | 119 | List<EventParams> eventsForItem; |
116 | 120 | ||
117 | if (!PostedEvents.ContainsKey(itemID)) | 121 | if (!PostedEvents.ContainsKey(itemID)) |
@@ -132,9 +136,22 @@ namespace OpenSim.Tests.Common | |||
132 | return true; | 136 | return true; |
133 | } | 137 | } |
134 | 138 | ||
139 | public bool PostObjectEvent(uint localID, EventParams evParams) | ||
140 | { | ||
141 | return PostObjectEvent(m_scene.GetSceneObjectPart(localID), evParams); | ||
142 | } | ||
143 | |||
135 | public bool PostObjectEvent(UUID itemID, string name, object[] args) | 144 | public bool PostObjectEvent(UUID itemID, string name, object[] args) |
136 | { | 145 | { |
137 | throw new System.NotImplementedException (); | 146 | return PostObjectEvent(m_scene.GetSceneObjectPart(itemID), new EventParams(name, args, null)); |
147 | } | ||
148 | |||
149 | private bool PostObjectEvent(SceneObjectPart part, EventParams evParams) | ||
150 | { | ||
151 | foreach (TaskInventoryItem item in part.Inventory.GetInventoryItems(InventoryType.LSL)) | ||
152 | PostScriptEvent(item.ItemID, evParams); | ||
153 | |||
154 | return true; | ||
138 | } | 155 | } |
139 | 156 | ||
140 | public void SuspendScript(UUID itemID) | 157 | public void SuspendScript(UUID itemID) |
@@ -187,16 +204,6 @@ namespace OpenSim.Tests.Common | |||
187 | throw new System.NotImplementedException (); | 204 | throw new System.NotImplementedException (); |
188 | } | 205 | } |
189 | 206 | ||
190 | public bool PostScriptEvent(UUID itemID,EventParams parms) | ||
191 | { | ||
192 | throw new System.NotImplementedException (); | ||
193 | } | ||
194 | |||
195 | public bool PostObjectEvent (uint localID, EventParams parms) | ||
196 | { | ||
197 | throw new System.NotImplementedException (); | ||
198 | } | ||
199 | |||
200 | public DetectParams GetDetectParams(UUID item, int number) | 207 | public DetectParams GetDetectParams(UUID item, int number) |
201 | { | 208 | { |
202 | throw new System.NotImplementedException (); | 209 | throw new System.NotImplementedException (); |
diff --git a/OpenSim/Tests/Common/TestHelpers.cs b/OpenSim/Tests/Common/TestHelpers.cs index 57da802..a684d72 100644 --- a/OpenSim/Tests/Common/TestHelpers.cs +++ b/OpenSim/Tests/Common/TestHelpers.cs | |||
@@ -114,6 +114,27 @@ namespace OpenSim.Tests.Common | |||
114 | } | 114 | } |
115 | 115 | ||
116 | /// <summary> | 116 | /// <summary> |
117 | /// Parse a UUID stem into a full UUID. | ||
118 | /// </summary> | ||
119 | /// <remarks> | ||
120 | /// Yes, this is completely inconsistent with ParseTail but this is probably a better way to do it, | ||
121 | /// UUIDs are conceptually not hexadecmial numbers. | ||
122 | /// The fragment will come at the start of the UUID. The rest will be 0s | ||
123 | /// </remarks> | ||
124 | /// <returns></returns> | ||
125 | /// <param name='frag'> | ||
126 | /// A UUID fragment that will be parsed into a full UUID. Therefore, it can only contain | ||
127 | /// cahracters which are valid in a UUID, except for "-" which is currently only allowed if a full UUID is | ||
128 | /// given as the 'fragment'. | ||
129 | /// </param> | ||
130 | public static UUID ParseStem(string stem) | ||
131 | { | ||
132 | string rawUuid = stem.PadRight(32, '0'); | ||
133 | |||
134 | return UUID.Parse(rawUuid); | ||
135 | } | ||
136 | |||
137 | /// <summary> | ||
117 | /// Parse tail section into full UUID. | 138 | /// Parse tail section into full UUID. |
118 | /// </summary> | 139 | /// </summary> |
119 | /// <param name="tail"></param> | 140 | /// <param name="tail"></param> |
diff --git a/OpenSim/Tests/ConfigurationLoaderTest.cs b/OpenSim/Tests/ConfigurationLoaderTest.cs index 9d63324..a409a13 100644 --- a/OpenSim/Tests/ConfigurationLoaderTest.cs +++ b/OpenSim/Tests/ConfigurationLoaderTest.cs | |||
@@ -45,7 +45,7 @@ namespace OpenSim.Tests | |||
45 | /// Set up a test directory. | 45 | /// Set up a test directory. |
46 | /// </summary> | 46 | /// </summary> |
47 | [SetUp] | 47 | [SetUp] |
48 | public void SetUp() | 48 | public override void SetUp() |
49 | { | 49 | { |
50 | base.SetUp(); | 50 | base.SetUp(); |
51 | 51 | ||