Пример #1
0
  @Test
  public void testGetTopologySummary() {
    ClusterSummary cs = mock(ClusterSummary.class);
    TopologySummary ts = mock(TopologySummary.class);
    String tsName = "benchmarks";
    String fakeName = "fake";

    when(cs.get_topologies()).thenReturn(Lists.newArrayList(ts));
    when(ts.get_name()).thenReturn(tsName);

    assertThat(MetricsUtils.getTopologySummary(cs, tsName)).isEqualTo(ts);
    assertThat(MetricsUtils.getTopologySummary(cs, fakeName)).isNull();
  }
Пример #2
0
 @Test
 public void testAddLatency() {
   Map<String, List<Double>> stats = Maps.newHashMap();
   String id = "spout";
   double lat = 0.01;
   MetricsUtils.addLatency(stats, id, lat);
   assertThat(stats).containsKey(id);
   assertThat(stats.get(id)).isNotNull().contains(lat);
 }
Пример #3
0
 @Probe
 private Map mapMethod() {
   return MetricsUtils.createMap(10);
 }