Merge branch 'master' of melanie@opensimulator.org:/var/git/opensim

user_profiles
Melanie 2013-02-07 23:23:42 +00:00
commit de53955610
3 changed files with 29 additions and 15 deletions

View File

@ -114,7 +114,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
m_ReadStore = new List<TakeValueCallbackClass>(); m_ReadStore = new List<TakeValueCallbackClass>();
} }
public JsonStore(string value) public JsonStore(string value) : this()
{ {
if (String.IsNullOrEmpty(value)) if (String.IsNullOrEmpty(value))
ValueStore = new OSDMap(); ValueStore = new OSDMap();

View File

@ -93,12 +93,12 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
} }
catch (Exception e) catch (Exception e)
{ {
m_log.ErrorFormat("[JsonStore] initialization error: {0}",e.Message); m_log.Error("[JsonStore]: initialization error: {0}", e);
return; return;
} }
if (m_enabled) if (m_enabled)
m_log.DebugFormat("[JsonStore] module is enabled"); m_log.DebugFormat("[JsonStore]: module is enabled");
} }
// ----------------------------------------------------------------- // -----------------------------------------------------------------
@ -182,7 +182,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
SceneObjectPart sop = m_scene.GetSceneObjectPart(objectID); SceneObjectPart sop = m_scene.GetSceneObjectPart(objectID);
if (sop == null) if (sop == null)
{ {
m_log.InfoFormat("[JsonStore] unable to attach to unknown object; {0}",objectID); m_log.ErrorFormat("[JsonStore] unable to attach to unknown object; {0}", objectID);
return false; return false;
} }
@ -219,7 +219,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
} }
catch (Exception e) catch (Exception e)
{ {
m_log.InfoFormat("[JsonStore] Unable to initialize store from {0}; {1}",value,e.Message); m_log.Error(string.Format("[JsonStore]: Unable to initialize store from {0}", value), e);
return false; return false;
} }
@ -283,7 +283,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
} }
catch (Exception e) catch (Exception e)
{ {
m_log.InfoFormat("[JsonStore] Path test failed for {0} in {1}; {2}",path,storeID,e.Message); m_log.Error(string.Format("[JsonStore]: Path test failed for {0} in {1}", path, storeID), e);
} }
return false; return false;
@ -316,7 +316,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
} }
catch (Exception e) catch (Exception e)
{ {
m_log.InfoFormat("[JsonStore] Unable to assign {0} to {1} in {2}; {3}",value,path,storeID,e.Message); m_log.Error(string.Format("[JsonStore]: Unable to assign {0} to {1} in {2}", value, path, storeID), e);
} }
return false; return false;
@ -349,7 +349,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
} }
catch (Exception e) catch (Exception e)
{ {
m_log.InfoFormat("[JsonStore] Unable to remove {0} in {1}; {2}",path,storeID,e.Message); m_log.Error(string.Format("[JsonStore]: Unable to remove {0} in {1}", path, storeID), e);
} }
return false; return false;
@ -382,7 +382,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
} }
catch (Exception e) catch (Exception e)
{ {
m_log.InfoFormat("[JsonStore] unable to retrieve value; {0}",e.Message); m_log.Error("[JsonStore]: unable to retrieve value", e);
} }
return false; return false;
@ -421,7 +421,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
} }
catch (Exception e) catch (Exception e)
{ {
m_log.InfoFormat("[JsonStore] unable to retrieve value; {0}",e.ToString()); m_log.Error("[JsonStore] unable to retrieve value", e);
} }
cback(String.Empty); cback(String.Empty);
@ -460,7 +460,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
} }
catch (Exception e) catch (Exception e)
{ {
m_log.InfoFormat("[JsonStore] unable to retrieve value; {0}",e.ToString()); m_log.Error("[JsonStore]: unable to retrieve value", e);
} }
cback(String.Empty); cback(String.Empty);

View File

@ -134,6 +134,20 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
Assert.That(tprv, Is.EqualTo(0)); Assert.That(tprv, Is.EqualTo(0));
} }
[Test]
public void TestJsonDestroyStoreNotExists()
{
TestHelpers.InMethod();
// TestHelpers.EnableLogging();
UUID fakeStoreId = TestHelpers.ParseTail(0x500);
int dsrv = (int)InvokeOp("JsonDestroyStore", fakeStoreId);
// XXX: Current returns 'true' even though no such store existed. Need to ask if this is best behaviour.
Assert.That(dsrv, Is.EqualTo(1));
}
[Test] [Test]
public void TestJsonGetValue() public void TestJsonGetValue()
{ {
@ -205,13 +219,13 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
TestHelpers.InMethod(); TestHelpers.InMethod();
// TestHelpers.EnableLogging(); // TestHelpers.EnableLogging();
UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{}"); UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ }");
int result = (int)InvokeOp("JsonSetValue", storeId, "Hello", "World"); int result = (int)InvokeOp("JsonSetValue", storeId, "Fun", "Times");
Assert.That(result, Is.EqualTo(1)); Assert.That(result, Is.EqualTo(1));
string value = (string)InvokeOp("JsonGetValue", storeId, "Hello"); string value = (string)InvokeOp("JsonGetValue", storeId, "Fun");
Assert.That(value, Is.EqualTo("World")); Assert.That(value, Is.EqualTo("Times"));
} }
/// <summary> /// <summary>