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);
}
}
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();
}
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);
}
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"));
}
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);
}
Aggregations