use of com.jayway.restassured.path.json.JsonPath in project webcert by sklintyg.
the class IntygModuleApiControllerIT method testReplaceIntyg.
@Test
public void testReplaceIntyg() {
final String personnummer = "19121212-1212";
RestAssured.sessionId = getAuthSession(DEFAULT_LAKARE);
changeOriginTo("DJUPINTEGRATION");
String intygsId = createSignedIntyg("lisjp", personnummer);
CopyIntygRequest copyIntygRequest = new CopyIntygRequest();
copyIntygRequest.setPatientPersonnummer(createPnr(personnummer));
Map<String, String> pathParams = new HashMap<>();
pathParams.put("intygsTyp", "lisjp");
pathParams.put("intygsId", intygsId);
final Response response = given().cookie("ROUTEID", BaseRestIntegrationTest.routeId).contentType(ContentType.JSON).and().pathParams(pathParams).and().body(copyIntygRequest).expect().statusCode(200).when().post("moduleapi/intyg/{intygsTyp}/{intygsId}/ersatt").then().body("intygsUtkastId", not(isEmptyString())).body("intygsUtkastId", not(equalTo(intygsId))).body("intygsTyp", equalTo("lisjp")).extract().response();
JsonPath intygJson = new JsonPath(response.body().asString());
String utkastId = intygJson.getString("intygsUtkastId");
// Verify that the new draft has correct relations
given().cookie("ROUTEID", BaseRestIntegrationTest.routeId).expect().statusCode(200).when().get(MODULEAPI_UTKAST_BASE + "/lisjp/" + utkastId).then().body("relations.parent.intygsId", equalTo(intygsId)).body("relations.parent.relationKod", equalTo(RelationKod.ERSATT.name()));
// Verify the original certficate has a child relationship
given().cookie("ROUTEID", BaseRestIntegrationTest.routeId).expect().statusCode(200).when().get("moduleapi/intyg/lisjp/" + intygsId).then().body("relations.latestChildRelations.replacedByUtkast.intygsId", equalTo(utkastId)).body("relations.latestChildRelations.replacedByUtkast.relationKod", equalTo(RelationKod.ERSATT.name()));
}
use of com.jayway.restassured.path.json.JsonPath in project webcert by sklintyg.
the class UtkastModuleApiControllerIT method testSaveDraft.
@Test
public void testSaveDraft() {
RestAssured.sessionId = getAuthSession(DEFAULT_LAKARE);
String intygsTyp = "luse";
String intygsId = createUtkast(intygsTyp, DEFAULT_PATIENT_PERSONNUMMER);
Response responseIntyg = given().cookie("ROUTEID", BaseRestIntegrationTest.routeId).expect().statusCode(200).when().get(MODULEAPI_UTKAST_BASE + "/" + intygsTyp + "/" + intygsId).then().body(matchesJsonSchemaInClasspath("jsonschema/webcert-get-utkast-response-schema.json")).extract().response();
JsonPath model = new JsonPath(responseIntyg.body().asString());
String version = model.getString("version");
Map<String, String> content = model.getJsonObject("content");
given().cookie("ROUTEID", BaseRestIntegrationTest.routeId).contentType(ContentType.JSON).body(content).expect().statusCode(200).when().put(MODULEAPI_UTKAST_BASE + "/" + intygsTyp + "/" + intygsId + "/" + version).then().body(matchesJsonSchemaInClasspath("jsonschema/webcert-save-draft-response-schema.json")).body("version", equalTo(Integer.parseInt(version) + 1));
}
use of com.jayway.restassured.path.json.JsonPath in project camunda-bpm-platform by camunda.
the class TaskRestServiceInteractionTest method verifyTaskCommentValues.
private void verifyTaskCommentValues(Comment mockTaskComment, String responseContent) {
JsonPath path = from(responseContent);
String returnedId = path.get("id");
String returnedUserId = path.get("userId");
String returnedTaskId = path.get("taskId");
Date returnedTime = DateTimeUtil.parseDate(path.<String>get("time"));
String returnedFullMessage = path.get("message");
assertEquals(mockTaskComment.getId(), returnedId);
assertEquals(mockTaskComment.getTaskId(), returnedTaskId);
assertEquals(mockTaskComment.getUserId(), returnedUserId);
assertEquals(mockTaskComment.getTime(), returnedTime);
assertEquals(mockTaskComment.getFullMessage(), returnedFullMessage);
}
use of com.jayway.restassured.path.json.JsonPath in project camunda-bpm-platform by camunda.
the class DeploymentRestServiceInteractionTest method verifyDeploymentWithDefinitionsValues.
private void verifyDeploymentWithDefinitionsValues(Deployment mockDeployment, String responseContent) {
JsonPath path = from(responseContent);
verifyStandardDeploymentValues(mockDeployment, path);
Map<String, HashMap<String, Object>> deployedProcessDefinitions = path.getMap(PROPERTY_DEPLOYED_PROCESS_DEFINITIONS);
Map<String, HashMap<String, Object>> deployedCaseDefinitions = path.getMap(PROPERTY_DEPLOYED_CASE_DEFINITIONS);
Map<String, HashMap<String, Object>> deployedDecisionDefinitions = path.getMap(PROPERTY_DEPLOYED_DECISION_DEFINITIONS);
Map<String, HashMap<String, Object>> deployedDecisionRequirementsDefinitions = path.getMap(PROPERTY_DEPLOYED_DECISION_REQUIREMENTS_DEFINITIONS);
assertEquals(1, deployedProcessDefinitions.size());
assertNotNull(deployedProcessDefinitions.get(MockProvider.EXAMPLE_PROCESS_DEFINITION_ID));
assertEquals(1, deployedCaseDefinitions.size());
assertNotNull(deployedCaseDefinitions.get(EXAMPLE_CASE_DEFINITION_ID));
assertEquals(1, deployedDecisionDefinitions.size());
assertNotNull(deployedDecisionDefinitions.get(EXAMPLE_DECISION_DEFINITION_ID));
assertEquals(1, deployedDecisionRequirementsDefinitions.size());
assertNotNull(deployedDecisionRequirementsDefinitions.get(EXAMPLE_DECISION_REQUIREMENTS_DEFINITION_ID));
}
use of com.jayway.restassured.path.json.JsonPath in project camunda-bpm-platform by camunda.
the class DeploymentRestServiceInteractionTest method verifyDeploymentValuesEmptyDefinitions.
private void verifyDeploymentValuesEmptyDefinitions(Deployment mockDeployment, String responseContent) {
JsonPath path = from(responseContent);
verifyStandardDeploymentValues(mockDeployment, path);
assertNull(path.get(PROPERTY_DEPLOYED_PROCESS_DEFINITIONS));
assertNull(path.get(PROPERTY_DEPLOYED_CASE_DEFINITIONS));
assertNull(path.get(PROPERTY_DEPLOYED_DECISION_DEFINITIONS));
assertNull(path.get(PROPERTY_DEPLOYED_DECISION_REQUIREMENTS_DEFINITIONS));
}
Aggregations