Search in sources :

Example 41 with V2Convertible

use of org.orcid.core.version.V2Convertible in project ORCID-Source by ORCID.

the class ConvertV2ToV2_1Test method upgradeActivitiesToV21Test.

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

Example 42 with V2Convertible

use of org.orcid.core.version.V2Convertible in project ORCID-Source by ORCID.

the class ConvertV2ToV2_1Test method upgradeWorksToV21Test.

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

Example 43 with V2Convertible

use of org.orcid.core.version.V2Convertible in project ORCID-Source by ORCID.

the class ConvertV2ToV2_1Test method upgradeEmploymentsToV21Test.

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

Example 44 with V2Convertible

use of org.orcid.core.version.V2Convertible in project ORCID-Source by ORCID.

the class ConvertVrc1ToVrc2Test method upgradeEmploymentsToVrc2Test.

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

Example 45 with V2Convertible

use of org.orcid.core.version.V2Convertible 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)

Aggregations

V2Convertible (org.orcid.core.version.V2Convertible)46 InputStream (java.io.InputStream)39 JAXBContext (javax.xml.bind.JAXBContext)39 Unmarshaller (javax.xml.bind.Unmarshaller)39 Test (org.junit.Test)39 BaseTest (org.orcid.core.BaseTest)39 MappingContext (ma.glasnost.orika.MappingContext)2 GroupIdRecords (org.orcid.jaxb.model.groupid_rc1.GroupIdRecords)1 GroupIdRecords (org.orcid.jaxb.model.groupid_rc2.GroupIdRecords)1 GroupIdRecords (org.orcid.jaxb.model.groupid_rc3.GroupIdRecords)1 GroupIdRecords (org.orcid.jaxb.model.groupid_rc4.GroupIdRecords)1 GroupIdRecords (org.orcid.jaxb.model.groupid_v2.GroupIdRecords)1 ActivitiesSummary (org.orcid.jaxb.model.record.summary_rc1.ActivitiesSummary)1 Educations (org.orcid.jaxb.model.record.summary_rc1.Educations)1 Employments (org.orcid.jaxb.model.record.summary_rc1.Employments)1 Fundings (org.orcid.jaxb.model.record.summary_rc1.Fundings)1 PeerReviews (org.orcid.jaxb.model.record.summary_rc1.PeerReviews)1 Works (org.orcid.jaxb.model.record.summary_rc1.Works)1 ActivitiesSummary (org.orcid.jaxb.model.record.summary_rc2.ActivitiesSummary)1 Educations (org.orcid.jaxb.model.record.summary_rc2.Educations)1