Search in sources :

Example 26 with PeerReview

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

the class MemberV2ApiServiceDelegator_PeerReviewsTest method testUpdatePeerReviewChangingVisibilityTest.

@Test(expected = VisibilityMismatchException.class)
public void testUpdatePeerReviewChangingVisibilityTest() {
    SecurityContextTestUtils.setUpSecurityContext("4444-4444-4444-4447", ScopePathType.ACTIVITIES_UPDATE);
    Response response = serviceDelegator.viewPeerReview("4444-4444-4444-4447", 6L);
    assertNotNull(response);
    PeerReview peerReview = (PeerReview) response.getEntity();
    assertNotNull(peerReview);
    assertEquals(Visibility.PUBLIC, peerReview.getVisibility());
    peerReview.setVisibility(Visibility.PRIVATE);
    response = serviceDelegator.updatePeerReview("4444-4444-4444-4447", 6L, peerReview);
    fail();
}
Also used : Response(javax.ws.rs.core.Response) PeerReview(org.orcid.jaxb.model.record_v2.PeerReview) DBUnitTest(org.orcid.test.DBUnitTest) Test(org.junit.Test)

Example 27 with PeerReview

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

the class MemberV2ApiServiceDelegator_PeerReviewsTest method testUpdatePeerReviewWhenYouAreNotTheSourceOf.

@Test
public void testUpdatePeerReviewWhenYouAreNotTheSourceOf() {
    SecurityContextTestUtils.setUpSecurityContext("4444-4444-4444-4447", ScopePathType.READ_LIMITED, ScopePathType.ACTIVITIES_UPDATE);
    Response response = serviceDelegator.viewPeerReview("4444-4444-4444-4447", 2L);
    assertNotNull(response);
    PeerReview peerReview = (PeerReview) response.getEntity();
    assertNotNull(peerReview);
    assertEquals("http://peer_review.com/2", peerReview.getUrl().getValue());
    assertEquals("APP-6666666666666666", peerReview.getSource().retrieveSourcePath());
    // Update the info
    peerReview.setUrl(new Url("http://updated.com/url"));
    peerReview.getSubjectName().getTitle().setContent("Updated Title");
    peerReview.getExternalIdentifiers().getExternalIdentifier().iterator().next().setValue("different");
    try {
        response = serviceDelegator.updatePeerReview("4444-4444-4444-4447", 2L, peerReview);
        fail();
    } catch (WrongSourceException wse) {
    }
    response = serviceDelegator.viewPeerReview("4444-4444-4444-4447", Long.valueOf(2));
    peerReview = (PeerReview) response.getEntity();
    assertNotNull(peerReview);
    assertEquals("http://peer_review.com/2", peerReview.getUrl().getValue());
    assertEquals("APP-6666666666666666", peerReview.getSource().retrieveSourcePath());
}
Also used : Response(javax.ws.rs.core.Response) WrongSourceException(org.orcid.core.exception.WrongSourceException) PeerReview(org.orcid.jaxb.model.record_v2.PeerReview) Url(org.orcid.jaxb.model.common_v2.Url) ResearcherUrl(org.orcid.jaxb.model.record_v2.ResearcherUrl) DBUnitTest(org.orcid.test.DBUnitTest) Test(org.junit.Test)

Example 28 with PeerReview

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

the class ActivityValidatorTest method getPeerReview.

public PeerReview getPeerReview() {
    PeerReview peerReview = new PeerReview();
    peerReview.setCompletionDate(getFuzzyDate());
    peerReview.setExternalIdentifiers(getExternalIDs());
    peerReview.setGroupId("group-id");
    peerReview.setOrganization(getOrganization());
    peerReview.setRole(Role.CHAIR);
    peerReview.setSubjectContainerName(new Title("subject-container-name"));
    peerReview.setSubjectExternalIdentifier(getExternalID());
    peerReview.setSubjectName(getWorkTitle());
    peerReview.setSubjectType(WorkType.ARTISTIC_PERFORMANCE);
    peerReview.setSubjectUrl(new Url("http://test.orcid.org"));
    peerReview.setType(PeerReviewType.EVALUATION);
    peerReview.setUrl(new Url("http://test.orcid.org"));
    peerReview.setVisibility(Visibility.PUBLIC);
    return peerReview;
}
Also used : WorkTitle(org.orcid.jaxb.model.record_v2.WorkTitle) TranslatedTitle(org.orcid.jaxb.model.common_v2.TranslatedTitle) FundingTitle(org.orcid.jaxb.model.record_v2.FundingTitle) Title(org.orcid.jaxb.model.common_v2.Title) PeerReview(org.orcid.jaxb.model.record_v2.PeerReview) Url(org.orcid.jaxb.model.common_v2.Url)

Example 29 with PeerReview

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

the class ActivityValidatorTest method validatePeerReview_invalidPeerReviewTypeTest.

@Test(expected = ActivityTypeValidationException.class)
public void validatePeerReview_invalidPeerReviewTypeTest() {
    PeerReview pr = getPeerReview();
    pr.setType(null);
    activityValidator.validatePeerReview(pr, null, true, true, Visibility.PUBLIC);
}
Also used : PeerReview(org.orcid.jaxb.model.record_v2.PeerReview) Test(org.junit.Test)

Example 30 with PeerReview

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

the class ActivityValidatorTest method validatePeerReview_emptyExternalIdentifierValueTest.

@Test(expected = ActivityIdentifierValidationException.class)
public void validatePeerReview_emptyExternalIdentifierValueTest() {
    PeerReview pr = getPeerReview();
    pr.getExternalIdentifiers().getExternalIdentifier().get(0).setValue("");
    activityValidator.validatePeerReview(pr, null, true, true, Visibility.PUBLIC);
}
Also used : PeerReview(org.orcid.jaxb.model.record_v2.PeerReview) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)72 PeerReview (org.orcid.jaxb.model.record_v2.PeerReview)66 ClientResponse (com.sun.jersey.api.client.ClientResponse)35 Response (javax.ws.rs.core.Response)17 DBUnitTest (org.orcid.test.DBUnitTest)17 ExternalID (org.orcid.jaxb.model.record_v2.ExternalID)16 Url (org.orcid.jaxb.model.common_v2.Url)10 SourceEntity (org.orcid.persistence.jpa.entities.SourceEntity)10 PeerReview (org.orcid.jaxb.model.record_rc1.PeerReview)9 PeerReviewEntity (org.orcid.persistence.jpa.entities.PeerReviewEntity)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 PeerReview (org.orcid.jaxb.model.record_rc4.PeerReview)6 Funding (org.orcid.jaxb.model.record_v2.Funding)6 ResearcherUrl (org.orcid.jaxb.model.record_v2.ResearcherUrl)6 Title (org.orcid.jaxb.model.common_v2.Title)5 Education (org.orcid.jaxb.model.record_v2.Education)5