Search in sources :

Example 36 with V2Convertible

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

the class ConvertVrc3ToVrc4Test method upgradeEmploymentsToVrc3Test.

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

Example 37 with V2Convertible

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

the class ConvertVrc3ToVrc4Test method upgradeGroupIdToVrc3Test.

@Test
public void upgradeGroupIdToVrc3Test() throws JAXBException {
    JAXBContext jaxbContext1 = JAXBContext.newInstance(GroupIdRecords.class);
    JAXBContext jaxbContext2 = JAXBContext.newInstance(org.orcid.jaxb.model.groupid_rc4.GroupIdRecords.class);
    Unmarshaller jaxbUnmarshaller = jaxbContext1.createUnmarshaller();
    InputStream rc3Stream = ConvertVrc3ToVrc4Test.class.getClassLoader().getResourceAsStream("test-group-id-2.0_rc3.xml");
    InputStream rc4Stream = ConvertVrc3ToVrc4Test.class.getClassLoader().getResourceAsStream("test-group-id-2.0_rc4.xml");
    GroupIdRecords rc4Group = (GroupIdRecords) jaxbUnmarshaller.unmarshal(rc3Stream);
    jaxbUnmarshaller = jaxbContext2.createUnmarshaller();
    org.orcid.jaxb.model.groupid_rc4.GroupIdRecords rc4GroupId1 = (org.orcid.jaxb.model.groupid_rc4.GroupIdRecords) jaxbUnmarshaller.unmarshal(rc4Stream);
    V2Convertible result = versionConverterV2_0_rc3ToV2_0_rc4.upgrade(new V2Convertible(rc4Group, "v2_rc3"));
    org.orcid.jaxb.model.groupid_rc4.GroupIdRecords rc4GroupId2 = (org.orcid.jaxb.model.groupid_rc4.GroupIdRecords) result.getObjectToConvert();
    assertEquals(rc4GroupId1, rc4GroupId2);
}
Also used : V2Convertible(org.orcid.core.version.V2Convertible) InputStream(java.io.InputStream) JAXBContext(javax.xml.bind.JAXBContext) GroupIdRecords(org.orcid.jaxb.model.groupid_rc3.GroupIdRecords) Unmarshaller(javax.xml.bind.Unmarshaller) Test(org.junit.Test) BaseTest(org.orcid.core.BaseTest)

Example 38 with V2Convertible

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

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

the class ConvertVrc3ToVrc4Test method upgradeWorksToVrc3Test.

@Test
public void upgradeWorksToVrc3Test() throws JAXBException {
    JAXBContext jaxbContext1 = JAXBContext.newInstance(Works.class);
    JAXBContext jaxbContext2 = JAXBContext.newInstance(org.orcid.jaxb.model.record.summary_rc4.Works.class);
    Unmarshaller jaxbUnmarshaller = jaxbContext1.createUnmarshaller();
    InputStream rc3Stream = ConvertVrc3ToVrc4Test.class.getClassLoader().getResourceAsStream("test-works-2.0_rc3.xml");
    InputStream rc4Stream = ConvertVrc3ToVrc4Test.class.getClassLoader().getResourceAsStream("test-works-2.0_rc4.xml");
    Works rc4Works = (Works) jaxbUnmarshaller.unmarshal(rc3Stream);
    jaxbUnmarshaller = jaxbContext2.createUnmarshaller();
    org.orcid.jaxb.model.record.summary_rc4.Works rc4Works1 = (org.orcid.jaxb.model.record.summary_rc4.Works) jaxbUnmarshaller.unmarshal(rc4Stream);
    V2Convertible result = versionConverterV2_0_rc3ToV2_0_rc4.upgrade(new V2Convertible(rc4Works, "v2_rc3"));
    org.orcid.jaxb.model.record.summary_rc4.Works rc4Works2 = (org.orcid.jaxb.model.record.summary_rc4.Works) result.getObjectToConvert();
    assertEquals(rc4Works1, rc4Works2);
}
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_rc3.Works) Test(org.junit.Test) BaseTest(org.orcid.core.BaseTest)

Example 40 with V2Convertible

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

the class ConvertV2ToV2_1Test method upgradeAddressesToV21Test.

@Test
public void upgradeAddressesToV21Test() throws JAXBException {
    JAXBContext jaxbContext1 = JAXBContext.newInstance(Addresses.class);
    JAXBContext jaxbContext2 = JAXBContext.newInstance(Addresses.class);
    Unmarshaller jaxbUnmarshaller = jaxbContext1.createUnmarshaller();
    InputStream v20Stream = ConvertV2ToV2_1Test.class.getClassLoader().getResourceAsStream("test-addresses-2.0.xml");
    InputStream v21Stream = ConvertV2ToV2_1Test.class.getClassLoader().getResourceAsStream("test-addresses-2.1.xml");
    Addresses v20Element = (Addresses) jaxbUnmarshaller.unmarshal(v20Stream);
    jaxbUnmarshaller = jaxbContext2.createUnmarshaller();
    Addresses v21Element1 = (Addresses) jaxbUnmarshaller.unmarshal(v21Stream);
    V2Convertible result = versionConverterV2_0ToV2_1.upgrade(new V2Convertible(v20Element, "v2.1"));
    Addresses v21Element2 = (Addresses) result.getObjectToConvert();
    assertEquals(v21Element1, v21Element2);
}
Also used : Addresses(org.orcid.jaxb.model.record_v2.Addresses) 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)

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