aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/OptionalModules
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2013-02-08 00:36:20 +0000
committerJustin Clark-Casey (justincc)2013-02-08 00:36:20 +0000
commit24bfdbfb804293362bbdc86dd5bb46e6add26bcb (patch)
tree4c264ef8d90bd3a89679c1555568308e94276777 /OpenSim/Region/OptionalModules
parentExtend TestJsonSetValue() regressio ntes tto test against a fake store (diff)
downloadopensim-SC_OLD-24bfdbfb804293362bbdc86dd5bb46e6add26bcb.zip
opensim-SC_OLD-24bfdbfb804293362bbdc86dd5bb46e6add26bcb.tar.gz
opensim-SC_OLD-24bfdbfb804293362bbdc86dd5bb46e6add26bcb.tar.bz2
opensim-SC_OLD-24bfdbfb804293362bbdc86dd5bb46e6add26bcb.tar.xz
Extend TestJsonWriteNotecard() regression test for cases with fake paths and fake stores.
Also separates out TestJsonWriteReadNotecard() into separate write and read tests
Diffstat (limited to 'OpenSim/Region/OptionalModules')
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs69
1 files changed, 61 insertions, 8 deletions
diff --git a/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs b/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs
index 73bc955..ce586be 100644
--- a/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs
@@ -262,6 +262,65 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
262 } 262 }
263 263
264 /// <summary> 264 /// <summary>
265 /// Test for writing json to a notecard
266 /// </summary>
267 /// <remarks>
268 /// TODO: Really needs to test correct receipt of the link_message event. Could do this by directly fetching
269 /// it via the MockScriptEngine or perhaps by a dummy script instance.
270 /// </remarks>
271 [Test]
272 public void TestJsonWriteNotecard()
273 {
274 TestHelpers.InMethod();
275// TestHelpers.EnableLogging();
276
277 SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, TestHelpers.ParseTail(0x1));
278 m_scene.AddSceneObject(so);
279
280 UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ 'Hello':'World' }");
281
282 {
283 string notecardName = "nc1";
284
285 // Write notecard
286 UUID writeNotecardRequestId = (UUID)InvokeOpOnHost("JsonWriteNotecard", so.UUID, storeId, "/", notecardName);
287 Assert.That(writeNotecardRequestId, Is.Not.EqualTo(UUID.Zero));
288
289 TaskInventoryItem nc1Item = so.RootPart.Inventory.GetInventoryItem(notecardName);
290 Assert.That(nc1Item, Is.Not.Null);
291
292 // TODO: Should independently check the contents.
293 }
294
295 {
296 // Try to write notecard against bad path
297 // In this case we do get a request id but no notecard is written.
298 string badPathNotecardName = "badPathNotecardName";
299
300 UUID writeNotecardBadPathRequestId
301 = (UUID)InvokeOpOnHost("JsonWriteNotecard", so.UUID, storeId, "flibble", badPathNotecardName);
302 Assert.That(writeNotecardBadPathRequestId, Is.Not.EqualTo(UUID.Zero));
303
304 TaskInventoryItem badPathItem = so.RootPart.Inventory.GetInventoryItem(badPathNotecardName);
305 Assert.That(badPathItem, Is.Null);
306 }
307
308 {
309 // Test with fake store
310 // In this case we do get a request id but no notecard is written.
311 string fakeStoreNotecardName = "fakeStoreNotecardName";
312
313 UUID fakeStoreId = TestHelpers.ParseTail(0x500);
314 UUID fakeStoreWriteNotecardValue
315 = (UUID)InvokeOpOnHost("JsonWriteNotecard", so.UUID, fakeStoreId, "/", fakeStoreNotecardName);
316 Assert.That(fakeStoreWriteNotecardValue, Is.Not.EqualTo(UUID.Zero));
317
318 TaskInventoryItem fakeStoreItem = so.RootPart.Inventory.GetInventoryItem(fakeStoreNotecardName);
319 Assert.That(fakeStoreItem, Is.Null);
320 }
321 }
322
323 /// <summary>
265 /// Test for reading and writing json to a notecard 324 /// Test for reading and writing json to a notecard
266 /// </summary> 325 /// </summary>
267 /// <remarks> 326 /// <remarks>
@@ -269,7 +328,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
269 /// it via the MockScriptEngine or perhaps by a dummy script instance. 328 /// it via the MockScriptEngine or perhaps by a dummy script instance.
270 /// </remarks> 329 /// </remarks>
271 [Test] 330 [Test]
272 public void TestJsonWriteReadNotecard() 331 public void TestJsonReadNotecard()
273 { 332 {
274 TestHelpers.InMethod(); 333 TestHelpers.InMethod();
275// TestHelpers.EnableLogging(); 334// TestHelpers.EnableLogging();
@@ -282,13 +341,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
282 UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ 'Hello':'World' }"); 341 UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ 'Hello':'World' }");
283 342
284 // Write notecard 343 // Write notecard
285 UUID writeNotecardRequestId = (UUID)InvokeOpOnHost("JsonWriteNotecard", so.UUID, storeId, "/", notecardName); 344 InvokeOpOnHost("JsonWriteNotecard", so.UUID, storeId, "/", notecardName);
286 Assert.That(writeNotecardRequestId, Is.Not.EqualTo(UUID.Zero));
287
288 TaskInventoryItem nc1Item = so.RootPart.Inventory.GetInventoryItem(notecardName);
289 Assert.That(nc1Item, Is.Not.Null);
290
291 // TODO: Should probably independently check the contents.
292 345
293 // Read notecard 346 // Read notecard
294 UUID receivingStoreId = (UUID)InvokeOp("JsonCreateStore", "{ 'Hello':'World' }"); 347 UUID receivingStoreId = (UUID)InvokeOp("JsonCreateStore", "{ 'Hello':'World' }");