use of com.google.cloud.servicedirectory.v1.Endpoint in project carbon-apimgt by wso2.
the class APIMWSDLReader method setServiceDefinitionForWSDL2.
private void setServiceDefinitionForWSDL2(org.apache.woden.wsdl20.Description definition, API api) throws APIManagementException {
org.apache.woden.wsdl20.Service[] serviceMap = definition.getServices();
String organization = api.getOrganization();
// URL addressURI;
try {
for (org.apache.woden.wsdl20.Service svc : serviceMap) {
Endpoint[] portMap = svc.getEndpoints();
for (Endpoint endpoint : portMap) {
EndpointElement element = endpoint.toElement();
// addressURI = endpoint.getAddress().toURL();
// if (addressURI == null) {
// break;
// } else {
String endpointTransport = determineURLTransport(endpoint.getAddress().getScheme(), api.getTransports());
setAddressUrl(element, new URI(APIUtil.getGatewayendpoint(endpointTransport, organization) + api.getContext() + '/' + api.getId().getVersion()));
// }
}
}
} catch (Exception e) {
String errorMsg = "Error occurred while getting the wsdl address location";
log.error(errorMsg, e);
throw new APIManagementException(errorMsg, e);
}
}
use of com.google.cloud.servicedirectory.v1.Endpoint in project brave by openzipkin.
the class MutableSpanTest method remoteEndpoint.
@Test
public void remoteEndpoint() {
MutableSpan span = newSpan();
Endpoint endpoint = Endpoint.newBuilder().serviceName("server").build();
span.kind(CLIENT);
span.remoteEndpoint(endpoint);
span.start(1L);
span.finish(2L);
assertThat(span.toSpan().remoteEndpoint()).isEqualTo(endpoint);
}
use of com.google.cloud.servicedirectory.v1.Endpoint in project cloudbreak by hortonworks.
the class OpenStackClient method getRegion.
public Set<String> getRegion(CloudCredential cloudCredential) {
Access access = createAccess(cloudCredential);
Token token = createToken(cloudCredential);
Set<String> regions = new HashSet<>();
if (token == null && access == null) {
throw new CloudConnectorException("Unsupported keystone version");
} else if (token != null) {
for (Service service : token.getCatalog()) {
for (Endpoint endpoint : service.getEndpoints()) {
regions.add(endpoint.getRegion());
}
}
} else {
for (Access.Service service : access.getServiceCatalog()) {
for (org.openstack4j.model.identity.v2.Endpoint endpoint : service.getEndpoints()) {
regions.add(endpoint.getRegion());
}
}
}
LOGGER.info("regions from openstack: {}", regions);
return regions;
}
use of com.google.cloud.servicedirectory.v1.Endpoint in project zipkin-gcp by openzipkin.
the class LabelExtractorTest method testEndpointIsSetIpv6.
@Test
public void testEndpointIsSetIpv6() {
Endpoint.Builder serverEndpointBuilder = Endpoint.newBuilder().serviceName("service1").port(80);
serverEndpointBuilder.parseIp("::1");
Endpoint serverEndpoint = serverEndpointBuilder.build();
Endpoint.Builder clientEndpointBuilder = Endpoint.newBuilder().serviceName("service2").port(80);
clientEndpointBuilder.parseIp("::1");
Endpoint clientEndpoint = clientEndpointBuilder.build();
Span serverSpan = Span.newBuilder().kind(Kind.SERVER).traceId("4").name("test-span").id("5").localEndpoint(serverEndpoint).build();
Span clientSpan = Span.newBuilder().kind(Kind.CLIENT).traceId("4").name("test-span").id("6").parentId("5").localEndpoint(clientEndpoint).build();
String prefix = "test.prefix/";
LabelExtractor extractor = new LabelExtractor(Collections.<String, String>emptyMap(), prefix);
Map<String, String> serverLabels = extractor.extract(serverSpan);
assertNull(serverLabels.get(prefix + "endpoint.ipv4"));
assertEquals("::1", serverLabels.get(prefix + "endpoint.ipv6"));
Map<String, String> clientLabels = extractor.extract(clientSpan);
assertNull(clientLabels.get(prefix + "endpoint.ipv4"));
assertNull(clientLabels.get(prefix + "endpoint.ipv6"));
}
use of com.google.cloud.servicedirectory.v1.Endpoint in project zipkin-gcp by openzipkin.
the class LabelExtractorTest method testEndpointIsSetIpv4.
@Test
public void testEndpointIsSetIpv4() {
Endpoint.Builder serverEndpointBuilder = Endpoint.newBuilder().serviceName("service1").port(80);
serverEndpointBuilder.parseIp("10.0.0.1");
Endpoint serverEndpoint = serverEndpointBuilder.build();
Endpoint.Builder clientEndpointBuilder = Endpoint.newBuilder().serviceName("service2").port(80);
clientEndpointBuilder.parseIp("10.0.0.1");
Endpoint clientEndpoint = clientEndpointBuilder.build();
Span serverSpan = Span.newBuilder().kind(Kind.SERVER).traceId("4").name("test-span").id("5").localEndpoint(serverEndpoint).build();
Span clientSpan = Span.newBuilder().kind(Kind.CLIENT).traceId("4").name("test-span").id("6").parentId("5").localEndpoint(clientEndpoint).build();
String prefix = "test.prefix/";
LabelExtractor extractor = new LabelExtractor(Collections.<String, String>emptyMap(), prefix);
Map<String, String> serverLabels = extractor.extract(serverSpan);
assertEquals("10.0.0.1", serverLabels.get(prefix + "endpoint.ipv4"));
assertNull(serverLabels.get(prefix + "endpoint.ipv6"));
Map<String, String> clientLabels = extractor.extract(clientSpan);
assertNull(clientLabels.get(prefix + "endpoint.ipv4"));
assertNull(clientLabels.get(prefix + "endpoint.ipv6"));
}
Aggregations