use of com.b2international.snowowl.core.api.IBranchPath in project snow-owl by b2ihealthcare.
the class SnomedMergeApiTest method mergeNewDescriptionToUnrelatedBranch.
@Test
public void mergeNewDescriptionToUnrelatedBranch() {
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 descriptionId = createNewDescription(a);
getComponent(a, SnomedComponentType.DESCRIPTION, descriptionId).statusCode(200);
getComponent(b, SnomedComponentType.DESCRIPTION, descriptionId).statusCode(404);
merge(a, b, "Merged new description from unrelated branch").body("status", equalTo(Merge.Status.COMPLETED.name()));
getComponent(a, SnomedComponentType.DESCRIPTION, descriptionId).statusCode(200);
getComponent(b, SnomedComponentType.DESCRIPTION, descriptionId).statusCode(200);
}
use of com.b2international.snowowl.core.api.IBranchPath in project snow-owl by b2ihealthcare.
the class SnomedMergeApiTest method rebaseNewConceptStale.
@Test
public void rebaseNewConceptStale() {
final IBranchPath a = BranchPathUtils.createPath(branchPath, "a");
branching.createBranch(a).statusCode(201);
final IBranchPath b = BranchPathUtils.createPath(a, "b");
branching.createBranch(b).statusCode(201);
final String concept1Id = createNewConcept(b);
final String concept2Id = createNewConcept(a);
final String concept3Id = createNewConcept(branchPath);
merge(branchPath, a, "Rebased new concept on child over new concept on parent").body("status", equalTo(Merge.Status.COMPLETED.name()));
// "a" now knows about concept 3
getComponent(branchPath, SnomedComponentType.CONCEPT, concept3Id).statusCode(200);
getComponent(a, SnomedComponentType.CONCEPT, concept3Id).statusCode(200);
// "b" is now in STALE state, and doesn't know about either concept 2 or 3
getComponent(b, SnomedComponentType.CONCEPT, concept3Id).statusCode(404);
getComponent(b, SnomedComponentType.CONCEPT, concept2Id).statusCode(404);
merge(a, b, "Rebased new concept on nested child over new concepts on child").body("status", equalTo(Merge.Status.COMPLETED.name()));
// Now "b" should see all three concepts
getComponent(b, SnomedComponentType.CONCEPT, concept3Id).statusCode(200);
getComponent(b, SnomedComponentType.CONCEPT, concept2Id).statusCode(200);
getComponent(b, SnomedComponentType.CONCEPT, concept1Id).statusCode(200);
}
use of com.b2international.snowowl.core.api.IBranchPath in project snow-owl by b2ihealthcare.
the class SnomedMergeApiTest method rebaseAndMergeChangedOnParentDeletedOnBranch.
@Test
public void rebaseAndMergeChangedOnParentDeletedOnBranch() {
final String conceptId = createNewConcept(branchPath);
final IBranchPath a = BranchPathUtils.createPath(branchPath, "a");
branching.createBranch(a).statusCode(201);
rebaseConceptDeletionOverChange(branchPath, a, conceptId);
merge(a, branchPath, "Merged concept deletion").body("status", equalTo(Merge.Status.COMPLETED.name()));
// Concept should now be deleted everywhere
getComponent(branchPath, SnomedComponentType.CONCEPT, conceptId).statusCode(404);
getComponent(a, SnomedComponentType.CONCEPT, conceptId).statusCode(404);
}
use of com.b2international.snowowl.core.api.IBranchPath in project snow-owl by b2ihealthcare.
the class SnomedMergeApiTest method mergeThenRebaseOtherTask.
@Test
public void mergeThenRebaseOtherTask() throws Exception {
final String conceptA = createNewConcept(branchPath);
final IBranchPath a = BranchPathUtils.createPath(branchPath, "a");
final IBranchPath b = BranchPathUtils.createPath(branchPath, "b");
branching.createBranch(a).statusCode(201);
branching.createBranch(b).statusCode(201);
Map<?, ?> inactivationRequest = ImmutableMap.builder().put("active", false).put("inactivationProperties", new InactivationProperties(Concepts.DUPLICATE, List.of(new AssociationTarget(Concepts.REFSET_SAME_AS_ASSOCIATION, Concepts.FULLY_SPECIFIED_NAME)))).put("commitComment", "Inactivated concept").build();
updateComponent(a, SnomedComponentType.CONCEPT, conceptA, inactivationRequest).statusCode(204);
final String conceptB = createNewConcept(b);
merge(a, branchPath, "Merge branch A").body("status", equalTo(Merge.Status.COMPLETED.name()));
SnomedConcept conceptAOnParent = getComponent(branchPath, SnomedComponentType.CONCEPT, conceptA, "members(),relationships()").statusCode(200).extract().as(SnomedConcept.class);
assertThat(conceptAOnParent.getRelationships()).hasSize(1);
assertThat(conceptAOnParent.getMembers()).hasSize(2);
merge(branchPath, b, "Rebase branch B").body("status", equalTo(Merge.Status.COMPLETED.name()));
SnomedConcept conceptAOnBranchB = getComponent(b, SnomedComponentType.CONCEPT, conceptA, "members(),relationships()").statusCode(200).extract().as(SnomedConcept.class);
assertThat(conceptAOnBranchB.getRelationships()).hasSize(1);
assertThat(conceptAOnBranchB.getMembers()).hasSize(2);
getComponent(b, SnomedComponentType.CONCEPT, conceptB, "relationships()").statusCode(200).extract().as(SnomedConcept.class);
}
use of com.b2international.snowowl.core.api.IBranchPath in project snow-owl by b2ihealthcare.
the class SnomedMergeApiTest method rebaseStaleBranchWithDeleteOnChangedContent.
@Test
public void rebaseStaleBranchWithDeleteOnChangedContent() 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);
// Make changes on branch "a"
changeCaseSignificance(a, descriptionId);
changeRelationshipGroup(a, relationshipId);
// Delete description on branch "b"
deleteComponent(b, SnomedComponentType.DESCRIPTION, descriptionId, false).statusCode(204);
getComponent(b, SnomedComponentType.DESCRIPTION, descriptionId).statusCode(404);
// Make change on "branchPath" so "a" can be rebased
createNewRelationship(branchPath);
merge(branchPath, a, "Rebased changed components 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 description should be deleted
merge(a, b, "Rebased description deletion over changed components").body("status", equalTo(Merge.Status.COMPLETED.name()));
// Verify that the relationship has the modified values, and the description stayed deleted
getComponent(b, SnomedComponentType.DESCRIPTION, descriptionId).statusCode(404);
getComponent(b, SnomedComponentType.RELATIONSHIP, relationshipId).statusCode(200).body("relationshipGroup", equalTo(99));
}
Aggregations