use of com.b2international.snowowl.core.api.IBranchPath in project snow-owl by b2ihealthcare.
the class SnomedMergeApiTest method rebaseNewConceptDiverged.
@Test
public void rebaseNewConceptDiverged() {
final IBranchPath a = BranchPathUtils.createPath(branchPath, "a");
branching.createBranch(a).statusCode(201);
final String concept1Id = createNewConcept(branchPath);
final String concept2Id = createNewConcept(a);
getComponent(branchPath, SnomedComponentType.CONCEPT, concept1Id).statusCode(200);
getComponent(a, SnomedComponentType.CONCEPT, concept1Id).statusCode(404);
getComponent(branchPath, SnomedComponentType.CONCEPT, concept2Id).statusCode(404);
getComponent(a, SnomedComponentType.CONCEPT, concept2Id).statusCode(200);
merge(branchPath, a, "Rebased new concept").body("status", equalTo(Merge.Status.COMPLETED.name()));
// Concept 1 from the parent becomes visible on the child after rebasing
getComponent(branchPath, SnomedComponentType.CONCEPT, concept1Id).statusCode(200);
getComponent(a, SnomedComponentType.CONCEPT, concept1Id).statusCode(200);
// Concept 2 should still not be present on the parent, however
getComponent(branchPath, SnomedComponentType.CONCEPT, concept2Id).statusCode(404);
getComponent(a, SnomedComponentType.CONCEPT, concept2Id).statusCode(200);
}
use of com.b2international.snowowl.core.api.IBranchPath in project snow-owl by b2ihealthcare.
the class SnomedMergeConflictTest method rebaseResolvableDescriptionConflictOnTheSameDescription.
@Test
public void rebaseResolvableDescriptionConflictOnTheSameDescription() 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(a, SnomedComponentType.DESCRIPTION, descriptionB, descriptionBUpdateRequest).statusCode(204);
updateComponent(branchPath, SnomedComponentType.DESCRIPTION, descriptionB, descriptionBUpdateRequest).statusCode(204);
merge(branchPath, a, "Rebase branch A").body("status", equalTo(Merge.Status.COMPLETED.name()));
// checking duplicate revisions after sync
getComponent(a, SnomedComponentType.DESCRIPTION, descriptionB).statusCode(200);
getComponent(a, SnomedComponentType.CONCEPT, conceptA).statusCode(200);
}
use of com.b2international.snowowl.core.api.IBranchPath in project snow-owl by b2ihealthcare.
the class SnomedMergeConflictTest method changedInSourceDetachedInTargetMergeConflict.
@Test
public void changedInSourceDetachedInTargetMergeConflict() {
String memberId = createNewRefSetMember(branchPath);
IBranchPath a = BranchPathUtils.createPath(branchPath, "a");
branching.createBranch(a).statusCode(201);
LocalDate nextEffectiveTime = getNextAvailableEffectiveDate(SnomedContentRule.SNOMEDCT_ID);
String nextEffectiveTimeAsString = EffectiveTimes.format(nextEffectiveTime, DateFormats.SHORT);
Map<?, ?> effectiveTimeUpdateRequest = ImmutableMap.builder().put("effectiveTime", nextEffectiveTimeAsString).put("commitComment", "Updated effective time on reference set member").build();
updateRefSetComponent(branchPath, SnomedComponentType.MEMBER, memberId, effectiveTimeUpdateRequest, true).statusCode(204);
deleteComponent(a, SnomedComponentType.MEMBER, memberId, false).statusCode(204);
Collection<MergeConflict> conflicts = merge(branchPath, a, "Rebased reference set member deletion over effective time update").body("status", equalTo(Merge.Status.CONFLICTS.name())).extract().as(Merge.class).getConflicts();
assertEquals(1, conflicts.size());
MergeConflict conflict = Iterables.getOnlyElement(conflicts);
assertEquals(memberId, conflict.getComponentId());
assertEquals("member", conflict.getComponentType());
assertEquals(ConflictType.DELETED_WHILE_CHANGED, conflict.getType());
Map<String, ConflictingAttribute> expectedAttributes = newHashMap();
expectedAttributes.put("effectiveTime", ConflictingAttribute.builder().property("effectiveTime").sourceValue(nextEffectiveTimeAsString).build());
expectedAttributes.put("released", ConflictingAttribute.builder().property("released").oldValue("false").sourceValue("true").build());
for (ConflictingAttribute attribute : conflict.getConflictingAttributes()) {
ConflictingAttribute expected = expectedAttributes.remove(attribute.getProperty());
assertNotNull(expected);
assertEquals(expected.toDisplayName(), attribute.toDisplayName());
}
assertThat(expectedAttributes).isEmpty();
}
use of com.b2international.snowowl.core.api.IBranchPath in project snow-owl by b2ihealthcare.
the class SnomedMergeConflictTest method rebaseResolvableIsaRelationshipConflictTwoDifferentDestinations.
@Test
public void rebaseResolvableIsaRelationshipConflictTwoDifferentDestinations() 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.CONCEPT_MODEL_DATA_ATTRIBUTE);
String relationshipOnChild = createNewRelationship(a, concept, Concepts.IS_A, Concepts.CONCEPT_MODEL_OBJECT_ATTRIBUTE);
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.CONCEPT_MODEL_DATA_ATTRIBUTE, Concepts.CONCEPT_MODEL_OBJECT_ATTRIBUTE);
assertThat(conceptOnChild.getParentIdsAsString()).containsOnly(IComponent.ROOT_ID);
assertThat(conceptOnChild.getStatedAncestorIdsAsString()).containsOnly(IComponent.ROOT_ID, Concepts.ROOT_CONCEPT, Concepts.LINKAGE, Concepts.ATTRIBUTE, Concepts.CONCEPT_MODEL_ATTRIBUTE, Concepts.TOPLEVEL_METADATA);
assertThat(conceptOnChild.getAncestorIdsAsString()).isEmpty();
}
use of com.b2international.snowowl.core.api.IBranchPath in project snow-owl by b2ihealthcare.
the class SnomedMergeConflictTest method addedInTargetDetachedInSourceMergeConflict.
@Test
public void addedInTargetDetachedInSourceMergeConflict() {
String conceptId = createNewConcept(branchPath);
IBranchPath a = BranchPathUtils.createPath(branchPath, "a");
branching.createBranch(a).statusCode(201);
deleteComponent(branchPath, SnomedComponentType.CONCEPT, conceptId, false).statusCode(204);
String relationshipId = createNewRelationship(a, Concepts.ROOT_CONCEPT, Concepts.PART_OF, conceptId);
Collection<MergeConflict> conflicts = merge(branchPath, a, "Rebased new relationship over deleted concept").body("status", equalTo(Merge.Status.CONFLICTS.name())).extract().as(Merge.class).getConflicts();
assertEquals(1, conflicts.size());
ConflictingAttribute attribute = ConflictingAttribute.builder().property("destinationId").sourceValue(conceptId).build();
MergeConflict conflict = Iterables.getOnlyElement(conflicts);
assertEquals(relationshipId, conflict.getComponentId());
assertEquals("relationship", conflict.getComponentType());
assertEquals(ConflictType.HAS_MISSING_REFERENCE, conflict.getType());
assertEquals(attribute.toDisplayName(), Iterables.getOnlyElement(conflict.getConflictingAttributes()).toDisplayName());
}
Aggregations