Search in sources :

Example 6 with BranchCompareResult

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

the class BranchCompareRequestTest method compareBranchWithNewComponentOnExistingComponent.

@Test
public void compareBranchWithNewComponentOnExistingComponent() throws Exception {
    final Set<ComponentIdentifier> componentsOnParentBranch = prepareBranchWithNewChanges(branchPath);
    final String taskBranchPath = createBranch(branchPath, "taskBranch");
    final ComponentIdentifier concept = componentsOnParentBranch.stream().filter(ci -> ci.getComponentType() == SnomedConcept.TYPE).findFirst().get();
    final String newDescriptionId = SnomedRequests.prepareNewDescription().setIdFromNamespace(null).setConceptId(concept.getComponentId()).setTerm("New Description").setModuleId(Concepts.MODULE_SCT_CORE).setLanguageCode("en").setTypeId(Concepts.FULLY_SPECIFIED_NAME).build(taskBranchPath, RestExtensions.USER, "Create new Description on Concept: " + concept.getComponentId()).execute(bus).getSync(1, TimeUnit.MINUTES).getResultAs(String.class);
    final ComponentIdentifier newDescription = ComponentIdentifier.of(SnomedDescription.TYPE, newDescriptionId);
    final BranchCompareResult compareResult = compare(branchPath, taskBranchPath);
    assertThat(compareResult.getNewComponents()).containsOnly(newDescription);
    assertThat(compareResult.getChangedComponents()).containsOnly(concept);
    assertThat(compareResult.getDeletedComponents()).isEmpty();
}
Also used : BranchCompareResult(com.b2international.snowowl.core.branch.compare.BranchCompareResult) ComponentIdentifier(com.b2international.snowowl.core.ComponentIdentifier) Test(org.junit.Test)

Example 7 with BranchCompareResult

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

the class BranchCompareRequestTest method compareBranchWithNewComponents.

@Test
public void compareBranchWithNewComponents() throws Exception {
    final Set<ComponentIdentifier> newIds = prepareBranchWithNewChanges(branchPath);
    final BranchCompareResult compare = compare(null, branchPath);
    assertThat(compare.getNewComponents()).containsAll(newIds);
    assertThat(compare.getChangedComponents()).doesNotContainAnyElementsOf(newIds);
    assertThat(compare.getDeletedComponents()).isEmpty();
}
Also used : BranchCompareResult(com.b2international.snowowl.core.branch.compare.BranchCompareResult) ComponentIdentifier(com.b2international.snowowl.core.ComponentIdentifier) Test(org.junit.Test)

Example 8 with BranchCompareResult

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

the class BranchCompareRequestTest method remoteJobSupportEmptyCompare.

@Test
public void remoteJobSupportEmptyCompare() throws Exception {
    final BranchCompareResult compareResult = compareOnJob(Branch.MAIN_PATH, branchPath);
    assertThat(compareResult.getCompareBranch()).isEqualTo(branchPath);
    assertThat(compareResult.getBaseBranch()).isEqualTo(Branch.MAIN_PATH);
    assertThat(compareResult.getNewComponents()).isEmpty();
    assertThat(compareResult.getChangedComponents()).isEmpty();
    assertThat(compareResult.getDeletedComponents()).isEmpty();
}
Also used : BranchCompareResult(com.b2international.snowowl.core.branch.compare.BranchCompareResult) Test(org.junit.Test)

Example 9 with BranchCompareResult

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

the class BranchCompareRequestTest method remoteJobSupportCompareWithContent.

@Test
public void remoteJobSupportCompareWithContent() throws Exception {
    final Set<ComponentIdentifier> newIds = prepareBranchWithNewChanges(branchPath);
    final BranchCompareResult compare = compareOnJob(null, branchPath);
    assertThat(compare.getNewComponents()).containsAll(newIds);
    assertThat(compare.getChangedComponents()).doesNotContainAnyElementsOf(newIds);
    assertThat(compare.getDeletedComponents()).isEmpty();
}
Also used : BranchCompareResult(com.b2international.snowowl.core.branch.compare.BranchCompareResult) ComponentIdentifier(com.b2international.snowowl.core.ComponentIdentifier) Test(org.junit.Test)

Example 10 with BranchCompareResult

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

the class BranchCompareRequestTest method compareEmptyBranchWithoutBase.

@Test
public void compareEmptyBranchWithoutBase() throws Exception {
    final BranchCompareResult compareResult = compare(null, branchPath);
    assertThat(compareResult.getCompareBranch()).isEqualTo(branchPath);
    assertThat(compareResult.getBaseBranch()).isEqualTo(Branch.MAIN_PATH);
    assertThat(compareResult.getNewComponents()).isEmpty();
    assertThat(compareResult.getChangedComponents()).isEmpty();
    assertThat(compareResult.getDeletedComponents()).isEmpty();
}
Also used : BranchCompareResult(com.b2international.snowowl.core.branch.compare.BranchCompareResult) 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