use of com.b2international.commons.json.Json in project snow-owl by b2ihealthcare.
the class SnomedRefSetMemberApiTest method searchOWLAxiomRefsetMemberBySourceTypeDestination.
@Test
public void searchOWLAxiomRefsetMemberBySourceTypeDestination() {
String conceptId = createNewConcept(branchPath);
Json requestBody = createRefSetMemberRequestBody(Concepts.REFSET_OWL_AXIOM, conceptId).with(SnomedRf2Headers.FIELD_OWL_EXPRESSION, "SubClassOf(:" + conceptId + " :" + Concepts.NAMESPACE_ROOT + ")").with("commitComment", "Created new OWL Axiom reference set member");
String memberId = assertCreated(createComponent(branchPath, SnomedComponentType.MEMBER, requestBody));
SnomedReferenceSetMembers results = givenAuthenticatedRequest(SnomedApiTestConstants.SCT_API).queryParam("referencedComponentId", conceptId).queryParam("owlExpression.typeId", Concepts.IS_A).queryParam("owlExpression.destinationId", Concepts.NAMESPACE_ROOT).get("/{path}/members", branchPath.getPath()).then().extract().as(SnomedReferenceSetMembers.class);
assertEquals(1, results.getItems().size());
SnomedReferenceSetMember member = results.getItems().stream().findFirst().get();
assertEquals(memberId, member.getId());
}
use of com.b2international.commons.json.Json in project snow-owl by b2ihealthcare.
the class SnomedRefSetMemberApiTest method createMRCMAttributeDomainMember.
@Test
public void createMRCMAttributeDomainMember() {
String newIdentifierConceptId = createNewConcept(branchPath, SnomedRefSetUtil.getParentConceptId(SnomedRefSetType.MRCM_ATTRIBUTE_DOMAIN));
createNewRefSet(branchPath, SnomedRefSetType.MRCM_ATTRIBUTE_DOMAIN, newIdentifierConceptId);
Json requestBody = createRefSetMemberRequestBody(newIdentifierConceptId, Concepts.ROOT_CONCEPT).with(Json.object(SnomedRf2Headers.FIELD_MRCM_DOMAIN_ID, Concepts.ROOT_CONCEPT, SnomedRf2Headers.FIELD_MRCM_GROUPED, Boolean.TRUE, SnomedRf2Headers.FIELD_MRCM_ATTRIBUTE_CARDINALITY, "attributeCardinality", SnomedRf2Headers.FIELD_MRCM_ATTRIBUTE_IN_GROUP_CARDINALITY, "attributeInGroupCardinality", SnomedRf2Headers.FIELD_MRCM_RULE_STRENGTH_ID, Concepts.ROOT_CONCEPT, SnomedRf2Headers.FIELD_MRCM_CONTENT_TYPE_ID, Concepts.ROOT_CONCEPT, "commitComment", "Created new reference set member"));
String memberId = assertCreated(createComponent(branchPath, SnomedComponentType.MEMBER, requestBody));
getComponent(branchPath, SnomedComponentType.MEMBER, memberId).statusCode(200).body(SnomedRf2Headers.FIELD_MRCM_DOMAIN_ID, equalTo(Concepts.ROOT_CONCEPT)).body(SnomedRf2Headers.FIELD_MRCM_GROUPED, equalTo(Boolean.TRUE)).body(SnomedRf2Headers.FIELD_MRCM_ATTRIBUTE_CARDINALITY, equalTo("attributeCardinality")).body(SnomedRf2Headers.FIELD_MRCM_ATTRIBUTE_IN_GROUP_CARDINALITY, equalTo("attributeInGroupCardinality")).body(SnomedRf2Headers.FIELD_MRCM_RULE_STRENGTH_ID, equalTo(Concepts.ROOT_CONCEPT)).body(SnomedRf2Headers.FIELD_MRCM_CONTENT_TYPE_ID, equalTo(Concepts.ROOT_CONCEPT));
Json requestBody2 = createRefSetMemberRequestBody(newIdentifierConceptId, Concepts.ROOT_CONCEPT).with(Json.object(// XXX batman should not be in the test dataset
SnomedRf2Headers.FIELD_MRCM_DOMAIN_ID, // XXX batman should not be in the test dataset
"159725002", SnomedRf2Headers.FIELD_MRCM_GROUPED, Boolean.TRUE, SnomedRf2Headers.FIELD_MRCM_ATTRIBUTE_CARDINALITY, "attributeCardinality", SnomedRf2Headers.FIELD_MRCM_ATTRIBUTE_IN_GROUP_CARDINALITY, "attributeInGroupCardinality", SnomedRf2Headers.FIELD_MRCM_RULE_STRENGTH_ID, Concepts.ROOT_CONCEPT, SnomedRf2Headers.FIELD_MRCM_CONTENT_TYPE_ID, Concepts.ROOT_CONCEPT, "commitComment", "Created new reference set member"));
createComponent(branchPath, SnomedComponentType.MEMBER, requestBody2).statusCode(400);
Json requestBody3 = createRefSetMemberRequestBody(newIdentifierConceptId, Concepts.ROOT_CONCEPT).with(Json.object(SnomedRf2Headers.FIELD_MRCM_DOMAIN_ID, Concepts.ROOT_CONCEPT, SnomedRf2Headers.FIELD_MRCM_GROUPED, Boolean.TRUE, SnomedRf2Headers.FIELD_MRCM_ATTRIBUTE_CARDINALITY, "attributeCardinality", SnomedRf2Headers.FIELD_MRCM_ATTRIBUTE_IN_GROUP_CARDINALITY, "attributeInGroupCardinality", // XXX batman should not be in the test dataset
SnomedRf2Headers.FIELD_MRCM_RULE_STRENGTH_ID, // XXX batman should not be in the test dataset
"159725002", SnomedRf2Headers.FIELD_MRCM_CONTENT_TYPE_ID, Concepts.ROOT_CONCEPT, "commitComment", "Created new reference set member"));
createComponent(branchPath, SnomedComponentType.MEMBER, requestBody3).statusCode(400);
Json requestBody4 = createRefSetMemberRequestBody(newIdentifierConceptId, Concepts.ROOT_CONCEPT).with(Json.object(SnomedRf2Headers.FIELD_MRCM_DOMAIN_ID, Concepts.ROOT_CONCEPT, SnomedRf2Headers.FIELD_MRCM_GROUPED, Boolean.TRUE, SnomedRf2Headers.FIELD_MRCM_ATTRIBUTE_CARDINALITY, "attributeCardinality", SnomedRf2Headers.FIELD_MRCM_ATTRIBUTE_IN_GROUP_CARDINALITY, "attributeInGroupCardinality", SnomedRf2Headers.FIELD_MRCM_RULE_STRENGTH_ID, Concepts.ROOT_CONCEPT, // XXX batman should not be in the test dataset
SnomedRf2Headers.FIELD_MRCM_CONTENT_TYPE_ID, // XXX batman should not be in the test dataset
"159725002", "commitComment", "Created new reference set member"));
createComponent(branchPath, SnomedComponentType.MEMBER, requestBody4).statusCode(400);
}
use of com.b2international.commons.json.Json in project snow-owl by b2ihealthcare.
the class SnomedRefSetMemberApiTest method executeSyncAction.
private void executeSyncAction(final String memberId) {
final Json syncActionRequest = Json.object("action", "sync", SnomedRf2Headers.FIELD_MODULE_ID, Concepts.MODULE_SCT_CORE, "commitComment", "Executed sync action on reference set member");
executeMemberAction(branchPath, memberId, syncActionRequest).statusCode(200);
}
use of com.b2international.commons.json.Json in project snow-owl by b2ihealthcare.
the class SnomedRefSetMemberApiTest method deleteReferringOwlAxiomRefsetMember.
@Test
public void deleteReferringOwlAxiomRefsetMember() {
String newIdentifierConceptId = createNewConcept(branchPath, SnomedRefSetUtil.getParentConceptId(SnomedRefSetType.OWL_AXIOM));
createNewRefSet(branchPath, SnomedRefSetType.OWL_AXIOM, newIdentifierConceptId);
String conceptId = createNewConcept(branchPath);
Json requestBody = createRefSetMemberRequestBody(newIdentifierConceptId, conceptId).with(SnomedRf2Headers.FIELD_OWL_EXPRESSION, SnomedApiTestConstants.owlAxiom1(conceptId)).with("commitComment", "Created new OWL Axiom reference set member");
String memberId = assertCreated(createComponent(branchPath, SnomedComponentType.MEMBER, requestBody));
getComponent(branchPath, SnomedComponentType.MEMBER, memberId).statusCode(200);
deleteComponent(branchPath, SnomedComponentType.CONCEPT, conceptId, false).statusCode(204);
getComponent(branchPath, SnomedComponentType.CONCEPT, conceptId).statusCode(404);
getComponent(branchPath, SnomedComponentType.MEMBER, memberId).statusCode(404);
}
use of com.b2international.commons.json.Json in project snow-owl by b2ihealthcare.
the class SnomedRefSetMemberApiTest method createAndUpdateUnpublishedModuleDependencyMembers.
@Test
public void createAndUpdateUnpublishedModuleDependencyMembers() {
Json requestBody = createRefSetMemberRequestBody(Concepts.REFSET_MODULE_DEPENDENCY_TYPE, Concepts.MODULE_SCT_MODEL_COMPONENT).with(SnomedRf2Headers.FIELD_SOURCE_EFFECTIVE_TIME, "").with(SnomedRf2Headers.FIELD_TARGET_EFFECTIVE_TIME, "").with("commitComment", "Created new module dependency reference set member");
String memberId = assertCreated(createComponent(branchPath, SnomedComponentType.MEMBER, requestBody));
SnomedReferenceSetMember member = getComponent(branchPath, SnomedComponentType.MEMBER, memberId).statusCode(200).extract().as(SnomedReferenceSetMember.class);
assertNull(member.getProperties().get(SnomedRf2Headers.FIELD_SOURCE_EFFECTIVE_TIME));
assertNull(member.getProperties().get(SnomedRf2Headers.FIELD_TARGET_EFFECTIVE_TIME));
Json updateRequest = Json.object(SnomedRf2Headers.FIELD_SOURCE_EFFECTIVE_TIME, "20181002", SnomedRf2Headers.FIELD_TARGET_EFFECTIVE_TIME, "20181002", "commitComment", "Updated reference set member");
updateRefSetComponent(branchPath, SnomedComponentType.MEMBER, memberId, updateRequest, false).statusCode(204);
SnomedReferenceSetMember updatedMember = getComponent(branchPath, SnomedComponentType.MEMBER, memberId).statusCode(200).extract().as(SnomedReferenceSetMember.class);
assertEquals(EffectiveTimes.parse("20181002", DateFormats.SHORT), updatedMember.getProperties().get(SnomedRf2Headers.FIELD_SOURCE_EFFECTIVE_TIME));
assertEquals(EffectiveTimes.parse("20181002", DateFormats.SHORT), updatedMember.getProperties().get(SnomedRf2Headers.FIELD_TARGET_EFFECTIVE_TIME));
}
Aggregations