use of com.b2international.commons.json.Json in project snow-owl by b2ihealthcare.
the class SnomedRefSetMemberParameterizedTest method rejectInvalidProperties.
@Test
public void rejectInvalidProperties() throws Exception {
// Simple type reference sets can't be tested with this method
Assume.assumeFalse(SnomedRefSetType.SIMPLE.equals(refSetType));
String refSetId = getOrCreateRefSet(branchPath, refSetType);
String componentId = createNewComponent(branchPath, getFirstAllowedReferencedComponentType(refSetType));
Json requestBody = createRefSetMemberRequestBody(refSetId, componentId).with(getInvalidProperties()).with("commitComment", "Created new reference set member with invalid additional properties");
createComponent(branchPath, SnomedComponentType.MEMBER, requestBody).statusCode(400);
}
use of com.b2international.commons.json.Json in project snow-owl by b2ihealthcare.
the class SnomedRefSetMemberParameterizedTest method acceptValidUpdate.
@Test
public void acceptValidUpdate() throws Exception {
// Simple type reference sets can't be tested with this method
Assume.assumeFalse(SnomedRefSetType.SIMPLE.equals(refSetType));
final Pair<String, String> member = createRefSetMember();
final String memberId = member.getA();
final String referencedComponentId = member.getB();
Json updateRequest = Json.object().with(getUpdateProperties(referencedComponentId)).with("commitComment", "Updated reference set member");
updateRefSetComponent(branchPath, SnomedComponentType.MEMBER, memberId, updateRequest, false).statusCode(204);
ValidatableResponse response = getComponent(branchPath, SnomedComponentType.MEMBER, memberId).statusCode(200);
for (Entry<String, Object> validProperty : getUpdateProperties(referencedComponentId).entrySet()) {
response.body(validProperty.getKey(), equalTo(validProperty.getValue()));
}
}
use of com.b2international.commons.json.Json in project snow-owl by b2ihealthcare.
the class SnomedRefSetMemberParameterizedTest method rejectNonExistentComponentId.
@Test
public void rejectNonExistentComponentId() throws Exception {
String refSetId = createNewRefSet(branchPath, refSetType);
String referencedComponentId = reserveComponentId(null, getFirstAllowedReferencedComponentCategory(refSetType));
Json requestBody = createRefSetMemberRequestBody(refSetId, referencedComponentId).with(getValidProperties(refSetType, referencedComponentId)).with("commitComment", "Created new reference set member with non-existent referencedComponentId");
createComponent(branchPath, SnomedComponentType.MEMBER, requestBody).statusCode(400);
}
use of com.b2international.commons.json.Json in project snow-owl by b2ihealthcare.
the class SnomedRefSetMemberParameterizedTest method inactivateMember.
@Test
public void inactivateMember() throws Exception {
final Pair<String, String> member = createRefSetMember();
final String memberId = member.getA();
Json updateRequest = Json.object("active", false, "moduleId", Concepts.MODULE_ROOT, "commitComment", "Inactivated reference set member and changed module");
updateRefSetComponent(branchPath, SnomedComponentType.MEMBER, memberId, updateRequest, false).statusCode(204);
getComponent(branchPath, SnomedComponentType.MEMBER, memberId).statusCode(200).body("active", equalTo(false)).body("moduleId", equalTo(Concepts.MODULE_ROOT));
}
use of com.b2international.commons.json.Json in project snow-owl by b2ihealthcare.
the class SnomedRefSetMemberParameterizedTest method createRefSetMember.
/**
* Creates a member for the first applicable matching referenced component and returns the memberId and the referencedComponentId in a Pair.
*/
private Pair<String, String> createRefSetMember() {
String referencedComponentId = getFirstMatchingComponent(branchPath, getFirstAllowedReferencedComponentType(refSetType));
String refSetId = getOrCreateRefSet(branchPath, refSetType);
Json requestBody = createRefSetMemberRequestBody(refSetId, referencedComponentId).with(getValidProperties(refSetType, referencedComponentId)).with("commitComment", "Created new reference set member");
ValidatableResponse response = createComponent(branchPath, SnomedComponentType.MEMBER, requestBody).statusCode(201);
return Pair.of(lastPathSegment(response.extract().header("Location")), referencedComponentId);
}
Aggregations