diff options
Diffstat (limited to 'OpenSim')
3 files changed, 29 insertions, 15 deletions
diff --git a/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStore.cs b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStore.cs index 751e463..5808d46 100644 --- a/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStore.cs +++ b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStore.cs | |||
@@ -114,7 +114,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore | |||
114 | m_ReadStore = new List<TakeValueCallbackClass>(); | 114 | m_ReadStore = new List<TakeValueCallbackClass>(); |
115 | } | 115 | } |
116 | 116 | ||
117 | public JsonStore(string value) | 117 | public JsonStore(string value) : this() |
118 | { | 118 | { |
119 | if (String.IsNullOrEmpty(value)) | 119 | if (String.IsNullOrEmpty(value)) |
120 | ValueStore = new OSDMap(); | 120 | ValueStore = new OSDMap(); |
diff --git a/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreModule.cs b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreModule.cs index a36ef42..3b52e44 100644 --- a/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreModule.cs +++ b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreModule.cs | |||
@@ -93,12 +93,12 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore | |||
93 | } | 93 | } |
94 | catch (Exception e) | 94 | catch (Exception e) |
95 | { | 95 | { |
96 | m_log.ErrorFormat("[JsonStore] initialization error: {0}",e.Message); | 96 | m_log.Error("[JsonStore]: initialization error: {0}", e); |
97 | return; | 97 | return; |
98 | } | 98 | } |
99 | 99 | ||
100 | if (m_enabled) | 100 | if (m_enabled) |
101 | m_log.DebugFormat("[JsonStore] module is enabled"); | 101 | m_log.DebugFormat("[JsonStore]: module is enabled"); |
102 | } | 102 | } |
103 | 103 | ||
104 | // ----------------------------------------------------------------- | 104 | // ----------------------------------------------------------------- |
@@ -182,7 +182,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore | |||
182 | SceneObjectPart sop = m_scene.GetSceneObjectPart(objectID); | 182 | SceneObjectPart sop = m_scene.GetSceneObjectPart(objectID); |
183 | if (sop == null) | 183 | if (sop == null) |
184 | { | 184 | { |
185 | m_log.InfoFormat("[JsonStore] unable to attach to unknown object; {0}",objectID); | 185 | m_log.ErrorFormat("[JsonStore] unable to attach to unknown object; {0}", objectID); |
186 | return false; | 186 | return false; |
187 | } | 187 | } |
188 | 188 | ||
@@ -219,7 +219,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore | |||
219 | } | 219 | } |
220 | catch (Exception e) | 220 | catch (Exception e) |
221 | { | 221 | { |
222 | m_log.InfoFormat("[JsonStore] Unable to initialize store from {0}; {1}",value,e.Message); | 222 | m_log.Error(string.Format("[JsonStore]: Unable to initialize store from {0}", value), e); |
223 | return false; | 223 | return false; |
224 | } | 224 | } |
225 | 225 | ||
@@ -283,7 +283,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore | |||
283 | } | 283 | } |
284 | catch (Exception e) | 284 | catch (Exception e) |
285 | { | 285 | { |
286 | m_log.InfoFormat("[JsonStore] Path test failed for {0} in {1}; {2}",path,storeID,e.Message); | 286 | m_log.Error(string.Format("[JsonStore]: Path test failed for {0} in {1}", path, storeID), e); |
287 | } | 287 | } |
288 | 288 | ||
289 | return false; | 289 | return false; |
@@ -316,7 +316,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore | |||
316 | } | 316 | } |
317 | catch (Exception e) | 317 | catch (Exception e) |
318 | { | 318 | { |
319 | m_log.InfoFormat("[JsonStore] Unable to assign {0} to {1} in {2}; {3}",value,path,storeID,e.Message); | 319 | m_log.Error(string.Format("[JsonStore]: Unable to assign {0} to {1} in {2}", value, path, storeID), e); |
320 | } | 320 | } |
321 | 321 | ||
322 | return false; | 322 | return false; |
@@ -349,7 +349,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore | |||
349 | } | 349 | } |
350 | catch (Exception e) | 350 | catch (Exception e) |
351 | { | 351 | { |
352 | m_log.InfoFormat("[JsonStore] Unable to remove {0} in {1}; {2}",path,storeID,e.Message); | 352 | m_log.Error(string.Format("[JsonStore]: Unable to remove {0} in {1}", path, storeID), e); |
353 | } | 353 | } |
354 | 354 | ||
355 | return false; | 355 | return false; |
@@ -382,7 +382,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore | |||
382 | } | 382 | } |
383 | catch (Exception e) | 383 | catch (Exception e) |
384 | { | 384 | { |
385 | m_log.InfoFormat("[JsonStore] unable to retrieve value; {0}",e.Message); | 385 | m_log.Error("[JsonStore]: unable to retrieve value", e); |
386 | } | 386 | } |
387 | 387 | ||
388 | return false; | 388 | return false; |
@@ -421,7 +421,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore | |||
421 | } | 421 | } |
422 | catch (Exception e) | 422 | catch (Exception e) |
423 | { | 423 | { |
424 | m_log.InfoFormat("[JsonStore] unable to retrieve value; {0}",e.ToString()); | 424 | m_log.Error("[JsonStore] unable to retrieve value", e); |
425 | } | 425 | } |
426 | 426 | ||
427 | cback(String.Empty); | 427 | cback(String.Empty); |
@@ -460,7 +460,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore | |||
460 | } | 460 | } |
461 | catch (Exception e) | 461 | catch (Exception e) |
462 | { | 462 | { |
463 | m_log.InfoFormat("[JsonStore] unable to retrieve value; {0}",e.ToString()); | 463 | m_log.Error("[JsonStore]: unable to retrieve value", e); |
464 | } | 464 | } |
465 | 465 | ||
466 | cback(String.Empty); | 466 | cback(String.Empty); |
diff --git a/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs b/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs index 98b5624..5484d8d 100644 --- a/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs +++ b/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs | |||
@@ -135,6 +135,20 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests | |||
135 | } | 135 | } |
136 | 136 | ||
137 | [Test] | 137 | [Test] |
138 | public void TestJsonDestroyStoreNotExists() | ||
139 | { | ||
140 | TestHelpers.InMethod(); | ||
141 | // TestHelpers.EnableLogging(); | ||
142 | |||
143 | UUID fakeStoreId = TestHelpers.ParseTail(0x500); | ||
144 | |||
145 | int dsrv = (int)InvokeOp("JsonDestroyStore", fakeStoreId); | ||
146 | |||
147 | // XXX: Current returns 'true' even though no such store existed. Need to ask if this is best behaviour. | ||
148 | Assert.That(dsrv, Is.EqualTo(1)); | ||
149 | } | ||
150 | |||
151 | [Test] | ||
138 | public void TestJsonGetValue() | 152 | public void TestJsonGetValue() |
139 | { | 153 | { |
140 | TestHelpers.InMethod(); | 154 | TestHelpers.InMethod(); |
@@ -205,13 +219,13 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests | |||
205 | TestHelpers.InMethod(); | 219 | TestHelpers.InMethod(); |
206 | // TestHelpers.EnableLogging(); | 220 | // TestHelpers.EnableLogging(); |
207 | 221 | ||
208 | UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{}"); | 222 | UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ }"); |
209 | 223 | ||
210 | int result = (int)InvokeOp("JsonSetValue", storeId, "Hello", "World"); | 224 | int result = (int)InvokeOp("JsonSetValue", storeId, "Fun", "Times"); |
211 | Assert.That(result, Is.EqualTo(1)); | 225 | Assert.That(result, Is.EqualTo(1)); |
212 | 226 | ||
213 | string value = (string)InvokeOp("JsonGetValue", storeId, "Hello"); | 227 | string value = (string)InvokeOp("JsonGetValue", storeId, "Fun"); |
214 | Assert.That(value, Is.EqualTo("World")); | 228 | Assert.That(value, Is.EqualTo("Times")); |
215 | } | 229 | } |
216 | 230 | ||
217 | /// <summary> | 231 | /// <summary> |