// Path: cm-schema/src/main/java/com/cloudera/csd/tools/impala/ImpalaMetricTypes.java
// public enum StatisticalMetricType implements ComplexImpalaMetric {
//   COUNT("_count", ImpalaMetricClass.COUNTER, ": Samples"),
//   LAST("_last", ImpalaMetricClass.GAUGE, ": Last"),
//   MIN("_min", ImpalaMetricClass.GAUGE, ": Min"),
//   MAX("_max", ImpalaMetricClass.GAUGE, ": Max"),
//   MEAN("_mean", ImpalaMetricClass.GAUGE, ": Mean"),
//   STDDEV("_stddev", ImpalaMetricClass.GAUGE, ": Standard Deviation");
// 
//   private final String metricNameSuffix;
//   private final ImpalaMetricClass metricClass;
//   private final String descriptionSuffix;
// 
//   private StatisticalMetricType(String val,
//                                 ImpalaMetricClass metricClass,
//                                 String descriptionSuffix) {
//     Preconditions.checkNotNull(val);
//     Preconditions.checkNotNull(metricClass);
//     Preconditions.checkNotNull(descriptionSuffix);
//     this.metricNameSuffix = val;
//     this.metricClass = metricClass;
//     this.descriptionSuffix = descriptionSuffix;
//   }
// 
//   public String suffix() {
//     return metricNameSuffix;
//   }
// 
//   @Override
//   public boolean isCounter() {
//     return metricClass.equals(ImpalaMetricClass.COUNTER);
//   }
// 
//   @Override
//   public boolean isRate() {
//     return false;
//   }
// 
//   public String descriptionSuffix() {
//     return descriptionSuffix;
//   }
// 
//   @Override
//   public String makeMetricName(String metricName) {
//     Preconditions.checkNotNull(metricName);
//     return String.format("%s%s", metricName, suffix());
//   }
// 
//   public String makeMetricLabel(String baseLabel) {
//     return makeMetricDescription(baseLabel);
//   }
// 
//   public String makeMetricDescription(String baseDescription) {
//     Preconditions.checkNotNull(baseDescription);
//     return String.format("%s%s", baseDescription, descriptionSuffix());
//   }
// }


import com.cloudera.csd.descriptors.MetricDescriptor;
import com.cloudera.csd.tools.impala.ImpalaMetricTypes.StatisticalMetricType;
import java.util.List;
import org.junit.Before;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
        getMetricsForRole(adapter, "test_role1_metrics");
    assertEquals(2, metrics.size());
    validateSimpleMetric(metrics.get(1),
                         adapter.getServiceName(),
                         "test_role1_metric2",
                         !COUNTER);
  }

  @Test
  public void testCounterMetrics() throws Exception {
    String source = this.getClass().getResource(
        "/com/cloudera/csd/tools/impala/valid.json").getPath();
    adapter.init(source, null);
    assertEquals(2, adapter.getRoleNames().size());
    List<MetricDescriptor> metrics =
        getMetricsForRole(adapter, "test_role1_metrics");
    assertEquals(2, metrics.size());
    validateSimpleMetric(metrics.get(0),
                         adapter.getServiceName(),
                         "test_role1_metric1",
                         COUNTER);
  }

  @Test
  public void testStatisticalMetrics() throws Exception {
    String source = this.getClass().getResource(
        "/com/cloudera/csd/tools/impala/valid.json").getPath();
    adapter.init(source, null);
    List<MetricDescriptor> metrics =
        getMetricsForEntity(adapter, "test_entity1_metrics");
// Path: cm-schema/src/main/java/com/cloudera/csd/tools/impala/ImpalaMetricTypes.java
// public enum StatisticalMetricType implements ComplexImpalaMetric {
//   COUNT("_count", ImpalaMetricClass.COUNTER, ": Samples"),
//   LAST("_last", ImpalaMetricClass.GAUGE, ": Last"),
//   MIN("_min", ImpalaMetricClass.GAUGE, ": Min"),
//   MAX("_max", ImpalaMetricClass.GAUGE, ": Max"),
//   MEAN("_mean", ImpalaMetricClass.GAUGE, ": Mean"),
//   STDDEV("_stddev", ImpalaMetricClass.GAUGE, ": Standard Deviation");
// 
//   private final String metricNameSuffix;
//   private final ImpalaMetricClass metricClass;
//   private final String descriptionSuffix;
// 
//   private StatisticalMetricType(String val,
//                                 ImpalaMetricClass metricClass,
//                                 String descriptionSuffix) {
//     Preconditions.checkNotNull(val);
//     Preconditions.checkNotNull(metricClass);
//     Preconditions.checkNotNull(descriptionSuffix);
//     this.metricNameSuffix = val;
//     this.metricClass = metricClass;
//     this.descriptionSuffix = descriptionSuffix;
//   }
// 
//   public String suffix() {
//     return metricNameSuffix;
//   }
// 
//   @Override
//   public boolean isCounter() {
//     return metricClass.equals(ImpalaMetricClass.COUNTER);
//   }
// 
//   @Override
//   public boolean isRate() {
//     return false;
//   }
// 
//   public String descriptionSuffix() {
//     return descriptionSuffix;
//   }
// 
//   @Override
//   public String makeMetricName(String metricName) {
//     Preconditions.checkNotNull(metricName);
//     return String.format("%s%s", metricName, suffix());
//   }
// 
//   public String makeMetricLabel(String baseLabel) {
//     return makeMetricDescription(baseLabel);
//   }
// 
//   public String makeMetricDescription(String baseDescription) {
//     Preconditions.checkNotNull(baseDescription);
//     return String.format("%s%s", baseDescription, descriptionSuffix());
//   }
// }


// Path: cm-schema/src/test/java/com/cloudera/csd/tools/impala/ImpalaMetricAdapterTest.java
import com.cloudera.csd.descriptors.MetricDescriptor;
import com.cloudera.csd.tools.impala.ImpalaMetricTypes.StatisticalMetricType;
import java.util.List;
import org.junit.Before;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;

        getMetricsForRole(adapter, "test_role1_metrics");
    assertEquals(2, metrics.size());
    validateSimpleMetric(metrics.get(1),
                         adapter.getServiceName(),
                         "test_role1_metric2",
                         !COUNTER);
  }

  @Test
  public void testCounterMetrics() throws Exception {
    String source = this.getClass().getResource(
        "/com/cloudera/csd/tools/impala/valid.json").getPath();
    adapter.init(source, null);
    assertEquals(2, adapter.getRoleNames().size());
    List<MetricDescriptor> metrics =
        getMetricsForRole(adapter, "test_role1_metrics");
    assertEquals(2, metrics.size());
    validateSimpleMetric(metrics.get(0),
                         adapter.getServiceName(),
                         "test_role1_metric1",
                         COUNTER);
  }

  @Test
  public void testStatisticalMetrics() throws Exception {
    String source = this.getClass().getResource(
        "/com/cloudera/csd/tools/impala/valid.json").getPath();
    adapter.init(source, null);
    List<MetricDescriptor> metrics =
        getMetricsForEntity(adapter, "test_entity1_metrics");
    assertEquals(StatisticalMetricType.values().length,