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);
}
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());
}
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());
}
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());
}
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());
}
Aggregations