use of org.orcid.jaxb.model.record_rc3.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_rc3.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_rc3.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_rc3.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_rc3.Addresses in project ORCID-Source by ORCID.
the class Api2_0_rc3_LastModifiedDatesHelper method calculateLastModified.
public static void calculateLastModified(Addresses addresses) {
if (addresses != null && addresses.getAddress() != null && !addresses.getAddress().isEmpty()) {
LastModifiedDate latest = null;
for (Address address : addresses.getAddress()) {
if (address.getLastModifiedDate() != null && address.getLastModifiedDate().after(latest)) {
latest = address.getLastModifiedDate();
}
}
addresses.setLastModifiedDate(latest);
}
}
Aggregations