Search in sources :

Example 1 with Builder

use of com.b2international.snowowl.test.commons.snomed.TestBranchContext.Builder in project snow-owl by b2ihealthcare.

the class SnomedEclLabelerRequestTest method setup.

@Before
public void setup() {
    final IParser parser = ECL_INJECTOR.getInstance(IParser.class);
    final IResourceValidator resourceValidator = ECL_INJECTOR.getInstance(IResourceValidator.class);
    final ISerializer serializer = ECL_INJECTOR.getInstance(ISerializer.class);
    Builder contextBuilder = TestBranchContext.on(MAIN).with(EclParser.class, new DefaultEclParser(parser, resourceValidator)).with(EclSerializer.class, new DefaultEclSerializer(serializer)).with(Index.class, rawIndex()).with(RevisionIndex.class, index()).with(ObjectMapper.class, getMapper());
    CodeSystemResource.configureCodeSystem(contextBuilder);
    context = contextBuilder.build();
}
Also used : IResourceValidator(org.eclipse.xtext.validation.IResourceValidator) RevisionIndex(com.b2international.index.revision.RevisionIndex) Builder(com.b2international.snowowl.test.commons.snomed.TestBranchContext.Builder) IParser(org.eclipse.xtext.parser.IParser) ISerializer(org.eclipse.xtext.serializer.ISerializer) Before(org.junit.Before)

Example 2 with Builder

use of com.b2international.snowowl.test.commons.snomed.TestBranchContext.Builder in project snow-owl by b2ihealthcare.

the class SnomedDescriptionUtilsTest method setup.

@BeforeClass
public static void setup() {
    Builder contextBuilder = TestBranchContext.on(Branch.MAIN_PATH).with(ClassLoader.class, SnomedDescriptionUtilsTest.class.getClassLoader()).with(ObjectMapper.class, JsonSupport.getDefaultObjectMapper()).with(TerminologyRegistry.class, TerminologyRegistry.INSTANCE);
    CodeSystemResource.configureCodeSystem(contextBuilder);
    context = contextBuilder.build();
    gbPreferredDescription = createDescription("1", "first description", Map.of(Concepts.REFSET_LANGUAGE_TYPE_UK, Acceptability.PREFERRED, Concepts.REFSET_LANGUAGE_TYPE_US, Acceptability.ACCEPTABLE));
    usPreferredDescription = createDescription("2", "second description", Map.of(Concepts.REFSET_LANGUAGE_TYPE_UK, Acceptability.ACCEPTABLE, Concepts.REFSET_LANGUAGE_TYPE_US, Acceptability.PREFERRED));
    sgPreferredDescription = createDescription("3", "third description", Map.of(Concepts.REFSET_LANGUAGE_TYPE_SG, Acceptability.PREFERRED));
    englishAdditionalDescription = createDescription("4", "fourth description", Map.of(Concepts.REFSET_LANGUAGE_TYPE_UK, Acceptability.ACCEPTABLE, Concepts.REFSET_LANGUAGE_TYPE_US, Acceptability.ACCEPTABLE));
    sgAdditionalDescription = createDescription("5", "fifth description", Map.of(Concepts.REFSET_LANGUAGE_TYPE_SG, Acceptability.ACCEPTABLE));
    descriptions = List.of(gbPreferredDescription, usPreferredDescription, englishAdditionalDescription, sgPreferredDescription, sgAdditionalDescription);
}
Also used : Builder(com.b2international.snowowl.test.commons.snomed.TestBranchContext.Builder) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) BeforeClass(org.junit.BeforeClass)

Example 3 with Builder

use of com.b2international.snowowl.test.commons.snomed.TestBranchContext.Builder 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();
}
Also used : ValidationRepository(com.b2international.snowowl.core.internal.validation.ValidationRepository) RevisionIndex(com.b2international.index.revision.RevisionIndex) ValidationIssueDetailExtensionProvider(com.b2international.snowowl.core.validation.issue.ValidationIssueDetailExtensionProvider) ValidationThreadPool(com.b2international.snowowl.core.internal.validation.ValidationThreadPool) ValidateRequestBuilder(com.b2international.snowowl.core.validation.ValidateRequestBuilder) Builder(com.b2international.snowowl.test.commons.snomed.TestBranchContext.Builder) ResourceURIPathResolver(com.b2international.snowowl.core.uri.ResourceURIPathResolver) ClassPathScanner(com.b2international.snowowl.core.plugin.ClassPathScanner) ScriptEngine(com.b2international.snowowl.core.scripts.ScriptEngine) Before(org.junit.Before)

Aggregations

Builder (com.b2international.snowowl.test.commons.snomed.TestBranchContext.Builder)3 RevisionIndex (com.b2international.index.revision.RevisionIndex)2 Before (org.junit.Before)2 ValidationRepository (com.b2international.snowowl.core.internal.validation.ValidationRepository)1 ValidationThreadPool (com.b2international.snowowl.core.internal.validation.ValidationThreadPool)1 ClassPathScanner (com.b2international.snowowl.core.plugin.ClassPathScanner)1 ScriptEngine (com.b2international.snowowl.core.scripts.ScriptEngine)1 ResourceURIPathResolver (com.b2international.snowowl.core.uri.ResourceURIPathResolver)1 ValidateRequestBuilder (com.b2international.snowowl.core.validation.ValidateRequestBuilder)1 ValidationIssueDetailExtensionProvider (com.b2international.snowowl.core.validation.issue.ValidationIssueDetailExtensionProvider)1 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 IParser (org.eclipse.xtext.parser.IParser)1 ISerializer (org.eclipse.xtext.serializer.ISerializer)1 IResourceValidator (org.eclipse.xtext.validation.IResourceValidator)1 BeforeClass (org.junit.BeforeClass)1