Search in sources :

Example 71 with Endpoint

use of com.google.cloud.servicedirectory.v1.Endpoint in project ysoserial by frohoff.

the class JBoss method doRun.

private static void doRun(URI u, final Object payloadObject, String username, String password) {
    ConnectionProvider instance = null;
    ConnectionProviderContextImpl context = null;
    ConnectionHandler ch = null;
    Channel c = null;
    VersionedConnection vc = null;
    try {
        Logger logger = LogManager.getLogManager().getLogger("");
        logger.addHandler(new ConsoleLogHandler());
        logger.setLevel(Level.INFO);
        OptionMap options = OptionMap.builder().set(Options.SSL_ENABLED, u.getScheme().equals("https")).getMap();
        context = new ConnectionProviderContextImpl(options, "endpoint");
        instance = new HttpUpgradeConnectionProviderFactory().createInstance(context, options);
        String host = u.getHost();
        int port = u.getPort() > 0 ? u.getPort() : 9990;
        SocketAddress destination = new InetSocketAddress(host, port);
        ConnectionHandlerFactory chf = getConnection(destination, username, password, context, instance, options);
        ch = chf.createInstance(new ConnectionHandlerContextImpl(context));
        c = getChannel(context, ch, options);
        System.err.println("Connected");
        vc = makeVersionedConnection(c);
        MBeanServerConnection mbc = vc.getMBeanServerConnection(null);
        doExploit(payloadObject, mbc);
        System.err.println("DONE");
    } catch (Throwable e) {
        e.printStackTrace(System.err);
    } finally {
        cleanup(instance, context, ch, c, vc);
    }
}
Also used : ConnectionHandlerFactory(org.jboss.remoting3.spi.ConnectionHandlerFactory) InetSocketAddress(java.net.InetSocketAddress) Channel(org.jboss.remoting3.Channel) Logger(java.util.logging.Logger) Endpoint(org.jboss.remoting3.Endpoint) ConnectionProvider(org.jboss.remoting3.spi.ConnectionProvider) ConnectionHandler(org.jboss.remoting3.spi.ConnectionHandler) OptionMap(org.xnio.OptionMap) HttpUpgradeConnectionProviderFactory(org.jboss.remoting3.remote.HttpUpgradeConnectionProviderFactory) VersionedConnection(org.jboss.remotingjmx.VersionedConnection) SocketAddress(java.net.SocketAddress) InetSocketAddress(java.net.InetSocketAddress) MBeanServerConnection(javax.management.MBeanServerConnection)

Example 72 with Endpoint

use of com.google.cloud.servicedirectory.v1.Endpoint in project crnk-framework by crnk-project.

the class AbstractBraveModuleTest method setup.

@Before
@SuppressWarnings("unchecked")
public void setup() {
    Endpoint localEndpoint = Endpoint.newBuilder().serviceName("testClient").build();
    clientReporter = Mockito.mock(Reporter.class);
    Tracing clientTracing = Tracing.newBuilder().spanReporter(clientReporter).localEndpoint(localEndpoint).build();
    client = new CrnkClient(getBaseUri().toString());
    client.setHttpAdapter(httpAdapter);
    client.addModule(BraveClientModule.create(clientTracing));
    taskRepo = client.getRepositoryForType(Task.class);
    TaskRepository.clear();
    ProjectRepository.clear();
    httpAdapter.setReceiveTimeout(10000, TimeUnit.SECONDS);
}
Also used : CrnkClient(io.crnk.client.CrnkClient) Task(io.crnk.monitor.brave.mock.models.Task) Endpoint(zipkin2.Endpoint) Reporter(zipkin2.reporter.Reporter) Tracing(brave.Tracing) Before(org.junit.Before)

Example 73 with Endpoint

use of com.google.cloud.servicedirectory.v1.Endpoint in project axis-axis2-java-core by apache.

the class WSDL20ToAxisServiceBuilder method setup.

/**
 * contains all code which gathers non-wsdlService specific information from the
 * wsdl.
 * <p/>
 * After all the setup completes successfully, the setupComplete field is
 * set so that any subsequent calls to setup() will result in a no-op. Note
 * that subclass WSDL20ToAllAxisServicesBuilder will call populateService
 * for each endpoint in the WSDL. Separating the non-wsdlService specific
 * information here allows WSDL20ToAllAxisServicesBuilder to only do this
 * work 1 time per WSDL, instead of for each endpoint on each wsdlService.
 *
 * @throws AxisFault - Thrown in case the necessary resources are not available in the WSDL
 * @throws WSDLException - Thrown in case Woden throws an exception
 */
protected void setup() throws AxisFault, WSDLException {
    if (setupComplete) {
        // already setup, just do nothing and return
        return;
    }
    try {
        if (description == null) {
            Description description;
            DescriptionElement descriptionElement;
            if (wsdlURI != null && !"".equals(wsdlURI)) {
                description = readInTheWSDLFile(wsdlURI);
                descriptionElement = description.toElement();
            } else if (in != null) {
                description = readInTheWSDLFile(in);
                descriptionElement = description.toElement();
            } else {
                throw new AxisFault("No resources found to read the wsdl");
            }
            savedTargetNamespace = descriptionElement.getTargetNamespace().toString();
            namespacemap = descriptionElement.getDeclaredNamespaces();
            this.description = description;
        }
        // Create the namespacemap
        stringBasedNamespaceMap = new NamespaceMap();
        for (int i = 0; i < namespacemap.length; i++) {
            NamespaceDeclaration namespaceDeclaration = namespacemap[i];
            stringBasedNamespaceMap.put(namespaceDeclaration.getPrefix(), namespaceDeclaration.getNamespaceURI().toString());
        }
        DescriptionElement descriptionElement = description.toElement();
        createNamespaceMap(descriptionElement);
        setupComplete = true;
    } catch (AxisFault e) {
        // just rethrow AxisFaults
        throw e;
    } catch (WSDLException e) {
        // Preserve the WSDLException
        throw e;
    } catch (Exception e) {
        throw AxisFault.makeFault(e);
    }
}
Also used : AxisFault(org.apache.axis2.AxisFault) Description(org.apache.woden.wsdl20.Description) WSDLException(org.apache.woden.WSDLException) NamespaceMap(org.apache.ws.commons.schema.utils.NamespaceMap) DescriptionElement(org.apache.woden.wsdl20.xml.DescriptionElement) Endpoint(org.apache.woden.wsdl20.Endpoint) NamespaceDeclaration(org.apache.woden.types.NamespaceDeclaration) URISyntaxException(java.net.URISyntaxException) SAXException(org.xml.sax.SAXException) IOException(java.io.IOException) ParserConfigurationException(javax.xml.parsers.ParserConfigurationException) WSDLException(org.apache.woden.WSDLException)

Example 74 with Endpoint

use of com.google.cloud.servicedirectory.v1.Endpoint in project opentelemetry-java by open-telemetry.

the class ZipkinSpanExporterTest method generateSpan_ResourceServiceNameMapping.

@Test
void generateSpan_ResourceServiceNameMapping() {
    Resource resource = Resource.create(Attributes.of(ResourceAttributes.SERVICE_NAME, "super-zipkin-service"));
    SpanData data = buildStandardSpan().setResource(resource).build();
    Endpoint expectedEndpoint = Endpoint.newBuilder().serviceName("super-zipkin-service").ip(exporter.getLocalAddressForTest()).build();
    Span expectedZipkinSpan = buildZipkinSpan(Span.Kind.SERVER).toBuilder().localEndpoint(expectedEndpoint).putTag(ZipkinSpanExporter.OTEL_STATUS_CODE, "OK").build();
    assertThat(exporter.generateSpan(data)).isEqualTo(expectedZipkinSpan);
}
Also used : SpanData(io.opentelemetry.sdk.trace.data.SpanData) TestSpanData(io.opentelemetry.sdk.testing.trace.TestSpanData) Endpoint(zipkin2.Endpoint) Resource(io.opentelemetry.sdk.resources.Resource) Span(zipkin2.Span) Test(org.junit.jupiter.api.Test)

Example 75 with Endpoint

use of com.google.cloud.servicedirectory.v1.Endpoint in project opentelemetry-java by open-telemetry.

the class ZipkinSpanExporterTest method generateSpan_defaultResourceServiceName.

@Test
void generateSpan_defaultResourceServiceName() {
    SpanData data = buildStandardSpan().setResource(Resource.empty()).build();
    Endpoint expectedEndpoint = Endpoint.newBuilder().serviceName(Resource.getDefault().getAttribute(ResourceAttributes.SERVICE_NAME)).ip(exporter.getLocalAddressForTest()).build();
    Span expectedZipkinSpan = buildZipkinSpan(Span.Kind.SERVER).toBuilder().localEndpoint(expectedEndpoint).putTag(ZipkinSpanExporter.OTEL_STATUS_CODE, "OK").build();
    assertThat(exporter.generateSpan(data)).isEqualTo(expectedZipkinSpan);
}
Also used : SpanData(io.opentelemetry.sdk.trace.data.SpanData) TestSpanData(io.opentelemetry.sdk.testing.trace.TestSpanData) Endpoint(zipkin2.Endpoint) Span(zipkin2.Span) Test(org.junit.jupiter.api.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 Annotation (wavefront.report.Annotation)8 ServiceName (org.jboss.msc.service.ServiceName)7 RateSampler (com.wavefront.sdk.entities.tracing.sampling.RateSampler)6 URISyntaxException (java.net.URISyntaxException)6 Endpoint (org.apache.woden.wsdl20.Endpoint)6