Search in sources :

Example 41 with ValidationIssues

use of com.b2international.snowowl.core.validation.issue.ValidationIssues in project snow-owl by b2ihealthcare.

the class SnomedValidationIssueDetailTest method filterByModuleId.

@Test
public void filterByModuleId() {
    final Map<String, Object> details = ImmutableMap.of(SnomedIssueDetailFilterFields.COMPONENT_MODULE_ID, "1010101010101010");
    final ValidationIssue issueWithDetails = createIssue("1122334455", details);
    final ValidationIssue issueWithoutDetails = createIssue("5544332211", Collections.emptyMap());
    save(issueWithDetails);
    save(issueWithoutDetails);
    ValidationIssues issues = ValidationRequests.issues().prepareSearch().all().filterByDetails(details).buildAsync().getRequest().execute(context);
    assertComponents(issues, issueWithDetails.getAffectedComponent());
}
Also used : ValidationIssues(com.b2international.snowowl.core.validation.issue.ValidationIssues) ValidationIssue(com.b2international.snowowl.core.validation.issue.ValidationIssue) Test(org.junit.Test) BaseRevisionIndexTest(com.b2international.index.revision.BaseRevisionIndexTest)

Example 42 with ValidationIssues

use of com.b2international.snowowl.core.validation.issue.ValidationIssues in project snow-owl by b2ihealthcare.

the class SnomedValidationIssueDetailTest method filterByModuleIds.

@Test
public void filterByModuleIds() {
    final Map<String, Object> details = ImmutableMap.of(SnomedIssueDetailFilterFields.COMPONENT_MODULE_ID, newArrayList("1111"));
    final Map<String, Object> details2 = ImmutableMap.of(SnomedIssueDetailFilterFields.COMPONENT_MODULE_ID, "2222");
    final ValidationIssue issueWithModuleId = createIssue("111111111", details);
    final ValidationIssue issueWithModuleId2 = createIssue("222222222", details2);
    final ValidationIssue issueWithoutModuleId = createIssue("333333333", Collections.emptyMap());
    save(issueWithModuleId);
    save(issueWithModuleId2);
    save(issueWithoutModuleId);
    final Map<String, Object> detailsToSearch = ImmutableMap.of(SnomedIssueDetailFilterFields.COMPONENT_MODULE_ID, newArrayList("1111", "2222"));
    ValidationIssues issues = ValidationRequests.issues().prepareSearch().all().filterByDetails(detailsToSearch).buildAsync().getRequest().execute(context);
    assertComponents(issues, issueWithModuleId.getAffectedComponent(), issueWithModuleId2.getAffectedComponent());
}
Also used : ValidationIssues(com.b2international.snowowl.core.validation.issue.ValidationIssues) ValidationIssue(com.b2international.snowowl.core.validation.issue.ValidationIssue) Test(org.junit.Test) BaseRevisionIndexTest(com.b2international.index.revision.BaseRevisionIndexTest)

Example 43 with ValidationIssues

use of com.b2international.snowowl.core.validation.issue.ValidationIssues in project snow-owl by b2ihealthcare.

the class SnomedValidationIssueDetailTest method filterByAffectedComponentStatus.

@Test
public void filterByAffectedComponentStatus() {
    final Map<String, Object> details = ImmutableMap.of(SnomedIssueDetailFilterFields.COMPONENT_STATUS, true);
    final Map<String, Object> details2 = ImmutableMap.of(SnomedIssueDetailFilterFields.COMPONENT_STATUS, false);
    final ValidationIssue issueWithActiveComponent = createIssue("444444444", details);
    final ValidationIssue issueWithInactiveComponent = createIssue("555555555", details2);
    save(issueWithActiveComponent);
    save(issueWithInactiveComponent);
    ValidationIssues issues = ValidationRequests.issues().prepareSearch().all().filterByDetails(details).buildAsync().getRequest().execute(context);
    assertComponents(issues, issueWithActiveComponent.getAffectedComponent());
}
Also used : ValidationIssues(com.b2international.snowowl.core.validation.issue.ValidationIssues) ValidationIssue(com.b2international.snowowl.core.validation.issue.ValidationIssue) Test(org.junit.Test) BaseRevisionIndexTest(com.b2international.index.revision.BaseRevisionIndexTest)

Example 44 with ValidationIssues

use of com.b2international.snowowl.core.validation.issue.ValidationIssues in project snow-owl by b2ihealthcare.

the class SnomedValidationIssueDetailTest method conceptAttributeChange.

@Test
public void conceptAttributeChange() throws Exception {
    final String conceptId = RandomSnomedIdentiferGenerator.generateConceptId();
    indexRevision(MAIN, concept(conceptId).effectiveTime(EffectiveTimes.UNSET_EFFECTIVE_TIME).build());
    createSnomedQueryRule(ImmutableMap.<String, Object>builder().put("componentType", "concept").put("ecl", conceptId).build());
    final ValidationIssues firstValidation = validate();
    indexRevision(MAIN, concept(conceptId).effectiveTime(Long.MAX_VALUE).build());
    ValidationIssues afterConceptEffectiveTimeChangeValidation = validate();
    assertThat(firstValidation).hasSize(1);
    assertThat(firstValidation.first().get().getDetails().get(SnomedDocument.Fields.EFFECTIVE_TIME)).isEqualTo(EffectiveTimes.UNSET_EFFECTIVE_TIME);
    assertThat(afterConceptEffectiveTimeChangeValidation).hasSize(1);
    assertThat(afterConceptEffectiveTimeChangeValidation.first().get().getDetails().get(SnomedDocument.Fields.EFFECTIVE_TIME)).isEqualTo(Long.MAX_VALUE);
}
Also used : ValidationIssues(com.b2international.snowowl.core.validation.issue.ValidationIssues) Test(org.junit.Test) BaseRevisionIndexTest(com.b2international.index.revision.BaseRevisionIndexTest)

Aggregations

ValidationIssues (com.b2international.snowowl.core.validation.issue.ValidationIssues)44 Test (org.junit.Test)43 ValidationIssue (com.b2international.snowowl.core.validation.issue.ValidationIssue)9 BaseRevisionIndexTest (com.b2international.index.revision.BaseRevisionIndexTest)5 BaseValidationTest (com.b2international.snowowl.test.commons.validation.BaseValidationTest)5 ComponentURI (com.b2international.snowowl.core.uri.ComponentURI)1 SnomedConceptDocument (com.b2international.snowowl.snomed.datastore.index.entry.SnomedConceptDocument)1