use of org.apache.servicecomb.foundation.metrics.MetricsBootstrapConfig in project incubator-servicecomb-java-chassis by apache.
the class TestDefaultLogPublisher method init_enabled_false.
@Test
public void init_enabled_false() {
Holder<Boolean> registered = new Holder<>();
new MockUp<EventBus>(eventBus) {
@Mock
void register(Object object) {
registered.value = true;
}
};
ArchaiusUtils.setProperty(DefaultLogPublisher.ENABLED, false);
publisher.init(globalRegistry, eventBus, new MetricsBootstrapConfig());
Assert.assertNull(registered.value);
}
use of org.apache.servicecomb.foundation.metrics.MetricsBootstrapConfig in project java-chassis by ServiceComb.
the class TestDefaultLogPublisher method init_enabled_true.
@Test
public void init_enabled_true() {
Holder<Boolean> registered = new Holder<>();
new MockUp<EventBus>(eventBus) {
@Mock
void register(Object object) {
registered.value = true;
}
};
ArchaiusUtils.setProperty(DefaultLogPublisher.ENABLED, true);
publisher.init(globalRegistry, eventBus, new MetricsBootstrapConfig());
Assert.assertTrue(registered.value);
}
use of org.apache.servicecomb.foundation.metrics.MetricsBootstrapConfig in project java-chassis by ServiceComb.
the class TestMetricsRestPublisher method measure_normal.
@Test
public void measure_normal() {
Clock clock = new ManualClock();
GlobalRegistry globalRegistry = new GlobalRegistry();
Registry registry = new DefaultRegistry(clock);
registry.timer(registry.createId("name", "t1", "v1", "t2", "v2"));
globalRegistry.add(registry);
EventBus eventBus = new EventBus();
publisher.init(globalRegistry, eventBus, new MetricsBootstrapConfig());
Map<String, Double> result = publisher.measure();
Assert.assertEquals(2, result.size());
Assert.assertEquals(0, result.get("name(statistic=count,t1=v1,t2=v2)"), 0);
Assert.assertEquals(0, result.get("name(statistic=totalTime,t1=v1,t2=v2)"), 0);
}
use of org.apache.servicecomb.foundation.metrics.MetricsBootstrapConfig in project incubator-servicecomb-java-chassis by apache.
the class TestDefaultLogPublisher method init_enabled_default.
@Test
public void init_enabled_default() {
Holder<Boolean> registered = new Holder<>();
new MockUp<EventBus>(eventBus) {
@Mock
void register(Object object) {
registered.value = true;
}
};
publisher.init(globalRegistry, eventBus, new MetricsBootstrapConfig());
Assert.assertTrue(registered.value);
}
use of org.apache.servicecomb.foundation.metrics.MetricsBootstrapConfig in project incubator-servicecomb-java-chassis by apache.
the class TestDefaultLogPublisher method init_enabled_true.
@Test
public void init_enabled_true() {
Holder<Boolean> registered = new Holder<>();
new MockUp<EventBus>(eventBus) {
@Mock
void register(Object object) {
registered.value = true;
}
};
ArchaiusUtils.setProperty(DefaultLogPublisher.ENABLED, true);
publisher.init(globalRegistry, eventBus, new MetricsBootstrapConfig());
Assert.assertTrue(registered.value);
}
Aggregations