From 5a22efe69cb75972d2fa9446d8b98734af7c653a Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 30 Jan 2013 05:49:28 +0000 Subject: refactor: Make invocations of json store functions from the regression test simpler --- .../JsonStore/Tests/JsonStoreScriptModuleTests.cs | 59 +++++++--------------- 1 file changed, 17 insertions(+), 42 deletions(-) (limited to 'OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests') diff --git a/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs b/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs index d209551..297d7c1 100644 --- a/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs +++ b/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs @@ -83,14 +83,18 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests // XXX: Unfortunately, ICommsModule currently has no way of deregistering methods. } + private object InvokeOp(string name, params object[] args) + { + return m_smcm.InvokeOperation(UUID.Zero, UUID.Zero, name, args); + } + [Test] public void TestJsonCreateStore() { TestHelpers.InMethod(); // TestHelpers.EnableLogging(); - UUID storeId = (UUID)m_smcm.InvokeOperation(UUID.Zero, UUID.Zero, "JsonCreateStore", new object[] { "{}" }); - + UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{}"); Assert.That(storeId, Is.Not.EqualTo(UUID.Zero)); } @@ -100,14 +104,9 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests TestHelpers.InMethod(); // TestHelpers.EnableLogging(); - UUID storeId - = (UUID)m_smcm.InvokeOperation( - UUID.Zero, UUID.Zero, "JsonCreateStore", new object[] { "{ 'Hello' : 'World' }" }); - - string value - = (string)m_smcm.InvokeOperation( - UUID.Zero, UUID.Zero, "JsonGetValue", new object[] { storeId, "Hello" }); + UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ 'Hello' : 'World' }"); + string value = (string)InvokeOp("JsonGetValue", storeId, "Hello"); Assert.That(value, Is.EqualTo("World")); } @@ -140,26 +139,15 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests TestHelpers.InMethod(); // TestHelpers.EnableLogging(); - UUID storeId - = (UUID)m_smcm.InvokeOperation( - UUID.Zero, UUID.Zero, "JsonCreateStore", new object[] { "{ 'Hello' : 'World' }" }); - - int returnValue - = (int)m_smcm.InvokeOperation( - UUID.Zero, UUID.Zero, "JsonRemoveValue", new object[] { storeId, "Hello" }); + UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ 'Hello' : 'World' }"); + int returnValue = (int)InvokeOp( "JsonRemoveValue", storeId, "Hello"); Assert.That(returnValue, Is.EqualTo(1)); - int result - = (int)m_smcm.InvokeOperation( - UUID.Zero, UUID.Zero, "JsonTestPath", new object[] { storeId, "Hello" }); - + int result = (int)InvokeOp("JsonTestPath", storeId, "Hello"); Assert.That(result, Is.EqualTo(0)); - string returnValue2 - = (string)m_smcm.InvokeOperation( - UUID.Zero, UUID.Zero, "JsonGetValue", new object[] { storeId, "Hello" }); - + string returnValue2 = (string)InvokeOp("JsonGetValue", storeId, "Hello"); Assert.That(returnValue2, Is.EqualTo("")); } @@ -169,14 +157,9 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests TestHelpers.InMethod(); // TestHelpers.EnableLogging(); - UUID storeId - = (UUID)m_smcm.InvokeOperation( - UUID.Zero, UUID.Zero, "JsonCreateStore", new object[] { "{ 'Hello' : 'World' }" }); - - int result - = (int)m_smcm.InvokeOperation( - UUID.Zero, UUID.Zero, "JsonTestPath", new object[] { storeId, "Hello" }); + UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ 'Hello' : 'World' }"); + int result = (int)InvokeOp("JsonTestPath", storeId, "Hello"); Assert.That(result, Is.EqualTo(1)); } @@ -186,20 +169,12 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests TestHelpers.InMethod(); // TestHelpers.EnableLogging(); - UUID storeId - = (UUID)m_smcm.InvokeOperation( - UUID.Zero, UUID.Zero, "JsonCreateStore", new object[] { "{ }" }); - - int result - = (int)m_smcm.InvokeOperation( - UUID.Zero, UUID.Zero, "JsonSetValue", new object[] { storeId, "Hello", "World" }); + UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{}"); + int result = (int)InvokeOp("JsonSetValue", storeId, "Hello", "World"); Assert.That(result, Is.EqualTo(1)); - string value - = (string)m_smcm.InvokeOperation( - UUID.Zero, UUID.Zero, "JsonGetValue", new object[] { storeId, "Hello" }); - + string value = (string)InvokeOp("JsonGetValue", storeId, "Hello"); Assert.That(value, Is.EqualTo("World")); } -- cgit v1.1