diff options
author | Justin Clark-Casey (justincc) | 2013-02-15 00:38:07 +0000 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2013-02-15 00:38:07 +0000 |
commit | 61f18d15e1115275588e9e5a27f5d148ed762b4e (patch) | |
tree | d801a0e6581eaec1e67f1036bde662a56be07a60 /OpenSim/Region/OptionalModules | |
parent | Comment out regression TestJsonTestPath and TestJsonTestPathJson as these wil... (diff) | |
download | opensim-SC_OLD-61f18d15e1115275588e9e5a27f5d148ed762b4e.zip opensim-SC_OLD-61f18d15e1115275588e9e5a27f5d148ed762b4e.tar.gz opensim-SC_OLD-61f18d15e1115275588e9e5a27f5d148ed762b4e.tar.bz2 opensim-SC_OLD-61f18d15e1115275588e9e5a27f5d148ed762b4e.tar.xz |
Rename JsonSetValueJson() -> JsonSetJson() and JsonGetValueJson() -> JsonGetJson()
This is because JsonGetJson() is getting json from anywhere in the structure, not just values.
Equally, JsonSetJson() is setting any type of json, not just json which represents a value.
Agreed with cmickeyb
Diffstat (limited to 'OpenSim/Region/OptionalModules')
-rw-r--r-- | OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreScriptModule.cs | 4 | ||||
-rw-r--r-- | OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs | 26 |
2 files changed, 15 insertions, 15 deletions
diff --git a/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreScriptModule.cs b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreScriptModule.cs index 1ed7df7..ef08c05 100644 --- a/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreScriptModule.cs +++ b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreScriptModule.cs | |||
@@ -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 | } |
@@ -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 1c4737b..ffa8250 100644 --- a/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs +++ b/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs | |||
@@ -209,7 +209,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests | |||
209 | } | 209 | } |
210 | 210 | ||
211 | [Test] | 211 | [Test] |
212 | public void TestJsonGetValueJson() | 212 | public void TestJsonGetJson() |
213 | { | 213 | { |
214 | TestHelpers.InMethod(); | 214 | TestHelpers.InMethod(); |
215 | // TestHelpers.EnableLogging(); | 215 | // TestHelpers.EnableLogging(); |
@@ -217,26 +217,26 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests | |||
217 | UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ 'Hello' : { 'World' : 'Two' } }"); | 217 | UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ 'Hello' : { 'World' : 'Two' } }"); |
218 | 218 | ||
219 | { | 219 | { |
220 | string value = (string)InvokeOp("JsonGetValueJson", storeId, "Hello.World"); | 220 | string value = (string)InvokeOp("JsonGetJson", storeId, "Hello.World"); |
221 | Assert.That(value, Is.EqualTo("'Two'")); | 221 | Assert.That(value, Is.EqualTo("'Two'")); |
222 | } | 222 | } |
223 | 223 | ||
224 | // Test get of path section instead of leaf | 224 | // Test get of path section instead of leaf |
225 | { | 225 | { |
226 | string value = (string)InvokeOp("JsonGetValueJson", storeId, "Hello"); | 226 | string value = (string)InvokeOp("JsonGetJson", storeId, "Hello"); |
227 | Assert.That(value, Is.EqualTo("{\"World\":\"Two\"}")); | 227 | Assert.That(value, Is.EqualTo("{\"World\":\"Two\"}")); |
228 | } | 228 | } |
229 | 229 | ||
230 | // Test get of non-existing value | 230 | // Test get of non-existing value |
231 | { | 231 | { |
232 | string fakeValueGet = (string)InvokeOp("JsonGetValueJson", storeId, "foo"); | 232 | string fakeValueGet = (string)InvokeOp("JsonGetJson", storeId, "foo"); |
233 | Assert.That(fakeValueGet, Is.EqualTo("")); | 233 | Assert.That(fakeValueGet, Is.EqualTo("")); |
234 | } | 234 | } |
235 | 235 | ||
236 | // Test get from non-existing store | 236 | // Test get from non-existing store |
237 | { | 237 | { |
238 | UUID fakeStoreId = TestHelpers.ParseTail(0x500); | 238 | UUID fakeStoreId = TestHelpers.ParseTail(0x500); |
239 | string fakeStoreValueGet = (string)InvokeOp("JsonGetValueJson", fakeStoreId, "Hello"); | 239 | string fakeStoreValueGet = (string)InvokeOp("JsonGetJson", fakeStoreId, "Hello"); |
240 | Assert.That(fakeStoreValueGet, Is.EqualTo("")); | 240 | Assert.That(fakeStoreValueGet, Is.EqualTo("")); |
241 | } | 241 | } |
242 | } | 242 | } |
@@ -294,7 +294,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests | |||
294 | int result = (int)InvokeOp("JsonTestPath", storeId, "Hello"); | 294 | int result = (int)InvokeOp("JsonTestPath", storeId, "Hello"); |
295 | Assert.That(result, Is.EqualTo(0)); | 295 | Assert.That(result, Is.EqualTo(0)); |
296 | 296 | ||
297 | string returnValue2 = (string)InvokeOp("JsonGetValueJson", storeId, "Hello"); | 297 | string returnValue2 = (string)InvokeOp("JsonGetJson", storeId, "Hello"); |
298 | Assert.That(returnValue2, Is.EqualTo("")); | 298 | Assert.That(returnValue2, Is.EqualTo("")); |
299 | } | 299 | } |
300 | 300 | ||
@@ -315,7 +315,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests | |||
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")); |
317 | 317 | ||
318 | stringReturnValue = (string)InvokeOp("JsonGetValueJson", storeId, "Hello[1]"); | 318 | stringReturnValue = (string)InvokeOp("JsonGetJson", storeId, "Hello[1]"); |
319 | Assert.That(stringReturnValue, Is.EqualTo("")); | 319 | Assert.That(stringReturnValue, Is.EqualTo("")); |
320 | } | 320 | } |
321 | 321 | ||
@@ -689,7 +689,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests | |||
689 | } | 689 | } |
690 | 690 | ||
691 | [Test] | 691 | [Test] |
692 | public void TestJsonSetValueJson() | 692 | public void TestJsonSetJson() |
693 | { | 693 | { |
694 | TestHelpers.InMethod(); | 694 | TestHelpers.InMethod(); |
695 | // TestHelpers.EnableLogging(); | 695 | // TestHelpers.EnableLogging(); |
@@ -698,7 +698,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests | |||
698 | { | 698 | { |
699 | UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ }"); | 699 | UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ }"); |
700 | 700 | ||
701 | int result = (int)InvokeOp("JsonSetValueJson", storeId, "Fun", "'Times'"); | 701 | int result = (int)InvokeOp("JsonSetJson", storeId, "Fun", "'Times'"); |
702 | Assert.That(result, Is.EqualTo(1)); | 702 | Assert.That(result, Is.EqualTo(1)); |
703 | 703 | ||
704 | string value = (string)InvokeOp("JsonGetValue", storeId, "Fun"); | 704 | string value = (string)InvokeOp("JsonGetValue", storeId, "Fun"); |
@@ -709,7 +709,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests | |||
709 | { | 709 | { |
710 | UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ }"); | 710 | UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ }"); |
711 | 711 | ||
712 | int result = (int)InvokeOp("JsonSetValueJson", storeId, "Fun", "{ 'Filled' : 'Times' }"); | 712 | int result = (int)InvokeOp("JsonSetJson", storeId, "Fun", "{ 'Filled' : 'Times' }"); |
713 | Assert.That(result, Is.EqualTo(1)); | 713 | Assert.That(result, Is.EqualTo(1)); |
714 | 714 | ||
715 | string value = (string)InvokeOp("JsonGetValue", storeId, "Fun.Filled"); | 715 | string value = (string)InvokeOp("JsonGetValue", storeId, "Fun.Filled"); |
@@ -720,7 +720,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests | |||
720 | { | 720 | { |
721 | UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ }"); | 721 | UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ }"); |
722 | 722 | ||
723 | int result = (int)InvokeOp("JsonSetValueJson", storeId, "Fun", "Times"); | 723 | int result = (int)InvokeOp("JsonSetJson", storeId, "Fun", "Times"); |
724 | Assert.That(result, Is.EqualTo(0)); | 724 | Assert.That(result, Is.EqualTo(0)); |
725 | 725 | ||
726 | string value = (string)InvokeOp("JsonGetValue", storeId, "Fun"); | 726 | string value = (string)InvokeOp("JsonGetValue", storeId, "Fun"); |
@@ -731,7 +731,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests | |||
731 | { | 731 | { |
732 | UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ }"); | 732 | UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ }"); |
733 | 733 | ||
734 | int result = (int)InvokeOp("JsonSetValueJson", storeId, "Fun.Circus", "'Times'"); | 734 | int result = (int)InvokeOp("JsonSetJson", storeId, "Fun.Circus", "'Times'"); |
735 | Assert.That(result, Is.EqualTo(0)); | 735 | Assert.That(result, Is.EqualTo(0)); |
736 | 736 | ||
737 | string value = (string)InvokeOp("JsonGetValue", storeId, "Fun.Circus"); | 737 | string value = (string)InvokeOp("JsonGetValue", storeId, "Fun.Circus"); |
@@ -741,7 +741,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests | |||
741 | // Test with fake store | 741 | // Test with fake store |
742 | { | 742 | { |
743 | UUID fakeStoreId = TestHelpers.ParseTail(0x500); | 743 | UUID fakeStoreId = TestHelpers.ParseTail(0x500); |
744 | int fakeStoreValueSet = (int)InvokeOp("JsonSetValueJson", fakeStoreId, "Hello", "'World'"); | 744 | int fakeStoreValueSet = (int)InvokeOp("JsonSetJson", fakeStoreId, "Hello", "'World'"); |
745 | Assert.That(fakeStoreValueSet, Is.EqualTo(0)); | 745 | Assert.That(fakeStoreValueSet, Is.EqualTo(0)); |
746 | } | 746 | } |
747 | } | 747 | } |