use of org.orcid.jaxb.model.record.summary_rc2.PeerReviewSummary in project ORCID-Source by ORCID.
the class JpaJaxbPeerReviewAdapterTest method fromPeerReviewEntityToPeerReviewSummary.
@Test
public void fromPeerReviewEntityToPeerReviewSummary() {
PeerReviewEntity entity = getPeerReviewEntity();
assertNotNull(entity);
PeerReviewSummary peerReviewSummary = jpaJaxbPeerReviewAdapter.toPeerReviewSummary(entity);
assertNotNull(peerReviewSummary);
assertEquals(Long.valueOf(12345), peerReviewSummary.getPutCode());
assertEquals("private", peerReviewSummary.getVisibility().value());
assertNotNull(peerReviewSummary.getCompletionDate());
assertEquals("2015", peerReviewSummary.getCompletionDate().getYear().getValue());
assertEquals("01", peerReviewSummary.getCompletionDate().getMonth().getValue());
assertEquals("01", peerReviewSummary.getCompletionDate().getDay().getValue());
assertNotNull(peerReviewSummary.getExternalIdentifiers());
assertNotNull(peerReviewSummary.getExternalIdentifiers().getExternalIdentifier());
assertEquals(1, peerReviewSummary.getExternalIdentifiers().getExternalIdentifier().size());
assertEquals("peer-review:external-identifier-id", peerReviewSummary.getExternalIdentifiers().getExternalIdentifier().get(0).getValue());
assertEquals("source-work-id", peerReviewSummary.getExternalIdentifiers().getExternalIdentifier().get(0).getType());
assertNotNull(peerReviewSummary.getSource());
assertEquals("APP-000000001", peerReviewSummary.getSource().retrieveSourcePath());
}
use of org.orcid.jaxb.model.record.summary_rc2.PeerReviewSummary in project ORCID-Source by ORCID.
the class PublicV2Test method checkPeerReview.
public void checkPeerReview(String readPublicToken) throws JSONException, InterruptedException, URISyntaxException {
PeerReview peerReviewToCreate = (PeerReview) unmarshallFromPath("/record_2.0_rc1/samples/peer-review-2.0_rc1.xml", PeerReview.class);
peerReviewToCreate.setPutCode(null);
peerReviewToCreate.setGroupId(groupRecords.get(0).getGroupId());
peerReviewToCreate.setVisibility(org.orcid.jaxb.model.common_rc1.Visibility.PUBLIC);
String accessToken = getAccessToken();
ClientResponse postResponse = memberV2ApiClient.createPeerReviewXml(getUser1OrcidId(), peerReviewToCreate, accessToken);
assertNotNull(postResponse);
assertEquals(Response.Status.CREATED.getStatusCode(), postResponse.getStatus());
String path = postResponse.getLocation().getPath();
String putCode = path.substring(path.lastIndexOf('/') + 1, path.length());
ClientResponse getPeerReviewResponse = null;
if (readPublicToken != null) {
getPeerReviewResponse = publicV2ApiClient.viewPeerReviewXml(getUser1OrcidId(), putCode, readPublicToken);
} else {
getPeerReviewResponse = publicV2ApiClient.viewPeerReviewXml(getUser1OrcidId(), putCode);
}
assertNotNull(getPeerReviewResponse);
checkResponse(getPeerReviewResponse);
PeerReview peerReview = getPeerReviewResponse.getEntity(PeerReview.class);
assertNotNull(peerReview);
assertEquals("peer-review:url", peerReview.getUrl().getValue());
ClientResponse getPeerReviewSummaryResponse = publicV2ApiClient.viewPeerReviewSummaryXml(getUser1OrcidId(), putCode);
if (readPublicToken != null) {
getPeerReviewSummaryResponse = publicV2ApiClient.viewPeerReviewSummaryXml(getUser1OrcidId(), putCode, readPublicToken);
} else {
getPeerReviewSummaryResponse = publicV2ApiClient.viewPeerReviewSummaryXml(getUser1OrcidId(), putCode);
}
assertNotNull(getPeerReviewSummaryResponse);
checkResponse(getPeerReviewSummaryResponse);
PeerReviewSummary summary = getPeerReviewSummaryResponse.getEntity(PeerReviewSummary.class);
assertNotNull(summary);
assertEquals("1848", summary.getCompletionDate().getYear().getValue());
}
Aggregations