use of com.b2international.snowowl.core.api.IBranchPath in project snow-owl by b2ihealthcare.
the class SnomedMergeConflictTest method changedInSourceAndTargetMergeConflict.
@Test
public void changedInSourceAndTargetMergeConflict() {
String descriptionId = createNewDescription(branchPath);
IBranchPath a = BranchPathUtils.createPath(branchPath, "a");
branching.createBranch(a).statusCode(201);
// Parent branch changes to CaseSignificance.CASE_INSENSITIVE
changeCaseSignificance(branchPath, descriptionId, Concepts.ENTIRE_TERM_CASE_INSENSITIVE);
// Child branch changes to CaseSignificance.ENTIRE_TERM_CASE_SENSITIVE
changeCaseSignificance(a, descriptionId);
Collection<MergeConflict> conflicts = merge(branchPath, a, "Rebased case significance change over case significance change").body("status", equalTo(Merge.Status.CONFLICTS.name())).extract().as(Merge.class).getConflicts();
assertEquals(1, conflicts.size());
ConflictingAttribute attribute = ConflictingAttribute.builder().property("caseSignificanceId").oldValue(Concepts.ONLY_INITIAL_CHARACTER_CASE_INSENSITIVE).sourceValue(Concepts.ENTIRE_TERM_CASE_INSENSITIVE).targetValue(Concepts.ENTIRE_TERM_CASE_SENSITIVE).build();
MergeConflict conflict = Iterables.getOnlyElement(conflicts);
assertEquals(descriptionId, conflict.getComponentId());
assertEquals("description", conflict.getComponentType());
assertEquals(ConflictType.CONFLICTING_CHANGE, conflict.getType());
assertEquals(attribute.toDisplayName(), Iterables.getOnlyElement(conflict.getConflictingAttributes()).toDisplayName());
}
use of com.b2international.snowowl.core.api.IBranchPath in project snow-owl by b2ihealthcare.
the class SnomedMergeConflictTest method rebaseResolvableIsaRelationshipConflictSameDestination.
@Test
public void rebaseResolvableIsaRelationshipConflictSameDestination() throws Exception {
final String concept = createNewConcept(branchPath, Concepts.ROOT_CONCEPT);
final IBranchPath a = BranchPathUtils.createPath(branchPath, "a");
branching.createBranch(a).statusCode(201);
String relationshipOnParent = createNewRelationship(branchPath, concept, Concepts.IS_A, Concepts.TOPLEVEL_METADATA);
String relationshipOnChild = createNewRelationship(a, concept, Concepts.IS_A, Concepts.TOPLEVEL_METADATA);
merge(branchPath, a, "Rebase branch A").body("status", equalTo(Merge.Status.COMPLETED.name()));
getComponent(a, SnomedComponentType.RELATIONSHIP, relationshipOnChild).statusCode(200);
getComponent(a, SnomedComponentType.RELATIONSHIP, relationshipOnParent).statusCode(200);
SnomedConcept conceptOnChild = getComponent(a, SnomedComponentType.CONCEPT, concept).statusCode(200).extract().as(SnomedConcept.class);
assertThat(conceptOnChild.getStatedParentIdsAsString()).containsOnly(Concepts.ROOT_CONCEPT, Concepts.TOPLEVEL_METADATA);
assertThat(conceptOnChild.getParentIdsAsString()).containsOnly(IComponent.ROOT_ID);
assertThat(conceptOnChild.getStatedAncestorIdsAsString()).containsOnly(IComponent.ROOT_ID, Concepts.ROOT_CONCEPT);
assertThat(conceptOnChild.getAncestorIdsAsString()).isEmpty();
}
use of com.b2international.snowowl.core.api.IBranchPath in project snow-owl by b2ihealthcare.
the class SnomedConceptApiTest method deleteConceptOnNestedBranch.
@Test
public void deleteConceptOnNestedBranch() {
String parentId = ROOT_CONCEPT;
for (int i = 0; i < 10; i++) {
parentId = createNewConcept(branchPath, parentId);
}
IBranchPath a = BranchPathUtils.createPath(branchPath, "a");
IBranchPath b = BranchPathUtils.createPath(a, "b");
branching.createBranchRecursively(b);
// New component on nested branch resets the container's version to 1 again
createNewConcept(b, parentId);
// Deleting the last concept in the chain
deleteComponent(branchPath, SnomedComponentType.CONCEPT, parentId, false).statusCode(204);
getComponent(branchPath, SnomedComponentType.CONCEPT, parentId).statusCode(404);
// Should still exist on the nested branch, and be possible to remove
deleteComponent(b, SnomedComponentType.CONCEPT, parentId, false).statusCode(204);
getComponent(b, SnomedComponentType.CONCEPT, parentId).statusCode(404);
}
use of com.b2international.snowowl.core.api.IBranchPath in project snow-owl by b2ihealthcare.
the class SnomedExtensionCreationTest method createExtensionVersion02.
@Test
public void createExtensionVersion02() {
IBranchPath a = BranchPathUtils.createPath(branchPath, "a");
branching.createBranch(a).statusCode(201);
String conceptId = createNewConcept(a);
getComponent(branchPath, SnomedComponentType.CONCEPT, conceptId).statusCode(404);
String codeSystemId = "SNOMEDCT-CV2";
createCodeSystem(a, codeSystemId).statusCode(201);
getComponent(a, SnomedComponentType.CONCEPT, conceptId).statusCode(200).body("released", equalTo(false));
String versionId = "v1";
LocalDate effectiveTime = LocalDate.now();
createVersion(codeSystemId, versionId, effectiveTime).statusCode(201);
Version version = getVersion(codeSystemId, versionId);
assertThat(version.getEffectiveTime()).isEqualTo(effectiveTime);
getComponent(branchPath, SnomedComponentType.CONCEPT, conceptId).statusCode(404);
getComponent(a, SnomedComponentType.CONCEPT, conceptId).statusCode(200).body("released", equalTo(true)).body("effectiveTime", equalTo(effectiveTime.format(DateTimeFormatter.BASIC_ISO_DATE)));
}
use of com.b2international.snowowl.core.api.IBranchPath in project snow-owl by b2ihealthcare.
the class SnomedMergeApiTest method rebaseNewRelationshipDiverged.
@Test
public void rebaseNewRelationshipDiverged() {
final IBranchPath a = BranchPathUtils.createPath(branchPath, "a");
branching.createBranch(a).statusCode(201);
final String relationship1Id = createNewRelationship(branchPath);
final String relationship2Id = createNewRelationship(a);
getComponent(branchPath, SnomedComponentType.RELATIONSHIP, relationship1Id).statusCode(200);
getComponent(a, SnomedComponentType.RELATIONSHIP, relationship1Id).statusCode(404);
getComponent(branchPath, SnomedComponentType.RELATIONSHIP, relationship2Id).statusCode(404);
getComponent(a, SnomedComponentType.RELATIONSHIP, relationship2Id).statusCode(200);
merge(branchPath, a, "Rebased new relationship").body("status", equalTo(Merge.Status.COMPLETED.name()));
// Relationship 1 from the parent becomes visible on the child after rebasing
getComponent(branchPath, SnomedComponentType.RELATIONSHIP, relationship1Id).statusCode(200);
getComponent(a, SnomedComponentType.RELATIONSHIP, relationship1Id).statusCode(200);
// Relationship 2 should still not be present on the parent, however
getComponent(branchPath, SnomedComponentType.RELATIONSHIP, relationship2Id).statusCode(404);
getComponent(a, SnomedComponentType.RELATIONSHIP, relationship2Id).statusCode(200);
}
Aggregations