Beispiel #1
0
  @Test(description = "Get template with empty name and type")
  public void templates07() throws Exception {
    String url = swagger_url + "/template/" + "" + "/" + "";
    HttpResponse response = Utils.sendGetRequest(url);
    String responseBody = Utils.getResponseBody(response);

    System.out.println("templates07 Response Code: " + response.getStatusLine().getStatusCode());
    System.out.println(
        "templates07 Response Message: " + response.getStatusLine().getReasonPhrase());

    Assert.assertEquals(response.getStatusLine().getStatusCode(), 404);
    Assert.assertEquals(response.getStatusLine().getReasonPhrase(), "Not Found");
    Assert.assertEquals(responseBody, "The requested resource could not be found.");
  }
Beispiel #2
0
  @Test(description = "Get existing template")
  public void templates10() throws Exception {
    String existing_type = defaultProps.getProperty("existing_type");
    String existing_template = defaultProps.getProperty("existing_template");

    String url = swagger_url + "/template/" + existing_type + "/" + existing_template;
    HttpResponse response = Utils.sendGetRequest(url);
    String responseBody = Utils.getResponseBody(response);

    System.out.println("templates10 Response Code: " + response.getStatusLine().getStatusCode());
    System.out.println(
        "templates10 Response Message: " + response.getStatusLine().getReasonPhrase());
    System.out.println("templates10 Response Body: " + responseBody);

    Assert.assertEquals(response.getStatusLine().getStatusCode(), 200);
    Assert.assertEquals(response.getStatusLine().getReasonPhrase(), "OK");
  }
Beispiel #3
0
  @Test(description = "Get all outputs templates")
  public void templates04() throws Exception {
    String outputs_templates = defaultProps.getProperty("outputs_templates");

    String url = swagger_url + "/template/" + "output";
    HttpResponse response = Utils.sendGetRequest(url);
    String responseBody = Utils.getResponseBody(response);

    System.out.println("templates04 Response Code: " + response.getStatusLine().getStatusCode());
    System.out.println(
        "templates04 Response Message: " + response.getStatusLine().getReasonPhrase());
    System.out.println("templates04 Response Body: " + responseBody);

    Assert.assertEquals(response.getStatusLine().getStatusCode(), 200);
    Assert.assertEquals(response.getStatusLine().getReasonPhrase(), "OK");
    JSONArray bodyJson = new JSONArray(responseBody);
    Assert.assertEquals(bodyJson.length(), Integer.parseInt(outputs_templates));
  }
Beispiel #4
0
  @Test(description = "Get all templates with invalid type")
  public void templates02() throws Exception {
    String url = swagger_url + "/template/" + "invalid";
    HttpResponse response = Utils.sendGetRequest(url);

    System.out.println("templates02 Response Code: " + response.getStatusLine().getStatusCode());
    System.out.println(
        "templates02 Response Message: " + response.getStatusLine().getReasonPhrase());

    Assert.assertEquals(response.getStatusLine().getStatusCode(), 404);
    Assert.assertEquals(response.getStatusLine().getReasonPhrase(), "Not Found");
  }
Beispiel #5
0
  @Test(description = "Get template with non-existing name")
  public void templates09() throws Exception {
    String existing_type = defaultProps.getProperty("existing_type");

    String url = swagger_url + "/template/" + existing_type + "/" + "invalid";
    HttpResponse response = Utils.sendGetRequest(url);

    System.out.println("templates09 Response Code: " + response.getStatusLine().getStatusCode());
    System.out.println(
        "templates09 Response Message: " + response.getStatusLine().getReasonPhrase());

    Assert.assertEquals(response.getStatusLine().getStatusCode(), 404);
    Assert.assertEquals(response.getStatusLine().getReasonPhrase(), "Not Found");
  }