@Test public void testSerializeToJson() throws IOException { Metric diskOnHostMetric = new Metric(new ApplicationInstance("localhost", AppID.HOST, ""), "disk_free", 0); long timestamp = 0; double value = 5.35; diskOnHostMetric.putMetric(timestamp, Double.toString(value)); diskOnHostMetric.putMetric(timestamp + 5000, Double.toString(value)); diskOnHostMetric.putMetric(timestamp + 10000, Double.toString(value)); diskOnHostMetric.putMetric(timestamp + 15000, Double.toString(value)); String expected = SAMPLE_METRIC_IN_JSON; String s = new Json(true).serialize(diskOnHostMetric); assertEquals("Json should match", expected, s); }
public void putMetric(long timestamp, String value) { metrics.put(Long.toString(timestamp), value); }
Metric { public void putMetric(long timestamp, String value) { metrics.put(Long.toString(timestamp), value); } }
Metric { public void putMetric(long timestamp, String value) { metrics.put(Long.toString(timestamp), value); } Metric();  Metric(ApplicationInstance app, String metricName, long startTime); }
Metric { public void putMetric(long timestamp, String value) { metrics.put(Long.toString(timestamp), value); } Metric();  Metric(ApplicationInstance app, String metricName, long startTime); void putMetric(long timestamp, String value); String getInstanceid(); String getHostname(); Map<String, String> getMetrics(); String getStarttime(); String getAppid(); String getMetricname(); }
Metric { public void putMetric(long timestamp, String value) { metrics.put(Long.toString(timestamp), value); } Metric();  Metric(ApplicationInstance app, String metricName, long startTime); void putMetric(long timestamp, String value); String getInstanceid(); String getHostname(); Map<String, String> getMetrics(); String getStarttime(); String getAppid(); String getMetricname();  }