use of com.b2international.commons.json.Json in project snow-owl by b2ihealthcare.
the class SnomedConcreteValueApiTest method createConcreteValueInferred.
@Test
public void createConcreteValueInferred() {
Json requestBody = createConcreteValueRequestBody(Concepts.ROOT_CONCEPT, Concepts.PART_OF, new RelationshipValue(7), Concepts.INFERRED_RELATIONSHIP).with("commitComment", "Created new concrete value with inferred characteristic type");
String relationshipId = assertCreated(createComponent(branchPath, SnomedComponentType.RELATIONSHIP, requestBody));
getComponent(branchPath, SnomedComponentType.RELATIONSHIP, relationshipId).statusCode(200).body("characteristicTypeId", equalTo(Concepts.INFERRED_RELATIONSHIP));
}
use of com.b2international.commons.json.Json in project snow-owl by b2ihealthcare.
the class SnomedConcreteValueApiTest method createConcreteValueInvalidModule.
@Test
public void createConcreteValueInvalidModule() {
Json requestBody = createConcreteValueRequestBody(Concepts.ROOT_CONCEPT, Concepts.PART_OF, new RelationshipValue(5), Concepts.INFERRED_RELATIONSHIP, 0, "11110000").with("commitComment", "Created new concrete value with invalid moduleId");
createComponent(branchPath, SnomedComponentType.RELATIONSHIP, requestBody).statusCode(400);
}
use of com.b2international.commons.json.Json in project snow-owl by b2ihealthcare.
the class SnomedConcreteValueApiTest method createInactiveConcreteValue.
@Test
public void createInactiveConcreteValue() {
Json requestBody = createConcreteValueRequestBody(Concepts.ROOT_CONCEPT, Concepts.PART_OF, new RelationshipValue(5)).with("active", false).with("commitComment", "Created inactive concrete value");
String relationshipId = assertCreated(createComponent(branchPath, SnomedComponentType.RELATIONSHIP, requestBody));
getComponent(branchPath, SnomedComponentType.RELATIONSHIP, relationshipId).statusCode(200).body("active", equalTo(false));
}
use of com.b2international.commons.json.Json in project snow-owl by b2ihealthcare.
the class SnomedConcreteValueApiTest method restoreEffectiveTimeOnReleasedConcreteValue.
@Test
public void restoreEffectiveTimeOnReleasedConcreteValue() throws Exception {
final String relationshipId = createNewConcreteValue(branchPath);
// Create code system and version
final LocalDate effectiveTime = LocalDate.parse("2017-03-01");
createCodeSystemAndVersion(branchPath, "SNOMEDCT-CONCVAL-EFFTIME", "v1", effectiveTime);
// After versioning, the concrete value should be released and have an effective time set on it
getComponent(branchPath, SnomedComponentType.RELATIONSHIP, relationshipId).statusCode(200).body("active", equalTo(true)).body("released", equalTo(true)).body("effectiveTime", equalTo(effectiveTime.format(DateTimeFormatter.BASIC_ISO_DATE)));
Json inactivationRequestBody = Json.object("active", false, "commitComment", "Inactivate concrete value");
updateComponent(branchPath, SnomedComponentType.RELATIONSHIP, relationshipId, inactivationRequestBody).statusCode(204);
// An inactivation should unset the effective time field
getComponent(branchPath, SnomedComponentType.RELATIONSHIP, relationshipId).statusCode(200).body("active", equalTo(false)).body("released", equalTo(true)).body("effectiveTime", nullValue());
Json reactivationRequestBody = Json.object("active", true, "commitComment", "Reactivate concrete value");
updateComponent(branchPath, SnomedComponentType.RELATIONSHIP, relationshipId, reactivationRequestBody).statusCode(204);
// Getting the concrete value back to its originally released state should restore its effective time
getComponent(branchPath, SnomedComponentType.RELATIONSHIP, relationshipId).statusCode(200).body("active", equalTo(true)).body("released", equalTo(true)).body("effectiveTime", equalTo(effectiveTime.format(DateTimeFormatter.BASIC_ISO_DATE)));
}
use of com.b2international.commons.json.Json in project snow-owl by b2ihealthcare.
the class SnomedConcreteValueApiTest method updateUnreleasedConcreteValue.
@Test
public void updateUnreleasedConcreteValue() throws Exception {
String relationshipId = createNewConcreteValue(branchPath);
Json update = Json.object("value", Json.object("type", "INTEGER", "numericValue", "15"), "commitComment", "Updated value of unreleased concrete value");
updateComponent(branchPath, SnomedComponentType.RELATIONSHIP, relationshipId, update).statusCode(204);
getComponent(branchPath, SnomedComponentType.RELATIONSHIP, relationshipId).statusCode(200).body("value.type", equalTo("INTEGER")).body("value.numericValue", equalTo("15"));
}
Aggregations