use of org.orcid.core.version.V2Convertible in project ORCID-Source by ORCID.
the class ConvertVrc1ToVrc2Test method upgradeGroupIdToVrc2Test.
@Test
public void upgradeGroupIdToVrc2Test() throws JAXBException {
JAXBContext jaxbContext1 = JAXBContext.newInstance(GroupIdRecords.class);
JAXBContext jaxbContext2 = JAXBContext.newInstance(org.orcid.jaxb.model.groupid_rc2.GroupIdRecords.class);
Unmarshaller jaxbUnmarshaller = jaxbContext1.createUnmarshaller();
InputStream rc1Stream = ConvertVrc1ToVrc2Test.class.getClassLoader().getResourceAsStream("test-group-id-2.0_rc1.xml");
InputStream rc2Stream = ConvertVrc1ToVrc2Test.class.getClassLoader().getResourceAsStream("test-group-id-2.0_rc2.xml");
GroupIdRecords rc1Works = (GroupIdRecords) jaxbUnmarshaller.unmarshal(rc1Stream);
jaxbUnmarshaller = jaxbContext2.createUnmarshaller();
org.orcid.jaxb.model.groupid_rc2.GroupIdRecords rc2GroupId1 = (org.orcid.jaxb.model.groupid_rc2.GroupIdRecords) jaxbUnmarshaller.unmarshal(rc2Stream);
V2Convertible result = versionConverterV2_0_rc1ToV2_0_rc2.upgrade(new V2Convertible(rc1Works, "v2_rc1"));
org.orcid.jaxb.model.groupid_rc2.GroupIdRecords rc2GroupId2 = (org.orcid.jaxb.model.groupid_rc2.GroupIdRecords) result.getObjectToConvert();
assertEquals(rc2GroupId1.getLastModifiedDate(), rc2GroupId2.getLastModifiedDate());
}
use of org.orcid.core.version.V2Convertible in project ORCID-Source by ORCID.
the class ConvertVrc2ToVrc3Test method upgradeAddressesToVrc3Test.
@Test
public void upgradeAddressesToVrc3Test() throws JAXBException {
JAXBContext jaxbContext1 = JAXBContext.newInstance(Addresses.class);
JAXBContext jaxbContext2 = JAXBContext.newInstance(org.orcid.jaxb.model.record_rc3.Addresses.class);
Unmarshaller jaxbUnmarshaller = jaxbContext1.createUnmarshaller();
InputStream rc2Stream = ConvertVrc2ToVrc3Test.class.getClassLoader().getResourceAsStream("test-addresses-2.0_rc2.xml");
InputStream rc3Stream = ConvertVrc2ToVrc3Test.class.getClassLoader().getResourceAsStream("test-addresses-2.0_rc3.xml");
Addresses rc2Element = (Addresses) jaxbUnmarshaller.unmarshal(rc2Stream);
jaxbUnmarshaller = jaxbContext2.createUnmarshaller();
org.orcid.jaxb.model.record_rc3.Addresses rc3Element1 = (org.orcid.jaxb.model.record_rc3.Addresses) jaxbUnmarshaller.unmarshal(rc3Stream);
V2Convertible result = versionConverterV2_0_rc2ToV2_0_rc3.upgrade(new V2Convertible(rc2Element, "v2_rc2"));
org.orcid.jaxb.model.record_rc3.Addresses rc3Element2 = (org.orcid.jaxb.model.record_rc3.Addresses) result.getObjectToConvert();
assertEquals(rc3Element1, rc3Element2);
}
use of org.orcid.core.version.V2Convertible in project ORCID-Source by ORCID.
the class ConvertVrc2ToVrc3Test method upgradePeerReviewsToVrc3Test.
@Test
public void upgradePeerReviewsToVrc3Test() throws JAXBException {
JAXBContext jaxbContext1 = JAXBContext.newInstance(PeerReviews.class);
JAXBContext jaxbContext2 = JAXBContext.newInstance(org.orcid.jaxb.model.record.summary_rc3.PeerReviews.class);
Unmarshaller jaxbUnmarshaller = jaxbContext1.createUnmarshaller();
InputStream rc2Stream = ConvertVrc2ToVrc3Test.class.getClassLoader().getResourceAsStream("test-peer-reviews-2.0_rc2.xml");
InputStream rc3Stream = ConvertVrc2ToVrc3Test.class.getClassLoader().getResourceAsStream("test-peer-reviews-2.0_rc3.xml");
PeerReviews rc2PeerReviews = (PeerReviews) jaxbUnmarshaller.unmarshal(rc2Stream);
jaxbUnmarshaller = jaxbContext2.createUnmarshaller();
org.orcid.jaxb.model.record.summary_rc3.PeerReviews rc3PeerReviews1 = (org.orcid.jaxb.model.record.summary_rc3.PeerReviews) jaxbUnmarshaller.unmarshal(rc3Stream);
V2Convertible result = versionConverterV2_0_rc2ToV2_0_rc3.upgrade(new V2Convertible(rc2PeerReviews, "v2_rc2"));
org.orcid.jaxb.model.record.summary_rc3.PeerReviews rc3PeerReviews2 = (org.orcid.jaxb.model.record.summary_rc3.PeerReviews) result.getObjectToConvert();
assertEquals(rc3PeerReviews1, rc3PeerReviews2);
}
use of org.orcid.core.version.V2Convertible in project ORCID-Source by ORCID.
the class ConvertVrc2ToVrc3Test method upgradeGroupIdToVrc3Test.
@Test
public void upgradeGroupIdToVrc3Test() throws JAXBException {
JAXBContext jaxbContext1 = JAXBContext.newInstance(GroupIdRecords.class);
JAXBContext jaxbContext2 = JAXBContext.newInstance(org.orcid.jaxb.model.groupid_rc3.GroupIdRecords.class);
Unmarshaller jaxbUnmarshaller = jaxbContext1.createUnmarshaller();
InputStream rc2Stream = ConvertVrc2ToVrc3Test.class.getClassLoader().getResourceAsStream("test-group-id-2.0_rc2.xml");
InputStream rc3Stream = ConvertVrc2ToVrc3Test.class.getClassLoader().getResourceAsStream("test-group-id-2.0_rc3.xml");
GroupIdRecords rc2Group = (GroupIdRecords) jaxbUnmarshaller.unmarshal(rc2Stream);
jaxbUnmarshaller = jaxbContext2.createUnmarshaller();
org.orcid.jaxb.model.groupid_rc3.GroupIdRecords rc3GroupId1 = (org.orcid.jaxb.model.groupid_rc3.GroupIdRecords) jaxbUnmarshaller.unmarshal(rc3Stream);
V2Convertible result = versionConverterV2_0_rc2ToV2_0_rc3.upgrade(new V2Convertible(rc2Group, "v2_rc2"));
org.orcid.jaxb.model.groupid_rc3.GroupIdRecords rc3GroupId2 = (org.orcid.jaxb.model.groupid_rc3.GroupIdRecords) result.getObjectToConvert();
assertEquals(rc3GroupId1, rc3GroupId2);
}
use of org.orcid.core.version.V2Convertible in project ORCID-Source by ORCID.
the class ConvertVrc2ToVrc3Test method upgradeWorksToVrc3Test.
@Test
public void upgradeWorksToVrc3Test() throws JAXBException {
JAXBContext jaxbContext1 = JAXBContext.newInstance(Works.class);
JAXBContext jaxbContext2 = JAXBContext.newInstance(org.orcid.jaxb.model.record.summary_rc3.Works.class);
Unmarshaller jaxbUnmarshaller = jaxbContext1.createUnmarshaller();
InputStream rc2Stream = ConvertVrc2ToVrc3Test.class.getClassLoader().getResourceAsStream("test-works-2.0_rc2.xml");
InputStream rc3Stream = ConvertVrc2ToVrc3Test.class.getClassLoader().getResourceAsStream("test-works-2.0_rc3.xml");
Works rc2Works = (Works) jaxbUnmarshaller.unmarshal(rc2Stream);
jaxbUnmarshaller = jaxbContext2.createUnmarshaller();
org.orcid.jaxb.model.record.summary_rc3.Works rc3Works1 = (org.orcid.jaxb.model.record.summary_rc3.Works) jaxbUnmarshaller.unmarshal(rc3Stream);
V2Convertible result = versionConverterV2_0_rc2ToV2_0_rc3.upgrade(new V2Convertible(rc2Works, "v2_rc2"));
org.orcid.jaxb.model.record.summary_rc3.Works rc3Works2 = (org.orcid.jaxb.model.record.summary_rc3.Works) result.getObjectToConvert();
assertEquals(rc3Works1, rc3Works2);
}
Aggregations