Search in sources :

Example 26 with Service

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());
}
Also used : ActivitiesSummary(org.orcid.jaxb.model.v3.dev1.record.summary.ActivitiesSummary) Test(org.junit.Test)

Example 27 with Service

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);
}
Also used : InputStream(java.io.InputStream) Service(org.orcid.jaxb.model.v3.dev1.record.Service) JAXBContext(javax.xml.bind.JAXBContext) Unmarshaller(javax.xml.bind.Unmarshaller)

Example 28 with Service

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());
}
Also used : Service(org.orcid.jaxb.model.v3.dev1.record.Service) OrgAffiliationRelationEntity(org.orcid.persistence.jpa.entities.OrgAffiliationRelationEntity) Test(org.junit.Test)

Example 29 with Service

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());
}
Also used : Response(javax.ws.rs.core.Response) Service(org.orcid.jaxb.model.v3.dev1.record.Service) DBUnitTest(org.orcid.test.DBUnitTest) Test(org.junit.Test)

Example 30 with Service

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());
}
Also used : Response(javax.ws.rs.core.Response) Service(org.orcid.jaxb.model.v3.dev1.record.Service) DBUnitTest(org.orcid.test.DBUnitTest) Test(org.junit.Test)

Aggregations

Service (org.orcid.jaxb.model.v3.dev1.record.Service)41 Test (org.junit.Test)31 DBUnitTest (org.orcid.test.DBUnitTest)18 Response (javax.ws.rs.core.Response)17 Distinction (org.orcid.jaxb.model.v3.dev1.record.Distinction)11 Education (org.orcid.jaxb.model.v3.dev1.record.Education)11 Membership (org.orcid.jaxb.model.v3.dev1.record.Membership)11 Employment (org.orcid.jaxb.model.v3.dev1.record.Employment)10 InvitedPosition (org.orcid.jaxb.model.v3.dev1.record.InvitedPosition)10 Qualification (org.orcid.jaxb.model.v3.dev1.record.Qualification)10 Affiliation (org.orcid.jaxb.model.v3.dev1.record.Affiliation)8 ServiceSummary (org.orcid.jaxb.model.v3.dev1.record.summary.ServiceSummary)7 OrgAffiliationRelationEntity (org.orcid.persistence.jpa.entities.OrgAffiliationRelationEntity)6 ResearcherUrl (org.orcid.jaxb.model.v3.dev1.record.ResearcherUrl)5 ArrayList (java.util.ArrayList)4 List (java.util.List)4 Funding (org.orcid.jaxb.model.v3.dev1.record.Funding)4 Work (org.orcid.jaxb.model.v3.dev1.record.Work)4 ActivitiesSummary (org.orcid.jaxb.model.v3.dev1.record.summary.ActivitiesSummary)4 Services (org.orcid.jaxb.model.v3.dev1.record.summary.Services)4