use of com.b2international.snowowl.core.api.IBranchPath in project snow-owl by b2ihealthcare.
the class SnomedMergeConflictTest method noMergeNewDescriptionToUnrelatedBranch.
@Test
public void noMergeNewDescriptionToUnrelatedBranch() {
String conceptId = createNewConcept(branchPath);
IBranchPath a = BranchPathUtils.createPath(branchPath, "a");
branching.createBranch(a).statusCode(201);
/*
* XXX: Creating a new description on the concept itself would result in a DELETED_WHILE_CHANGED conflict;
* by referring to it as the type, the deletion will generate a CAUSES_MISSING_REFERENCE conflict instead.
*/
createNewDescription(a, Concepts.ROOT_CONCEPT, conceptId);
IBranchPath b = BranchPathUtils.createPath(branchPath, "b");
branching.createBranch(b).statusCode(201);
deleteComponent(b, SnomedComponentType.CONCEPT, conceptId, false).statusCode(204);
Collection<MergeConflict> conflicts = merge(a, b, "Merged new description to unrelated branch").body("status", equalTo(Merge.Status.CONFLICTS.name())).extract().as(Merge.class).getConflicts();
assertEquals(1, conflicts.size());
MergeConflict conflict = Iterables.getOnlyElement(conflicts);
assertEquals(conceptId, conflict.getComponentId());
assertEquals("concept", conflict.getComponentType());
assertEquals(ConflictType.CAUSES_MISSING_REFERENCE, conflict.getType());
assertEquals(0, conflict.getConflictingAttributes().size());
}
use of com.b2international.snowowl.core.api.IBranchPath in project snow-owl by b2ihealthcare.
the class SnomedMergeConflictTest method rebaseResolvableAxiomMemberConflict.
@Test
public void rebaseResolvableAxiomMemberConflict() throws Exception {
final String concept = createNewConcept(branchPath, Concepts.ROOT_CONCEPT);
final IBranchPath a = BranchPathUtils.createPath(branchPath, "a");
branching.createBranch(a).statusCode(201);
String axiomOnParent = createNewRefSetMember(branchPath, concept, Concepts.REFSET_OWL_AXIOM, Map.of(SnomedRf2Headers.FIELD_OWL_EXPRESSION, String.format("SubClassOf(:%s :%s)", concept, Concepts.TOPLEVEL_METADATA)));
String axiomOnChild = createNewRefSetMember(a, concept, Concepts.REFSET_OWL_AXIOM, Map.of(SnomedRf2Headers.FIELD_OWL_EXPRESSION, String.format("SubClassOf(:%s :%s)", concept, Concepts.TOPLEVEL_METADATA)));
merge(branchPath, a, "Rebase branch A").body("status", equalTo(Merge.Status.COMPLETED.name()));
getComponent(a, SnomedComponentType.MEMBER, axiomOnChild).statusCode(200);
getComponent(a, SnomedComponentType.MEMBER, axiomOnParent).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 SnomedMergeConflictTest method rebaseResolvableModuleAndTermChange.
@Test
public void rebaseResolvableModuleAndTermChange() throws Exception {
final String conceptA = createNewConcept(branchPath);
final String descriptionB = createNewDescription(branchPath, conceptA, Concepts.SYNONYM, SnomedApiTestConstants.UK_PREFERRED_MAP);
final IBranchPath a = BranchPathUtils.createPath(branchPath, "a");
branching.createBranch(a).statusCode(201);
Map<?, ?> descriptionBUpdateRequest = ImmutableMap.builder().put("term", "Description B New Term").put("commitComment", "Change description B").build();
updateComponent(branchPath, SnomedComponentType.DESCRIPTION, descriptionB, descriptionBUpdateRequest).statusCode(204);
Map<?, ?> conceptUpdateRequest = ImmutableMap.builder().put("moduleId", Concepts.MODULE_SCT_MODEL_COMPONENT).put("commitComment", "Change description B").build();
updateComponent(a, SnomedComponentType.CONCEPT, conceptA, conceptUpdateRequest).statusCode(204);
merge(branchPath, a, "Rebase branch A").body("status", equalTo(Merge.Status.COMPLETED.name()));
// checking duplicate revisions and properties after sync
// on parent branch
getComponent(branchPath, SnomedComponentType.DESCRIPTION, descriptionB).statusCode(200).body("term", equalTo("Description B New Term"));
getComponent(branchPath, SnomedComponentType.CONCEPT, conceptA).statusCode(200).body("moduleId", equalTo(Concepts.MODULE_SCT_CORE));
// on task branch
getComponent(a, SnomedComponentType.DESCRIPTION, descriptionB).statusCode(200).body("term", equalTo("Description B New Term"));
getComponent(a, SnomedComponentType.CONCEPT, conceptA).statusCode(200).body("moduleId", equalTo(Concepts.MODULE_SCT_MODEL_COMPONENT));
}
use of com.b2international.snowowl.core.api.IBranchPath in project snow-owl by b2ihealthcare.
the class SnomedMergeConflictTest method addedInSourceAndTargetMergeConflict.
@Test
public void addedInSourceAndTargetMergeConflict() {
IBranchPath a = BranchPathUtils.createPath(branchPath, "a");
branching.createBranch(a).statusCode(201);
String descriptionId = createNewDescription(branchPath);
Map<?, ?> requestBody = ImmutableMap.builder().put("id", descriptionId).put("conceptId", Concepts.ROOT_CONCEPT).put("moduleId", Concepts.MODULE_SCT_CORE).put("typeId", Concepts.SYNONYM).put("term", "Synonym of root concept").put("languageCode", "en").put("acceptability", SnomedApiTestConstants.UK_ACCEPTABLE_MAP).put("caseSignificanceId", Concepts.ENTIRE_TERM_CASE_INSENSITIVE).put("commitComment", "Created new synonym with duplicate SCTID").build();
createComponent(a, SnomedComponentType.DESCRIPTION, requestBody).statusCode(201);
Collection<MergeConflict> conflicts = merge(branchPath, a, "Rebased new description over new description with same SCTID").body("status", equalTo(Merge.Status.CONFLICTS.name())).extract().as(Merge.class).getConflicts();
assertEquals(1, conflicts.size());
ConflictingAttribute attribute = ConflictingAttribute.builder().property("id").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 deleteReferencedComponentOnTargetMergeConflict.
@Test
public void deleteReferencedComponentOnTargetMergeConflict() {
String conceptId = createNewConcept(branchPath);
IBranchPath a = BranchPathUtils.createPath(branchPath, "a");
branching.createBranch(a).statusCode(201);
createNewRefSetMember(branchPath, conceptId);
deleteComponent(a, SnomedComponentType.CONCEPT, conceptId, false).statusCode(204);
Collection<MergeConflict> conflicts = merge(branchPath, a, "Rebased deleted referenced component over new reference set member").body("status", equalTo(Merge.Status.CONFLICTS.name())).extract().as(Merge.class).getConflicts();
assertEquals(1, conflicts.size());
MergeConflict conflict = Iterables.getOnlyElement(conflicts);
assertEquals(conceptId, conflict.getComponentId());
assertEquals("concept", conflict.getComponentType());
assertEquals(ConflictType.CAUSES_MISSING_REFERENCE, conflict.getType());
}
Aggregations