Search in sources :

Example 1 with DepositionSubmissionListWrapper

use of uk.ac.ebi.spot.goci.model.deposition.util.DepositionSubmissionListWrapper in project goci by EBISPOT.

the class DepositionSubmissionTest method testReadSubmissions.

@Test
public void testReadSubmissions() {
    try {
        Resource resource = new ClassPathResource("submissions.json");
        assertTrue(resource.exists());
        ObjectMapper objectMapper = new ObjectMapper();
        objectMapper.registerModule(new JodaModule());
        DepositionSubmissionListWrapper submissionList = objectMapper.readValue(resource.getFile(), DepositionSubmissionListWrapper.class);
        assertNotNull(submissionList);
        assertTrue(submissionList.getWrapper().getSubmissions().get(0).getCreated().getTimestamp().toString().equals("2019-08-12T11:33:45.005Z"));
        assertNotNull(submissionList.getWrapper().getSubmissions().get(0).getStatus());
    } catch (IOException e) {
        e.printStackTrace();
        fail(e.getMessage());
    }
}
Also used : JodaModule(com.fasterxml.jackson.datatype.joda.JodaModule) DepositionSubmissionListWrapper(uk.ac.ebi.spot.goci.model.deposition.util.DepositionSubmissionListWrapper) ClassPathResource(org.springframework.core.io.ClassPathResource) Resource(org.springframework.core.io.Resource) IOException(java.io.IOException) ClassPathResource(org.springframework.core.io.ClassPathResource) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) Test(org.junit.Test)

Example 2 with DepositionSubmissionListWrapper

use of uk.ac.ebi.spot.goci.model.deposition.util.DepositionSubmissionListWrapper in project goci by EBISPOT.

the class DepositionSubmissionTest method testCreateSubmissionWrapper.

@Test
public void testCreateSubmissionWrapper() {
    DepositionSubmissionListWrapper wrapper = new DepositionSubmissionListWrapper();
    wrapper.setWrapper(new DepositionSubmissionList());
    DepositionSubmission submission = new DepositionSubmission();
    wrapper.getWrapper().getSubmissions().add(submission);
    try {
        String json = new ObjectMapper().writeValueAsString(wrapper);
        assertNotNull(json);
    } catch (JsonProcessingException e) {
        e.printStackTrace();
        fail(e.getMessage());
    }
}
Also used : DepositionSubmissionListWrapper(uk.ac.ebi.spot.goci.model.deposition.util.DepositionSubmissionListWrapper) DepositionSubmissionList(uk.ac.ebi.spot.goci.model.deposition.util.DepositionSubmissionList) JsonProcessingException(com.fasterxml.jackson.core.JsonProcessingException) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) Test(org.junit.Test)

Aggregations

ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)2 Test (org.junit.Test)2 DepositionSubmissionListWrapper (uk.ac.ebi.spot.goci.model.deposition.util.DepositionSubmissionListWrapper)2 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)1 JodaModule (com.fasterxml.jackson.datatype.joda.JodaModule)1 IOException (java.io.IOException)1 ClassPathResource (org.springframework.core.io.ClassPathResource)1 Resource (org.springframework.core.io.Resource)1 DepositionSubmissionList (uk.ac.ebi.spot.goci.model.deposition.util.DepositionSubmissionList)1