Skip to content

Commit e55dd3f

Browse files
committed
updated with a test for an issue 151
1 parent b88e14e commit e55dd3f

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

test-complete/src/test/java/com/marklogic/javaclient/TestJSResourceExtensions.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -207,12 +207,12 @@ public void test1GetAllResourceServices() throws Exception {
207207
TestJSExtension tjs= new TestJSExtension(client);
208208
String expectedResponse="{\"response\":[200, \"OK\"]}";
209209
JSONAssert.assertEquals(expectedResponse, tjs.putJSON("helloJS.json"), false);
210-
String expAftrPut ="{\"argument1\":\"helloJS.json\", \"argument2\":\"Earth\",\"database-name\":\"TestJSResourceExtensionDB\", \"document-count\":1, \"content\":\"This is a JSON document\", \"document-content\":{\"argument1\":\"hello\", \"argument2\":\"Earth\", \"content\":\"This is a JSON document\", \"response\":[200, \"OK\"], \"outputTypes\":\"application/json\"}, \"response\":[200, \"OK\"], \"outputTypes\":\"application/json\"}";
210+
String expAftrPut ="{\"argument1\":\"helloJS.json\", \"argument2\":\"Earth\",\"database-name\":\"TestJSResourceExtensionDB\", \"document-count\":1, \"content\":\"This is a JSON document\", \"document-content\":{\"argument1\":\"hello\", \"argument2\":\"Earth\", \"content\":\"This is a JSON document\", \"response\":[200, \"OK\"], \"outputTypes\":\"application/json\"}, \"response\":[200, \"OK\"], \"outputTypes\":[\"application/json\"]}";
211211
JSONAssert.assertEquals(expAftrPut, tjs.getJSON("helloJS.json"), false);
212212
JSONAssert.assertEquals(expectedResponse, tjs.postJSON("helloJS.json"), false);
213-
String expAftrPost ="{\"argument1\":\"helloJS.json\", \"argument2\":\"Earth\", \"document-count\":1, \"content\":\"This is a JSON document\", \"document-content\":{\"argument1\":\"hello\", \"argument2\":\"Earth\", \"content\":\"This is a JSON document\", \"array\":[1, 2, 3], \"response\":[200, \"OK\"], \"outputTypes\":\"application/json\"}, \"response\":[200, \"OK\"], \"outputTypes\":\"application/json\"}";
213+
String expAftrPost ="{\"argument1\":\"helloJS.json\", \"argument2\":\"Earth\", \"document-count\":1, \"content\":\"This is a JSON document\", \"document-content\":{\"argument1\":\"hello\", \"argument2\":\"Earth\", \"content\":\"This is a JSON document\", \"array\":[1, 2, 3], \"response\":[200, \"OK\"], \"outputTypes\":\"application/json\"}, \"response\":[200, \"OK\"], \"outputTypes\":[\"application/json\"]}";
214214
JSONAssert.assertEquals(expAftrPost, tjs.getJSON("helloJS.json"), false);
215-
String expected ="{\"argument1\":\"helloJS.json\", \"argument2\":\"Earth\", \"document-count\":0, \"content\":\"This is a JSON document\", \"document-content\":null, \"response\":[200, \"OK\"], \"outputTypes\":\"application/json\"}";
215+
String expected ="{\"argument1\":\"helloJS.json\", \"argument2\":\"Earth\", \"document-count\":0, \"content\":\"This is a JSON document\", \"document-content\":null, \"response\":[200, \"OK\"], \"outputTypes\":[\"application/json\"]}";
216216
// JSONAssert.assertEquals(expected, tjs.getJSON(), false);
217217

218218
JSONAssert.assertEquals(expectedResponse, tjs.deleteJSON("helloJS.json"), false);
@@ -239,14 +239,14 @@ public void test2GetAllResourceServicesMultipleTimes() throws Exception {
239239
assertEquals("Total documents loaded are",150,jh.get().get("document-count").intValue());
240240

241241
String expAftrPut ="{\"argument1\":\"hello\", \"argument2\":\"Earth\", \"content\":\"This is a JSON document\", \"array\":[1, 2, 3], \"response\":[200, \"OK\"], \"outputTypes\":\"application/json\"}";
242-
String expected ="{\"argument1\":\"helloJS.json\", \"argument2\":\"Earth\", \"database-name\":\"TestJSResourceExtensionDB\", \"document-count\":0, \"content\":\"This is a JSON document\", \"document-content\":null, \"response\":[200, \"OK\"], \"outputTypes\":\"application/json\"}";
242+
String expected ="{\"argument1\":\"helloJS.json\", \"argument2\":\"Earth\", \"database-name\":\"TestJSResourceExtensionDB\", \"document-count\":0, \"content\":\"This is a JSON document\", \"document-content\":null, \"response\":[200, \"OK\"], \"outputTypes\":[\"application/json\"]}";
243243
// verify by reading all the documents to see put and post services correctly inserted documents and delete them
244244
for(int j=0;j<150;j++){
245245
jh.set(jh2.getMapper().readTree(tjs.getJSON("helloJS"+j+".json")));
246246
JSONAssert.assertEquals(expAftrPut,jh.get().get("document-content").findParent("array").toString(), false);
247247
JSONAssert.assertEquals(expectedResponse, tjs.deleteJSON("helloJS"+j+".json"), false);
248248
}
249-
// System.out.println(tjs.getJSON());
249+
System.out.println(tjs.getJSON("helloJS.json"));
250250
JSONAssert.assertEquals(expected, tjs.getJSON("helloJS.json"), false);
251251

252252
}

0 commit comments

Comments
 (0)