use of org.orcid.jaxb.model.record.summary_rc4.Fundings 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.jaxb.model.record.summary_rc4.Fundings in project ORCID-Source by ORCID.
the class PublicAPISecurityManagerV2Test method filterFundingsTest.
@Test
public void filterFundingsTest() {
Fundings f = getFundings(Visibility.PUBLIC, Visibility.PUBLIC, Visibility.PUBLIC);
assertEquals(3, f.getFundingGroup().size());
publicAPISecurityManagerV2.filter(f);
assertEquals(3, f.getFundingGroup().size());
assertGroupContainsOnlyPublicElements(f);
f = getFundings(Visibility.PUBLIC, Visibility.PUBLIC, Visibility.LIMITED);
assertEquals(3, f.getFundingGroup().size());
publicAPISecurityManagerV2.filter(f);
assertEquals(2, f.getFundingGroup().size());
assertGroupContainsOnlyPublicElements(f);
f = getFundings(Visibility.PUBLIC, Visibility.LIMITED, Visibility.PRIVATE);
assertEquals(3, f.getFundingGroup().size());
publicAPISecurityManagerV2.filter(f);
assertEquals(1, f.getFundingGroup().size());
assertGroupContainsOnlyPublicElements(f);
f = getFundings(Visibility.PRIVATE, Visibility.LIMITED, Visibility.PRIVATE);
assertEquals(3, f.getFundingGroup().size());
publicAPISecurityManagerV2.filter(f);
assertTrue(f.getFundingGroup().isEmpty());
}
use of org.orcid.jaxb.model.record.summary_rc4.Fundings in project ORCID-Source by ORCID.
the class PublicAPISecurityManagerV2Test method getFundings.
private Fundings getFundings(Visibility... vs) {
Fundings fundings = new Fundings();
for (Visibility v : vs) {
FundingGroup g = new FundingGroup();
FundingSummary s = new FundingSummary();
s.setVisibility(v);
g.getFundingSummary().add(s);
fundings.getFundingGroup().add(g);
}
return fundings;
}
use of org.orcid.jaxb.model.record.summary_rc4.Fundings 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.jaxb.model.record.summary_rc4.Fundings in project ORCID-Source by ORCID.
the class ConvertVrc3ToVrc4Test method upgradeFundingsToVrc3Test.
@Test
public void upgradeFundingsToVrc3Test() throws JAXBException {
JAXBContext jaxbContext1 = JAXBContext.newInstance(Fundings.class);
JAXBContext jaxbContext2 = JAXBContext.newInstance(org.orcid.jaxb.model.record.summary_rc4.Fundings.class);
Unmarshaller jaxbUnmarshaller = jaxbContext1.createUnmarshaller();
InputStream rc3Stream = ConvertVrc3ToVrc4Test.class.getClassLoader().getResourceAsStream("test-fundings-2.0_rc3.xml");
InputStream rc4Stream = ConvertVrc3ToVrc4Test.class.getClassLoader().getResourceAsStream("test-fundings-2.0_rc4.xml");
Fundings rc4Fundings = (Fundings) jaxbUnmarshaller.unmarshal(rc3Stream);
jaxbUnmarshaller = jaxbContext2.createUnmarshaller();
org.orcid.jaxb.model.record.summary_rc4.Fundings rc4Fundings1 = (org.orcid.jaxb.model.record.summary_rc4.Fundings) jaxbUnmarshaller.unmarshal(rc4Stream);
V2Convertible result = versionConverterV2_0_rc3ToV2_0_rc4.upgrade(new V2Convertible(rc4Fundings, "v2_rc3"));
org.orcid.jaxb.model.record.summary_rc4.Fundings rc4Fundings2 = (org.orcid.jaxb.model.record.summary_rc4.Fundings) result.getObjectToConvert();
assertEquals(rc4Fundings1, rc4Fundings2);
}
Aggregations