io.dropwizard.jackson.DiscoverableSubtypeResolver Java Examples
The following examples show how to use
io.dropwizard.jackson.DiscoverableSubtypeResolver.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: KafkaZipkinFactoryTest.java From dropwizard-zipkin with Apache License 2.0 | 6 votes |
@Test public void shouldBeConfigurable() throws IOException { ObjectMapper mapper = new ObjectMapper(new YAMLFactory()).setSubtypeResolver(new DiscoverableSubtypeResolver()); final ZipkinFactory factory = mapper.readValue( "enabled: true\n" + "collector: kafka\n" + "bootstrapServers: example.com:1234\n" + "topic: foo\n" + "overrides:\n" + " acks: all\n" + "reportTimeout: 3d\n", ZipkinFactory.class); assertThat(factory).isInstanceOf(KafkaZipkinFactory.class); KafkaZipkinFactory kafkaFactory = (KafkaZipkinFactory) factory; assertThat(kafkaFactory.getBootstrapServers()).isEqualTo("example.com:1234"); assertThat(kafkaFactory.getTopic()).isEqualTo("foo"); assertThat(kafkaFactory.getOverrides()).containsExactly(entry("acks", "all")); assertThat(kafkaFactory.getReportTimeout()).isEqualTo(Duration.days(3)); }
Example #2
Source File: HttpZipkinFactoryTest.java From dropwizard-zipkin with Apache License 2.0 | 6 votes |
@Test public void shouldBeConfigurable() throws IOException { ObjectMapper mapper = new ObjectMapper(new YAMLFactory()).setSubtypeResolver(new DiscoverableSubtypeResolver()); final ZipkinFactory factory = mapper.readValue( "enabled: true\n" + "collector: http\n" + "baseUrl: http://example.com:1234/zipkin\n" + "connectTimeout: 1d\n" + "readTimeout: 2d\n" + "reportTimeout: 3d\n", ZipkinFactory.class); assertThat(factory).isInstanceOf(HttpZipkinFactory.class); HttpZipkinFactory httpFactory = (HttpZipkinFactory) factory; assertThat(httpFactory.getBaseUrl()).isEqualTo("http://example.com:1234/zipkin"); assertThat(httpFactory.getReportTimeout()).isEqualTo(Duration.days(3)); }
Example #3
Source File: RabbitMQZipkinFactoryTest.java From dropwizard-zipkin with Apache License 2.0 | 5 votes |
@Test public void shouldBeConfigurable() throws IOException { ObjectMapper mapper = new ObjectMapper(new YAMLFactory()).setSubtypeResolver(new DiscoverableSubtypeResolver()); final ZipkinFactory factory = mapper.readValue( "enabled: true\n" + "collector: amqp\n" + "addresses: example.com:1234\n" + "queue: test\n" + "username: foo\n" + "password: bar\n" + "virtualHost: /test\n" + "connectionTimeout: 1d\n" + "reportTimeout: 3d\n", ZipkinFactory.class); assertThat(factory).isInstanceOf(RabbitMQZipkinFactory.class); RabbitMQZipkinFactory kafkaFactory = (RabbitMQZipkinFactory) factory; assertThat(kafkaFactory.getAddresses()).isEqualTo("example.com:1234"); assertThat(kafkaFactory.getQueue()).isEqualTo("test"); assertThat(kafkaFactory.getUsername()).isEqualTo("foo"); assertThat(kafkaFactory.getPassword()).isEqualTo("bar"); assertThat(kafkaFactory.getVirtualHost()).isEqualTo("/test"); assertThat(kafkaFactory.getConnectionTimeout()).isEqualTo(Duration.days(1)); assertThat(kafkaFactory.getReportTimeout()).isEqualTo(Duration.days(3)); }
Example #4
Source File: EmoServiceObjectMapperFactory.java From emodb with Apache License 2.0 | 5 votes |
public static ObjectMapper configure(ObjectMapper mapper) { return CustomJsonObjectMapperFactory.configure(mapper) .registerModule(new LogbackModule()) .setDateFormat(new ISO8601DateFormat()) .setPropertyNamingStrategy(new AnnotationSensitivePropertyNamingStrategy()) .setSubtypeResolver(new DiscoverableSubtypeResolver()); }
Example #5
Source File: JsonHelpers.java From keywhiz with Apache License 2.0 | 5 votes |
/** * Customized ObjectMapper for common settings. * * @return customized object mapper */ private static ObjectMapper customizeObjectMapper() { ObjectMapper mapper = new ObjectMapper(); mapper.registerModule(new Jdk8Module()); mapper.registerModule(new GuavaModule()); mapper.registerModule(new GuavaExtrasModule()); mapper.registerModule(new FuzzyEnumModule()); mapper.setPropertyNamingStrategy(new AnnotationSensitivePropertyNamingStrategy()); mapper.setSubtypeResolver(new DiscoverableSubtypeResolver()); mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); return mapper; }
Example #6
Source File: JacksonXML.java From dropwizard-xml with Apache License 2.0 | 5 votes |
/** * Creates a new {@link com.fasterxml.jackson.dataformat.xml.XmlMapper} using Woodstox * with Logback and Joda Time support. * Also includes all {@link io.dropwizard.jackson.Discoverable} interface implementations. * * @return XmlMapper */ public static XmlMapper newXMLMapper(JacksonXmlModule jacksonXmlModule) { final XmlFactory woodstoxFactory = new XmlFactory(new WstxInputFactory(), new WstxOutputFactory()); final XmlMapper mapper = new XmlMapper(woodstoxFactory, jacksonXmlModule); mapper.registerModule(new GuavaModule()); mapper.registerModule(new GuavaExtrasModule()); mapper.registerModule(new JodaModule()); mapper.registerModule(new FuzzyEnumModule()); mapper.setPropertyNamingStrategy(new AnnotationSensitivePropertyNamingStrategy()); mapper.setSubtypeResolver(new DiscoverableSubtypeResolver()); return mapper; }
Example #7
Source File: EmptyZipkinFactoryTest.java From dropwizard-zipkin with Apache License 2.0 | 4 votes |
@Test public void isDiscoverable() { assertThat(new DiscoverableSubtypeResolver().getDiscoveredSubtypes()) .contains(EmptyZipkinFactory.class); }
Example #8
Source File: ConsoleZipkinFactoryTest.java From dropwizard-zipkin with Apache License 2.0 | 4 votes |
@Test public void isDiscoverable() { assertThat(new DiscoverableSubtypeResolver().getDiscoveredSubtypes()) .contains(ConsoleZipkinFactory.class); }
Example #9
Source File: RabbitMQZipkinFactoryTest.java From dropwizard-zipkin with Apache License 2.0 | 4 votes |
@Test public void isDiscoverable() { assertThat(new DiscoverableSubtypeResolver().getDiscoveredSubtypes()) .contains(RabbitMQZipkinFactory.class); }
Example #10
Source File: KafkaZipkinFactoryTest.java From dropwizard-zipkin with Apache License 2.0 | 4 votes |
@Test public void isDiscoverable() { assertThat(new DiscoverableSubtypeResolver().getDiscoveredSubtypes()) .contains(KafkaZipkinFactory.class); }
Example #11
Source File: HttpZipkinFactoryTest.java From dropwizard-zipkin with Apache License 2.0 | 4 votes |
@Test public void isDiscoverable() { assertThat(new DiscoverableSubtypeResolver().getDiscoveredSubtypes()) .contains(HttpZipkinFactory.class); }
Example #12
Source File: MultiIpPerNodeAddressTranslatorFactoryTest.java From cassandra-reaper with Apache License 2.0 | 4 votes |
@Test public void isDiscoverable() { assertTrue("problem with discovering custom factory", new DiscoverableSubtypeResolver().getDiscoveredSubtypes() .contains(MultiIpPerNodeAddressTranslatorFactory.class)); }
Example #13
Source File: InfluxDbReporterFactoryTest.java From dropwizard-metrics-influxdb with Apache License 2.0 | 4 votes |
@Test public void isDiscoverable() throws Exception { assertThat(new DiscoverableSubtypeResolver().getDiscoveredSubtypes()) .contains(InfluxDbReporterFactory.class); }
Example #14
Source File: CloudWatchReporterFactoryTest.java From dropwizard-metrics-cloudwatch with Apache License 2.0 | 4 votes |
@Test public void isDiscoverable() throws Exception { assertThat(new DiscoverableSubtypeResolver().getDiscoveredSubtypes()) .contains(CloudWatchReporterFactory.class); }