diff options
13 files changed, 267 insertions, 103 deletions
diff --git a/OpenSim/Framework/Monitoring/SimExtraStatsCollector.cs b/OpenSim/Framework/Monitoring/SimExtraStatsCollector.cs index aa86202..3765efb 100644 --- a/OpenSim/Framework/Monitoring/SimExtraStatsCollector.cs +++ b/OpenSim/Framework/Monitoring/SimExtraStatsCollector.cs | |||
@@ -359,11 +359,11 @@ Asset service request failures: {3}" + Environment.NewLine, | |||
359 | inPacketsPerSecond, outPacketsPerSecond, pendingDownloads, pendingUploads, unackedBytes, totalFrameTime, | 359 | inPacketsPerSecond, outPacketsPerSecond, pendingDownloads, pendingUploads, unackedBytes, totalFrameTime, |
360 | netFrameTime, physicsFrameTime, otherFrameTime, agentFrameTime, imageFrameTime)); | 360 | netFrameTime, physicsFrameTime, otherFrameTime, agentFrameTime, imageFrameTime)); |
361 | 361 | ||
362 | Dictionary<string, Dictionary<string, Stat>> sceneStats; | 362 | SortedDictionary<string, SortedDictionary<string, Stat>> sceneStats; |
363 | 363 | ||
364 | if (StatsManager.TryGetStats("scene", out sceneStats)) | 364 | if (StatsManager.TryGetStats("scene", out sceneStats)) |
365 | { | 365 | { |
366 | foreach (KeyValuePair<string, Dictionary<string, Stat>> kvp in sceneStats) | 366 | foreach (KeyValuePair<string, SortedDictionary<string, Stat>> kvp in sceneStats) |
367 | { | 367 | { |
368 | foreach (Stat stat in kvp.Value.Values) | 368 | foreach (Stat stat in kvp.Value.Values) |
369 | { | 369 | { |
diff --git a/OpenSim/Framework/Monitoring/StatsManager.cs b/OpenSim/Framework/Monitoring/StatsManager.cs index 0762b01..910907e 100644 --- a/OpenSim/Framework/Monitoring/StatsManager.cs +++ b/OpenSim/Framework/Monitoring/StatsManager.cs | |||
@@ -51,8 +51,8 @@ namespace OpenSim.Framework.Monitoring | |||
51 | /// <remarks> | 51 | /// <remarks> |
52 | /// Do not add or remove directly from this dictionary. | 52 | /// Do not add or remove directly from this dictionary. |
53 | /// </remarks> | 53 | /// </remarks> |
54 | public static Dictionary<string, Dictionary<string, Dictionary<string, Stat>>> RegisteredStats | 54 | public static SortedDictionary<string, SortedDictionary<string, SortedDictionary<string, Stat>>> RegisteredStats |
55 | = new Dictionary<string, Dictionary<string, Dictionary<string, Stat>>>(); | 55 | = new SortedDictionary<string, SortedDictionary<string, SortedDictionary<string, Stat>>>(); |
56 | 56 | ||
57 | private static AssetStatsCollector assetStats; | 57 | private static AssetStatsCollector assetStats; |
58 | private static UserStatsCollector userStats; | 58 | private static UserStatsCollector userStats; |
@@ -101,7 +101,7 @@ namespace OpenSim.Framework.Monitoring | |||
101 | } | 101 | } |
102 | else | 102 | else |
103 | { | 103 | { |
104 | Dictionary<string, Dictionary<string, Stat>> category; | 104 | SortedDictionary<string, SortedDictionary<string, Stat>> category; |
105 | if (!RegisteredStats.TryGetValue(categoryName, out category)) | 105 | if (!RegisteredStats.TryGetValue(categoryName, out category)) |
106 | { | 106 | { |
107 | con.OutputFormat("No such category as {0}", categoryName); | 107 | con.OutputFormat("No such category as {0}", categoryName); |
@@ -120,7 +120,7 @@ namespace OpenSim.Framework.Monitoring | |||
120 | } | 120 | } |
121 | 121 | ||
122 | private static void OutputCategoryStatsToConsole( | 122 | private static void OutputCategoryStatsToConsole( |
123 | ICommandConsole con, Dictionary<string, Dictionary<string, Stat>> category) | 123 | ICommandConsole con, SortedDictionary<string, SortedDictionary<string, Stat>> category) |
124 | { | 124 | { |
125 | foreach (var container in category.Values) | 125 | foreach (var container in category.Values) |
126 | { | 126 | { |
@@ -160,8 +160,8 @@ namespace OpenSim.Framework.Monitoring | |||
160 | /// <returns></returns> | 160 | /// <returns></returns> |
161 | public static bool RegisterStat(Stat stat) | 161 | public static bool RegisterStat(Stat stat) |
162 | { | 162 | { |
163 | Dictionary<string, Dictionary<string, Stat>> category = null, newCategory; | 163 | SortedDictionary<string, SortedDictionary<string, Stat>> category = null, newCategory; |
164 | Dictionary<string, Stat> container = null, newContainer; | 164 | SortedDictionary<string, Stat> container = null, newContainer; |
165 | 165 | ||
166 | lock (RegisteredStats) | 166 | lock (RegisteredStats) |
167 | { | 167 | { |
@@ -175,14 +175,14 @@ namespace OpenSim.Framework.Monitoring | |||
175 | // This means that we don't need to lock or copy them on iteration, which will be a much more | 175 | // This means that we don't need to lock or copy them on iteration, which will be a much more |
176 | // common operation after startup. | 176 | // common operation after startup. |
177 | if (container != null) | 177 | if (container != null) |
178 | newContainer = new Dictionary<string, Stat>(container); | 178 | newContainer = new SortedDictionary<string, Stat>(container); |
179 | else | 179 | else |
180 | newContainer = new Dictionary<string, Stat>(); | 180 | newContainer = new SortedDictionary<string, Stat>(); |
181 | 181 | ||
182 | if (category != null) | 182 | if (category != null) |
183 | newCategory = new Dictionary<string, Dictionary<string, Stat>>(category); | 183 | newCategory = new SortedDictionary<string, SortedDictionary<string, Stat>>(category); |
184 | else | 184 | else |
185 | newCategory = new Dictionary<string, Dictionary<string, Stat>>(); | 185 | newCategory = new SortedDictionary<string, SortedDictionary<string, Stat>>(); |
186 | 186 | ||
187 | newContainer[stat.ShortName] = stat; | 187 | newContainer[stat.ShortName] = stat; |
188 | newCategory[stat.Container] = newContainer; | 188 | newCategory[stat.Container] = newContainer; |
@@ -196,21 +196,21 @@ namespace OpenSim.Framework.Monitoring | |||
196 | /// Deregister a statistic | 196 | /// Deregister a statistic |
197 | /// </summary>> | 197 | /// </summary>> |
198 | /// <param name='stat'></param> | 198 | /// <param name='stat'></param> |
199 | /// <returns></returns | 199 | /// <returns></returns> |
200 | public static bool DeregisterStat(Stat stat) | 200 | public static bool DeregisterStat(Stat stat) |
201 | { | 201 | { |
202 | Dictionary<string, Dictionary<string, Stat>> category = null, newCategory; | 202 | SortedDictionary<string, SortedDictionary<string, Stat>> category = null, newCategory; |
203 | Dictionary<string, Stat> container = null, newContainer; | 203 | SortedDictionary<string, Stat> container = null, newContainer; |
204 | 204 | ||
205 | lock (RegisteredStats) | 205 | lock (RegisteredStats) |
206 | { | 206 | { |
207 | if (!TryGetStat(stat, out category, out container)) | 207 | if (!TryGetStat(stat, out category, out container)) |
208 | return false; | 208 | return false; |
209 | 209 | ||
210 | newContainer = new Dictionary<string, Stat>(container); | 210 | newContainer = new SortedDictionary<string, Stat>(container); |
211 | newContainer.Remove(stat.ShortName); | 211 | newContainer.Remove(stat.ShortName); |
212 | 212 | ||
213 | newCategory = new Dictionary<string, Dictionary<string, Stat>>(category); | 213 | newCategory = new SortedDictionary<string, SortedDictionary<string, Stat>>(category); |
214 | newCategory.Remove(stat.Container); | 214 | newCategory.Remove(stat.Container); |
215 | 215 | ||
216 | newCategory[stat.Container] = newContainer; | 216 | newCategory[stat.Container] = newContainer; |
@@ -220,15 +220,15 @@ namespace OpenSim.Framework.Monitoring | |||
220 | } | 220 | } |
221 | } | 221 | } |
222 | 222 | ||
223 | public static bool TryGetStats(string category, out Dictionary<string, Dictionary<string, Stat>> stats) | 223 | public static bool TryGetStats(string category, out SortedDictionary<string, SortedDictionary<string, Stat>> stats) |
224 | { | 224 | { |
225 | return RegisteredStats.TryGetValue(category, out stats); | 225 | return RegisteredStats.TryGetValue(category, out stats); |
226 | } | 226 | } |
227 | 227 | ||
228 | public static bool TryGetStat( | 228 | public static bool TryGetStat( |
229 | Stat stat, | 229 | Stat stat, |
230 | out Dictionary<string, Dictionary<string, Stat>> category, | 230 | out SortedDictionary<string, SortedDictionary<string, Stat>> category, |
231 | out Dictionary<string, Stat> container) | 231 | out SortedDictionary<string, Stat> container) |
232 | { | 232 | { |
233 | category = null; | 233 | category = null; |
234 | container = null; | 234 | container = null; |
@@ -252,9 +252,9 @@ namespace OpenSim.Framework.Monitoring | |||
252 | { | 252 | { |
253 | lock (RegisteredStats) | 253 | lock (RegisteredStats) |
254 | { | 254 | { |
255 | foreach (Dictionary<string, Dictionary<string, Stat>> category in RegisteredStats.Values) | 255 | foreach (SortedDictionary<string, SortedDictionary<string, Stat>> category in RegisteredStats.Values) |
256 | { | 256 | { |
257 | foreach (Dictionary<string, Stat> container in category.Values) | 257 | foreach (SortedDictionary<string, Stat> container in category.Values) |
258 | { | 258 | { |
259 | foreach (Stat stat in container.Values) | 259 | foreach (Stat stat in container.Values) |
260 | { | 260 | { |
diff --git a/OpenSim/Framework/Servers/HttpServer/WebsocketServerHandler.cs b/OpenSim/Framework/Servers/HttpServer/WebsocketServerHandler.cs index cfb1605..bb8825b 100644 --- a/OpenSim/Framework/Servers/HttpServer/WebsocketServerHandler.cs +++ b/OpenSim/Framework/Servers/HttpServer/WebsocketServerHandler.cs | |||
@@ -535,6 +535,8 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
535 | /// <param name="message"></param> | 535 | /// <param name="message"></param> |
536 | public void Close(string message) | 536 | public void Close(string message) |
537 | { | 537 | { |
538 | if (_networkContext == null) | ||
539 | return; | ||
538 | if (_networkContext.Stream != null) | 540 | if (_networkContext.Stream != null) |
539 | { | 541 | { |
540 | if (_networkContext.Stream.CanWrite) | 542 | if (_networkContext.Stream.CanWrite) |
diff --git a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetTransactionModule.cs b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetTransactionModule.cs index faee189..f489262 100644 --- a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetTransactionModule.cs +++ b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetTransactionModule.cs | |||
@@ -42,7 +42,7 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction | |||
42 | public class AssetTransactionModule : INonSharedRegionModule, | 42 | public class AssetTransactionModule : INonSharedRegionModule, |
43 | IAgentAssetTransactions | 43 | IAgentAssetTransactions |
44 | { | 44 | { |
45 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 45 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
46 | 46 | ||
47 | protected Scene m_Scene; | 47 | protected Scene m_Scene; |
48 | private bool m_dumpAssetsToFile = false; | 48 | private bool m_dumpAssetsToFile = false; |
diff --git a/OpenSim/Region/CoreModules/Framework/DynamicAttributes/DAExampleModule.cs b/OpenSim/Region/CoreModules/Framework/DynamicAttributes/DAExampleModule.cs index d36f65a..37131b9 100644 --- a/OpenSim/Region/CoreModules/Framework/DynamicAttributes/DAExampleModule.cs +++ b/OpenSim/Region/CoreModules/Framework/DynamicAttributes/DAExampleModule.cs | |||
@@ -44,7 +44,7 @@ namespace OpenSim.Region.Framework.DynamicAttributes.DAExampleModule | |||
44 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "DAExampleModule")] | 44 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "DAExampleModule")] |
45 | public class DAExampleModule : INonSharedRegionModule | 45 | public class DAExampleModule : INonSharedRegionModule |
46 | { | 46 | { |
47 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 47 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
48 | 48 | ||
49 | private static readonly bool ENABLED = false; // enable for testing | 49 | private static readonly bool ENABLED = false; // enable for testing |
50 | 50 | ||
diff --git a/OpenSim/Region/CoreModules/Framework/Statistics/Logging/BinaryLoggingModule.cs b/OpenSim/Region/CoreModules/Framework/Statistics/Logging/BinaryLoggingModule.cs index fb74cc6..f3436d1 100644 --- a/OpenSim/Region/CoreModules/Framework/Statistics/Logging/BinaryLoggingModule.cs +++ b/OpenSim/Region/CoreModules/Framework/Statistics/Logging/BinaryLoggingModule.cs | |||
@@ -57,7 +57,7 @@ namespace OpenSim.Region.CoreModules.Framework.Statistics.Logging | |||
57 | try | 57 | try |
58 | { | 58 | { |
59 | IConfig statConfig = source.Configs["Statistics.Binary"]; | 59 | IConfig statConfig = source.Configs["Statistics.Binary"]; |
60 | if (statConfig.Contains("enabled") && statConfig.GetBoolean("enabled")) | 60 | if (statConfig != null && statConfig.Contains("enabled") && statConfig.GetBoolean("enabled")) |
61 | { | 61 | { |
62 | if (statConfig.Contains("collect_region_stats")) | 62 | if (statConfig.Contains("collect_region_stats")) |
63 | { | 63 | { |
diff --git a/OpenSim/Region/CoreModules/Scripting/XMLRPC/XMLRPCModule.cs b/OpenSim/Region/CoreModules/Scripting/XMLRPC/XMLRPCModule.cs index 385f5ad..cbffca7 100644 --- a/OpenSim/Region/CoreModules/Scripting/XMLRPC/XMLRPCModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/XMLRPC/XMLRPCModule.cs | |||
@@ -111,13 +111,15 @@ namespace OpenSim.Region.CoreModules.Scripting.XMLRPC | |||
111 | m_rpcPending = new Dictionary<UUID, RPCRequestInfo>(); | 111 | m_rpcPending = new Dictionary<UUID, RPCRequestInfo>(); |
112 | m_rpcPendingResponses = new Dictionary<UUID, RPCRequestInfo>(); | 112 | m_rpcPendingResponses = new Dictionary<UUID, RPCRequestInfo>(); |
113 | m_pendingSRDResponses = new Dictionary<UUID, SendRemoteDataRequest>(); | 113 | m_pendingSRDResponses = new Dictionary<UUID, SendRemoteDataRequest>(); |
114 | 114 | if (config.Configs["XMLRPC"] != null) | |
115 | try | ||
116 | { | ||
117 | m_remoteDataPort = config.Configs["XMLRPC"].GetInt("XmlRpcPort", m_remoteDataPort); | ||
118 | } | ||
119 | catch (Exception) | ||
120 | { | 115 | { |
116 | try | ||
117 | { | ||
118 | m_remoteDataPort = config.Configs["XMLRPC"].GetInt("XmlRpcPort", m_remoteDataPort); | ||
119 | } | ||
120 | catch (Exception) | ||
121 | { | ||
122 | } | ||
121 | } | 123 | } |
122 | } | 124 | } |
123 | 125 | ||
diff --git a/OpenSim/Region/Framework/Interfaces/IJsonStoreModule.cs b/OpenSim/Region/Framework/Interfaces/IJsonStoreModule.cs index d7907e3..b40d24f 100644 --- a/OpenSim/Region/Framework/Interfaces/IJsonStoreModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IJsonStoreModule.cs | |||
@@ -49,7 +49,7 @@ namespace OpenSim.Region.Framework.Interfaces | |||
49 | bool CreateStore(string value, ref UUID result); | 49 | bool CreateStore(string value, ref UUID result); |
50 | bool DestroyStore(UUID storeID); | 50 | bool DestroyStore(UUID storeID); |
51 | 51 | ||
52 | JsonStoreNodeType PathType(UUID storeID, string path); | 52 | JsonStoreNodeType GetPathType(UUID storeID, string path); |
53 | bool TestStore(UUID storeID); | 53 | bool TestStore(UUID storeID); |
54 | bool TestPath(UUID storeID, string path, bool useJson); | 54 | bool TestPath(UUID storeID, string path, bool useJson); |
55 | 55 | ||
@@ -60,6 +60,6 @@ namespace OpenSim.Region.Framework.Interfaces | |||
60 | void TakeValue(UUID storeID, string path, bool useJson, TakeValueCallback cback); | 60 | void TakeValue(UUID storeID, string path, bool useJson, TakeValueCallback cback); |
61 | void ReadValue(UUID storeID, string path, bool useJson, TakeValueCallback cback); | 61 | void ReadValue(UUID storeID, string path, bool useJson, TakeValueCallback cback); |
62 | 62 | ||
63 | int ArrayLength(UUID storeID, string path); | 63 | int GetArrayLength(UUID storeID, string path); |
64 | } | 64 | } |
65 | } | 65 | } |
diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs index 052a05e..4733547 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs | |||
@@ -792,6 +792,19 @@ namespace OpenSim.Region.Framework.Scenes | |||
792 | public delegate void ObjectBeingRemovedFromScene(SceneObjectGroup obj); | 792 | public delegate void ObjectBeingRemovedFromScene(SceneObjectGroup obj); |
793 | 793 | ||
794 | /// <summary> | 794 | /// <summary> |
795 | /// Triggered when an object is placed into the physical scene (PhysicsActor created). | ||
796 | /// </summary> | ||
797 | public event Action<SceneObjectPart> OnObjectAddedToPhysicalScene; | ||
798 | /// <summary> | ||
799 | /// Triggered when an object is removed from the physical scene (PhysicsActor destroyed). | ||
800 | /// </summary> | ||
801 | /// <remarks> | ||
802 | /// Note: this is triggered just before the PhysicsActor is removed from the | ||
803 | /// physics engine so the receiver can do any necessary cleanup before its destruction. | ||
804 | /// </remarks> | ||
805 | public event Action<SceneObjectPart> OnObjectRemovedFromPhysicalScene; | ||
806 | |||
807 | /// <summary> | ||
795 | /// Triggered when an object is removed from the scene. | 808 | /// Triggered when an object is removed from the scene. |
796 | /// </summary> | 809 | /// </summary> |
797 | /// <remarks> | 810 | /// <remarks> |
@@ -1541,6 +1554,48 @@ namespace OpenSim.Region.Framework.Scenes | |||
1541 | } | 1554 | } |
1542 | } | 1555 | } |
1543 | 1556 | ||
1557 | public void TriggerObjectAddedToPhysicalScene(SceneObjectPart obj) | ||
1558 | { | ||
1559 | Action<SceneObjectPart> handler = OnObjectAddedToPhysicalScene; | ||
1560 | if (handler != null) | ||
1561 | { | ||
1562 | foreach (Action<SceneObjectPart> d in handler.GetInvocationList()) | ||
1563 | { | ||
1564 | try | ||
1565 | { | ||
1566 | d(obj); | ||
1567 | } | ||
1568 | catch (Exception e) | ||
1569 | { | ||
1570 | m_log.ErrorFormat( | ||
1571 | "[EVENT MANAGER]: Delegate for TriggerObjectAddedToPhysicalScene failed - continuing. {0} {1}", | ||
1572 | e.Message, e.StackTrace); | ||
1573 | } | ||
1574 | } | ||
1575 | } | ||
1576 | } | ||
1577 | |||
1578 | public void TriggerObjectRemovedFromPhysicalScene(SceneObjectPart obj) | ||
1579 | { | ||
1580 | Action<SceneObjectPart> handler = OnObjectRemovedFromPhysicalScene; | ||
1581 | if (handler != null) | ||
1582 | { | ||
1583 | foreach (Action<SceneObjectPart> d in handler.GetInvocationList()) | ||
1584 | { | ||
1585 | try | ||
1586 | { | ||
1587 | d(obj); | ||
1588 | } | ||
1589 | catch (Exception e) | ||
1590 | { | ||
1591 | m_log.ErrorFormat( | ||
1592 | "[EVENT MANAGER]: Delegate for TriggerObjectRemovedFromPhysicalScene failed - continuing. {0} {1}", | ||
1593 | e.Message, e.StackTrace); | ||
1594 | } | ||
1595 | } | ||
1596 | } | ||
1597 | } | ||
1598 | |||
1544 | public void TriggerShutdown() | 1599 | public void TriggerShutdown() |
1545 | { | 1600 | { |
1546 | Action handlerShutdown = OnShutdown; | 1601 | Action handlerShutdown = OnShutdown; |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index ce0820c..7cab841 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -4738,7 +4738,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
4738 | } | 4738 | } |
4739 | 4739 | ||
4740 | PhysActor = pa; | 4740 | PhysActor = pa; |
4741 | } | 4741 | |
4742 | ParentGroup.Scene.EventManager.TriggerObjectAddedToPhysicalScene(this); | ||
4743 | } | ||
4742 | 4744 | ||
4743 | /// <summary> | 4745 | /// <summary> |
4744 | /// This removes the part from the physics scene. | 4746 | /// This removes the part from the physics scene. |
@@ -4757,6 +4759,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
4757 | pa.OnOutOfBounds -= PhysicsOutOfBounds; | 4759 | pa.OnOutOfBounds -= PhysicsOutOfBounds; |
4758 | 4760 | ||
4759 | ParentGroup.Scene.PhysicsScene.RemovePrim(pa); | 4761 | ParentGroup.Scene.PhysicsScene.RemovePrim(pa); |
4762 | |||
4763 | ParentGroup.Scene.EventManager.TriggerObjectRemovedFromPhysicalScene(this); | ||
4760 | } | 4764 | } |
4761 | PhysActor = null; | 4765 | PhysActor = null; |
4762 | } | 4766 | } |
diff --git a/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreModule.cs b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreModule.cs index eec86ef..fb35068 100644 --- a/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreModule.cs +++ b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreModule.cs | |||
@@ -270,7 +270,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore | |||
270 | /// | 270 | /// |
271 | /// </summary> | 271 | /// </summary> |
272 | // ----------------------------------------------------------------- | 272 | // ----------------------------------------------------------------- |
273 | public JsonStoreNodeType PathType(UUID storeID, string path) | 273 | public JsonStoreNodeType GetPathType(UUID storeID, string path) |
274 | { | 274 | { |
275 | if (! m_enabled) return JsonStoreNodeType.Undefined; | 275 | if (! m_enabled) return JsonStoreNodeType.Undefined; |
276 | 276 | ||
@@ -407,7 +407,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore | |||
407 | /// | 407 | /// |
408 | /// </summary> | 408 | /// </summary> |
409 | // ----------------------------------------------------------------- | 409 | // ----------------------------------------------------------------- |
410 | public int ArrayLength(UUID storeID, string path) | 410 | public int GetArrayLength(UUID storeID, string path) |
411 | { | 411 | { |
412 | if (! m_enabled) return -1; | 412 | if (! m_enabled) return -1; |
413 | 413 | ||
diff --git a/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreScriptModule.cs b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreScriptModule.cs index 3955bff..ef08c05 100644 --- a/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreScriptModule.cs +++ b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreScriptModule.cs | |||
@@ -215,19 +215,19 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore | |||
215 | 215 | ||
216 | #endregion | 216 | #endregion |
217 | 217 | ||
218 | #region ScriptConstantInteface | 218 | #region ScriptConstantsInterface |
219 | 219 | ||
220 | [ScriptConstant] | 220 | [ScriptConstant] |
221 | public static readonly int JSONTYPEUNDEF = (int)JsonStoreNodeType.Undefined; | 221 | public static readonly int JSON_TYPE_UNDEF = (int)JsonStoreNodeType.Undefined; |
222 | 222 | ||
223 | [ScriptConstant] | 223 | [ScriptConstant] |
224 | public static readonly int JSONTYPEOBJECT = (int)JsonStoreNodeType.Object; | 224 | public static readonly int JSON_TYPE_OBJECT = (int)JsonStoreNodeType.Object; |
225 | 225 | ||
226 | [ScriptConstant] | 226 | [ScriptConstant] |
227 | public static readonly int JSONTYPEARRAY = (int)JsonStoreNodeType.Array; | 227 | public static readonly int JSON_TYPE_ARRAY = (int)JsonStoreNodeType.Array; |
228 | 228 | ||
229 | [ScriptConstant] | 229 | [ScriptConstant] |
230 | public static readonly int JSONTYPEVALUE = (int)JsonStoreNodeType.Value; | 230 | public static readonly int JSON_TYPE_VALUE = (int)JsonStoreNodeType.Value; |
231 | 231 | ||
232 | #endregion | 232 | #endregion |
233 | 233 | ||
@@ -336,9 +336,9 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore | |||
336 | /// </summary> | 336 | /// </summary> |
337 | // ----------------------------------------------------------------- | 337 | // ----------------------------------------------------------------- |
338 | [ScriptInvocation] | 338 | [ScriptInvocation] |
339 | public int JsonPathType(UUID hostID, UUID scriptID, UUID storeID, string path) | 339 | public int JsonGetPathType(UUID hostID, UUID scriptID, UUID storeID, string path) |
340 | { | 340 | { |
341 | return (int)m_store.PathType(storeID,path); | 341 | return (int)m_store.GetPathType(storeID,path); |
342 | } | 342 | } |
343 | 343 | ||
344 | [ScriptInvocation] | 344 | [ScriptInvocation] |
@@ -365,7 +365,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore | |||
365 | } | 365 | } |
366 | 366 | ||
367 | [ScriptInvocation] | 367 | [ScriptInvocation] |
368 | public int JsonSetValueJson(UUID hostID, UUID scriptID, UUID storeID, string path, string value) | 368 | public int JsonSetJson(UUID hostID, UUID scriptID, UUID storeID, string path, string value) |
369 | { | 369 | { |
370 | return m_store.SetValue(storeID,path,value,true) ? 1 : 0; | 370 | return m_store.SetValue(storeID,path,value,true) ? 1 : 0; |
371 | } | 371 | } |
@@ -387,9 +387,9 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore | |||
387 | /// </summary> | 387 | /// </summary> |
388 | // ----------------------------------------------------------------- | 388 | // ----------------------------------------------------------------- |
389 | [ScriptInvocation] | 389 | [ScriptInvocation] |
390 | public int JsonArrayLength(UUID hostID, UUID scriptID, UUID storeID, string path) | 390 | public int JsonGetArrayLength(UUID hostID, UUID scriptID, UUID storeID, string path) |
391 | { | 391 | { |
392 | return m_store.ArrayLength(storeID,path); | 392 | return m_store.GetArrayLength(storeID,path); |
393 | } | 393 | } |
394 | 394 | ||
395 | // ----------------------------------------------------------------- | 395 | // ----------------------------------------------------------------- |
@@ -406,7 +406,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore | |||
406 | } | 406 | } |
407 | 407 | ||
408 | [ScriptInvocation] | 408 | [ScriptInvocation] |
409 | public string JsonGetValueJson(UUID hostID, UUID scriptID, UUID storeID, string path) | 409 | public string JsonGetJson(UUID hostID, UUID scriptID, UUID storeID, string path) |
410 | { | 410 | { |
411 | string value = String.Empty; | 411 | string value = String.Empty; |
412 | m_store.GetValue(storeID,path,true, out value); | 412 | m_store.GetValue(storeID,path,true, out value); |
diff --git a/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs b/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs index f25f290..3d9ad16 100644 --- a/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs +++ b/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs | |||
@@ -53,6 +53,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests | |||
53 | private Scene m_scene; | 53 | private Scene m_scene; |
54 | private MockScriptEngine m_engine; | 54 | private MockScriptEngine m_engine; |
55 | private ScriptModuleCommsModule m_smcm; | 55 | private ScriptModuleCommsModule m_smcm; |
56 | private JsonStoreScriptModule m_jssm; | ||
56 | 57 | ||
57 | [TestFixtureSetUp] | 58 | [TestFixtureSetUp] |
58 | public void FixtureInit() | 59 | public void FixtureInit() |
@@ -82,10 +83,10 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests | |||
82 | m_engine = new MockScriptEngine(); | 83 | m_engine = new MockScriptEngine(); |
83 | m_smcm = new ScriptModuleCommsModule(); | 84 | m_smcm = new ScriptModuleCommsModule(); |
84 | JsonStoreModule jsm = new JsonStoreModule(); | 85 | JsonStoreModule jsm = new JsonStoreModule(); |
85 | JsonStoreScriptModule jssm = new JsonStoreScriptModule(); | 86 | m_jssm = new JsonStoreScriptModule(); |
86 | 87 | ||
87 | m_scene = new SceneHelpers().SetupScene(); | 88 | m_scene = new SceneHelpers().SetupScene(); |
88 | SceneHelpers.SetupSceneModules(m_scene, configSource, m_engine, m_smcm, jsm, jssm); | 89 | SceneHelpers.SetupSceneModules(m_scene, configSource, m_engine, m_smcm, jsm, m_jssm); |
89 | 90 | ||
90 | try | 91 | try |
91 | { | 92 | { |
@@ -208,7 +209,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests | |||
208 | } | 209 | } |
209 | 210 | ||
210 | [Test] | 211 | [Test] |
211 | public void TestJsonGetValueJson() | 212 | public void TestJsonGetJson() |
212 | { | 213 | { |
213 | TestHelpers.InMethod(); | 214 | TestHelpers.InMethod(); |
214 | // TestHelpers.EnableLogging(); | 215 | // TestHelpers.EnableLogging(); |
@@ -216,26 +217,26 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests | |||
216 | UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ 'Hello' : { 'World' : 'Two' } }"); | 217 | UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ 'Hello' : { 'World' : 'Two' } }"); |
217 | 218 | ||
218 | { | 219 | { |
219 | string value = (string)InvokeOp("JsonGetValueJson", storeId, "Hello.World"); | 220 | string value = (string)InvokeOp("JsonGetJson", storeId, "Hello.World"); |
220 | Assert.That(value, Is.EqualTo("'Two'")); | 221 | Assert.That(value, Is.EqualTo("'Two'")); |
221 | } | 222 | } |
222 | 223 | ||
223 | // Test get of path section instead of leaf | 224 | // Test get of path section instead of leaf |
224 | { | 225 | { |
225 | string value = (string)InvokeOp("JsonGetValueJson", storeId, "Hello"); | 226 | string value = (string)InvokeOp("JsonGetJson", storeId, "Hello"); |
226 | Assert.That(value, Is.EqualTo("{\"World\":\"Two\"}")); | 227 | Assert.That(value, Is.EqualTo("{\"World\":\"Two\"}")); |
227 | } | 228 | } |
228 | 229 | ||
229 | // Test get of non-existing value | 230 | // Test get of non-existing value |
230 | { | 231 | { |
231 | string fakeValueGet = (string)InvokeOp("JsonGetValueJson", storeId, "foo"); | 232 | string fakeValueGet = (string)InvokeOp("JsonGetJson", storeId, "foo"); |
232 | Assert.That(fakeValueGet, Is.EqualTo("")); | 233 | Assert.That(fakeValueGet, Is.EqualTo("")); |
233 | } | 234 | } |
234 | 235 | ||
235 | // Test get from non-existing store | 236 | // Test get from non-existing store |
236 | { | 237 | { |
237 | UUID fakeStoreId = TestHelpers.ParseTail(0x500); | 238 | UUID fakeStoreId = TestHelpers.ParseTail(0x500); |
238 | string fakeStoreValueGet = (string)InvokeOp("JsonGetValueJson", fakeStoreId, "Hello"); | 239 | string fakeStoreValueGet = (string)InvokeOp("JsonGetJson", fakeStoreId, "Hello"); |
239 | Assert.That(fakeStoreValueGet, Is.EqualTo("")); | 240 | Assert.That(fakeStoreValueGet, Is.EqualTo("")); |
240 | } | 241 | } |
241 | } | 242 | } |
@@ -293,7 +294,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests | |||
293 | int result = (int)InvokeOp("JsonTestPath", storeId, "Hello"); | 294 | int result = (int)InvokeOp("JsonTestPath", storeId, "Hello"); |
294 | Assert.That(result, Is.EqualTo(0)); | 295 | Assert.That(result, Is.EqualTo(0)); |
295 | 296 | ||
296 | string returnValue2 = (string)InvokeOp("JsonGetValueJson", storeId, "Hello"); | 297 | string returnValue2 = (string)InvokeOp("JsonGetJson", storeId, "Hello"); |
297 | Assert.That(returnValue2, Is.EqualTo("")); | 298 | Assert.That(returnValue2, Is.EqualTo("")); |
298 | } | 299 | } |
299 | 300 | ||
@@ -314,7 +315,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests | |||
314 | string stringReturnValue = (string)InvokeOp("JsonGetValue", storeId, "Hello[0]"); | 315 | string stringReturnValue = (string)InvokeOp("JsonGetValue", storeId, "Hello[0]"); |
315 | Assert.That(stringReturnValue, Is.EqualTo("value2")); | 316 | Assert.That(stringReturnValue, Is.EqualTo("value2")); |
316 | 317 | ||
317 | stringReturnValue = (string)InvokeOp("JsonGetValueJson", storeId, "Hello[1]"); | 318 | stringReturnValue = (string)InvokeOp("JsonGetJson", storeId, "Hello[1]"); |
318 | Assert.That(stringReturnValue, Is.EqualTo("")); | 319 | Assert.That(stringReturnValue, Is.EqualTo("")); |
319 | } | 320 | } |
320 | 321 | ||
@@ -334,67 +335,171 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests | |||
334 | } | 335 | } |
335 | } | 336 | } |
336 | 337 | ||
338 | // [Test] | ||
339 | // public void TestJsonTestPath() | ||
340 | // { | ||
341 | // TestHelpers.InMethod(); | ||
342 | //// TestHelpers.EnableLogging(); | ||
343 | // | ||
344 | // UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ 'Hello' : { 'World' : 'One' } }"); | ||
345 | // | ||
346 | // { | ||
347 | // int result = (int)InvokeOp("JsonTestPath", storeId, "Hello.World"); | ||
348 | // Assert.That(result, Is.EqualTo(1)); | ||
349 | // } | ||
350 | // | ||
351 | // // Test for path which does not resolve to a value. | ||
352 | // { | ||
353 | // int result = (int)InvokeOp("JsonTestPath", storeId, "Hello"); | ||
354 | // Assert.That(result, Is.EqualTo(0)); | ||
355 | // } | ||
356 | // | ||
357 | // { | ||
358 | // int result2 = (int)InvokeOp("JsonTestPath", storeId, "foo"); | ||
359 | // Assert.That(result2, Is.EqualTo(0)); | ||
360 | // } | ||
361 | // | ||
362 | // // Test with fake store | ||
363 | // { | ||
364 | // UUID fakeStoreId = TestHelpers.ParseTail(0x500); | ||
365 | // int fakeStoreValueRemove = (int)InvokeOp("JsonTestPath", fakeStoreId, "Hello"); | ||
366 | // Assert.That(fakeStoreValueRemove, Is.EqualTo(0)); | ||
367 | // } | ||
368 | // } | ||
369 | |||
370 | // [Test] | ||
371 | // public void TestJsonTestPathJson() | ||
372 | // { | ||
373 | // TestHelpers.InMethod(); | ||
374 | //// TestHelpers.EnableLogging(); | ||
375 | // | ||
376 | // UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ 'Hello' : { 'World' : 'One' } }"); | ||
377 | // | ||
378 | // { | ||
379 | // int result = (int)InvokeOp("JsonTestPathJson", storeId, "Hello.World"); | ||
380 | // Assert.That(result, Is.EqualTo(1)); | ||
381 | // } | ||
382 | // | ||
383 | // // Test for path which does not resolve to a value. | ||
384 | // { | ||
385 | // int result = (int)InvokeOp("JsonTestPathJson", storeId, "Hello"); | ||
386 | // Assert.That(result, Is.EqualTo(1)); | ||
387 | // } | ||
388 | // | ||
389 | // { | ||
390 | // int result2 = (int)InvokeOp("JsonTestPathJson", storeId, "foo"); | ||
391 | // Assert.That(result2, Is.EqualTo(0)); | ||
392 | // } | ||
393 | // | ||
394 | // // Test with fake store | ||
395 | // { | ||
396 | // UUID fakeStoreId = TestHelpers.ParseTail(0x500); | ||
397 | // int fakeStoreValueRemove = (int)InvokeOp("JsonTestPathJson", fakeStoreId, "Hello"); | ||
398 | // Assert.That(fakeStoreValueRemove, Is.EqualTo(0)); | ||
399 | // } | ||
400 | // } | ||
401 | |||
337 | [Test] | 402 | [Test] |
338 | public void TestJsonTestPath() | 403 | public void TestGetArrayLength() |
339 | { | 404 | { |
340 | TestHelpers.InMethod(); | 405 | TestHelpers.InMethod(); |
341 | // TestHelpers.EnableLogging(); | 406 | // TestHelpers.EnableLogging(); |
342 | 407 | ||
343 | UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ 'Hello' : { 'World' : 'One' } }"); | 408 | UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ 'Hello' : { 'World' : [ 'one', 2 ] } }"); |
344 | 409 | ||
345 | { | 410 | { |
346 | int result = (int)InvokeOp("JsonTestPath", storeId, "Hello.World"); | 411 | int result = (int)InvokeOp("JsonGetArrayLength", storeId, "Hello.World"); |
347 | Assert.That(result, Is.EqualTo(1)); | 412 | Assert.That(result, Is.EqualTo(2)); |
348 | } | 413 | } |
349 | 414 | ||
350 | // Test for path which does not resolve to a value. | 415 | // Test path which is not an array |
351 | { | 416 | { |
352 | int result = (int)InvokeOp("JsonTestPath", storeId, "Hello"); | 417 | int result = (int)InvokeOp("JsonGetArrayLength", storeId, "Hello"); |
353 | Assert.That(result, Is.EqualTo(0)); | 418 | Assert.That(result, Is.EqualTo(-1)); |
354 | } | 419 | } |
355 | 420 | ||
421 | // Test fake path | ||
356 | { | 422 | { |
357 | int result2 = (int)InvokeOp("JsonTestPath", storeId, "foo"); | 423 | int result = (int)InvokeOp("JsonGetArrayLength", storeId, "foo"); |
358 | Assert.That(result2, Is.EqualTo(0)); | 424 | Assert.That(result, Is.EqualTo(-1)); |
359 | } | 425 | } |
360 | 426 | ||
361 | // Test with fake store | 427 | // Test fake store |
362 | { | 428 | { |
363 | UUID fakeStoreId = TestHelpers.ParseTail(0x500); | 429 | UUID fakeStoreId = TestHelpers.ParseTail(0x500); |
364 | int fakeStoreValueRemove = (int)InvokeOp("JsonTestPath", fakeStoreId, "Hello"); | 430 | int result = (int)InvokeOp("JsonGetArrayLength", fakeStoreId, "Hello.World"); |
365 | Assert.That(fakeStoreValueRemove, Is.EqualTo(0)); | 431 | Assert.That(result, Is.EqualTo(-1)); |
366 | } | 432 | } |
367 | } | 433 | } |
368 | 434 | ||
369 | [Test] | 435 | [Test] |
370 | public void TestJsonTestPathJson() | 436 | public void TestJsonGetPathType() |
371 | { | 437 | { |
372 | TestHelpers.InMethod(); | 438 | TestHelpers.InMethod(); |
373 | // TestHelpers.EnableLogging(); | 439 | // TestHelpers.EnableLogging(); |
374 | 440 | ||
375 | UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ 'Hello' : { 'World' : 'One' } }"); | 441 | UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ 'Hello' : { 'World' : [ 'one', 2 ] } }"); |
376 | 442 | ||
377 | { | 443 | { |
378 | int result = (int)InvokeOp("JsonTestPathJson", storeId, "Hello.World"); | 444 | int result = (int)InvokeOp("JsonGetPathType", storeId, "."); |
379 | Assert.That(result, Is.EqualTo(1)); | 445 | Assert.That(result, Is.EqualTo(JsonStoreScriptModule.JSON_TYPE_OBJECT)); |
380 | } | 446 | } |
381 | 447 | ||
382 | // Test for path which does not resolve to a value. | ||
383 | { | 448 | { |
384 | int result = (int)InvokeOp("JsonTestPathJson", storeId, "Hello"); | 449 | int result = (int)InvokeOp("JsonGetPathType", storeId, "Hello"); |
385 | Assert.That(result, Is.EqualTo(1)); | 450 | Assert.That(result, Is.EqualTo(JsonStoreScriptModule.JSON_TYPE_OBJECT)); |
386 | } | 451 | } |
387 | 452 | ||
388 | { | 453 | { |
389 | int result2 = (int)InvokeOp("JsonTestPathJson", storeId, "foo"); | 454 | int result = (int)InvokeOp("JsonGetPathType", storeId, "Hello.World"); |
390 | Assert.That(result2, Is.EqualTo(0)); | 455 | Assert.That(result, Is.EqualTo(JsonStoreScriptModule.JSON_TYPE_ARRAY)); |
391 | } | 456 | } |
392 | 457 | ||
393 | // Test with fake store | 458 | { |
459 | int result = (int)InvokeOp("JsonGetPathType", storeId, "Hello.World[0]"); | ||
460 | Assert.That(result, Is.EqualTo(JsonStoreScriptModule.JSON_TYPE_VALUE)); | ||
461 | } | ||
462 | |||
463 | { | ||
464 | int result = (int)InvokeOp("JsonGetPathType", storeId, "Hello.World[1]"); | ||
465 | Assert.That(result, Is.EqualTo(JsonStoreScriptModule.JSON_TYPE_VALUE)); | ||
466 | } | ||
467 | |||
468 | // Test for non-existant path | ||
469 | { | ||
470 | int result = (int)InvokeOp("JsonGetPathType", storeId, "foo"); | ||
471 | Assert.That(result, Is.EqualTo(JsonStoreScriptModule.JSON_TYPE_UNDEF)); | ||
472 | } | ||
473 | |||
474 | // Test for non-existant store | ||
394 | { | 475 | { |
395 | UUID fakeStoreId = TestHelpers.ParseTail(0x500); | 476 | UUID fakeStoreId = TestHelpers.ParseTail(0x500); |
396 | int fakeStoreValueRemove = (int)InvokeOp("JsonTestPathJson", fakeStoreId, "Hello"); | 477 | int result = (int)InvokeOp("JsonGetPathType", fakeStoreId, "."); |
397 | Assert.That(fakeStoreValueRemove, Is.EqualTo(0)); | 478 | Assert.That(result, Is.EqualTo(JsonStoreScriptModule.JSON_TYPE_UNDEF)); |
479 | } | ||
480 | } | ||
481 | |||
482 | [Test] | ||
483 | public void TestJsonList2Path() | ||
484 | { | ||
485 | TestHelpers.InMethod(); | ||
486 | // TestHelpers.EnableLogging(); | ||
487 | |||
488 | // Invoking these methods directly since I just couldn't get comms module invocation to work for some reason | ||
489 | // - some confusion with the methods that take a params object[] invocation. | ||
490 | { | ||
491 | string result = m_jssm.JsonList2Path(UUID.Zero, UUID.Zero, new object[] { "foo" }); | ||
492 | Assert.That(result, Is.EqualTo("{foo}")); | ||
493 | } | ||
494 | |||
495 | { | ||
496 | string result = m_jssm.JsonList2Path(UUID.Zero, UUID.Zero, new object[] { "foo", "bar" }); | ||
497 | Assert.That(result, Is.EqualTo("{foo}.{bar}")); | ||
498 | } | ||
499 | |||
500 | { | ||
501 | string result = m_jssm.JsonList2Path(UUID.Zero, UUID.Zero, new object[] { "foo", 1, "bar" }); | ||
502 | Assert.That(result, Is.EqualTo("{foo}.[1].{bar}")); | ||
398 | } | 503 | } |
399 | } | 504 | } |
400 | 505 | ||
@@ -414,17 +519,16 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests | |||
414 | Assert.That(value, Is.EqualTo("Times")); | 519 | Assert.That(value, Is.EqualTo("Times")); |
415 | } | 520 | } |
416 | 521 | ||
417 | // Commented out as this currently unexpectedly fails. | ||
418 | // Test setting a key containing periods with delineation | 522 | // Test setting a key containing periods with delineation |
419 | // { | 523 | { |
420 | // UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{}"); | 524 | UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{}"); |
421 | // | 525 | |
422 | // int result = (int)InvokeOp("JsonSetValue", storeId, "{Fun.Circus}", "Times"); | 526 | int result = (int)InvokeOp("JsonSetValue", storeId, "{Fun.Circus}", "Times"); |
423 | // Assert.That(result, Is.EqualTo(1)); | 527 | Assert.That(result, Is.EqualTo(1)); |
424 | // | 528 | |
425 | // string value = (string)InvokeOp("JsonGetValue", storeId, "{Fun.Circus}"); | 529 | string value = (string)InvokeOp("JsonGetValue", storeId, "{Fun.Circus}"); |
426 | // Assert.That(value, Is.EqualTo("Times")); | 530 | Assert.That(value, Is.EqualTo("Times")); |
427 | // } | 531 | } |
428 | 532 | ||
429 | // *** Test [] *** | 533 | // *** Test [] *** |
430 | 534 | ||
@@ -494,7 +598,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests | |||
494 | Assert.That(value, Is.EqualTo("Times")); | 598 | Assert.That(value, Is.EqualTo("Times")); |
495 | } | 599 | } |
496 | 600 | ||
497 | // Commented out as this currently unexpectedly fails. | 601 | // // Commented out as this currently unexpectedly fails. |
498 | // // Test setting a key containing brackets around an integer with delineation | 602 | // // Test setting a key containing brackets around an integer with delineation |
499 | // { | 603 | // { |
500 | // UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{}"); | 604 | // UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{}"); |
@@ -502,7 +606,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests | |||
502 | // int result = (int)InvokeOp("JsonSetValue", storeId, "{Fun[0]Circus}", "Times"); | 606 | // int result = (int)InvokeOp("JsonSetValue", storeId, "{Fun[0]Circus}", "Times"); |
503 | // Assert.That(result, Is.EqualTo(1)); | 607 | // Assert.That(result, Is.EqualTo(1)); |
504 | // | 608 | // |
505 | // string value = (string)InvokeOp("JsonGetValue", storeId, "{Fun[]Circus}"); | 609 | // string value = (string)InvokeOp("JsonGetValue", storeId, "{Fun[0]Circus}"); |
506 | // Assert.That(value, Is.EqualTo("Times")); | 610 | // Assert.That(value, Is.EqualTo("Times")); |
507 | // } | 611 | // } |
508 | 612 | ||
@@ -530,16 +634,13 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests | |||
530 | Assert.That(value, Is.EqualTo("")); | 634 | Assert.That(value, Is.EqualTo("")); |
531 | } | 635 | } |
532 | 636 | ||
533 | // Commented out as this currently unexpectedly fails. | 637 | // // Commented out as this currently unexpectedly fails. |
534 | // // Test setting a key containing unbalanced } | 638 | // // Test setting a key containing unbalanced } |
535 | // { | 639 | // { |
536 | // UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{}"); | 640 | // UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{}"); |
537 | // | 641 | // |
538 | // int result = (int)InvokeOp("JsonSetValue", storeId, "{Fun}Circus}", "Times"); | 642 | // int result = (int)InvokeOp("JsonSetValue", storeId, "{Fun}Circus}", "Times"); |
539 | // Assert.That(result, Is.EqualTo(1)); | 643 | // Assert.That(result, Is.EqualTo(0)); |
540 | // | ||
541 | // string value = (string)InvokeOp("JsonGetValue", storeId, "{Fun}Circus}"); | ||
542 | // Assert.That(value, Is.EqualTo("Times")); | ||
543 | // } | 644 | // } |
544 | 645 | ||
545 | // Test setting a key containing unbalanced { with delineation | 646 | // Test setting a key containing unbalanced { with delineation |
@@ -584,7 +685,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests | |||
584 | } | 685 | } |
585 | 686 | ||
586 | [Test] | 687 | [Test] |
587 | public void TestJsonSetValueJson() | 688 | public void TestJsonSetJson() |
588 | { | 689 | { |
589 | TestHelpers.InMethod(); | 690 | TestHelpers.InMethod(); |
590 | // TestHelpers.EnableLogging(); | 691 | // TestHelpers.EnableLogging(); |
@@ -593,7 +694,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests | |||
593 | { | 694 | { |
594 | UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ }"); | 695 | UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ }"); |
595 | 696 | ||
596 | int result = (int)InvokeOp("JsonSetValueJson", storeId, "Fun", "'Times'"); | 697 | int result = (int)InvokeOp("JsonSetJson", storeId, "Fun", "'Times'"); |
597 | Assert.That(result, Is.EqualTo(1)); | 698 | Assert.That(result, Is.EqualTo(1)); |
598 | 699 | ||
599 | string value = (string)InvokeOp("JsonGetValue", storeId, "Fun"); | 700 | string value = (string)InvokeOp("JsonGetValue", storeId, "Fun"); |
@@ -604,7 +705,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests | |||
604 | { | 705 | { |
605 | UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ }"); | 706 | UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ }"); |
606 | 707 | ||
607 | int result = (int)InvokeOp("JsonSetValueJson", storeId, "Fun", "{ 'Filled' : 'Times' }"); | 708 | int result = (int)InvokeOp("JsonSetJson", storeId, "Fun", "{ 'Filled' : 'Times' }"); |
608 | Assert.That(result, Is.EqualTo(1)); | 709 | Assert.That(result, Is.EqualTo(1)); |
609 | 710 | ||
610 | string value = (string)InvokeOp("JsonGetValue", storeId, "Fun.Filled"); | 711 | string value = (string)InvokeOp("JsonGetValue", storeId, "Fun.Filled"); |
@@ -615,7 +716,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests | |||
615 | { | 716 | { |
616 | UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ }"); | 717 | UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ }"); |
617 | 718 | ||
618 | int result = (int)InvokeOp("JsonSetValueJson", storeId, "Fun", "Times"); | 719 | int result = (int)InvokeOp("JsonSetJson", storeId, "Fun", "Times"); |
619 | Assert.That(result, Is.EqualTo(0)); | 720 | Assert.That(result, Is.EqualTo(0)); |
620 | 721 | ||
621 | string value = (string)InvokeOp("JsonGetValue", storeId, "Fun"); | 722 | string value = (string)InvokeOp("JsonGetValue", storeId, "Fun"); |
@@ -626,7 +727,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests | |||
626 | { | 727 | { |
627 | UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ }"); | 728 | UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ }"); |
628 | 729 | ||
629 | int result = (int)InvokeOp("JsonSetValueJson", storeId, "Fun.Circus", "'Times'"); | 730 | int result = (int)InvokeOp("JsonSetJson", storeId, "Fun.Circus", "'Times'"); |
630 | Assert.That(result, Is.EqualTo(0)); | 731 | Assert.That(result, Is.EqualTo(0)); |
631 | 732 | ||
632 | string value = (string)InvokeOp("JsonGetValue", storeId, "Fun.Circus"); | 733 | string value = (string)InvokeOp("JsonGetValue", storeId, "Fun.Circus"); |
@@ -636,7 +737,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests | |||
636 | // Test with fake store | 737 | // Test with fake store |
637 | { | 738 | { |
638 | UUID fakeStoreId = TestHelpers.ParseTail(0x500); | 739 | UUID fakeStoreId = TestHelpers.ParseTail(0x500); |
639 | int fakeStoreValueSet = (int)InvokeOp("JsonSetValueJson", fakeStoreId, "Hello", "'World'"); | 740 | int fakeStoreValueSet = (int)InvokeOp("JsonSetJson", fakeStoreId, "Hello", "'World'"); |
640 | Assert.That(fakeStoreValueSet, Is.EqualTo(0)); | 741 | Assert.That(fakeStoreValueSet, Is.EqualTo(0)); |
641 | } | 742 | } |
642 | } | 743 | } |