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);
}
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);
}
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());
}
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());
}
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;
}
Aggregations