use of org.orcid.persistence.jpa.entities.PeerReviewEntity 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.persistence.jpa.entities.PeerReviewEntity 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.persistence.jpa.entities.PeerReviewEntity in project ORCID-Source by ORCID.
the class JpaJaxbPeerReviewAdapterTest method fromOrgAffiliationRelationEntityToEducation.
@Test
public void fromOrgAffiliationRelationEntityToEducation() {
PeerReviewEntity entity = getPeerReviewEntity();
assertNotNull(entity);
PeerReview peerReview = jpaJaxbPeerReviewAdapter.toPeerReview(entity);
assertNotNull(peerReview);
assertEquals(Long.valueOf(12345), peerReview.getPutCode());
assertEquals("private", peerReview.getVisibility().value());
assertEquals("orcid-generated:12345", peerReview.getGroupId());
//Subject
assertNotNull(peerReview.getSubjectExternalIdentifier());
assertEquals("peer-review:subject-external-identifier-id", peerReview.getSubjectExternalIdentifier().getValue());
assertEquals("source-work-id", peerReview.getSubjectExternalIdentifier().getType());
assertEquals("peer-review:subject-container-name", peerReview.getSubjectContainerName().getContent());
assertEquals("peer-review:subject-name", peerReview.getSubjectName().getTitle().getContent());
assertEquals("peer-review:subject-translated-name", peerReview.getSubjectName().getTranslatedTitle().getContent());
assertEquals("en", peerReview.getSubjectName().getTranslatedTitle().getLanguageCode());
assertEquals(WorkType.BOOK_REVIEW.value(), peerReview.getSubjectType().value());
assertEquals("peer-review:subject-url", peerReview.getSubjectUrl().getValue());
//Fields
assertNotNull(peerReview.getExternalIdentifiers());
assertNotNull(peerReview.getExternalIdentifiers().getExternalIdentifier());
assertEquals(1, peerReview.getExternalIdentifiers().getExternalIdentifier().size());
assertEquals("peer-review:external-identifier-id", peerReview.getExternalIdentifiers().getExternalIdentifier().get(0).getValue());
assertEquals("source-work-id", peerReview.getExternalIdentifiers().getExternalIdentifier().get(0).getType());
assertEquals(Role.MEMBER.value(), peerReview.getRole().value());
assertEquals(PeerReviewType.EVALUATION.value(), peerReview.getType().value());
assertEquals("peer-review:url", peerReview.getUrl().getValue());
assertNotNull(peerReview.getCompletionDate());
assertEquals("2015", peerReview.getCompletionDate().getYear().getValue());
assertEquals("01", peerReview.getCompletionDate().getMonth().getValue());
assertEquals("01", peerReview.getCompletionDate().getDay().getValue());
assertNotNull(peerReview.getOrganization());
assertEquals("org:name", peerReview.getOrganization().getName());
assertNotNull(peerReview.getOrganization().getAddress());
assertEquals("org:city", peerReview.getOrganization().getAddress().getCity());
assertEquals("org:region", peerReview.getOrganization().getAddress().getRegion());
assertNotNull(peerReview.getSource());
assertEquals("APP-000000001", peerReview.getSource().retrieveSourcePath());
}
use of org.orcid.persistence.jpa.entities.PeerReviewEntity 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.persistence.jpa.entities.PeerReviewEntity in project ORCID-Source by ORCID.
the class JpaJaxbPeerReviewAdapterTest method getPeerReviewEntity.
private PeerReviewEntity getPeerReviewEntity() {
OrgEntity orgEntity = new OrgEntity();
orgEntity.setCity("org:city");
orgEntity.setCountry(org.orcid.jaxb.model.message.Iso3166Country.US);
orgEntity.setName("org:name");
orgEntity.setRegion("org:region");
orgEntity.setUrl("org:url");
orgEntity.setSource(new SourceEntity("APP-000000001"));
PeerReviewEntity result = new PeerReviewEntity();
result.setOrg(orgEntity);
result.setCompletionDate(new CompletionDateEntity(2015, 1, 1));
result.setExternalIdentifiersJson("{\"workExternalIdentifier\":[{\"relationship\":\"SELF\",\"url\":{\"value\":\"http://orcid.org\"},\"workExternalIdentifierType\":\"SOURCE_WORK_ID\",\"workExternalIdentifierId\":{\"content\":\"peer-review:external-identifier-id\"}}]}");
result.setProfile(new ProfileEntity("0000-0001-0002-0003"));
result.setRole(Role.MEMBER);
result.setType(PeerReviewType.EVALUATION);
result.setUrl("peer-review:url");
result.setSubjectExternalIdentifiersJson("{\"relationship\":\"SELF\",\"url\":{\"value\":\"http://orcid.org\"},\"workExternalIdentifierType\":\"SOURCE_WORK_ID\",\"workExternalIdentifierId\":{\"content\":\"peer-review:subject-external-identifier-id\"}}");
result.setSubjectContainerName("peer-review:subject-container-name");
result.setSubjectName("peer-review:subject-name");
result.setSubjectTranslatedName("peer-review:subject-translated-name");
result.setSubjectTranslatedNameLanguageCode("en");
result.setSubjectUrl("peer-review:subject-url");
result.setSubjectType(WorkType.BOOK_REVIEW);
result.setVisibility(Visibility.PRIVATE);
result.setClientSourceId("APP-000000001");
result.setGroupId("orcid-generated:12345");
result.setId(12345L);
return result;
}
Aggregations