Search in sources :

Example 66 with Address

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);
}
Also used : Addresses(org.orcid.jaxb.model.record_v2.Addresses) Address(org.orcid.jaxb.model.record_v2.Address) Test(org.junit.Test) BaseTest(org.orcid.core.BaseTest)

Example 67 with Address

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());
}
Also used : Set(java.util.Set) Address(test1.Address) Model(org.apache.jena.rdf.model.Model) Shapes(org.apache.jena.shacl.Shapes) Person(test1.Person) Test(org.junit.Test)

Example 68 with Address

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);
}
Also used : Interface2(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.Interface2) Address(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces.state._interface.ipv4.Address) Ipv4Address(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address) Ipv4AddressNoZone(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4AddressNoZone) Ipv4(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces.state._interface.Ipv4)

Example 69 with Address

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);
}
Also used : Address(okhttp3.Address) InetSocketAddress(java.net.InetSocketAddress) InetSocketAddress(java.net.InetSocketAddress) Route(okhttp3.Route) Before(org.junit.Before)

Example 70 with Address

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);
}
Also used : Address(okhttp3.Address) InetSocketAddress(java.net.InetSocketAddress) InetSocketAddress(java.net.InetSocketAddress) Route(okhttp3.Route) Before(org.junit.Before)

Aggregations

Test (org.junit.Test)86 Address (org.orcid.jaxb.model.record_v2.Address)82 Addresses (org.orcid.jaxb.model.record_v2.Addresses)43 ResearcherUrl (org.orcid.jaxb.model.record_v2.ResearcherUrl)43 Keyword (org.orcid.jaxb.model.record_v2.Keyword)42 OtherName (org.orcid.jaxb.model.record_v2.OtherName)42 PersonExternalIdentifier (org.orcid.jaxb.model.record_v2.PersonExternalIdentifier)42 Email (org.orcid.jaxb.model.record_v2.Email)41 OtherNames (org.orcid.jaxb.model.record_v2.OtherNames)35 Biography (org.orcid.jaxb.model.record_v2.Biography)34 Emails (org.orcid.jaxb.model.record_v2.Emails)34 ResearcherUrls (org.orcid.jaxb.model.record_v2.ResearcherUrls)33 Keywords (org.orcid.jaxb.model.record_v2.Keywords)32 PersonExternalIdentifiers (org.orcid.jaxb.model.record_v2.PersonExternalIdentifiers)32 Name (org.orcid.jaxb.model.record_v2.Name)31 Person (org.orcid.jaxb.model.record_v2.Person)31 Record (org.orcid.jaxb.model.record_v2.Record)19 Response (javax.ws.rs.core.Response)18 EducationSummary (org.orcid.jaxb.model.record.summary_v2.EducationSummary)18 EmploymentSummary (org.orcid.jaxb.model.record.summary_v2.EmploymentSummary)18