Search in sources :

Example 31 with Employment

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

the class PojoUtilTest method affiliationsCreateDateSortString_NullStartYearTest.

@Test
public void affiliationsCreateDateSortString_NullStartYearTest() {
    Affiliation aff = new Employment();
    FuzzyDate start = new FuzzyDate();
    start.setDay(new Day(1));
    start.setMonth(new Month(2));
    aff.setStartDate(start);
    String dateSortString = PojoUtil.createDateSortString(aff);
    assertEquals("Y-NaN-02-01", dateSortString);
}
Also used : Month(org.orcid.jaxb.model.v3.dev1.common.Month) Employment(org.orcid.jaxb.model.v3.dev1.record.Employment) FuzzyDate(org.orcid.jaxb.model.v3.dev1.common.FuzzyDate) Day(org.orcid.jaxb.model.v3.dev1.common.Day) Affiliation(org.orcid.jaxb.model.v3.dev1.record.Affiliation) Test(org.junit.Test)

Example 32 with Employment

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

the class PojoUtilTest method affiliationsCreateDateSortString_StartAndEndDateExistsTest.

@Test
public void affiliationsCreateDateSortString_StartAndEndDateExistsTest() {
    Affiliation aff = new Employment();
    FuzzyDate start = new FuzzyDate();
    FuzzyDate end = new FuzzyDate();
    start.setDay(new Day(1));
    start.setMonth(new Month(2));
    start.setYear(new Year(3));
    end.setDay(new Day(4));
    end.setMonth(new Month(5));
    end.setYear(new Year(6));
    aff.setStartDate(start);
    aff.setEndDate(end);
    String dateSortString = PojoUtil.createDateSortString(aff);
    assertNotNull(dateSortString);
    assertEquals("X-6-05-04-3-02-01", dateSortString);
}
Also used : Month(org.orcid.jaxb.model.v3.dev1.common.Month) Year(org.orcid.jaxb.model.v3.dev1.common.Year) Employment(org.orcid.jaxb.model.v3.dev1.record.Employment) FuzzyDate(org.orcid.jaxb.model.v3.dev1.common.FuzzyDate) Day(org.orcid.jaxb.model.v3.dev1.common.Day) Affiliation(org.orcid.jaxb.model.v3.dev1.record.Affiliation) Test(org.junit.Test)

Example 33 with Employment

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

the class ActivityUtilsTest method setPathToEmploymentsTest.

@Test
public void setPathToEmploymentsTest() {
    Employments x = getEmployments();
    ActivityUtils.setPathToAffiliations(x, ORCID);
    assertEquals("/" + ORCID + "/employment/123", x.getSummaries().get(0).getPath());
}
Also used : Employments(org.orcid.jaxb.model.v3.dev1.record.summary.Employments) Test(org.junit.Test)

Example 34 with Employment

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

Example 35 with Employment

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

the class JpaJaxbEmploymentAdapterTest method getEmployment.

private Employment getEmployment(boolean full) throws JAXBException {
    JAXBContext context = JAXBContext.newInstance(new Class[] { Employment.class });
    Unmarshaller unmarshaller = context.createUnmarshaller();
    Marshaller m = context.createMarshaller();
    String name = "/record_3.0_dev1/samples/read_samples/employment-3.0_dev1.xml";
    if (full) {
        name = "/record_3.0_dev1/samples/read_samples/employment-full-3.0_dev1.xml";
    }
    InputStream inputStream = getClass().getResourceAsStream(name);
    Employment e = (Employment) unmarshaller.unmarshal(inputStream);
    StringWriter stringWriter = new StringWriter();
    m.marshal(e, stringWriter);
    System.out.println(stringWriter.toString());
    return e;
}
Also used : Marshaller(javax.xml.bind.Marshaller) StringWriter(java.io.StringWriter) Employment(org.orcid.jaxb.model.v3.dev1.record.Employment) InputStream(java.io.InputStream) JAXBContext(javax.xml.bind.JAXBContext) Unmarshaller(javax.xml.bind.Unmarshaller)

Aggregations

Employment (org.orcid.jaxb.model.v3.dev1.record.Employment)61 Test (org.junit.Test)53 DBUnitTest (org.orcid.test.DBUnitTest)21 Response (javax.ws.rs.core.Response)20 Affiliation (org.orcid.jaxb.model.v3.dev1.record.Affiliation)18 Education (org.orcid.jaxb.model.v3.dev1.record.Education)13 Distinction (org.orcid.jaxb.model.v3.dev1.record.Distinction)11 Membership (org.orcid.jaxb.model.v3.dev1.record.Membership)11 Service (org.orcid.jaxb.model.v3.dev1.record.Service)11 FuzzyDate (org.orcid.jaxb.model.v3.dev1.common.FuzzyDate)10 InvitedPosition (org.orcid.jaxb.model.v3.dev1.record.InvitedPosition)10 Qualification (org.orcid.jaxb.model.v3.dev1.record.Qualification)10 Day (org.orcid.jaxb.model.v3.dev1.common.Day)8 Month (org.orcid.jaxb.model.v3.dev1.common.Month)8 Year (org.orcid.jaxb.model.v3.dev1.common.Year)8 ResearcherUrl (org.orcid.jaxb.model.v3.dev1.record.ResearcherUrl)8 EmploymentSummary (org.orcid.jaxb.model.v3.dev1.record.summary.EmploymentSummary)8 ActivitiesSummary (org.orcid.jaxb.model.v3.dev1.record.summary.ActivitiesSummary)7 Funding (org.orcid.jaxb.model.v3.dev1.record.Funding)6 Work (org.orcid.jaxb.model.v3.dev1.record.Work)6