Search in sources :

Example 96 with Funding

use of org.orcid.jaxb.model.v3.dev1.record.Funding in project ORCID-Source by ORCID.

the class ActivityValidatorTest method validateFunding_validFundingTest.

/**
 * VALIDATE FUNDING
 */
@Test
public void validateFunding_validFundingTest() {
    Funding funding = getFunding();
    activityValidator.validateFunding(funding, null, true, true, Visibility.PUBLIC);
}
Also used : Funding(org.orcid.jaxb.model.v3.dev1.record.Funding) Test(org.junit.Test)

Example 97 with Funding

use of org.orcid.jaxb.model.v3.dev1.record.Funding in project ORCID-Source by ORCID.

the class ActivityValidatorTest method validateFunding_invalidCurrencyCodeTest.

@Test
public void validateFunding_invalidCurrencyCodeTest() {
    try {
        Funding funding = getFunding();
        funding.getAmount().setCurrencyCode(null);
        activityValidator.validateFunding(funding, null, true, true, Visibility.PUBLIC);
        fail();
    } catch (OrcidValidationException e) {
    }
    try {
        Funding funding = getFunding();
        funding.getAmount().setContent(null);
        activityValidator.validateFunding(funding, null, true, true, Visibility.PUBLIC);
        fail();
    } catch (OrcidValidationException e) {
    }
}
Also used : Funding(org.orcid.jaxb.model.v3.dev1.record.Funding) OrcidValidationException(org.orcid.core.exception.OrcidValidationException) Test(org.junit.Test)

Example 98 with Funding

use of org.orcid.jaxb.model.v3.dev1.record.Funding in project ORCID-Source by ORCID.

the class ActivityValidatorTest method validateFunding_dontChangeVisibilityTest.

@Test(expected = VisibilityMismatchException.class)
public void validateFunding_dontChangeVisibilityTest() {
    Funding funding = getFunding();
    funding.setVisibility(Visibility.LIMITED);
    activityValidator.validateFunding(funding, null, false, true, Visibility.PUBLIC);
}
Also used : Funding(org.orcid.jaxb.model.v3.dev1.record.Funding) Test(org.junit.Test)

Example 99 with Funding

use of org.orcid.jaxb.model.v3.dev1.record.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);
    DisambiguatedOrganization disambiguatedOrg = new DisambiguatedOrganization();
    disambiguatedOrg.setDisambiguatedOrganizationIdentifier("abc456");
    disambiguatedOrg.setDisambiguationSource("WDB");
    org.setDisambiguatedOrganization(disambiguatedOrg);
    funding.setOrganization(org);
    funding.setVisibility(Visibility.PUBLIC);
    funding.setType(FundingType.AWARD);
    return funding;
}
Also used : ExternalIDs(org.orcid.jaxb.model.v3.dev1.record.ExternalIDs) Organization(org.orcid.jaxb.model.v3.dev1.common.Organization) DisambiguatedOrganization(org.orcid.jaxb.model.v3.dev1.common.DisambiguatedOrganization) DisambiguatedOrganization(org.orcid.jaxb.model.v3.dev1.common.DisambiguatedOrganization) Funding(org.orcid.jaxb.model.v3.dev1.record.Funding) ExternalID(org.orcid.jaxb.model.v3.dev1.record.ExternalID) OrganizationAddress(org.orcid.jaxb.model.v3.dev1.common.OrganizationAddress) Title(org.orcid.jaxb.model.v3.dev1.common.Title) FundingTitle(org.orcid.jaxb.model.v3.dev1.record.FundingTitle) FundingTitle(org.orcid.jaxb.model.v3.dev1.record.FundingTitle) Url(org.orcid.jaxb.model.v3.dev1.common.Url)

Example 100 with Funding

use of org.orcid.jaxb.model.v3.dev1.record.Funding in project ORCID-Source by ORCID.

the class ProfileFundingManagerTest method displayIndexIsSetTo_1_FromUI.

@Test
public void displayIndexIsSetTo_1_FromUI() {
    when(sourceManager.retrieveSourceEntity()).thenReturn(new SourceEntity(new ClientDetailsEntity(CLIENT_1_ID)));
    Funding f1 = getFunding("fromUI-1");
    f1 = profileFundingManager.createFunding(claimedOrcid, f1, false);
    ProfileFundingEntity f = profileFundingDao.find(f1.getPutCode());
    assertNotNull(f);
    assertEquals(Long.valueOf(1), f.getDisplayIndex());
}
Also used : ClientDetailsEntity(org.orcid.persistence.jpa.entities.ClientDetailsEntity) Funding(org.orcid.jaxb.model.v3.dev1.record.Funding) SourceEntity(org.orcid.persistence.jpa.entities.SourceEntity) ProfileFundingEntity(org.orcid.persistence.jpa.entities.ProfileFundingEntity) Test(org.junit.Test) BaseTest(org.orcid.core.BaseTest)

Aggregations

Test (org.junit.Test)76 Funding (org.orcid.jaxb.model.v3.dev1.record.Funding)72 FundingSummary (org.orcid.jaxb.model.v3.dev1.record.summary.FundingSummary)24 Response (javax.ws.rs.core.Response)23 DBUnitTest (org.orcid.test.DBUnitTest)23 ActivitiesSummary (org.orcid.jaxb.model.v3.dev1.record.summary.ActivitiesSummary)20 ExternalID (org.orcid.jaxb.model.v3.dev1.record.ExternalID)15 EducationSummary (org.orcid.jaxb.model.v3.dev1.record.summary.EducationSummary)12 EmploymentSummary (org.orcid.jaxb.model.v3.dev1.record.summary.EmploymentSummary)12 PeerReviewSummary (org.orcid.jaxb.model.v3.dev1.record.summary.PeerReviewSummary)12 WorkSummary (org.orcid.jaxb.model.v3.dev1.record.summary.WorkSummary)12 DistinctionSummary (org.orcid.jaxb.model.v3.dev1.record.summary.DistinctionSummary)10 InvitedPositionSummary (org.orcid.jaxb.model.v3.dev1.record.summary.InvitedPositionSummary)10 MembershipSummary (org.orcid.jaxb.model.v3.dev1.record.summary.MembershipSummary)10 QualificationSummary (org.orcid.jaxb.model.v3.dev1.record.summary.QualificationSummary)10 ServiceSummary (org.orcid.jaxb.model.v3.dev1.record.summary.ServiceSummary)10 Url (org.orcid.jaxb.model.v3.dev1.common.Url)9 FundingContributor (org.orcid.jaxb.model.v3.dev1.record.FundingContributor)9 ArrayList (java.util.ArrayList)8 ExternalIDs (org.orcid.jaxb.model.v3.dev1.record.ExternalIDs)8