diff options
Diffstat (limited to 'OpenSim/Region/OptionalModules')
5 files changed, 156 insertions, 49 deletions
diff --git a/OpenSim/Region/OptionalModules/Framework/Monitoring/ServerStats.cs b/OpenSim/Region/OptionalModules/Framework/Monitoring/ServerStats.cs index a3d2436..6e74ce0 100644 --- a/OpenSim/Region/OptionalModules/Framework/Monitoring/ServerStats.cs +++ b/OpenSim/Region/OptionalModules/Framework/Monitoring/ServerStats.cs | |||
@@ -140,9 +140,12 @@ public class ServerStats : ISharedRegionModule | |||
140 | } | 140 | } |
141 | #endregion ISharedRegionModule | 141 | #endregion ISharedRegionModule |
142 | 142 | ||
143 | private void MakeStat(string pName, string pUnit, string pContainer, Action<Stat> act) | 143 | private void MakeStat(string pName, string pDesc, string pUnit, string pContainer, Action<Stat> act) |
144 | { | 144 | { |
145 | Stat stat = new Stat(pName, pName, "", pUnit, CategoryServer, pContainer, StatType.Pull, act, StatVerbosity.Info); | 145 | string desc = pDesc; |
146 | if (desc == null) | ||
147 | desc = pName; | ||
148 | Stat stat = new Stat(pName, pName, desc, pUnit, CategoryServer, pContainer, StatType.Pull, act, StatVerbosity.Info); | ||
146 | StatsManager.RegisterStat(stat); | 149 | StatsManager.RegisterStat(stat); |
147 | RegisteredStats.Add(pName, stat); | 150 | RegisteredStats.Add(pName, stat); |
148 | } | 151 | } |
@@ -166,16 +169,16 @@ public class ServerStats : ISharedRegionModule | |||
166 | StatsManager.RegisterStat(tempStat); | 169 | StatsManager.RegisterStat(tempStat); |
167 | RegisteredStats.Add(tempName, tempStat); | 170 | RegisteredStats.Add(tempName, tempStat); |
168 | 171 | ||
169 | MakeStat("TotalProcessorTime", "sec", ContainerProcessor, | 172 | MakeStat("TotalProcessorTime", null, "sec", ContainerProcessor, |
170 | (s) => { s.Value = Process.GetCurrentProcess().TotalProcessorTime.TotalSeconds; }); | 173 | (s) => { s.Value = Process.GetCurrentProcess().TotalProcessorTime.TotalSeconds; }); |
171 | 174 | ||
172 | MakeStat("UserProcessorTime", "sec", ContainerProcessor, | 175 | MakeStat("UserProcessorTime", null, "sec", ContainerProcessor, |
173 | (s) => { s.Value = Process.GetCurrentProcess().UserProcessorTime.TotalSeconds; }); | 176 | (s) => { s.Value = Process.GetCurrentProcess().UserProcessorTime.TotalSeconds; }); |
174 | 177 | ||
175 | MakeStat("PrivilegedProcessorTime", "sec", ContainerProcessor, | 178 | MakeStat("PrivilegedProcessorTime", null, "sec", ContainerProcessor, |
176 | (s) => { s.Value = Process.GetCurrentProcess().PrivilegedProcessorTime.TotalSeconds; }); | 179 | (s) => { s.Value = Process.GetCurrentProcess().PrivilegedProcessorTime.TotalSeconds; }); |
177 | 180 | ||
178 | MakeStat("Threads", "threads", ContainerProcessor, | 181 | MakeStat("Threads", null, "threads", ContainerProcessor, |
179 | (s) => { s.Value = Process.GetCurrentProcess().Threads.Count; }); | 182 | (s) => { s.Value = Process.GetCurrentProcess().Threads.Count; }); |
180 | } | 183 | } |
181 | catch (Exception e) | 184 | catch (Exception e) |
@@ -196,8 +199,10 @@ public class ServerStats : ISharedRegionModule | |||
196 | string nicInterfaceType = nic.NetworkInterfaceType.ToString(); | 199 | string nicInterfaceType = nic.NetworkInterfaceType.ToString(); |
197 | if (!okInterfaceTypes.Contains(nicInterfaceType)) | 200 | if (!okInterfaceTypes.Contains(nicInterfaceType)) |
198 | { | 201 | { |
199 | m_log.DebugFormat("{0} Not including stats for network interface '{1}' of type '{2}'. To include, add to [Monitoring]NetworkInterfaceTypes='Ethernet,Loopback'", | 202 | m_log.DebugFormat("{0} Not including stats for network interface '{1}' of type '{2}'.", |
200 | LogHeader, nic.Name, nicInterfaceType); | 203 | LogHeader, nic.Name, nicInterfaceType); |
204 | m_log.DebugFormat("{0} To include, add to comma separated list in [Monitoring]NetworkInterfaceTypes={1}", | ||
205 | LogHeader, NetworkInterfaceTypes); | ||
201 | continue; | 206 | continue; |
202 | } | 207 | } |
203 | 208 | ||
@@ -206,14 +211,15 @@ public class ServerStats : ISharedRegionModule | |||
206 | IPv4InterfaceStatistics nicStats = nic.GetIPv4Statistics(); | 211 | IPv4InterfaceStatistics nicStats = nic.GetIPv4Statistics(); |
207 | if (nicStats != null) | 212 | if (nicStats != null) |
208 | { | 213 | { |
209 | MakeStat("BytesRcvd/" + nic.Name, "KB", ContainerNetwork, | 214 | MakeStat("BytesRcvd/" + nic.Name, nic.Name, "KB", ContainerNetwork, |
210 | (s) => { LookupNic(s, (ns) => { return ns.BytesReceived; }, 1024.0); }); | 215 | (s) => { LookupNic(s, (ns) => { return ns.BytesReceived; }, 1024.0); }); |
211 | MakeStat("BytesSent/" + nic.Name, "KB", ContainerNetwork, | 216 | MakeStat("BytesSent/" + nic.Name, nic.Name, "KB", ContainerNetwork, |
212 | (s) => { LookupNic(s, (ns) => { return ns.BytesSent; }, 1024.0); }); | 217 | (s) => { LookupNic(s, (ns) => { return ns.BytesSent; }, 1024.0); }); |
213 | MakeStat("TotalBytes/" + nic.Name, "KB", ContainerNetwork, | 218 | MakeStat("TotalBytes/" + nic.Name, nic.Name, "KB", ContainerNetwork, |
214 | (s) => { LookupNic(s, (ns) => { return ns.BytesSent + ns.BytesReceived; }, 1024.0); }); | 219 | (s) => { LookupNic(s, (ns) => { return ns.BytesSent + ns.BytesReceived; }, 1024.0); }); |
215 | } | 220 | } |
216 | } | 221 | } |
222 | // TODO: add IPv6 (it may actually happen someday) | ||
217 | } | 223 | } |
218 | } | 224 | } |
219 | catch (Exception e) | 225 | catch (Exception e) |
@@ -221,13 +227,13 @@ public class ServerStats : ISharedRegionModule | |||
221 | m_log.ErrorFormat("{0} Exception creating 'Network Interface': {1}", LogHeader, e); | 227 | m_log.ErrorFormat("{0} Exception creating 'Network Interface': {1}", LogHeader, e); |
222 | } | 228 | } |
223 | 229 | ||
224 | MakeStat("ProcessMemory", "MB", ContainerMemory, | 230 | MakeStat("ProcessMemory", null, "MB", ContainerMemory, |
225 | (s) => { s.Value = Process.GetCurrentProcess().WorkingSet64 / 1024d / 1024d; }); | 231 | (s) => { s.Value = Process.GetCurrentProcess().WorkingSet64 / 1024d / 1024d; }); |
226 | MakeStat("ObjectMemory", "MB", ContainerMemory, | 232 | MakeStat("ObjectMemory", null, "MB", ContainerMemory, |
227 | (s) => { s.Value = GC.GetTotalMemory(false) / 1024d / 1024d; }); | 233 | (s) => { s.Value = GC.GetTotalMemory(false) / 1024d / 1024d; }); |
228 | MakeStat("LastMemoryChurn", "MB/sec", ContainerMemory, | 234 | MakeStat("LastMemoryChurn", null, "MB/sec", ContainerMemory, |
229 | (s) => { s.Value = Math.Round(MemoryWatchdog.LastMemoryChurn * 1000d / 1024d / 1024d, 3); }); | 235 | (s) => { s.Value = Math.Round(MemoryWatchdog.LastMemoryChurn * 1000d / 1024d / 1024d, 3); }); |
230 | MakeStat("AverageMemoryChurn", "MB/sec", ContainerMemory, | 236 | MakeStat("AverageMemoryChurn", null, "MB/sec", ContainerMemory, |
231 | (s) => { s.Value = Math.Round(MemoryWatchdog.AverageMemoryChurn * 1000d / 1024d / 1024d, 3); }); | 237 | (s) => { s.Value = Math.Round(MemoryWatchdog.AverageMemoryChurn * 1000d / 1024d / 1024d, 3); }); |
232 | } | 238 | } |
233 | 239 | ||
@@ -263,6 +269,8 @@ public class ServerStats : ISharedRegionModule | |||
263 | } | 269 | } |
264 | } | 270 | } |
265 | 271 | ||
272 | // Lookup the nic that goes with this stat and set the value by using a fetch action. | ||
273 | // Not sure about closure with delegates inside delegates. | ||
266 | private delegate double GetIPv4StatValue(IPv4InterfaceStatistics interfaceStat); | 274 | private delegate double GetIPv4StatValue(IPv4InterfaceStatistics interfaceStat); |
267 | private void LookupNic(Stat stat, GetIPv4StatValue getter, double factor) | 275 | private void LookupNic(Stat stat, GetIPv4StatValue getter, double factor) |
268 | { | 276 | { |
@@ -275,7 +283,10 @@ public class ServerStats : ISharedRegionModule | |||
275 | { | 283 | { |
276 | IPv4InterfaceStatistics intrStats = nic.GetIPv4Statistics(); | 284 | IPv4InterfaceStatistics intrStats = nic.GetIPv4Statistics(); |
277 | if (intrStats != null) | 285 | if (intrStats != null) |
278 | stat.Value = Math.Round(getter(intrStats) / factor, 3); | 286 | { |
287 | double newVal = Math.Round(getter(intrStats) / factor, 3); | ||
288 | stat.Value = newVal; | ||
289 | } | ||
279 | break; | 290 | break; |
280 | } | 291 | } |
281 | } | 292 | } |
diff --git a/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStore.cs b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStore.cs index 40adba1..e498c6a 100644 --- a/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStore.cs +++ b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStore.cs | |||
@@ -145,7 +145,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore | |||
145 | /// | 145 | /// |
146 | /// </summary> | 146 | /// </summary> |
147 | // ----------------------------------------------------------------- | 147 | // ----------------------------------------------------------------- |
148 | public JsonStoreNodeType PathType(string expr) | 148 | public JsonStoreNodeType GetNodeType(string expr) |
149 | { | 149 | { |
150 | Stack<string> path; | 150 | Stack<string> path; |
151 | if (! ParsePathExpression(expr,out path)) | 151 | if (! ParsePathExpression(expr,out path)) |
@@ -173,6 +173,43 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore | |||
173 | /// | 173 | /// |
174 | /// </summary> | 174 | /// </summary> |
175 | // ----------------------------------------------------------------- | 175 | // ----------------------------------------------------------------- |
176 | public JsonStoreValueType GetValueType(string expr) | ||
177 | { | ||
178 | Stack<string> path; | ||
179 | if (! ParsePathExpression(expr,out path)) | ||
180 | return JsonStoreValueType.Undefined; | ||
181 | |||
182 | OSD result = ProcessPathExpression(ValueStore,path); | ||
183 | |||
184 | if (result == null) | ||
185 | return JsonStoreValueType.Undefined; | ||
186 | |||
187 | if (result is OSDMap) | ||
188 | return JsonStoreValueType.Undefined; | ||
189 | |||
190 | if (result is OSDArray) | ||
191 | return JsonStoreValueType.Undefined; | ||
192 | |||
193 | if (result is OSDBoolean) | ||
194 | return JsonStoreValueType.Boolean; | ||
195 | |||
196 | if (result is OSDInteger) | ||
197 | return JsonStoreValueType.Integer; | ||
198 | |||
199 | if (result is OSDReal) | ||
200 | return JsonStoreValueType.Float; | ||
201 | |||
202 | if (result is OSDString) | ||
203 | return JsonStoreValueType.String; | ||
204 | |||
205 | return JsonStoreValueType.Undefined; | ||
206 | } | ||
207 | |||
208 | // ----------------------------------------------------------------- | ||
209 | /// <summary> | ||
210 | /// | ||
211 | /// </summary> | ||
212 | // ----------------------------------------------------------------- | ||
176 | public int ArrayLength(string expr) | 213 | public int ArrayLength(string expr) |
177 | { | 214 | { |
178 | Stack<string> path; | 215 | Stack<string> path; |
diff --git a/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreModule.cs b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreModule.cs index e78a2f4..5fbfcc5 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 GetPathType(UUID storeID, string path) | 273 | public JsonStoreNodeType GetNodeType(UUID storeID, string path) |
274 | { | 274 | { |
275 | if (! m_enabled) return JsonStoreNodeType.Undefined; | 275 | if (! m_enabled) return JsonStoreNodeType.Undefined; |
276 | 276 | ||
@@ -287,7 +287,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore | |||
287 | try | 287 | try |
288 | { | 288 | { |
289 | lock (map) | 289 | lock (map) |
290 | return map.PathType(path); | 290 | return map.GetNodeType(path); |
291 | } | 291 | } |
292 | catch (Exception e) | 292 | catch (Exception e) |
293 | { | 293 | { |
@@ -302,6 +302,38 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore | |||
302 | /// | 302 | /// |
303 | /// </summary> | 303 | /// </summary> |
304 | // ----------------------------------------------------------------- | 304 | // ----------------------------------------------------------------- |
305 | public JsonStoreValueType GetValueType(UUID storeID, string path) | ||
306 | { | ||
307 | if (! m_enabled) return JsonStoreValueType.Undefined; | ||
308 | |||
309 | JsonStore map = null; | ||
310 | lock (m_JsonValueStore) | ||
311 | { | ||
312 | if (! m_JsonValueStore.TryGetValue(storeID,out map)) | ||
313 | { | ||
314 | m_log.InfoFormat("[JsonStore] Missing store {0}",storeID); | ||
315 | return JsonStoreValueType.Undefined; | ||
316 | } | ||
317 | } | ||
318 | |||
319 | try | ||
320 | { | ||
321 | lock (map) | ||
322 | return map.GetValueType(path); | ||
323 | } | ||
324 | catch (Exception e) | ||
325 | { | ||
326 | m_log.Error(string.Format("[JsonStore]: Path test failed for {0} in {1}", path, storeID), e); | ||
327 | } | ||
328 | |||
329 | return JsonStoreValueType.Undefined; | ||
330 | } | ||
331 | |||
332 | // ----------------------------------------------------------------- | ||
333 | /// <summary> | ||
334 | /// | ||
335 | /// </summary> | ||
336 | // ----------------------------------------------------------------- | ||
305 | public bool SetValue(UUID storeID, string path, string value, bool useJson) | 337 | public bool SetValue(UUID storeID, string path, string value, bool useJson) |
306 | { | 338 | { |
307 | if (! m_enabled) return false; | 339 | if (! m_enabled) return false; |
diff --git a/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreScriptModule.cs b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreScriptModule.cs index e13eb56..4a754a9 100644 --- a/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreScriptModule.cs +++ b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreScriptModule.cs | |||
@@ -192,16 +192,32 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore | |||
192 | #region ScriptConstantsInterface | 192 | #region ScriptConstantsInterface |
193 | 193 | ||
194 | [ScriptConstant] | 194 | [ScriptConstant] |
195 | public static readonly int JSON_TYPE_UNDEF = (int)JsonStoreNodeType.Undefined; | 195 | public static readonly int JSON_NODETYPE_UNDEF = (int)JsonStoreNodeType.Undefined; |
196 | 196 | ||
197 | [ScriptConstant] | 197 | [ScriptConstant] |
198 | public static readonly int JSON_TYPE_OBJECT = (int)JsonStoreNodeType.Object; | 198 | public static readonly int JSON_NODETYPE_OBJECT = (int)JsonStoreNodeType.Object; |
199 | 199 | ||
200 | [ScriptConstant] | 200 | [ScriptConstant] |
201 | public static readonly int JSON_TYPE_ARRAY = (int)JsonStoreNodeType.Array; | 201 | public static readonly int JSON_NODETYPE_ARRAY = (int)JsonStoreNodeType.Array; |
202 | 202 | ||
203 | [ScriptConstant] | 203 | [ScriptConstant] |
204 | public static readonly int JSON_TYPE_VALUE = (int)JsonStoreNodeType.Value; | 204 | public static readonly int JSON_NODETYPE_VALUE = (int)JsonStoreNodeType.Value; |
205 | |||
206 | [ScriptConstant] | ||
207 | public static readonly int JSON_VALUETYPE_UNDEF = (int)JsonStoreValueType.Undefined; | ||
208 | |||
209 | [ScriptConstant] | ||
210 | public static readonly int JSON_VALUETYPE_BOOLEAN = (int)JsonStoreValueType.Boolean; | ||
211 | |||
212 | [ScriptConstant] | ||
213 | public static readonly int JSON_VALUETYPE_INTEGER = (int)JsonStoreValueType.Integer; | ||
214 | |||
215 | [ScriptConstant] | ||
216 | public static readonly int JSON_VALUETYPE_FLOAT = (int)JsonStoreValueType.Float; | ||
217 | |||
218 | [ScriptConstant] | ||
219 | public static readonly int JSON_VALUETYPE_STRING = (int)JsonStoreValueType.String; | ||
220 | |||
205 | 221 | ||
206 | #endregion | 222 | #endregion |
207 | 223 | ||
@@ -310,9 +326,20 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore | |||
310 | /// </summary> | 326 | /// </summary> |
311 | // ----------------------------------------------------------------- | 327 | // ----------------------------------------------------------------- |
312 | [ScriptInvocation] | 328 | [ScriptInvocation] |
313 | public int JsonGetPathType(UUID hostID, UUID scriptID, UUID storeID, string path) | 329 | public int JsonGetNodeType(UUID hostID, UUID scriptID, UUID storeID, string path) |
330 | { | ||
331 | return (int)m_store.GetNodeType(storeID,path); | ||
332 | } | ||
333 | |||
334 | // ----------------------------------------------------------------- | ||
335 | /// <summary> | ||
336 | /// | ||
337 | /// </summary> | ||
338 | // ----------------------------------------------------------------- | ||
339 | [ScriptInvocation] | ||
340 | public int JsonGetValueType(UUID hostID, UUID scriptID, UUID storeID, string path) | ||
314 | { | 341 | { |
315 | return (int)m_store.GetPathType(storeID,path); | 342 | return (int)m_store.GetValueType(storeID,path); |
316 | } | 343 | } |
317 | 344 | ||
318 | // ----------------------------------------------------------------- | 345 | // ----------------------------------------------------------------- |
diff --git a/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs b/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs index b64dbd4..bfa9937 100644 --- a/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs +++ b/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs | |||
@@ -158,8 +158,8 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests | |||
158 | 158 | ||
159 | Assert.That(dsrv, Is.EqualTo(1)); | 159 | Assert.That(dsrv, Is.EqualTo(1)); |
160 | 160 | ||
161 | int tprv = (int)InvokeOp("JsonGetPathType", storeId, "Hello"); | 161 | int tprv = (int)InvokeOp("JsonGetNodeType", storeId, "Hello"); |
162 | Assert.That(tprv, Is.EqualTo(JsonStoreScriptModule.JSON_TYPE_UNDEF)); | 162 | Assert.That(tprv, Is.EqualTo(JsonStoreScriptModule.JSON_NODETYPE_UNDEF)); |
163 | } | 163 | } |
164 | 164 | ||
165 | [Test] | 165 | [Test] |
@@ -277,8 +277,8 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests | |||
277 | int returnValue = (int)InvokeOp( "JsonRemoveValue", storeId, "Hello"); | 277 | int returnValue = (int)InvokeOp( "JsonRemoveValue", storeId, "Hello"); |
278 | Assert.That(returnValue, Is.EqualTo(1)); | 278 | Assert.That(returnValue, Is.EqualTo(1)); |
279 | 279 | ||
280 | int result = (int)InvokeOp("JsonGetPathType", storeId, "Hello"); | 280 | int result = (int)InvokeOp("JsonGetNodeType", storeId, "Hello"); |
281 | Assert.That(result, Is.EqualTo(JsonStoreScriptModule.JSON_TYPE_UNDEF)); | 281 | Assert.That(result, Is.EqualTo(JsonStoreScriptModule.JSON_NODETYPE_UNDEF)); |
282 | 282 | ||
283 | string returnValue2 = (string)InvokeOp("JsonGetValue", storeId, "Hello"); | 283 | string returnValue2 = (string)InvokeOp("JsonGetValue", storeId, "Hello"); |
284 | Assert.That(returnValue2, Is.EqualTo("")); | 284 | Assert.That(returnValue2, Is.EqualTo("")); |
@@ -291,8 +291,8 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests | |||
291 | int returnValue = (int)InvokeOp( "JsonRemoveValue", storeId, "Hello"); | 291 | int returnValue = (int)InvokeOp( "JsonRemoveValue", storeId, "Hello"); |
292 | Assert.That(returnValue, Is.EqualTo(1)); | 292 | Assert.That(returnValue, Is.EqualTo(1)); |
293 | 293 | ||
294 | int result = (int)InvokeOp("JsonGetPathType", storeId, "Hello"); | 294 | int result = (int)InvokeOp("JsonGetNodeType", storeId, "Hello"); |
295 | Assert.That(result, Is.EqualTo(JsonStoreScriptModule.JSON_TYPE_UNDEF)); | 295 | Assert.That(result, Is.EqualTo(JsonStoreScriptModule.JSON_NODETYPE_UNDEF)); |
296 | 296 | ||
297 | string returnValue2 = (string)InvokeOp("JsonGetJson", storeId, "Hello"); | 297 | string returnValue2 = (string)InvokeOp("JsonGetJson", storeId, "Hello"); |
298 | Assert.That(returnValue2, Is.EqualTo("")); | 298 | Assert.That(returnValue2, Is.EqualTo("")); |
@@ -306,11 +306,11 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests | |||
306 | int returnValue = (int)InvokeOp( "JsonRemoveValue", storeId, "Hello[0]"); | 306 | int returnValue = (int)InvokeOp( "JsonRemoveValue", storeId, "Hello[0]"); |
307 | Assert.That(returnValue, Is.EqualTo(1)); | 307 | Assert.That(returnValue, Is.EqualTo(1)); |
308 | 308 | ||
309 | int result = (int)InvokeOp("JsonGetPathType", storeId, "Hello[0]"); | 309 | int result = (int)InvokeOp("JsonGetNodeType", storeId, "Hello[0]"); |
310 | Assert.That(result, Is.EqualTo(JsonStoreScriptModule.JSON_TYPE_VALUE)); | 310 | Assert.That(result, Is.EqualTo(JsonStoreScriptModule.JSON_NODETYPE_VALUE)); |
311 | 311 | ||
312 | result = (int)InvokeOp("JsonGetPathType", storeId, "Hello[1]"); | 312 | result = (int)InvokeOp("JsonGetNodeType", storeId, "Hello[1]"); |
313 | Assert.That(result, Is.EqualTo(JsonStoreScriptModule.JSON_TYPE_UNDEF)); | 313 | Assert.That(result, Is.EqualTo(JsonStoreScriptModule.JSON_NODETYPE_UNDEF)); |
314 | 314 | ||
315 | string stringReturnValue = (string)InvokeOp("JsonGetValue", storeId, "Hello[0]"); | 315 | string stringReturnValue = (string)InvokeOp("JsonGetValue", storeId, "Hello[0]"); |
316 | Assert.That(stringReturnValue, Is.EqualTo("value2")); | 316 | Assert.That(stringReturnValue, Is.EqualTo("value2")); |
@@ -433,7 +433,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests | |||
433 | } | 433 | } |
434 | 434 | ||
435 | [Test] | 435 | [Test] |
436 | public void TestJsonGetPathType() | 436 | public void TestJsonGetNodeType() |
437 | { | 437 | { |
438 | TestHelpers.InMethod(); | 438 | TestHelpers.InMethod(); |
439 | // TestHelpers.EnableLogging(); | 439 | // TestHelpers.EnableLogging(); |
@@ -441,41 +441,41 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests | |||
441 | UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ 'Hello' : { 'World' : [ 'one', 2 ] } }"); | 441 | UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ 'Hello' : { 'World' : [ 'one', 2 ] } }"); |
442 | 442 | ||
443 | { | 443 | { |
444 | int result = (int)InvokeOp("JsonGetPathType", storeId, "."); | 444 | int result = (int)InvokeOp("JsonGetNodeType", storeId, "."); |
445 | Assert.That(result, Is.EqualTo(JsonStoreScriptModule.JSON_TYPE_OBJECT)); | 445 | Assert.That(result, Is.EqualTo(JsonStoreScriptModule.JSON_NODETYPE_OBJECT)); |
446 | } | 446 | } |
447 | 447 | ||
448 | { | 448 | { |
449 | int result = (int)InvokeOp("JsonGetPathType", storeId, "Hello"); | 449 | int result = (int)InvokeOp("JsonGetNodeType", storeId, "Hello"); |
450 | Assert.That(result, Is.EqualTo(JsonStoreScriptModule.JSON_TYPE_OBJECT)); | 450 | Assert.That(result, Is.EqualTo(JsonStoreScriptModule.JSON_NODETYPE_OBJECT)); |
451 | } | 451 | } |
452 | 452 | ||
453 | { | 453 | { |
454 | int result = (int)InvokeOp("JsonGetPathType", storeId, "Hello.World"); | 454 | int result = (int)InvokeOp("JsonGetNodeType", storeId, "Hello.World"); |
455 | Assert.That(result, Is.EqualTo(JsonStoreScriptModule.JSON_TYPE_ARRAY)); | 455 | Assert.That(result, Is.EqualTo(JsonStoreScriptModule.JSON_NODETYPE_ARRAY)); |
456 | } | 456 | } |
457 | 457 | ||
458 | { | 458 | { |
459 | int result = (int)InvokeOp("JsonGetPathType", storeId, "Hello.World[0]"); | 459 | int result = (int)InvokeOp("JsonGetNodeType", storeId, "Hello.World[0]"); |
460 | Assert.That(result, Is.EqualTo(JsonStoreScriptModule.JSON_TYPE_VALUE)); | 460 | Assert.That(result, Is.EqualTo(JsonStoreScriptModule.JSON_NODETYPE_VALUE)); |
461 | } | 461 | } |
462 | 462 | ||
463 | { | 463 | { |
464 | int result = (int)InvokeOp("JsonGetPathType", storeId, "Hello.World[1]"); | 464 | int result = (int)InvokeOp("JsonGetNodeType", storeId, "Hello.World[1]"); |
465 | Assert.That(result, Is.EqualTo(JsonStoreScriptModule.JSON_TYPE_VALUE)); | 465 | Assert.That(result, Is.EqualTo(JsonStoreScriptModule.JSON_NODETYPE_VALUE)); |
466 | } | 466 | } |
467 | 467 | ||
468 | // Test for non-existant path | 468 | // Test for non-existant path |
469 | { | 469 | { |
470 | int result = (int)InvokeOp("JsonGetPathType", storeId, "foo"); | 470 | int result = (int)InvokeOp("JsonGetNodeType", storeId, "foo"); |
471 | Assert.That(result, Is.EqualTo(JsonStoreScriptModule.JSON_TYPE_UNDEF)); | 471 | Assert.That(result, Is.EqualTo(JsonStoreScriptModule.JSON_NODETYPE_UNDEF)); |
472 | } | 472 | } |
473 | 473 | ||
474 | // Test for non-existant store | 474 | // Test for non-existant store |
475 | { | 475 | { |
476 | UUID fakeStoreId = TestHelpers.ParseTail(0x500); | 476 | UUID fakeStoreId = TestHelpers.ParseTail(0x500); |
477 | int result = (int)InvokeOp("JsonGetPathType", fakeStoreId, "."); | 477 | int result = (int)InvokeOp("JsonGetNodeType", fakeStoreId, "."); |
478 | Assert.That(result, Is.EqualTo(JsonStoreScriptModule.JSON_TYPE_UNDEF)); | 478 | Assert.That(result, Is.EqualTo(JsonStoreScriptModule.JSON_NODETYPE_UNDEF)); |
479 | } | 479 | } |
480 | } | 480 | } |
481 | 481 | ||