use of org.apache.druid.initialization.DruidModule in project druid by druid-io.
the class LookupSerdeModuleTest method setUp.
@Before
public void setUp() {
final ImmutableList<DruidModule> modules = ImmutableList.of(new ExpressionModule(), new LookupSerdeModule());
injector = GuiceInjectors.makeStartupInjectorWithModules(modules);
objectMapper = injector.getInstance(Key.get(ObjectMapper.class, Json.class));
objectMapper.setInjectableValues(new InjectableValues.Std().addValue(ExprMacroTable.class, injector.getInstance(ExprMacroTable.class)).addValue(LookupExtractorFactoryContainerProvider.class, injector.getInstance(LookupExtractorFactoryContainerProvider.class)));
modules.stream().flatMap(module -> module.getJacksonModules().stream()).forEach(objectMapper::registerModule);
}
use of org.apache.druid.initialization.DruidModule in project druid by druid-io.
the class S3InputSourceTest method createS3ObjectMapper.
public static ObjectMapper createS3ObjectMapper() {
DruidModule baseModule = new TestS3Module();
final Injector injector = Guice.createInjector(new ObjectMapperModule(), baseModule, new DruidModule() {
@Provides
public AWSCredentialsProvider getAWSCredentialsProvider() {
return AWSCredentialsUtils.defaultAWSCredentialsProviderChain(null);
}
@Override
public List<? extends Module> getJacksonModules() {
return Collections.emptyList();
}
@Override
public void configure(Binder binder) {
}
});
final ObjectMapper baseMapper = injector.getInstance(ObjectMapper.class);
baseModule.getJacksonModules().forEach(baseMapper::registerModule);
return baseMapper;
}
use of org.apache.druid.initialization.DruidModule in project druid by druid-io.
the class OssInputSourceTest method createObjectMapper.
public static ObjectMapper createObjectMapper() {
DruidModule baseModule = new TestOssModule();
final Injector injector = Guice.createInjector(new ObjectMapperModule(), baseModule);
final ObjectMapper baseMapper = injector.getInstance(ObjectMapper.class);
baseModule.getJacksonModules().forEach(baseMapper::registerModule);
return baseMapper;
}
use of org.apache.druid.initialization.DruidModule in project druid by druid-io.
the class GoogleCloudStorageInputSourceTest method createGoogleObjectMapper.
public static ObjectMapper createGoogleObjectMapper() {
final DruidModule baseModule = new TestGoogleModule();
final ObjectMapper baseMapper = new DefaultObjectMapper();
baseModule.getJacksonModules().forEach(baseMapper::registerModule);
final Injector injector = Guice.createInjector(new ObjectMapperModule(), baseModule);
return injector.getInstance(ObjectMapper.class);
}
use of org.apache.druid.initialization.DruidModule in project druid by druid-io.
the class KinesisIndexTaskSerdeTest method createObjectMapper.
private static ObjectMapper createObjectMapper() {
DruidModule module = new KinesisIndexingServiceModule();
Injector injector = Initialization.makeInjectorWithModules(GuiceInjectors.makeStartupInjector(), Arrays.asList(module, (Module) binder -> {
binder.bindConstant().annotatedWith(Names.named("serviceName")).to("test");
binder.bindConstant().annotatedWith(Names.named("servicePort")).to(8000);
binder.bindConstant().annotatedWith(Names.named("tlsServicePort")).to(9000);
binder.bind(ChatHandlerProvider.class).toInstance(new NoopChatHandlerProvider());
binder.bind(RowIngestionMetersFactory.class).toInstance(new DropwizardRowIngestionMetersFactory());
binder.bind(AppenderatorsManager.class).toInstance(new TestAppenderatorsManager());
}));
ObjectMapper objectMapper = injector.getInstance(ObjectMapper.class);
module.getJacksonModules().forEach(objectMapper::registerModule);
return objectMapper;
}
Aggregations