aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/OptionalModules
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2013-02-13 00:12:20 +0000
committerJustin Clark-Casey (justincc)2013-02-13 00:12:20 +0000
commit4b797f2ead3052ca24ff36948f4bfb4e28bbb638 (patch)
tree13b7387e69dc52c915b75cb419221c101ea06a37 /OpenSim/Region/OptionalModules
parentExtend TestJsonCreateStore() with a one key input and an input with raw numbe... (diff)
downloadopensim-SC_OLD-4b797f2ead3052ca24ff36948f4bfb4e28bbb638.zip
opensim-SC_OLD-4b797f2ead3052ca24ff36948f4bfb4e28bbb638.tar.gz
opensim-SC_OLD-4b797f2ead3052ca24ff36948f4bfb4e28bbb638.tar.bz2
opensim-SC_OLD-4b797f2ead3052ca24ff36948f4bfb4e28bbb638.tar.xz
Extend TestJsonRemoveValue() with tests for non-penultimate nodes and arrays
Diffstat (limited to 'OpenSim/Region/OptionalModules')
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs70
1 files changed, 57 insertions, 13 deletions
diff --git a/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs b/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs
index eb4bc22..bba727d 100644
--- a/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs
@@ -260,25 +260,69 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
260 TestHelpers.InMethod(); 260 TestHelpers.InMethod();
261// TestHelpers.EnableLogging(); 261// TestHelpers.EnableLogging();
262 262
263 UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ 'Hello' : 'World' }"); 263 // Test remove of node in object pointing to a string
264 {
265 UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ 'Hello' : 'World' }");
266
267 int returnValue = (int)InvokeOp( "JsonRemoveValue", storeId, "Hello");
268 Assert.That(returnValue, Is.EqualTo(1));
269
270 int result = (int)InvokeOp("JsonTestPath", storeId, "Hello");
271 Assert.That(result, Is.EqualTo(0));
272
273 string returnValue2 = (string)InvokeOp("JsonGetValue", storeId, "Hello");
274 Assert.That(returnValue2, Is.EqualTo(""));
275 }
276
277 // Test remove of node in object pointing to another object
278 {
279 UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ 'Hello' : { 'World' : 'Wally' } }");
280
281 int returnValue = (int)InvokeOp( "JsonRemoveValue", storeId, "Hello");
282 Assert.That(returnValue, Is.EqualTo(1));
283
284 int result = (int)InvokeOp("JsonTestPath", storeId, "Hello");
285 Assert.That(result, Is.EqualTo(0));
264 286
265 int returnValue = (int)InvokeOp( "JsonRemoveValue", storeId, "Hello"); 287 string returnValue2 = (string)InvokeOp("JsonGetValueJson", storeId, "Hello");
266 Assert.That(returnValue, Is.EqualTo(1)); 288 Assert.That(returnValue2, Is.EqualTo(""));
289 }
267 290
268 int result = (int)InvokeOp("JsonTestPath", storeId, "Hello"); 291 // Test remove of node in an array
269 Assert.That(result, Is.EqualTo(0)); 292 {
293 UUID storeId
294 = (UUID)InvokeOp("JsonCreateStore", "{ 'Hello' : [ 'value1', 'value2' ] }");
270 295
271 string returnValue2 = (string)InvokeOp("JsonGetValue", storeId, "Hello"); 296 int returnValue = (int)InvokeOp( "JsonRemoveValue", storeId, "Hello[0]");
272 Assert.That(returnValue2, Is.EqualTo("")); 297 Assert.That(returnValue, Is.EqualTo(1));
298
299 int result = (int)InvokeOp("JsonTestPath", storeId, "Hello[0]");
300 Assert.That(result, Is.EqualTo(1));
301
302 result = (int)InvokeOp("JsonTestPath", storeId, "Hello[1]");
303 Assert.That(result, Is.EqualTo(0));
304
305 string stringReturnValue = (string)InvokeOp("JsonGetValue", storeId, "Hello[0]");
306 Assert.That(stringReturnValue, Is.EqualTo("value2"));
307
308 stringReturnValue = (string)InvokeOp("JsonGetValueJson", storeId, "Hello[1]");
309 Assert.That(stringReturnValue, Is.EqualTo(""));
310 }
273 311
274 // Test remove of non-existing value 312 // Test remove of non-existing value
275 int fakeValueRemove = (int)InvokeOp("JsonRemoveValue", storeId, "Hello"); 313 {
276 Assert.That(fakeValueRemove, Is.EqualTo(0)); 314 UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ 'Hello' : 'World' }");
277 315
278 // Test get from non-existing store 316 int fakeValueRemove = (int)InvokeOp("JsonRemoveValue", storeId, "Cheese");
279 UUID fakeStoreId = TestHelpers.ParseTail(0x500); 317 Assert.That(fakeValueRemove, Is.EqualTo(0));
280 int fakeStoreValueRemove = (int)InvokeOp("JsonRemoveValue", fakeStoreId, "Hello"); 318 }
281 Assert.That(fakeStoreValueRemove, Is.EqualTo(0)); 319
320 {
321 // Test get from non-existing store
322 UUID fakeStoreId = TestHelpers.ParseTail(0x500);
323 int fakeStoreValueRemove = (int)InvokeOp("JsonRemoveValue", fakeStoreId, "Hello");
324 Assert.That(fakeStoreValueRemove, Is.EqualTo(0));
325 }
282 } 326 }
283 327
284 [Test] 328 [Test]