Search in sources :

Example 81 with JsonPath

use of com.jayway.restassured.path.json.JsonPath in project camunda-bpm-platform by camunda.

the class DeploymentRestServiceInteractionTest method verifyDmnDeploymentValues.

private void verifyDmnDeploymentValues(Deployment mockDeployment, String responseContent) {
    JsonPath path = from(responseContent);
    verifyStandardDeploymentValues(mockDeployment, path);
    Map<String, HashMap<String, Object>> deployedDecisionDefinitions = path.getMap(PROPERTY_DEPLOYED_DECISION_DEFINITIONS);
    assertEquals(1, deployedDecisionDefinitions.size());
    HashMap decisionDefinitionDto = deployedDecisionDefinitions.get(EXAMPLE_DECISION_DEFINITION_ID);
    assertNotNull(decisionDefinitionDto);
    verifyDmnDeployment(decisionDefinitionDto);
    assertNull(path.get(PROPERTY_DEPLOYED_DECISION_REQUIREMENTS_DEFINITIONS));
    assertNull(path.get(PROPERTY_DEPLOYED_PROCESS_DEFINITIONS));
    assertNull(path.get(PROPERTY_DEPLOYED_CASE_DEFINITIONS));
}
Also used : Matchers.anyString(org.mockito.Matchers.anyString) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) JsonPath(com.jayway.restassured.path.json.JsonPath)

Example 82 with JsonPath

use of com.jayway.restassured.path.json.JsonPath in project camunda-bpm-platform by camunda.

the class DeploymentRestServiceInteractionTest method verifyDeploymentValues.

private void verifyDeploymentValues(Deployment mockDeployment, String responseContent) {
    JsonPath path = from(responseContent);
    verifyStandardDeploymentValues(mockDeployment, path);
}
Also used : JsonPath(com.jayway.restassured.path.json.JsonPath)

Example 83 with JsonPath

use of com.jayway.restassured.path.json.JsonPath in project kylo by Teradata.

the class SearchFeedMetadataEsIT method verifyIndexDocCompleteness.

private void verifyIndexDocCompleteness(String feedId) {
    String docId = getDocIdForIndexedFeedMetadata(feedId);
    Response response = RestAssured.get(getBaseEsUrl() + FEEDS_INDEX_PREFIX + "-" + WORKSPACE + "/" + FEEDS_DOCTYPE + "/" + docId);
    response.then().assertThat().body(matchesJsonSchemaInClasspath(FEEDS_SEARCH_RESULT_SCHEMA_JSON_PATH));
    String responseJson = response.asString();
    JsonPath responseJsonPath = new JsonPath(responseJson);
    getIndexedFieldsWithJsonPathForEntity().forEach(field -> Assert.assertNotNull(responseJsonPath.get(field)));
}
Also used : Response(com.jayway.restassured.response.Response) JsonPath(com.jayway.restassured.path.json.JsonPath)

Example 84 with JsonPath

use of com.jayway.restassured.path.json.JsonPath in project data-prep by Talend.

the class SuggestionTest method suggestLimit.

@Test
public void suggestLimit() throws Exception {
    // given
    final String columnMetadata = IOUtils.toString(Application.class.getResourceAsStream("suggestions/date_column.json"), UTF_8);
    // when
    final String response = // 
    given().contentType(// 
    JSON).body(// 
    columnMetadata).when().post(// 
    "/suggest/column?limit=2").asString();
    // then
    final JsonPath json = JsonPath.from(response);
    assertThat(json.getList("").size(), is(2));
}
Also used : JsonPath(com.jayway.restassured.path.json.JsonPath) Application(org.talend.dataprep.transformation.Application) Test(org.junit.Test)

Example 85 with JsonPath

use of com.jayway.restassured.path.json.JsonPath in project data-prep by Talend.

the class DataSetAPITest method testDataSetDeleteWhenUsedByPreparation.

/**
 * DataSet deletion test case when the dataset is used by a preparation.
 */
@Test
public void testDataSetDeleteWhenUsedByPreparation() throws Exception {
    // given
    final String dataSetId = testClient.createDataset("dataset/dataset.csv", "testDataset");
    testClient.createPreparationFromDataset(dataSetId, "testPreparation", home.getId());
    // when/then
    final Response response = when().delete("/api/datasets/" + dataSetId);
    // then
    final int statusCode = response.statusCode();
    assertThat(statusCode, is(409));
    final String responseAsString = response.asString();
    final JsonPath json = from(responseAsString);
    assertThat(json.get("code"), is("TDP_API_DATASET_STILL_IN_USE"));
}
Also used : Response(com.jayway.restassured.response.Response) JsonPath(com.jayway.restassured.path.json.JsonPath) Test(org.junit.Test)

Aggregations

JsonPath (com.jayway.restassured.path.json.JsonPath)87 Test (org.junit.Test)56 Response (com.jayway.restassured.response.Response)29 BaseRestTest (integration.BaseRestTest)11 BaseRestIntegrationTest (se.inera.intyg.webcert.web.web.controller.integrationtest.BaseRestIntegrationTest)10 Matchers.isEmptyString (org.hamcrest.Matchers.isEmptyString)9 Matchers.anyString (org.mockito.Matchers.anyString)8 ValidatableResponse (com.jayway.restassured.response.ValidatableResponse)6 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)6 Matchers.containsString (org.hamcrest.Matchers.containsString)6 UsingDataSet (com.lordofthejars.nosqlunit.annotation.UsingDataSet)5 HttpServletResponse (javax.servlet.http.HttpServletResponse)5 Ignore (org.junit.Ignore)5 MongoDbSeed (integration.MongoDbSeed)4 HashMap (java.util.HashMap)3 Then (cucumber.api.java.en.Then)2 AbstractIntegrationTest (org.codice.ddf.itests.common.AbstractIntegrationTest)2 BaseMatcher (org.hamcrest.BaseMatcher)2 Description (org.hamcrest.Description)2 PreparationDTO (org.talend.dataprep.api.preparation.PreparationDTO)2