use of io.grpc.channelz.v1.Address in project ORCID-Source by ORCID.
the class AddressManagerTest method getAllTest.
@Test
public void getAllTest() {
String orcid = "0000-0000-0000-0003";
Addresses elements = addressManager.getAddresses(orcid);
assertNotNull(elements);
assertNotNull(elements.getAddress());
assertEquals(5, elements.getAddress().size());
boolean found1 = false, found2 = false, found3 = false, found4 = false, found5 = false;
for (Address element : elements.getAddress()) {
if (9 == element.getPutCode()) {
found1 = true;
} else if (10 == element.getPutCode()) {
found2 = true;
} else if (11 == element.getPutCode()) {
found3 = true;
} else if (12 == element.getPutCode()) {
found4 = true;
} else if (13 == element.getPutCode()) {
found5 = true;
} else {
fail("Invalid put code found: " + element.getPutCode());
}
}
assertTrue(found1);
assertTrue(found2);
assertTrue(found3);
assertTrue(found4);
assertTrue(found5);
}
use of io.grpc.channelz.v1.Address in project webofneeds by researchstudio-sat.
the class GeneratedSourcesTests method test1Generated_data001.
@Test
public void test1Generated_data001() throws IOException {
Shapes shapes = loadShapes(testBaseFolder.createRelative("test1/shapes.ttl"));
Shacl2JavaConfig config = Shacl2JavaConfig.builder().packageName("test1").build();
Model data = loadData(testBaseFolder.createRelative("test1/data-001.ttl"));
Shacl2JavaInstanceFactory factory = new Shacl2JavaInstanceFactory(shapes, config.getPackageName());
Shacl2JavaInstanceFactory.Accessor accessor = factory.accessor(data.getGraph());
Map<String, Set<Object>> entities = accessor.getInstanceMap();
Assert.assertEquals(4, entities.size());
Optional<Person> bob = accessor.getInstanceOfType("https://example.com/ns#Bob", Person.class);
Assert.assertTrue(bob.isPresent());
Optional<Address> address = accessor.getInstanceOfType("https://example.com/ns#BobsAddress", Address.class);
Assert.assertTrue(address.isPresent());
Assert.assertSame(address.get(), bob.get().getAddresses().stream().findFirst().get());
Assert.assertEquals("1234", bob.get().getAddresses().stream().findFirst().get().getPostalCode());
}
use of io.grpc.channelz.v1.Address in project lispflowmapping by opendaylight.
the class VppNodeReader method readIpAddressFromInterface.
private Optional<Ipv4Address> readIpAddressFromInterface(Interface intf, KeyedInstanceIdentifier iiToVpp) {
Interface2 augIntf = intf.getAugmentation(Interface2.class);
if (augIntf == null) {
LOG.debug("Cannot get Interface2 augmentation for intf {}");
return Optional.absent();
}
Ipv4 ipv4 = augIntf.getIpv4();
if (ipv4 == null) {
LOG.debug("Ipv4 address for interface {} on node {} is null!", augIntf, InfoUtil.node(iiToVpp));
return Optional.absent();
}
final List<Address> addresses = ipv4.getAddress();
if (addresses == null || addresses.isEmpty()) {
LOG.debug("Ipv4 addresses list is empty for interface {} on node {}", augIntf, InfoUtil.node(iiToVpp));
return Optional.absent();
}
final Ipv4AddressNoZone ip = addresses.iterator().next().getIp();
if (ip == null) {
LOG.debug("Ipv4AddressNoZone is null for node {}", InfoUtil.node(iiToVpp));
return Optional.absent();
}
LOG.debug("Got ip address {} from interface {} on node {}", ip.getValue(), intf.getName(), InfoUtil.node(iiToVpp));
return Optional.of(ip);
}
use of io.grpc.channelz.v1.Address in project okhttp-digest by rburgst.
the class AuthenticationCacheInterceptorTest method beforeMethod.
@Before
public void beforeMethod() {
MockitoAnnotations.initMocks(this);
// setup some dummy data so that we dont get NPEs
Address address = new Address("localhost", 8080, mockDns, socketFactory, null, null, null, proxyAuthenticator, null, Collections.singletonList(Protocol.HTTP_1_1), Collections.singletonList(ConnectionSpec.MODERN_TLS), proxySelector);
InetSocketAddress inetSocketAddress = new InetSocketAddress("localhost", 8080);
mockRoute = new Route(address, proxy, inetSocketAddress);
given(mockConnection.route()).willReturn(mockRoute);
}
use of io.grpc.channelz.v1.Address in project okhttp-digest by rburgst.
the class DispatchingAuthenticatorTest method beforeMethod.
@Before
public void beforeMethod() {
MockitoAnnotations.initMocks(this);
// setup some dummy data so that we dont get NPEs
Address address = new Address("localhost", 8080, mockDns, socketFactory, null, null, null, proxyAuthenticator, null, Collections.singletonList(Protocol.HTTP_1_1), Collections.singletonList(ConnectionSpec.MODERN_TLS), proxySelector);
InetSocketAddress inetSocketAddress = new InetSocketAddress("localhost", 8080);
mockRoute = new Route(address, proxy, inetSocketAddress);
given(mockConnection.route()).willReturn(mockRoute);
}
Aggregations