Search in sources :

Example 86 with PeerReview

use of org.orcid.jaxb.model.record_v2.PeerReview in project ORCID-Source by ORCID.

the class JSONPeerReviewWorkExternalIdentifierConverterV2Test method testConvertTo.

@Test
public void testConvertTo() throws JAXBException {
    PeerReview peerReview = getPeerReview();
    assertEquals("{\"relationship\":\"SELF\",\"url\":{\"value\":\"http://orcid.org\"},\"workExternalIdentifierType\":\"DOI\",\"workExternalIdentifierId\":{\"content\":\"peer-review:subject-external-identifier-id\"}}", converter.convertTo(peerReview.getSubjectExternalIdentifier(), null));
}
Also used : PeerReview(org.orcid.jaxb.model.record_v2.PeerReview) Test(org.junit.Test)

Example 87 with PeerReview

use of org.orcid.jaxb.model.record_v2.PeerReview in project ORCID-Source by ORCID.

the class JSONPeerReviewWorkExternalIdentifierConverterV2Test method getPeerReview.

private PeerReview getPeerReview() throws JAXBException {
    JAXBContext context = JAXBContext.newInstance(new Class[] { PeerReview.class });
    Unmarshaller unmarshaller = context.createUnmarshaller();
    String name = "/record_2.0/samples/read_samples/peer-review-full-2.0.xml";
    InputStream inputStream = getClass().getResourceAsStream(name);
    return (PeerReview) unmarshaller.unmarshal(inputStream);
}
Also used : InputStream(java.io.InputStream) JAXBContext(javax.xml.bind.JAXBContext) Unmarshaller(javax.xml.bind.Unmarshaller) PeerReview(org.orcid.jaxb.model.record_v2.PeerReview)

Example 88 with PeerReview

use of org.orcid.jaxb.model.record_v2.PeerReview in project ORCID-Source by ORCID.

the class ActivityValidatorTest method validatePeerReview_validPeerReviewTest.

/**
 * VALIDATE PEER REVIEW
 */
@Test
public void validatePeerReview_validPeerReviewTest() {
    PeerReview pr = getPeerReview();
    activityValidator.validatePeerReview(pr, null, true, true, Visibility.PUBLIC);
}
Also used : PeerReview(org.orcid.jaxb.model.record_v2.PeerReview) Test(org.junit.Test)

Example 89 with PeerReview

use of org.orcid.jaxb.model.record_v2.PeerReview in project ORCID-Source by ORCID.

the class PeerReviewManagerTest method testGetAll.

@Test
public void testGetAll() {
    String orcid = "0000-0000-0000-0003";
    List<PeerReview> elements = peerReviewManager.findPeerReviews(orcid);
    boolean found1 = false, found2 = false, found3 = false, found4 = false, found5 = false;
    for (PeerReview element : elements) {
        if (9 == element.getPutCode()) {
            found1 = true;
        } else if (10 == element.getPutCode()) {
            found2 = true;
        } else if (11 == element.getPutCode()) {
            found3 = true;
        } else if (12 == element.getPutCode()) {
            found4 = true;
        } else if (13 == element.getPutCode()) {
            found5 = true;
        } else {
            fail("Invalid element found: " + element.getPutCode());
        }
    }
    assertTrue(found1);
    assertTrue(found2);
    assertTrue(found3);
    assertTrue(found4);
    assertTrue(found5);
}
Also used : PeerReview(org.orcid.jaxb.model.record_v2.PeerReview) Test(org.junit.Test) BaseTest(org.orcid.core.BaseTest)

Example 90 with PeerReview

use of org.orcid.jaxb.model.record_v2.PeerReview in project ORCID-Source by ORCID.

the class MemberV2ApiServiceDelegatorImpl method createPeerReview.

@Override
public Response createPeerReview(String orcid, PeerReview peerReview) {
    orcidSecurityManager.checkClientAccessAndScopes(orcid, ScopePathType.PEER_REVIEW_CREATE, ScopePathType.PEER_REVIEW_UPDATE);
    clearSource(peerReview);
    PeerReview newPeerReview = peerReviewManager.createPeerReview(orcid, peerReview, true);
    sourceUtils.setSourceName(newPeerReview);
    try {
        return Response.created(new URI(String.valueOf(newPeerReview.getPutCode()))).build();
    } catch (URISyntaxException ex) {
        throw new RuntimeException(localeManager.resolveMessage("apiError.createpeerreview_response.exception"), ex);
    }
}
Also used : URISyntaxException(java.net.URISyntaxException) URI(java.net.URI) PeerReview(org.orcid.jaxb.model.record_v2.PeerReview)

Aggregations

Test (org.junit.Test)74 PeerReview (org.orcid.jaxb.model.record_v2.PeerReview)66 ClientResponse (com.sun.jersey.api.client.ClientResponse)35 Response (javax.ws.rs.core.Response)18 ExternalID (org.orcid.jaxb.model.record_v2.ExternalID)18 DBUnitTest (org.orcid.test.DBUnitTest)18 ResearcherUrl (org.orcid.jaxb.model.record_v2.ResearcherUrl)11 Url (org.orcid.jaxb.model.common_v2.Url)10 Funding (org.orcid.jaxb.model.record_v2.Funding)10 PeerReviewEntity (org.orcid.persistence.jpa.entities.PeerReviewEntity)10 PeerReview (org.orcid.jaxb.model.record_rc1.PeerReview)9 Education (org.orcid.jaxb.model.record_v2.Education)9 Work (org.orcid.jaxb.model.record_v2.Work)9 OtherName (org.orcid.jaxb.model.record_v2.OtherName)8 SourceEntity (org.orcid.persistence.jpa.entities.SourceEntity)8 ArrayList (java.util.ArrayList)7 BaseTest (org.orcid.core.BaseTest)6 WorkExternalIdentifier (org.orcid.jaxb.model.record_rc1.WorkExternalIdentifier)6 WorkExternalIdentifierId (org.orcid.jaxb.model.record_rc1.WorkExternalIdentifierId)6 PeerReview (org.orcid.jaxb.model.record_rc3.PeerReview)6