diff --git a/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs b/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs
index 73bc9554c4..ce586bec0b 100644
--- a/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs
@@ -261,6 +261,65 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
Assert.That(fakeStoreValueSet, Is.EqualTo(0));
}
+ ///
+ /// Test for writing json to a notecard
+ ///
+ ///
+ /// TODO: Really needs to test correct receipt of the link_message event. Could do this by directly fetching
+ /// it via the MockScriptEngine or perhaps by a dummy script instance.
+ ///
+ [Test]
+ public void TestJsonWriteNotecard()
+ {
+ TestHelpers.InMethod();
+// TestHelpers.EnableLogging();
+
+ SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, TestHelpers.ParseTail(0x1));
+ m_scene.AddSceneObject(so);
+
+ UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ 'Hello':'World' }");
+
+ {
+ string notecardName = "nc1";
+
+ // Write notecard
+ UUID writeNotecardRequestId = (UUID)InvokeOpOnHost("JsonWriteNotecard", so.UUID, storeId, "/", notecardName);
+ Assert.That(writeNotecardRequestId, Is.Not.EqualTo(UUID.Zero));
+
+ TaskInventoryItem nc1Item = so.RootPart.Inventory.GetInventoryItem(notecardName);
+ Assert.That(nc1Item, Is.Not.Null);
+
+ // TODO: Should independently check the contents.
+ }
+
+ {
+ // Try to write notecard against bad path
+ // In this case we do get a request id but no notecard is written.
+ string badPathNotecardName = "badPathNotecardName";
+
+ UUID writeNotecardBadPathRequestId
+ = (UUID)InvokeOpOnHost("JsonWriteNotecard", so.UUID, storeId, "flibble", badPathNotecardName);
+ Assert.That(writeNotecardBadPathRequestId, Is.Not.EqualTo(UUID.Zero));
+
+ TaskInventoryItem badPathItem = so.RootPart.Inventory.GetInventoryItem(badPathNotecardName);
+ Assert.That(badPathItem, Is.Null);
+ }
+
+ {
+ // Test with fake store
+ // In this case we do get a request id but no notecard is written.
+ string fakeStoreNotecardName = "fakeStoreNotecardName";
+
+ UUID fakeStoreId = TestHelpers.ParseTail(0x500);
+ UUID fakeStoreWriteNotecardValue
+ = (UUID)InvokeOpOnHost("JsonWriteNotecard", so.UUID, fakeStoreId, "/", fakeStoreNotecardName);
+ Assert.That(fakeStoreWriteNotecardValue, Is.Not.EqualTo(UUID.Zero));
+
+ TaskInventoryItem fakeStoreItem = so.RootPart.Inventory.GetInventoryItem(fakeStoreNotecardName);
+ Assert.That(fakeStoreItem, Is.Null);
+ }
+ }
+
///
/// Test for reading and writing json to a notecard
///
@@ -269,7 +328,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
/// it via the MockScriptEngine or perhaps by a dummy script instance.
///
[Test]
- public void TestJsonWriteReadNotecard()
+ public void TestJsonReadNotecard()
{
TestHelpers.InMethod();
// TestHelpers.EnableLogging();
@@ -282,13 +341,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ 'Hello':'World' }");
// Write notecard
- UUID writeNotecardRequestId = (UUID)InvokeOpOnHost("JsonWriteNotecard", so.UUID, storeId, "/", notecardName);
- Assert.That(writeNotecardRequestId, Is.Not.EqualTo(UUID.Zero));
-
- TaskInventoryItem nc1Item = so.RootPart.Inventory.GetInventoryItem(notecardName);
- Assert.That(nc1Item, Is.Not.Null);
-
- // TODO: Should probably independently check the contents.
+ InvokeOpOnHost("JsonWriteNotecard", so.UUID, storeId, "/", notecardName);
// Read notecard
UUID receivingStoreId = (UUID)InvokeOp("JsonCreateStore", "{ 'Hello':'World' }");