use of com.b2international.snowowl.core.api.IBranchPath in project snow-owl by b2ihealthcare.
the class SnomedMergeApiTest method rebaseReactivatedConcept.
@Test
public void rebaseReactivatedConcept() {
final String concept1Id = createInactiveConcept(branchPath);
final IBranchPath a = BranchPathUtils.createPath(branchPath, "a");
branching.createBranch(a).statusCode(201);
reactivateConcept(a, concept1Id);
// Create concept 2 on "branchPath" so that "a" can be rebased
final String concept2Id = createNewConcept(branchPath);
merge(branchPath, a, "Rebased reactivation on child branch").body("status", equalTo(Merge.Status.COMPLETED.name()));
// Concept 1 should be active on "a", but still inactive on "branchPath"
getComponent(branchPath, SnomedComponentType.CONCEPT, concept1Id, "descriptions()", "relationships()").statusCode(200).body("active", equalTo(false)).body("descriptions.items[0].active", equalTo(true)).body("descriptions.items[1].active", equalTo(true)).body("relationships.items[0].active", equalTo(false));
getComponent(a, SnomedComponentType.CONCEPT, concept1Id, "descriptions()", "relationships()").statusCode(200).body("active", equalTo(true)).body("descriptions.items[0].active", equalTo(true)).body("descriptions.items[1].active", equalTo(true)).body("relationships.items[0].active", equalTo(true));
// Concept 2 should be visible everywhere
getComponent(branchPath, SnomedComponentType.CONCEPT, concept2Id).statusCode(200);
getComponent(a, SnomedComponentType.CONCEPT, concept2Id).statusCode(200);
}
use of com.b2international.snowowl.core.api.IBranchPath in project snow-owl by b2ihealthcare.
the class SnomedMergeApiTest method rebaseAndMergeNewDescriptionBothDeleted.
@Test
public void rebaseAndMergeNewDescriptionBothDeleted() {
final String description1Id = createNewDescription(branchPath);
final IBranchPath a = BranchPathUtils.createPath(branchPath, "a");
branching.createBranch(a).statusCode(201);
final String description2Id = createNewDescription(branchPath);
deleteComponent(branchPath, SnomedComponentType.DESCRIPTION, description1Id, false).statusCode(204);
deleteComponent(a, SnomedComponentType.DESCRIPTION, description1Id, false).statusCode(204);
/*
* The rebase sees that the same thing has already happened on the parent branch, and does not
* add an empty commit to the new instance of the child; it will be in UP_TO_DATE state and can
* not be promoted.
*/
merge(branchPath, a, "Rebased description dual deletion over description creation").body("status", equalTo(Merge.Status.COMPLETED.name()));
merge(a, branchPath, "Merged description dual deletion").body("status", equalTo(Merge.Status.COMPLETED.name()));
// Description 1 is now deleted on both branches
getComponent(branchPath, SnomedComponentType.DESCRIPTION, description1Id).statusCode(404);
getComponent(a, SnomedComponentType.DESCRIPTION, description1Id).statusCode(404);
// Description 2 should be present, however
getComponent(branchPath, SnomedComponentType.DESCRIPTION, description2Id).statusCode(200);
getComponent(a, SnomedComponentType.DESCRIPTION, description2Id).statusCode(200);
}
use of com.b2international.snowowl.core.api.IBranchPath in project snow-owl by b2ihealthcare.
the class SnomedMergeApiTest method mergeReactivatedConcept.
@Test
public void mergeReactivatedConcept() {
final String conceptId = createInactiveConcept(branchPath);
final IBranchPath a = BranchPathUtils.createPath(branchPath, "a");
branching.createBranch(a).statusCode(201);
reactivateConcept(a, conceptId);
merge(a, branchPath, "Merged reactivation from child branch").body("status", equalTo(Merge.Status.COMPLETED.name()));
getComponent(branchPath, SnomedComponentType.CONCEPT, conceptId, "descriptions()", "relationships()").statusCode(200).body("active", equalTo(true)).body("descriptions.items[0].active", equalTo(true)).body("descriptions.items[1].active", equalTo(true)).body("relationships.items[0].active", equalTo(true));
}
use of com.b2international.snowowl.core.api.IBranchPath in project snow-owl by b2ihealthcare.
the class SnomedMergeApiTest method rebaseChangedConceptOnBranchDeletedOnParent.
@Test
@Ignore("Currently always fails due to merge policy")
public void rebaseChangedConceptOnBranchDeletedOnParent() {
final String conceptId = createNewConcept(branchPath);
final IBranchPath a = BranchPathUtils.createPath(branchPath, "a");
branching.createBranch(a).statusCode(201);
final Map<?, ?> requestBody = ImmutableMap.builder().put("definitionStatusId", Concepts.FULLY_DEFINED).put("commitComment", "Changed definition status on child").build();
updateComponent(a, SnomedComponentType.CONCEPT, conceptId, requestBody).statusCode(204);
deleteComponent(branchPath, SnomedComponentType.CONCEPT, conceptId, false).statusCode(204);
merge(branchPath, a, "Rebased concept change over deletion").body("status", equalTo(Merge.Status.COMPLETED.name()));
}
use of com.b2international.snowowl.core.api.IBranchPath in project snow-owl by b2ihealthcare.
the class SnomedMergeApiTest method rebaseConceptDeletionOverNewOutAndInboundRelationships.
@Test
public void rebaseConceptDeletionOverNewOutAndInboundRelationships() throws Exception {
// new concept on test branch
final String deletedConcept = createNewConcept(branchPath);
// new child branch of test parent branch
final IBranchPath a = BranchPathUtils.createPath(branchPath, "a");
branching.createBranch(a).statusCode(201);
// create a new relationship to newly created destination concept on parent branch
final String newInboundRelationshipToDeletedConcept = createNewRelationship(branchPath, Concepts.ROOT_CONCEPT, Concepts.FINDING_SITE, deletedConcept, Concepts.INFERRED_RELATIONSHIP);
final String newOutboundRelationshipFromDeletedConcept = createNewRelationship(branchPath, deletedConcept, Concepts.FINDING_SITE, Concepts.ROOT_CONCEPT, Concepts.INFERRED_RELATIONSHIP);
// delete destination concept on child branch
deleteComponent(a, SnomedComponentType.CONCEPT, deletedConcept, false);
// rebase child branch with deletion over new relationship, this should succeed, but should also implicitly delete the relationship
merge(branchPath, a, "Rebased concept deletion over new outbound and inbound relationships").body("status", equalTo(Merge.Status.CONFLICTS.name()));
// relationships should be deleted along with the already deleted destination concept
getComponent(a, SnomedComponentType.RELATIONSHIP, newOutboundRelationshipFromDeletedConcept).statusCode(404);
getComponent(a, SnomedComponentType.RELATIONSHIP, newInboundRelationshipToDeletedConcept).statusCode(404);
}
Aggregations