use of com.b2international.snowowl.core.validation.issue.ValidationIssues in project snow-owl by b2ihealthcare.
the class SnomedValidationIssueDetailTest method duplicateIssueWithSameComponentIdTest.
@Test
public void duplicateIssueWithSameComponentIdTest() throws Exception {
final String conceptId = RandomSnomedIdentiferGenerator.generateConceptId();
final ValidationIssue existingIssue = createIssue(conceptId, Collections.emptyMap());
final ValidationIssue existingIssue2 = createIssue(conceptId, Collections.emptyMap());
save(existingIssue);
save(existingIssue2);
ImmutableMap<String, Object> ruleQuery = ImmutableMap.<String, Object>builder().put("componentType", "concept").put("active", true).build();
SnomedConceptDocument theConcept = concept(conceptId).active(true).build();
indexRevision(MAIN, theConcept);
createSnomedQueryRule(ruleQuery);
final ValidationIssues issues = validate();
assertThat(issues.getItems().size()).isEqualTo(1);
}
use of com.b2international.snowowl.core.validation.issue.ValidationIssues in project snow-owl by b2ihealthcare.
the class SnomedQueryValidationRuleEvaluatorTest method descriptionRuleRegex.
@Test
public void descriptionRuleRegex() throws Exception {
final String description1 = RandomSnomedIdentiferGenerator.generateDescriptionId();
final String description2 = RandomSnomedIdentiferGenerator.generateDescriptionId();
indexRevision(MAIN, description(description1, Concepts.SYNONYM, "Minor heart attack").conceptId(generateConceptId()).build(), description(description2, Concepts.SYNONYM, "Clinical finding").conceptId(generateConceptId()).build());
final Map<String, Object> ruleQuery = ImmutableMap.<String, Object>builder().put("componentType", "description").put("term", "regex(.*heart.*)").build();
final String ruleId = createSnomedQueryRule(ruleQuery);
final ValidationIssues issues = validate(ruleId);
assertThat(issues.getTotal()).isEqualTo(1);
assertThat(issues.getItems().get(0).getAffectedComponent()).isEqualTo(ComponentIdentifier.of(SnomedDescription.TYPE, description1));
}
use of com.b2international.snowowl.core.validation.issue.ValidationIssues in project snow-owl by b2ihealthcare.
the class SnomedQueryValidationRuleEvaluatorTest method conceptRuleEclSingleConcept.
@Test
public void conceptRuleEclSingleConcept() throws Exception {
final String concept1 = RandomSnomedIdentiferGenerator.generateConceptId();
final String concept2 = RandomSnomedIdentiferGenerator.generateConceptId();
indexRevision(MAIN, concept(concept1).build(), concept(concept2).build());
final Map<String, Object> ruleQuery = ImmutableMap.<String, Object>builder().put("componentType", "concept").put("ecl", concept1).build();
final String ruleId = createSnomedQueryRule(ruleQuery);
final ValidationIssues issues = validate(ruleId);
assertThat(issues.getTotal()).isEqualTo(1);
assertThat(issues.getItems().get(0).getAffectedComponent()).isEqualTo(ComponentIdentifier.of(SnomedConcept.TYPE, concept1));
}
use of com.b2international.snowowl.core.validation.issue.ValidationIssues in project snow-owl by b2ihealthcare.
the class SnomedQueryValidationRuleEvaluatorTest method conceptRuleActiveAndModuleFilter.
@Test
public void conceptRuleActiveAndModuleFilter() throws Exception {
final String concept1 = RandomSnomedIdentiferGenerator.generateConceptId();
final String concept2 = RandomSnomedIdentiferGenerator.generateConceptId();
final String concept3 = RandomSnomedIdentiferGenerator.generateConceptId();
indexRevision(MAIN, concept(concept1).moduleId(Concepts.MODULE_B2I_EXTENSION).build(), concept(concept2).active(false).moduleId(Concepts.MODULE_B2I_EXTENSION).build(), concept(concept3).active(false).moduleId(Concepts.MODULE_SCT_CORE).build());
final Map<String, Object> ruleQuery = ImmutableMap.<String, Object>builder().put("componentType", "concept").put("active", true).put("module", Concepts.MODULE_B2I_EXTENSION).build();
final String ruleId = createSnomedQueryRule(ruleQuery);
final ValidationIssues issues = validate(ruleId);
assertThat(issues.getTotal()).isEqualTo(1);
assertThat(issues.getItems().get(0).getAffectedComponent()).isEqualTo(ComponentIdentifier.of(SnomedConcept.TYPE, concept1));
}
use of com.b2international.snowowl.core.validation.issue.ValidationIssues in project snow-owl by b2ihealthcare.
the class SnomedQueryValidationRuleEvaluatorTest method descriptionAcceptableInAndPreferredIn.
@Test
public void descriptionAcceptableInAndPreferredIn() throws Exception {
final String description1 = RandomSnomedIdentiferGenerator.generateDescriptionId();
final String description2 = RandomSnomedIdentiferGenerator.generateDescriptionId();
final String langRefSet1 = generateConceptId();
final String langRefSet2 = RandomSnomedIdentiferGenerator.generateConceptId();
indexRevision(MAIN, description(description1, Concepts.SYNONYM, "Minor heart attack").conceptId(generateConceptId()).acceptableIn(ImmutableSet.of(langRefSet1)).preferredIn(ImmutableSet.of(langRefSet2)).build(), description(description2, Concepts.SYNONYM, "Clinical finding (finding)").conceptId(generateConceptId()).acceptableIn(ImmutableSet.of(langRefSet1)).build());
final Map<String, Object> ruleQuery = ImmutableMap.<String, Object>builder().put("componentType", "description").put("acceptableIn", ImmutableList.of(langRefSet1)).put("preferredIn", ImmutableList.of(langRefSet2)).build();
final String ruleId = createSnomedQueryRule(ruleQuery);
final ValidationIssues issues = validate(ruleId);
assertThat(issues.getTotal()).isEqualTo(1);
assertThat(issues.getItems().get(0).getAffectedComponent()).isEqualTo(ComponentIdentifier.of(SnomedDescription.TYPE, description1));
}
Aggregations