Search in sources :

Example 76 with PeerReviewSummary

use of org.orcid.jaxb.model.record.summary_rc2.PeerReviewSummary in project ORCID-Source by ORCID.

the class JpaJaxbPeerReviewAdapterTest method fromPeerReviewEntityToPeerReviewSummary.

@Test
public void fromPeerReviewEntityToPeerReviewSummary() {
    PeerReviewEntity entity = getPeerReviewEntity();
    assertNotNull(entity);
    PeerReviewSummary peerReviewSummary = jpaJaxbPeerReviewAdapter.toPeerReviewSummary(entity);
    assertNotNull(peerReviewSummary);
    assertEquals(Long.valueOf(12345), peerReviewSummary.getPutCode());
    assertEquals("private", peerReviewSummary.getVisibility().value());
    assertNotNull(peerReviewSummary.getCompletionDate());
    assertEquals("2015", peerReviewSummary.getCompletionDate().getYear().getValue());
    assertEquals("01", peerReviewSummary.getCompletionDate().getMonth().getValue());
    assertEquals("01", peerReviewSummary.getCompletionDate().getDay().getValue());
    assertNotNull(peerReviewSummary.getExternalIdentifiers());
    assertNotNull(peerReviewSummary.getExternalIdentifiers().getExternalIdentifier());
    assertEquals(1, peerReviewSummary.getExternalIdentifiers().getExternalIdentifier().size());
    assertEquals("peer-review:external-identifier-id", peerReviewSummary.getExternalIdentifiers().getExternalIdentifier().get(0).getValue());
    assertEquals("source-work-id", peerReviewSummary.getExternalIdentifiers().getExternalIdentifier().get(0).getType());
    assertNotNull(peerReviewSummary.getSource());
    assertEquals("APP-000000001", peerReviewSummary.getSource().retrieveSourcePath());
}
Also used : PeerReviewSummary(org.orcid.jaxb.model.record.summary_v2.PeerReviewSummary) PeerReviewEntity(org.orcid.persistence.jpa.entities.PeerReviewEntity) Test(org.junit.Test)

Example 77 with PeerReviewSummary

use of org.orcid.jaxb.model.record.summary_rc2.PeerReviewSummary in project ORCID-Source by ORCID.

the class PublicV2Test method checkPeerReview.

public void checkPeerReview(String readPublicToken) throws JSONException, InterruptedException, URISyntaxException {
    PeerReview peerReviewToCreate = (PeerReview) unmarshallFromPath("/record_2.0_rc1/samples/peer-review-2.0_rc1.xml", PeerReview.class);
    peerReviewToCreate.setPutCode(null);
    peerReviewToCreate.setGroupId(groupRecords.get(0).getGroupId());
    peerReviewToCreate.setVisibility(org.orcid.jaxb.model.common_rc1.Visibility.PUBLIC);
    String accessToken = getAccessToken();
    ClientResponse postResponse = memberV2ApiClient.createPeerReviewXml(getUser1OrcidId(), peerReviewToCreate, accessToken);
    assertNotNull(postResponse);
    assertEquals(Response.Status.CREATED.getStatusCode(), postResponse.getStatus());
    String path = postResponse.getLocation().getPath();
    String putCode = path.substring(path.lastIndexOf('/') + 1, path.length());
    ClientResponse getPeerReviewResponse = null;
    if (readPublicToken != null) {
        getPeerReviewResponse = publicV2ApiClient.viewPeerReviewXml(getUser1OrcidId(), putCode, readPublicToken);
    } else {
        getPeerReviewResponse = publicV2ApiClient.viewPeerReviewXml(getUser1OrcidId(), putCode);
    }
    assertNotNull(getPeerReviewResponse);
    checkResponse(getPeerReviewResponse);
    PeerReview peerReview = getPeerReviewResponse.getEntity(PeerReview.class);
    assertNotNull(peerReview);
    assertEquals("peer-review:url", peerReview.getUrl().getValue());
    ClientResponse getPeerReviewSummaryResponse = publicV2ApiClient.viewPeerReviewSummaryXml(getUser1OrcidId(), putCode);
    if (readPublicToken != null) {
        getPeerReviewSummaryResponse = publicV2ApiClient.viewPeerReviewSummaryXml(getUser1OrcidId(), putCode, readPublicToken);
    } else {
        getPeerReviewSummaryResponse = publicV2ApiClient.viewPeerReviewSummaryXml(getUser1OrcidId(), putCode);
    }
    assertNotNull(getPeerReviewSummaryResponse);
    checkResponse(getPeerReviewSummaryResponse);
    PeerReviewSummary summary = getPeerReviewSummaryResponse.getEntity(PeerReviewSummary.class);
    assertNotNull(summary);
    assertEquals("1848", summary.getCompletionDate().getYear().getValue());
}
Also used : ClientResponse(com.sun.jersey.api.client.ClientResponse) PeerReviewSummary(org.orcid.jaxb.model.record.summary_rc1.PeerReviewSummary) PeerReview(org.orcid.jaxb.model.record_rc1.PeerReview)

Aggregations

PeerReviewSummary (org.orcid.jaxb.model.record.summary_v2.PeerReviewSummary)64 Test (org.junit.Test)59 EducationSummary (org.orcid.jaxb.model.record.summary_v2.EducationSummary)43 EmploymentSummary (org.orcid.jaxb.model.record.summary_v2.EmploymentSummary)43 FundingSummary (org.orcid.jaxb.model.record.summary_v2.FundingSummary)43 WorkSummary (org.orcid.jaxb.model.record.summary_v2.WorkSummary)43 ActivitiesSummary (org.orcid.jaxb.model.record.summary_v2.ActivitiesSummary)37 ClientResponse (com.sun.jersey.api.client.ClientResponse)20 PeerReviewGroup (org.orcid.jaxb.model.record.summary_v2.PeerReviewGroup)17 PeerReviews (org.orcid.jaxb.model.record.summary_v2.PeerReviews)16 Address (org.orcid.jaxb.model.record_v2.Address)16 Email (org.orcid.jaxb.model.record_v2.Email)16 Keyword (org.orcid.jaxb.model.record_v2.Keyword)16 OtherName (org.orcid.jaxb.model.record_v2.OtherName)16 PersonExternalIdentifier (org.orcid.jaxb.model.record_v2.PersonExternalIdentifier)16 Record (org.orcid.jaxb.model.record_v2.Record)16 ResearcherUrl (org.orcid.jaxb.model.record_v2.ResearcherUrl)16 Addresses (org.orcid.jaxb.model.record_v2.Addresses)15 Biography (org.orcid.jaxb.model.record_v2.Biography)15 Emails (org.orcid.jaxb.model.record_v2.Emails)15