use of org.orcid.jaxb.model.v3.dev1.record.Service 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.Service in project ORCID-Source by ORCID.
the class JpaJaxbServiceAdapterTest method getService.
private Service getService() throws JAXBException {
JAXBContext context = JAXBContext.newInstance(new Class[] { Service.class });
Unmarshaller unmarshaller = context.createUnmarshaller();
String name = "/record_3.0_dev1/samples/read_samples/service-3.0_dev1.xml";
InputStream inputStream = getClass().getResourceAsStream(name);
return (Service) unmarshaller.unmarshal(inputStream);
}
use of org.orcid.jaxb.model.v3.dev1.record.Service in project ORCID-Source by ORCID.
the class JpaJaxbServiceAdapterTest method fromOrgAffiliationRelationEntityToService.
@Test
public void fromOrgAffiliationRelationEntityToService() {
OrgAffiliationRelationEntity entity = getEntity();
assertNotNull(entity);
Service service = adapter.toService(entity);
assertNotNull(service);
assertEquals("service:department", service.getDepartmentName());
assertEquals(Long.valueOf(123456), service.getPutCode());
assertEquals("service:title", service.getRoleTitle());
assertEquals("private", service.getVisibility().value());
assertNotNull(service.getStartDate());
assertEquals("2000", service.getStartDate().getYear().getValue());
assertEquals("01", service.getStartDate().getMonth().getValue());
assertEquals("01", service.getStartDate().getDay().getValue());
assertEquals("2020", service.getEndDate().getYear().getValue());
assertEquals("02", service.getEndDate().getMonth().getValue());
assertEquals("02", service.getEndDate().getDay().getValue());
assertNotNull(service.getOrganization());
assertEquals("org:name", service.getOrganization().getName());
assertNotNull(service.getOrganization().getAddress());
assertEquals("org:city", service.getOrganization().getAddress().getCity());
assertEquals("org:region", service.getOrganization().getAddress().getRegion());
assertEquals(org.orcid.jaxb.model.v3.dev1.common.Iso3166Country.US, service.getOrganization().getAddress().getCountry());
assertNotNull(service.getSource());
assertNotNull(service.getSource().retrieveSourcePath());
assertEquals("APP-000000001", service.getSource().retrieveSourcePath());
}
use of org.orcid.jaxb.model.v3.dev1.record.Service in project ORCID-Source by ORCID.
the class MemberV3ApiServiceDelegator_ServicesTest method testViewLimitedService.
@Test
public void testViewLimitedService() {
SecurityContextTestUtils.setUpSecurityContext(ORCID, ScopePathType.READ_LIMITED);
Response response = serviceDelegator.viewService(ORCID, 50L);
assertNotNull(response);
Service service = (Service) response.getEntity();
assertNotNull(service);
Utils.verifyLastModified(service.getLastModifiedDate());
assertEquals(Long.valueOf(50L), service.getPutCode());
assertEquals("/0000-0000-0000-0003/service/50", service.getPath());
assertEquals("SELF LIMITED Department", service.getDepartmentName());
assertEquals(Visibility.LIMITED.value(), service.getVisibility().value());
}
use of org.orcid.jaxb.model.v3.dev1.record.Service in project ORCID-Source by ORCID.
the class MemberV3ApiServiceDelegator_ServicesTest method testViewPrivateService.
@Test
public void testViewPrivateService() {
SecurityContextTestUtils.setUpSecurityContext(ORCID, ScopePathType.READ_LIMITED);
Response response = serviceDelegator.viewService(ORCID, 49L);
assertNotNull(response);
Service service = (Service) response.getEntity();
assertNotNull(service);
Utils.verifyLastModified(service.getLastModifiedDate());
assertEquals(Long.valueOf(49L), service.getPutCode());
assertEquals("/0000-0000-0000-0003/service/49", service.getPath());
assertEquals("PRIVATE Department", service.getDepartmentName());
assertEquals(Visibility.PRIVATE.value(), service.getVisibility().value());
}
Aggregations