Java Code Examples for org.apache.hadoop.metrics.MetricsServlet.TagsMetricsPair

The following examples show how to use org.apache.hadoop.metrics.MetricsServlet.TagsMetricsPair. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: hadoop   Source File: TestMetricsServlet.java    License: Apache License 2.0 5 votes vote down vote up
public void testTagsMetricsPair() throws IOException {
  TagsMetricsPair pair = new TagsMetricsPair(outputRecord.getTagsCopy(), 
      outputRecord.getMetricsCopy());
  String s = JSON.toString(pair);
  assertEquals(
      "[{\"testTag1\":\"testTagValue1\",\"testTag2\":\"testTagValue2\"},"+
      "{\"testMetric1\":1,\"testMetric2\":33}]", s);
}
 
Example 2
Source Project: hadoop   Source File: TestMetricsServlet.java    License: Apache License 2.0 5 votes vote down vote up
public void testGetMap() throws IOException {
  MetricsServlet servlet = new MetricsServlet();
  Map<String, Map<String, List<TagsMetricsPair>>> m = servlet.makeMap(contexts);
  assertEquals("Map missing contexts", 2, m.size());
  assertTrue(m.containsKey("test1"));
 
  Map<String, List<TagsMetricsPair>> m2 = m.get("test1");
  
  assertEquals("Missing records", 1, m2.size());
  assertTrue(m2.containsKey("testRecord"));
  assertEquals("Wrong number of tags-values pairs.", 1, m2.get("testRecord").size());
}
 
Example 3
Source Project: big-c   Source File: TestMetricsServlet.java    License: Apache License 2.0 5 votes vote down vote up
public void testTagsMetricsPair() throws IOException {
  TagsMetricsPair pair = new TagsMetricsPair(outputRecord.getTagsCopy(), 
      outputRecord.getMetricsCopy());
  String s = JSON.toString(pair);
  assertEquals(
      "[{\"testTag1\":\"testTagValue1\",\"testTag2\":\"testTagValue2\"},"+
      "{\"testMetric1\":1,\"testMetric2\":33}]", s);
}
 
Example 4
Source Project: big-c   Source File: TestMetricsServlet.java    License: Apache License 2.0 5 votes vote down vote up
public void testGetMap() throws IOException {
  MetricsServlet servlet = new MetricsServlet();
  Map<String, Map<String, List<TagsMetricsPair>>> m = servlet.makeMap(contexts);
  assertEquals("Map missing contexts", 2, m.size());
  assertTrue(m.containsKey("test1"));
 
  Map<String, List<TagsMetricsPair>> m2 = m.get("test1");
  
  assertEquals("Missing records", 1, m2.size());
  assertTrue(m2.containsKey("testRecord"));
  assertEquals("Wrong number of tags-values pairs.", 1, m2.get("testRecord").size());
}
 
Example 5
Source Project: RDFS   Source File: TestMetricsServlet.java    License: Apache License 2.0 5 votes vote down vote up
public void testTagsMetricsPair() throws IOException {
  TagsMetricsPair pair = new TagsMetricsPair(outputRecord.getTagsCopy(), 
      outputRecord.getMetricsCopy());
  String s = JSON.toString(pair);
  assertEquals(
      "[{\"testTag1\":\"testTagValue1\",\"testTag2\":\"testTagValue2\"},"+
      "{\"testMetric1\":1,\"testMetric2\":33}]", s);
}
 
Example 6
Source Project: RDFS   Source File: TestMetricsServlet.java    License: Apache License 2.0 5 votes vote down vote up
public void testGetMap() throws IOException {
  MetricsServlet servlet = new MetricsServlet();
  Map<String, Map<String, List<TagsMetricsPair>>> m = servlet.makeMap(contexts);
  assertEquals("Map missing contexts", 2, m.size());
  assertTrue(m.containsKey("test1"));
 
  Map<String, List<TagsMetricsPair>> m2 = m.get("test1");
  
  assertEquals("Missing records", 1, m2.size());
  assertTrue(m2.containsKey("testRecord"));
  assertEquals("Wrong number of tags-values pairs.", 1, m2.get("testRecord").size());
}