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
0.7.4-extended
Justin Clark-Casey (justincc) 2013-02-15 00:38:07 +00:00
parent 282123cb00
commit 7e75fd7dcb
2 changed files with 15 additions and 15 deletions

View File

@ -349,7 +349,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
} }
[ScriptInvocation] [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; return m_store.SetValue(storeID,path,value,true) ? 1 : 0;
} }
@ -390,7 +390,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
} }
[ScriptInvocation] [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; string value = String.Empty;
m_store.GetValue(storeID,path,true, out value); m_store.GetValue(storeID,path,true, out value);

View File

@ -209,7 +209,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
} }
[Test] [Test]
public void TestJsonGetValueJson() public void TestJsonGetJson()
{ {
TestHelpers.InMethod(); TestHelpers.InMethod();
// TestHelpers.EnableLogging(); // TestHelpers.EnableLogging();
@ -217,26 +217,26 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ 'Hello' : { 'World' : 'Two' } }"); 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'")); Assert.That(value, Is.EqualTo("'Two'"));
} }
// Test get of path section instead of leaf // 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\"}")); Assert.That(value, Is.EqualTo("{\"World\":\"Two\"}"));
} }
// Test get of non-existing value // 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("")); Assert.That(fakeValueGet, Is.EqualTo(""));
} }
// Test get from non-existing store // Test get from non-existing store
{ {
UUID fakeStoreId = TestHelpers.ParseTail(0x500); UUID fakeStoreId = TestHelpers.ParseTail(0x500);
string fakeStoreValueGet = (string)InvokeOp("JsonGetValueJson", fakeStoreId, "Hello"); string fakeStoreValueGet = (string)InvokeOp("JsonGetJson", fakeStoreId, "Hello");
Assert.That(fakeStoreValueGet, Is.EqualTo("")); Assert.That(fakeStoreValueGet, Is.EqualTo(""));
} }
} }
@ -294,7 +294,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
int result = (int)InvokeOp("JsonTestPath", storeId, "Hello"); int result = (int)InvokeOp("JsonTestPath", storeId, "Hello");
Assert.That(result, Is.EqualTo(0)); 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("")); Assert.That(returnValue2, Is.EqualTo(""));
} }
@ -315,7 +315,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
string stringReturnValue = (string)InvokeOp("JsonGetValue", storeId, "Hello[0]"); string stringReturnValue = (string)InvokeOp("JsonGetValue", storeId, "Hello[0]");
Assert.That(stringReturnValue, Is.EqualTo("value2")); 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("")); Assert.That(stringReturnValue, Is.EqualTo(""));
} }
@ -689,7 +689,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
} }
[Test] [Test]
public void TestJsonSetValueJson() public void TestJsonSetJson()
{ {
TestHelpers.InMethod(); TestHelpers.InMethod();
// TestHelpers.EnableLogging(); // TestHelpers.EnableLogging();
@ -698,7 +698,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
{ {
UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ }"); 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)); Assert.That(result, Is.EqualTo(1));
string value = (string)InvokeOp("JsonGetValue", storeId, "Fun"); string value = (string)InvokeOp("JsonGetValue", storeId, "Fun");
@ -709,7 +709,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
{ {
UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ }"); 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)); Assert.That(result, Is.EqualTo(1));
string value = (string)InvokeOp("JsonGetValue", storeId, "Fun.Filled"); string value = (string)InvokeOp("JsonGetValue", storeId, "Fun.Filled");
@ -720,7 +720,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
{ {
UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ }"); 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)); Assert.That(result, Is.EqualTo(0));
string value = (string)InvokeOp("JsonGetValue", storeId, "Fun"); string value = (string)InvokeOp("JsonGetValue", storeId, "Fun");
@ -731,7 +731,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
{ {
UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ }"); 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)); Assert.That(result, Is.EqualTo(0));
string value = (string)InvokeOp("JsonGetValue", storeId, "Fun.Circus"); string value = (string)InvokeOp("JsonGetValue", storeId, "Fun.Circus");
@ -741,7 +741,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
// Test with fake store // Test with fake store
{ {
UUID fakeStoreId = TestHelpers.ParseTail(0x500); 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)); Assert.That(fakeStoreValueSet, Is.EqualTo(0));
} }
} }