Search in sources :

Example 6 with RequestSpecification

use of com.jayway.restassured.specification.RequestSpecification in project camunda-bpm-platform by camunda.

the class UserRestServiceQueryTest method testCompleteGetParameters.

@Test
public void testCompleteGetParameters() {
    Map<String, String> queryParameters = getCompleteStringQueryParameters();
    RequestSpecification requestSpecification = given().contentType(POST_JSON_CONTENT_TYPE);
    for (Entry<String, String> paramEntry : queryParameters.entrySet()) {
        requestSpecification.parameter(paramEntry.getKey(), paramEntry.getValue());
    }
    requestSpecification.expect().statusCode(Status.OK.getStatusCode()).when().get(USER_QUERY_URL);
    verify(mockQuery).userEmail(MockProvider.EXAMPLE_USER_EMAIL);
    verify(mockQuery).userFirstName(MockProvider.EXAMPLE_USER_FIRST_NAME);
    verify(mockQuery).userLastName(MockProvider.EXAMPLE_USER_LAST_NAME);
    verify(mockQuery).memberOfGroup(MockProvider.EXAMPLE_GROUP_ID);
    verify(mockQuery).memberOfTenant(MockProvider.EXAMPLE_TENANT_ID);
    verify(mockQuery).list();
}
Also used : RequestSpecification(com.jayway.restassured.specification.RequestSpecification) Test(org.junit.Test)

Example 7 with RequestSpecification

use of com.jayway.restassured.specification.RequestSpecification in project ddf by codice.

the class TestSpatial method sendCswQuery.

private String sendCswQuery(String query) {
    RequestSpecification queryRequest = given().body(query);
    queryRequest = queryRequest.header("Content-Type", TEXT_XML_UTF_8);
    return queryRequest.when().log().all().post(CSW_PATH.getUrl()).then().log().all().assertThat().statusCode(equalTo(HttpStatus.SC_OK)).extract().response().getBody().asString();
}
Also used : RequestSpecification(com.jayway.restassured.specification.RequestSpecification)

Example 8 with RequestSpecification

use of com.jayway.restassured.specification.RequestSpecification in project dataverse by IQSS.

the class UtilIT method addExternalTool.

static Response addExternalTool(JsonObject jsonObject) {
    RequestSpecification requestSpecification = given();
    requestSpecification = given().body(jsonObject.toString()).contentType(ContentType.JSON);
    return requestSpecification.post("/api/admin/externalTools");
}
Also used : RequestSpecification(com.jayway.restassured.specification.RequestSpecification)

Example 9 with RequestSpecification

use of com.jayway.restassured.specification.RequestSpecification in project dataverse by IQSS.

the class UtilIT method publishDatasetViaNativeApi.

static Response publishDatasetViaNativeApi(String idOrPersistentId, String majorOrMinor, String apiToken) {
    // Assume it's a number.
    String idInPath = idOrPersistentId;
    // If idOrPersistentId is a number we'll just put it in the path.
    String optionalQueryParam = "";
    if (!NumberUtils.isNumber(idOrPersistentId)) {
        idInPath = ":persistentId";
        optionalQueryParam = "&persistentId=" + idOrPersistentId;
    }
    RequestSpecification requestSpecification = given();
    if (apiToken != null) {
        requestSpecification = given().urlEncodingEnabled(false).header(UtilIT.API_TOKEN_HTTP_HEADER, apiToken);
    }
    return requestSpecification.post("/api/datasets/" + idInPath + "/actions/:publish?type=" + majorOrMinor + optionalQueryParam);
}
Also used : RequestSpecification(com.jayway.restassured.specification.RequestSpecification)

Example 10 with RequestSpecification

use of com.jayway.restassured.specification.RequestSpecification in project data-prep by Talend.

the class APIClientTest method createPreparationFromDataset.

/**
 * Create an empty preparation from a dataset.
 *
 * @param dataSetId the dataset id to create the preparation from.
 * @param name the preparation name.
 * @param folderId where to create the preparation.
 * @return the preparation id.
 * @throws IOException sh*t happens.
 */
public String createPreparationFromDataset(final String dataSetId, final String name, final String folderId) throws IOException {
    RequestSpecification request = // 
    given().contentType(// 
    JSON).body("{ \"name\": \"" + name + "\", \"dataSetId\": \"" + dataSetId + "\"}");
    if (folderId != null) {
        request = request.queryParam("folder", folderId);
    }
    final Response response = // 
    request.when().expect().statusCode(200).log().ifError().post("/api/preparations");
    assertThat(response.getStatusCode(), is(200));
    final String preparationId = response.asString();
    assertThat(preparationId, notNullValue());
    assertThat(preparationId, not(""));
    return preparationId;
}
Also used : Response(com.jayway.restassured.response.Response) RequestSpecification(com.jayway.restassured.specification.RequestSpecification)

Aggregations

RequestSpecification (com.jayway.restassured.specification.RequestSpecification)13 Test (org.junit.Test)4 Response (com.jayway.restassured.response.Response)2 IOException (java.io.IOException)1 Authorization (org.camunda.bpm.engine.authorization.Authorization)1 AuthorizationQuery (org.camunda.bpm.engine.authorization.AuthorizationQuery)1 PreparationMessage (org.talend.dataprep.api.preparation.PreparationMessage)1 TDPException (org.talend.dataprep.exception.TDPException)1 MockTDPException (org.talend.dataprep.test.MockTDPException)1