From 61f18d15e1115275588e9e5a27f5d148ed762b4e Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Fri, 15 Feb 2013 00:38:07 +0000 Subject: [PATCH] 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 --- .../JsonStore/JsonStoreScriptModule.cs | 4 +-- .../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 1ed7df7aaf..ef08c05b9c 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 } [ScriptInvocation] - public int JsonSetValueJson(UUID hostID, UUID scriptID, UUID storeID, string path, string value) + public int JsonSetJson(UUID hostID, UUID scriptID, UUID storeID, string path, string value) { return m_store.SetValue(storeID,path,value,true) ? 1 : 0; } @@ -406,7 +406,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore } [ScriptInvocation] - public string JsonGetValueJson(UUID hostID, UUID scriptID, UUID storeID, string path) + public string JsonGetJson(UUID hostID, UUID scriptID, UUID storeID, string path) { string value = String.Empty; 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 1c4737be86..ffa825050b 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 } [Test] - public void TestJsonGetValueJson() + public void TestJsonGetJson() { TestHelpers.InMethod(); // TestHelpers.EnableLogging(); @@ -217,26 +217,26 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ 'Hello' : { 'World' : 'Two' } }"); { - string value = (string)InvokeOp("JsonGetValueJson", storeId, "Hello.World"); + string value = (string)InvokeOp("JsonGetJson", storeId, "Hello.World"); Assert.That(value, Is.EqualTo("'Two'")); } // Test get of path section instead of leaf { - string value = (string)InvokeOp("JsonGetValueJson", storeId, "Hello"); + string value = (string)InvokeOp("JsonGetJson", storeId, "Hello"); Assert.That(value, Is.EqualTo("{\"World\":\"Two\"}")); } // Test get of non-existing value { - string fakeValueGet = (string)InvokeOp("JsonGetValueJson", storeId, "foo"); + string fakeValueGet = (string)InvokeOp("JsonGetJson", storeId, "foo"); Assert.That(fakeValueGet, Is.EqualTo("")); } // Test get from non-existing store { UUID fakeStoreId = TestHelpers.ParseTail(0x500); - string fakeStoreValueGet = (string)InvokeOp("JsonGetValueJson", fakeStoreId, "Hello"); + string fakeStoreValueGet = (string)InvokeOp("JsonGetJson", fakeStoreId, "Hello"); Assert.That(fakeStoreValueGet, Is.EqualTo("")); } } @@ -294,7 +294,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests int result = (int)InvokeOp("JsonTestPath", storeId, "Hello"); Assert.That(result, Is.EqualTo(0)); - string returnValue2 = (string)InvokeOp("JsonGetValueJson", storeId, "Hello"); + string returnValue2 = (string)InvokeOp("JsonGetJson", storeId, "Hello"); Assert.That(returnValue2, Is.EqualTo("")); } @@ -315,7 +315,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests string stringReturnValue = (string)InvokeOp("JsonGetValue", storeId, "Hello[0]"); Assert.That(stringReturnValue, Is.EqualTo("value2")); - stringReturnValue = (string)InvokeOp("JsonGetValueJson", storeId, "Hello[1]"); + stringReturnValue = (string)InvokeOp("JsonGetJson", storeId, "Hello[1]"); Assert.That(stringReturnValue, Is.EqualTo("")); } @@ -689,7 +689,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests } [Test] - public void TestJsonSetValueJson() + public void TestJsonSetJson() { TestHelpers.InMethod(); // TestHelpers.EnableLogging(); @@ -698,7 +698,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests { UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ }"); - int result = (int)InvokeOp("JsonSetValueJson", storeId, "Fun", "'Times'"); + int result = (int)InvokeOp("JsonSetJson", storeId, "Fun", "'Times'"); Assert.That(result, Is.EqualTo(1)); string value = (string)InvokeOp("JsonGetValue", storeId, "Fun"); @@ -709,7 +709,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests { UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ }"); - int result = (int)InvokeOp("JsonSetValueJson", storeId, "Fun", "{ 'Filled' : 'Times' }"); + int result = (int)InvokeOp("JsonSetJson", storeId, "Fun", "{ 'Filled' : 'Times' }"); Assert.That(result, Is.EqualTo(1)); string value = (string)InvokeOp("JsonGetValue", storeId, "Fun.Filled"); @@ -720,7 +720,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests { UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ }"); - int result = (int)InvokeOp("JsonSetValueJson", storeId, "Fun", "Times"); + int result = (int)InvokeOp("JsonSetJson", storeId, "Fun", "Times"); Assert.That(result, Is.EqualTo(0)); string value = (string)InvokeOp("JsonGetValue", storeId, "Fun"); @@ -731,7 +731,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests { UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ }"); - int result = (int)InvokeOp("JsonSetValueJson", storeId, "Fun.Circus", "'Times'"); + int result = (int)InvokeOp("JsonSetJson", storeId, "Fun.Circus", "'Times'"); Assert.That(result, Is.EqualTo(0)); string value = (string)InvokeOp("JsonGetValue", storeId, "Fun.Circus"); @@ -741,7 +741,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests // Test with fake store { UUID fakeStoreId = TestHelpers.ParseTail(0x500); - int fakeStoreValueSet = (int)InvokeOp("JsonSetValueJson", fakeStoreId, "Hello", "'World'"); + int fakeStoreValueSet = (int)InvokeOp("JsonSetJson", fakeStoreId, "Hello", "'World'"); Assert.That(fakeStoreValueSet, Is.EqualTo(0)); } }