Search in sources :

Example 61 with Funding

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

the class PublicV2ApiServiceDelegatorTest 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());
}
Also used : Response(javax.ws.rs.core.Response) Funding(org.orcid.jaxb.model.record_v2.Funding) DBUnitTest(org.orcid.test.DBUnitTest) Test(org.junit.Test)

Example 62 with Funding

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

the class SourceInActivitiesTest method getFundingWithPutCode.

private ProfileFundingEntity getFundingWithPutCode(String userOrcid) {
    Funding funding = new Funding();
    funding.setOrganization(getOrganization());
    FundingTitle title = new FundingTitle();
    title.setTitle(new Title("Title " + System.currentTimeMillis()));
    funding.setTitle(title);
    funding.setType(org.orcid.jaxb.model.record_v2.FundingType.AWARD);
    ExternalID extId = new ExternalID();
    extId.setValue("111");
    extId.setType(FundingExternalIdentifierType.GRANT_NUMBER.value());
    extId.setUrl(new Url("http://test.com"));
    ExternalIDs extIdentifiers = new ExternalIDs();
    extIdentifiers.getExternalIdentifier().add(extId);
    funding.setExternalIdentifiers(extIdentifiers);
    funding.setPutCode(Long.valueOf(111));
    funding = profileFundingManager.createFunding(userOrcid, funding, true);
    return profileFundingManager.getProfileFundingEntity(funding.getPutCode());
}
Also used : ExternalIDs(org.orcid.jaxb.model.record_v2.ExternalIDs) Funding(org.orcid.jaxb.model.record_v2.Funding) ExternalID(org.orcid.jaxb.model.record_v2.ExternalID) WorkTitle(org.orcid.jaxb.model.record_v2.WorkTitle) FundingTitle(org.orcid.jaxb.model.record_v2.FundingTitle) Title(org.orcid.jaxb.model.common_v2.Title) FundingTitle(org.orcid.jaxb.model.record_v2.FundingTitle) Url(org.orcid.jaxb.model.common_v2.Url)

Example 63 with Funding

use of org.orcid.jaxb.model.record_rc1.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.record_v2.Funding) Test(org.junit.Test)

Example 64 with Funding

use of org.orcid.jaxb.model.record_rc1.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.record_v2.Funding) Test(org.junit.Test)

Example 65 with Funding

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

the class ActivityValidatorTest method validateFunding_emptyTitleTest.

@Test(expected = ActivityTitleValidationException.class)
public void validateFunding_emptyTitleTest() {
    Funding funding = getFunding();
    funding.getTitle().getTitle().setContent(null);
    activityValidator.validateFunding(funding, null, true, true, Visibility.PUBLIC);
}
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)70 ClientResponse (com.sun.jersey.api.client.ClientResponse)28 ArrayList (java.util.ArrayList)17 ExternalID (org.orcid.jaxb.model.record_v2.ExternalID)16 Response (javax.ws.rs.core.Response)15 Url (org.orcid.jaxb.model.common_v2.Url)15 DBUnitTest (org.orcid.test.DBUnitTest)15 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 IOException (java.io.IOException)8 Funding (org.orcid.jaxb.model.record_rc1.Funding)8 Education (org.orcid.jaxb.model.record_v2.Education)8 ExternalIDs (org.orcid.jaxb.model.record_v2.ExternalIDs)8 WorkTitle (org.orcid.jaxb.model.record_v2.WorkTitle)8 InputStreamReader (java.io.InputStreamReader)7 Reader (java.io.Reader)7