use of com.fasterxml.jackson.datatype.joda.JodaModule in project kylo by Teradata.
the class MetadataClient method createObjectMapper.
private ObjectMapper createObjectMapper() {
ObjectMapper mapper = new ObjectMapper();
mapper.registerModule(new JodaModule());
// TODO Module dependency is causing a conflict somehow.
// mapper.registerModule(new JavaTimeModule());
mapper.setSerializationInclusion(Include.NON_NULL);
return mapper;
}
use of com.fasterxml.jackson.datatype.joda.JodaModule in project kylo by Teradata.
the class IntegrationTestBase method setupRestAssured.
@Before
public void setupRestAssured() throws URISyntaxException {
UserContext.setUser(UserContext.User.ADMIN);
RestAssured.baseURI = kyloConfig.getProtocol() + kyloConfig.getHost();
RestAssured.port = kyloConfig.getPort();
RestAssured.basePath = kyloConfig.getBasePath();
RestAssured.enableLoggingOfRequestAndResponseIfValidationFails();
Jackson2ObjectMapperFactory factory = (aClass, s) -> {
ObjectMapper om = new ObjectMapper();
om.registerModule(new JodaModule());
om.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, true);
om.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false);
om.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
configureObjectMapper(om);
return om;
};
com.jayway.restassured.mapper.ObjectMapper objectMapper = new Jackson2Mapper(factory);
RestAssured.objectMapper(objectMapper);
startClean();
}
use of com.fasterxml.jackson.datatype.joda.JodaModule in project killbill by killbill.
the class TestDefaultBroadcastInternalEvent method testBasic.
@Test(groups = "fast")
public void testBasic() throws Exception {
final ObjectMapper objectMapper = new ObjectMapper();
objectMapper.registerModule(new JodaModule());
objectMapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
final String eventJson = "\"{\"pluginName\":\"foo\",\"pluginVersion\":\"1.2.3\",\"properties\":[{\"key\":\"something\",\"value\":\"nothing\"}]}\"";
final BroadcastInternalEvent broadcastEvent = new DefaultBroadcastInternalEvent("service", "PLUGIN_INSTALL", eventJson);
final String broadcastEventStr = objectMapper.writeValueAsString(broadcastEvent);
final BroadcastInternalEvent res = objectMapper.readValue(broadcastEventStr, DefaultBroadcastInternalEvent.class);
Assert.assertEquals(res.getServiceName(), "service");
Assert.assertEquals(res.getType(), "PLUGIN_INSTALL");
Assert.assertEquals(res.getJsonEvent(), eventJson);
}
use of com.fasterxml.jackson.datatype.joda.JodaModule in project goci by EBISPOT.
the class DepositionSyncApp method getObjectMapper.
@Bean(name = "JodaMapper")
@Primary
public ObjectMapper getObjectMapper() {
ObjectMapper mapper = new ObjectMapper();
mapper.registerModule(new JodaModule()).configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false).configure(SerializationFeature.INDENT_OUTPUT, true).setSerializationInclusion(JsonInclude.Include.NON_NULL);
return mapper;
}
use of com.fasterxml.jackson.datatype.joda.JodaModule in project goci by EBISPOT.
the class BeanMapperTest method testConvertStudy.
@Test
public void testConvertStudy() {
String dtoString = "{\n" + " \"study_tag\": \"t1\",\n" + " \"study_accession\": \"GCST90000116\",\n" + " \"genotyping_technology\": \"Genome-wide genotyping array\",\n" + " \"imputation\": false,\n" + " \"variant_count\": 4,\n" + " \"trait\": \"bmi\",\n" + " \"summary_statistics_file\": \"abc123.tsv\",\n" + " \"checksum\": \"a1195761f082f8cbc2f5a560743077cc\",\n" + " \"summary_statistics_assembly\": \"GRCh38\",\n" + " \"readme_file\": \"some text\"\n" + " }";
ObjectMapper objectMapper = new ObjectMapper();
objectMapper.registerModule(new JodaModule());
DepositionStudyDto studyDto = null;
try {
studyDto = objectMapper.readValue(dtoString, DepositionStudyDto.class);
} catch (IOException e) {
e.printStackTrace();
fail(e.getMessage());
}
UnpublishedStudy study = BeanMapper.MAPPER.convert(studyDto);
assertNotNull(study);
assertNotNull(study.getSummaryStatsFile());
}
Aggregations