use of org.orcid.jaxb.model.record_v2.PeerReview in project ORCID-Source by ORCID.
the class JSONPeerReviewWorkExternalIdentifierConverterV2Test method testConvertTo.
@Test
public void testConvertTo() throws JAXBException {
PeerReview peerReview = getPeerReview();
assertEquals("{\"relationship\":\"SELF\",\"url\":{\"value\":\"http://orcid.org\"},\"workExternalIdentifierType\":\"DOI\",\"workExternalIdentifierId\":{\"content\":\"peer-review:subject-external-identifier-id\"}}", converter.convertTo(peerReview.getSubjectExternalIdentifier(), null));
}
use of org.orcid.jaxb.model.record_v2.PeerReview in project ORCID-Source by ORCID.
the class JSONPeerReviewWorkExternalIdentifierConverterV2Test method getPeerReview.
private PeerReview getPeerReview() throws JAXBException {
JAXBContext context = JAXBContext.newInstance(new Class[] { PeerReview.class });
Unmarshaller unmarshaller = context.createUnmarshaller();
String name = "/record_2.0/samples/read_samples/peer-review-full-2.0.xml";
InputStream inputStream = getClass().getResourceAsStream(name);
return (PeerReview) unmarshaller.unmarshal(inputStream);
}
use of org.orcid.jaxb.model.record_v2.PeerReview in project ORCID-Source by ORCID.
the class ActivityValidatorTest method validatePeerReview_validPeerReviewTest.
/**
* VALIDATE PEER REVIEW
*/
@Test
public void validatePeerReview_validPeerReviewTest() {
PeerReview pr = getPeerReview();
activityValidator.validatePeerReview(pr, null, true, true, Visibility.PUBLIC);
}
use of org.orcid.jaxb.model.record_v2.PeerReview in project ORCID-Source by ORCID.
the class PeerReviewManagerTest method testGetAll.
@Test
public void testGetAll() {
String orcid = "0000-0000-0000-0003";
List<PeerReview> elements = peerReviewManager.findPeerReviews(orcid);
boolean found1 = false, found2 = false, found3 = false, found4 = false, found5 = false;
for (PeerReview element : elements) {
if (9 == element.getPutCode()) {
found1 = true;
} else if (10 == element.getPutCode()) {
found2 = true;
} else if (11 == element.getPutCode()) {
found3 = true;
} else if (12 == element.getPutCode()) {
found4 = true;
} else if (13 == element.getPutCode()) {
found5 = true;
} else {
fail("Invalid element found: " + element.getPutCode());
}
}
assertTrue(found1);
assertTrue(found2);
assertTrue(found3);
assertTrue(found4);
assertTrue(found5);
}
use of org.orcid.jaxb.model.record_v2.PeerReview in project ORCID-Source by ORCID.
the class MemberV2ApiServiceDelegatorImpl 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);
}
}
Aggregations