Extend TestJsonWriteNotecard() regression test for cases with fake paths and fake stores.
Also separates out TestJsonWriteReadNotecard() into separate write and read tests0.7.4-extended
parent
f52cee9732
commit
23df5768c3
|
@ -261,6 +261,65 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
|
||||||
Assert.That(fakeStoreValueSet, Is.EqualTo(0));
|
Assert.That(fakeStoreValueSet, Is.EqualTo(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test for writing json to a notecard
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// 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.
|
||||||
|
/// </remarks>
|
||||||
|
[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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Test for reading and writing json to a notecard
|
/// Test for reading and writing json to a notecard
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -269,7 +328,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
|
||||||
/// it via the MockScriptEngine or perhaps by a dummy script instance.
|
/// it via the MockScriptEngine or perhaps by a dummy script instance.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
[Test]
|
[Test]
|
||||||
public void TestJsonWriteReadNotecard()
|
public void TestJsonReadNotecard()
|
||||||
{
|
{
|
||||||
TestHelpers.InMethod();
|
TestHelpers.InMethod();
|
||||||
// TestHelpers.EnableLogging();
|
// TestHelpers.EnableLogging();
|
||||||
|
@ -282,13 +341,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
|
||||||
UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ 'Hello':'World' }");
|
UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ 'Hello':'World' }");
|
||||||
|
|
||||||
// Write notecard
|
// Write notecard
|
||||||
UUID writeNotecardRequestId = (UUID)InvokeOpOnHost("JsonWriteNotecard", so.UUID, storeId, "/", notecardName);
|
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.
|
|
||||||
|
|
||||||
// Read notecard
|
// Read notecard
|
||||||
UUID receivingStoreId = (UUID)InvokeOp("JsonCreateStore", "{ 'Hello':'World' }");
|
UUID receivingStoreId = (UUID)InvokeOp("JsonCreateStore", "{ 'Hello':'World' }");
|
||||||
|
|
Loading…
Reference in New Issue