You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by kr...@apache.org on 2018/09/20 20:55:22 UTC
[1/2] calcite-avatica git commit: [CALCITE-2583] Upgrade dropwizard
metrics to 4.0.3
Repository: calcite-avatica
Updated Branches:
refs/heads/master bba9ba773 -> 6afbfd52a
http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/6afbfd52/metrics-dropwizardmetrics3/src/test/java/org/apache/calcite/avatica/metrics/dropwizard3/DropwizardMetricsSystemTest.java
----------------------------------------------------------------------
diff --git a/metrics-dropwizardmetrics3/src/test/java/org/apache/calcite/avatica/metrics/dropwizard3/DropwizardMetricsSystemTest.java b/metrics-dropwizardmetrics3/src/test/java/org/apache/calcite/avatica/metrics/dropwizard3/DropwizardMetricsSystemTest.java
deleted file mode 100644
index 7eeec3b..0000000
--- a/metrics-dropwizardmetrics3/src/test/java/org/apache/calcite/avatica/metrics/dropwizard3/DropwizardMetricsSystemTest.java
+++ /dev/null
@@ -1,161 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.calcite.avatica.metrics.dropwizard3;
-
-import org.apache.calcite.avatica.metrics.Counter;
-import org.apache.calcite.avatica.metrics.Gauge;
-import org.apache.calcite.avatica.metrics.Histogram;
-import org.apache.calcite.avatica.metrics.Meter;
-import org.apache.calcite.avatica.metrics.Timer;
-import org.apache.calcite.avatica.metrics.Timer.Context;
-
-import com.codahale.metrics.MetricRegistry;
-
-import org.junit.Before;
-import org.junit.Test;
-
-import static org.mockito.Mockito.any;
-import static org.mockito.Mockito.eq;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-/**
- * Tests for {@link DropwizardMetricsSystem}.
- */
-public class DropwizardMetricsSystemTest {
-
- private MetricRegistry mockRegistry;
- private DropwizardMetricsSystem metrics;
-
- @Before public void setup() {
- mockRegistry = mock(MetricRegistry.class);
- metrics = new DropwizardMetricsSystem(mockRegistry);
- }
-
- @Test public void testGauge() {
- final long gaugeValue = 42L;
- final String name = "gauge";
- metrics.register(name, new Gauge<Long>() {
- @Override public Long getValue() {
- return gaugeValue;
- }
- });
-
- verify(mockRegistry, times(1)).register(eq(name), any(com.codahale.metrics.Gauge.class));
- }
-
- @Test public void testMeter() {
- final String name = "meter";
- final com.codahale.metrics.Meter mockMeter = mock(com.codahale.metrics.Meter.class);
-
- when(mockRegistry.meter(name)).thenReturn(mockMeter);
-
- Meter meter = metrics.getMeter(name);
-
- final long count = 5;
- meter.mark(count);
-
- verify(mockMeter, times(1)).mark(count);
-
- meter.mark();
-
- verify(mockMeter, times(1)).mark();
- }
-
- @Test public void testHistogram() {
- final String name = "histogram";
- final com.codahale.metrics.Histogram mockHistogram = mock(com.codahale.metrics.Histogram.class);
-
- when(mockRegistry.histogram(name)).thenReturn(mockHistogram);
-
- Histogram histogram = metrics.getHistogram(name);
-
- long[] long_values = new long[] {1L, 5L, 15L, 30L, 60L};
- for (long value : long_values) {
- histogram.update(value);
- }
-
- for (long value : long_values) {
- verify(mockHistogram).update(value);
- }
-
- int[] int_values = new int[] {2, 6, 16, 31, 61};
- for (int value : int_values) {
- histogram.update(value);
- }
-
- for (int value : int_values) {
- verify(mockHistogram).update(value);
- }
- }
-
- @Test public void testCounter() {
- final String name = "counter";
- final com.codahale.metrics.Counter mockCounter = mock(com.codahale.metrics.Counter.class);
-
- when(mockRegistry.counter(name)).thenReturn(mockCounter);
-
- Counter counter = metrics.getCounter(name);
-
- long[] updates = new long[] {1L, 5L, -2L, 4L, -8L, 0};
- for (long update : updates) {
- if (update < 0) {
- counter.decrement(Math.abs(update));
- } else {
- counter.increment(update);
- }
- }
-
- for (long update : updates) {
- if (update < 0) {
- verify(mockCounter).dec(Math.abs(update));
- } else {
- verify(mockCounter).inc(update);
- }
- }
-
- int numSingleUpdates = 3;
- for (int i = 0; i < numSingleUpdates; i++) {
- counter.increment();
- counter.decrement();
- }
-
- verify(mockCounter, times(numSingleUpdates)).inc();
- verify(mockCounter, times(numSingleUpdates)).dec();
- }
-
- @Test public void testTimer() {
- final String name = "timer";
- final com.codahale.metrics.Timer mockTimer = mock(com.codahale.metrics.Timer.class);
- final com.codahale.metrics.Timer.Context mockContext =
- mock(com.codahale.metrics.Timer.Context.class);
-
- when(mockRegistry.timer(name)).thenReturn(mockTimer);
- when(mockTimer.time()).thenReturn(mockContext);
-
- Timer timer = metrics.getTimer(name);
- Context context = timer.start();
- context.close();
-
- verify(mockTimer).time();
- verify(mockContext).stop();
- }
-}
-
-// End DropwizardMetricsSystemTest.java
http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/6afbfd52/metrics-dropwizardmetrics3/src/test/java/org/apache/calcite/avatica/metrics/dropwizard3/DropwizardTimerTest.java
----------------------------------------------------------------------
diff --git a/metrics-dropwizardmetrics3/src/test/java/org/apache/calcite/avatica/metrics/dropwizard3/DropwizardTimerTest.java b/metrics-dropwizardmetrics3/src/test/java/org/apache/calcite/avatica/metrics/dropwizard3/DropwizardTimerTest.java
deleted file mode 100644
index 536d935..0000000
--- a/metrics-dropwizardmetrics3/src/test/java/org/apache/calcite/avatica/metrics/dropwizard3/DropwizardTimerTest.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.calcite.avatica.metrics.dropwizard3;
-
-import org.apache.calcite.avatica.metrics.dropwizard3.DropwizardTimer.DropwizardContext;
-
-import com.codahale.metrics.Timer;
-import com.codahale.metrics.Timer.Context;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.Mockito;
-
-/**
- * Test class for {@link DropwizardTimer}
- */
-public class DropwizardTimerTest {
-
- private Timer timer;
- private Context context;
-
- @Before public void setup() {
- this.timer = Mockito.mock(Timer.class);
- this.context = Mockito.mock(Context.class);
- }
-
- @Test public void test() {
- DropwizardTimer dwTimer = new DropwizardTimer(timer);
-
- Mockito.when(timer.time()).thenReturn(context);
-
- DropwizardContext dwContext = dwTimer.start();
-
- dwContext.close();
-
- Mockito.verify(timer).time();
- Mockito.verify(context).stop();
- }
-
-}
-
-// End DropwizardTimerTest.java
http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/6afbfd52/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index e60e33c..1d6c9ac 100644
--- a/pom.xml
+++ b/pom.xml
@@ -62,7 +62,7 @@ limitations under the License.
<!-- Needed for JDK 10 javadoc for [LANG-1365] -->
<commons-lang3.version>3.8</commons-lang3.version>
<docker-maven-plugin.version>1.1.1</docker-maven-plugin.version>
- <dropwizard-metrics3.version>3.1.2</dropwizard-metrics3.version>
+ <dropwizard-metrics.version>4.0.3</dropwizard-metrics.version>
<forbiddenapis.version>2.6</forbiddenapis.version>
<groovy-maven-plugin.version>2.1</groovy-maven-plugin.version>
<!-- We support guava versions as old as 14.0.1 (the version used by Hive)
@@ -114,7 +114,7 @@ limitations under the License.
<module>core</module>
<module>docker</module>
<module>metrics</module>
- <module>metrics-dropwizardmetrics3</module>
+ <module>metrics-dropwizardmetrics</module>
<module>noop-driver</module>
<module>server</module>
<module>tck</module>
[2/2] calcite-avatica git commit: [CALCITE-2583] Upgrade dropwizard
metrics to 4.0.3
Posted by kr...@apache.org.
[CALCITE-2583] Upgrade dropwizard metrics to 4.0.3
This changes the following:
* package name: `metrics-dropwizardmetrics3` -> `metrics-dropwizardmetrics`
* class name: `o.a.c.a.metrics.dropwizard3` -> `o.a.c.a.metrics.dropwizard`
Close apache/calcite-avatica#72
Signed-off-by: Kevin Risden <kr...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/calcite-avatica/repo
Commit: http://git-wip-us.apache.org/repos/asf/calcite-avatica/commit/6afbfd52
Tree: http://git-wip-us.apache.org/repos/asf/calcite-avatica/tree/6afbfd52
Diff: http://git-wip-us.apache.org/repos/asf/calcite-avatica/diff/6afbfd52
Branch: refs/heads/master
Commit: 6afbfd52a78966a12d837a3cfe9c49ef216944fe
Parents: bba9ba7
Author: Kevin Risden <kr...@apache.org>
Authored: Thu Sep 20 14:11:07 2018 -0400
Committer: Kevin Risden <kr...@apache.org>
Committed: Thu Sep 20 16:55:09 2018 -0400
----------------------------------------------------------------------
metrics-dropwizardmetrics/pom.xml | 88 ++++++++++
.../metrics/dropwizard/DropwizardCounter.java | 51 ++++++
.../metrics/dropwizard/DropwizardGauge.java | 39 +++++
.../metrics/dropwizard/DropwizardHistogram.java | 43 +++++
.../metrics/dropwizard/DropwizardMeter.java | 43 +++++
.../dropwizard/DropwizardMetricsSystem.java | 62 +++++++
.../DropwizardMetricsSystemConfiguration.java | 42 +++++
.../DropwizardMetricsSystemFactory.java | 42 +++++
.../metrics/dropwizard/DropwizardTimer.java | 54 +++++++
.../metrics/dropwizard/package-info.java | 26 +++
...calcite.avatica.metrics.MetricsSystemFactory | 2 +
.../dropwizard/DropwizardCounterTest.java | 61 +++++++
.../metrics/dropwizard/DropwizardGaugeTest.java | 60 +++++++
.../dropwizard/DropwizardHistogramTest.java | 49 ++++++
.../metrics/dropwizard/DropwizardMeterTest.java | 50 ++++++
.../DropwizardMetricsSystemFactoryTest.java | 54 +++++++
.../dropwizard/DropwizardMetricsSystemTest.java | 161 +++++++++++++++++++
.../metrics/dropwizard/DropwizardTimerTest.java | 56 +++++++
metrics-dropwizardmetrics3/pom.xml | 88 ----------
.../metrics/dropwizard3/DropwizardCounter.java | 51 ------
.../metrics/dropwizard3/DropwizardGauge.java | 39 -----
.../dropwizard3/DropwizardHistogram.java | 43 -----
.../metrics/dropwizard3/DropwizardMeter.java | 43 -----
.../dropwizard3/DropwizardMetricsSystem.java | 62 -------
.../DropwizardMetricsSystemConfiguration.java | 42 -----
.../DropwizardMetricsSystemFactory.java | 42 -----
.../metrics/dropwizard3/DropwizardTimer.java | 54 -------
.../metrics/dropwizard3/package-info.java | 26 ---
...calcite.avatica.metrics.MetricsSystemFactory | 2 -
.../dropwizard3/DropwizardCounterTest.java | 61 -------
.../dropwizard3/DropwizardGaugeTest.java | 60 -------
.../dropwizard3/DropwizardHistogramTest.java | 49 ------
.../dropwizard3/DropwizardMeterTest.java | 50 ------
.../DropwizardMetricsSystemFactoryTest.java | 54 -------
.../DropwizardMetricsSystemTest.java | 161 -------------------
.../dropwizard3/DropwizardTimerTest.java | 56 -------
pom.xml | 4 +-
37 files changed, 985 insertions(+), 985 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/6afbfd52/metrics-dropwizardmetrics/pom.xml
----------------------------------------------------------------------
diff --git a/metrics-dropwizardmetrics/pom.xml b/metrics-dropwizardmetrics/pom.xml
new file mode 100644
index 0000000..387e7f3
--- /dev/null
+++ b/metrics-dropwizardmetrics/pom.xml
@@ -0,0 +1,88 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements. See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to you under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License. You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.calcite.avatica</groupId>
+ <artifactId>avatica-parent</artifactId>
+ <version>1.13.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>avatica-metrics-dropwizardmetrics</artifactId>
+ <packaging>jar</packaging>
+ <name>Apache Calcite Avatica Dropwizard Metrics</name>
+ <description>An implementation of Avatica Metrics using Dropwizard Metrics. This should work with Dropwizard Metrics 3.x and 4.x.</description>
+
+ <properties>
+ <top.dir>${project.basedir}/..</top.dir>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.calcite.avatica</groupId>
+ <artifactId>avatica-metrics</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>io.dropwizard.metrics</groupId>
+ <artifactId>metrics-core</artifactId>
+ <!-- Avoid specifying version in dependencyManagement in support of other avatica-metrics impls -->
+ <version>${dropwizard-metrics.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-core</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <!-- Parent module has the same plugin and does the work of
+ generating -sources.jar for each project. But without the
+ plugin declared here, IDEs don't know the sources are
+ available. -->
+ <plugin>
+ <artifactId>maven-source-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>attach-sources</id>
+ <phase>verify</phase>
+ <goals>
+ <goal>jar-no-fork</goal>
+ <goal>test-jar-no-fork</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.rat</groupId>
+ <artifactId>apache-rat-plugin</artifactId>
+ <configuration>
+ <excludes>
+ <exclude>src/main/resources/META-INF/services/org.apache.calcite.avatica.metrics.MetricsSystemFactory</exclude>
+ </excludes>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/6afbfd52/metrics-dropwizardmetrics/src/main/java/org/apache/calcite/avatica/metrics/dropwizard/DropwizardCounter.java
----------------------------------------------------------------------
diff --git a/metrics-dropwizardmetrics/src/main/java/org/apache/calcite/avatica/metrics/dropwizard/DropwizardCounter.java b/metrics-dropwizardmetrics/src/main/java/org/apache/calcite/avatica/metrics/dropwizard/DropwizardCounter.java
new file mode 100644
index 0000000..c6de931
--- /dev/null
+++ b/metrics-dropwizardmetrics/src/main/java/org/apache/calcite/avatica/metrics/dropwizard/DropwizardCounter.java
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.calcite.avatica.metrics.dropwizard;
+
+import com.codahale.metrics.Counter;
+
+import java.util.Objects;
+
+/**
+ * Dropwizard Metrics implementation of {@link org.apache.calcite.avatica.metrics.Counter}.
+ */
+public class DropwizardCounter implements org.apache.calcite.avatica.metrics.Counter {
+
+ private final Counter counter;
+
+ public DropwizardCounter(Counter counter) {
+ this.counter = Objects.requireNonNull(counter);
+ }
+
+ @Override public void increment() {
+ this.counter.inc();
+ }
+
+ @Override public void increment(long n) {
+ this.counter.inc(n);
+ }
+
+ @Override public void decrement() {
+ this.counter.dec();
+ }
+
+ @Override public void decrement(long n) {
+ this.counter.dec(n);
+ }
+}
+
+// End DropwizardCounter.java
http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/6afbfd52/metrics-dropwizardmetrics/src/main/java/org/apache/calcite/avatica/metrics/dropwizard/DropwizardGauge.java
----------------------------------------------------------------------
diff --git a/metrics-dropwizardmetrics/src/main/java/org/apache/calcite/avatica/metrics/dropwizard/DropwizardGauge.java b/metrics-dropwizardmetrics/src/main/java/org/apache/calcite/avatica/metrics/dropwizard/DropwizardGauge.java
new file mode 100644
index 0000000..50537db
--- /dev/null
+++ b/metrics-dropwizardmetrics/src/main/java/org/apache/calcite/avatica/metrics/dropwizard/DropwizardGauge.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.calcite.avatica.metrics.dropwizard;
+
+import com.codahale.metrics.Gauge;
+
+/**
+ * Dropwizard Metrics implementation of {@link org.apache.calcite.avatica.metrics.Gauge}.
+ *
+ * @param <T> The value the gauge returns.
+ */
+public class DropwizardGauge<T> implements Gauge<T> {
+
+ private final org.apache.calcite.avatica.metrics.Gauge<T> gauge;
+
+ public DropwizardGauge(org.apache.calcite.avatica.metrics.Gauge<T> gauge) {
+ this.gauge = gauge;
+ }
+
+ @Override public T getValue() {
+ return gauge.getValue();
+ }
+}
+
+// End DropwizardGauge.java
http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/6afbfd52/metrics-dropwizardmetrics/src/main/java/org/apache/calcite/avatica/metrics/dropwizard/DropwizardHistogram.java
----------------------------------------------------------------------
diff --git a/metrics-dropwizardmetrics/src/main/java/org/apache/calcite/avatica/metrics/dropwizard/DropwizardHistogram.java b/metrics-dropwizardmetrics/src/main/java/org/apache/calcite/avatica/metrics/dropwizard/DropwizardHistogram.java
new file mode 100644
index 0000000..3a33ca3
--- /dev/null
+++ b/metrics-dropwizardmetrics/src/main/java/org/apache/calcite/avatica/metrics/dropwizard/DropwizardHistogram.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.calcite.avatica.metrics.dropwizard;
+
+import com.codahale.metrics.Histogram;
+
+import java.util.Objects;
+
+/**
+ * Dropwizard metrics implementation of {@link org.apache.calcite.avatica.metrics.Histogram}.
+ */
+public class DropwizardHistogram implements org.apache.calcite.avatica.metrics.Histogram {
+
+ private final Histogram histogram;
+
+ public DropwizardHistogram(Histogram histogram) {
+ this.histogram = Objects.requireNonNull(histogram);
+ }
+
+ @Override public void update(int value) {
+ histogram.update(value);
+ }
+
+ @Override public void update(long value) {
+ histogram.update(value);
+ }
+}
+
+// End DropwizardHistogram.java
http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/6afbfd52/metrics-dropwizardmetrics/src/main/java/org/apache/calcite/avatica/metrics/dropwizard/DropwizardMeter.java
----------------------------------------------------------------------
diff --git a/metrics-dropwizardmetrics/src/main/java/org/apache/calcite/avatica/metrics/dropwizard/DropwizardMeter.java b/metrics-dropwizardmetrics/src/main/java/org/apache/calcite/avatica/metrics/dropwizard/DropwizardMeter.java
new file mode 100644
index 0000000..041cb8c
--- /dev/null
+++ b/metrics-dropwizardmetrics/src/main/java/org/apache/calcite/avatica/metrics/dropwizard/DropwizardMeter.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.calcite.avatica.metrics.dropwizard;
+
+import com.codahale.metrics.Meter;
+
+import java.util.Objects;
+
+/**
+ * Dropwizard metrics implementation of {@link org.apache.calcite.avatica.metrics.Meter}.
+ */
+public class DropwizardMeter implements org.apache.calcite.avatica.metrics.Meter {
+
+ private final Meter meter;
+
+ public DropwizardMeter(Meter meter) {
+ this.meter = Objects.requireNonNull(meter);
+ }
+
+ @Override public void mark() {
+ this.meter.mark();
+ }
+
+ @Override public void mark(long count) {
+ this.meter.mark(count);
+ }
+}
+
+// End DropwizardMeter.java
http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/6afbfd52/metrics-dropwizardmetrics/src/main/java/org/apache/calcite/avatica/metrics/dropwizard/DropwizardMetricsSystem.java
----------------------------------------------------------------------
diff --git a/metrics-dropwizardmetrics/src/main/java/org/apache/calcite/avatica/metrics/dropwizard/DropwizardMetricsSystem.java b/metrics-dropwizardmetrics/src/main/java/org/apache/calcite/avatica/metrics/dropwizard/DropwizardMetricsSystem.java
new file mode 100644
index 0000000..e78273c
--- /dev/null
+++ b/metrics-dropwizardmetrics/src/main/java/org/apache/calcite/avatica/metrics/dropwizard/DropwizardMetricsSystem.java
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.calcite.avatica.metrics.dropwizard;
+
+import org.apache.calcite.avatica.metrics.Counter;
+import org.apache.calcite.avatica.metrics.Gauge;
+import org.apache.calcite.avatica.metrics.Histogram;
+import org.apache.calcite.avatica.metrics.Meter;
+import org.apache.calcite.avatica.metrics.MetricsSystem;
+import org.apache.calcite.avatica.metrics.Timer;
+
+import com.codahale.metrics.MetricRegistry;
+
+import java.util.Objects;
+
+/**
+ * Dropwizard Metrics implementation of {@link MetricsSystem}.
+ */
+public class DropwizardMetricsSystem implements MetricsSystem {
+
+ private final MetricRegistry registry;
+
+ public DropwizardMetricsSystem(MetricRegistry registry) {
+ this.registry = Objects.requireNonNull(registry);
+ }
+
+ @Override public Timer getTimer(String name) {
+ return new DropwizardTimer(registry.timer(name));
+ }
+
+ @Override public Histogram getHistogram(String name) {
+ return new DropwizardHistogram(registry.histogram(name));
+ }
+
+ @Override public Meter getMeter(String name) {
+ return new DropwizardMeter(registry.meter(name));
+ }
+
+ @Override public Counter getCounter(String name) {
+ return new DropwizardCounter(registry.counter(name));
+ }
+
+ @Override public <T> void register(String name, Gauge<T> gauge) {
+ registry.register(name, new DropwizardGauge<T>(gauge));
+ }
+}
+
+// End DropwizardMetricsSystem.java
http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/6afbfd52/metrics-dropwizardmetrics/src/main/java/org/apache/calcite/avatica/metrics/dropwizard/DropwizardMetricsSystemConfiguration.java
----------------------------------------------------------------------
diff --git a/metrics-dropwizardmetrics/src/main/java/org/apache/calcite/avatica/metrics/dropwizard/DropwizardMetricsSystemConfiguration.java b/metrics-dropwizardmetrics/src/main/java/org/apache/calcite/avatica/metrics/dropwizard/DropwizardMetricsSystemConfiguration.java
new file mode 100644
index 0000000..df432bd
--- /dev/null
+++ b/metrics-dropwizardmetrics/src/main/java/org/apache/calcite/avatica/metrics/dropwizard/DropwizardMetricsSystemConfiguration.java
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.calcite.avatica.metrics.dropwizard;
+
+import org.apache.calcite.avatica.metrics.MetricsSystemConfiguration;
+
+import com.codahale.metrics.MetricRegistry;
+
+import java.util.Objects;
+
+/**
+ * A container which provides a {@link MetricRegistry} to a {@link DropwizardMetricsSystem}.
+ */
+public class DropwizardMetricsSystemConfiguration implements
+ MetricsSystemConfiguration<MetricRegistry> {
+
+ private final MetricRegistry registry;
+
+ public DropwizardMetricsSystemConfiguration(MetricRegistry registry) {
+ this.registry = Objects.requireNonNull(registry);
+ }
+
+ @Override public MetricRegistry get() {
+ return registry;
+ }
+}
+
+// End DropwizardMetricsSystemConfiguration.java
http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/6afbfd52/metrics-dropwizardmetrics/src/main/java/org/apache/calcite/avatica/metrics/dropwizard/DropwizardMetricsSystemFactory.java
----------------------------------------------------------------------
diff --git a/metrics-dropwizardmetrics/src/main/java/org/apache/calcite/avatica/metrics/dropwizard/DropwizardMetricsSystemFactory.java b/metrics-dropwizardmetrics/src/main/java/org/apache/calcite/avatica/metrics/dropwizard/DropwizardMetricsSystemFactory.java
new file mode 100644
index 0000000..a9fafd6
--- /dev/null
+++ b/metrics-dropwizardmetrics/src/main/java/org/apache/calcite/avatica/metrics/dropwizard/DropwizardMetricsSystemFactory.java
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.calcite.avatica.metrics.dropwizard;
+
+import org.apache.calcite.avatica.metrics.MetricsSystemConfiguration;
+import org.apache.calcite.avatica.metrics.MetricsSystemFactory;
+
+/**
+ * A {@link MetricsSystemFactory} for {@link DropwizardMetricsSystem}.
+ */
+public class DropwizardMetricsSystemFactory implements MetricsSystemFactory {
+
+ @Override public DropwizardMetricsSystem create(MetricsSystemConfiguration<?> config) {
+ // Verify we got configuration this factory can use
+ if (config instanceof DropwizardMetricsSystemConfiguration) {
+ DropwizardMetricsSystemConfiguration typedConfig =
+ (DropwizardMetricsSystemConfiguration) config;
+
+ return new DropwizardMetricsSystem(typedConfig.get());
+ }
+
+ throw new IllegalStateException("Expected instance of "
+ + DropwizardMetricsSystemConfiguration.class.getName() + " but got "
+ + (null == config ? "null" : config.getClass().getName()));
+ }
+}
+
+// End DropwizardMetricsSystemFactory.java
http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/6afbfd52/metrics-dropwizardmetrics/src/main/java/org/apache/calcite/avatica/metrics/dropwizard/DropwizardTimer.java
----------------------------------------------------------------------
diff --git a/metrics-dropwizardmetrics/src/main/java/org/apache/calcite/avatica/metrics/dropwizard/DropwizardTimer.java b/metrics-dropwizardmetrics/src/main/java/org/apache/calcite/avatica/metrics/dropwizard/DropwizardTimer.java
new file mode 100644
index 0000000..7d71001
--- /dev/null
+++ b/metrics-dropwizardmetrics/src/main/java/org/apache/calcite/avatica/metrics/dropwizard/DropwizardTimer.java
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.calcite.avatica.metrics.dropwizard;
+
+import com.codahale.metrics.Timer;
+
+import java.util.Objects;
+
+/**
+ * Dropwizard Metrics implementation of {@link org.apache.calcite.avatica.metrics.Timer}.
+ */
+public class DropwizardTimer implements org.apache.calcite.avatica.metrics.Timer {
+
+ private final Timer timer;
+
+ public DropwizardTimer(Timer timer) {
+ this.timer = Objects.requireNonNull(timer);
+ }
+
+ @Override public DropwizardContext start() {
+ return new DropwizardContext(timer.time());
+ }
+
+ /**
+ * Dropwizard Metrics implementation of {@link org.apache.calcite.avatica.metrics.Timer.Context}
+ */
+ public class DropwizardContext implements org.apache.calcite.avatica.metrics.Timer.Context {
+ private final com.codahale.metrics.Timer.Context context;
+
+ public DropwizardContext(com.codahale.metrics.Timer.Context context) {
+ this.context = Objects.requireNonNull(context);
+ }
+
+ @Override public void close() {
+ this.context.stop();
+ }
+ }
+}
+
+// End DropwizardTimer.java
http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/6afbfd52/metrics-dropwizardmetrics/src/main/java/org/apache/calcite/avatica/metrics/dropwizard/package-info.java
----------------------------------------------------------------------
diff --git a/metrics-dropwizardmetrics/src/main/java/org/apache/calcite/avatica/metrics/dropwizard/package-info.java b/metrics-dropwizardmetrics/src/main/java/org/apache/calcite/avatica/metrics/dropwizard/package-info.java
new file mode 100644
index 0000000..0104f20
--- /dev/null
+++ b/metrics-dropwizardmetrics/src/main/java/org/apache/calcite/avatica/metrics/dropwizard/package-info.java
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * Dropwizard-Metrics (v3) implementation of the Avatica Metrics framework.
+ */
+@PackageMarker
+package org.apache.calcite.avatica.metrics.dropwizard;
+
+import org.apache.calcite.avatica.metrics.PackageMarker;
+
+// End package-info.java
http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/6afbfd52/metrics-dropwizardmetrics/src/main/resources/META-INF/services/org.apache.calcite.avatica.metrics.MetricsSystemFactory
----------------------------------------------------------------------
diff --git a/metrics-dropwizardmetrics/src/main/resources/META-INF/services/org.apache.calcite.avatica.metrics.MetricsSystemFactory b/metrics-dropwizardmetrics/src/main/resources/META-INF/services/org.apache.calcite.avatica.metrics.MetricsSystemFactory
new file mode 100644
index 0000000..b03fe3c
--- /dev/null
+++ b/metrics-dropwizardmetrics/src/main/resources/META-INF/services/org.apache.calcite.avatica.metrics.MetricsSystemFactory
@@ -0,0 +1,2 @@
+org.apache.calcite.avatica.metrics.dropwizard.DropwizardMetricsSystemFactory
+
http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/6afbfd52/metrics-dropwizardmetrics/src/test/java/org/apache/calcite/avatica/metrics/dropwizard/DropwizardCounterTest.java
----------------------------------------------------------------------
diff --git a/metrics-dropwizardmetrics/src/test/java/org/apache/calcite/avatica/metrics/dropwizard/DropwizardCounterTest.java b/metrics-dropwizardmetrics/src/test/java/org/apache/calcite/avatica/metrics/dropwizard/DropwizardCounterTest.java
new file mode 100644
index 0000000..4b6b2e7
--- /dev/null
+++ b/metrics-dropwizardmetrics/src/test/java/org/apache/calcite/avatica/metrics/dropwizard/DropwizardCounterTest.java
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.calcite.avatica.metrics.dropwizard;
+
+import com.codahale.metrics.Counter;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+
+/**
+ * Test class for {@link DropwizardCounter}.
+ */
+public class DropwizardCounterTest {
+
+ private Counter counter;
+
+ @Before public void setup() {
+ this.counter = new Counter();
+ }
+
+ @Test public void testCounting() {
+ DropwizardCounter dwCounter = new DropwizardCounter(counter);
+
+ dwCounter.increment();
+ assertEquals(1L, counter.getCount());
+ dwCounter.increment();
+ assertEquals(2L, counter.getCount());
+ dwCounter.increment(2L);
+ assertEquals(4L, counter.getCount());
+ dwCounter.increment(-1L);
+ assertEquals(3L, counter.getCount());
+
+ dwCounter.decrement();
+ assertEquals(2L, counter.getCount());
+ dwCounter.decrement();
+ assertEquals(1L, counter.getCount());
+ dwCounter.decrement(4L);
+ assertEquals(-3L, counter.getCount());
+ dwCounter.decrement(-3L);
+ assertEquals(0L, counter.getCount());
+ }
+
+}
+
+// End DropwizardCounterTest.java
http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/6afbfd52/metrics-dropwizardmetrics/src/test/java/org/apache/calcite/avatica/metrics/dropwizard/DropwizardGaugeTest.java
----------------------------------------------------------------------
diff --git a/metrics-dropwizardmetrics/src/test/java/org/apache/calcite/avatica/metrics/dropwizard/DropwizardGaugeTest.java b/metrics-dropwizardmetrics/src/test/java/org/apache/calcite/avatica/metrics/dropwizard/DropwizardGaugeTest.java
new file mode 100644
index 0000000..5212594
--- /dev/null
+++ b/metrics-dropwizardmetrics/src/test/java/org/apache/calcite/avatica/metrics/dropwizard/DropwizardGaugeTest.java
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.calcite.avatica.metrics.dropwizard;
+
+import org.apache.calcite.avatica.metrics.Gauge;
+
+import org.junit.Test;
+
+import java.util.concurrent.atomic.AtomicLong;
+
+import static org.junit.Assert.assertEquals;
+
+/**
+ * Test class for {@link DropwizardGauge}.
+ */
+public class DropwizardGaugeTest {
+
+ @Test public void test() {
+ SimpleGauge gauge = new SimpleGauge();
+ DropwizardGauge<Long> dwGauge = new DropwizardGauge<>(gauge);
+
+ assertEquals(gauge.getValue(), dwGauge.getValue());
+
+ gauge.setValue(1000L);
+
+ assertEquals(gauge.getValue(), dwGauge.getValue());
+ }
+
+ /**
+ * Gauge implementation with a setter.
+ */
+ private static class SimpleGauge implements Gauge<Long> {
+
+ private final AtomicLong value = new AtomicLong(0L);
+
+ @Override public Long getValue() {
+ return this.value.get();
+ }
+
+ public void setValue(long value) {
+ this.value.set(value);
+ }
+ }
+}
+
+// End DropwizardGaugeTest.java
http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/6afbfd52/metrics-dropwizardmetrics/src/test/java/org/apache/calcite/avatica/metrics/dropwizard/DropwizardHistogramTest.java
----------------------------------------------------------------------
diff --git a/metrics-dropwizardmetrics/src/test/java/org/apache/calcite/avatica/metrics/dropwizard/DropwizardHistogramTest.java b/metrics-dropwizardmetrics/src/test/java/org/apache/calcite/avatica/metrics/dropwizard/DropwizardHistogramTest.java
new file mode 100644
index 0000000..b6dc1f4
--- /dev/null
+++ b/metrics-dropwizardmetrics/src/test/java/org/apache/calcite/avatica/metrics/dropwizard/DropwizardHistogramTest.java
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.calcite.avatica.metrics.dropwizard;
+
+import com.codahale.metrics.Histogram;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mockito;
+
+/**
+ * Test class for {@link DropwizardHistogram}.
+ */
+public class DropwizardHistogramTest {
+
+ private Histogram histogram;
+
+ @Before public void setup() {
+ this.histogram = Mockito.mock(Histogram.class);
+ }
+
+ @Test public void test() {
+ DropwizardHistogram dwHistogram = new DropwizardHistogram(histogram);
+
+ dwHistogram.update(10);
+
+ dwHistogram.update(100L);
+
+ Mockito.verify(histogram).update(10);
+ Mockito.verify(histogram).update(100L);
+ }
+
+}
+
+// End DropwizardHistogramTest.java
http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/6afbfd52/metrics-dropwizardmetrics/src/test/java/org/apache/calcite/avatica/metrics/dropwizard/DropwizardMeterTest.java
----------------------------------------------------------------------
diff --git a/metrics-dropwizardmetrics/src/test/java/org/apache/calcite/avatica/metrics/dropwizard/DropwizardMeterTest.java b/metrics-dropwizardmetrics/src/test/java/org/apache/calcite/avatica/metrics/dropwizard/DropwizardMeterTest.java
new file mode 100644
index 0000000..d236bfd
--- /dev/null
+++ b/metrics-dropwizardmetrics/src/test/java/org/apache/calcite/avatica/metrics/dropwizard/DropwizardMeterTest.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.calcite.avatica.metrics.dropwizard;
+
+import com.codahale.metrics.Meter;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mockito;
+
+/**
+ * Test class for {@link DropwizardMeter}.
+ */
+public class DropwizardMeterTest {
+
+ private Meter meter;
+
+ @Before public void setup() {
+ this.meter = Mockito.mock(Meter.class);
+ }
+
+ @Test public void test() {
+ DropwizardMeter dwMeter = new DropwizardMeter(this.meter);
+
+ dwMeter.mark();
+ dwMeter.mark(10L);
+ dwMeter.mark();
+ dwMeter.mark();
+
+ Mockito.verify(meter, Mockito.times(3)).mark();
+ Mockito.verify(meter).mark(10L);
+ }
+
+}
+
+// End DropwizardMeterTest.java
http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/6afbfd52/metrics-dropwizardmetrics/src/test/java/org/apache/calcite/avatica/metrics/dropwizard/DropwizardMetricsSystemFactoryTest.java
----------------------------------------------------------------------
diff --git a/metrics-dropwizardmetrics/src/test/java/org/apache/calcite/avatica/metrics/dropwizard/DropwizardMetricsSystemFactoryTest.java b/metrics-dropwizardmetrics/src/test/java/org/apache/calcite/avatica/metrics/dropwizard/DropwizardMetricsSystemFactoryTest.java
new file mode 100644
index 0000000..63859ae
--- /dev/null
+++ b/metrics-dropwizardmetrics/src/test/java/org/apache/calcite/avatica/metrics/dropwizard/DropwizardMetricsSystemFactoryTest.java
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.calcite.avatica.metrics.dropwizard;
+
+import org.apache.calcite.avatica.metrics.noop.NoopMetricsSystemConfiguration;
+
+import com.codahale.metrics.MetricRegistry;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.junit.Assert.assertNotNull;
+
+/**
+ * Test class for {@link DropwizardMetricsSystemFactory}.
+ */
+public class DropwizardMetricsSystemFactoryTest {
+
+ private DropwizardMetricsSystemFactory factory;
+
+ @Before public void setup() {
+ factory = new DropwizardMetricsSystemFactory();
+ }
+
+ @Test(expected = IllegalStateException.class) public void testNullConfigurationFails() {
+ factory.create(null);
+ }
+
+ @Test(expected = IllegalStateException.class) public void testUnhandledConfigurationType() {
+ factory.create(NoopMetricsSystemConfiguration.getInstance());
+ }
+
+ @Test public void testHandledConfigurationType() {
+ DropwizardMetricsSystem metrics =
+ factory.create(new DropwizardMetricsSystemConfiguration(new MetricRegistry()));
+ assertNotNull("Expected DropwizardMetricsSystem to be non-null", metrics);
+ }
+}
+
+// End DropwizardMetricsSystemFactoryTest.java
http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/6afbfd52/metrics-dropwizardmetrics/src/test/java/org/apache/calcite/avatica/metrics/dropwizard/DropwizardMetricsSystemTest.java
----------------------------------------------------------------------
diff --git a/metrics-dropwizardmetrics/src/test/java/org/apache/calcite/avatica/metrics/dropwizard/DropwizardMetricsSystemTest.java b/metrics-dropwizardmetrics/src/test/java/org/apache/calcite/avatica/metrics/dropwizard/DropwizardMetricsSystemTest.java
new file mode 100644
index 0000000..a7ac094
--- /dev/null
+++ b/metrics-dropwizardmetrics/src/test/java/org/apache/calcite/avatica/metrics/dropwizard/DropwizardMetricsSystemTest.java
@@ -0,0 +1,161 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.calcite.avatica.metrics.dropwizard;
+
+import org.apache.calcite.avatica.metrics.Counter;
+import org.apache.calcite.avatica.metrics.Gauge;
+import org.apache.calcite.avatica.metrics.Histogram;
+import org.apache.calcite.avatica.metrics.Meter;
+import org.apache.calcite.avatica.metrics.Timer;
+import org.apache.calcite.avatica.metrics.Timer.Context;
+
+import com.codahale.metrics.MetricRegistry;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.mockito.Mockito.any;
+import static org.mockito.Mockito.eq;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+/**
+ * Tests for {@link DropwizardMetricsSystem}.
+ */
+public class DropwizardMetricsSystemTest {
+
+ private MetricRegistry mockRegistry;
+ private DropwizardMetricsSystem metrics;
+
+ @Before public void setup() {
+ mockRegistry = mock(MetricRegistry.class);
+ metrics = new DropwizardMetricsSystem(mockRegistry);
+ }
+
+ @Test public void testGauge() {
+ final long gaugeValue = 42L;
+ final String name = "gauge";
+ metrics.register(name, new Gauge<Long>() {
+ @Override public Long getValue() {
+ return gaugeValue;
+ }
+ });
+
+ verify(mockRegistry, times(1)).register(eq(name), any(com.codahale.metrics.Gauge.class));
+ }
+
+ @Test public void testMeter() {
+ final String name = "meter";
+ final com.codahale.metrics.Meter mockMeter = mock(com.codahale.metrics.Meter.class);
+
+ when(mockRegistry.meter(name)).thenReturn(mockMeter);
+
+ Meter meter = metrics.getMeter(name);
+
+ final long count = 5;
+ meter.mark(count);
+
+ verify(mockMeter, times(1)).mark(count);
+
+ meter.mark();
+
+ verify(mockMeter, times(1)).mark();
+ }
+
+ @Test public void testHistogram() {
+ final String name = "histogram";
+ final com.codahale.metrics.Histogram mockHistogram = mock(com.codahale.metrics.Histogram.class);
+
+ when(mockRegistry.histogram(name)).thenReturn(mockHistogram);
+
+ Histogram histogram = metrics.getHistogram(name);
+
+ long[] long_values = new long[] {1L, 5L, 15L, 30L, 60L};
+ for (long value : long_values) {
+ histogram.update(value);
+ }
+
+ for (long value : long_values) {
+ verify(mockHistogram).update(value);
+ }
+
+ int[] int_values = new int[] {2, 6, 16, 31, 61};
+ for (int value : int_values) {
+ histogram.update(value);
+ }
+
+ for (int value : int_values) {
+ verify(mockHistogram).update(value);
+ }
+ }
+
+ @Test public void testCounter() {
+ final String name = "counter";
+ final com.codahale.metrics.Counter mockCounter = mock(com.codahale.metrics.Counter.class);
+
+ when(mockRegistry.counter(name)).thenReturn(mockCounter);
+
+ Counter counter = metrics.getCounter(name);
+
+ long[] updates = new long[] {1L, 5L, -2L, 4L, -8L, 0};
+ for (long update : updates) {
+ if (update < 0) {
+ counter.decrement(Math.abs(update));
+ } else {
+ counter.increment(update);
+ }
+ }
+
+ for (long update : updates) {
+ if (update < 0) {
+ verify(mockCounter).dec(Math.abs(update));
+ } else {
+ verify(mockCounter).inc(update);
+ }
+ }
+
+ int numSingleUpdates = 3;
+ for (int i = 0; i < numSingleUpdates; i++) {
+ counter.increment();
+ counter.decrement();
+ }
+
+ verify(mockCounter, times(numSingleUpdates)).inc();
+ verify(mockCounter, times(numSingleUpdates)).dec();
+ }
+
+ @Test public void testTimer() {
+ final String name = "timer";
+ final com.codahale.metrics.Timer mockTimer = mock(com.codahale.metrics.Timer.class);
+ final com.codahale.metrics.Timer.Context mockContext =
+ mock(com.codahale.metrics.Timer.Context.class);
+
+ when(mockRegistry.timer(name)).thenReturn(mockTimer);
+ when(mockTimer.time()).thenReturn(mockContext);
+
+ Timer timer = metrics.getTimer(name);
+ Context context = timer.start();
+ context.close();
+
+ verify(mockTimer).time();
+ verify(mockContext).stop();
+ }
+}
+
+// End DropwizardMetricsSystemTest.java
http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/6afbfd52/metrics-dropwizardmetrics/src/test/java/org/apache/calcite/avatica/metrics/dropwizard/DropwizardTimerTest.java
----------------------------------------------------------------------
diff --git a/metrics-dropwizardmetrics/src/test/java/org/apache/calcite/avatica/metrics/dropwizard/DropwizardTimerTest.java b/metrics-dropwizardmetrics/src/test/java/org/apache/calcite/avatica/metrics/dropwizard/DropwizardTimerTest.java
new file mode 100644
index 0000000..7730061
--- /dev/null
+++ b/metrics-dropwizardmetrics/src/test/java/org/apache/calcite/avatica/metrics/dropwizard/DropwizardTimerTest.java
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.calcite.avatica.metrics.dropwizard;
+
+import org.apache.calcite.avatica.metrics.dropwizard.DropwizardTimer.DropwizardContext;
+
+import com.codahale.metrics.Timer;
+import com.codahale.metrics.Timer.Context;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mockito;
+
+/**
+ * Test class for {@link DropwizardTimer}
+ */
+public class DropwizardTimerTest {
+
+ private Timer timer;
+ private Context context;
+
+ @Before public void setup() {
+ this.timer = Mockito.mock(Timer.class);
+ this.context = Mockito.mock(Context.class);
+ }
+
+ @Test public void test() {
+ DropwizardTimer dwTimer = new DropwizardTimer(timer);
+
+ Mockito.when(timer.time()).thenReturn(context);
+
+ DropwizardContext dwContext = dwTimer.start();
+
+ dwContext.close();
+
+ Mockito.verify(timer).time();
+ Mockito.verify(context).stop();
+ }
+
+}
+
+// End DropwizardTimerTest.java
http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/6afbfd52/metrics-dropwizardmetrics3/pom.xml
----------------------------------------------------------------------
diff --git a/metrics-dropwizardmetrics3/pom.xml b/metrics-dropwizardmetrics3/pom.xml
deleted file mode 100644
index ebf967f..0000000
--- a/metrics-dropwizardmetrics3/pom.xml
+++ /dev/null
@@ -1,88 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements. See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you under the Apache License, Version 2.0
-(the "License"); you may not use this file except in compliance with
-the License. You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.calcite.avatica</groupId>
- <artifactId>avatica-parent</artifactId>
- <version>1.13.0-SNAPSHOT</version>
- </parent>
-
- <artifactId>avatica-metrics-dropwizardmetrics3</artifactId>
- <packaging>jar</packaging>
- <name>Apache Calcite Avatica Dropwizard Metrics 3</name>
- <description>An implementation of Avatica Metrics using Dropwizard Metrics.</description>
-
- <properties>
- <top.dir>${project.basedir}/..</top.dir>
- </properties>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.calcite.avatica</groupId>
- <artifactId>avatica-metrics</artifactId>
- </dependency>
- <dependency>
- <groupId>io.dropwizard.metrics</groupId>
- <artifactId>metrics-core</artifactId>
- <!-- Avoid specifying version in dependencyManagement in support of other avatica-metrics impls -->
- <version>${dropwizard-metrics3.version}</version>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.mockito</groupId>
- <artifactId>mockito-core</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <!-- Parent module has the same plugin and does the work of
- generating -sources.jar for each project. But without the
- plugin declared here, IDEs don't know the sources are
- available. -->
- <plugin>
- <artifactId>maven-source-plugin</artifactId>
- <executions>
- <execution>
- <id>attach-sources</id>
- <phase>verify</phase>
- <goals>
- <goal>jar-no-fork</goal>
- <goal>test-jar-no-fork</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.apache.rat</groupId>
- <artifactId>apache-rat-plugin</artifactId>
- <configuration>
- <excludes>
- <exclude>src/main/resources/META-INF/services/org.apache.calcite.avatica.metrics.MetricsSystemFactory</exclude>
- </excludes>
- </configuration>
- </plugin>
- </plugins>
- </build>
-</project>
http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/6afbfd52/metrics-dropwizardmetrics3/src/main/java/org/apache/calcite/avatica/metrics/dropwizard3/DropwizardCounter.java
----------------------------------------------------------------------
diff --git a/metrics-dropwizardmetrics3/src/main/java/org/apache/calcite/avatica/metrics/dropwizard3/DropwizardCounter.java b/metrics-dropwizardmetrics3/src/main/java/org/apache/calcite/avatica/metrics/dropwizard3/DropwizardCounter.java
deleted file mode 100644
index 4204ebf..0000000
--- a/metrics-dropwizardmetrics3/src/main/java/org/apache/calcite/avatica/metrics/dropwizard3/DropwizardCounter.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.calcite.avatica.metrics.dropwizard3;
-
-import com.codahale.metrics.Counter;
-
-import java.util.Objects;
-
-/**
- * Dropwizard Metrics implementation of {@link org.apache.calcite.avatica.metrics.Counter}.
- */
-public class DropwizardCounter implements org.apache.calcite.avatica.metrics.Counter {
-
- private final Counter counter;
-
- public DropwizardCounter(Counter counter) {
- this.counter = Objects.requireNonNull(counter);
- }
-
- @Override public void increment() {
- this.counter.inc();
- }
-
- @Override public void increment(long n) {
- this.counter.inc(n);
- }
-
- @Override public void decrement() {
- this.counter.dec();
- }
-
- @Override public void decrement(long n) {
- this.counter.dec(n);
- }
-}
-
-// End DropwizardCounter.java
http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/6afbfd52/metrics-dropwizardmetrics3/src/main/java/org/apache/calcite/avatica/metrics/dropwizard3/DropwizardGauge.java
----------------------------------------------------------------------
diff --git a/metrics-dropwizardmetrics3/src/main/java/org/apache/calcite/avatica/metrics/dropwizard3/DropwizardGauge.java b/metrics-dropwizardmetrics3/src/main/java/org/apache/calcite/avatica/metrics/dropwizard3/DropwizardGauge.java
deleted file mode 100644
index 5f4b776..0000000
--- a/metrics-dropwizardmetrics3/src/main/java/org/apache/calcite/avatica/metrics/dropwizard3/DropwizardGauge.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.calcite.avatica.metrics.dropwizard3;
-
-import com.codahale.metrics.Gauge;
-
-/**
- * Dropwizard Metrics implementation of {@link org.apache.calcite.avatica.metrics.Gauge}.
- *
- * @param <T> The value the gauge returns.
- */
-public class DropwizardGauge<T> implements Gauge<T> {
-
- private final org.apache.calcite.avatica.metrics.Gauge<T> gauge;
-
- public DropwizardGauge(org.apache.calcite.avatica.metrics.Gauge<T> gauge) {
- this.gauge = gauge;
- }
-
- @Override public T getValue() {
- return gauge.getValue();
- }
-}
-
-// End DropwizardGauge.java
http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/6afbfd52/metrics-dropwizardmetrics3/src/main/java/org/apache/calcite/avatica/metrics/dropwizard3/DropwizardHistogram.java
----------------------------------------------------------------------
diff --git a/metrics-dropwizardmetrics3/src/main/java/org/apache/calcite/avatica/metrics/dropwizard3/DropwizardHistogram.java b/metrics-dropwizardmetrics3/src/main/java/org/apache/calcite/avatica/metrics/dropwizard3/DropwizardHistogram.java
deleted file mode 100644
index 266f130..0000000
--- a/metrics-dropwizardmetrics3/src/main/java/org/apache/calcite/avatica/metrics/dropwizard3/DropwizardHistogram.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.calcite.avatica.metrics.dropwizard3;
-
-import com.codahale.metrics.Histogram;
-
-import java.util.Objects;
-
-/**
- * Dropwizard metrics implementation of {@link org.apache.calcite.avatica.metrics.Histogram}.
- */
-public class DropwizardHistogram implements org.apache.calcite.avatica.metrics.Histogram {
-
- private final Histogram histogram;
-
- public DropwizardHistogram(Histogram histogram) {
- this.histogram = Objects.requireNonNull(histogram);
- }
-
- @Override public void update(int value) {
- histogram.update(value);
- }
-
- @Override public void update(long value) {
- histogram.update(value);
- }
-}
-
-// End DropwizardHistogram.java
http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/6afbfd52/metrics-dropwizardmetrics3/src/main/java/org/apache/calcite/avatica/metrics/dropwizard3/DropwizardMeter.java
----------------------------------------------------------------------
diff --git a/metrics-dropwizardmetrics3/src/main/java/org/apache/calcite/avatica/metrics/dropwizard3/DropwizardMeter.java b/metrics-dropwizardmetrics3/src/main/java/org/apache/calcite/avatica/metrics/dropwizard3/DropwizardMeter.java
deleted file mode 100644
index ab8fafc..0000000
--- a/metrics-dropwizardmetrics3/src/main/java/org/apache/calcite/avatica/metrics/dropwizard3/DropwizardMeter.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.calcite.avatica.metrics.dropwizard3;
-
-import com.codahale.metrics.Meter;
-
-import java.util.Objects;
-
-/**
- * Dropwizard metrics implementation of {@link org.apache.calcite.avatica.metrics.Meter}.
- */
-public class DropwizardMeter implements org.apache.calcite.avatica.metrics.Meter {
-
- private final Meter meter;
-
- public DropwizardMeter(Meter meter) {
- this.meter = Objects.requireNonNull(meter);
- }
-
- @Override public void mark() {
- this.meter.mark();
- }
-
- @Override public void mark(long count) {
- this.meter.mark(count);
- }
-}
-
-// End DropwizardMeter.java
http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/6afbfd52/metrics-dropwizardmetrics3/src/main/java/org/apache/calcite/avatica/metrics/dropwizard3/DropwizardMetricsSystem.java
----------------------------------------------------------------------
diff --git a/metrics-dropwizardmetrics3/src/main/java/org/apache/calcite/avatica/metrics/dropwizard3/DropwizardMetricsSystem.java b/metrics-dropwizardmetrics3/src/main/java/org/apache/calcite/avatica/metrics/dropwizard3/DropwizardMetricsSystem.java
deleted file mode 100644
index 6aa71b9..0000000
--- a/metrics-dropwizardmetrics3/src/main/java/org/apache/calcite/avatica/metrics/dropwizard3/DropwizardMetricsSystem.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.calcite.avatica.metrics.dropwizard3;
-
-import org.apache.calcite.avatica.metrics.Counter;
-import org.apache.calcite.avatica.metrics.Gauge;
-import org.apache.calcite.avatica.metrics.Histogram;
-import org.apache.calcite.avatica.metrics.Meter;
-import org.apache.calcite.avatica.metrics.MetricsSystem;
-import org.apache.calcite.avatica.metrics.Timer;
-
-import com.codahale.metrics.MetricRegistry;
-
-import java.util.Objects;
-
-/**
- * Dropwizard Metrics implementation of {@link MetricsSystem}.
- */
-public class DropwizardMetricsSystem implements MetricsSystem {
-
- private final MetricRegistry registry;
-
- public DropwizardMetricsSystem(MetricRegistry registry) {
- this.registry = Objects.requireNonNull(registry);
- }
-
- @Override public Timer getTimer(String name) {
- return new DropwizardTimer(registry.timer(name));
- }
-
- @Override public Histogram getHistogram(String name) {
- return new DropwizardHistogram(registry.histogram(name));
- }
-
- @Override public Meter getMeter(String name) {
- return new DropwizardMeter(registry.meter(name));
- }
-
- @Override public Counter getCounter(String name) {
- return new DropwizardCounter(registry.counter(name));
- }
-
- @Override public <T> void register(String name, Gauge<T> gauge) {
- registry.register(name, new DropwizardGauge<T>(gauge));
- }
-}
-
-// End DropwizardMetricsSystem.java
http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/6afbfd52/metrics-dropwizardmetrics3/src/main/java/org/apache/calcite/avatica/metrics/dropwizard3/DropwizardMetricsSystemConfiguration.java
----------------------------------------------------------------------
diff --git a/metrics-dropwizardmetrics3/src/main/java/org/apache/calcite/avatica/metrics/dropwizard3/DropwizardMetricsSystemConfiguration.java b/metrics-dropwizardmetrics3/src/main/java/org/apache/calcite/avatica/metrics/dropwizard3/DropwizardMetricsSystemConfiguration.java
deleted file mode 100644
index f4c9234..0000000
--- a/metrics-dropwizardmetrics3/src/main/java/org/apache/calcite/avatica/metrics/dropwizard3/DropwizardMetricsSystemConfiguration.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.calcite.avatica.metrics.dropwizard3;
-
-import org.apache.calcite.avatica.metrics.MetricsSystemConfiguration;
-
-import com.codahale.metrics.MetricRegistry;
-
-import java.util.Objects;
-
-/**
- * A container which provides a {@link MetricRegistry} to a {@link DropwizardMetricsSystem}.
- */
-public class DropwizardMetricsSystemConfiguration implements
- MetricsSystemConfiguration<MetricRegistry> {
-
- private final MetricRegistry registry;
-
- public DropwizardMetricsSystemConfiguration(MetricRegistry registry) {
- this.registry = Objects.requireNonNull(registry);
- }
-
- @Override public MetricRegistry get() {
- return registry;
- }
-}
-
-// End DropwizardMetricsSystemConfiguration.java
http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/6afbfd52/metrics-dropwizardmetrics3/src/main/java/org/apache/calcite/avatica/metrics/dropwizard3/DropwizardMetricsSystemFactory.java
----------------------------------------------------------------------
diff --git a/metrics-dropwizardmetrics3/src/main/java/org/apache/calcite/avatica/metrics/dropwizard3/DropwizardMetricsSystemFactory.java b/metrics-dropwizardmetrics3/src/main/java/org/apache/calcite/avatica/metrics/dropwizard3/DropwizardMetricsSystemFactory.java
deleted file mode 100644
index 1480db6..0000000
--- a/metrics-dropwizardmetrics3/src/main/java/org/apache/calcite/avatica/metrics/dropwizard3/DropwizardMetricsSystemFactory.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.calcite.avatica.metrics.dropwizard3;
-
-import org.apache.calcite.avatica.metrics.MetricsSystemConfiguration;
-import org.apache.calcite.avatica.metrics.MetricsSystemFactory;
-
-/**
- * A {@link MetricsSystemFactory} for {@link DropwizardMetricsSystem}.
- */
-public class DropwizardMetricsSystemFactory implements MetricsSystemFactory {
-
- @Override public DropwizardMetricsSystem create(MetricsSystemConfiguration<?> config) {
- // Verify we got configuration this factory can use
- if (config instanceof DropwizardMetricsSystemConfiguration) {
- DropwizardMetricsSystemConfiguration typedConfig =
- (DropwizardMetricsSystemConfiguration) config;
-
- return new DropwizardMetricsSystem(typedConfig.get());
- }
-
- throw new IllegalStateException("Expected instance of "
- + DropwizardMetricsSystemConfiguration.class.getName() + " but got "
- + (null == config ? "null" : config.getClass().getName()));
- }
-}
-
-// End DropwizardMetricsSystemFactory.java
http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/6afbfd52/metrics-dropwizardmetrics3/src/main/java/org/apache/calcite/avatica/metrics/dropwizard3/DropwizardTimer.java
----------------------------------------------------------------------
diff --git a/metrics-dropwizardmetrics3/src/main/java/org/apache/calcite/avatica/metrics/dropwizard3/DropwizardTimer.java b/metrics-dropwizardmetrics3/src/main/java/org/apache/calcite/avatica/metrics/dropwizard3/DropwizardTimer.java
deleted file mode 100644
index 850f9a6..0000000
--- a/metrics-dropwizardmetrics3/src/main/java/org/apache/calcite/avatica/metrics/dropwizard3/DropwizardTimer.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.calcite.avatica.metrics.dropwizard3;
-
-import com.codahale.metrics.Timer;
-
-import java.util.Objects;
-
-/**
- * Dropwizard Metrics implementation of {@link org.apache.calcite.avatica.metrics.Timer}.
- */
-public class DropwizardTimer implements org.apache.calcite.avatica.metrics.Timer {
-
- private final Timer timer;
-
- public DropwizardTimer(Timer timer) {
- this.timer = Objects.requireNonNull(timer);
- }
-
- @Override public DropwizardContext start() {
- return new DropwizardContext(timer.time());
- }
-
- /**
- * Dropwizard Metrics implementation of {@link org.apache.calcite.avatica.metrics.Timer.Context}
- */
- public class DropwizardContext implements org.apache.calcite.avatica.metrics.Timer.Context {
- private final com.codahale.metrics.Timer.Context context;
-
- public DropwizardContext(com.codahale.metrics.Timer.Context context) {
- this.context = Objects.requireNonNull(context);
- }
-
- @Override public void close() {
- this.context.stop();
- }
- }
-}
-
-// End DropwizardTimer.java
http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/6afbfd52/metrics-dropwizardmetrics3/src/main/java/org/apache/calcite/avatica/metrics/dropwizard3/package-info.java
----------------------------------------------------------------------
diff --git a/metrics-dropwizardmetrics3/src/main/java/org/apache/calcite/avatica/metrics/dropwizard3/package-info.java b/metrics-dropwizardmetrics3/src/main/java/org/apache/calcite/avatica/metrics/dropwizard3/package-info.java
deleted file mode 100644
index f88df93..0000000
--- a/metrics-dropwizardmetrics3/src/main/java/org/apache/calcite/avatica/metrics/dropwizard3/package-info.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * Dropwizard-Metrics (v3) implementation of the Avatica Metrics framework.
- */
-@PackageMarker
-package org.apache.calcite.avatica.metrics.dropwizard3;
-
-import org.apache.calcite.avatica.metrics.PackageMarker;
-
-// End package-info.java
http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/6afbfd52/metrics-dropwizardmetrics3/src/main/resources/META-INF/services/org.apache.calcite.avatica.metrics.MetricsSystemFactory
----------------------------------------------------------------------
diff --git a/metrics-dropwizardmetrics3/src/main/resources/META-INF/services/org.apache.calcite.avatica.metrics.MetricsSystemFactory b/metrics-dropwizardmetrics3/src/main/resources/META-INF/services/org.apache.calcite.avatica.metrics.MetricsSystemFactory
deleted file mode 100644
index 25b64a8..0000000
--- a/metrics-dropwizardmetrics3/src/main/resources/META-INF/services/org.apache.calcite.avatica.metrics.MetricsSystemFactory
+++ /dev/null
@@ -1,2 +0,0 @@
-org.apache.calcite.avatica.metrics.dropwizard3.DropwizardMetricsSystemFactory
-
http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/6afbfd52/metrics-dropwizardmetrics3/src/test/java/org/apache/calcite/avatica/metrics/dropwizard3/DropwizardCounterTest.java
----------------------------------------------------------------------
diff --git a/metrics-dropwizardmetrics3/src/test/java/org/apache/calcite/avatica/metrics/dropwizard3/DropwizardCounterTest.java b/metrics-dropwizardmetrics3/src/test/java/org/apache/calcite/avatica/metrics/dropwizard3/DropwizardCounterTest.java
deleted file mode 100644
index b037196..0000000
--- a/metrics-dropwizardmetrics3/src/test/java/org/apache/calcite/avatica/metrics/dropwizard3/DropwizardCounterTest.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.calcite.avatica.metrics.dropwizard3;
-
-import com.codahale.metrics.Counter;
-
-import org.junit.Before;
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-
-/**
- * Test class for {@link DropwizardCounter}.
- */
-public class DropwizardCounterTest {
-
- private Counter counter;
-
- @Before public void setup() {
- this.counter = new Counter();
- }
-
- @Test public void testCounting() {
- DropwizardCounter dwCounter = new DropwizardCounter(counter);
-
- dwCounter.increment();
- assertEquals(1L, counter.getCount());
- dwCounter.increment();
- assertEquals(2L, counter.getCount());
- dwCounter.increment(2L);
- assertEquals(4L, counter.getCount());
- dwCounter.increment(-1L);
- assertEquals(3L, counter.getCount());
-
- dwCounter.decrement();
- assertEquals(2L, counter.getCount());
- dwCounter.decrement();
- assertEquals(1L, counter.getCount());
- dwCounter.decrement(4L);
- assertEquals(-3L, counter.getCount());
- dwCounter.decrement(-3L);
- assertEquals(0L, counter.getCount());
- }
-
-}
-
-// End DropwizardCounterTest.java
http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/6afbfd52/metrics-dropwizardmetrics3/src/test/java/org/apache/calcite/avatica/metrics/dropwizard3/DropwizardGaugeTest.java
----------------------------------------------------------------------
diff --git a/metrics-dropwizardmetrics3/src/test/java/org/apache/calcite/avatica/metrics/dropwizard3/DropwizardGaugeTest.java b/metrics-dropwizardmetrics3/src/test/java/org/apache/calcite/avatica/metrics/dropwizard3/DropwizardGaugeTest.java
deleted file mode 100644
index ed78a58..0000000
--- a/metrics-dropwizardmetrics3/src/test/java/org/apache/calcite/avatica/metrics/dropwizard3/DropwizardGaugeTest.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.calcite.avatica.metrics.dropwizard3;
-
-import org.apache.calcite.avatica.metrics.Gauge;
-
-import org.junit.Test;
-
-import java.util.concurrent.atomic.AtomicLong;
-
-import static org.junit.Assert.assertEquals;
-
-/**
- * Test class for {@link DropwizardGauge}.
- */
-public class DropwizardGaugeTest {
-
- @Test public void test() {
- SimpleGauge gauge = new SimpleGauge();
- DropwizardGauge<Long> dwGauge = new DropwizardGauge<>(gauge);
-
- assertEquals(gauge.getValue(), dwGauge.getValue());
-
- gauge.setValue(1000L);
-
- assertEquals(gauge.getValue(), dwGauge.getValue());
- }
-
- /**
- * Gauge implementation with a setter.
- */
- private static class SimpleGauge implements Gauge<Long> {
-
- private final AtomicLong value = new AtomicLong(0L);
-
- @Override public Long getValue() {
- return this.value.get();
- }
-
- public void setValue(long value) {
- this.value.set(value);
- }
- }
-}
-
-// End DropwizardGaugeTest.java
http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/6afbfd52/metrics-dropwizardmetrics3/src/test/java/org/apache/calcite/avatica/metrics/dropwizard3/DropwizardHistogramTest.java
----------------------------------------------------------------------
diff --git a/metrics-dropwizardmetrics3/src/test/java/org/apache/calcite/avatica/metrics/dropwizard3/DropwizardHistogramTest.java b/metrics-dropwizardmetrics3/src/test/java/org/apache/calcite/avatica/metrics/dropwizard3/DropwizardHistogramTest.java
deleted file mode 100644
index 25ec5c0..0000000
--- a/metrics-dropwizardmetrics3/src/test/java/org/apache/calcite/avatica/metrics/dropwizard3/DropwizardHistogramTest.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.calcite.avatica.metrics.dropwizard3;
-
-import com.codahale.metrics.Histogram;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.Mockito;
-
-/**
- * Test class for {@link DropwizardHistogram}.
- */
-public class DropwizardHistogramTest {
-
- private Histogram histogram;
-
- @Before public void setup() {
- this.histogram = Mockito.mock(Histogram.class);
- }
-
- @Test public void test() {
- DropwizardHistogram dwHistogram = new DropwizardHistogram(histogram);
-
- dwHistogram.update(10);
-
- dwHistogram.update(100L);
-
- Mockito.verify(histogram).update(10);
- Mockito.verify(histogram).update(100L);
- }
-
-}
-
-// End DropwizardHistogramTest.java
http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/6afbfd52/metrics-dropwizardmetrics3/src/test/java/org/apache/calcite/avatica/metrics/dropwizard3/DropwizardMeterTest.java
----------------------------------------------------------------------
diff --git a/metrics-dropwizardmetrics3/src/test/java/org/apache/calcite/avatica/metrics/dropwizard3/DropwizardMeterTest.java b/metrics-dropwizardmetrics3/src/test/java/org/apache/calcite/avatica/metrics/dropwizard3/DropwizardMeterTest.java
deleted file mode 100644
index c76c7e0..0000000
--- a/metrics-dropwizardmetrics3/src/test/java/org/apache/calcite/avatica/metrics/dropwizard3/DropwizardMeterTest.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.calcite.avatica.metrics.dropwizard3;
-
-import com.codahale.metrics.Meter;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.Mockito;
-
-/**
- * Test class for {@link DropwizardMeter}.
- */
-public class DropwizardMeterTest {
-
- private Meter meter;
-
- @Before public void setup() {
- this.meter = Mockito.mock(Meter.class);
- }
-
- @Test public void test() {
- DropwizardMeter dwMeter = new DropwizardMeter(this.meter);
-
- dwMeter.mark();
- dwMeter.mark(10L);
- dwMeter.mark();
- dwMeter.mark();
-
- Mockito.verify(meter, Mockito.times(3)).mark();
- Mockito.verify(meter).mark(10L);
- }
-
-}
-
-// End DropwizardMeterTest.java
http://git-wip-us.apache.org/repos/asf/calcite-avatica/blob/6afbfd52/metrics-dropwizardmetrics3/src/test/java/org/apache/calcite/avatica/metrics/dropwizard3/DropwizardMetricsSystemFactoryTest.java
----------------------------------------------------------------------
diff --git a/metrics-dropwizardmetrics3/src/test/java/org/apache/calcite/avatica/metrics/dropwizard3/DropwizardMetricsSystemFactoryTest.java b/metrics-dropwizardmetrics3/src/test/java/org/apache/calcite/avatica/metrics/dropwizard3/DropwizardMetricsSystemFactoryTest.java
deleted file mode 100644
index 332c6e0..0000000
--- a/metrics-dropwizardmetrics3/src/test/java/org/apache/calcite/avatica/metrics/dropwizard3/DropwizardMetricsSystemFactoryTest.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.calcite.avatica.metrics.dropwizard3;
-
-import org.apache.calcite.avatica.metrics.noop.NoopMetricsSystemConfiguration;
-
-import com.codahale.metrics.MetricRegistry;
-
-import org.junit.Before;
-import org.junit.Test;
-
-import static org.junit.Assert.assertNotNull;
-
-/**
- * Test class for {@link DropwizardMetricsSystemFactory}.
- */
-public class DropwizardMetricsSystemFactoryTest {
-
- private DropwizardMetricsSystemFactory factory;
-
- @Before public void setup() {
- factory = new DropwizardMetricsSystemFactory();
- }
-
- @Test(expected = IllegalStateException.class) public void testNullConfigurationFails() {
- factory.create(null);
- }
-
- @Test(expected = IllegalStateException.class) public void testUnhandledConfigurationType() {
- factory.create(NoopMetricsSystemConfiguration.getInstance());
- }
-
- @Test public void testHandledConfigurationType() {
- DropwizardMetricsSystem metrics =
- factory.create(new DropwizardMetricsSystemConfiguration(new MetricRegistry()));
- assertNotNull("Expected DropwizardMetricsSystem to be non-null", metrics);
- }
-}
-
-// End DropwizardMetricsSystemFactoryTest.java