use of io.grpc.channelz.v1.Address in project ORCID-Source by ORCID.
the class AddressManagerTest method displayIndexIsSetTo_0_FromAPI.
@Test
public void displayIndexIsSetTo_0_FromAPI() {
when(sourceManager.retrieveSourceEntity()).thenReturn(new SourceEntity(new ClientDetailsEntity(CLIENT_1_ID)));
Address address = getAddress(Iso3166Country.PE);
address = addressManager.createAddress(claimedOrcid, address, true);
address = addressManager.getAddress(claimedOrcid, address.getPutCode());
assertNotNull(address);
assertEquals(Long.valueOf(0), address.getDisplayIndex());
}
use of io.grpc.channelz.v1.Address in project ORCID-Source by ORCID.
the class AddressManagerTest method testAddAddressToUnclaimedRecordPreserveAddressVisibility.
@Test
public void testAddAddressToUnclaimedRecordPreserveAddressVisibility() {
when(sourceManager.retrieveSourceEntity()).thenReturn(new SourceEntity(new ClientDetailsEntity(CLIENT_1_ID)));
Address address = getAddress(Iso3166Country.CR);
address = addressManager.createAddress(unclaimedOrcid, address, true);
address = addressManager.getAddress(unclaimedOrcid, address.getPutCode());
assertNotNull(address);
assertEquals(Visibility.PUBLIC, address.getVisibility());
}
use of io.grpc.channelz.v1.Address in project ORCID-Source by ORCID.
the class AddressManagerTest method testAddAddressToClaimedRecordPreserveUserDefaultVisibility.
@Test
public void testAddAddressToClaimedRecordPreserveUserDefaultVisibility() {
when(sourceManager.retrieveSourceEntity()).thenReturn(new SourceEntity(new ClientDetailsEntity(CLIENT_1_ID)));
Address address = getAddress(Iso3166Country.US);
address = addressManager.createAddress(claimedOrcid, address, true);
address = addressManager.getAddress(claimedOrcid, address.getPutCode());
assertNotNull(address);
assertEquals(Visibility.LIMITED, address.getVisibility());
}
use of io.grpc.channelz.v1.Address 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);
}
}
use of io.grpc.channelz.v1.Address in project ORCID-Source by ORCID.
the class Api2_0_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