Search in sources :

Example 51 with WorkBulk

use of org.orcid.jaxb.model.record_rc3.WorkBulk in project ORCID-Source by ORCID.

the class WorksTest method testCreateBulkWork.

@Test
public void testCreateBulkWork() throws InterruptedException, JSONException {
    String accessToken = getAccessToken();
    WorkBulk bulk = createBulk(10, null);
    ClientResponse postResponse = memberV2_1ApiClient.createWorksJson(this.getUser1OrcidId(), bulk, accessToken);
    assertNotNull(postResponse);
    assertEquals(Response.Status.OK.getStatusCode(), postResponse.getStatus());
    bulk = postResponse.getEntity(WorkBulk.class);
    assertNotNull(bulk);
    assertNotNull(bulk.getBulk());
    // All elements might be ok
    for (BulkElement element : bulk.getBulk()) {
        assertTrue(Work.class.isAssignableFrom(element.getClass()));
        Work work = (Work) element;
        // Remove the work
        memberV2_1ApiClient.deleteWorkXml(this.getUser1OrcidId(), work.getPutCode(), accessToken);
    }
}
Also used : ClientResponse(com.sun.jersey.api.client.ClientResponse) BulkElement(org.orcid.jaxb.model.record.bulk.BulkElement) WorkBulk(org.orcid.jaxb.model.record_v2.WorkBulk) Work(org.orcid.jaxb.model.record_v2.Work) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)43 WorkBulk (org.orcid.jaxb.model.record_v2.WorkBulk)41 Work (org.orcid.jaxb.model.record_v2.Work)26 OrcidError (org.orcid.jaxb.model.error_v2.OrcidError)23 ClientResponse (com.sun.jersey.api.client.ClientResponse)16 BulkElement (org.orcid.jaxb.model.record.bulk.BulkElement)15 Response (javax.ws.rs.core.Response)8 DBUnitTest (org.orcid.test.DBUnitTest)8 BaseTest (org.orcid.core.BaseTest)7 Url (org.orcid.jaxb.model.common_v2.Url)7 ExternalID (org.orcid.jaxb.model.record_v2.ExternalID)7 Title (org.orcid.jaxb.model.common_v2.Title)6 ExternalIDs (org.orcid.jaxb.model.record_v2.ExternalIDs)6 WorkTitle (org.orcid.jaxb.model.record_v2.WorkTitle)6 WorkBulk (org.orcid.jaxb.model.record_rc3.WorkBulk)5 WorkBulk (org.orcid.jaxb.model.record_rc4.WorkBulk)5 ClientDetailsEntity (org.orcid.persistence.jpa.entities.ClientDetailsEntity)5 SourceEntity (org.orcid.persistence.jpa.entities.SourceEntity)5 ArrayList (java.util.ArrayList)3 OrcidError (org.orcid.jaxb.model.error_rc3.OrcidError)3