aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2013-01-30 05:49:28 +0000
committerJustin Clark-Casey (justincc)2013-01-30 05:49:28 +0000
commit5a22efe69cb75972d2fa9446d8b98734af7c653a (patch)
treeb14f14996de6676d51c0d67d7f52274797dda82c /OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests
parentAdd regression test for script func JsonRemoveValue() (diff)
downloadopensim-SC-5a22efe69cb75972d2fa9446d8b98734af7c653a.zip
opensim-SC-5a22efe69cb75972d2fa9446d8b98734af7c653a.tar.gz
opensim-SC-5a22efe69cb75972d2fa9446d8b98734af7c653a.tar.bz2
opensim-SC-5a22efe69cb75972d2fa9446d8b98734af7c653a.tar.xz
refactor: Make invocations of json store functions from the regression test simpler
Diffstat (limited to 'OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests')
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs59
1 files changed, 17 insertions, 42 deletions
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
83 // XXX: Unfortunately, ICommsModule currently has no way of deregistering methods. 83 // XXX: Unfortunately, ICommsModule currently has no way of deregistering methods.
84 } 84 }
85 85
86 private object InvokeOp(string name, params object[] args)
87 {
88 return m_smcm.InvokeOperation(UUID.Zero, UUID.Zero, name, args);
89 }
90
86 [Test] 91 [Test]
87 public void TestJsonCreateStore() 92 public void TestJsonCreateStore()
88 { 93 {
89 TestHelpers.InMethod(); 94 TestHelpers.InMethod();
90// TestHelpers.EnableLogging(); 95// TestHelpers.EnableLogging();
91 96
92 UUID storeId = (UUID)m_smcm.InvokeOperation(UUID.Zero, UUID.Zero, "JsonCreateStore", new object[] { "{}" }); 97 UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{}");
93
94 Assert.That(storeId, Is.Not.EqualTo(UUID.Zero)); 98 Assert.That(storeId, Is.Not.EqualTo(UUID.Zero));
95 } 99 }
96 100
@@ -100,14 +104,9 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
100 TestHelpers.InMethod(); 104 TestHelpers.InMethod();
101// TestHelpers.EnableLogging(); 105// TestHelpers.EnableLogging();
102 106
103 UUID storeId 107 UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ 'Hello' : 'World' }");
104 = (UUID)m_smcm.InvokeOperation(
105 UUID.Zero, UUID.Zero, "JsonCreateStore", new object[] { "{ 'Hello' : 'World' }" });
106
107 string value
108 = (string)m_smcm.InvokeOperation(
109 UUID.Zero, UUID.Zero, "JsonGetValue", new object[] { storeId, "Hello" });
110 108
109 string value = (string)InvokeOp("JsonGetValue", storeId, "Hello");
111 Assert.That(value, Is.EqualTo("World")); 110 Assert.That(value, Is.EqualTo("World"));
112 } 111 }
113 112
@@ -140,26 +139,15 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
140 TestHelpers.InMethod(); 139 TestHelpers.InMethod();
141// TestHelpers.EnableLogging(); 140// TestHelpers.EnableLogging();
142 141
143 UUID storeId 142 UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ 'Hello' : 'World' }");
144 = (UUID)m_smcm.InvokeOperation(
145 UUID.Zero, UUID.Zero, "JsonCreateStore", new object[] { "{ 'Hello' : 'World' }" });
146
147 int returnValue
148 = (int)m_smcm.InvokeOperation(
149 UUID.Zero, UUID.Zero, "JsonRemoveValue", new object[] { storeId, "Hello" });
150 143
144 int returnValue = (int)InvokeOp( "JsonRemoveValue", storeId, "Hello");
151 Assert.That(returnValue, Is.EqualTo(1)); 145 Assert.That(returnValue, Is.EqualTo(1));
152 146
153 int result 147 int result = (int)InvokeOp("JsonTestPath", storeId, "Hello");
154 = (int)m_smcm.InvokeOperation(
155 UUID.Zero, UUID.Zero, "JsonTestPath", new object[] { storeId, "Hello" });
156
157 Assert.That(result, Is.EqualTo(0)); 148 Assert.That(result, Is.EqualTo(0));
158 149
159 string returnValue2 150 string returnValue2 = (string)InvokeOp("JsonGetValue", storeId, "Hello");
160 = (string)m_smcm.InvokeOperation(
161 UUID.Zero, UUID.Zero, "JsonGetValue", new object[] { storeId, "Hello" });
162
163 Assert.That(returnValue2, Is.EqualTo("")); 151 Assert.That(returnValue2, Is.EqualTo(""));
164 } 152 }
165 153
@@ -169,14 +157,9 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
169 TestHelpers.InMethod(); 157 TestHelpers.InMethod();
170// TestHelpers.EnableLogging(); 158// TestHelpers.EnableLogging();
171 159
172 UUID storeId 160 UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ 'Hello' : 'World' }");
173 = (UUID)m_smcm.InvokeOperation(
174 UUID.Zero, UUID.Zero, "JsonCreateStore", new object[] { "{ 'Hello' : 'World' }" });
175
176 int result
177 = (int)m_smcm.InvokeOperation(
178 UUID.Zero, UUID.Zero, "JsonTestPath", new object[] { storeId, "Hello" });
179 161
162 int result = (int)InvokeOp("JsonTestPath", storeId, "Hello");
180 Assert.That(result, Is.EqualTo(1)); 163 Assert.That(result, Is.EqualTo(1));
181 } 164 }
182 165
@@ -186,20 +169,12 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
186 TestHelpers.InMethod(); 169 TestHelpers.InMethod();
187// TestHelpers.EnableLogging(); 170// TestHelpers.EnableLogging();
188 171
189 UUID storeId 172 UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{}");
190 = (UUID)m_smcm.InvokeOperation(
191 UUID.Zero, UUID.Zero, "JsonCreateStore", new object[] { "{ }" });
192
193 int result
194 = (int)m_smcm.InvokeOperation(
195 UUID.Zero, UUID.Zero, "JsonSetValue", new object[] { storeId, "Hello", "World" });
196 173
174 int result = (int)InvokeOp("JsonSetValue", storeId, "Hello", "World");
197 Assert.That(result, Is.EqualTo(1)); 175 Assert.That(result, Is.EqualTo(1));
198 176
199 string value 177 string value = (string)InvokeOp("JsonGetValue", storeId, "Hello");
200 = (string)m_smcm.InvokeOperation(
201 UUID.Zero, UUID.Zero, "JsonGetValue", new object[] { storeId, "Hello" });
202
203 Assert.That(value, Is.EqualTo("World")); 178 Assert.That(value, Is.EqualTo("World"));
204 } 179 }
205 180