Пример #1
0
  // 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);
  }
Пример #2
0
  @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);
  }
Пример #3
0
 @Test
 public void state_2() {
   addTestDataset();
   execHttpPost(ServerTest.urlRoot + "$/" + opDatasets + "/" + dsTest + "?state=offline", null);
   deleteDataset(dsTest);
   checkNotThere(dsTest);
 }
Пример #4
0
 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);
 }
Пример #5
0
 @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);
 }
Пример #6
0
  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;
  }
Пример #7
0
 @Test
 public void server_2() {
   execHttpPost(ServerTest.urlRoot + "$/" + opServer, null);
 }
Пример #8
0
 @Test
 public void ping_2() {
   execHttpPost(ServerTest.urlRoot + "$/" + opPing, null);
 }