use of org.orcid.jaxb.model.v3.dev1.record.PeerReview in project ORCID-Source by ORCID.
the class Utils method getPeerReview.
public static PeerReview getPeerReview() {
PeerReview peerReview = new PeerReview();
ExternalIDs weis = new ExternalIDs();
ExternalID wei1 = new ExternalID();
wei1.setRelationship(Relationship.PART_OF);
wei1.setUrl(new Url("http://myUrl.com"));
wei1.setValue("work-external-identifier-id");
wei1.setType(WorkExternalIdentifierType.DOI.value());
weis.getExternalIdentifier().add(wei1);
peerReview.setExternalIdentifiers(weis);
peerReview.setGroupId("issn:0000003");
peerReview.setOrganization(getOrganization());
peerReview.setRole(Role.CHAIR);
peerReview.setSubjectContainerName(new Title("subject-container-name"));
peerReview.setSubjectExternalIdentifier(wei1);
WorkTitle workTitle = new WorkTitle();
workTitle.setTitle(new Title("work-title"));
peerReview.setSubjectName(workTitle);
peerReview.setSubjectType(WorkType.DATA_SET);
peerReview.setType(PeerReviewType.EVALUATION);
return peerReview;
}
use of org.orcid.jaxb.model.v3.dev1.record.PeerReview in project ORCID-Source by ORCID.
the class JSONInputValidatorTest method testValidateJSONInputForValidV3PeerReview.
@Test
public void testValidateJSONInputForValidV3PeerReview() throws JAXBException, SAXException, IOException {
PeerReview peerReview = org.orcid.test.helper.v3.Utils.getPeerReview();
peerReview.setCompletionDate(new FuzzyDate(new Year(2017), new Month(1), new Day(1)));
validator.validateJSONInput(peerReview);
}
use of org.orcid.jaxb.model.v3.dev1.record.PeerReview in project ORCID-Source by ORCID.
the class PublicV3ApiServiceDelegatorTest method testViewPeerReview.
@Test
public void testViewPeerReview() {
Response response = serviceDelegator.viewPeerReview(ORCID, 9L);
assertNotNull(response);
PeerReview peerReview = (PeerReview) response.getEntity();
assertNotNull(peerReview);
assertEquals("/0000-0000-0000-0003/peer-review/9", peerReview.getPath());
assertNotNull(peerReview.getLastModifiedDate());
assertNotNull(peerReview.getLastModifiedDate().getValue());
assertEquals(Long.valueOf(9), peerReview.getPutCode());
assertEquals("02", peerReview.getCompletionDate().getDay().getValue());
assertEquals("02", peerReview.getCompletionDate().getMonth().getValue());
assertEquals("2016", peerReview.getCompletionDate().getYear().getValue());
assertNotNull(peerReview.getExternalIdentifiers());
assertNotNull(peerReview.getExternalIdentifiers().getExternalIdentifier());
assertEquals(1, peerReview.getExternalIdentifiers().getExternalIdentifier().size());
assertEquals("work:external-identifier-id#1", peerReview.getExternalIdentifiers().getExternalIdentifier().get(0).getValue());
assertEquals(Visibility.PUBLIC.value(), peerReview.getVisibility().value());
assertEquals("APP-5555555555555555", peerReview.getSource().retrieveSourcePath());
}
use of org.orcid.jaxb.model.v3.dev1.record.PeerReview in project ORCID-Source by ORCID.
the class PublicV3ApiServiceDelegatorTest method testViewPeerReviews.
@Test
public void testViewPeerReviews() {
Response response = serviceDelegator.viewPeerReviews(ORCID);
assertNotNull(response);
PeerReviews peerReviews = (PeerReviews) response.getEntity();
assertNotNull(peerReviews);
assertEquals("/0000-0000-0000-0003/peer-reviews", peerReviews.getPath());
assertNotNull(peerReviews.getLastModifiedDate());
assertNotNull(peerReviews.getLastModifiedDate().getValue());
assertEquals(1, peerReviews.getPeerReviewGroup().size());
assertEquals(1, peerReviews.getPeerReviewGroup().get(0).getPeerReviewSummary().size());
PeerReviewSummary peerReview = peerReviews.getPeerReviewGroup().get(0).getPeerReviewSummary().get(0);
assertEquals(Long.valueOf(9), peerReview.getPutCode());
assertNotNull(peerReview.getLastModifiedDate());
assertNotNull(peerReview.getLastModifiedDate().getValue());
assertEquals("02", peerReview.getCompletionDate().getDay().getValue());
assertEquals("02", peerReview.getCompletionDate().getMonth().getValue());
assertEquals("2016", peerReview.getCompletionDate().getYear().getValue());
assertNotNull(peerReview.getExternalIdentifiers());
assertNotNull(peerReview.getExternalIdentifiers().getExternalIdentifier());
assertEquals(1, peerReview.getExternalIdentifiers().getExternalIdentifier().size());
assertEquals("/0000-0000-0000-0003/peer-review/9", peerReview.getPath());
assertEquals("work:external-identifier-id#1", peerReview.getExternalIdentifiers().getExternalIdentifier().get(0).getValue());
assertEquals(Visibility.PUBLIC.value(), peerReview.getVisibility().value());
assertEquals("APP-5555555555555555", peerReview.getSource().retrieveSourcePath());
}
use of org.orcid.jaxb.model.v3.dev1.record.PeerReview in project ORCID-Source by ORCID.
the class GetMyDataControllerTest method before.
@Before
public void before() {
MockitoAnnotations.initMocks(this);
TargetProxyHelper.injectIntoProxy(getMyDataController, "batchSize", 50);
TargetProxyHelper.injectIntoProxy(getMyDataController, "personDetailsManager", mockPersonDetailsManager);
TargetProxyHelper.injectIntoProxy(getMyDataController, "workEntityCacheManager", mockWorkEntityCacheManager);
TargetProxyHelper.injectIntoProxy(getMyDataController, "affiliationManagerReadOnly", mockAffiliationManagerReadOnly);
TargetProxyHelper.injectIntoProxy(getMyDataController, "profileFundingManagerReadOnly", mockProfileFundingManagerReadOnly);
TargetProxyHelper.injectIntoProxy(getMyDataController, "peerReviewManagerReadOnly", mockPeerReviewManagerReadOnly);
TargetProxyHelper.injectIntoProxy(getMyDataController, "workManagerReadOnly", mockWorkManagerReadOnly);
when(mockPersonDetailsManager.getPersonDetails(anyString())).thenAnswer(new Answer<Person>() {
@Override
public Person answer(InvocationOnMock invocation) throws Throwable {
Person p = new Person();
p.setBiography(new Biography("Biography", Visibility.LIMITED));
Name name = new Name();
name.setVisibility(Visibility.LIMITED);
name.setFamilyName(new FamilyName("Family Name"));
name.setGivenNames(new GivenNames("Given Names"));
name.setCreditName(new CreditName("Credit Name"));
p.setName(name);
return p;
}
});
when(mockAffiliationManagerReadOnly.getAffiliations(anyString())).thenAnswer(new Answer<List<Affiliation>>() {
@Override
public List<Affiliation> answer(InvocationOnMock invocation) throws Throwable {
List<Affiliation> affs = new ArrayList<Affiliation>();
FuzzyDate startDate = new FuzzyDate(new Year(2018), new Month(1), new Day(1));
FuzzyDate endDate = new FuzzyDate(new Year(2018), new Month(12), new Day(31));
Distinction d = new Distinction();
d.setDepartmentName("distinction");
d.setEndDate(endDate);
d.setStartDate(startDate);
d.setPutCode(1L);
setOrg(d);
affs.add(d);
Education e = new Education();
e.setDepartmentName("education");
e.setEndDate(endDate);
e.setStartDate(startDate);
e.setPutCode(2L);
setOrg(e);
affs.add(e);
Employment emp = new Employment();
emp.setDepartmentName("employment");
emp.setEndDate(endDate);
emp.setStartDate(startDate);
emp.setPutCode(3L);
setOrg(emp);
affs.add(emp);
InvitedPosition i = new InvitedPosition();
i.setDepartmentName("invited position");
i.setEndDate(endDate);
i.setStartDate(startDate);
i.setPutCode(4L);
setOrg(i);
affs.add(i);
Membership m = new Membership();
m.setDepartmentName("membership");
m.setEndDate(endDate);
m.setStartDate(startDate);
m.setPutCode(5L);
setOrg(m);
affs.add(m);
Qualification q = new Qualification();
q.setDepartmentName("qualification");
q.setEndDate(endDate);
q.setStartDate(startDate);
q.setPutCode(6L);
setOrg(q);
affs.add(q);
Service s = new Service();
s.setDepartmentName("service");
s.setEndDate(endDate);
s.setStartDate(startDate);
s.setPutCode(7L);
setOrg(s);
affs.add(s);
return affs;
}
});
when(mockProfileFundingManagerReadOnly.getFundingList(anyString())).thenAnswer(new Answer<List<Funding>>() {
@Override
public List<Funding> answer(InvocationOnMock invocation) throws Throwable {
List<Funding> fundings = new ArrayList<Funding>();
Funding f = new Funding();
Amount a = new Amount();
a.setContent("1000");
a.setCurrencyCode("$");
f.setAmount(a);
FundingTitle t = new FundingTitle();
t.setTitle(new Title("title"));
f.setTitle(t);
setOrg(f);
f.setPutCode(1L);
fundings.add(f);
return fundings;
}
});
when(mockPeerReviewManagerReadOnly.findPeerReviews(anyString())).thenAnswer(new Answer<List<PeerReview>>() {
@Override
public List<PeerReview> answer(InvocationOnMock invocation) throws Throwable {
List<PeerReview> peerReviews = new ArrayList<PeerReview>();
PeerReview p = new PeerReview();
setOrg(p);
p.setPutCode(1L);
peerReviews.add(p);
return peerReviews;
}
});
when(mockWorkManagerReadOnly.findWorks(anyString(), any())).thenAnswer(new Answer<List<Work>>() {
@Override
public List<Work> answer(InvocationOnMock invocation) throws Throwable {
List<Work> works = new ArrayList<Work>();
Work w = new Work();
WorkTitle t = new WorkTitle();
t.setTitle(new Title("title"));
w.setPutCode(1L);
works.add(w);
return works;
}
});
when(mockWorkManagerReadOnly.getLastModified(anyString())).thenReturn(0L);
when(mockWorkEntityCacheManager.retrieveWorkLastModifiedList(anyString(), anyLong())).thenAnswer(new Answer<List<WorkLastModifiedEntity>>() {
@Override
public List<WorkLastModifiedEntity> answer(InvocationOnMock invocation) throws Throwable {
List<WorkLastModifiedEntity> works = new ArrayList<WorkLastModifiedEntity>();
WorkLastModifiedEntity w = new WorkLastModifiedEntity();
w.setId(1L);
w.setOrcid(ORCID);
w.setLastModified(new Date());
works.add(w);
return works;
}
});
}
Aggregations