Search in sources :

Example 26 with Educations

use of org.orcid.jaxb.model.record.summary_rc3.Educations in project ORCID-Source by ORCID.

the class ConvertVrc1ToVrc2Test method upgradeEducationsToVrc2Test.

@Test
public void upgradeEducationsToVrc2Test() throws JAXBException {
    JAXBContext jaxbContext1 = JAXBContext.newInstance(Educations.class);
    JAXBContext jaxbContext2 = JAXBContext.newInstance(org.orcid.jaxb.model.record.summary_rc2.Educations.class);
    Unmarshaller jaxbUnmarshaller = jaxbContext1.createUnmarshaller();
    InputStream rc1Stream = ConvertVrc1ToVrc2Test.class.getClassLoader().getResourceAsStream("test-educations-2.0_rc1.xml");
    InputStream rc2Stream = ConvertVrc1ToVrc2Test.class.getClassLoader().getResourceAsStream("test-educations-2.0_rc2.xml");
    Educations rc1Educations = (Educations) jaxbUnmarshaller.unmarshal(rc1Stream);
    jaxbUnmarshaller = jaxbContext2.createUnmarshaller();
    org.orcid.jaxb.model.record.summary_rc2.Educations rc2Educations1 = (org.orcid.jaxb.model.record.summary_rc2.Educations) jaxbUnmarshaller.unmarshal(rc2Stream);
    V2Convertible result = versionConverterV2_0_rc1ToV2_0_rc2.upgrade(new V2Convertible(rc1Educations, "v2_rc1"));
    org.orcid.jaxb.model.record.summary_rc2.Educations rc2Educations2 = (org.orcid.jaxb.model.record.summary_rc2.Educations) result.getObjectToConvert();
    assertEquals(rc2Educations1.getLastModifiedDate(), rc2Educations2.getLastModifiedDate());
}
Also used : V2Convertible(org.orcid.core.version.V2Convertible) InputStream(java.io.InputStream) JAXBContext(javax.xml.bind.JAXBContext) Educations(org.orcid.jaxb.model.record.summary_rc1.Educations) Unmarshaller(javax.xml.bind.Unmarshaller) Test(org.junit.Test) BaseTest(org.orcid.core.BaseTest)

Example 27 with Educations

use of org.orcid.jaxb.model.record.summary_rc3.Educations in project ORCID-Source by ORCID.

the class ConvertVrc2ToVrc3Test method upgradeEducationsToVrc3Test.

@Test
public void upgradeEducationsToVrc3Test() throws JAXBException {
    JAXBContext jaxbContext1 = JAXBContext.newInstance(Educations.class);
    JAXBContext jaxbContext2 = JAXBContext.newInstance(org.orcid.jaxb.model.record.summary_rc3.Educations.class);
    Unmarshaller jaxbUnmarshaller = jaxbContext1.createUnmarshaller();
    InputStream rc2Stream = ConvertVrc2ToVrc3Test.class.getClassLoader().getResourceAsStream("test-educations-2.0_rc2.xml");
    InputStream rc3Stream = ConvertVrc2ToVrc3Test.class.getClassLoader().getResourceAsStream("test-educations-2.0_rc3.xml");
    Educations rc2Educations = (Educations) jaxbUnmarshaller.unmarshal(rc2Stream);
    jaxbUnmarshaller = jaxbContext2.createUnmarshaller();
    org.orcid.jaxb.model.record.summary_rc3.Educations rc3Educations1 = (org.orcid.jaxb.model.record.summary_rc3.Educations) jaxbUnmarshaller.unmarshal(rc3Stream);
    V2Convertible result = versionConverterV2_0_rc2ToV2_0_rc3.upgrade(new V2Convertible(rc2Educations, "v2_rc2"));
    org.orcid.jaxb.model.record.summary_rc3.Educations rc3Educations2 = (org.orcid.jaxb.model.record.summary_rc3.Educations) result.getObjectToConvert();
    assertEquals(rc3Educations1, rc3Educations2);
}
Also used : V2Convertible(org.orcid.core.version.V2Convertible) InputStream(java.io.InputStream) JAXBContext(javax.xml.bind.JAXBContext) Educations(org.orcid.jaxb.model.record.summary_rc2.Educations) Unmarshaller(javax.xml.bind.Unmarshaller) Test(org.junit.Test) BaseTest(org.orcid.core.BaseTest)

Example 28 with Educations

use of org.orcid.jaxb.model.record.summary_rc3.Educations in project ORCID-Source by ORCID.

the class ConvertVrc3ToVrc4Test method upgradeEducationsToVrc3Test.

@Test
public void upgradeEducationsToVrc3Test() throws JAXBException {
    JAXBContext jaxbContext1 = JAXBContext.newInstance(Educations.class);
    JAXBContext jaxbContext2 = JAXBContext.newInstance(org.orcid.jaxb.model.record.summary_rc4.Educations.class);
    Unmarshaller jaxbUnmarshaller = jaxbContext1.createUnmarshaller();
    InputStream rc3Stream = ConvertVrc3ToVrc4Test.class.getClassLoader().getResourceAsStream("test-educations-2.0_rc3.xml");
    InputStream rc4Stream = ConvertVrc3ToVrc4Test.class.getClassLoader().getResourceAsStream("test-educations-2.0_rc4.xml");
    Educations rc4Educations = (Educations) jaxbUnmarshaller.unmarshal(rc3Stream);
    jaxbUnmarshaller = jaxbContext2.createUnmarshaller();
    org.orcid.jaxb.model.record.summary_rc4.Educations rc4Educations1 = (org.orcid.jaxb.model.record.summary_rc4.Educations) jaxbUnmarshaller.unmarshal(rc4Stream);
    V2Convertible result = versionConverterV2_0_rc3ToV2_0_rc4.upgrade(new V2Convertible(rc4Educations, "v2_rc3"));
    org.orcid.jaxb.model.record.summary_rc4.Educations rc4Educations2 = (org.orcid.jaxb.model.record.summary_rc4.Educations) result.getObjectToConvert();
    assertEquals(rc4Educations1, rc4Educations2);
}
Also used : V2Convertible(org.orcid.core.version.V2Convertible) InputStream(java.io.InputStream) JAXBContext(javax.xml.bind.JAXBContext) Educations(org.orcid.jaxb.model.record.summary_rc3.Educations) Unmarshaller(javax.xml.bind.Unmarshaller) Test(org.junit.Test) BaseTest(org.orcid.core.BaseTest)

Example 29 with Educations

use of org.orcid.jaxb.model.record.summary_rc3.Educations in project ORCID-Source by ORCID.

the class ConvertV2ToV2_1Test method upgradeEducationsToV21Test.

@Test
public void upgradeEducationsToV21Test() throws JAXBException {
    JAXBContext jaxbContext1 = JAXBContext.newInstance(Educations.class);
    JAXBContext jaxbContext2 = JAXBContext.newInstance(Educations.class);
    Unmarshaller jaxbUnmarshaller = jaxbContext1.createUnmarshaller();
    InputStream v20Stream = ConvertV2ToV2_1Test.class.getClassLoader().getResourceAsStream("test-educations-2.0.xml");
    InputStream v21Stream = ConvertV2ToV2_1Test.class.getClassLoader().getResourceAsStream("test-educations-2.1.xml");
    Educations v20Educations = (Educations) jaxbUnmarshaller.unmarshal(v20Stream);
    jaxbUnmarshaller = jaxbContext2.createUnmarshaller();
    Educations v21Educations1 = (Educations) jaxbUnmarshaller.unmarshal(v21Stream);
    V2Convertible result = versionConverterV2_0ToV2_1.upgrade(new V2Convertible(v20Educations, "v2.1"));
    Educations v21Educations2 = (Educations) result.getObjectToConvert();
    assertEquals(v21Educations1, v21Educations2);
}
Also used : V2Convertible(org.orcid.core.version.V2Convertible) InputStream(java.io.InputStream) Educations(org.orcid.jaxb.model.record.summary_v2.Educations) JAXBContext(javax.xml.bind.JAXBContext) Unmarshaller(javax.xml.bind.Unmarshaller) Test(org.junit.Test) BaseTest(org.orcid.core.BaseTest)

Example 30 with Educations

use of org.orcid.jaxb.model.record.summary_rc3.Educations in project ORCID-Source by ORCID.

the class PublicV2ApiServiceDelegatorImpl method viewEducations.

@Override
public Response viewEducations(String orcid) {
    List<EducationSummary> educations = affiliationsManagerReadOnly.getEducationSummaryList(orcid, getLastModifiedTime(orcid));
    Educations publicEducations = new Educations();
    for (EducationSummary summary : educations) {
        if (Visibility.PUBLIC.equals(summary.getVisibility())) {
            ActivityUtils.setPathToActivity(summary, orcid);
            sourceUtilsReadOnly.setSourceName(summary);
            publicEducations.getSummaries().add(summary);
        }
    }
    Api2_0_LastModifiedDatesHelper.calculateLastModified(publicEducations);
    ActivityUtils.setPathToEducations(publicEducations, orcid);
    return Response.ok(publicEducations).build();
}
Also used : EducationSummary(org.orcid.jaxb.model.record.summary_v2.EducationSummary) Educations(org.orcid.jaxb.model.record.summary_v2.Educations)

Aggregations

Test (org.junit.Test)26 Educations (org.orcid.jaxb.model.record.summary_v2.Educations)18 EducationSummary (org.orcid.jaxb.model.record.summary_v2.EducationSummary)13 ClientResponse (com.sun.jersey.api.client.ClientResponse)10 EmploymentSummary (org.orcid.jaxb.model.record.summary_v2.EmploymentSummary)8 Employments (org.orcid.jaxb.model.record.summary_v2.Employments)8 FundingSummary (org.orcid.jaxb.model.record.summary_v2.FundingSummary)8 Fundings (org.orcid.jaxb.model.record.summary_v2.Fundings)8 WorkSummary (org.orcid.jaxb.model.record.summary_v2.WorkSummary)8 Works (org.orcid.jaxb.model.record.summary_v2.Works)8 PeerReviewSummary (org.orcid.jaxb.model.record.summary_v2.PeerReviewSummary)6 PeerReviews (org.orcid.jaxb.model.record.summary_v2.PeerReviews)6 InputStream (java.io.InputStream)5 Response (javax.ws.rs.core.Response)5 JAXBContext (javax.xml.bind.JAXBContext)5 Unmarshaller (javax.xml.bind.Unmarshaller)5 BaseTest (org.orcid.core.BaseTest)5 V2Convertible (org.orcid.core.version.V2Convertible)5 FundingGroup (org.orcid.jaxb.model.record.summary_v2.FundingGroup)5 PeerReviewGroup (org.orcid.jaxb.model.record.summary_v2.PeerReviewGroup)5