Search in sources :

Example 11 with BranchCompareResult

use of com.b2international.snowowl.core.branch.compare.BranchCompareResult in project snow-owl by b2ihealthcare.

the class SnomedCompareRestRequestTest method testCompareWithDeletedComponents.

@Test
public void testCompareWithDeletedComponents() throws Exception {
    final String newConceptId = createNewConcept(parentBranch);
    final String parentBranchPath = parentBranch.toString();
    final String childBranchPath = createBranch(parentBranchPath, "SNOMEDCT-DELETED");
    final Set<ComponentIdentifier> newIds = prepareNewChanges(newConceptId, parentBranch);
    final ComponentIdentifier concept = newIds.stream().filter(ci -> ci.getComponentType() == SnomedConcept.TYPE).findFirst().get();
    SnomedRequests.prepareDeleteConcept(concept.getComponentId()).build(childBranchPath, RestExtensions.USER, "Delete concept on child branch").execute(bus).getSync();
    final BranchCompareResult compareResult = getCompareResult(parentBranchPath, childBranchPath);
    // compare task branch and its parent
    assertThat(compareResult.getNewComponents()).isEmpty();
    assertThat(compareResult.getChangedComponents()).isEmpty();
    assertThat(compareResult.getDeletedComponents()).containsAll(newIds);
}
Also used : BranchCompareResult(com.b2international.snowowl.core.branch.compare.BranchCompareResult) ComponentIdentifier(com.b2international.snowowl.core.ComponentIdentifier) Test(org.junit.Test)

Example 12 with BranchCompareResult

use of com.b2international.snowowl.core.branch.compare.BranchCompareResult in project snow-owl by b2ihealthcare.

the class SnomedCompareRestRequestTest method testCompareWithChangedNewComponents.

@Test
public void testCompareWithChangedNewComponents() throws IOException {
    final String newConceptId = createNewConcept(branchPath);
    final BranchCompareResult compareResult = getCompareResult(parentBranch.getPath(), branchPath.getPath());
    final Set<ComponentIdentifier> newIds = prepareNewChanges(newConceptId, branchPath);
    assertThat(compareResult.getNewComponents()).containsAll(newIds);
    assertThat(compareResult.getChangedComponents()).doesNotContainAnyElementsOf(newIds);
    assertThat(compareResult.getDeletedComponents()).isEmpty();
}
Also used : BranchCompareResult(com.b2international.snowowl.core.branch.compare.BranchCompareResult) ComponentIdentifier(com.b2international.snowowl.core.ComponentIdentifier) Test(org.junit.Test)

Aggregations

BranchCompareResult (com.b2international.snowowl.core.branch.compare.BranchCompareResult)12 Test (org.junit.Test)12 ComponentIdentifier (com.b2international.snowowl.core.ComponentIdentifier)6 SnomedConcept (com.b2international.snowowl.snomed.core.domain.SnomedConcept)2 IBranchPath (com.b2international.snowowl.core.api.IBranchPath)1