use of org.orcid.jaxb.model.record_v2.PeerReview in project ORCID-Source by ORCID.
the class PeerReviewManagerTest method testAddPeerReviewToUnclaimedRecordPreservePeerReviewVisibility.
@Test
public void testAddPeerReviewToUnclaimedRecordPreservePeerReviewVisibility() {
when(sourceManager.retrieveSourceEntity()).thenReturn(new SourceEntity(new ClientDetailsEntity(CLIENT_1_ID)));
PeerReview peer = getPeerReview(null);
peer = peerReviewManager.createPeerReview(unclaimedOrcid, peer, true);
peer = peerReviewManager.getPeerReview(unclaimedOrcid, peer.getPutCode());
assertNotNull(peer);
assertEquals(Visibility.PUBLIC, peer.getVisibility());
}
use of org.orcid.jaxb.model.record_v2.PeerReview in project ORCID-Source by ORCID.
the class PeerReviewManagerTest method displayIndexIsSetTo_0_FromAPI.
@Test
public void displayIndexIsSetTo_0_FromAPI() {
when(sourceManager.retrieveSourceEntity()).thenReturn(new SourceEntity(new ClientDetailsEntity(CLIENT_1_ID)));
PeerReview p1 = getPeerReview("fromAPI-1");
p1 = peerReviewManager.createPeerReview(claimedOrcid, p1, true);
PeerReviewEntity p = peerReviewDao.find(p1.getPutCode());
assertNotNull(91);
assertEquals(Long.valueOf(0), p.getDisplayIndex());
}
use of org.orcid.jaxb.model.record_v2.PeerReview in project ORCID-Source by ORCID.
the class PeerReviewManagerTest method getPeerReview.
private PeerReview getPeerReview(String extIdValue) {
PeerReview peerReview = new PeerReview();
peerReview.setRole(Role.CHAIR);
ExternalIDs extIds = new ExternalIDs();
ExternalID extId = new ExternalID();
extId.setRelationship(Relationship.SELF);
extId.setType("doi");
extId.setUrl(new Url("http://orcid.org"));
if (extIdValue == null) {
extId.setValue("ext-id-value");
} else {
extId.setValue("ext-id-value-" + extIdValue);
}
extIds.getExternalIdentifier().add(extId);
peerReview.setExternalIdentifiers(extIds);
if (extIdValue == null) {
peerReview.setSubjectContainerName(new Title("Peer review title"));
} else {
peerReview.setSubjectContainerName(new Title("Peer review title " + extIdValue));
}
peerReview.setSubjectExternalIdentifier(extId);
Organization org = new Organization();
org.setName("org-name");
OrganizationAddress address = new OrganizationAddress();
address.setCity("city");
address.setCountry(Iso3166Country.US);
org.setAddress(address);
peerReview.setOrganization(org);
peerReview.setType(PeerReviewType.EVALUATION);
peerReview.setVisibility(Visibility.PUBLIC);
return peerReview;
}
use of org.orcid.jaxb.model.record_v2.PeerReview in project ORCID-Source by ORCID.
the class PeerReviewManagerTest method testAddMultipleModifiesIndexingStatus.
@Test
public void testAddMultipleModifiesIndexingStatus() {
when(sourceManager.retrieveSourceEntity()).thenReturn(new SourceEntity(new ClientDetailsEntity(CLIENT_1_ID)));
PeerReview p1 = getPeerReview("extId1");
p1 = peerReviewManager.createPeerReview(claimedOrcid, p1, true);
PeerReview p2 = getPeerReview("extId2");
p2 = peerReviewManager.createPeerReview(claimedOrcid, p2, true);
PeerReview p3 = getPeerReview("extId3");
p3 = peerReviewManager.createPeerReview(claimedOrcid, p3, true);
PeerReviewEntity entity1 = peerReviewDao.find(p1.getPutCode());
PeerReviewEntity entity2 = peerReviewDao.find(p2.getPutCode());
PeerReviewEntity entity3 = peerReviewDao.find(p3.getPutCode());
assertNotNull(entity1.getDisplayIndex());
assertNotNull(entity2.getDisplayIndex());
assertNotNull(entity3.getDisplayIndex());
assertEquals(Long.valueOf(0), entity3.getDisplayIndex());
//Rollback all changes
peerReviewDao.remove(entity1.getId());
peerReviewDao.remove(entity2.getId());
peerReviewDao.remove(entity3.getId());
}
use of org.orcid.jaxb.model.record_v2.PeerReview in project ORCID-Source by ORCID.
the class ActivityValidatorTest method validatePeerReview_invalidExternalIdentifiersTest.
@Test(expected = ActivityIdentifierValidationException.class)
public void validatePeerReview_invalidExternalIdentifiersTest() {
PeerReview pr = getPeerReview();
pr.getExternalIdentifiers().getExternalIdentifier().get(0).setType(null);
activityValidator.validatePeerReview(pr, null, true, true, Visibility.PUBLIC);
}
Aggregations