Search in sources :

Example 11 with ComponentIdentifier

use of com.b2international.snowowl.core.ComponentIdentifier in project snow-owl by b2ihealthcare.

the class ValidationWhiteListApiTest method filterByComponentIdentifier.

@Test
public void filterByComponentIdentifier() throws Exception {
    final ComponentIdentifier componentIdentifier = ComponentIdentifier.of("concept", "12345678");
    createWhiteLists("5", COMPONENT_ID);
    createWhiteLists("6", componentIdentifier);
    final ValidationWhiteLists whiteLists = ValidationRequests.whiteList().prepareSearch().filterByComponentIdentifier(componentIdentifier.getComponentId()).filterByComponentType(componentIdentifier.getComponentType()).buildAsync().getRequest().execute(context);
    assertThat(whiteLists).hasSize(1);
    assertThat(whiteLists.first().get().getComponentIdentifier().getComponentId()).isEqualTo(componentIdentifier.getComponentId());
}
Also used : ValidationWhiteLists(com.b2international.snowowl.core.validation.whitelist.ValidationWhiteLists) ComponentIdentifier(com.b2international.snowowl.core.ComponentIdentifier) Test(org.junit.Test)

Example 12 with ComponentIdentifier

use of com.b2international.snowowl.core.ComponentIdentifier 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 13 with ComponentIdentifier

use of com.b2international.snowowl.core.ComponentIdentifier 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

ComponentIdentifier (com.b2international.snowowl.core.ComponentIdentifier)13 BranchCompareResult (com.b2international.snowowl.core.branch.compare.BranchCompareResult)6 Test (org.junit.Test)6 ValidationIssue (com.b2international.snowowl.core.validation.issue.ValidationIssue)2 ValidationWhiteListSearchRequestBuilder (com.b2international.snowowl.core.validation.whitelist.ValidationWhiteListSearchRequestBuilder)2 SnomedConcept (com.b2international.snowowl.snomed.core.domain.SnomedConcept)2 SnomedDescription (com.b2international.snowowl.snomed.core.domain.SnomedDescription)2 SnomedRelationship (com.b2international.snowowl.snomed.core.domain.SnomedRelationship)2 SnomedReferenceSetMember (com.b2international.snowowl.snomed.core.domain.refset.SnomedReferenceSetMember)2 CompareUtils (com.b2international.commons.CompareUtils)1 Writer (com.b2international.index.Writer)1 ExpressionBuilder (com.b2international.index.query.Expressions.ExpressionBuilder)1 ObjectId (com.b2international.index.revision.ObjectId)1 RevisionCompare (com.b2international.index.revision.RevisionCompare)1 RevisionCompareDetail (com.b2international.index.revision.RevisionCompareDetail)1 RevisionIndex (com.b2international.index.revision.RevisionIndex)1 ResourceURI (com.b2international.snowowl.core.ResourceURI)1 TerminologyResource (com.b2international.snowowl.core.TerminologyResource)1 IBranchPath (com.b2international.snowowl.core.api.IBranchPath)1 SnowowlRuntimeException (com.b2international.snowowl.core.api.SnowowlRuntimeException)1