Search in sources :

Example 6 with Endpoint

use of org.openstack4j.model.identity.v2.Endpoint in project wildfly by wildfly.

the class EJBRemoteConnectorService method start.

@Override
public void start(StartContext context) throws StartException {
    final AssociationService associationService = associationServiceInjectedValue.getValue();
    final Endpoint endpoint = endpointValue.getValue();
    Executor executor = executorService.getOptionalValue();
    if (executor != null) {
        associationService.setExecutor(executor);
    }
    RemoteEJBService remoteEJBService = RemoteEJBService.create(associationService.getAssociation(), remotingTransactionServiceInjectedValue.getValue(), classResolverFilter);
    remoteEJBService.serverUp();
    // Register an EJB channel open listener
    OpenListener channelOpenListener = remoteEJBService.getOpenListener();
    try {
        registration = endpoint.registerService(EJB_CHANNEL_NAME, channelOpenListener, this.channelCreationOptions);
    } catch (ServiceRegistrationException e) {
        throw new StartException(e);
    }
}
Also used : RemoteEJBService(org.jboss.ejb.protocol.remote.RemoteEJBService) Executor(java.util.concurrent.Executor) Endpoint(org.jboss.remoting3.Endpoint) OpenListener(org.jboss.remoting3.OpenListener) ServiceRegistrationException(org.jboss.remoting3.ServiceRegistrationException) StartException(org.jboss.msc.service.StartException)

Example 7 with Endpoint

use of org.openstack4j.model.identity.v2.Endpoint in project zipkin by openzipkin.

the class JsonSerializers method parseEndpoint.

static Endpoint parseEndpoint(JsonParser parser) throws IOException {
    if (!parser.isExpectedStartObjectToken()) {
        throw new IllegalArgumentException("Not a valid JSON object, start token: " + parser.currentToken());
    }
    String serviceName = null, ipv4 = null, ipv6 = null;
    int port = 0;
    while (parser.nextToken() != JsonToken.END_OBJECT) {
        JsonToken value = parser.nextValue();
        if (value == JsonToken.VALUE_NULL) {
            continue;
        }
        switch(parser.currentName()) {
            case "serviceName":
                serviceName = parser.getText();
                break;
            case "ipv4":
                ipv4 = parser.getText();
                break;
            case "ipv6":
                ipv6 = parser.getText();
                break;
            case "port":
                port = parser.getIntValue();
                break;
            default:
        }
    }
    if (serviceName == null && ipv4 == null && ipv6 == null && port == 0)
        return null;
    return Endpoint.newBuilder().serviceName(serviceName).ip(ipv4).ip(ipv6).port(port).build();
}
Also used : JsonToken(com.fasterxml.jackson.core.JsonToken) Endpoint(zipkin2.Endpoint)

Example 8 with Endpoint

use of org.openstack4j.model.identity.v2.Endpoint in project zipkin by openzipkin.

the class JsonSerializersTest method span_specialCharsInJson.

/**
 * This isn't a test of what we "should" accept as a span, rather that characters that trip-up
 * json don't fail in SPAN_PARSER.
 */
@Test
public void span_specialCharsInJson() {
    // service name is surrounded by control characters
    Endpoint e = Endpoint.newBuilder().serviceName(new String(new char[] { 0, 'a', 1 })).build();
    Span worstSpanInTheWorld = Span.newBuilder().traceId("1").id("1").name(new String(new char[] { '"', '\\', '\t', '\b', '\n', '\r', '\f' })).localEndpoint(e).addAnnotation(1L, "\u2028 and \u2029").putTag("\"foo", "Database error: ORA-00942:\u2028 and \u2029 table or view does not exist\n").build();
    assertThat(parse(SPAN_PARSER, new String(SpanBytesEncoder.JSON_V2.encode(worstSpanInTheWorld), UTF_8))).isEqualTo(worstSpanInTheWorld);
}
Also used : Endpoint(zipkin2.Endpoint) Span(zipkin2.Span) Test(org.junit.Test)

Example 9 with Endpoint

use of org.openstack4j.model.identity.v2.Endpoint in project zipkin by openzipkin.

the class TraceTest method cleanupComparator_transitiveKindComparison.

/**
 * Comparators are meant to be transitive. This exploits edge cases to fool our comparator.
 */
@Test
public void cleanupComparator_transitiveKindComparison() {
    List<Span> trace = new ArrayList<>();
    Endpoint aEndpoint = Endpoint.newBuilder().serviceName("a").build();
    Endpoint bEndpoint = Endpoint.newBuilder().serviceName("b").build();
    Span template = Span.newBuilder().traceId("a").id("a").build();
    // when there are at least 32 elements.
    for (int i = 0, length = 7; i < length; i++) {
        trace.add(template.toBuilder().shared(true).localEndpoint(bEndpoint).build());
        trace.add(template.toBuilder().kind(Kind.CLIENT).localEndpoint(bEndpoint).build());
        trace.add(template.toBuilder().localEndpoint(aEndpoint).build());
        trace.add(template);
        trace.add(template.toBuilder().kind(Kind.CLIENT).localEndpoint(aEndpoint).build());
    }
    Collections.sort(trace, Trace.CLEANUP_COMPARATOR);
    assertThat(new LinkedHashSet<>(trace)).extracting(Span::shared, Span::kind, s -> s.localServiceName()).containsExactly(tuple(null, Kind.CLIENT, "a"), tuple(null, Kind.CLIENT, "b"), tuple(null, null, null), tuple(null, null, "a"), tuple(true, null, "b"));
}
Also used : List(java.util.List) Endpoint(zipkin2.Endpoint) Assertions.tuple(org.assertj.core.api.Assertions.tuple) Arrays.asList(java.util.Arrays.asList) Kind(zipkin2.Span.Kind) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) Span(zipkin2.Span) Test(org.junit.Test) Collections(java.util.Collections) LinkedHashSet(java.util.LinkedHashSet) ArrayList(java.util.ArrayList) Endpoint(zipkin2.Endpoint) ArrayList(java.util.ArrayList) Span(zipkin2.Span) Endpoint(zipkin2.Endpoint) Test(org.junit.Test)

Example 10 with Endpoint

use of org.openstack4j.model.identity.v2.Endpoint in project zipkin by openzipkin.

the class V1ThriftSpanWriterTest method endpoint_highPort.

@Test
public void endpoint_highPort() {
    int highPort = 63840;
    Endpoint endpoint = Endpoint.newBuilder().ip("127.0.0.1").port(63840).build();
    byte[] buff = new byte[ThriftEndpointCodec.sizeInBytes(endpoint)];
    ThriftEndpointCodec.write(endpoint, WriteBuffer.wrap(buff, 0));
    assertThat(buff).containsSequence(TYPE_I32, 0, 1, 127, 0, 0, // ipv4
    1).containsSequence(TYPE_I16, 0, 2, (highPort >> 8) & 0xFF, // port
    highPort & 0xFF);
    assertThat(ThriftEndpointCodec.read(ReadBuffer.wrap(buff)).portAsInt()).isEqualTo(highPort);
}
Also used : Endpoint(zipkin2.Endpoint) Endpoint(zipkin2.Endpoint) Test(org.junit.Test)

Aggregations

Endpoint (zipkin2.Endpoint)60 Span (zipkin2.Span)27 Test (org.junit.jupiter.api.Test)18 V1Span (zipkin2.v1.V1Span)16 Test (org.junit.Test)15 NoopHealthCheckManager (com.wavefront.agent.channel.NoopHealthCheckManager)5 SpanSampler (com.wavefront.agent.sampler.SpanSampler)5 ByteBuf (io.netty.buffer.ByteBuf)5 ChannelHandlerContext (io.netty.channel.ChannelHandlerContext)5 DefaultFullHttpRequest (io.netty.handler.codec.http.DefaultFullHttpRequest)5 FullHttpRequest (io.netty.handler.codec.http.FullHttpRequest)5 ArrayList (java.util.ArrayList)5 Span (wavefront.report.Span)5 Endpoint (org.apache.woden.wsdl20.Endpoint)4 TestObjects.newClientSpan (zipkin2.TestObjects.newClientSpan)4 RateSampler (com.wavefront.sdk.entities.tracing.sampling.RateSampler)3 IOException (java.io.IOException)3 HashMap (java.util.HashMap)3 List (java.util.List)3 Service (org.apache.woden.wsdl20.Service)3