Search in sources :

Example 26 with Funding

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

the class ActivityValidatorTest method validateFunding_invalidTranslatedTitleLanguageCodeTest.

@Test(expected = ActivityTypeValidationException.class)
public void validateFunding_invalidTranslatedTitleLanguageCodeTest() {
    Funding funding = getFunding();
    funding.getTitle().getTranslatedTitle().setLanguageCode("xx");
    activityValidator.validateFunding(funding, null, true, true, Visibility.PUBLIC);
}
Also used : Funding(org.orcid.jaxb.model.v3.dev1.record.Funding) Test(org.junit.Test)

Example 27 with Funding

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

the class ActivityValidatorTest method validateFundingWithoutOrg.

@Test(expected = InvalidOrgException.class)
public void validateFundingWithoutOrg() {
    Funding f = getFunding();
    f.setOrganization(null);
    activityValidator.validateFunding(f, null, false, true, Visibility.PUBLIC);
}
Also used : Funding(org.orcid.jaxb.model.v3.dev1.record.Funding) Test(org.junit.Test)

Example 28 with Funding

use of org.orcid.jaxb.model.v3.dev1.record.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());
}
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) Test(org.junit.Test) BaseTest(org.orcid.core.BaseTest)

Example 29 with Funding

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

the class ProfileFundingManagerTest method displayIndexIsSetTo_0_FromAPI.

@Test
public void displayIndexIsSetTo_0_FromAPI() {
    when(sourceManager.retrieveSourceEntity()).thenReturn(new SourceEntity(new ClientDetailsEntity(CLIENT_1_ID)));
    Funding f1 = getFunding("fromAPI-1");
    f1 = profileFundingManager.createFunding(claimedOrcid, f1, true);
    ProfileFundingEntity f = profileFundingDao.find(f1.getPutCode());
    assertNotNull(f);
    assertEquals(Long.valueOf(0), 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)

Example 30 with Funding

use of org.orcid.jaxb.model.v3.dev1.record.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());
}
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) 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