Search in sources :

Example 1 with FakeTracer

use of io.vertx.test.faketracer.FakeTracer in project vert.x by eclipse.

the class VertxFactoryTest method testFactoryTracerFactoryOverridesOptions.

@Test
public void testFactoryTracerFactoryOverridesOptions() {
    FakeTracer tracer = new FakeTracer();
    TracingOptions tracingOptions = new TracingOptions().setFactory(new VertxTracerFactory() {

        @Override
        public VertxTracer tracer(TracingOptions options) {
            throw new AssertionError();
        }
    });
    VertxBuilder factory = new VertxBuilder(new VertxOptions().setTracingOptions(tracingOptions));
    factory.tracer(tracer);
    factory.init();
    Vertx vertx = factory.vertx();
    assertSame(tracer, ((VertxInternal) vertx).getOrCreateContext().tracer());
}
Also used : VertxTracer(io.vertx.core.spi.tracing.VertxTracer) FakeTracer(io.vertx.test.faketracer.FakeTracer) TracingOptions(io.vertx.core.tracing.TracingOptions) VertxTracerFactory(io.vertx.core.spi.VertxTracerFactory) Vertx(io.vertx.core.Vertx) VertxOptions(io.vertx.core.VertxOptions) Test(org.junit.Test)

Example 2 with FakeTracer

use of io.vertx.test.faketracer.FakeTracer in project vert.x by eclipse.

the class VertxFactoryTest method testFactoryTracerOverridesMetaInf.

@Test
public void testFactoryTracerOverridesMetaInf() {
    runWithServiceFromMetaInf(VertxTracerFactory.class, FakeTracerFactory.class.getName(), () -> {
        FakeTracer tracer = new FakeTracer();
        TracingOptions tracingOptions = new TracingOptions();
        VertxBuilder factory = new VertxBuilder(new VertxOptions().setTracingOptions(tracingOptions));
        factory.tracer(tracer);
        factory.init();
        Vertx vertx = factory.vertx();
        assertSame(tracer, ((VertxInternal) vertx).getOrCreateContext().tracer());
    });
}
Also used : FakeTracer(io.vertx.test.faketracer.FakeTracer) TracingOptions(io.vertx.core.tracing.TracingOptions) FakeTracerFactory(io.vertx.test.faketracer.FakeTracerFactory) Vertx(io.vertx.core.Vertx) VertxOptions(io.vertx.core.VertxOptions) Test(org.junit.Test)

Aggregations

Vertx (io.vertx.core.Vertx)2 VertxOptions (io.vertx.core.VertxOptions)2 TracingOptions (io.vertx.core.tracing.TracingOptions)2 FakeTracer (io.vertx.test.faketracer.FakeTracer)2 Test (org.junit.Test)2 VertxTracerFactory (io.vertx.core.spi.VertxTracerFactory)1 VertxTracer (io.vertx.core.spi.tracing.VertxTracer)1 FakeTracerFactory (io.vertx.test.faketracer.FakeTracerFactory)1