Search in sources :

Example 1 with DepositionFileUploadListWrapper

use of uk.ac.ebi.spot.goci.model.deposition.util.DepositionFileUploadListWrapper 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());
    }
}
Also used : JodaModule(com.fasterxml.jackson.datatype.joda.JodaModule) DepositionFileUploadListWrapper(uk.ac.ebi.spot.goci.model.deposition.util.DepositionFileUploadListWrapper) IOException(java.io.IOException) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) Test(org.junit.Test)

Aggregations

ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 JodaModule (com.fasterxml.jackson.datatype.joda.JodaModule)1 IOException (java.io.IOException)1 Test (org.junit.Test)1 DepositionFileUploadListWrapper (uk.ac.ebi.spot.goci.model.deposition.util.DepositionFileUploadListWrapper)1