use of org.orcid.jaxb.model.record_rc4.Addresses in project ORCID-Source by ORCID.
the class ValidateV2SamplesTest method testMarshallAddress.
@Test
public void testMarshallAddress() throws JAXBException, SAXException, URISyntaxException {
Addresses object = (Addresses) unmarshallFromPath("/record_2.0/samples/read_samples/addresses-2.0.xml", Addresses.class);
marshall(object, "/record_2.0/address-2.0.xsd");
}
use of org.orcid.jaxb.model.record_rc4.Addresses in project ORCID-Source by ORCID.
the class PublicAPISecurityManagerV2Test method getAddressesElement.
private Addresses getAddressesElement(Visibility... vs) {
Addresses elements = new Addresses();
for (Visibility v : vs) {
Address element = new Address();
element.setVisibility(v);
if (elements.getAddress() == null) {
elements.setAddress(new ArrayList<Address>());
}
elements.getAddress().add(element);
}
return elements;
}
use of org.orcid.jaxb.model.record_rc4.Addresses in project ORCID-Source by ORCID.
the class PublicAPISecurityManagerV2Test method filterAddressesTest.
@Test
public void filterAddressesTest() {
Addresses x = getAddressesElement(Visibility.PUBLIC, Visibility.PUBLIC, Visibility.PUBLIC);
assertEquals(3, x.getAddress().size());
publicAPISecurityManagerV2.filter(x);
assertEquals(3, x.getAddress().size());
assertAllArePublic(x.getAddress());
x = getAddressesElement(Visibility.PUBLIC, Visibility.PUBLIC, Visibility.LIMITED);
assertEquals(3, x.getAddress().size());
publicAPISecurityManagerV2.filter(x);
assertEquals(2, x.getAddress().size());
assertAllArePublic(x.getAddress());
x = getAddressesElement(Visibility.PUBLIC, Visibility.LIMITED, Visibility.PRIVATE);
assertEquals(3, x.getAddress().size());
publicAPISecurityManagerV2.filter(x);
assertEquals(1, x.getAddress().size());
assertAllArePublic(x.getAddress());
x = getAddressesElement(Visibility.PRIVATE, Visibility.LIMITED, Visibility.PRIVATE);
assertEquals(3, x.getAddress().size());
publicAPISecurityManagerV2.filter(x);
assertTrue(x.getAddress().isEmpty());
}
use of org.orcid.jaxb.model.record_rc4.Addresses 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.jaxb.model.record_rc4.Addresses 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);
}
Aggregations