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();
}
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());
}
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;
}
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);
}
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);
}
Aggregations