Search in sources :

Example 31 with ValidatableResponse

use of io.restassured.response.ValidatableResponse in project testcases by coheigea.

the class KnoxRangerTest method makeWebHDFSInvocation.

private void makeWebHDFSInvocation(int statusCode, String user, String password) throws IOException {
    String basedir = System.getProperty("basedir");
    if (basedir == null) {
        basedir = new File(".").getCanonicalPath();
    }
    Path path = FileSystems.getDefault().getPath(basedir, "/src/test/resources/webhdfs-liststatus-test.json");
    driver.getMock("WEBHDFS").expect().method("GET").pathInfo("/v1/hdfstest").queryParam("op", "LISTSTATUS").respond().status(HttpStatus.SC_OK).content(IOUtils.toByteArray(path.toUri())).contentType("application/json");
    ValidatableResponse response = given().log().all().auth().preemptive().basic(user, password).header("X-XSRF-Header", "jksdhfkhdsf").queryParam("op", "LISTSTATUS").when().get(driver.getUrl("WEBHDFS") + "/v1/hdfstest").then().statusCode(statusCode).log().body();
    if (statusCode == HttpStatus.SC_OK) {
        response.body("FileStatuses.FileStatus[0].pathSuffix", is("dir"));
    }
}
Also used : Path(java.nio.file.Path) ValidatableResponse(io.restassured.response.ValidatableResponse) File(java.io.File)

Example 32 with ValidatableResponse

use of io.restassured.response.ValidatableResponse in project testcases by coheigea.

the class KnoxAuthorizationTest method makeWebHDFSInvocation.

private void makeWebHDFSInvocation(int statusCode, String user, String password) throws IOException {
    String basedir = System.getProperty("basedir");
    if (basedir == null) {
        basedir = new File(".").getCanonicalPath();
    }
    Path path = FileSystems.getDefault().getPath(basedir, "/src/test/resources/webhdfs-liststatus-test.json");
    driver.getMock("WEBHDFS").expect().method("GET").pathInfo("/v1/hdfstest").queryParam("op", "LISTSTATUS").respond().status(HttpStatus.SC_OK).content(IOUtils.toByteArray(path.toUri())).contentType("application/json");
    ValidatableResponse response = given().log().all().auth().preemptive().basic(user, password).header("X-XSRF-Header", "jksdhfkhdsf").queryParam("op", "LISTSTATUS").when().get(driver.getUrl("WEBHDFS") + "/v1/hdfstest").then().statusCode(statusCode).log().body();
    if (statusCode == HttpStatus.SC_OK) {
        response.body("FileStatuses.FileStatus[0].pathSuffix", is("dir"));
    }
}
Also used : Path(java.nio.file.Path) ValidatableResponse(io.restassured.response.ValidatableResponse) File(java.io.File)

Example 33 with ValidatableResponse

use of io.restassured.response.ValidatableResponse in project wildfly-swarm by wildfly-swarm.

the class BaseTckTest method doCallEndpoint.

/**
 * Calls the endpoint.
 * @param format
 */
protected ValidatableResponse doCallEndpoint(String format) {
    ValidatableResponse vr;
    vr = given().accept(APPLICATION_JSON).when().get("/openapi").then().statusCode(200);
    return vr;
}
Also used : ValidatableResponse(io.restassured.response.ValidatableResponse)

Aggregations

ValidatableResponse (io.restassured.response.ValidatableResponse)33 Test (org.testng.annotations.Test)24 File (java.io.File)4 Path (java.nio.file.Path)3 EntityTypeRequest (org.molgenis.data.rest.EntityTypeRequest)3 Gson (com.google.gson.Gson)2 Response (io.restassured.response.Response)2 URL (java.net.URL)2 Matchers.containsString (org.hamcrest.Matchers.containsString)2 Test (org.junit.Test)2 EntityCollectionRequest (org.molgenis.data.rest.EntityCollectionRequest)2 JsonParseException (com.fasterxml.jackson.core.JsonParseException)1 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)1 ProcessingException (com.github.fge.jsonschema.core.exceptions.ProcessingException)1 JsonArray (com.google.gson.JsonArray)1 Param (de.ipk_gatersleben.bit.bi.bridge.brapicomp.testing.config.Param)1 RestAssured.baseURI (io.restassured.RestAssured.baseURI)1 RequestSpecification (io.restassured.specification.RequestSpecification)1 IOException (java.io.IOException)1