use of com.b2international.snowowl.core.merge.MergeConflict in project snow-owl by b2ihealthcare.
the class SnomedMergeConflictTest method deleteReferencedComponentOnSourceMergeConflict.
@Test
public void deleteReferencedComponentOnSourceMergeConflict() {
String conceptId = createNewConcept(branchPath);
IBranchPath a = BranchPathUtils.createPath(branchPath, "a");
branching.createBranch(a).statusCode(201);
deleteComponent(branchPath, SnomedComponentType.CONCEPT, conceptId, false).statusCode(204);
String memberId = createNewRefSetMember(a, conceptId);
Collection<MergeConflict> conflicts = merge(branchPath, a, "Rebased new reference set member over deleted referenced component").body("status", equalTo(Merge.Status.CONFLICTS.name())).extract().as(Merge.class).getConflicts();
assertEquals(1, conflicts.size());
ConflictingAttribute attribute = ConflictingAttribute.builder().property("container").sourceValue(conceptId).build();
MergeConflict conflict = Iterables.getOnlyElement(conflicts);
assertEquals(memberId, conflict.getComponentId());
assertEquals("member", conflict.getComponentType());
assertEquals(ConflictType.HAS_MISSING_REFERENCE, conflict.getType());
assertEquals(attribute.toDisplayName(), Iterables.getOnlyElement(conflict.getConflictingAttributes()).toDisplayName());
}
use of com.b2international.snowowl.core.merge.MergeConflict in project snow-owl by b2ihealthcare.
the class SnomedMergeConflictTest method changedInSourceAndTargetMultipleConflict.
@Test
public void changedInSourceAndTargetMultipleConflict() {
String descriptionId = createNewDescription(branchPath);
IBranchPath a = BranchPathUtils.createPath(branchPath, "a");
branching.createBranch(a).statusCode(201);
Map<?, ?> changesOnParent = ImmutableMap.builder().put("caseSignificanceId", Concepts.ENTIRE_TERM_CASE_INSENSITIVE).put("moduleId", Concepts.MODULE_ROOT).put("commitComment", "Changed case significance and module on parent").build();
Map<?, ?> changesOnBranch = ImmutableMap.builder().put("caseSignificanceId", Concepts.ENTIRE_TERM_CASE_SENSITIVE).put("moduleId", Concepts.MODULE_SCT_MODEL_COMPONENT).put("commitComment", "Changed case significance and module on branch").build();
updateComponent(branchPath, SnomedComponentType.DESCRIPTION, descriptionId, changesOnParent).statusCode(204);
updateComponent(a, SnomedComponentType.DESCRIPTION, descriptionId, changesOnBranch).statusCode(204);
Collection<MergeConflict> conflicts = merge(branchPath, a, "Rebased description changes over conflicting description changes").body("status", equalTo(Merge.Status.CONFLICTS.name())).extract().as(Merge.class).getConflicts();
assertEquals(1, conflicts.size());
MergeConflict conflict = Iterables.getOnlyElement(conflicts);
assertEquals(descriptionId, conflict.getComponentId());
assertEquals("description", conflict.getComponentType());
assertEquals(ConflictType.CONFLICTING_CHANGE, conflict.getType());
Map<String, ConflictingAttribute> expectedAttributes = newHashMap();
expectedAttributes.put("caseSignificanceId", ConflictingAttribute.builder().property("caseSignificanceId").oldValue(Concepts.ONLY_INITIAL_CHARACTER_CASE_INSENSITIVE).sourceValue(Concepts.ENTIRE_TERM_CASE_INSENSITIVE).targetValue(Concepts.ENTIRE_TERM_CASE_SENSITIVE).build());
expectedAttributes.put("moduleId", ConflictingAttribute.builder().property("moduleId").oldValue(Concepts.MODULE_SCT_CORE).sourceValue(Concepts.MODULE_ROOT).targetValue(Concepts.MODULE_SCT_MODEL_COMPONENT).build());
for (ConflictingAttribute attribute : conflict.getConflictingAttributes()) {
ConflictingAttribute expected = expectedAttributes.remove(attribute.getProperty());
assertNotNull(expected);
assertEquals(expected.toDisplayName(), attribute.toDisplayName());
}
assertEquals(ImmutableList.of(), ImmutableList.copyOf(expectedAttributes.values()));
}
use of com.b2international.snowowl.core.merge.MergeConflict 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());
}
Aggregations