use of com.b2international.snowowl.core.api.IBranchPath in project snow-owl by b2ihealthcare.
the class SnomedMergeApiTest method rebaseStaleBranchWithChangesOnDeletedContent.
@Test
public void rebaseStaleBranchWithChangesOnDeletedContent() throws Exception {
final IBranchPath a = BranchPathUtils.createPath(branchPath, "a");
branching.createBranch(a).statusCode(201);
final String relationshipId = createNewRelationship(a);
final String descriptionId = createNewDescription(a);
final IBranchPath b = BranchPathUtils.createPath(a, "b");
branching.createBranch(b).statusCode(201);
deleteComponent(a, SnomedComponentType.RELATIONSHIP, relationshipId, false).statusCode(204);
deleteComponent(a, SnomedComponentType.DESCRIPTION, descriptionId, false).statusCode(204);
changeCaseSignificance(b, descriptionId);
changeRelationshipGroup(b, relationshipId);
// Make change on "branchPath" so "a" can be rebased
createNewRelationship(branchPath);
merge(branchPath, a, "Rebased component deletion over new relationship").body("status", equalTo(Merge.Status.COMPLETED.name()));
// "b" should be STALE at this point, try to rebase it, it should pass and the components should be deleted
merge(a, b, "Rebased component updates over deletion").body("status", equalTo(Merge.Status.COMPLETED.name()));
// Verify that the two deleted components are really deleted
getComponent(b, SnomedComponentType.DESCRIPTION, descriptionId).statusCode(404);
getComponent(b, SnomedComponentType.RELATIONSHIP, relationshipId).statusCode(404);
}
use of com.b2international.snowowl.core.api.IBranchPath in project snow-owl by b2ihealthcare.
the class SnomedMergeApiTest method rebaseStaleBranchWithChangesOnNewContent.
@Test
public void rebaseStaleBranchWithChangesOnNewContent() throws Exception {
final IBranchPath a = BranchPathUtils.createPath(branchPath, "a");
branching.createBranch(a).statusCode(201);
final String relationshipId = createNewRelationship(a);
final String descriptionId = createNewDescription(a);
final IBranchPath b = BranchPathUtils.createPath(a, "b");
branching.createBranch(b).statusCode(201);
changeCaseSignificance(b, descriptionId);
changeRelationshipGroup(b, relationshipId);
// Make change on "branchPath" so "a" can be rebased
createNewRelationship(branchPath);
merge(branchPath, a, "Rebased new components over new relationship").body("status", equalTo(Merge.Status.COMPLETED.name()));
getComponent(a, SnomedComponentType.DESCRIPTION, descriptionId).statusCode(200).body("caseSignificanceId", equalTo(Concepts.ONLY_INITIAL_CHARACTER_CASE_INSENSITIVE));
getComponent(a, SnomedComponentType.RELATIONSHIP, relationshipId).statusCode(200).body("relationshipGroup", equalTo(0));
// "b" should be STALE at this point, try to rebase it, it should pass and the components should still exist with changed content
merge(a, b, "Rebased changed components over new components").body("status", equalTo(Merge.Status.COMPLETED.name()));
// Verify that the two components have the modified values
getComponent(b, SnomedComponentType.DESCRIPTION, descriptionId).statusCode(200).body("caseSignificanceId", equalTo(Concepts.ENTIRE_TERM_CASE_SENSITIVE));
getComponent(b, SnomedComponentType.RELATIONSHIP, relationshipId).statusCode(200).body("relationshipGroup", equalTo(99));
}
use of com.b2international.snowowl.core.api.IBranchPath in project snow-owl by b2ihealthcare.
the class SnomedMergeApiTest method mergeNewRelationshipToUnrelatedBranch.
@Test
public void mergeNewRelationshipToUnrelatedBranch() {
final IBranchPath a = BranchPathUtils.createPath(branchPath, "a");
branching.createBranch(a).statusCode(201);
final IBranchPath b = BranchPathUtils.createPath(branchPath, "b");
branching.createBranch(b).statusCode(201);
final String relationshipId = createNewRelationship(a);
getComponent(a, SnomedComponentType.RELATIONSHIP, relationshipId).statusCode(200);
getComponent(b, SnomedComponentType.RELATIONSHIP, relationshipId).statusCode(404);
merge(a, b, "Merged new relationship from unrelated branch").body("status", equalTo(Merge.Status.COMPLETED.name()));
getComponent(a, SnomedComponentType.RELATIONSHIP, relationshipId).statusCode(200);
getComponent(b, SnomedComponentType.RELATIONSHIP, relationshipId).statusCode(200);
}
use of com.b2international.snowowl.core.api.IBranchPath in project snow-owl by b2ihealthcare.
the class SnomedMergeApiTest method rebaseUnsetEffectiveTimeOnTarget.
@Test
public void rebaseUnsetEffectiveTimeOnTarget() {
final String memberId = createNewRefSetMember(branchPath);
LocalDate version = getNextAvailableEffectiveDate(SnomedContentRule.SNOMEDCT_ID);
updateRefSetMemberEffectiveTime(branchPath, memberId, version);
final IBranchPath a = BranchPathUtils.createPath(branchPath, "a");
branching.createBranch(a).statusCode(201);
final Map<?, ?> parentRequest = ImmutableMap.builder().put("active", false).put("commitComment", "Inactivated reference set member").build();
// Parent unsets the effective time and inactivates the member
updateRefSetComponent(branchPath, SnomedComponentType.MEMBER, memberId, parentRequest, false).statusCode(204);
version = version.plus(1, ChronoUnit.DAYS);
// Child increases the effective time by one day
updateRefSetMemberEffectiveTime(a, memberId, version);
merge(branchPath, a, "Rebased effective time change over update").body("status", equalTo(Merge.Status.COMPLETED.name()));
getComponent(branchPath, SnomedComponentType.MEMBER, memberId).statusCode(200).body("released", equalTo(true)).body("effectiveTime", nullValue()).body("active", equalTo(false));
getComponent(a, SnomedComponentType.MEMBER, memberId).statusCode(200).body("released", equalTo(true)).body("effectiveTime", // Parent wins because of the effective time unset
nullValue()).body("active", // Child didn't update the status, so inactivation on the parent is in effect
equalTo(false));
}
use of com.b2international.snowowl.core.api.IBranchPath in project snow-owl by b2ihealthcare.
the class SnomedMergeApiTest method rebaseChangedConceptOnParentDeletedOnBranch.
@Test
public void rebaseChangedConceptOnParentDeletedOnBranch() {
final String conceptId = createNewConcept(branchPath);
final IBranchPath a = BranchPathUtils.createPath(branchPath, "a");
branching.createBranch(a).statusCode(201);
rebaseConceptDeletionOverChange(branchPath, a, conceptId);
// Concept should still be present on parent, and deleted on child
getComponent(branchPath, SnomedComponentType.CONCEPT, conceptId).statusCode(200).body("definitionStatusId", equalTo(Concepts.FULLY_DEFINED));
getComponent(a, SnomedComponentType.CONCEPT, conceptId).statusCode(404);
}
Aggregations