use of org.orcid.jaxb.model.v3.dev1.record.PeerReview in project ORCID-Source by ORCID.
the class MemberV3ApiServiceDelegator_PeerReviewsTest method testViewPeerReviewReadPublic.
@Test
public void testViewPeerReviewReadPublic() {
SecurityContextTestUtils.setUpSecurityContextForClientOnly("APP-5555555555555555", ScopePathType.READ_PUBLIC);
Response r = serviceDelegator.viewPeerReview("4444-4444-4444-4447", 2L);
PeerReview element = (PeerReview) r.getEntity();
assertNotNull(element);
assertEquals("/4444-4444-4444-4447/peer-review/2", element.getPath());
Utils.assertIsPublicOrSource(element, "APP-5555555555555555");
}
use of org.orcid.jaxb.model.v3.dev1.record.PeerReview in project ORCID-Source by ORCID.
the class MemberV3ApiServiceDelegator_PeerReviewsTest method testViewPublicPeerReview.
@Test
public void testViewPublicPeerReview() {
SecurityContextTestUtils.setUpSecurityContext("4444-4444-4444-4446", ScopePathType.READ_LIMITED);
Response response = serviceDelegator.viewPeerReview("4444-4444-4444-4446", 1L);
assertNotNull(response);
PeerReview peerReview = (PeerReview) response.getEntity();
assertNotNull(peerReview);
assertEquals("/4444-4444-4444-4446/peer-review/1", peerReview.getPath());
Utils.verifyLastModified(peerReview.getLastModifiedDate());
assertEquals(Long.valueOf(1L), peerReview.getPutCode());
assertNotNull(peerReview.getCompletionDate());
assertEquals("01", peerReview.getCompletionDate().getDay().getValue());
assertEquals("01", peerReview.getCompletionDate().getMonth().getValue());
assertEquals("2015", peerReview.getCompletionDate().getYear().getValue());
assertEquals("work:external-identifier-id#1", peerReview.getExternalIdentifiers().getExternalIdentifier().get(0).getValue());
assertEquals("reviewer", peerReview.getRole().value());
assertEquals("APP-5555555555555555", peerReview.getSource().retrieveSourcePath());
assertEquals("public", peerReview.getVisibility().value());
assertEquals("review", peerReview.getType().value());
assertEquals("http://peer_review.com", peerReview.getUrl().getValue());
assertEquals("Peer Review # 1", peerReview.getSubjectName().getTitle().getContent());
assertEquals("es", peerReview.getSubjectName().getTranslatedTitle().getLanguageCode());
assertEquals("artistic-performance", peerReview.getSubjectType().value());
assertEquals("http://work.com", peerReview.getSubjectUrl().getValue());
assertEquals("Peer Review # 1 container name", peerReview.getSubjectContainerName().getContent());
assertEquals("peer-review:subject-external-identifier-id#1", peerReview.getSubjectExternalIdentifier().getValue());
assertEquals("agr", peerReview.getSubjectExternalIdentifier().getType());
assertEquals("issn:0000001", peerReview.getGroupId());
}
use of org.orcid.jaxb.model.v3.dev1.record.PeerReview in project ORCID-Source by ORCID.
the class MemberV3ApiServiceDelegator_PeerReviewsTest method testAddPeerReview.
@Test
public void testAddPeerReview() {
SecurityContextTestUtils.setUpSecurityContext("4444-4444-4444-4444", ScopePathType.READ_LIMITED, ScopePathType.ACTIVITIES_UPDATE);
Response response = serviceDelegator.viewActivities("4444-4444-4444-4444");
assertNotNull(response);
ActivitiesSummary summary = (ActivitiesSummary) response.getEntity();
assertNotNull(summary);
assertNotNull(summary.getPeerReviews());
assertNotNull(summary.getPeerReviews().getPeerReviewGroup());
assertEquals(1, summary.getPeerReviews().getPeerReviewGroup().size());
assertNotNull(summary.getPeerReviews().getPeerReviewGroup().get(0));
assertNotNull(summary.getPeerReviews().getPeerReviewGroup().get(0).getPeerReviewSummary());
assertNotNull(summary.getPeerReviews().getPeerReviewGroup().get(0).getPeerReviewSummary().get(0));
assertEquals("issn:0000001", summary.getPeerReviews().getPeerReviewGroup().get(0).getPeerReviewSummary().get(0).getGroupId());
PeerReview peerReview = Utils.getPeerReview();
response = serviceDelegator.createPeerReview("4444-4444-4444-4444", peerReview);
assertNotNull(response);
assertEquals(Response.Status.CREATED.getStatusCode(), response.getStatus());
Map<?, ?> map = response.getMetadata();
assertNotNull(map);
assertTrue(map.containsKey("Location"));
List<?> resultWithPutCode = (List<?>) map.get("Location");
Long putCode = Long.valueOf(String.valueOf(resultWithPutCode.get(0)));
response = serviceDelegator.viewActivities("4444-4444-4444-4444");
assertNotNull(response);
summary = (ActivitiesSummary) response.getEntity();
assertNotNull(summary);
Utils.verifyLastModified(summary.getLastModifiedDate());
assertNotNull(summary.getPeerReviews());
Utils.verifyLastModified(summary.getLastModifiedDate());
assertNotNull(summary.getPeerReviews().getPeerReviewGroup());
assertEquals(2, summary.getPeerReviews().getPeerReviewGroup().size());
boolean haveOld = false;
boolean haveNew = false;
for (PeerReviewGroup group : summary.getPeerReviews().getPeerReviewGroup()) {
Utils.verifyLastModified(group.getLastModifiedDate());
Utils.verifyLastModified(group.getPeerReviewSummary().get(0).getLastModifiedDate());
if ("issn:0000001".equals(group.getPeerReviewSummary().get(0).getGroupId())) {
haveOld = true;
} else {
assertEquals("issn:0000003", group.getPeerReviewSummary().get(0).getGroupId());
haveNew = true;
}
}
assertTrue(haveOld);
assertTrue(haveNew);
// Delete the new so it doesn't affect other tests
serviceDelegator.deletePeerReview("4444-4444-4444-4444", putCode);
}
use of org.orcid.jaxb.model.v3.dev1.record.PeerReview in project ORCID-Source by ORCID.
the class MemberV3ApiServiceDelegator_PeerReviewsTest method testViewLimitedPeerReview.
@Test
public void testViewLimitedPeerReview() {
SecurityContextTestUtils.setUpSecurityContext("4444-4444-4444-4446", ScopePathType.READ_LIMITED);
Response response = serviceDelegator.viewPeerReview("4444-4444-4444-4446", 3L);
assertNotNull(response);
PeerReview peerReview = (PeerReview) response.getEntity();
assertNotNull(peerReview);
assertEquals("/4444-4444-4444-4446/peer-review/3", peerReview.getPath());
Utils.verifyLastModified(peerReview.getLastModifiedDate());
assertEquals(Long.valueOf(3L), peerReview.getPutCode());
assertNotNull(peerReview.getCompletionDate());
assertEquals("01", peerReview.getCompletionDate().getDay().getValue());
assertEquals("01", peerReview.getCompletionDate().getMonth().getValue());
assertEquals("2015", peerReview.getCompletionDate().getYear().getValue());
assertEquals("work:external-identifier-id#2", peerReview.getExternalIdentifiers().getExternalIdentifier().get(0).getValue());
assertEquals("limited", peerReview.getVisibility().value());
assertEquals("issn:0000002", peerReview.getGroupId());
}
use of org.orcid.jaxb.model.v3.dev1.record.PeerReview in project ORCID-Source by ORCID.
the class MemberV3ApiServiceDelegator_PeerReviewsTest method testAddPeerReviewWithSameExtIdValueButDifferentExtIdType.
@Test
public void testAddPeerReviewWithSameExtIdValueButDifferentExtIdType() {
SecurityContextTestUtils.setUpSecurityContext("4444-4444-4444-4444", ScopePathType.READ_LIMITED, ScopePathType.ACTIVITIES_UPDATE);
PeerReview peerReview1 = new PeerReview();
ExternalIDs weis1 = new ExternalIDs();
ExternalID wei1 = new ExternalID();
wei1.setRelationship(null);
wei1.setValue("same_but_different_type");
wei1.setType(WorkExternalIdentifierType.DOI.value());
weis1.getExternalIdentifier().add(wei1);
peerReview1.setExternalIdentifiers(weis1);
peerReview1.setGroupId("issn:0000003");
peerReview1.setOrganization(Utils.getOrganization());
peerReview1.setRole(Role.CHAIR);
peerReview1.setSubjectContainerName(new Title("subject-container-name"));
peerReview1.setSubjectExternalIdentifier(wei1);
WorkTitle workTitle1 = new WorkTitle();
workTitle1.setTitle(new Title("work-title"));
peerReview1.setSubjectName(workTitle1);
peerReview1.setSubjectType(WorkType.DATA_SET);
peerReview1.setType(PeerReviewType.EVALUATION);
Response response1 = serviceDelegator.createPeerReview("4444-4444-4444-4444", peerReview1);
assertNotNull(response1);
assertEquals(Response.Status.CREATED.getStatusCode(), response1.getStatus());
Map<?, ?> map = response1.getMetadata();
assertNotNull(map);
assertTrue(map.containsKey("Location"));
List<?> resultWithPutCode = (List<?>) map.get("Location");
Long putCode1 = Long.valueOf(String.valueOf(resultWithPutCode.get(0)));
PeerReview peerReview2 = new PeerReview();
ExternalIDs weis2 = new ExternalIDs();
ExternalID wei2 = new ExternalID();
wei2.setRelationship(null);
// Same value
wei2.setValue("same_but_different_type");
// But different
wei2.setType(WorkExternalIdentifierType.ARXIV.value());
// type
weis2.getExternalIdentifier().add(wei2);
peerReview2.setExternalIdentifiers(weis2);
peerReview2.setGroupId("issn:0000003");
peerReview2.setOrganization(Utils.getOrganization());
peerReview2.setRole(Role.CHAIR);
peerReview2.setSubjectContainerName(new Title("subject-container-name"));
peerReview2.setSubjectExternalIdentifier(wei2);
WorkTitle workTitle2 = new WorkTitle();
workTitle2.setTitle(new Title("work-title"));
peerReview2.setSubjectName(workTitle2);
peerReview2.setSubjectType(WorkType.DATA_SET);
peerReview2.setType(PeerReviewType.EVALUATION);
Response response2 = serviceDelegator.createPeerReview("4444-4444-4444-4444", peerReview2);
assertNotNull(response2);
assertEquals(Response.Status.CREATED.getStatusCode(), response2.getStatus());
map = response2.getMetadata();
assertNotNull(map);
assertTrue(map.containsKey("Location"));
resultWithPutCode = (List<?>) map.get("Location");
Long putCode2 = Long.valueOf(String.valueOf(resultWithPutCode.get(0)));
// Delete new peer reviews so they don't affect other tests
serviceDelegator.deletePeerReview("4444-4444-4444-4444", putCode1);
serviceDelegator.deletePeerReview("4444-4444-4444-4444", putCode2);
}
Aggregations