@Test public void test1GetAllResourceServices() throws KeyManagementException, NoSuchAlgorithmException, Exception { JacksonHandle jh = new JacksonHandle(); resourceMgr.listServices(jh); assertEquals("Format on Handle", "JSON", jh.getFormat().name()); assertEquals("Mime Type on Handle", "application/json", jh.getMimetype()); String expectedList = "{\"resources\":{\"resource\":[{\"name\":\"simpleJSResourceModule\", \"source-format\":\"javascript\", \"description\":\"Testing resource extension for java script\", \"version\":\"1.0\", \"title\":\"BasicJSTest\", \"methods\":{\"method\":[{\"method-name\":\"get\", \"parameter\":[{\"parameter-name\":\"my-uri\", \"parameter-type\":\"xs:string?\"}]}, {\"method-name\":\"post\"}, {\"method-name\":\"put\"}, {\"method-name\":\"delete\"}]}, \"resource-source\":\"/v1/resources/simpleJSResourceModule\"}]}}"; JSONAssert.assertEquals(expectedList, jh.get().toString(), false); TestJSExtension tjs = new TestJSExtension(client); String expectedResponse = "{\"response\":[200, \"OK\"]}"; JSONAssert.assertEquals(expectedResponse, tjs.putJSON("helloJS.json"), false); 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\"]}"; JSONAssert.assertEquals(expAftrPut, tjs.getJSON("helloJS.json"), false); JSONAssert.assertEquals(expectedResponse, tjs.postJSON("helloJS.json"), false); 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\"]}"; JSONAssert.assertEquals(expAftrPost, tjs.getJSON("helloJS.json"), false); 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\"]}"; JSONAssert.assertEquals(expectedResponse, tjs.deleteJSON("helloJS.json"), false); JSONAssert.assertEquals(expected, tjs.getJSON("helloJS.json"), false); }