Search in sources :

Example 66 with PeerReview

use of org.orcid.jaxb.model.v3.dev1.record.PeerReview in project ORCID-Source by ORCID.

the class ActivityValidatorTest method validatePeerReviewWithoutOrg.

@Test(expected = InvalidOrgException.class)
public void validatePeerReviewWithoutOrg() {
    PeerReview pr = getPeerReview();
    pr.setOrganization(null);
    activityValidator.validatePeerReview(pr, null, false, true, Visibility.PUBLIC);
}
Also used : PeerReview(org.orcid.jaxb.model.v3.dev1.record.PeerReview) Test(org.junit.Test)

Example 67 with PeerReview

use of org.orcid.jaxb.model.v3.dev1.record.PeerReview in project ORCID-Source by ORCID.

the class ActivityValidatorTest method validatePeerReview_dontChangeVisibilityTest.

@Test(expected = VisibilityMismatchException.class)
public void validatePeerReview_dontChangeVisibilityTest() {
    PeerReview pr = getPeerReview();
    pr.setVisibility(Visibility.LIMITED);
    activityValidator.validatePeerReview(pr, null, false, true, Visibility.PUBLIC);
}
Also used : PeerReview(org.orcid.jaxb.model.v3.dev1.record.PeerReview) Test(org.junit.Test)

Example 68 with PeerReview

use of org.orcid.jaxb.model.v3.dev1.record.PeerReview in project ORCID-Source by ORCID.

the class ActivityValidatorTest method validatePeerReview_invalidPutCodeTest.

@Test(expected = InvalidPutCodeException.class)
public void validatePeerReview_invalidPutCodeTest() {
    SourceEntity source = mock(SourceEntity.class);
    when(source.getSourceName()).thenReturn("source name");
    PeerReview pr = getPeerReview();
    pr.setPutCode(1L);
    activityValidator.validatePeerReview(pr, source, true, true, Visibility.PUBLIC);
}
Also used : SourceEntity(org.orcid.persistence.jpa.entities.SourceEntity) PeerReview(org.orcid.jaxb.model.v3.dev1.record.PeerReview) Test(org.junit.Test)

Example 69 with PeerReview

use of org.orcid.jaxb.model.v3.dev1.record.PeerReview in project ORCID-Source by ORCID.

the class ActivityValidatorTest method validatePeerReview_invalidSubjectExternalIdentifiersTest.

@Test(expected = ActivityIdentifierValidationException.class)
public void validatePeerReview_invalidSubjectExternalIdentifiersTest() {
    PeerReview pr = getPeerReview();
    pr.getSubjectExternalIdentifier().setType(null);
    activityValidator.validatePeerReview(pr, null, true, true, Visibility.PUBLIC);
}
Also used : PeerReview(org.orcid.jaxb.model.v3.dev1.record.PeerReview) Test(org.junit.Test)

Example 70 with PeerReview

use of org.orcid.jaxb.model.v3.dev1.record.PeerReview in project ORCID-Source by ORCID.

the class MemberV3ApiServiceDelegatorImpl 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.v3.dev1.record.PeerReview)

Aggregations

PeerReview (org.orcid.jaxb.model.v3.dev1.record.PeerReview)66 Test (org.junit.Test)49 Response (javax.ws.rs.core.Response)20 DBUnitTest (org.orcid.test.DBUnitTest)20 ExternalID (org.orcid.jaxb.model.v3.dev1.record.ExternalID)12 PeerReviewEntity (org.orcid.persistence.jpa.entities.PeerReviewEntity)9 SourceEntity (org.orcid.persistence.jpa.entities.SourceEntity)9 Url (org.orcid.jaxb.model.v3.dev1.common.Url)8 Funding (org.orcid.jaxb.model.v3.dev1.record.Funding)8 ResearcherUrl (org.orcid.jaxb.model.v3.dev1.record.ResearcherUrl)8 Work (org.orcid.jaxb.model.v3.dev1.record.Work)7 BaseTest (org.orcid.core.BaseTest)6 Title (org.orcid.jaxb.model.v3.dev1.common.Title)6 Education (org.orcid.jaxb.model.v3.dev1.record.Education)6 WorkTitle (org.orcid.jaxb.model.v3.dev1.record.WorkTitle)6 PeerReviewSummary (org.orcid.jaxb.model.v3.dev1.record.summary.PeerReviewSummary)6 ArrayList (java.util.ArrayList)5 Day (org.orcid.jaxb.model.v3.dev1.common.Day)5 Month (org.orcid.jaxb.model.v3.dev1.common.Month)5 Year (org.orcid.jaxb.model.v3.dev1.common.Year)5