use of com.fasterxml.jackson.datatype.joda.JodaModule in project goci by EBISPOT.
the class DepositionFileUploadDtoTest method testReadFileUploadResponse.
@Test
public void testReadFileUploadResponse() {
String json = "{\n" + " \"_embedded\" : {\n" + " \"fileUploads\" : [ {\n" + " \"fileUploadId\" : \"5d52af6207d5180001ecd186\",\n" + " \"status\" : \"VALID\",\n" + " \"type\" : \"METADATA\",\n" + " \"fileName\" : \"file\",\n" + " \"fileSize\" : 13654,\n" + " \"_links\" : {\n" + " \"self\" : {\n" + " \"href\" : \"http://193.62.54.159/backend/v1/submissions/5d514e99dcf21d0001eee221/uploads" + "/5d52af6207d5180001ecd186\"\n" + " }\n" + " }\n" + " } ]\n" + " },\n" + " \"_links\" : {\n" + " \"self\" : {\n" + " \"href\" : \"http://193.62.54.159/backend/v1/submissions/5d514e99dcf21d0001eee221/uploads\"\n" + " }\n" + " }\n" + "}";
ObjectMapper objectMapper = new ObjectMapper();
try {
objectMapper.registerModule(new JodaModule());
DepositionFileUploadListWrapper files = objectMapper.readValue(json, DepositionFileUploadListWrapper.class);
assertNotNull(files);
// assertNotNull(publication.getPublications().get(0).getPublicationDate().year());
} catch (IOException e) {
e.printStackTrace();
fail(e.getMessage());
}
}
use of com.fasterxml.jackson.datatype.joda.JodaModule in project goci by EBISPOT.
the class DepositionPublicationTest method testDepositionPublicationRead.
@Test
public void testDepositionPublicationRead() {
try {
Resource resource = new ClassPathResource("publication.json");
assertTrue(resource.exists());
ObjectMapper objectMapper = new ObjectMapper();
objectMapper.registerModule(new JodaModule());
DepositionPublication publication = objectMapper.readValue(resource.getFile(), DepositionPublication.class);
assertNotNull(publication);
assertNotNull(publication.getStatus());
assertNotNull(publication.getPublicationDate().year());
} catch (IOException e) {
e.printStackTrace();
fail(e.getMessage());
}
}
use of com.fasterxml.jackson.datatype.joda.JodaModule in project goci by EBISPOT.
the class DepositionPublicationTest method testDepositionPublicationWrite.
@Test
public void testDepositionPublicationWrite() {
ObjectMapper objectMapper = new ObjectMapper();
try {
objectMapper.registerModule(new JodaModule());
DepositionPublication publication = new DepositionPublication();
publication.setPublicationDate(new LocalDate());
String json = objectMapper.writeValueAsString(publication);
assertNotNull(json);
} catch (IOException e) {
e.printStackTrace();
fail(e.getMessage());
}
}
use of com.fasterxml.jackson.datatype.joda.JodaModule in project goci by EBISPOT.
the class DepositionStudyDtoTest method testReadStudiesResponse.
@Test
public void testReadStudiesResponse() {
String json = "{\n" + " \"_embedded\" : {\n" + " \"studies\" : [ {\n" + " \"study_tag\" : \"30237584_1\",\n" + " \"genotyping_technology\" : \"Genome-wide genotyping array\",\n" + " \"array_manufacturer\" : \"Illumina\",\n" + " \"array_information\" : \"\",\n" + " \"imputation\" : false,\n" + " \"variant_count\" : 696317,\n" + " \"statistical_model\" : \"\",\n" + " \"study_description\" : \"Primary validation\",\n" + " \"trait\" : \"Resistant hypertension\",\n" + " \"summary_statistics_file\" : \"EFO_1002006\",\n" + " \"checksum\" : \"\",\n" + " \"summary_statistics_assembly\" : \"\",\n" + " \"_links\" : {\n" + " \"parent\" : {\n" + " \"href\" : \"http://193.62.54.159/backend/v1/submissions/5d514e99dcf21d0001eee221\"\n" + " }\n" + " }\n" + " }, {\n" + " \"study_tag\" : \"30237584_2\",\n" + " \"genotyping_technology\" : \"Genome-wide genotyping array\",\n" + " \"array_manufacturer\" : \"Illumina\",\n" + " \"array_information\" : \"\",\n" + " \"imputation\" : false,\n" + " \"variant_count\" : 696317,\n" + " \"statistical_model\" : \"\",\n" + " \"study_description\" : \"Secondary validation\",\n" + " \"trait\" : \"Resistant hypertension\",\n" + " \"summary_statistics_file\" : \"EFO_1002006\",\n" + " \"checksum\" : \"\",\n" + " \"summary_statistics_assembly\" : \"\",\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/studies\"\n" + " }\n" + " },\n" + " \"page\" : {\n" + " \"size\" : 20,\n" + " \"totalElements\" : 2,\n" + " \"totalPages\" : 1,\n" + " \"number\" : 0\n" + " }\n" + "}";
ObjectMapper objectMapper = new ObjectMapper();
try {
objectMapper.registerModule(new JodaModule());
DepositionStudyListWrapper studies = objectMapper.readValue(json, DepositionStudyListWrapper.class);
assertNotNull(studies);
// assertNotNull(publication.getPublications().get(0).getPublicationDate().year());
} catch (IOException e) {
e.printStackTrace();
fail(e.getMessage());
}
}
use of com.fasterxml.jackson.datatype.joda.JodaModule in project goci by EBISPOT.
the class DepositionSubmissionTest method testReadSubmission.
@Test
public void testReadSubmission() {
try {
Resource resource = new ClassPathResource("submission.json");
assertTrue(resource.exists());
ObjectMapper objectMapper = new ObjectMapper();
objectMapper.registerModule(new JodaModule());
DepositionSubmission submission = objectMapper.readValue(resource.getFile(), DepositionSubmission.class);
assertNotNull(submission);
assertTrue(submission.getCreated().getTimestamp().toString().equals("2019-08-12T11:41:43.861Z"));
assertNotNull(submission.getStatus());
} catch (IOException e) {
e.printStackTrace();
fail(e.getMessage());
}
}
Aggregations