use of org.orcid.jaxb.model.v3.dev1.record.Qualification in project ORCID-Source by ORCID.
the class MemberV3ApiServiceDelegator_QualificationsTest method testViewPublicQualification.
@Test
public void testViewPublicQualification() {
SecurityContextTestUtils.setUpSecurityContext(ORCID, ScopePathType.READ_LIMITED);
Response response = serviceDelegator.viewQualification(ORCID, 42L);
assertNotNull(response);
Qualification qualification = (Qualification) response.getEntity();
assertNotNull(qualification);
Utils.verifyLastModified(qualification.getLastModifiedDate());
assertEquals(Long.valueOf(42L), qualification.getPutCode());
assertEquals("/0000-0000-0000-0003/qualification/42", qualification.getPath());
assertEquals("PUBLIC Department", qualification.getDepartmentName());
assertEquals(Visibility.PUBLIC.value(), qualification.getVisibility().value());
}
use of org.orcid.jaxb.model.v3.dev1.record.Qualification in project ORCID-Source by ORCID.
the class MemberV3ApiServiceDelegator_QualificationsTest method testViewPrivateQualification.
@Test
public void testViewPrivateQualification() {
SecurityContextTestUtils.setUpSecurityContext(ORCID, ScopePathType.READ_LIMITED);
Response response = serviceDelegator.viewQualification(ORCID, 44L);
assertNotNull(response);
Qualification qualification = (Qualification) response.getEntity();
assertNotNull(qualification);
Utils.verifyLastModified(qualification.getLastModifiedDate());
assertEquals(Long.valueOf(44L), qualification.getPutCode());
assertEquals("/0000-0000-0000-0003/qualification/44", qualification.getPath());
assertEquals("PRIVATE Department", qualification.getDepartmentName());
assertEquals(Visibility.PRIVATE.value(), qualification.getVisibility().value());
}
use of org.orcid.jaxb.model.v3.dev1.record.Qualification in project ORCID-Source by ORCID.
the class JpaJaxbQualificationAdapterTest method testToOrgAffiliationRelationEntity.
@Test
public void testToOrgAffiliationRelationEntity() throws JAXBException {
Qualification e = getQualification();
assertNotNull(e);
OrgAffiliationRelationEntity oar = adapter.toOrgAffiliationRelationEntity(e);
assertNotNull(oar);
// General info
assertEquals(Long.valueOf(0), oar.getId());
assertEquals(Visibility.PRIVATE.value(), oar.getVisibility().value());
assertEquals("department-name", oar.getDepartment());
assertEquals("role-title", oar.getTitle());
// Dates
assertEquals(Integer.valueOf(2), oar.getStartDate().getDay());
assertEquals(Integer.valueOf(2), oar.getStartDate().getMonth());
assertEquals(Integer.valueOf(1848), oar.getStartDate().getYear());
assertEquals(Integer.valueOf(2), oar.getEndDate().getDay());
assertEquals(Integer.valueOf(2), oar.getEndDate().getMonth());
assertEquals(Integer.valueOf(1848), oar.getEndDate().getYear());
// Source
assertNull(oar.getSourceId());
assertNull(oar.getClientSourceId());
assertNull(oar.getElementSourceId());
}
use of org.orcid.jaxb.model.v3.dev1.record.Qualification in project ORCID-Source by ORCID.
the class JpaJaxbQualificationAdapterTest method getQualification.
private Qualification getQualification() throws JAXBException {
JAXBContext context = JAXBContext.newInstance(new Class[] { Qualification.class });
Unmarshaller unmarshaller = context.createUnmarshaller();
String name = "/record_3.0_dev1/samples/read_samples/qualification-3.0_dev1.xml";
InputStream inputStream = getClass().getResourceAsStream(name);
return (Qualification) unmarshaller.unmarshal(inputStream);
}
use of org.orcid.jaxb.model.v3.dev1.record.Qualification in project ORCID-Source by ORCID.
the class JpaJaxbQualificationAdapterTest method fromOrgAffiliationRelationEntityToQualification.
@Test
public void fromOrgAffiliationRelationEntityToQualification() {
OrgAffiliationRelationEntity entity = getEntity();
assertNotNull(entity);
Qualification qualification = adapter.toQualification(entity);
assertNotNull(qualification);
assertEquals("qualification:department", qualification.getDepartmentName());
assertEquals(Long.valueOf(123456), qualification.getPutCode());
assertEquals("qualification:title", qualification.getRoleTitle());
assertEquals("private", qualification.getVisibility().value());
assertNotNull(qualification.getStartDate());
assertEquals("2000", qualification.getStartDate().getYear().getValue());
assertEquals("01", qualification.getStartDate().getMonth().getValue());
assertEquals("01", qualification.getStartDate().getDay().getValue());
assertEquals("2020", qualification.getEndDate().getYear().getValue());
assertEquals("02", qualification.getEndDate().getMonth().getValue());
assertEquals("02", qualification.getEndDate().getDay().getValue());
assertNotNull(qualification.getOrganization());
assertEquals("org:name", qualification.getOrganization().getName());
assertNotNull(qualification.getOrganization().getAddress());
assertEquals("org:city", qualification.getOrganization().getAddress().getCity());
assertEquals("org:region", qualification.getOrganization().getAddress().getRegion());
assertEquals(org.orcid.jaxb.model.v3.dev1.common.Iso3166Country.US, qualification.getOrganization().getAddress().getCountry());
assertNotNull(qualification.getSource());
assertNotNull(qualification.getSource().retrieveSourcePath());
assertEquals("APP-000000001", qualification.getSource().retrieveSourcePath());
}
Aggregations