Search in sources :

Example 1 with Endpoint

use of org.jboss.remoting3.Endpoint in project carbon-apimgt by wso2.

the class WSDL20ProcessorImpl method getEndpoints.

/**
 * Get endpoints defined in the provided WSDL description.
 *
 * @param description WSDL 2.0 description
 * @return a Map of endpoint names and their URIs.
 * @throws APIMgtWSDLException if error occurs while reading endpoints
 */
private Map<String, String> getEndpoints(Description description) throws APIMgtWSDLException {
    Service[] services = description.getServices();
    Map<String, String> serviceEndpointMap = new HashMap<>();
    for (Service service : services) {
        Endpoint[] endpoints = service.getEndpoints();
        for (Endpoint endpoint : endpoints) {
            serviceEndpointMap.put(endpoint.getName().toString(), endpoint.getAddress().toString());
        }
    }
    return serviceEndpointMap;
}
Also used : Endpoint(org.apache.woden.wsdl20.Endpoint) HashMap(java.util.HashMap) Service(org.apache.woden.wsdl20.Service)

Example 2 with Endpoint

use of org.jboss.remoting3.Endpoint in project brave by openzipkin.

the class Platform method produceEndpoint.

Endpoint produceEndpoint() {
    Endpoint.Builder builder = Endpoint.newBuilder().serviceName("unknown");
    try {
        Enumeration<NetworkInterface> nics = NetworkInterface.getNetworkInterfaces();
        if (nics == null)
            return builder.build();
        while (nics.hasMoreElements()) {
            NetworkInterface nic = nics.nextElement();
            Enumeration<InetAddress> addresses = nic.getInetAddresses();
            while (addresses.hasMoreElements()) {
                InetAddress address = addresses.nextElement();
                if (address.isSiteLocalAddress()) {
                    builder.ip(address);
                    break;
                }
            }
        }
    } catch (Exception e) {
        // don't crash the caller if there was a problem reading nics.
        if (logger.isLoggable(Level.FINE)) {
            logger.log(Level.FINE, "error reading nics", e);
        }
    }
    return builder.build();
}
Also used : Endpoint(zipkin2.Endpoint) NetworkInterface(java.net.NetworkInterface) InetAddress(java.net.InetAddress)

Example 3 with Endpoint

use of org.jboss.remoting3.Endpoint in project brave by openzipkin.

the class TracerTest method localServiceName_ignoredWhenGivenLocalEndpoint.

@Test
public void localServiceName_ignoredWhenGivenLocalEndpoint() {
    Endpoint endpoint = Endpoint.newBuilder().serviceName("my-bar").build();
    tracer = Tracing.newBuilder().localServiceName("my-foo").endpoint(endpoint).build().tracer();
    assertThat(tracer).extracting("recorder.spanMap.endpoint").containsExactly(endpoint);
}
Also used : Endpoint(zipkin2.Endpoint) Test(org.junit.Test)

Example 4 with Endpoint

use of org.jboss.remoting3.Endpoint in project brave by openzipkin.

the class PlatformTest method localEndpoint_provisionsOnce.

/**
 * Getting an endpoint is expensive. This tests it is provisioned only once.
 *
 * test inspired by dagger.internal.DoubleCheckTest
 */
@Test
public void localEndpoint_provisionsOnce() throws Exception {
    // create all the tasks up front so that they are executed with no delay
    List<Callable<Endpoint>> tasks = new ArrayList<>();
    for (int i = 0; i < 10; i++) {
        tasks.add(() -> platform.endpoint());
    }
    ExecutorService executor = Executors.newFixedThreadPool(tasks.size());
    List<Future<Endpoint>> futures = executor.invokeAll(tasks);
    // check there's only a single unique endpoint returned
    Set<Object> results = Sets.newIdentityHashSet();
    for (Future<Endpoint> future : futures) {
        results.add(future.get());
    }
    assertThat(results).hasSize(1);
    executor.shutdownNow();
}
Also used : Endpoint(zipkin2.Endpoint) ArrayList(java.util.ArrayList) ExecutorService(java.util.concurrent.ExecutorService) Future(java.util.concurrent.Future) Callable(java.util.concurrent.Callable) Endpoint(zipkin2.Endpoint) Test(org.junit.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Example 5 with Endpoint

use of org.jboss.remoting3.Endpoint in project instrumentation-java by census-instrumentation.

the class ZipkinExporterHandler method produceLocalEndpoint.

/**
 * Logic borrowed from brave.internal.Platform.produceLocalEndpoint
 */
static Endpoint produceLocalEndpoint(String serviceName) {
    Endpoint.Builder builder = Endpoint.newBuilder().serviceName(serviceName);
    try {
        Enumeration<NetworkInterface> nics = NetworkInterface.getNetworkInterfaces();
        if (nics == null) {
            return builder.build();
        }
        while (nics.hasMoreElements()) {
            NetworkInterface nic = nics.nextElement();
            Enumeration<InetAddress> addresses = nic.getInetAddresses();
            while (addresses.hasMoreElements()) {
                InetAddress address = addresses.nextElement();
                if (address.isSiteLocalAddress()) {
                    builder.ip(address);
                    break;
                }
            }
        }
    } catch (Exception e) {
        // don't crash the caller if there was a problem reading nics.
        if (logger.isLoggable(Level.FINE)) {
            logger.log(Level.FINE, "error reading nics", e);
        }
    }
    return builder.build();
}
Also used : Endpoint(zipkin2.Endpoint) NetworkInterface(java.net.NetworkInterface) InetAddress(java.net.InetAddress) IOException(java.io.IOException)

Aggregations

Endpoint (zipkin2.Endpoint)55 Span (zipkin2.Span)27 Test (org.junit.jupiter.api.Test)18 V1Span (zipkin2.v1.V1Span)16 Test (org.junit.Test)10 ArrayList (java.util.ArrayList)5 TestObjects.newClientSpan (zipkin2.TestObjects.newClientSpan)5 List (java.util.List)3 JsonToken (com.fasterxml.jackson.core.JsonToken)2 IOException (java.io.IOException)2 InetAddress (java.net.InetAddress)2 NetworkInterface (java.net.NetworkInterface)2 Arrays.asList (java.util.Arrays.asList)2 Endpoint (org.jboss.remoting3.Endpoint)2 Record (org.jooq.Record)2 Access (org.openstack4j.model.identity.v2.Access)2 V1SpanConverter (zipkin2.v1.V1SpanConverter)2 Tracing (brave.Tracing)1 CloudConnectorException (com.sequenceiq.cloudbreak.cloud.exception.CloudConnectorException)1 CrnkClient (io.crnk.client.CrnkClient)1