use of org.orcid.jaxb.model.record_rc3.Funding in project ORCID-Source by ORCID.
the class ProfileFundingManagerTest method testAddFundingToClaimedRecordPreserveUserDefaultVisibility.
@Test
public void testAddFundingToClaimedRecordPreserveUserDefaultVisibility() {
when(sourceManager.retrieveSourceEntity()).thenReturn(new SourceEntity(new ClientDetailsEntity(CLIENT_1_ID)));
Funding funding = getFunding(null);
funding = profileFundingManager.createFunding(claimedOrcid, funding, true);
funding = profileFundingManager.getFunding(claimedOrcid, funding.getPutCode());
assertNotNull(funding);
assertEquals("Funding title", funding.getTitle().getTitle().getContent());
assertEquals(Visibility.LIMITED, funding.getVisibility());
}
use of org.orcid.jaxb.model.record_rc3.Funding in project ORCID-Source by ORCID.
the class ProfileFundingManagerTest method getFunding.
private Funding getFunding(String grantNumber) {
Funding funding = new Funding();
ExternalIDs extIds = new ExternalIDs();
ExternalID extId = new ExternalID();
extId.setRelationship(Relationship.SELF);
extId.setType("grant_number");
extId.setUrl(new Url("http://orcid.org"));
if (grantNumber == null) {
extId.setValue("ext-id-value");
} else {
extId.setValue(grantNumber);
}
extIds.getExternalIdentifier().add(extId);
funding.setExternalIdentifiers(extIds);
FundingTitle title = new FundingTitle();
if (grantNumber == null) {
title.setTitle(new Title("Funding title"));
} else {
title.setTitle(new Title("Funding title " + grantNumber));
}
funding.setTitle(title);
Organization org = new Organization();
org.setName("org-name");
OrganizationAddress address = new OrganizationAddress();
address.setCity("city");
address.setCountry(Iso3166Country.US);
org.setAddress(address);
funding.setOrganization(org);
funding.setVisibility(Visibility.PUBLIC);
funding.setType(FundingType.AWARD);
return funding;
}
use of org.orcid.jaxb.model.record_rc3.Funding in project ORCID-Source by ORCID.
the class ProfileFundingManagerTest method testAddFundingToUnclaimedRecordPreserveFundingVisibility.
@Test
public void testAddFundingToUnclaimedRecordPreserveFundingVisibility() {
when(sourceManager.retrieveSourceEntity()).thenReturn(new SourceEntity(new ClientDetailsEntity(CLIENT_1_ID)));
Funding funding = getFunding(null);
funding = profileFundingManager.createFunding(unclaimedOrcid, funding, true);
funding = profileFundingManager.getFunding(unclaimedOrcid, funding.getPutCode());
assertNotNull(funding);
assertEquals("Funding title", funding.getTitle().getTitle().getContent());
assertEquals(Visibility.PUBLIC, funding.getVisibility());
}
use of org.orcid.jaxb.model.record_rc3.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());
}
use of org.orcid.jaxb.model.record_rc3.Funding in project ORCID-Source by ORCID.
the class ContributorUtilsTest method getFundingWithoutContributors.
private Funding getFundingWithoutContributors() {
Funding funding = new Funding();
FundingTitle fundingTitle = new FundingTitle();
fundingTitle.setTitle(new Title("funding without contributors"));
funding.setTitle(fundingTitle);
return funding;
}
Aggregations