use of com.netflix.spectator.api.Clock 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);
}
Aggregations