Search in sources :

Example 46 with Funding

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

the class ActivitiesGroupGenerator_GroupingFundingsTest method groupFundings_1GroupsOf2Fundings_Test.

/**
 * Test grouping funding-1 and funding-2
 */
@Test
public void groupFundings_1GroupsOf2Fundings_Test() {
    ActivitiesGroupGenerator generator = new ActivitiesGroupGenerator();
    Map<String, FundingSummary> fundings = generateFundings();
    FundingSummary funding1 = fundings.get("funding-1");
    FundingSummary funding2 = fundings.get("funding-2");
    generator.group(funding1);
    generator.group(funding2);
    List<ActivitiesGroup> groups = generator.getGroups();
    assertNotNull(groups);
    assertEquals(1, groups.size());
    ActivitiesGroup g1 = groups.get(0);
    assertNotNull(g1);
    assertNotNull(g1.getActivities());
    assertEquals(2, g1.getActivities().size());
    assertTrue(g1.getActivities().contains(funding1));
    assertTrue(g1.getActivities().contains(funding2));
    assertNotNull(g1.getGroupKeys());
    assertEquals(5, g1.getGroupKeys().size());
    checkExternalIdentifiers(funding1, g1);
    checkExternalIdentifiers(funding2, g1);
}
Also used : FundingSummary(org.orcid.jaxb.model.v3.dev1.record.summary.FundingSummary) Test(org.junit.Test)

Example 47 with Funding

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

the class ActivitiesGroupGenerator_GroupingFundingsTest method groupFundings_2GroupsOf2Fundings_Test.

/**
 * Test grouping (funding-1 and funding-2) and (funding-5 and funding-6)
 */
@Test
public void groupFundings_2GroupsOf2Fundings_Test() {
    ActivitiesGroupGenerator generator = new ActivitiesGroupGenerator();
    Map<String, FundingSummary> fundings = generateFundings();
    FundingSummary funding1 = fundings.get("funding-1");
    FundingSummary funding2 = fundings.get("funding-2");
    FundingSummary funding5 = fundings.get("funding-5");
    FundingSummary funding6 = fundings.get("funding-6");
    generator.group(funding1);
    generator.group(funding2);
    generator.group(funding5);
    generator.group(funding6);
    List<ActivitiesGroup> groups = generator.getGroups();
    assertNotNull(groups);
    assertEquals(2, groups.size());
    // Check there are two activities in each group
    assertEquals(2, groups.get(0).getActivities().size());
    assertEquals(2, groups.get(1).getActivities().size());
    // Check there are five external ids in each group
    assertEquals(5, groups.get(0).getGroupKeys().size());
    assertEquals(5, groups.get(1).getGroupKeys().size());
    // Check each funding
    checkActivityIsOnGroups(funding1, groups);
    checkActivityIsOnGroups(funding2, groups);
    checkActivityIsOnGroups(funding5, groups);
    checkActivityIsOnGroups(funding6, groups);
    // Check funding1 and funding2 are in the same group
    checkActivitiesBelongsToTheSameGroup(groups, funding1, funding2);
    // Check funding6 and funding7 are in the same group
    checkActivitiesBelongsToTheSameGroup(groups, funding5, funding6);
    // Check fundings are not mixed
    checkActivitiesDontBelongsToTheSameGroup(groups, funding1, funding5);
    checkActivitiesDontBelongsToTheSameGroup(groups, funding1, funding6);
    checkActivitiesDontBelongsToTheSameGroup(groups, funding2, funding5);
    checkActivitiesDontBelongsToTheSameGroup(groups, funding2, funding6);
}
Also used : FundingSummary(org.orcid.jaxb.model.v3.dev1.record.summary.FundingSummary) Test(org.junit.Test)

Example 48 with Funding

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

the class ActivityUtilsTest method getEmptyFunding.

private Funding getEmptyFunding() {
    Funding f = new Funding();
    FundingContributors fcs = new FundingContributors();
    FundingContributor fc = new FundingContributor();
    fc.setCreditName(new CreditName(""));
    fcs.getContributor().add(fc);
    f.setContributors(fcs);
    return f;
}
Also used : Funding(org.orcid.jaxb.model.v3.dev1.record.Funding) FundingContributor(org.orcid.jaxb.model.v3.dev1.record.FundingContributor) FundingContributors(org.orcid.jaxb.model.v3.dev1.record.FundingContributors) CreditName(org.orcid.jaxb.model.v3.dev1.common.CreditName)

Example 49 with Funding

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

the class ActivityUtilsTest method setPathToFundingsTest.

@Test
public void setPathToFundingsTest() {
    Fundings x = getFundings();
    ActivityUtils.setPathToFundings(x, ORCID);
    assertEquals("/" + ORCID + "/funding/123", x.getFundingGroup().get(0).getFundingSummary().get(0).getPath());
}
Also used : Fundings(org.orcid.jaxb.model.v3.dev1.record.summary.Fundings) Test(org.junit.Test)

Example 50 with Funding

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

the class ActivityUtilsTest method setPathToActivitiesSummaryTest.

@Test
public void setPathToActivitiesSummaryTest() {
    ActivitiesSummary x = new ActivitiesSummary();
    x.setDistinctions(getDistinctions());
    x.setEducations(getEducations());
    x.setEmployments(getEmployments());
    x.setInvitedPositions(getInvitedPositions());
    x.setFundings(getFundings());
    x.setMemberships(getMemberships());
    x.setQualifications(getQualifications());
    x.setServices(getServices());
    x.setWorks(getWorks());
    x.setPeerReviews(getPeerReviews());
    ActivityUtils.setPathToActivity(x, ORCID);
    assertEquals("/" + ORCID + "/activities", x.getPath());
    assertEquals("/" + ORCID + "/distinction/123", x.getDistinctions().getSummaries().get(0).getPath());
    assertEquals("/" + ORCID + "/education/123", x.getEducations().getSummaries().get(0).getPath());
    assertEquals("/" + ORCID + "/employment/123", x.getEmployments().getSummaries().get(0).getPath());
    assertEquals("/" + ORCID + "/invited-position/123", x.getInvitedPositions().getSummaries().get(0).getPath());
    assertEquals("/" + ORCID + "/funding/123", x.getFundings().getFundingGroup().get(0).getFundingSummary().get(0).getPath());
    assertEquals("/" + ORCID + "/membership/123", x.getMemberships().getSummaries().get(0).getPath());
    assertEquals("/" + ORCID + "/qualification/123", x.getQualifications().getSummaries().get(0).getPath());
    assertEquals("/" + ORCID + "/service/123", x.getServices().getSummaries().get(0).getPath());
    assertEquals("/" + ORCID + "/work/123", x.getWorks().getWorkGroup().get(0).getWorkSummary().get(0).getPath());
    assertEquals("/" + ORCID + "/peer-review/123", x.getPeerReviews().getPeerReviewGroup().get(0).getPeerReviewSummary().get(0).getPath());
}
Also used : ActivitiesSummary(org.orcid.jaxb.model.v3.dev1.record.summary.ActivitiesSummary) 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