use of io.vertx.test.fakemetrics.FakeVertxMetrics in project vert.x by eclipse.
the class MetricsOptionsTest method testMetricsFromServiceLoader.
@Test
public void testMetricsFromServiceLoader() {
vertx.close();
MetricsOptions metricsOptions = new MetricsOptions().setEnabled(true);
VertxOptions options = new VertxOptions().setMetricsOptions(metricsOptions);
vertx = createVertxLoadingMetricsFromMetaInf(options, "io.vertx.test.fakemetrics.FakeMetricsFactory");
VertxMetrics metrics = ((VertxInternal) vertx).metricsSPI();
assertNotNull(metrics);
assertTrue(metrics instanceof FakeVertxMetrics);
assertEquals(metricsOptions.isEnabled(), ((FakeVertxMetrics) metrics).options().isEnabled());
}
use of io.vertx.test.fakemetrics.FakeVertxMetrics in project vert.x by eclipse.
the class MetricsOptionsTest method testMetricsFromServiceLoader.
@Test
public void testMetricsFromServiceLoader() {
vertx.close();
VertxOptions options = new VertxOptions().setMetricsOptions(new MetricsOptions().setEnabled(true));
vertx = createVertxLoadingMetricsFromMetaInf(options, "io.vertx.test.fakemetrics.FakeMetricsFactory");
VertxMetrics metrics = ((VertxInternal) vertx).metricsSPI();
assertNotNull(metrics);
assertTrue(metrics instanceof FakeVertxMetrics);
}
use of io.vertx.test.fakemetrics.FakeVertxMetrics in project vert.x by eclipse.
the class VertxFactoryTest method testFactoryMetricsOverridesMetaInf.
@Test
public void testFactoryMetricsOverridesMetaInf() {
runWithServiceFromMetaInf(VertxMetricsFactory.class, FakeVertxMetrics.class.getName(), () -> {
FakeVertxMetrics metrics = new FakeVertxMetrics();
MetricsOptions metricsOptions = new MetricsOptions().setEnabled(true);
VertxBuilder factory = new VertxBuilder(new VertxOptions().setMetricsOptions(metricsOptions));
factory.metrics(metrics);
factory.init();
Vertx vertx = factory.vertx();
assertSame(metrics, ((VertxInternal) vertx).metricsSPI());
});
}
use of io.vertx.test.fakemetrics.FakeVertxMetrics in project vert.x by eclipse.
the class VertxFactoryTest method testFactoryMetricsFactoryOverridesOptions.
@Test
public void testFactoryMetricsFactoryOverridesOptions() {
FakeVertxMetrics metrics = new FakeVertxMetrics();
MetricsOptions metricsOptions = new MetricsOptions().setEnabled(true).setFactory(options -> {
throw new AssertionError();
});
VertxBuilder factory = new VertxBuilder(new VertxOptions().setMetricsOptions(metricsOptions));
factory.metrics(metrics);
factory.init();
Vertx vertx = factory.vertx();
assertSame(metrics, ((VertxInternal) vertx).metricsSPI());
}
Aggregations