diff options
author | Justin Clark-Casey (justincc) | 2013-02-08 01:02:25 +0000 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2013-02-08 01:02:25 +0000 |
commit | 528f23beab703e60ec522117a2a442e733565727 (patch) | |
tree | 546edfd457f427302c1233528ff97b37f3253976 /OpenSim/Region/OptionalModules/Scripting/JsonStore | |
parent | Stop wrongly create a receiving store already populated with "Hello":"World" ... (diff) | |
download | opensim-SC-528f23beab703e60ec522117a2a442e733565727.zip opensim-SC-528f23beab703e60ec522117a2a442e733565727.tar.gz opensim-SC-528f23beab703e60ec522117a2a442e733565727.tar.bz2 opensim-SC-528f23beab703e60ec522117a2a442e733565727.tar.xz |
Extend TestJsonReadNotecard() for reads to non-root locations and fake stores.
Assertions for loading to non-root paths are currently commented out because this doesn't seem to be working. Will be raising mantis to resolve.
Diffstat (limited to 'OpenSim/Region/OptionalModules/Scripting/JsonStore')
-rw-r--r-- | OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs | 42 |
1 files changed, 33 insertions, 9 deletions
diff --git a/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs b/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs index 6658e1e..7e0f03c 100644 --- a/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs +++ b/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs | |||
@@ -321,7 +321,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests | |||
321 | } | 321 | } |
322 | 322 | ||
323 | /// <summary> | 323 | /// <summary> |
324 | /// Test for reading and writing json to a notecard | 324 | /// Test for reading json from a notecard |
325 | /// </summary> | 325 | /// </summary> |
326 | /// <remarks> | 326 | /// <remarks> |
327 | /// TODO: Really needs to test correct receipt of the link_message event. Could do this by directly fetching | 327 | /// TODO: Really needs to test correct receipt of the link_message event. Could do this by directly fetching |
@@ -338,20 +338,44 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests | |||
338 | SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, TestHelpers.ParseTail(0x1)); | 338 | SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, TestHelpers.ParseTail(0x1)); |
339 | m_scene.AddSceneObject(so); | 339 | m_scene.AddSceneObject(so); |
340 | 340 | ||
341 | UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ 'Hello':'World' }"); | 341 | UUID creatingStoreId = (UUID)InvokeOp("JsonCreateStore", "{ 'Hello':'World' }"); |
342 | 342 | ||
343 | // Write notecard | 343 | // Write notecard |
344 | InvokeOpOnHost("JsonWriteNotecard", so.UUID, storeId, "/", notecardName); | 344 | InvokeOpOnHost("JsonWriteNotecard", so.UUID, creatingStoreId, "/", notecardName); |
345 | 345 | ||
346 | // Read notecard | 346 | { |
347 | UUID receivingStoreId = (UUID)InvokeOp("JsonCreateStore", "{ }"); | 347 | // Read notecard |
348 | UUID readNotecardRequestId = (UUID)InvokeOpOnHost("JsonReadNotecard", so.UUID, receivingStoreId, "/", notecardName); | 348 | UUID receivingStoreId = (UUID)InvokeOp("JsonCreateStore", "{ }"); |
349 | Assert.That(readNotecardRequestId, Is.Not.EqualTo(UUID.Zero)); | 349 | UUID readNotecardRequestId = (UUID)InvokeOpOnHost("JsonReadNotecard", so.UUID, receivingStoreId, "/", notecardName); |
350 | Assert.That(readNotecardRequestId, Is.Not.EqualTo(UUID.Zero)); | ||
350 | 351 | ||
351 | string value = (string)InvokeOp("JsonGetValue", storeId, "Hello"); | 352 | string value = (string)InvokeOp("JsonGetValue", receivingStoreId, "Hello"); |
352 | Assert.That(value, Is.EqualTo("World")); | 353 | Assert.That(value, Is.EqualTo("World")); |
354 | } | ||
355 | |||
356 | { | ||
357 | // Read notecard to non-root path | ||
358 | UUID receivingStoreId = (UUID)InvokeOp("JsonCreateStore", "{ }"); | ||
359 | UUID readNotecardRequestId = (UUID)InvokeOpOnHost("JsonReadNotecard", so.UUID, receivingStoreId, "make/it/so", notecardName); | ||
360 | Assert.That(readNotecardRequestId, Is.Not.EqualTo(UUID.Zero)); | ||
361 | |||
362 | // These don't behave as I expect yet - reading to a path still seems to place the notecard contents at the root. | ||
363 | // string value = (string)InvokeOp("JsonGetValue", receivingStoreId, "Hello"); | ||
364 | // Assert.That(value, Is.EqualTo("")); | ||
365 | // | ||
366 | // value = (string)InvokeOp("JsonGetValue", receivingStoreId, "make/it/so/Hello"); | ||
367 | // Assert.That(value, Is.EqualTo("World")); | ||
368 | } | ||
353 | 369 | ||
370 | { | ||
371 | // Try read notecard to fake store. | ||
372 | UUID fakeStoreId = TestHelpers.ParseTail(0x500); | ||
373 | UUID readNotecardRequestId = (UUID)InvokeOpOnHost("JsonReadNotecard", so.UUID, fakeStoreId, "/", notecardName); | ||
374 | Assert.That(fakeStoreId, Is.Not.EqualTo(UUID.Zero)); | ||
354 | 375 | ||
376 | string value = (string)InvokeOp("JsonGetValue", fakeStoreId, "Hello"); | ||
377 | Assert.That(value, Is.EqualTo("")); | ||
378 | } | ||
355 | } | 379 | } |
356 | 380 | ||
357 | public object DummyTestMethod(object o1, object o2, object o3, object o4, object o5) { return null; } | 381 | public object DummyTestMethod(object o1, object o2, object o3, object o4, object o5) { return null; } |