Search in sources :

Example 21 with V2Convertible

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

the class ConvertVrc4ToV2Test method upgradeFundingsToVrc3Test.

@Test
public void upgradeFundingsToVrc3Test() throws JAXBException {
    JAXBContext jaxbContext1 = JAXBContext.newInstance(Fundings.class);
    JAXBContext jaxbContext2 = JAXBContext.newInstance(org.orcid.jaxb.model.record.summary_v2.Fundings.class);
    Unmarshaller jaxbUnmarshaller = jaxbContext1.createUnmarshaller();
    InputStream rc3Stream = ConvertVrc4ToV2Test.class.getClassLoader().getResourceAsStream("test-fundings-2.0_rc4.xml");
    InputStream rc4Stream = ConvertVrc4ToV2Test.class.getClassLoader().getResourceAsStream("test-fundings-2.0.xml");
    Fundings rc4Fundings = (Fundings) jaxbUnmarshaller.unmarshal(rc3Stream);
    jaxbUnmarshaller = jaxbContext2.createUnmarshaller();
    org.orcid.jaxb.model.record.summary_v2.Fundings rc4Fundings1 = (org.orcid.jaxb.model.record.summary_v2.Fundings) jaxbUnmarshaller.unmarshal(rc4Stream);
    V2Convertible result = versionConverterV2_0_rc4ToV2_0.upgrade(new V2Convertible(rc4Fundings, "v2_rc4"));
    org.orcid.jaxb.model.record.summary_v2.Fundings rc4Fundings2 = (org.orcid.jaxb.model.record.summary_v2.Fundings) result.getObjectToConvert();
    assertEquals(rc4Fundings1, rc4Fundings2);
}
Also used : V2Convertible(org.orcid.core.version.V2Convertible) Fundings(org.orcid.jaxb.model.record.summary_rc4.Fundings) InputStream(java.io.InputStream) JAXBContext(javax.xml.bind.JAXBContext) Unmarshaller(javax.xml.bind.Unmarshaller) Test(org.junit.Test) BaseTest(org.orcid.core.BaseTest)

Example 22 with V2Convertible

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

the class ConvertVrc1ToVrc2Test method upgradeToVrc2Test.

@Test
public void upgradeToVrc2Test() throws JAXBException {
    JAXBContext jaxbContext1 = JAXBContext.newInstance(ActivitiesSummary.class);
    JAXBContext jaxbContext2 = JAXBContext.newInstance(org.orcid.jaxb.model.record.summary_rc2.ActivitiesSummary.class);
    Unmarshaller jaxbUnmarshaller1 = jaxbContext1.createUnmarshaller();
    Unmarshaller jaxbUnmarshaller2 = jaxbContext2.createUnmarshaller();
    InputStream rc1Stream = ConvertVrc1ToVrc2Test.class.getClassLoader().getResourceAsStream("test-activities-2.0_rc1.xml");
    InputStream rc2Stream = ConvertVrc1ToVrc2Test.class.getClassLoader().getResourceAsStream("test-activities-2.0_rc2.xml");
    ActivitiesSummary rc1Activities = (ActivitiesSummary) jaxbUnmarshaller1.unmarshal(rc1Stream);
    org.orcid.jaxb.model.record.summary_rc2.ActivitiesSummary rc2Activities1 = (org.orcid.jaxb.model.record.summary_rc2.ActivitiesSummary) jaxbUnmarshaller2.unmarshal(rc2Stream);
    V2Convertible result = versionConverterV2_0_rc1ToV2_0_rc2.upgrade(new V2Convertible(rc1Activities, "v2_rc1"));
    org.orcid.jaxb.model.record.summary_rc2.ActivitiesSummary rc2Activities2 = (org.orcid.jaxb.model.record.summary_rc2.ActivitiesSummary) result.getObjectToConvert();
    //assertEquals(1,rc2Activities2.getFundings().getFundingGroup().get(0).getIdentifiers().getExternalIdentifier().size());
    //assertEquals("common:external-id-value",rc2Activities2.getFundings().getFundingGroup().get(0).getIdentifiers().getExternalIdentifier().get(0).getValue());
    assertEquals(rc2Activities1.toString(), rc2Activities2.toString());
}
Also used : V2Convertible(org.orcid.core.version.V2Convertible) InputStream(java.io.InputStream) JAXBContext(javax.xml.bind.JAXBContext) ActivitiesSummary(org.orcid.jaxb.model.record.summary_rc1.ActivitiesSummary) Unmarshaller(javax.xml.bind.Unmarshaller) Test(org.junit.Test) BaseTest(org.orcid.core.BaseTest)

Example 23 with V2Convertible

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

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

the class ConvertVrc1ToVrc2Test method upgradeFundingsToVrc2Test.

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

Example 25 with V2Convertible

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

the class ConvertVrc1ToVrc2Test method upgradeWorksToVrc2Test.

@Test
public void upgradeWorksToVrc2Test() throws JAXBException {
    JAXBContext jaxbContext1 = JAXBContext.newInstance(Works.class);
    JAXBContext jaxbContext2 = JAXBContext.newInstance(org.orcid.jaxb.model.record.summary_rc2.Works.class);
    Unmarshaller jaxbUnmarshaller = jaxbContext1.createUnmarshaller();
    InputStream rc1Stream = ConvertVrc1ToVrc2Test.class.getClassLoader().getResourceAsStream("test-works-2.0_rc1.xml");
    InputStream rc2Stream = ConvertVrc1ToVrc2Test.class.getClassLoader().getResourceAsStream("test-works-2.0_rc2.xml");
    Works rc1Works = (Works) jaxbUnmarshaller.unmarshal(rc1Stream);
    jaxbUnmarshaller = jaxbContext2.createUnmarshaller();
    org.orcid.jaxb.model.record.summary_rc2.Works rc2Works1 = (org.orcid.jaxb.model.record.summary_rc2.Works) jaxbUnmarshaller.unmarshal(rc2Stream);
    V2Convertible result = versionConverterV2_0_rc1ToV2_0_rc2.upgrade(new V2Convertible(rc1Works, "v2_rc1"));
    org.orcid.jaxb.model.record.summary_rc2.Works rc2Works2 = (org.orcid.jaxb.model.record.summary_rc2.Works) result.getObjectToConvert();
    assertEquals(rc2Works1.getLastModifiedDate(), rc2Works2.getLastModifiedDate());
}
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_rc1.Works) 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