diff options
author | Justin Clark-Casey (justincc) | 2013-02-08 01:59:27 +0000 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2013-02-08 01:59:27 +0000 |
commit | 42f724f38011286733351a46dd8369951a581ce9 (patch) | |
tree | a18b72a43cb99d0a7b644fb92d63db9326e90567 /OpenSim | |
parent | Extend TestJsonReadNotecard() for reads to non-root locations and fake stores. (diff) | |
download | opensim-SC_OLD-42f724f38011286733351a46dd8369951a581ce9.zip opensim-SC_OLD-42f724f38011286733351a46dd8369951a581ce9.tar.gz opensim-SC_OLD-42f724f38011286733351a46dd8369951a581ce9.tar.bz2 opensim-SC_OLD-42f724f38011286733351a46dd8369951a581ce9.tar.xz |
Refine TestJsonReadNotecard() and use / instead of . to separate paths.
An attack of the stupid meant that I was using / as a path separator.
Fixing this makes the tests behave better, though still with some questions.
Also, I imagine / shouldn't really put data in the root as that's not a valid identifier.
This commit also fix the / mistake in other tests those this does not affect their outcomes.
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs | 61 |
1 files changed, 46 insertions, 15 deletions
diff --git a/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs b/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs index 7e0f03c..ca88d1a 100644 --- a/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs +++ b/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs | |||
@@ -283,7 +283,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests | |||
283 | string notecardName = "nc1"; | 283 | string notecardName = "nc1"; |
284 | 284 | ||
285 | // Write notecard | 285 | // Write notecard |
286 | UUID writeNotecardRequestId = (UUID)InvokeOpOnHost("JsonWriteNotecard", so.UUID, storeId, "/", notecardName); | 286 | UUID writeNotecardRequestId = (UUID)InvokeOpOnHost("JsonWriteNotecard", so.UUID, storeId, "", notecardName); |
287 | Assert.That(writeNotecardRequestId, Is.Not.EqualTo(UUID.Zero)); | 287 | Assert.That(writeNotecardRequestId, Is.Not.EqualTo(UUID.Zero)); |
288 | 288 | ||
289 | TaskInventoryItem nc1Item = so.RootPart.Inventory.GetInventoryItem(notecardName); | 289 | TaskInventoryItem nc1Item = so.RootPart.Inventory.GetInventoryItem(notecardName); |
@@ -292,8 +292,10 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests | |||
292 | // TODO: Should independently check the contents. | 292 | // TODO: Should independently check the contents. |
293 | } | 293 | } |
294 | 294 | ||
295 | // TODO: Write partial test | ||
296 | |||
295 | { | 297 | { |
296 | // Try to write notecard against bad path | 298 | // Try to write notecard for a bad path |
297 | // In this case we do get a request id but no notecard is written. | 299 | // In this case we do get a request id but no notecard is written. |
298 | string badPathNotecardName = "badPathNotecardName"; | 300 | string badPathNotecardName = "badPathNotecardName"; |
299 | 301 | ||
@@ -312,7 +314,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests | |||
312 | 314 | ||
313 | UUID fakeStoreId = TestHelpers.ParseTail(0x500); | 315 | UUID fakeStoreId = TestHelpers.ParseTail(0x500); |
314 | UUID fakeStoreWriteNotecardValue | 316 | UUID fakeStoreWriteNotecardValue |
315 | = (UUID)InvokeOpOnHost("JsonWriteNotecard", so.UUID, fakeStoreId, "/", fakeStoreNotecardName); | 317 | = (UUID)InvokeOpOnHost("JsonWriteNotecard", so.UUID, fakeStoreId, "", fakeStoreNotecardName); |
316 | Assert.That(fakeStoreWriteNotecardValue, Is.Not.EqualTo(UUID.Zero)); | 318 | Assert.That(fakeStoreWriteNotecardValue, Is.Not.EqualTo(UUID.Zero)); |
317 | 319 | ||
318 | TaskInventoryItem fakeStoreItem = so.RootPart.Inventory.GetInventoryItem(fakeStoreNotecardName); | 320 | TaskInventoryItem fakeStoreItem = so.RootPart.Inventory.GetInventoryItem(fakeStoreNotecardName); |
@@ -341,12 +343,12 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests | |||
341 | UUID creatingStoreId = (UUID)InvokeOp("JsonCreateStore", "{ 'Hello':'World' }"); | 343 | UUID creatingStoreId = (UUID)InvokeOp("JsonCreateStore", "{ 'Hello':'World' }"); |
342 | 344 | ||
343 | // Write notecard | 345 | // Write notecard |
344 | InvokeOpOnHost("JsonWriteNotecard", so.UUID, creatingStoreId, "/", notecardName); | 346 | InvokeOpOnHost("JsonWriteNotecard", so.UUID, creatingStoreId, "", notecardName); |
345 | 347 | ||
346 | { | 348 | { |
347 | // Read notecard | 349 | // Read notecard |
348 | UUID receivingStoreId = (UUID)InvokeOp("JsonCreateStore", "{ }"); | 350 | UUID receivingStoreId = (UUID)InvokeOp("JsonCreateStore", "{}"); |
349 | UUID readNotecardRequestId = (UUID)InvokeOpOnHost("JsonReadNotecard", so.UUID, receivingStoreId, "/", notecardName); | 351 | UUID readNotecardRequestId = (UUID)InvokeOpOnHost("JsonReadNotecard", so.UUID, receivingStoreId, "", notecardName); |
350 | Assert.That(readNotecardRequestId, Is.Not.EqualTo(UUID.Zero)); | 352 | Assert.That(readNotecardRequestId, Is.Not.EqualTo(UUID.Zero)); |
351 | 353 | ||
352 | string value = (string)InvokeOp("JsonGetValue", receivingStoreId, "Hello"); | 354 | string value = (string)InvokeOp("JsonGetValue", receivingStoreId, "Hello"); |
@@ -354,23 +356,52 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests | |||
354 | } | 356 | } |
355 | 357 | ||
356 | { | 358 | { |
357 | // Read notecard to non-root path | 359 | // Read notecard to new single component path |
358 | UUID receivingStoreId = (UUID)InvokeOp("JsonCreateStore", "{ }"); | 360 | UUID receivingStoreId = (UUID)InvokeOp("JsonCreateStore", "{}"); |
359 | UUID readNotecardRequestId = (UUID)InvokeOpOnHost("JsonReadNotecard", so.UUID, receivingStoreId, "make/it/so", notecardName); | 361 | UUID readNotecardRequestId = (UUID)InvokeOpOnHost("JsonReadNotecard", so.UUID, receivingStoreId, "make", notecardName); |
360 | Assert.That(readNotecardRequestId, Is.Not.EqualTo(UUID.Zero)); | 362 | Assert.That(readNotecardRequestId, Is.Not.EqualTo(UUID.Zero)); |
361 | 363 | ||
362 | // These don't behave as I expect yet - reading to a path still seems to place the notecard contents at the root. | 364 | // 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"); | 365 | string value = (string)InvokeOp("JsonGetValue", receivingStoreId, "Hello"); |
364 | // Assert.That(value, Is.EqualTo("")); | 366 | Assert.That(value, Is.EqualTo("")); |
365 | // | 367 | |
366 | // value = (string)InvokeOp("JsonGetValue", receivingStoreId, "make/it/so/Hello"); | 368 | value = (string)InvokeOp("JsonGetValue", receivingStoreId, "make.Hello"); |
367 | // Assert.That(value, Is.EqualTo("World")); | 369 | Assert.That(value, Is.EqualTo("World")); |
370 | } | ||
371 | |||
372 | { | ||
373 | // Read notecard to new multi-component path | ||
374 | UUID receivingStoreId = (UUID)InvokeOp("JsonCreateStore", "{}"); | ||
375 | UUID readNotecardRequestId = (UUID)InvokeOpOnHost("JsonReadNotecard", so.UUID, receivingStoreId, "make.it", notecardName); | ||
376 | Assert.That(readNotecardRequestId, Is.Not.EqualTo(UUID.Zero)); | ||
377 | |||
378 | // These don't behave as I expect yet - reading to a path still seems to place the notecard contents at the root. | ||
379 | string value = (string)InvokeOp("JsonGetValue", receivingStoreId, "Hello"); | ||
380 | Assert.That(value, Is.EqualTo("")); | ||
381 | |||
382 | // TODO: Check that we are not expecting reading to a new path to work. | ||
383 | value = (string)InvokeOp("JsonGetValue", receivingStoreId, "make.it.Hello"); | ||
384 | Assert.That(value, Is.EqualTo("")); | ||
385 | } | ||
386 | |||
387 | { | ||
388 | // Read notecard to existing multi-component path | ||
389 | UUID receivingStoreId = (UUID)InvokeOp("JsonCreateStore", "{ 'make' : { 'it' : 'so' } }"); | ||
390 | UUID readNotecardRequestId = (UUID)InvokeOpOnHost("JsonReadNotecard", so.UUID, receivingStoreId, "make.it", notecardName); | ||
391 | Assert.That(readNotecardRequestId, Is.Not.EqualTo(UUID.Zero)); | ||
392 | |||
393 | // These don't behave as I expect yet - reading to a path still seems to place the notecard contents at the root. | ||
394 | string value = (string)InvokeOp("JsonGetValue", receivingStoreId, "Hello"); | ||
395 | Assert.That(value, Is.EqualTo("")); | ||
396 | |||
397 | value = (string)InvokeOp("JsonGetValue", receivingStoreId, "make.it.Hello"); | ||
398 | Assert.That(value, Is.EqualTo("World")); | ||
368 | } | 399 | } |
369 | 400 | ||
370 | { | 401 | { |
371 | // Try read notecard to fake store. | 402 | // Try read notecard to fake store. |
372 | UUID fakeStoreId = TestHelpers.ParseTail(0x500); | 403 | UUID fakeStoreId = TestHelpers.ParseTail(0x500); |
373 | UUID readNotecardRequestId = (UUID)InvokeOpOnHost("JsonReadNotecard", so.UUID, fakeStoreId, "/", notecardName); | 404 | UUID readNotecardRequestId = (UUID)InvokeOpOnHost("JsonReadNotecard", so.UUID, fakeStoreId, "", notecardName); |
374 | Assert.That(fakeStoreId, Is.Not.EqualTo(UUID.Zero)); | 405 | Assert.That(fakeStoreId, Is.Not.EqualTo(UUID.Zero)); |
375 | 406 | ||
376 | string value = (string)InvokeOp("JsonGetValue", fakeStoreId, "Hello"); | 407 | string value = (string)InvokeOp("JsonGetValue", fakeStoreId, "Hello"); |