diff options
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs | 45 |
1 files changed, 44 insertions, 1 deletions
diff --git a/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs b/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs index 34422b4..98b5624 100644 --- a/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs +++ b/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs | |||
@@ -101,7 +101,12 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests | |||
101 | 101 | ||
102 | private object InvokeOp(string name, params object[] args) | 102 | private object InvokeOp(string name, params object[] args) |
103 | { | 103 | { |
104 | return m_smcm.InvokeOperation(UUID.Zero, UUID.Zero, name, args); | 104 | return InvokeOpOnHost(name, UUID.Zero, args); |
105 | } | ||
106 | |||
107 | private object InvokeOpOnHost(string name, UUID hostId, params object[] args) | ||
108 | { | ||
109 | return m_smcm.InvokeOperation(hostId, UUID.Zero, name, args); | ||
105 | } | 110 | } |
106 | 111 | ||
107 | [Test] | 112 | [Test] |
@@ -209,6 +214,44 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests | |||
209 | Assert.That(value, Is.EqualTo("World")); | 214 | Assert.That(value, Is.EqualTo("World")); |
210 | } | 215 | } |
211 | 216 | ||
217 | /// <summary> | ||
218 | /// Test for reading and writing json to a notecard | ||
219 | /// </summary> | ||
220 | /// <remarks> | ||
221 | /// TODO: Really needs to test correct receipt of the link_message event. Could do this by directly fetching | ||
222 | /// it via the MockScriptEngine or perhaps by a dummy script instance. | ||
223 | /// </remarks> | ||
224 | [Test] | ||
225 | public void TestJsonWriteReadNotecard() | ||
226 | { | ||
227 | TestHelpers.InMethod(); | ||
228 | TestHelpers.EnableLogging(); | ||
229 | |||
230 | string notecardName = "nc1"; | ||
231 | |||
232 | SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, TestHelpers.ParseTail(0x1)); | ||
233 | m_scene.AddSceneObject(so); | ||
234 | |||
235 | UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ 'Hello':'World' }"); | ||
236 | |||
237 | // Write notecard | ||
238 | UUID writeNotecardRequestId = (UUID)InvokeOpOnHost("JsonWriteNotecard", so.UUID, storeId, "/", notecardName); | ||
239 | Assert.That(writeNotecardRequestId, Is.Not.EqualTo(UUID.Zero)); | ||
240 | |||
241 | TaskInventoryItem nc1Item = so.RootPart.Inventory.GetInventoryItem(notecardName); | ||
242 | Assert.That(nc1Item, Is.Not.Null); | ||
243 | |||
244 | // TODO: Should probably independently check the contents. | ||
245 | |||
246 | // Read notecard | ||
247 | UUID receivingStoreId = (UUID)InvokeOp("JsonCreateStore", "{ 'Hello':'World' }"); | ||
248 | UUID readNotecardRequestId = (UUID)InvokeOpOnHost("JsonReadNotecard", so.UUID, receivingStoreId, "/", notecardName); | ||
249 | Assert.That(readNotecardRequestId, Is.Not.EqualTo(UUID.Zero)); | ||
250 | |||
251 | string value = (string)InvokeOp("JsonGetValue", storeId, "Hello"); | ||
252 | Assert.That(value, Is.EqualTo("World")); | ||
253 | } | ||
254 | |||
212 | public object DummyTestMethod(object o1, object o2, object o3, object o4, object o5) { return null; } | 255 | public object DummyTestMethod(object o1, object o2, object o3, object o4, object o5) { return null; } |
213 | } | 256 | } |
214 | } \ No newline at end of file | 257 | } \ No newline at end of file |