use of org.orcid.jaxb.model.v3.dev1.record.Funding in project ORCID-Source by ORCID.
the class PublicV3ApiServiceDelegatorTest method testGetPublicFundingUsingToken.
// Funding
@Test
public void testGetPublicFundingUsingToken() {
SecurityContextTestUtils.setUpSecurityContext(ORCID, ScopePathType.READ_LIMITED);
Response r = serviceDelegator.viewFunding(ORCID, 10L);
assertNotNull(r);
Funding f = (Funding) r.getEntity();
assertNotNull(f);
assertNotNull(f.getLastModifiedDate());
assertNotNull(f.getLastModifiedDate().getValue());
assertEquals(Long.valueOf(10), f.getPutCode());
}
use of org.orcid.jaxb.model.v3.dev1.record.Funding in project ORCID-Source by ORCID.
the class PublicV3ApiServiceDelegatorTest method testViewFunding.
@Test
public void testViewFunding() {
Response response = serviceDelegator.viewFunding(ORCID, 10L);
assertNotNull(response);
Funding funding = (Funding) response.getEntity();
assertNotNull(funding);
assertNotNull(funding.getLastModifiedDate());
assertNotNull(funding.getLastModifiedDate().getValue());
assertNotNull(funding.getTitle());
assertNotNull(funding.getTitle().getTitle());
assertEquals(Long.valueOf(10), funding.getPutCode());
assertEquals("/0000-0000-0000-0003/funding/10", funding.getPath());
assertEquals("PUBLIC", funding.getTitle().getTitle().getContent());
assertEquals(Visibility.PUBLIC.value(), funding.getVisibility().value());
assertEquals("APP-5555555555555555", funding.getSource().retrieveSourcePath());
assertNotNull(funding.getContributors().getContributor().get(0).getContributorOrcid());
assertEquals("0000-0000-0000-0000", funding.getContributors().getContributor().get(0).getContributorOrcid().getPath());
assertNull(funding.getContributors().getContributor().get(0).getCreditName());
}
use of org.orcid.jaxb.model.v3.dev1.record.Funding in project ORCID-Source by ORCID.
the class PublicAPISecurityManagerV3Test method checkIsPublicRecordTest.
@Test
public void checkIsPublicRecordTest() {
Record r = getRecordElement();
publicAPISecurityManagerV3.filter(r);
// Verify activities - nothing filtered
ActivitiesSummary as = r.getActivitiesSummary();
assertEquals(3, as.getEducations().getSummaries().size());
assertContainerContainsOnlyPublicElements(as.getEducations());
assertEquals(3, as.getEmployments().getSummaries().size());
assertContainerContainsOnlyPublicElements(as.getEmployments());
assertEquals(3, as.getFundings().getFundingGroup().size());
assertGroupContainsOnlyPublicElements(as.getFundings());
assertEquals(3, as.getPeerReviews().getPeerReviewGroup().size());
assertGroupContainsOnlyPublicElements(as.getPeerReviews());
assertEquals(3, as.getWorks().getWorkGroup().size());
assertGroupContainsOnlyPublicElements(as.getWorks());
assertEquals(3, as.getDistinctions().getSummaries().size());
assertContainerContainsOnlyPublicElements(as.getDistinctions());
assertEquals(3, as.getInvitedPositions().getSummaries().size());
assertContainerContainsOnlyPublicElements(as.getInvitedPositions());
assertEquals(3, as.getMemberships().getSummaries().size());
assertContainerContainsOnlyPublicElements(as.getMemberships());
assertEquals(3, as.getQualifications().getSummaries().size());
assertContainerContainsOnlyPublicElements(as.getQualifications());
assertEquals(3, as.getServices().getSummaries().size());
assertContainerContainsOnlyPublicElements(as.getServices());
// Verify bio sections - nothing filtered
Person p = r.getPerson();
assertEquals(3, p.getAddresses().getAddress().size());
assertAllArePublic(p.getAddresses().getAddress());
assertEquals(3, p.getEmails().getEmails().size());
assertAllArePublic(p.getEmails().getEmails());
assertEquals(3, p.getExternalIdentifiers().getExternalIdentifiers().size());
assertAllArePublic(p.getExternalIdentifiers().getExternalIdentifiers());
assertEquals(3, p.getKeywords().getKeywords().size());
assertAllArePublic(p.getKeywords().getKeywords());
assertEquals(3, p.getOtherNames().getOtherNames().size());
assertAllArePublic(p.getOtherNames().getOtherNames());
assertEquals(3, p.getResearcherUrls().getResearcherUrls().size());
assertAllArePublic(p.getResearcherUrls().getResearcherUrls());
assertNotNull(p.getBiography());
assertNotNull(p.getName());
// Filter biography, name, educations and funding
r = getRecordElement();
r.getPerson().getBiography().setVisibility(Visibility.LIMITED);
r.getPerson().getName().setVisibility(Visibility.LIMITED);
setVisibility(r.getActivitiesSummary().getEducations().getSummaries(), Visibility.LIMITED, Visibility.PRIVATE, Visibility.LIMITED);
setVisibility(r.getActivitiesSummary().getFundings(), Visibility.LIMITED, Visibility.PRIVATE, Visibility.LIMITED);
publicAPISecurityManagerV3.filter(r);
// Verify activities - educations and funding filtered
as = r.getActivitiesSummary();
assertNotNull(as.getEducations());
assertTrue(as.getEducations().getSummaries().isEmpty());
assertEquals(3, as.getEmployments().getSummaries().size());
assertTrue(as.getFundings().getFundingGroup().isEmpty());
assertEquals(3, as.getPeerReviews().getPeerReviewGroup().size());
assertEquals(3, as.getWorks().getWorkGroup().size());
assertEquals(3, as.getDistinctions().getSummaries().size());
assertContainerContainsOnlyPublicElements(as.getDistinctions());
assertEquals(3, as.getInvitedPositions().getSummaries().size());
assertContainerContainsOnlyPublicElements(as.getInvitedPositions());
assertEquals(3, as.getMemberships().getSummaries().size());
assertContainerContainsOnlyPublicElements(as.getMemberships());
assertEquals(3, as.getQualifications().getSummaries().size());
assertContainerContainsOnlyPublicElements(as.getQualifications());
assertEquals(3, as.getServices().getSummaries().size());
assertContainerContainsOnlyPublicElements(as.getServices());
// Verify bio sections - bio and name filtered
p = r.getPerson();
assertEquals(3, p.getAddresses().getAddress().size());
assertEquals(3, p.getEmails().getEmails().size());
assertEquals(3, p.getExternalIdentifiers().getExternalIdentifiers().size());
assertEquals(3, p.getKeywords().getKeywords().size());
assertEquals(3, p.getOtherNames().getOtherNames().size());
assertEquals(3, p.getResearcherUrls().getResearcherUrls().size());
assertNull(p.getBiography());
assertNull(p.getName());
// Filter emails, external identifiers, peer reviews and works
r = getRecordElement();
setVisibility(r.getPerson().getEmails().getEmails(), Visibility.LIMITED, Visibility.PRIVATE, Visibility.LIMITED);
setVisibility(r.getPerson().getExternalIdentifiers().getExternalIdentifiers(), Visibility.LIMITED, Visibility.PRIVATE, Visibility.LIMITED);
setVisibility(r.getActivitiesSummary().getPeerReviews(), Visibility.LIMITED, Visibility.PRIVATE, Visibility.LIMITED);
setVisibility(r.getActivitiesSummary().getWorks(), Visibility.LIMITED, Visibility.PRIVATE, Visibility.LIMITED);
publicAPISecurityManagerV3.filter(r);
// Verify activities - peer reviews and works filtered
as = r.getActivitiesSummary();
assertEquals(3, as.getEducations().getSummaries().size());
assertEquals(3, as.getEmployments().getSummaries().size());
assertEquals(3, as.getFundings().getFundingGroup().size());
assertTrue(as.getPeerReviews().getPeerReviewGroup().isEmpty());
assertTrue(as.getWorks().getWorkGroup().isEmpty());
assertEquals(3, as.getDistinctions().getSummaries().size());
assertContainerContainsOnlyPublicElements(as.getDistinctions());
assertEquals(3, as.getInvitedPositions().getSummaries().size());
assertContainerContainsOnlyPublicElements(as.getInvitedPositions());
assertEquals(3, as.getMemberships().getSummaries().size());
assertContainerContainsOnlyPublicElements(as.getMemberships());
assertEquals(3, as.getQualifications().getSummaries().size());
assertContainerContainsOnlyPublicElements(as.getQualifications());
assertEquals(3, as.getServices().getSummaries().size());
assertContainerContainsOnlyPublicElements(as.getServices());
// Verify bio sections - emails, external identifiers filtered
p = r.getPerson();
assertEquals(3, p.getAddresses().getAddress().size());
assertNotNull(p.getEmails());
assertTrue(p.getEmails().getEmails().isEmpty());
assertNotNull(p.getExternalIdentifiers());
assertTrue(p.getExternalIdentifiers().getExternalIdentifiers().isEmpty());
assertEquals(3, p.getKeywords().getKeywords().size());
assertEquals(3, p.getOtherNames().getOtherNames().size());
assertEquals(3, p.getResearcherUrls().getResearcherUrls().size());
assertNotNull(p.getBiography());
assertNotNull(p.getName());
// Filter keywords and other names
r = getRecordElement();
setVisibility(r.getPerson().getOtherNames().getOtherNames(), Visibility.LIMITED, Visibility.PRIVATE, Visibility.LIMITED);
setVisibility(r.getPerson().getKeywords().getKeywords(), Visibility.LIMITED, Visibility.PRIVATE, Visibility.LIMITED);
publicAPISecurityManagerV3.filter(r);
// Verify activities - nothing filtered
as = r.getActivitiesSummary();
assertEquals(3, as.getEducations().getSummaries().size());
assertEquals(3, as.getEmployments().getSummaries().size());
assertEquals(3, as.getFundings().getFundingGroup().size());
assertEquals(3, as.getPeerReviews().getPeerReviewGroup().size());
assertEquals(3, as.getWorks().getWorkGroup().size());
assertEquals(3, as.getDistinctions().getSummaries().size());
assertContainerContainsOnlyPublicElements(as.getDistinctions());
assertEquals(3, as.getInvitedPositions().getSummaries().size());
assertContainerContainsOnlyPublicElements(as.getInvitedPositions());
assertEquals(3, as.getMemberships().getSummaries().size());
assertContainerContainsOnlyPublicElements(as.getMemberships());
assertEquals(3, as.getQualifications().getSummaries().size());
assertContainerContainsOnlyPublicElements(as.getQualifications());
assertEquals(3, as.getServices().getSummaries().size());
assertContainerContainsOnlyPublicElements(as.getServices());
// Verify bio sections - keywords and other names filtered
p = r.getPerson();
assertEquals(3, p.getAddresses().getAddress().size());
assertEquals(3, p.getEmails().getEmails().size());
assertEquals(3, p.getExternalIdentifiers().getExternalIdentifiers().size());
assertNotNull(p.getKeywords());
assertTrue(p.getKeywords().getKeywords().isEmpty());
assertNotNull(p.getOtherNames());
assertTrue(p.getOtherNames().getOtherNames().isEmpty());
assertEquals(3, p.getResearcherUrls().getResearcherUrls().size());
assertNotNull(p.getBiography());
assertNotNull(p.getName());
}
use of org.orcid.jaxb.model.v3.dev1.record.Funding in project ORCID-Source by ORCID.
the class ContributorUtilsTest method testFilterContributorPrivateDataForFundingWithoutContributors.
@Test
public void testFilterContributorPrivateDataForFundingWithoutContributors() {
Funding funding = getFundingWithoutContributors();
contributorUtils.filterContributorPrivateData(funding);
// test no failures
assertNotNull(funding);
}
use of org.orcid.jaxb.model.v3.dev1.record.Funding in project ORCID-Source by ORCID.
the class ContributorUtilsTest method testFilterContributorPrivateDataForFundingWithNoOrcidRecord.
@Test
public void testFilterContributorPrivateDataForFundingWithNoOrcidRecord() {
Funding funding = getFundingWithContributorWithoutOrcid();
contributorUtils.filterContributorPrivateData(funding);
FundingContributor contributor = funding.getContributors().getContributor().get(0);
assertNull(contributor.getContributorEmail());
assertEquals("original credit name", contributor.getCreditName().getContent());
}
Aggregations