use of org.orcid.jaxb.model.record_rc2.Addresses in project ORCID-Source by ORCID.
the class ValidateV2RC3SamplesTest method testUnmarshallAddress.
@Test
public void testUnmarshallAddress() throws SAXException, URISyntaxException {
Addresses addresses = (Addresses) unmarshallFromPath("/record_2.0_rc3/samples/addresses-2.0_rc3.xml", Addresses.class, "/record_2.0_rc3/address-2.0_rc3.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_rc3/samples/address-2.0_rc3.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 ValidateV2RC4SamplesTest method testUnmarshallAddress.
@Test
public void testUnmarshallAddress() throws SAXException, URISyntaxException {
Addresses addresses = (Addresses) unmarshallFromPath("/record_2.0_rc4/samples/addresses-2.0_rc4.xml", Addresses.class, "/record_2.0_rc4/address-2.0_rc4.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_rc4/samples/address-2.0_rc4.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 ValidateV2RC4SamplesTest method testMarshallAddress.
@Test
public void testMarshallAddress() throws JAXBException, SAXException, URISyntaxException {
Addresses object = (Addresses) unmarshallFromPath("/record_2.0_rc4/samples/addresses-2.0_rc4.xml", Addresses.class);
marshall(object, "/record_2.0_rc4/address-2.0_rc4.xsd");
}
use of org.orcid.jaxb.model.record_rc2.Addresses in project ORCID-Source by ORCID.
the class PublicV2ApiServiceDelegatorTest method testViewAddresses.
@Test
public void testViewAddresses() {
Response response = serviceDelegator.viewAddresses(ORCID);
assertNotNull(response);
Addresses addresses = (Addresses) response.getEntity();
assertNotNull(addresses);
assertNotNull(addresses.getLastModifiedDate());
assertNotNull(addresses.getLastModifiedDate().getValue());
assertEquals("/0000-0000-0000-0003/address", addresses.getPath());
assertEquals(1, addresses.getAddress().size());
Address address = addresses.getAddress().get(0);
assertNotNull(address);
assertNotNull(address.getLastModifiedDate());
assertNotNull(address.getLastModifiedDate().getValue());
assertEquals(Long.valueOf(9), address.getPutCode());
assertNotNull(address.getCountry());
assertEquals(Iso3166Country.US, address.getCountry().getValue());
assertEquals(Visibility.PUBLIC.value(), address.getVisibility().value());
assertEquals("/0000-0000-0000-0003/address/9", address.getPath());
assertEquals("APP-5555555555555555", address.getSource().retrieveSourcePath());
}
use of org.orcid.jaxb.model.record_rc2.Addresses in project ORCID-Source by ORCID.
the class MemberV2ApiServiceDelegator_AddressesTest method testViewAddresses.
@Test
public void testViewAddresses() {
SecurityContextTestUtils.setUpSecurityContext("4444-4444-4444-4447", ScopePathType.PERSON_READ_LIMITED);
Response response = serviceDelegator.viewAddresses("4444-4444-4444-4447");
assertNotNull(response);
Addresses addresses = (Addresses) response.getEntity();
assertNotNull(addresses);
assertEquals("/4444-4444-4444-4447/address", addresses.getPath());
Utils.verifyLastModified(addresses.getLastModifiedDate());
assertNotNull(addresses.getAddress());
assertEquals(3, addresses.getAddress().size());
for (Address address : addresses.getAddress()) {
Utils.verifyLastModified(address.getLastModifiedDate());
assertThat(address.getPutCode(), anyOf(is(2L), is(3L), is(4L)));
assertThat(address.getCountry().getValue(), anyOf(is(Iso3166Country.CR), is(Iso3166Country.US)));
if (address.getPutCode() == 2L) {
assertEquals(Visibility.PUBLIC, address.getVisibility());
assertEquals("4444-4444-4444-4447", address.getSource().retrieveSourcePath());
} else if (address.getPutCode() == 3L) {
assertEquals(Visibility.LIMITED, address.getVisibility());
assertEquals("APP-5555555555555555", address.getSource().retrieveSourcePath());
} else if (address.getPutCode() == 4L) {
assertEquals(Visibility.PRIVATE, address.getVisibility());
assertEquals("APP-5555555555555555", address.getSource().retrieveSourcePath());
}
}
}
Aggregations