Search in sources :

Example 11 with Mappings

use of com.b2international.index.mapping.Mappings 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());
}
Also used : ValidationRepository(com.b2international.snowowl.core.internal.validation.ValidationRepository) RevisionIndex(com.b2international.index.revision.RevisionIndex) DefaultEclSerializer(com.b2international.snowowl.snomed.core.ecl.DefaultEclSerializer) ValidationThreadPool(com.b2international.snowowl.core.internal.validation.ValidationThreadPool) RevisionIndex(com.b2international.index.revision.RevisionIndex) Index(com.b2international.index.Index) DefaultEclSerializer(com.b2international.snowowl.snomed.core.ecl.DefaultEclSerializer) EclSerializer(com.b2international.snowowl.snomed.core.ecl.EclSerializer) ValidationIssue(com.b2international.snowowl.core.validation.issue.ValidationIssue) ValidationWhiteList(com.b2international.snowowl.core.validation.whitelist.ValidationWhiteList) ValidationRule(com.b2international.snowowl.core.validation.rule.ValidationRule) DefaultEclParser(com.b2international.snowowl.snomed.core.ecl.DefaultEclParser) Mappings(com.b2international.index.mapping.Mappings) ValidationIssueDetailExtensionProvider(com.b2international.snowowl.core.validation.issue.ValidationIssueDetailExtensionProvider) ClassPathScanner(com.b2international.snowowl.core.plugin.ClassPathScanner) SnomedValidationIssueDetailExtension(com.b2international.snowowl.snomed.validation.detail.SnomedValidationIssueDetailExtension) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) ISerializer(org.eclipse.xtext.serializer.ISerializer) Before(org.junit.Before)

Example 12 with Mappings

use of com.b2international.index.mapping.Mappings in project snow-owl by b2ihealthcare.

the class ValidationRuleApiTest method setup.

@Before
public void setup() {
    final ObjectMapper mapper = JsonSupport.getDefaultObjectMapper();
    final Index index = Indexes.createIndex(UUID.randomUUID().toString(), mapper, new Mappings(ValidationRule.class));
    index.admin().create();
    final ValidationRepository repository = new ValidationRepository(index);
    context = ServiceProvider.EMPTY.inject().bind(ValidationRepository.class, repository).build();
}
Also used : ValidationRepository(com.b2international.snowowl.core.internal.validation.ValidationRepository) Mappings(com.b2international.index.mapping.Mappings) Index(com.b2international.index.Index) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) ValidationRule(com.b2international.snowowl.core.validation.rule.ValidationRule) Before(org.junit.Before)

Example 13 with Mappings

use of com.b2international.index.mapping.Mappings 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());
}
Also used : ValidationRepository(com.b2international.snowowl.core.internal.validation.ValidationRepository) Mappings(com.b2international.index.mapping.Mappings) ClassPathScanner(com.b2international.snowowl.core.plugin.ClassPathScanner) Index(com.b2international.index.Index) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) ValidationRule(com.b2international.snowowl.core.validation.rule.ValidationRule) Before(org.junit.Before)

Example 14 with Mappings

use of com.b2international.index.mapping.Mappings in project snow-owl by b2ihealthcare.

the class DatastoreLockTests method setup.

@Before
public void setup() {
    final ObjectMapper mapper = JsonSupport.getDefaultObjectMapper();
    final Index index = Indexes.createIndex("locks", mapper, new Mappings(DatastoreLockIndexEntry.class));
    manager = new DefaultOperationLockManager(index);
    manager.addLockTargetListener(new Slf4jOperationLockTargetListener());
    manager.unlockAll();
}
Also used : Mappings(com.b2international.index.mapping.Mappings) Index(com.b2international.index.Index) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) Slf4jOperationLockTargetListener(com.b2international.snowowl.core.internal.locks.Slf4jOperationLockTargetListener) Before(org.junit.Before)

Example 15 with Mappings

use of com.b2international.index.mapping.Mappings in project snow-owl by b2ihealthcare.

the class ValidationWhiteListApiTest method setup.

@Before
public void setup() {
    final ObjectMapper mapper = JsonSupport.getDefaultObjectMapper();
    final Index index = Indexes.createIndex(UUID.randomUUID().toString(), mapper, new Mappings(ValidationWhiteList.class, ValidationIssue.class));
    index.admin().create();
    final ValidationRepository repository = new ValidationRepository(index);
    context = ServiceProvider.EMPTY.inject().bind(IEventBus.class, EventBusUtil.getBus()).bind(ValidationRepository.class, repository).build();
}
Also used : ValidationRepository(com.b2international.snowowl.core.internal.validation.ValidationRepository) Mappings(com.b2international.index.mapping.Mappings) Index(com.b2international.index.Index) ValidationWhiteList(com.b2international.snowowl.core.validation.whitelist.ValidationWhiteList) ValidationIssue(com.b2international.snowowl.core.validation.issue.ValidationIssue) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) IEventBus(com.b2international.snowowl.eventbus.IEventBus) Before(org.junit.Before)

Aggregations

Mappings (com.b2international.index.mapping.Mappings)16 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)15 Index (com.b2international.index.Index)13 Before (org.junit.Before)7 RepositoryConfiguration (com.b2international.snowowl.core.config.RepositoryConfiguration)5 ValidationRepository (com.b2international.snowowl.core.internal.validation.ValidationRepository)4 ValidationRule (com.b2international.snowowl.core.validation.rule.ValidationRule)4 ValidationIssue (com.b2international.snowowl.core.validation.issue.ValidationIssue)3 ValidationWhiteList (com.b2international.snowowl.core.validation.whitelist.ValidationWhiteList)3 ItemIdGenerationStrategy (com.b2international.snowowl.snomed.cis.gen.ItemIdGenerationStrategy)3 DefaultSnomedIdentifierService (com.b2international.snowowl.snomed.cis.memory.DefaultSnomedIdentifierService)3 DefaultRevisionIndex (com.b2international.index.revision.DefaultRevisionIndex)2 RevisionIndex (com.b2international.index.revision.RevisionIndex)2 ClassPathScanner (com.b2international.snowowl.core.plugin.ClassPathScanner)2 ValidationIssueDetailExtensionProvider (com.b2international.snowowl.core.validation.issue.ValidationIssueDetailExtensionProvider)2 SnomedIdentifierConfiguration (com.b2international.snowowl.snomed.cis.SnomedIdentifierConfiguration)2 SctId (com.b2international.snowowl.snomed.cis.domain.SctId)2 SequentialItemIdGenerationStrategy (com.b2international.snowowl.snomed.cis.gen.SequentialItemIdGenerationStrategy)2 SnomedIdentifierReservationServiceImpl (com.b2international.snowowl.snomed.cis.internal.reservations.SnomedIdentifierReservationServiceImpl)2 CompareUtils (com.b2international.commons.CompareUtils)1