use of com.b2international.snowowl.core.api.IBranchPath in project snow-owl by b2ihealthcare.
the class SnomedMergeApiTest method rebaseUnsetEffectiveTimeOnSource.
@Test
public void rebaseUnsetEffectiveTimeOnSource() {
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);
version = version.plus(1, ChronoUnit.DAYS);
// Parent increases the effective time by one day
updateRefSetMemberEffectiveTime(branchPath, memberId, version);
final Map<?, ?> childRequest = ImmutableMap.builder().put("active", false).put("commitComment", "Inactivated reference set member").build();
// Child unsets it and inactivates the member
updateRefSetComponent(a, SnomedComponentType.MEMBER, memberId, childRequest, false).statusCode(204);
merge(branchPath, a, "Rebased update over effective time change").body("status", equalTo(Merge.Status.COMPLETED.name()));
getComponent(branchPath, SnomedComponentType.MEMBER, memberId).statusCode(200).body("released", equalTo(true)).body("effectiveTime", equalTo(EffectiveTimes.format(version, DateFormats.SHORT))).body("active", equalTo(true));
getComponent(a, SnomedComponentType.MEMBER, memberId).statusCode(200).body("released", equalTo(true)).body("effectiveTime", nullValue()).body("active", equalTo(false));
}
use of com.b2international.snowowl.core.api.IBranchPath in project snow-owl by b2ihealthcare.
the class SnomedMergeApiTest method mergeNewConceptToUnrelatedBranch.
// @Test
// public void noMergeNewConceptDiverged() {
// final IBranchPath a = BranchPathUtils.createPath(branchPath, "a");
// branching.createBranch(a).statusCode(201);
//
// final String concept1Id = createNewConcept(a);
// final String concept2Id = createNewConcept(branchPath);
//
// getComponent(branchPath, SnomedComponentType.CONCEPT, concept1Id).statusCode(404);
// getComponent(a, SnomedComponentType.CONCEPT, concept1Id).statusCode(200);
//
// getComponent(branchPath, SnomedComponentType.CONCEPT, concept2Id).statusCode(200);
// getComponent(a, SnomedComponentType.CONCEPT, concept2Id).statusCode(404);
//
// merge(a, branchPath, "Merged new concept from diverged branch").body("status", equalTo(Merge.Status.COMPLETED.name()));
//
// getComponent(branchPath, SnomedComponentType.CONCEPT, concept1Id).statusCode(404);
// getComponent(a, SnomedComponentType.CONCEPT, concept1Id).statusCode(200);
//
// getComponent(branchPath, SnomedComponentType.CONCEPT, concept2Id).statusCode(200);
// getComponent(a, SnomedComponentType.CONCEPT, concept2Id).statusCode(404);
// }
// @Test
// public void noMergeNewDescriptionDiverged() {
// IBranchPath a = BranchPathUtils.createPath(branchPath, "a");
// branching.createBranch(a).statusCode(201);
//
// String description1Id = createNewDescription(a);
// String description2Id = createNewDescription(branchPath);
//
// getComponent(branchPath, SnomedComponentType.DESCRIPTION, description1Id).statusCode(404);
// getComponent(a, SnomedComponentType.DESCRIPTION, description1Id).statusCode(200);
//
// getComponent(branchPath, SnomedComponentType.DESCRIPTION, description2Id).statusCode(200);
// getComponent(a, SnomedComponentType.DESCRIPTION, description2Id).statusCode(404);
//
// merge(a, branchPath, "Merged new description from diverged branch").body("status", equalTo(Merge.Status.FAILED.name()));
//
// getComponent(branchPath, SnomedComponentType.DESCRIPTION, description1Id).statusCode(404);
// getComponent(a, SnomedComponentType.DESCRIPTION, description1Id).statusCode(200);
//
// getComponent(branchPath, SnomedComponentType.DESCRIPTION, description2Id).statusCode(200);
// getComponent(a, SnomedComponentType.DESCRIPTION, description2Id).statusCode(404);
// }
// @Test
// public void noMergeNewRelationshipDiverged() {
// IBranchPath a = BranchPathUtils.createPath(branchPath, "a");
// branching.createBranch(a).statusCode(201);
//
// String relationship1Id = createNewRelationship(a);
// String relationship2Id = createNewRelationship(branchPath);
//
// getComponent(branchPath, SnomedComponentType.RELATIONSHIP, relationship1Id).statusCode(404);
// getComponent(a, SnomedComponentType.RELATIONSHIP, relationship1Id).statusCode(200);
//
// getComponent(branchPath, SnomedComponentType.RELATIONSHIP, relationship2Id).statusCode(200);
// getComponent(a, SnomedComponentType.RELATIONSHIP, relationship2Id).statusCode(404);
//
// merge(a, branchPath, "Merged new relationship from diverged branch").body("status", equalTo(Merge.Status.COMPLETED.name()));
//
// getComponent(branchPath, SnomedComponentType.RELATIONSHIP, relationship1Id).statusCode(404);
// getComponent(a, SnomedComponentType.RELATIONSHIP, relationship1Id).statusCode(200);
//
// getComponent(branchPath, SnomedComponentType.RELATIONSHIP, relationship2Id).statusCode(200);
// getComponent(a, SnomedComponentType.RELATIONSHIP, relationship2Id).statusCode(404);
// }
@Test
public void mergeNewConceptToUnrelatedBranch() {
final IBranchPath v1 = BranchPathUtils.createPath(branchPath, "v1");
branching.createBranch(v1).statusCode(201);
// Concept 1 is created on the two branches' common ancestor
final String concept1Id = createNewConcept(branchPath);
final IBranchPath v2 = BranchPathUtils.createPath(branchPath, "v2");
branching.createBranch(v2).statusCode(201);
final IBranchPath a = BranchPathUtils.createPath(v1, "extension-old");
branching.createBranch(a).statusCode(201);
final IBranchPath b = BranchPathUtils.createPath(v2, "extension-new");
branching.createBranch(b).statusCode(201);
// Concept 2 is initially only visible on branch "extension-old"
final String concept2Id = createNewConcept(a);
getComponent(a, SnomedComponentType.CONCEPT, concept2Id).statusCode(200);
getComponent(branchPath, SnomedComponentType.CONCEPT, concept1Id).statusCode(200);
getComponent(a, SnomedComponentType.CONCEPT, concept1Id).statusCode(404);
getComponent(b, SnomedComponentType.CONCEPT, concept1Id).statusCode(200);
merge(a, b, "Merged new concept from unrelated branch").body("status", equalTo(Merge.Status.COMPLETED.name()));
getComponent(b, SnomedComponentType.CONCEPT, concept1Id).statusCode(200);
getComponent(b, SnomedComponentType.CONCEPT, concept2Id).statusCode(200);
}
use of com.b2international.snowowl.core.api.IBranchPath in project snow-owl by b2ihealthcare.
the class SnomedMergeApiTest method rebaseMultipleChangesFromParent.
@Test
public void rebaseMultipleChangesFromParent() throws Exception {
final String concept = createNewConcept(branchPath);
final IBranchPath task = BranchPathUtils.createPath(branchPath, "task1");
branching.createBranch(task).statusCode(201);
String newParentDescription1 = createNewDescription(branchPath, concept, Concepts.SYNONYM, SnomedApiTestConstants.UK_PREFERRED_MAP);
String newChildDescription1 = createNewDescription(task, concept, Concepts.SYNONYM, SnomedApiTestConstants.UK_PREFERRED_MAP);
merge(branchPath, task, "Synchronize task").body("status", equalTo(Merge.Status.COMPLETED.name()));
getComponent(task, SnomedComponentType.CONCEPT, concept).statusCode(200);
getComponent(task, SnomedComponentType.DESCRIPTION, newParentDescription1).statusCode(200);
getComponent(task, SnomedComponentType.DESCRIPTION, newChildDescription1).statusCode(200);
String newParentDescription2 = createNewDescription(branchPath, concept, Concepts.SYNONYM, SnomedApiTestConstants.UK_PREFERRED_MAP);
String newChildDescription2 = createNewDescription(task, concept, Concepts.SYNONYM, SnomedApiTestConstants.UK_PREFERRED_MAP);
merge(branchPath, task, "Synchronize task").body("status", equalTo(Merge.Status.COMPLETED.name()));
getComponent(task, SnomedComponentType.CONCEPT, concept).statusCode(200);
getComponent(task, SnomedComponentType.DESCRIPTION, newParentDescription2).statusCode(200);
getComponent(task, SnomedComponentType.DESCRIPTION, newChildDescription2).statusCode(200);
String newParentDescription3 = createNewDescription(branchPath, concept, Concepts.SYNONYM, SnomedApiTestConstants.UK_PREFERRED_MAP);
String newChildDescription3 = createNewDescription(task, concept, Concepts.SYNONYM, SnomedApiTestConstants.UK_PREFERRED_MAP);
merge(branchPath, task, "Synchronize task").body("status", equalTo(Merge.Status.COMPLETED.name()));
getComponent(task, SnomedComponentType.CONCEPT, concept).statusCode(200);
getComponent(task, SnomedComponentType.DESCRIPTION, newParentDescription3).statusCode(200);
getComponent(task, SnomedComponentType.DESCRIPTION, newChildDescription3).statusCode(200);
SnomedConcept finalConcept = getComponent(task, SnomedComponentType.CONCEPT, concept, "descriptions(),preferredDescriptions()").statusCode(200).extract().as(SnomedConcept.class);
// 2 default + 6 newly added
assertThat(finalConcept.getDescriptions()).hasSize(8);
assertThat(finalConcept.getPreferredDescriptions()).hasSize(8);
}
use of com.b2international.snowowl.core.api.IBranchPath in project snow-owl by b2ihealthcare.
the class SnomedMergeApiTest method rebaseAndMergeChangedDescription.
@Test
public void rebaseAndMergeChangedDescription() {
final String description1Id = createNewDescription(branchPath);
final IBranchPath a = BranchPathUtils.createPath(branchPath, "a");
branching.createBranch(a).statusCode(201);
final String description2Id = createNewDescription(branchPath);
final Map<?, ?> requestBody = ImmutableMap.builder().put("caseSignificanceId", Concepts.ENTIRE_TERM_CASE_INSENSITIVE).put("moduleId", Concepts.MODULE_ROOT).put("commitComment", "Changed case significance and module on child").build();
updateComponent(a, SnomedComponentType.DESCRIPTION, description1Id, requestBody);
merge(branchPath, a, "Rebased description change over new description creation").body("status", equalTo(Merge.Status.COMPLETED.name()));
// Description 2 is now visible on both parent and child
getComponent(branchPath, SnomedComponentType.DESCRIPTION, description2Id).statusCode(200);
getComponent(a, SnomedComponentType.DESCRIPTION, description2Id).statusCode(200);
// Description 1 retains the changes on child, keeps the original values on parent
getComponent(branchPath, SnomedComponentType.DESCRIPTION, description1Id).statusCode(200).body("caseSignificanceId", equalTo(Concepts.ONLY_INITIAL_CHARACTER_CASE_INSENSITIVE)).body("moduleId", equalTo(Concepts.MODULE_SCT_CORE));
getComponent(a, SnomedComponentType.DESCRIPTION, description1Id).statusCode(200).body("caseSignificanceId", equalTo(Concepts.ENTIRE_TERM_CASE_INSENSITIVE)).body("moduleId", equalTo(Concepts.MODULE_ROOT));
merge(a, branchPath, "Merged description change to parent").body("status", equalTo(Merge.Status.COMPLETED.name()));
getComponent(branchPath, SnomedComponentType.DESCRIPTION, description2Id).statusCode(200);
getComponent(a, SnomedComponentType.DESCRIPTION, description2Id).statusCode(200);
// Description 1 changes are visible everywhere
getComponent(branchPath, SnomedComponentType.DESCRIPTION, description1Id).statusCode(200).body("caseSignificanceId", equalTo(Concepts.ENTIRE_TERM_CASE_INSENSITIVE)).body("moduleId", equalTo(Concepts.MODULE_ROOT));
getComponent(a, SnomedComponentType.DESCRIPTION, description1Id).statusCode(200).body("caseSignificanceId", equalTo(Concepts.ENTIRE_TERM_CASE_INSENSITIVE)).body("moduleId", equalTo(Concepts.MODULE_ROOT));
}
use of com.b2international.snowowl.core.api.IBranchPath in project snow-owl by b2ihealthcare.
the class SnomedMergeApiTest method rebaseNewDescriptionDiverged.
@Test
public void rebaseNewDescriptionDiverged() {
final IBranchPath a = BranchPathUtils.createPath(branchPath, "a");
branching.createBranch(a).statusCode(201);
final String description1Id = createNewDescription(branchPath);
final String description2Id = createNewDescription(a);
getComponent(branchPath, SnomedComponentType.DESCRIPTION, description1Id).statusCode(200);
getComponent(a, SnomedComponentType.DESCRIPTION, description1Id).statusCode(404);
getComponent(branchPath, SnomedComponentType.DESCRIPTION, description2Id).statusCode(404);
getComponent(a, SnomedComponentType.DESCRIPTION, description2Id).statusCode(200);
merge(branchPath, a, "Rebased new description").body("status", equalTo(Merge.Status.COMPLETED.name()));
// Description 1 from the parent becomes visible on the child after rebasing
getComponent(branchPath, SnomedComponentType.DESCRIPTION, description1Id).statusCode(200);
getComponent(a, SnomedComponentType.DESCRIPTION, description1Id).statusCode(200);
// Description 2 should still not be present on the parent, however
getComponent(branchPath, SnomedComponentType.DESCRIPTION, description2Id).statusCode(404);
getComponent(a, SnomedComponentType.DESCRIPTION, description2Id).statusCode(200);
}
Aggregations