use of org.orcid.jaxb.model.record_rc2.Addresses in project ORCID-Source by ORCID.
the class ValidateV2SamplesTest method testUnmarshallAddress.
@Test
public void testUnmarshallAddress() throws SAXException, URISyntaxException {
Addresses addresses = (Addresses) unmarshallFromPath("/record_2.0/samples/read_samples/addresses-2.0.xml", Addresses.class, "/record_2.0/address-2.0.xsd");
assertNotNull(addresses);
assertNotNull(addresses.getAddress());
assertEquals(2, addresses.getAddress().size());
for (Address address : addresses.getAddress()) {
assertNotNull(address.getPutCode());
assertNotNull(address.getCreatedDate());
assertNotNull(address.getLastModifiedDate());
assertNotNull(address.getCountry());
if (address.getPutCode().equals(new Long(1))) {
assertEquals(Iso3166Country.US, address.getCountry().getValue());
assertEquals(Visibility.PUBLIC, address.getVisibility());
} else {
assertEquals(Iso3166Country.CR, address.getCountry().getValue());
assertEquals(Visibility.LIMITED, address.getVisibility());
}
}
Address address = (Address) unmarshallFromPath("/record_2.0/samples/read_samples/address-2.0.xml", Address.class);
assertNotNull(address);
assertNotNull(address.getPutCode());
assertNotNull(address.getCreatedDate());
assertNotNull(address.getLastModifiedDate());
assertNotNull(address.getCountry());
assertEquals(Iso3166Country.US, address.getCountry().getValue());
assertEquals(Visibility.PUBLIC, address.getVisibility());
}
use of org.orcid.jaxb.model.record_rc2.Addresses in project ORCID-Source by ORCID.
the class ValidateV2_1SamplesTest method testMarshallAddress.
@Test
public void testMarshallAddress() throws JAXBException, SAXException, URISyntaxException {
Addresses object = (Addresses) unmarshallFromPath("/record_2.1/samples/read_samples/addresses-2.1.xml", Addresses.class);
marshall(object, "/record_2.1/address-2.1.xsd");
}
use of org.orcid.jaxb.model.record_rc2.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_rc2.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_rc2.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());
}
Aggregations