use of org.apache.druid.guice.GuiceInjectableValues in project druid by druid-io.
the class LoadSpecTest method setUp.
@BeforeClass
public static void setUp() {
final Injector injector = GuiceInjectors.makeStartupInjectorWithModules(ImmutableList.of(new Module() {
@Override
public void configure(Binder binder) {
binder.bind(LocalDataSegmentPuller.class);
}
}));
mapper = new DefaultObjectMapper();
mapper.registerModule(new SimpleModule("loadSpecTest").registerSubtypes(LocalLoadSpec.class));
mapper.setInjectableValues(new GuiceInjectableValues(injector));
final GuiceAnnotationIntrospector guiceIntrospector = new GuiceAnnotationIntrospector();
mapper.setAnnotationIntrospectors(new AnnotationIntrospectorPair(guiceIntrospector, mapper.getSerializationConfig().getAnnotationIntrospector()), new AnnotationIntrospectorPair(guiceIntrospector, mapper.getDeserializationConfig().getAnnotationIntrospector()));
}
use of org.apache.druid.guice.GuiceInjectableValues in project druid by druid-io.
the class DeepStorageShuffleClientTest method setUp.
@Before
public void setUp() throws Exception {
final Injector injector = GuiceInjectors.makeStartupInjectorWithModules(ImmutableList.of(binder -> binder.bind(LocalDataSegmentPuller.class)));
mapper = new DefaultObjectMapper();
mapper.registerModule(new SimpleModule("loadSpecTest").registerSubtypes(LocalLoadSpec.class));
mapper.setInjectableValues(new GuiceInjectableValues(injector));
final GuiceAnnotationIntrospector guiceIntrospector = new GuiceAnnotationIntrospector();
mapper.setAnnotationIntrospectors(new AnnotationIntrospectorPair(guiceIntrospector, mapper.getSerializationConfig().getAnnotationIntrospector()), new AnnotationIntrospectorPair(guiceIntrospector, mapper.getDeserializationConfig().getAnnotationIntrospector()));
deepStorageShuffleClient = new DeepStorageShuffleClient(mapper);
File temp = temporaryFolder.newFile();
segmentFileName = temp.getName();
try (Writer writer = Files.newBufferedWriter(temp.toPath(), StandardCharsets.UTF_8)) {
for (int j = 0; j < 10; j++) {
writer.write(StringUtils.format("let's write some data.\n"));
}
}
segmentFile = new File(temp.getAbsolutePath() + ".zip");
CompressionUtils.zip(segmentFile.getParentFile(), segmentFile);
}
use of org.apache.druid.guice.GuiceInjectableValues in project druid by druid-io.
the class IngestSegmentFirehoseFactoryTest method setupInjectablesInObjectMapper.
public static ObjectMapper setupInjectablesInObjectMapper(ObjectMapper objectMapper) {
objectMapper.registerModule(new SimpleModule("testModule").registerSubtypes(LocalLoadSpec.class));
final GuiceAnnotationIntrospector guiceIntrospector = new GuiceAnnotationIntrospector();
objectMapper.setAnnotationIntrospectors(new AnnotationIntrospectorPair(guiceIntrospector, objectMapper.getSerializationConfig().getAnnotationIntrospector()), new AnnotationIntrospectorPair(guiceIntrospector, objectMapper.getDeserializationConfig().getAnnotationIntrospector()));
objectMapper.setInjectableValues(new GuiceInjectableValues(GuiceInjectors.makeStartupInjectorWithModules(ImmutableList.of(new Module() {
@Override
public void configure(Binder binder) {
binder.bind(LocalDataSegmentPuller.class);
binder.bind(ExprMacroTable.class).toInstance(TestExprMacroTable.INSTANCE);
}
}))));
return objectMapper;
}
use of org.apache.druid.guice.GuiceInjectableValues in project druid by druid-io.
the class UriExtractionNamespaceTest method registerTypes.
public static ObjectMapper registerTypes(final ObjectMapper mapper) {
mapper.setInjectableValues(new GuiceInjectableValues(Guice.createInjector(ImmutableList.of(new Module() {
@Override
public void configure(Binder binder) {
binder.bind(ObjectMapper.class).annotatedWith(Json.class).toInstance(mapper);
binder.bind(ObjectMapper.class).toInstance(mapper);
}
})))).registerSubtypes(UriExtractionNamespace.class, UriExtractionNamespace.FlatDataParser.class);
final GuiceAnnotationIntrospector guiceIntrospector = new GuiceAnnotationIntrospector();
mapper.setAnnotationIntrospectors(new AnnotationIntrospectorPair(guiceIntrospector, mapper.getSerializationConfig().getAnnotationIntrospector()), new AnnotationIntrospectorPair(guiceIntrospector, mapper.getDeserializationConfig().getAnnotationIntrospector()));
return mapper;
}
use of org.apache.druid.guice.GuiceInjectableValues in project druid by druid-io.
the class CompactionTaskTest method setupInjectablesInObjectMapper.
private static ObjectMapper setupInjectablesInObjectMapper(ObjectMapper objectMapper) {
final GuiceAnnotationIntrospector guiceIntrospector = new GuiceAnnotationIntrospector();
objectMapper.setAnnotationIntrospectors(new AnnotationIntrospectorPair(guiceIntrospector, objectMapper.getSerializationConfig().getAnnotationIntrospector()), new AnnotationIntrospectorPair(guiceIntrospector, objectMapper.getDeserializationConfig().getAnnotationIntrospector()));
GuiceInjectableValues injectableValues = new GuiceInjectableValues(GuiceInjectors.makeStartupInjectorWithModules(ImmutableList.of(binder -> {
binder.bind(AuthorizerMapper.class).toInstance(AuthTestUtils.TEST_AUTHORIZER_MAPPER);
binder.bind(ChatHandlerProvider.class).toInstance(new NoopChatHandlerProvider());
binder.bind(RowIngestionMetersFactory.class).toInstance(TEST_UTILS.getRowIngestionMetersFactory());
binder.bind(CoordinatorClient.class).toInstance(COORDINATOR_CLIENT);
binder.bind(SegmentCacheManagerFactory.class).toInstance(new SegmentCacheManagerFactory(objectMapper));
binder.bind(AppenderatorsManager.class).toInstance(new TestAppenderatorsManager());
binder.bind(IndexingServiceClient.class).toInstance(INDEXING_SERVICE_CLIENT);
})));
objectMapper.setInjectableValues(injectableValues);
objectMapper.registerModule(new SimpleModule().registerSubtypes(new NamedType(NumberedShardSpec.class, "NumberedShardSpec")));
objectMapper.registerModules(new IndexingServiceTuningConfigModule().getJacksonModules());
return objectMapper;
}
Aggregations