use of com.b2international.snowowl.core.api.IBranchPath 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.api.IBranchPath 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.api.IBranchPath in project snow-owl by b2ihealthcare.
the class SnomedMergeConflictTest method rebaseResolvableNonIsaRelationshipConflict.
@Test
public void rebaseResolvableNonIsaRelationshipConflict() throws Exception {
final String concept = createNewConcept(branchPath, Concepts.ROOT_CONCEPT);
final IBranchPath a = BranchPathUtils.createPath(branchPath, "a");
branching.createBranch(a).statusCode(201);
String relationshipOnChild = createNewRelationship(a, concept, Concepts.FINDING_SITE, Concepts.TOPLEVEL_METADATA);
String relationshipOnParent = createNewRelationship(branchPath, concept, Concepts.FINDING_SITE, 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);
getComponent(a, SnomedComponentType.CONCEPT, concept).statusCode(200).extract().as(SnomedConcept.class);
}
use of com.b2international.snowowl.core.api.IBranchPath in project snow-owl by b2ihealthcare.
the class SnomedMergeConflictTest method rebaseResolvableDescriptionConflictOnTwoDifferentDescriptions.
@Test
public void rebaseResolvableDescriptionConflictOnTwoDifferentDescriptions() throws Exception {
final String concept = createNewConcept(branchPath);
final String syn = createNewDescription(branchPath, concept, Concepts.SYNONYM, SnomedApiTestConstants.UK_PREFERRED_MAP);
final String fsn = createNewDescription(branchPath, concept, Concepts.FULLY_SPECIFIED_NAME, SnomedApiTestConstants.UK_PREFERRED_MAP);
final IBranchPath a = BranchPathUtils.createPath(branchPath, "a");
branching.createBranch(a).statusCode(201);
Map<?, ?> synUpdateRequest = ImmutableMap.builder().put("term", "Updated").put("commitComment", "Change " + syn).build();
updateComponent(a, SnomedComponentType.DESCRIPTION, syn, synUpdateRequest).statusCode(204);
Map<?, ?> fsnUpdateRequest = ImmutableMap.builder().put("term", "Updated").put("commitComment", "Change " + fsn).build();
updateComponent(branchPath, SnomedComponentType.DESCRIPTION, fsn, fsnUpdateRequest).statusCode(204);
merge(branchPath, a, "Rebase branch A").body("status", equalTo(Merge.Status.COMPLETED.name()));
// checking duplicate revisions after sync
getComponent(a, SnomedComponentType.DESCRIPTION, syn).statusCode(200);
getComponent(a, SnomedComponentType.DESCRIPTION, fsn).statusCode(200);
getComponent(a, SnomedComponentType.CONCEPT, concept).statusCode(200);
}
use of com.b2international.snowowl.core.api.IBranchPath in project snow-owl by b2ihealthcare.
the class SnomedMergeConflictTest method rebaseConceptModuleConflictShouldReportConflict.
@Test
public void rebaseConceptModuleConflictShouldReportConflict() throws Exception {
final String concept = createNewConcept(branchPath);
final IBranchPath a = BranchPathUtils.createPath(branchPath, "a");
branching.createBranch(a).statusCode(201);
final Map<?, ?> moduleUpdateOnParent = Map.of("moduleId", Concepts.MODULE_ROOT, "commitComment", "Update module");
updateComponent(branchPath, SnomedComponentType.CONCEPT, concept, moduleUpdateOnParent);
final Map<?, ?> moduleUpdateOnChild = Map.of("moduleId", Concepts.MODULE_SCT_MODEL_COMPONENT, "commitComment", "Update module");
updateComponent(a, SnomedComponentType.CONCEPT, concept, moduleUpdateOnChild);
merge(branchPath, a, "Rebase branch A").body("status", equalTo(Merge.Status.CONFLICTS.name()));
}
Aggregations