use of org.orcid.jaxb.model.record_rc2.PeerReview in project ORCID-Source by ORCID.
the class MemberV2_1Test method testPeerReviewMustHaveAtLeastOneExtId.
@Test
public void testPeerReviewMustHaveAtLeastOneExtId() throws JSONException, InterruptedException, URISyntaxException {
PeerReview peerReview = (PeerReview) unmarshallFromPath("/record_2.1/samples/read_samples/peer-review-2.1.xml", PeerReview.class);
peerReview.setPutCode(null);
peerReview.setGroupId(groupRecords.get(0).getGroupId());
peerReview.getExternalIdentifiers().getExternalIdentifier().clear();
String accessToken = getAccessToken();
ClientResponse postResponse = memberV2_1ApiClient.createPeerReviewXml(this.getUser1OrcidId(), peerReview, accessToken);
assertNotNull(postResponse);
assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), postResponse.getStatus());
}
use of org.orcid.jaxb.model.record_rc2.PeerReview in project ORCID-Source by ORCID.
the class PublicV2ApiServiceDelegatorTest method testViewPeerReview.
@Test
public void testViewPeerReview() {
Response response = serviceDelegator.viewPeerReview(ORCID, 9L);
assertNotNull(response);
PeerReview peerReview = (PeerReview) response.getEntity();
assertNotNull(peerReview);
assertEquals("/0000-0000-0000-0003/peer-review/9", peerReview.getPath());
assertNotNull(peerReview.getLastModifiedDate());
assertNotNull(peerReview.getLastModifiedDate().getValue());
assertEquals(Long.valueOf(9), peerReview.getPutCode());
assertEquals("02", peerReview.getCompletionDate().getDay().getValue());
assertEquals("02", peerReview.getCompletionDate().getMonth().getValue());
assertEquals("2016", peerReview.getCompletionDate().getYear().getValue());
assertNotNull(peerReview.getExternalIdentifiers());
assertNotNull(peerReview.getExternalIdentifiers().getExternalIdentifier());
assertEquals(1, peerReview.getExternalIdentifiers().getExternalIdentifier().size());
assertEquals("work:external-identifier-id#1", peerReview.getExternalIdentifiers().getExternalIdentifier().get(0).getValue());
assertEquals(Visibility.PUBLIC.value(), peerReview.getVisibility().value());
assertEquals("APP-5555555555555555", peerReview.getSource().retrieveSourcePath());
}
use of org.orcid.jaxb.model.record_rc2.PeerReview in project ORCID-Source by ORCID.
the class PublicV2ApiServiceDelegatorTest method testGetPublicPeerReviewUsingToken.
// Peer review
@Test
public void testGetPublicPeerReviewUsingToken() {
SecurityContextTestUtils.setUpSecurityContext(ORCID, ScopePathType.READ_LIMITED);
Response r = serviceDelegator.viewPeerReview(ORCID, 9L);
assertNotNull(r);
PeerReview p = (PeerReview) r.getEntity();
assertNotNull(p);
assertNotNull(p.getLastModifiedDate());
assertNotNull(p.getLastModifiedDate().getValue());
assertEquals(Long.valueOf(9), p.getPutCode());
}
use of org.orcid.jaxb.model.record_rc2.PeerReview in project ORCID-Source by ORCID.
the class MemberV2ApiServiceDelegator_PeerReviewsTest method testDeletePeerReview.
@Test
public void testDeletePeerReview() {
SecurityContextTestUtils.setUpSecurityContext("4444-4444-4444-4443", ScopePathType.READ_LIMITED, ScopePathType.ACTIVITIES_UPDATE);
Response response = serviceDelegator.viewPeerReview("4444-4444-4444-4443", 8L);
assertNotNull(response);
PeerReview review = (PeerReview) response.getEntity();
assertNotNull(review);
assertNotNull(review.getSubjectName());
assertNotNull(review.getSubjectName().getTitle());
assertEquals("Peer Review # 3", review.getSubjectName().getTitle().getContent());
response = serviceDelegator.deletePeerReview("4444-4444-4444-4443", 8L);
assertNotNull(response);
assertEquals(Response.Status.NO_CONTENT.getStatusCode(), response.getStatus());
}
use of org.orcid.jaxb.model.record_rc2.PeerReview in project ORCID-Source by ORCID.
the class MemberV2ApiServiceDelegator_PeerReviewsTest method testUpdatePeerReview.
@Test
public void testUpdatePeerReview() {
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);
Utils.verifyLastModified(peerReview.getLastModifiedDate());
LastModifiedDate before = peerReview.getLastModifiedDate();
peerReview.setUrl(new Url("http://updated.com/url"));
peerReview.getSubjectName().getTitle().setContent("Updated Title");
response = serviceDelegator.updatePeerReview("4444-4444-4444-4447", 6L, peerReview);
assertNotNull(response);
assertEquals(Response.Status.OK.getStatusCode(), response.getStatus());
response = serviceDelegator.viewPeerReview("4444-4444-4444-4447", 6L);
PeerReview updatedPeerReview = (PeerReview) response.getEntity();
assertNotNull(updatedPeerReview);
Utils.verifyLastModified(updatedPeerReview.getLastModifiedDate());
assertTrue(updatedPeerReview.getLastModifiedDate().after(before));
assertEquals("http://updated.com/url", updatedPeerReview.getUrl().getValue());
assertEquals("Updated Title", updatedPeerReview.getSubjectName().getTitle().getContent());
}
Aggregations