Search in sources :

Example 56 with Endpoint

use of com.google.cloud.aiplatform.v1.Endpoint in project carbon-apimgt by wso2.

the class WSDL20ProcessorImpl method updateEndpointsOfSingleWSDL.

/**
 * Update the endpoint information of the provided WSDL definition when an API and the environment details are
 * provided
 *
 * @param api API
 * @param environmentName name of the gateway environment
 * @param environmentType type of the gateway environment
 * @param wsdlDescription WSDL 2.0 definition
 * @throws APIMgtWSDLException when error occurred while updating the endpoints
 */
private void updateEndpointsOfSingleWSDL(API api, String environmentName, String environmentType, Description wsdlDescription) throws APIMgtWSDLException {
    Service[] serviceMap = wsdlDescription.getServices();
    String organization = api.getOrganization();
    try {
        for (Service svc : serviceMap) {
            Endpoint[] portMap = svc.getEndpoints();
            for (Endpoint endpoint : portMap) {
                EndpointElement element = endpoint.toElement();
                String endpointTransport = determineURLTransport(endpoint.getAddress().getScheme(), api.getTransports());
                setAddressUrl(element, new URI(APIUtil.getGatewayEndpoint(endpointTransport, environmentName, environmentType, organization) + api.getContext()));
            }
        }
    } catch (URISyntaxException | APIManagementException e) {
        throw new APIMgtWSDLException("Error while setting gateway access URLs in the WSDL", e);
    }
}
Also used : Endpoint(org.apache.woden.wsdl20.Endpoint) APIManagementException(org.wso2.carbon.apimgt.api.APIManagementException) APIMgtWSDLException(org.wso2.carbon.apimgt.impl.wsdl.exceptions.APIMgtWSDLException) Service(org.apache.woden.wsdl20.Service) URISyntaxException(java.net.URISyntaxException) EndpointElement(org.apache.woden.wsdl20.xml.EndpointElement) URI(java.net.URI)

Example 57 with Endpoint

use of com.google.cloud.aiplatform.v1.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 58 with Endpoint

use of com.google.cloud.aiplatform.v1.Endpoint in project brave by openzipkin.

the class TracerTest method localServiceName_ignoredWhenGivenLocalEndpoint.

@Test
public void localServiceName_ignoredWhenGivenLocalEndpoint() {
    Endpoint endpoint = Endpoint.newBuilder().ip("1.2.3.4").serviceName("my-bar").build();
    tracer = Tracing.newBuilder().localServiceName("my-foo").endpoint(endpoint).build().tracer();
    MutableSpan defaultSpan = new MutableSpan();
    defaultSpan.localServiceName("my-bar");
    defaultSpan.localIp("1.2.3.4");
    assertThat(tracer).extracting("pendingSpans.defaultSpan").isEqualTo(defaultSpan);
}
Also used : MutableSpan(brave.handler.MutableSpan) Endpoint(zipkin2.Endpoint) Test(org.junit.Test)

Example 59 with Endpoint

use of com.google.cloud.aiplatform.v1.Endpoint in project zipkin-gcp by openzipkin.

the class AttributesExtractorTest method testEndpointWithNullServiceName.

@Test
public void testEndpointWithNullServiceName() {
    Endpoint.Builder serverEndpointBuilder = Endpoint.newBuilder().port(80);
    Endpoint serverEndpoint = serverEndpointBuilder.build();
    Span serverSpan = Span.newBuilder().kind(Kind.SERVER).traceId("4").name("test-span").id("5").localEndpoint(serverEndpoint).build();
    AttributesExtractor extractor = new AttributesExtractor(Collections.emptyMap());
    Map<String, AttributeValue> serverLabels = extractor.extract(serverSpan).getAttributeMapMap();
    assertThat(serverLabels).doesNotContainKey("endpoint.serviceName");
}
Also used : AttributeValue(com.google.devtools.cloudtrace.v2.AttributeValue) AttributesExtractor.toAttributeValue(zipkin2.translation.stackdriver.AttributesExtractor.toAttributeValue) Endpoint(zipkin2.Endpoint) Span(zipkin2.Span) Test(org.junit.Test)

Example 60 with Endpoint

use of com.google.cloud.aiplatform.v1.Endpoint in project zipkin-gcp by openzipkin.

the class AttributesExtractorTest 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();
    AttributesExtractor extractor = new AttributesExtractor(Collections.emptyMap());
    Map<String, AttributeValue> serverLabels = extractor.extract(serverSpan).getAttributeMapMap();
    assertThat(serverLabels).containsEntry("endpoint.ipv4", toAttributeValue("10.0.0.1"));
    assertThat(serverLabels).doesNotContainKey("endpoint.ipv6");
    Map<String, AttributeValue> clientLabels = extractor.extract(clientSpan).getAttributeMapMap();
    assertThat(clientLabels).doesNotContainKeys("endpoint.ipv4", "endpoint.ipv6");
}
Also used : AttributeValue(com.google.devtools.cloudtrace.v2.AttributeValue) AttributesExtractor.toAttributeValue(zipkin2.translation.stackdriver.AttributesExtractor.toAttributeValue) Endpoint(zipkin2.Endpoint) Span(zipkin2.Span) Test(org.junit.Test)

Aggregations

Endpoint (zipkin2.Endpoint)73 Span (zipkin2.Span)33 Test (org.junit.Test)28 Endpoint (org.jboss.remoting3.Endpoint)22 Test (org.junit.jupiter.api.Test)20 V1Span (zipkin2.v1.V1Span)16 NoopHealthCheckManager (com.wavefront.agent.channel.NoopHealthCheckManager)10 SpanSampler (com.wavefront.agent.sampler.SpanSampler)10 ByteBuf (io.netty.buffer.ByteBuf)10 ChannelHandlerContext (io.netty.channel.ChannelHandlerContext)10 DefaultFullHttpRequest (io.netty.handler.codec.http.DefaultFullHttpRequest)10 FullHttpRequest (io.netty.handler.codec.http.FullHttpRequest)10 Span (wavefront.report.Span)10 IOException (java.io.IOException)8 URI (java.net.URI)8 HashMap (java.util.HashMap)8 Annotation (wavefront.report.Annotation)8 ServiceName (org.jboss.msc.service.ServiceName)7 RateSampler (com.wavefront.sdk.entities.tracing.sampling.RateSampler)6 SaslAuthenticationFactory (org.wildfly.security.auth.server.SaslAuthenticationFactory)6