use of com.fasterxml.jackson.databind.cfg.MapperConfig in project druid by druid-io.
the class InputSourceModuleTest method testSubTypeRegistration.
@Test
public void testSubTypeRegistration() {
MapperConfig config = mapper.getDeserializationConfig();
AnnotatedClass annotatedClass = AnnotatedClassResolver.resolveWithoutSuperTypes(config, SqlInputSource.class);
List<String> subtypes = mapper.getSubtypeResolver().collectAndResolveSubtypesByClass(config, annotatedClass).stream().map(NamedType::getName).collect(Collectors.toList());
Assert.assertNotNull(subtypes);
Assert.assertEquals(SQL_NAMED_TYPE, Iterables.getOnlyElement(subtypes));
}
use of com.fasterxml.jackson.databind.cfg.MapperConfig in project druid by druid-io.
the class FirehoseModuleTest method getFirehoseFactorySubtypeClasses.
private static Set<Class> getFirehoseFactorySubtypeClasses(ObjectMapper objectMapper) {
Class parentClass = FirehoseFactory.class;
MapperConfig config = objectMapper.getDeserializationConfig();
AnnotatedClass ac = AnnotatedClass.constructWithoutSuperTypes(parentClass, config);
Collection<NamedType> subtypes = objectMapper.getSubtypeResolver().collectAndResolveSubtypesByClass(config, ac);
Assert.assertNotNull(subtypes);
return subtypes.stream().map(NamedType::getType).filter(c -> !c.equals(parentClass)).collect(Collectors.toSet());
}
Aggregations