// Try to add twice @Test public void add_delete_dataset_2() { checkNotThere(dsTest); File f = new File("testing/config-ds-1.ttl"); { org.apache.http.entity.ContentType ct = org.apache.http.entity.ContentType.parse( WebContent.contentTypeTurtle + "; charset=" + WebContent.charsetUTF8); HttpEntity e = new FileEntity(f, ct); execHttpPost(ServerTest.urlRoot + "$/" + opDatasets, e); } // Check exists. checkExists(dsTest); try { org.apache.http.entity.ContentType ct = org.apache.http.entity.ContentType.parse( WebContent.contentTypeTurtle + "; charset=" + WebContent.charsetUTF8); HttpEntity e = new FileEntity(f, ct); execHttpPost(ServerTest.urlRoot + "$/" + opDatasets, e); } catch (HttpException ex) { assertEquals(HttpSC.CONFLICT_409, ex.getResponseCode()); } // Check exists. checkExists(dsTest); deleteDataset(dsTest); }
@Test public void state_1() { // Add one addTestDataset(); checkExists(dsTest); execHttpPost(ServerTest.urlRoot + "$/" + opDatasets + "/" + dsTest + "?state=offline", null); checkExistsNotActive(dsTest); execHttpPost(ServerTest.urlRoot + "$/" + opDatasets + "/" + dsTest + "?state=active", null); checkExists(dsTest); deleteDataset(dsTest); }
@Test public void state_2() { addTestDataset(); execHttpPost(ServerTest.urlRoot + "$/" + opDatasets + "/" + dsTest + "?state=offline", null); deleteDataset(dsTest); checkNotThere(dsTest); }
private static void addTestDataset() { File f = new File("testing/config-ds-1.ttl"); org.apache.http.entity.ContentType ct = org.apache.http.entity.ContentType.parse( WebContent.contentTypeTurtle + "; charset=" + WebContent.charsetUTF8); HttpEntity e = new FileEntity(f, ct); execHttpPost(ServerTest.urlRoot + "$/" + opDatasets, e); }
@Test public void state_3() { addTestDataset(); try { execHttpPost(ServerTest.urlRoot + "$/" + opDatasets + "/DoesNotExist?state=offline", null); } catch (HttpException ex) { assertEquals(HttpSC.NOT_FOUND_404, ex.getResponseCode()); } deleteDataset(dsTest); }
private String execSleepTask(String name, int millis) { String url = urlRoot + "$/sleep"; if (name != null) { if (name.startsWith("/")) name = name.substring(1); url = url + "/" + name; } JsonResponseHandler x = new JsonResponseHandler(); HttpOp.execHttpPost(url + "?interval=" + millis, null, WebContent.contentTypeJSON, x); JsonValue v = x.getJSON(); String id = v.getAsObject().get("taskId").getAsString().value(); return id; }
@Test public void server_2() { execHttpPost(ServerTest.urlRoot + "$/" + opServer, null); }
@Test public void ping_2() { execHttpPost(ServerTest.urlRoot + "$/" + opPing, null); }