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.0.7.4-extended
parent
3f6feec914
commit
90d71d423c
|
@ -283,7 +283,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
|
|||
string notecardName = "nc1";
|
||||
|
||||
// Write notecard
|
||||
UUID writeNotecardRequestId = (UUID)InvokeOpOnHost("JsonWriteNotecard", so.UUID, storeId, "/", notecardName);
|
||||
UUID writeNotecardRequestId = (UUID)InvokeOpOnHost("JsonWriteNotecard", so.UUID, storeId, "", notecardName);
|
||||
Assert.That(writeNotecardRequestId, Is.Not.EqualTo(UUID.Zero));
|
||||
|
||||
TaskInventoryItem nc1Item = so.RootPart.Inventory.GetInventoryItem(notecardName);
|
||||
|
@ -292,8 +292,10 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
|
|||
// TODO: Should independently check the contents.
|
||||
}
|
||||
|
||||
// TODO: Write partial test
|
||||
|
||||
{
|
||||
// Try to write notecard against bad path
|
||||
// Try to write notecard for a bad path
|
||||
// In this case we do get a request id but no notecard is written.
|
||||
string badPathNotecardName = "badPathNotecardName";
|
||||
|
||||
|
@ -312,7 +314,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
|
|||
|
||||
UUID fakeStoreId = TestHelpers.ParseTail(0x500);
|
||||
UUID fakeStoreWriteNotecardValue
|
||||
= (UUID)InvokeOpOnHost("JsonWriteNotecard", so.UUID, fakeStoreId, "/", fakeStoreNotecardName);
|
||||
= (UUID)InvokeOpOnHost("JsonWriteNotecard", so.UUID, fakeStoreId, "", fakeStoreNotecardName);
|
||||
Assert.That(fakeStoreWriteNotecardValue, Is.Not.EqualTo(UUID.Zero));
|
||||
|
||||
TaskInventoryItem fakeStoreItem = so.RootPart.Inventory.GetInventoryItem(fakeStoreNotecardName);
|
||||
|
@ -341,12 +343,12 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
|
|||
UUID creatingStoreId = (UUID)InvokeOp("JsonCreateStore", "{ 'Hello':'World' }");
|
||||
|
||||
// Write notecard
|
||||
InvokeOpOnHost("JsonWriteNotecard", so.UUID, creatingStoreId, "/", notecardName);
|
||||
InvokeOpOnHost("JsonWriteNotecard", so.UUID, creatingStoreId, "", notecardName);
|
||||
|
||||
{
|
||||
// Read notecard
|
||||
UUID receivingStoreId = (UUID)InvokeOp("JsonCreateStore", "{ }");
|
||||
UUID readNotecardRequestId = (UUID)InvokeOpOnHost("JsonReadNotecard", so.UUID, receivingStoreId, "/", notecardName);
|
||||
UUID receivingStoreId = (UUID)InvokeOp("JsonCreateStore", "{}");
|
||||
UUID readNotecardRequestId = (UUID)InvokeOpOnHost("JsonReadNotecard", so.UUID, receivingStoreId, "", notecardName);
|
||||
Assert.That(readNotecardRequestId, Is.Not.EqualTo(UUID.Zero));
|
||||
|
||||
string value = (string)InvokeOp("JsonGetValue", receivingStoreId, "Hello");
|
||||
|
@ -354,23 +356,52 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
|
|||
}
|
||||
|
||||
{
|
||||
// Read notecard to non-root path
|
||||
UUID receivingStoreId = (UUID)InvokeOp("JsonCreateStore", "{ }");
|
||||
UUID readNotecardRequestId = (UUID)InvokeOpOnHost("JsonReadNotecard", so.UUID, receivingStoreId, "make/it/so", notecardName);
|
||||
// Read notecard to new single component path
|
||||
UUID receivingStoreId = (UUID)InvokeOp("JsonCreateStore", "{}");
|
||||
UUID readNotecardRequestId = (UUID)InvokeOpOnHost("JsonReadNotecard", so.UUID, receivingStoreId, "make", notecardName);
|
||||
Assert.That(readNotecardRequestId, Is.Not.EqualTo(UUID.Zero));
|
||||
|
||||
// These don't behave as I expect yet - reading to a path still seems to place the notecard contents at the root.
|
||||
// string value = (string)InvokeOp("JsonGetValue", receivingStoreId, "Hello");
|
||||
// Assert.That(value, Is.EqualTo(""));
|
||||
//
|
||||
// value = (string)InvokeOp("JsonGetValue", receivingStoreId, "make/it/so/Hello");
|
||||
// Assert.That(value, Is.EqualTo("World"));
|
||||
string value = (string)InvokeOp("JsonGetValue", receivingStoreId, "Hello");
|
||||
Assert.That(value, Is.EqualTo(""));
|
||||
|
||||
value = (string)InvokeOp("JsonGetValue", receivingStoreId, "make.Hello");
|
||||
Assert.That(value, Is.EqualTo("World"));
|
||||
}
|
||||
|
||||
{
|
||||
// Read notecard to new multi-component path
|
||||
UUID receivingStoreId = (UUID)InvokeOp("JsonCreateStore", "{}");
|
||||
UUID readNotecardRequestId = (UUID)InvokeOpOnHost("JsonReadNotecard", so.UUID, receivingStoreId, "make.it", notecardName);
|
||||
Assert.That(readNotecardRequestId, Is.Not.EqualTo(UUID.Zero));
|
||||
|
||||
// These don't behave as I expect yet - reading to a path still seems to place the notecard contents at the root.
|
||||
string value = (string)InvokeOp("JsonGetValue", receivingStoreId, "Hello");
|
||||
Assert.That(value, Is.EqualTo(""));
|
||||
|
||||
// TODO: Check that we are not expecting reading to a new path to work.
|
||||
value = (string)InvokeOp("JsonGetValue", receivingStoreId, "make.it.Hello");
|
||||
Assert.That(value, Is.EqualTo(""));
|
||||
}
|
||||
|
||||
{
|
||||
// Read notecard to existing multi-component path
|
||||
UUID receivingStoreId = (UUID)InvokeOp("JsonCreateStore", "{ 'make' : { 'it' : 'so' } }");
|
||||
UUID readNotecardRequestId = (UUID)InvokeOpOnHost("JsonReadNotecard", so.UUID, receivingStoreId, "make.it", notecardName);
|
||||
Assert.That(readNotecardRequestId, Is.Not.EqualTo(UUID.Zero));
|
||||
|
||||
// These don't behave as I expect yet - reading to a path still seems to place the notecard contents at the root.
|
||||
string value = (string)InvokeOp("JsonGetValue", receivingStoreId, "Hello");
|
||||
Assert.That(value, Is.EqualTo(""));
|
||||
|
||||
value = (string)InvokeOp("JsonGetValue", receivingStoreId, "make.it.Hello");
|
||||
Assert.That(value, Is.EqualTo("World"));
|
||||
}
|
||||
|
||||
{
|
||||
// Try read notecard to fake store.
|
||||
UUID fakeStoreId = TestHelpers.ParseTail(0x500);
|
||||
UUID readNotecardRequestId = (UUID)InvokeOpOnHost("JsonReadNotecard", so.UUID, fakeStoreId, "/", notecardName);
|
||||
UUID readNotecardRequestId = (UUID)InvokeOpOnHost("JsonReadNotecard", so.UUID, fakeStoreId, "", notecardName);
|
||||
Assert.That(fakeStoreId, Is.Not.EqualTo(UUID.Zero));
|
||||
|
||||
string value = (string)InvokeOp("JsonGetValue", fakeStoreId, "Hello");
|
||||
|
|
Loading…
Reference in New Issue