use of com.fasterxml.jackson.datatype.joda.JodaModule in project goci by EBISPOT.
the class DepositionAssociationDtoTest method testReadAssociationResponse.
@Test
public void testReadAssociationResponse() {
String json = "{\n" + " \"_embedded\" : {\n" + " \"associations\" : [ {\n" + " \"study_tag\" : \"30237584_1\",\n" + " \"variant_id\" : \"rs11749255\",\n" + " \"pvalue\" : \"0.0000003\",\n" + " \"effect_allele\" : \"A\",\n" + " \"other_allele\" : \"\",\n" + " \"_links\" : {\n" + " \"parent\" : {\n" + " \"href\" : \"http://193.62.54.159/backend/v1/submissions/5d514e99dcf21d0001eee221\"\n" + " }\n" + " }\n" + " }, {\n" + " \"study_tag\" : \"30237584_2\",\n" + " \"variant_id\" : \"rs12228810\",\n" + " \"pvalue\" : \"0.000009\",\n" + " \"effect_allele\" : \"C\",\n" + " \"other_allele\" : \"\",\n" + " \"_links\" : {\n" + " \"parent\" : {\n" + " \"href\" : \"http://193.62.54.159/backend/v1/submissions/5d514e99dcf21d0001eee221\"\n" + " }\n" + " }\n" + " }, {\n" + " \"study_tag\" : \"30237584_2\",\n" + " \"variant_id\" : \"rs16934621\",\n" + " \"pvalue\" : \"0.000005\",\n" + " \"effect_allele\" : \"A\",\n" + " \"other_allele\" : \"\",\n" + " \"_links\" : {\n" + " \"parent\" : {\n" + " \"href\" : \"http://193.62.54.159/backend/v1/submissions/5d514e99dcf21d0001eee221\"\n" + " }\n" + " }\n" + " }, {\n" + " \"study_tag\" : \"30237584_2\",\n" + " \"variant_id\" : \"rs3766160\",\n" + " \"pvalue\" : \"0.000001\",\n" + " \"effect_allele\" : \"A\",\n" + " \"other_allele\" : \"\",\n" + " \"_links\" : {\n" + " \"parent\" : {\n" + " \"href\" : \"http://193.62.54.159/backend/v1/submissions/5d514e99dcf21d0001eee221\"\n" + " }\n" + " }\n" + " } ]\n" + " },\n" + " \"_links\" : {\n" + " \"self\" : {\n" + " \"href\" : \"http://193.62.54.159/backend/v1/submissions/5d514e99dcf21d0001eee221/associations\"\n" + " }\n" + " },\n" + " \"page\" : {\n" + " \"size\" : 20,\n" + " \"totalElements\" : 4,\n" + " \"totalPages\" : 1,\n" + " \"number\" : 0\n" + " }\n" + "}\n";
ObjectMapper objectMapper = new ObjectMapper();
try {
objectMapper.registerModule(new JodaModule());
DepositionAssociationListWrapper associations = objectMapper.readValue(json, DepositionAssociationListWrapper.class);
assertNotNull(associations);
assertNotNull(associations.getAssociations().getAssociations().get(0));
BigDecimal pValue = new BigDecimal(associations.getAssociations().getAssociations().get(0).getPValue());
assertNotNull(pValue);
BigInteger sv = pValue.unscaledValue();
int exponent = pValue.precision() - pValue.scale() - 1;
assertEquals(3, sv.intValue());
assertEquals(-7, exponent);
} catch (IOException e) {
e.printStackTrace();
fail(e.getMessage());
}
}
use of com.fasterxml.jackson.datatype.joda.JodaModule in project dropwizard by dropwizard.
the class Jackson method configure.
private static ObjectMapper configure(ObjectMapper mapper) {
mapper.registerModule(new GuavaModule());
mapper.registerModule(new GuavaExtrasModule());
mapper.registerModule(new CaffeineModule());
mapper.registerModule(new JodaModule());
mapper.registerModule(new BlackbirdModule());
mapper.registerModule(new FuzzyEnumModule());
mapper.registerModule(new ParameterNamesModule());
mapper.registerModule(new Jdk8Module());
mapper.registerModule(new JavaTimeModule());
mapper.setPropertyNamingStrategy(new AnnotationSensitivePropertyNamingStrategy());
mapper.setSubtypeResolver(new DiscoverableSubtypeResolver());
mapper.disable(FAIL_ON_UNKNOWN_PROPERTIES);
return mapper;
}
use of com.fasterxml.jackson.datatype.joda.JodaModule in project pact-jvm by DiUS.
the class BooksPactProviderTest method setup.
@Before
public void setup() throws Exception {
MockitoAnnotations.initMocks(this);
target.setControllers(bookController, novelController);
target.setControllerAdvice(bookControllerAdviceOne, bookControllerAdviceTwo);
target.setServletPath("/api");
target.setMessageConvertors(new MappingJackson2HttpMessageConverter(new ObjectMapper().registerModule(new JodaModule()).configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false)));
}
use of com.fasterxml.jackson.datatype.joda.JodaModule in project killbill by killbill.
the class TestBillingEventSetJson method setup.
@BeforeClass(groups = "fast")
public void setup() {
testMapper = new ObjectMapper();
testMapper.registerModule(new JodaModule());
testMapper.enable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
}
use of com.fasterxml.jackson.datatype.joda.JodaModule in project graylog2-server by Graylog2.
the class QueryTest method setup.
@Before
public void setup() throws Exception {
final ObjectMapper mapper = new ObjectMapper();
final TypeFactory typeFactory = mapper.getTypeFactory().withClassLoader(this.getClass().getClassLoader());
this.objectMapper = mapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS).disable(DeserializationFeature.ADJUST_DATES_TO_CONTEXT_TIME_ZONE).setPropertyNamingStrategy(new PropertyNamingStrategy.SnakeCaseStrategy()).setTypeFactory(typeFactory).registerModule(new GuavaModule()).registerModule(new JodaModule()).registerModule(new Jdk8Module()).registerModule(new JavaTimeModule()).registerModule(new MetricsModule(TimeUnit.SECONDS, TimeUnit.SECONDS, false)).registerModule(new SimpleModule("Graylog").addKeyDeserializer(Period.class, new JodaTimePeriodKeyDeserializer()).addSerializer(new RangeJsonSerializer()).addSerializer(new SizeSerializer()).addSerializer(new ObjectIdSerializer()));
// kludge because we don't have an injector in tests
ImmutableMap<String, Class> subtypes = ImmutableMap.<String, Class>builder().put(StreamFilter.NAME, StreamFilter.class).put(ElasticsearchQueryString.NAME, ElasticsearchQueryString.class).put(MessageList.NAME, MessageList.class).build();
subtypes.forEach((name, klass) -> objectMapper.registerSubtypes(new NamedType(klass, name)));
}
Aggregations