Search in sources :

Example 76 with Funding

use of org.orcid.jaxb.model.record_rc4.Funding in project ORCID-Source by ORCID.

the class ActivityValidatorTest method getFunding.

public Funding getFunding() {
    Funding funding = new Funding();
    Amount amount = new Amount();
    amount.setContent("1000");
    amount.setCurrencyCode("$");
    funding.setAmount(amount);
    FundingContributor contributor = new FundingContributor();
    FundingContributorAttributes attributes = new FundingContributorAttributes();
    attributes.setContributorRole(FundingContributorRole.LEAD);
    ContributorOrcid contributorOrcid = new ContributorOrcid();
    contributorOrcid.setHost("http://test.orcid.org");
    contributorOrcid.setPath("0000-0000-0000-0000");
    contributorOrcid.setUri("http://test.orcid.org/0000-0000-0000-0000");
    contributor.setContributorAttributes(attributes);
    contributor.setContributorOrcid(contributorOrcid);
    FundingContributors contributors = new FundingContributors();
    contributors.getContributor().add(contributor);
    funding.setContributors(contributors);
    funding.setDescription("description");
    funding.setEndDate(getFuzzyDate());
    funding.setExternalIdentifiers(getExternalIDs());
    funding.setOrganization(getOrganization());
    funding.setOrganizationDefinedType(new OrganizationDefinedFundingSubType("subtype"));
    funding.setStartDate(getFuzzyDate());
    FundingTitle title = new FundingTitle();
    title.setTitle(new Title("title"));
    title.setTranslatedTitle(new TranslatedTitle("translated title", "en"));
    funding.setTitle(title);
    funding.setType(FundingType.AWARD);
    funding.setUrl(new Url("http://test.orcid.org"));
    funding.setVisibility(Visibility.PUBLIC);
    return funding;
}
Also used : TranslatedTitle(org.orcid.jaxb.model.common_v2.TranslatedTitle) Funding(org.orcid.jaxb.model.record_v2.Funding) Amount(org.orcid.jaxb.model.common_v2.Amount) FundingContributor(org.orcid.jaxb.model.record_v2.FundingContributor) FundingContributors(org.orcid.jaxb.model.record_v2.FundingContributors) FundingContributorAttributes(org.orcid.jaxb.model.record_v2.FundingContributorAttributes) WorkTitle(org.orcid.jaxb.model.record_v2.WorkTitle) TranslatedTitle(org.orcid.jaxb.model.common_v2.TranslatedTitle) FundingTitle(org.orcid.jaxb.model.record_v2.FundingTitle) Title(org.orcid.jaxb.model.common_v2.Title) ContributorOrcid(org.orcid.jaxb.model.common_v2.ContributorOrcid) FundingTitle(org.orcid.jaxb.model.record_v2.FundingTitle) Url(org.orcid.jaxb.model.common_v2.Url) OrganizationDefinedFundingSubType(org.orcid.jaxb.model.common_v2.OrganizationDefinedFundingSubType)

Example 77 with Funding

use of org.orcid.jaxb.model.record_rc4.Funding in project ORCID-Source by ORCID.

the class ActivityValidatorTest method validateFunding_emptyExternalIdentifiersTest.

@Test(expected = ActivityIdentifierValidationException.class)
public void validateFunding_emptyExternalIdentifiersTest() {
    Funding funding = getFunding();
    funding.getExternalIdentifiers().getExternalIdentifier().clear();
    activityValidator.validateFunding(funding, null, true, true, Visibility.PUBLIC);
}
Also used : Funding(org.orcid.jaxb.model.record_v2.Funding) Test(org.junit.Test)

Example 78 with Funding

use of org.orcid.jaxb.model.record_rc4.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());
}
Also used : Funding(org.orcid.jaxb.model.record_v2.Funding) FundingContributor(org.orcid.jaxb.model.record_v2.FundingContributor) Test(org.junit.Test)

Example 79 with Funding

use of org.orcid.jaxb.model.record_rc4.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;
}
Also used : Funding(org.orcid.jaxb.model.record_v2.Funding) FundingTitle(org.orcid.jaxb.model.record_v2.FundingTitle) WorkTitle(org.orcid.jaxb.model.record_v2.WorkTitle) Title(org.orcid.jaxb.model.common_v2.Title) FundingTitle(org.orcid.jaxb.model.record_v2.FundingTitle)

Example 80 with Funding

use of org.orcid.jaxb.model.record_rc4.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);
}
Also used : Funding(org.orcid.jaxb.model.record_v2.Funding) Test(org.junit.Test)

Aggregations

Funding (org.orcid.jaxb.model.record_v2.Funding)82 Test (org.junit.Test)73 ClientResponse (com.sun.jersey.api.client.ClientResponse)28 ArrayList (java.util.ArrayList)16 ExternalID (org.orcid.jaxb.model.record_v2.ExternalID)16 Response (javax.ws.rs.core.Response)15 DBUnitTest (org.orcid.test.DBUnitTest)15 Url (org.orcid.jaxb.model.common_v2.Url)14 Title (org.orcid.jaxb.model.common_v2.Title)11 Work (org.orcid.jaxb.model.record_v2.Work)10 List (java.util.List)9 FundingTitle (org.orcid.jaxb.model.record_v2.FundingTitle)9 ResearcherUrl (org.orcid.jaxb.model.record_v2.ResearcherUrl)9 Funding (org.orcid.jaxb.model.record_rc1.Funding)8 IOException (java.io.IOException)7 InputStreamReader (java.io.InputStreamReader)6 Reader (java.io.Reader)6 BaseTest (org.orcid.core.BaseTest)6 Funding (org.orcid.jaxb.model.record_rc4.Funding)6 Education (org.orcid.jaxb.model.record_v2.Education)6