From e0f4e91d224c7a3f478a1bdea3d563ce97bb07c0 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Tue, 29 Jan 2013 04:26:26 +0000
Subject: Try ignoring json tests if they can't be run due to being on <=.net
3.5
---
.../JsonStore/Tests/JsonStoreScriptModuleTests.cs | 23 ++++++++++++++++------
1 file changed, 17 insertions(+), 6 deletions(-)
(limited to 'OpenSim/Region/OptionalModules')
diff --git a/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs b/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs
index 397dd93..5b2931e 100644
--- a/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs
@@ -59,8 +59,6 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
{
base.SetUp();
- TestHelpers.EnableLogging();
-
IConfigSource configSource = new IniConfigSource();
IConfig jsonStoreConfig = configSource.AddConfig("JsonStore");
jsonStoreConfig.Set("Enabled", "true");
@@ -72,9 +70,20 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
m_scene = new SceneHelpers().SetupScene();
SceneHelpers.SetupSceneModules(m_scene, configSource, m_engine, m_smcm, jsm, jssm);
+
+ try
+ {
+ m_smcm.RegisterScriptInvocation(this, "DummyTestMethod");
+ }
+ catch (ArgumentException)
+ {
+ Assert.Ignore("Ignoring test since running on .NET 3.5 or earlier.");
+ }
+
+ // XXX: Unfortunately, ICommsModule currently has no way of deregistering methods.
}
-// [Test]
+ [Test]
public void TestJsonCreateStore()
{
TestHelpers.InMethod();
@@ -85,7 +94,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
Assert.That(storeId, Is.Not.EqualTo(UUID.Zero));
}
-// [Test]
+ [Test]
public void TestJsonGetValue()
{
TestHelpers.InMethod();
@@ -102,7 +111,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
Assert.That(value, Is.EqualTo("World"));
}
-// [Test]
+ [Test]
public void TestJsonTestPath()
{
TestHelpers.InMethod();
@@ -119,7 +128,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
Assert.That(result, Is.EqualTo(1));
}
-// [Test]
+ [Test]
public void TestJsonSetValue()
{
TestHelpers.InMethod();
@@ -141,5 +150,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
Assert.That(value, Is.EqualTo("World"));
}
+
+ public object DummyTestMethod(object o1, object o2, object o3, object o4, object o5) { return null; }
}
}
\ No newline at end of file
--
cgit v1.1
From 39700445f257108305f576c7af67623cc145906c Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Tue, 29 Jan 2013 04:36:41 +0000
Subject: minor: change name of json script tests to JsonStoreScriptModuleTests
instead of copy/pasted LSL_ApiInventoryTests
---
.../Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'OpenSim/Region/OptionalModules')
diff --git a/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs b/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs
index 5b2931e..9f91728 100644
--- a/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs
@@ -48,7 +48,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
/// Tests for inventory functions in LSL
///
[TestFixture]
- public class LSL_ApiInventoryTests : OpenSimTestCase
+ public class JsonStoreScriptModuleTests : OpenSimTestCase
{
private Scene m_scene;
private MockScriptEngine m_engine;
--
cgit v1.1
From addf9ada49f35a40f8739d0614c1d48fbbb82ec1 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Wed, 30 Jan 2013 05:39:34 +0000
Subject: Add regression test for script func JsonRemoveValue()
---
.../JsonStore/Tests/JsonStoreScriptModuleTests.cs | 52 ++++++++++++++++++++++
1 file changed, 52 insertions(+)
(limited to 'OpenSim/Region/OptionalModules')
diff --git a/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs b/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs
index 9f91728..d209551 100644
--- a/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs
@@ -111,6 +111,58 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
Assert.That(value, Is.EqualTo("World"));
}
+// [Test]
+// public void TestJsonTakeValue()
+// {
+// TestHelpers.InMethod();
+//// TestHelpers.EnableLogging();
+//
+// UUID storeId
+// = (UUID)m_smcm.InvokeOperation(
+// UUID.Zero, UUID.Zero, "JsonCreateStore", new object[] { "{ 'Hello' : 'World' }" });
+//
+// string value
+// = (string)m_smcm.InvokeOperation(
+// UUID.Zero, UUID.Zero, "JsonTakeValue", new object[] { storeId, "Hello" });
+//
+// Assert.That(value, Is.EqualTo("World"));
+//
+// string value2
+// = (string)m_smcm.InvokeOperation(
+// UUID.Zero, UUID.Zero, "JsonGetValue", new object[] { storeId, "Hello" });
+//
+// Assert.That(value, Is.Null);
+// }
+
+ [Test]
+ public void TestJsonRemoveValue()
+ {
+ TestHelpers.InMethod();
+// TestHelpers.EnableLogging();
+
+ UUID storeId
+ = (UUID)m_smcm.InvokeOperation(
+ UUID.Zero, UUID.Zero, "JsonCreateStore", new object[] { "{ 'Hello' : 'World' }" });
+
+ int returnValue
+ = (int)m_smcm.InvokeOperation(
+ UUID.Zero, UUID.Zero, "JsonRemoveValue", new object[] { storeId, "Hello" });
+
+ Assert.That(returnValue, Is.EqualTo(1));
+
+ int result
+ = (int)m_smcm.InvokeOperation(
+ UUID.Zero, UUID.Zero, "JsonTestPath", new object[] { storeId, "Hello" });
+
+ Assert.That(result, Is.EqualTo(0));
+
+ string returnValue2
+ = (string)m_smcm.InvokeOperation(
+ UUID.Zero, UUID.Zero, "JsonGetValue", new object[] { storeId, "Hello" });
+
+ Assert.That(returnValue2, Is.EqualTo(""));
+ }
+
[Test]
public void TestJsonTestPath()
{
--
cgit v1.1
From 5a22efe69cb75972d2fa9446d8b98734af7c653a Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Wed, 30 Jan 2013 05:49:28 +0000
Subject: refactor: Make invocations of json store functions from the
regression test simpler
---
.../JsonStore/Tests/JsonStoreScriptModuleTests.cs | 59 +++++++---------------
1 file changed, 17 insertions(+), 42 deletions(-)
(limited to 'OpenSim/Region/OptionalModules')
diff --git a/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs b/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs
index d209551..297d7c1 100644
--- a/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs
@@ -83,14 +83,18 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
// XXX: Unfortunately, ICommsModule currently has no way of deregistering methods.
}
+ private object InvokeOp(string name, params object[] args)
+ {
+ return m_smcm.InvokeOperation(UUID.Zero, UUID.Zero, name, args);
+ }
+
[Test]
public void TestJsonCreateStore()
{
TestHelpers.InMethod();
// TestHelpers.EnableLogging();
- UUID storeId = (UUID)m_smcm.InvokeOperation(UUID.Zero, UUID.Zero, "JsonCreateStore", new object[] { "{}" });
-
+ UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{}");
Assert.That(storeId, Is.Not.EqualTo(UUID.Zero));
}
@@ -100,14 +104,9 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
TestHelpers.InMethod();
// TestHelpers.EnableLogging();
- UUID storeId
- = (UUID)m_smcm.InvokeOperation(
- UUID.Zero, UUID.Zero, "JsonCreateStore", new object[] { "{ 'Hello' : 'World' }" });
-
- string value
- = (string)m_smcm.InvokeOperation(
- UUID.Zero, UUID.Zero, "JsonGetValue", new object[] { storeId, "Hello" });
+ UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ 'Hello' : 'World' }");
+ string value = (string)InvokeOp("JsonGetValue", storeId, "Hello");
Assert.That(value, Is.EqualTo("World"));
}
@@ -140,26 +139,15 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
TestHelpers.InMethod();
// TestHelpers.EnableLogging();
- UUID storeId
- = (UUID)m_smcm.InvokeOperation(
- UUID.Zero, UUID.Zero, "JsonCreateStore", new object[] { "{ 'Hello' : 'World' }" });
-
- int returnValue
- = (int)m_smcm.InvokeOperation(
- UUID.Zero, UUID.Zero, "JsonRemoveValue", new object[] { storeId, "Hello" });
+ UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ 'Hello' : 'World' }");
+ int returnValue = (int)InvokeOp( "JsonRemoveValue", storeId, "Hello");
Assert.That(returnValue, Is.EqualTo(1));
- int result
- = (int)m_smcm.InvokeOperation(
- UUID.Zero, UUID.Zero, "JsonTestPath", new object[] { storeId, "Hello" });
-
+ int result = (int)InvokeOp("JsonTestPath", storeId, "Hello");
Assert.That(result, Is.EqualTo(0));
- string returnValue2
- = (string)m_smcm.InvokeOperation(
- UUID.Zero, UUID.Zero, "JsonGetValue", new object[] { storeId, "Hello" });
-
+ string returnValue2 = (string)InvokeOp("JsonGetValue", storeId, "Hello");
Assert.That(returnValue2, Is.EqualTo(""));
}
@@ -169,14 +157,9 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
TestHelpers.InMethod();
// TestHelpers.EnableLogging();
- UUID storeId
- = (UUID)m_smcm.InvokeOperation(
- UUID.Zero, UUID.Zero, "JsonCreateStore", new object[] { "{ 'Hello' : 'World' }" });
-
- int result
- = (int)m_smcm.InvokeOperation(
- UUID.Zero, UUID.Zero, "JsonTestPath", new object[] { storeId, "Hello" });
+ UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ 'Hello' : 'World' }");
+ int result = (int)InvokeOp("JsonTestPath", storeId, "Hello");
Assert.That(result, Is.EqualTo(1));
}
@@ -186,20 +169,12 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
TestHelpers.InMethod();
// TestHelpers.EnableLogging();
- UUID storeId
- = (UUID)m_smcm.InvokeOperation(
- UUID.Zero, UUID.Zero, "JsonCreateStore", new object[] { "{ }" });
-
- int result
- = (int)m_smcm.InvokeOperation(
- UUID.Zero, UUID.Zero, "JsonSetValue", new object[] { storeId, "Hello", "World" });
+ UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{}");
+ int result = (int)InvokeOp("JsonSetValue", storeId, "Hello", "World");
Assert.That(result, Is.EqualTo(1));
- string value
- = (string)m_smcm.InvokeOperation(
- UUID.Zero, UUID.Zero, "JsonGetValue", new object[] { storeId, "Hello" });
-
+ string value = (string)InvokeOp("JsonGetValue", storeId, "Hello");
Assert.That(value, Is.EqualTo("World"));
}
--
cgit v1.1
From d42c7afe3fc5d226dffea3bb50e4e2963eb96f3b Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Wed, 30 Jan 2013 05:56:30 +0000
Subject: Add JsonDestroyStore() basic regression test
---
.../JsonStore/Tests/JsonStoreScriptModuleTests.cs | 15 +++++++++++++++
1 file changed, 15 insertions(+)
(limited to 'OpenSim/Region/OptionalModules')
diff --git a/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs b/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs
index 297d7c1..8042a93 100644
--- a/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs
@@ -99,6 +99,21 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
}
[Test]
+ public void TestJsonDestroyStore()
+ {
+ TestHelpers.InMethod();
+// TestHelpers.EnableLogging();
+
+ UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ 'Hello' : 'World' }");
+ int dsrv = (int)InvokeOp("JsonDestroyStore", storeId);
+
+ Assert.That(dsrv, Is.EqualTo(1));
+
+ int tprv = (int)InvokeOp("JsonTestPath", storeId, "Hello");
+ Assert.That(tprv, Is.EqualTo(0));
+ }
+
+ [Test]
public void TestJsonGetValue()
{
TestHelpers.InMethod();
--
cgit v1.1
From a0ef3df1941147cfc894493950e4d204f6b34216 Mon Sep 17 00:00:00 2001
From: Mic Bowman
Date: Wed, 30 Jan 2013 14:45:03 -0800
Subject: Add JsonTestStore to determine if a JsonStore is associated with a
particular UUID.
---
.../OptionalModules/Scripting/JsonStore/JsonStoreModule.cs | 13 +++++++++++++
.../Scripting/JsonStore/JsonStoreScriptModule.cs | 11 +++++++++++
2 files changed, 24 insertions(+)
(limited to 'OpenSim/Region/OptionalModules')
diff --git a/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreModule.cs b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreModule.cs
index e68764a..b9b3ebc 100644
--- a/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreModule.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreModule.cs
@@ -221,6 +221,19 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
///
///
// -----------------------------------------------------------------
+ public bool TestStore(UUID storeID)
+ {
+ if (! m_enabled) return false;
+
+ lock (m_JsonValueStore)
+ return m_JsonValueStore.ContainsKey(storeID);
+ }
+
+ // -----------------------------------------------------------------
+ ///
+ ///
+ ///
+ // -----------------------------------------------------------------
public bool TestPath(UUID storeID, string path, bool useJson)
{
if (! m_enabled) return false;
diff --git a/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreScriptModule.cs b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreScriptModule.cs
index b9dcfea..29955af 100644
--- a/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreScriptModule.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreScriptModule.cs
@@ -167,6 +167,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
{
m_comms.RegisterScriptInvocation(this, "JsonCreateStore");
m_comms.RegisterScriptInvocation(this, "JsonDestroyStore");
+ m_comms.RegisterScriptInvocation(this, "JsonTestStore");
m_comms.RegisterScriptInvocation(this, "JsonReadNotecard");
m_comms.RegisterScriptInvocation(this, "JsonWriteNotecard");
@@ -248,6 +249,16 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
///
///
// -----------------------------------------------------------------
+ protected int JsonTestStore(UUID hostID, UUID scriptID, UUID storeID)
+ {
+ return m_store.TestStore(storeID) ? 1 : 0;
+ }
+
+ // -----------------------------------------------------------------
+ ///
+ ///
+ ///
+ // -----------------------------------------------------------------
protected UUID JsonReadNotecard(UUID hostID, UUID scriptID, UUID storeID, string path, UUID assetID)
{
UUID reqID = UUID.Random();
--
cgit v1.1