use of com.b2international.snowowl.core.plugin.ClassPathScanner in project snow-owl by b2ihealthcare.
the class SnomedValidationIssueDetailTest method setup.
@Before
public void setup() {
final Index index = Indexes.createIndex(UUID.randomUUID().toString(), getMapper(), new Mappings(ValidationRule.class, ValidationIssue.class, ValidationWhiteList.class));
repository = new ValidationRepository(index);
ClassPathScanner scanner = new ClassPathScanner("com.b2international");
context = TestBranchContext.on(MAIN).with(ObjectMapper.class, getMapper()).with(EclParser.class, new DefaultEclParser(INJECTOR.getInstance(IParser.class), INJECTOR.getInstance(IResourceValidator.class))).with(EclSerializer.class, new DefaultEclSerializer(INJECTOR.getInstance(ISerializer.class))).with(Index.class, rawIndex()).with(RevisionIndex.class, index()).with(ValidationThreadPool.class, new ValidationThreadPool(1, 1, 1)).with(ValidationRepository.class, repository).with(ClassPathScanner.class, scanner).with(ValidationIssueDetailExtensionProvider.class, new ValidationIssueDetailExtensionProvider(scanner)).with(ResourceURIPathResolver.class, ResourceURIPathResolver.fromMap(Map.of("SNOMEDCT", Branch.MAIN_PATH))).build();
evaluator = new SnomedQueryValidationRuleEvaluator();
if (!ValidationRuleEvaluator.Registry.types().contains(evaluator.type())) {
ValidationRuleEvaluator.Registry.register(evaluator);
}
context.service(ValidationIssueDetailExtensionProvider.class).addExtension(new SnomedValidationIssueDetailExtension());
}
use of com.b2international.snowowl.core.plugin.ClassPathScanner in project snow-owl by b2ihealthcare.
the class BaseValidationTest method setup.
@Before
public final void setup() {
final ClassPathScanner scanner = new ClassPathScanner("com.b2international");
Builder context = TestBranchContext.on(MAIN).with(ClassLoader.class, getClass().getClassLoader()).with(ClassPathScanner.class, scanner).with(Index.class, rawIndex()).with(RevisionIndex.class, index()).with(ObjectMapper.class, getMapper()).with(ValidationRepository.class, new ValidationRepository(rawIndex())).with(ValidationThreadPool.class, new ValidationThreadPool(1, 1, 1)).with(ValidationIssueDetailExtensionProvider.class, new ValidationIssueDetailExtensionProvider(scanner)).with(TerminologyRegistry.class, TerminologyRegistry.INSTANCE).with(ResourceURIPathResolver.class, ResourceURIPathResolver.fromMap(getTestCodeSystemPathMap())).with(ScriptEngine.Registry.class, new ScriptEngine.Registry(scanner));
configureContext(context);
this.context = context.build();
initializeData();
}
use of com.b2international.snowowl.core.plugin.ClassPathScanner in project snow-owl by b2ihealthcare.
the class ValidationIssueApiTest method setup.
@Before
public void setup() {
final ObjectMapper mapper = JsonSupport.getDefaultObjectMapper();
final Index index = Indexes.createIndex(UUID.randomUUID().toString(), mapper, new Mappings(ValidationIssue.class, ValidationRule.class));
index.admin().create();
final ValidationRepository repository = new ValidationRepository(index);
final ClassPathScanner scanner = new ClassPathScanner("com.b2international");
context = ServiceProvider.EMPTY.inject().bind(ClassPathScanner.class, scanner).bind(ValidationRepository.class, repository).bind(ValidationIssueDetailExtensionProvider.class, new ValidationIssueDetailExtensionProvider(scanner)).bind(ResourceURIPathResolver.class, ResourceURIPathResolver.fromMap(Map.of("SNOMEDCT", Branch.MAIN_PATH))).build();
context.service(ValidationIssueDetailExtensionProvider.class).addExtension(new TestValidationDetailExtension());
}
Aggregations