use of org.orcid.jaxb.model.record_rc1.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();
String name = "/record_2.0/samples/read_samples/employment-2.0.xml";
if (full) {
name = "/record_2.0/samples/read_samples/employment-full-2.0.xml";
}
InputStream inputStream = getClass().getResourceAsStream(name);
return (Employment) unmarshaller.unmarshal(inputStream);
}
use of org.orcid.jaxb.model.record_rc1.Employment in project ORCID-Source by ORCID.
the class AffiliationsManagerTest method testAddEmploymentToClaimedRecordPreserveUserDefaultVisibility.
@Test
public void testAddEmploymentToClaimedRecordPreserveUserDefaultVisibility() {
when(sourceManager.retrieveSourceEntity()).thenReturn(new SourceEntity(new ClientDetailsEntity(CLIENT_1_ID)));
Employment employment = getEmployment();
employment = affiliationsManager.createEmploymentAffiliation(claimedOrcid, employment, true);
employment = affiliationsManager.getEmploymentAffiliation(claimedOrcid, employment.getPutCode());
assertNotNull(employment);
assertEquals(Visibility.LIMITED, employment.getVisibility());
}
use of org.orcid.jaxb.model.record_rc1.Employment in project ORCID-Source by ORCID.
the class AffiliationsManagerTest method getEmployment.
private Employment getEmployment() {
Employment employment = new Employment();
Organization org = new Organization();
org.setName("org-name");
OrganizationAddress address = new OrganizationAddress();
address.setCity("city");
address.setCountry(Iso3166Country.US);
org.setAddress(address);
employment.setOrganization(org);
employment.setStartDate(new FuzzyDate(new Year(2016), new Month(3), new Day(29)));
employment.setVisibility(Visibility.PUBLIC);
return employment;
}
use of org.orcid.jaxb.model.record_rc1.Employment in project ORCID-Source by ORCID.
the class ActivityValidatorTest method validateEmployment_invalidPutCodeTest.
@Test(expected = InvalidPutCodeException.class)
public void validateEmployment_invalidPutCodeTest() {
Employment employment = getEmployment();
employment.setPutCode(1L);
activityValidator.validateEmployment(employment, null, true, true, Visibility.PUBLIC);
}
use of org.orcid.jaxb.model.record_rc1.Employment in project ORCID-Source by ORCID.
the class BlackBoxBaseRC1 method unmarshallFromPath.
public Object unmarshallFromPath(String path, Class<?> type) {
try (Reader reader = new InputStreamReader(getClass().getResourceAsStream(path))) {
Object obj = unmarshall(reader, type);
Object result = null;
if (Education.class.equals(type)) {
result = (Education) obj;
} else if (Employment.class.equals(type)) {
result = (Employment) obj;
} else if (Funding.class.equals(type)) {
result = (Funding) obj;
} else if (Work.class.equals(type)) {
result = (Work) obj;
} else if (PeerReview.class.equals(type)) {
result = (PeerReview) obj;
}
return result;
} catch (IOException e) {
throw new RuntimeException("Error reading notification from classpath", e);
}
}
Aggregations