Search in sources :

Example 31 with Qualification

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

Example 32 with Qualification

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

Example 33 with Qualification

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

Example 34 with Qualification

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

Example 35 with Qualification

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

Aggregations

Qualification (org.orcid.jaxb.model.v3.dev1.record.Qualification)40 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 Service (org.orcid.jaxb.model.v3.dev1.record.Service)11 Employment (org.orcid.jaxb.model.v3.dev1.record.Employment)10 InvitedPosition (org.orcid.jaxb.model.v3.dev1.record.InvitedPosition)10 Affiliation (org.orcid.jaxb.model.v3.dev1.record.Affiliation)8 QualificationSummary (org.orcid.jaxb.model.v3.dev1.record.summary.QualificationSummary)7 OrgAffiliationRelationEntity (org.orcid.persistence.jpa.entities.OrgAffiliationRelationEntity)6 ResearcherUrl (org.orcid.jaxb.model.v3.dev1.record.ResearcherUrl)5 ActivitiesSummary (org.orcid.jaxb.model.v3.dev1.record.summary.ActivitiesSummary)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 Qualifications (org.orcid.jaxb.model.v3.dev1.record.summary.Qualifications)4