Search in sources :

Example 41 with Funding

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

the class ContributorUtilsTest method testFilterContributorPrivateDataForFundingWithInvalidOrcidRecord.

@Test
public void testFilterContributorPrivateDataForFundingWithInvalidOrcidRecord() {
    when(profileEntityManager.orcidExists(anyString())).thenReturn(false);
    Funding funding = getFundingWithOrcidContributor();
    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.v3.dev1.record.Funding) FundingContributor(org.orcid.jaxb.model.v3.dev1.record.FundingContributor) Test(org.junit.Test)

Example 42 with Funding

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

the class ContributorUtilsTest method testFilterContributorPrivateDataForFundingWithPublicName.

@Test
public void testFilterContributorPrivateDataForFundingWithPublicName() {
    when(profileEntityManager.orcidExists(anyString())).thenReturn(true);
    when(profileEntityCacheManager.retrieve(anyString())).thenReturn(new ProfileEntity());
    when(cacheManager.getPublicCreditName(any(ProfileEntity.class))).thenReturn("a public name");
    Funding funding = getFundingWithOrcidContributor();
    contributorUtils.filterContributorPrivateData(funding);
    FundingContributor contributor = funding.getContributors().getContributor().get(0);
    assertNull(contributor.getContributorEmail());
    assertEquals("a public name", contributor.getCreditName().getContent());
}
Also used : Funding(org.orcid.jaxb.model.v3.dev1.record.Funding) FundingContributor(org.orcid.jaxb.model.v3.dev1.record.FundingContributor) ProfileEntity(org.orcid.persistence.jpa.entities.ProfileEntity) Test(org.junit.Test)

Example 43 with Funding

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

the class ContributorUtilsTest method getFundingWithContributorWithoutOrcid.

private Funding getFundingWithContributorWithoutOrcid() {
    Funding funding = new Funding();
    FundingTitle fundingTitle = new FundingTitle();
    fundingTitle.setTitle(new Title("funding with contributor without ORCID record"));
    funding.setTitle(fundingTitle);
    funding.setContributors(getFundingContributorWithoutOrcid());
    return funding;
}
Also used : Funding(org.orcid.jaxb.model.v3.dev1.record.Funding) Title(org.orcid.jaxb.model.v3.dev1.common.Title) FundingTitle(org.orcid.jaxb.model.v3.dev1.record.FundingTitle) WorkTitle(org.orcid.jaxb.model.v3.dev1.record.WorkTitle) FundingTitle(org.orcid.jaxb.model.v3.dev1.record.FundingTitle)

Example 44 with Funding

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

the class ContributorUtilsTest method testFilterContributorPrivateDataForFundingWithPrivateName.

@Test
public void testFilterContributorPrivateDataForFundingWithPrivateName() {
    when(profileEntityManager.orcidExists(anyString())).thenReturn(true);
    when(profileEntityCacheManager.retrieve(anyString())).thenReturn(new ProfileEntity());
    when(cacheManager.getPublicCreditName(any(ProfileEntity.class))).thenReturn(null);
    Funding funding = getFundingWithOrcidContributor();
    contributorUtils.filterContributorPrivateData(funding);
    FundingContributor contributor = funding.getContributors().getContributor().get(0);
    assertNull(contributor.getContributorEmail());
    assertEquals("", contributor.getCreditName().getContent());
}
Also used : Funding(org.orcid.jaxb.model.v3.dev1.record.Funding) FundingContributor(org.orcid.jaxb.model.v3.dev1.record.FundingContributor) ProfileEntity(org.orcid.persistence.jpa.entities.ProfileEntity) Test(org.junit.Test)

Example 45 with Funding

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

the class ActivitiesGroupGenerator_GroupingFundingsTest method groupFundings_DontGroupFundingsWithoutExtIds_Test.

/**
 * Test that two groups without ext ids dont get grouped
 */
@Test
public void groupFundings_DontGroupFundingsWithoutExtIds_Test() {
    ActivitiesGroupGenerator generator = new ActivitiesGroupGenerator();
    Map<String, FundingSummary> fundings = generateFundings();
    // Group the first group
    FundingSummary funding8 = fundings.get("funding-8");
    FundingSummary funding9 = fundings.get("funding-9");
    generator.group(funding8);
    generator.group(funding9);
    List<ActivitiesGroup> groups = generator.getGroups();
    assertNotNull(groups);
    assertEquals(2, groups.size());
    // Check there are two activities in each group
    assertEquals(1, groups.get(0).getActivities().size());
    assertEquals(1, groups.get(1).getActivities().size());
    // Check there are five external ids in each group
    assertEquals(0, groups.get(0).getGroupKeys().size());
    assertEquals(0, groups.get(1).getGroupKeys().size());
    checkActivityIsOnGroups(funding8, groups);
    checkActivityIsOnGroups(funding9, groups);
    checkActivitiesDontBelongsToTheSameGroup(groups, funding8, funding9);
}
Also used : FundingSummary(org.orcid.jaxb.model.v3.dev1.record.summary.FundingSummary) Test(org.junit.Test)

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