flink-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ches...@apache.org
Subject [2/2] flink git commit: [FLINK-8007][metrics] Move TestMeter into test scope
Date Tue, 05 Dec 2017 13:31:56 GMT
[FLINK-8007][metrics] Move TestMeter into test scope


Project: http://git-wip-us.apache.org/repos/asf/flink/repo
Commit: http://git-wip-us.apache.org/repos/asf/flink/commit/94a0eccb
Tree: http://git-wip-us.apache.org/repos/asf/flink/tree/94a0eccb
Diff: http://git-wip-us.apache.org/repos/asf/flink/diff/94a0eccb

Branch: refs/heads/master
Commit: 94a0eccbec51aa2273b7d19fa0de3e940c2561e7
Parents: 2d4762c
Author: zentol <chesnay@apache.org>
Authored: Tue Nov 28 22:07:36 2017 +0100
Committer: zentol <chesnay@apache.org>
Committed: Tue Dec 5 14:31:44 2017 +0100

----------------------------------------------------------------------
 flink-metrics/flink-metrics-core/pom.xml        | 13 ++++
 .../apache/flink/metrics/util/TestMeter.java    | 45 ------------
 .../flink/metrics/util/TestHistogram.java       | 77 ++++++++++++++++++++
 .../apache/flink/metrics/util/TestMeter.java    | 45 ++++++++++++
 flink-metrics/flink-metrics-dropwizard/pom.xml  |  8 ++
 flink-metrics/flink-metrics-jmx/pom.xml         |  8 ++
 .../flink/metrics/jmx/JMXReporterTest.java      |  6 +-
 flink-metrics/flink-metrics-prometheus/pom.xml  |  2 +-
 .../PrometheusReporterTaskScopeTest.java        |  4 +-
 .../prometheus/PrometheusReporterTest.java      |  4 +-
 flink-metrics/flink-metrics-slf4j/pom.xml       |  4 +-
 .../flink/metrics/slf4j/Slf4jReporterTest.java  |  4 +-
 flink-metrics/flink-metrics-statsd/pom.xml      |  8 ++
 flink-runtime/pom.xml                           |  8 ++
 .../metrics/dump/MetricDumpSerializerTest.java  |  4 +-
 .../metrics/dump/MetricQueryServiceTest.java    |  4 +-
 .../runtime/metrics/util/TestingHistogram.java  | 77 --------------------
 .../legacy/metrics/MetricFetcherTest.java       |  4 +-
 18 files changed, 185 insertions(+), 140 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flink/blob/94a0eccb/flink-metrics/flink-metrics-core/pom.xml
----------------------------------------------------------------------
diff --git a/flink-metrics/flink-metrics-core/pom.xml b/flink-metrics/flink-metrics-core/pom.xml
index ea3b4c8..cad9c36 100644
--- a/flink-metrics/flink-metrics-core/pom.xml
+++ b/flink-metrics/flink-metrics-core/pom.xml
@@ -32,6 +32,8 @@ under the License.
 	<artifactId>flink-metrics-core</artifactId>
 	<name>flink-metrics-core</name>
 
+	<packaging>jar</packaging>
+
 	<build>
 		<plugins>
 			<!-- activate API compatibility checks -->
@@ -39,6 +41,17 @@ under the License.
 				<groupId>com.github.siom79.japicmp</groupId>
 				<artifactId>japicmp-maven-plugin</artifactId>
 			</plugin>
+			<plugin>
+				<groupId>org.apache.maven.plugins</groupId>
+				<artifactId>maven-jar-plugin</artifactId>
+				<executions>
+					<execution>
+						<goals>
+							<goal>test-jar</goal>
+						</goals>
+					</execution>
+				</executions>
+			</plugin>
 		</plugins>
 	</build>
 

http://git-wip-us.apache.org/repos/asf/flink/blob/94a0eccb/flink-metrics/flink-metrics-core/src/main/java/org/apache/flink/metrics/util/TestMeter.java
----------------------------------------------------------------------
diff --git a/flink-metrics/flink-metrics-core/src/main/java/org/apache/flink/metrics/util/TestMeter.java
b/flink-metrics/flink-metrics-core/src/main/java/org/apache/flink/metrics/util/TestMeter.java
deleted file mode 100644
index b1ec3a3..0000000
--- a/flink-metrics/flink-metrics-core/src/main/java/org/apache/flink/metrics/util/TestMeter.java
+++ /dev/null
@@ -1,45 +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.flink.metrics.util;
-
-import org.apache.flink.metrics.Meter;
-
-/**
- * A dummy {@link Meter} implementation.
- */
-public class TestMeter implements Meter {
-
-	@Override
-	public void markEvent() {
-	}
-
-	@Override
-	public void markEvent(long n) {
-	}
-
-	@Override
-	public double getRate() {
-		return 5;
-	}
-
-	@Override
-	public long getCount() {
-		return 100L;
-	}
-}

http://git-wip-us.apache.org/repos/asf/flink/blob/94a0eccb/flink-metrics/flink-metrics-core/src/test/java/org/apache/flink/metrics/util/TestHistogram.java
----------------------------------------------------------------------
diff --git a/flink-metrics/flink-metrics-core/src/test/java/org/apache/flink/metrics/util/TestHistogram.java
b/flink-metrics/flink-metrics-core/src/test/java/org/apache/flink/metrics/util/TestHistogram.java
new file mode 100644
index 0000000..6df2e92
--- /dev/null
+++ b/flink-metrics/flink-metrics-core/src/test/java/org/apache/flink/metrics/util/TestHistogram.java
@@ -0,0 +1,77 @@
+/*
+ * 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.flink.metrics.util;
+
+import org.apache.flink.metrics.Histogram;
+import org.apache.flink.metrics.HistogramStatistics;
+
+/**
+ * Stateless test histogram for which all methods return a static value.
+ */
+public class TestHistogram implements Histogram {
+
+	@Override
+	public void update(long value) {
+	}
+
+	@Override
+	public long getCount() {
+		return 1;
+	}
+
+	@Override
+	public HistogramStatistics getStatistics() {
+		return new HistogramStatistics() {
+			@Override
+			public double getQuantile(double quantile) {
+				return quantile;
+			}
+
+			@Override
+			public long[] getValues() {
+				return new long[0];
+			}
+
+			@Override
+			public int size() {
+				return 3;
+			}
+
+			@Override
+			public double getMean() {
+				return 4;
+			}
+
+			@Override
+			public double getStdDev() {
+				return 5;
+			}
+
+			@Override
+			public long getMax() {
+				return 6;
+			}
+
+			@Override
+			public long getMin() {
+				return 7;
+			}
+		};
+	}
+}

http://git-wip-us.apache.org/repos/asf/flink/blob/94a0eccb/flink-metrics/flink-metrics-core/src/test/java/org/apache/flink/metrics/util/TestMeter.java
----------------------------------------------------------------------
diff --git a/flink-metrics/flink-metrics-core/src/test/java/org/apache/flink/metrics/util/TestMeter.java
b/flink-metrics/flink-metrics-core/src/test/java/org/apache/flink/metrics/util/TestMeter.java
new file mode 100644
index 0000000..b1ec3a3
--- /dev/null
+++ b/flink-metrics/flink-metrics-core/src/test/java/org/apache/flink/metrics/util/TestMeter.java
@@ -0,0 +1,45 @@
+/*
+ * 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.flink.metrics.util;
+
+import org.apache.flink.metrics.Meter;
+
+/**
+ * A dummy {@link Meter} implementation.
+ */
+public class TestMeter implements Meter {
+
+	@Override
+	public void markEvent() {
+	}
+
+	@Override
+	public void markEvent(long n) {
+	}
+
+	@Override
+	public double getRate() {
+		return 5;
+	}
+
+	@Override
+	public long getCount() {
+		return 100L;
+	}
+}

http://git-wip-us.apache.org/repos/asf/flink/blob/94a0eccb/flink-metrics/flink-metrics-dropwizard/pom.xml
----------------------------------------------------------------------
diff --git a/flink-metrics/flink-metrics-dropwizard/pom.xml b/flink-metrics/flink-metrics-dropwizard/pom.xml
index 65802d4..9cc0072 100644
--- a/flink-metrics/flink-metrics-dropwizard/pom.xml
+++ b/flink-metrics/flink-metrics-dropwizard/pom.xml
@@ -58,6 +58,14 @@ under the License.
 
 		<dependency>
 			<groupId>org.apache.flink</groupId>
+			<artifactId>flink-metrics-core</artifactId>
+			<version>${project.version}</version>
+			<scope>test</scope>
+			<type>test-jar</type>
+		</dependency>
+
+		<dependency>
+			<groupId>org.apache.flink</groupId>
 			<artifactId>flink-runtime_${scala.binary.version}</artifactId>
 			<version>${project.version}</version>
 			<scope>test</scope>

http://git-wip-us.apache.org/repos/asf/flink/blob/94a0eccb/flink-metrics/flink-metrics-jmx/pom.xml
----------------------------------------------------------------------
diff --git a/flink-metrics/flink-metrics-jmx/pom.xml b/flink-metrics/flink-metrics-jmx/pom.xml
index d8cfd3c..66de1b3 100644
--- a/flink-metrics/flink-metrics-jmx/pom.xml
+++ b/flink-metrics/flink-metrics-jmx/pom.xml
@@ -65,6 +65,14 @@ under the License.
 
 		<dependency>
 			<groupId>org.apache.flink</groupId>
+			<artifactId>flink-metrics-core</artifactId>
+			<version>${project.version}</version>
+			<scope>test</scope>
+			<type>test-jar</type>
+		</dependency>
+
+		<dependency>
+			<groupId>org.apache.flink</groupId>
 			<artifactId>flink-runtime_${scala.binary.version}</artifactId>
 			<version>${project.version}</version>
 			<scope>test</scope>

http://git-wip-us.apache.org/repos/asf/flink/blob/94a0eccb/flink-metrics/flink-metrics-jmx/src/test/java/org/apache/flink/metrics/jmx/JMXReporterTest.java
----------------------------------------------------------------------
diff --git a/flink-metrics/flink-metrics-jmx/src/test/java/org/apache/flink/metrics/jmx/JMXReporterTest.java
b/flink-metrics/flink-metrics-jmx/src/test/java/org/apache/flink/metrics/jmx/JMXReporterTest.java
index 98c2d1b..067b08f 100644
--- a/flink-metrics/flink-metrics-jmx/src/test/java/org/apache/flink/metrics/jmx/JMXReporterTest.java
+++ b/flink-metrics/flink-metrics-jmx/src/test/java/org/apache/flink/metrics/jmx/JMXReporterTest.java
@@ -23,13 +23,13 @@ import org.apache.flink.configuration.Configuration;
 import org.apache.flink.configuration.MetricOptions;
 import org.apache.flink.metrics.Gauge;
 import org.apache.flink.metrics.reporter.MetricReporter;
+import org.apache.flink.metrics.util.TestHistogram;
 import org.apache.flink.metrics.util.TestMeter;
 import org.apache.flink.runtime.metrics.MetricRegistryConfiguration;
 import org.apache.flink.runtime.metrics.MetricRegistryImpl;
 import org.apache.flink.runtime.metrics.groups.FrontMetricGroup;
 import org.apache.flink.runtime.metrics.groups.TaskManagerMetricGroup;
 import org.apache.flink.runtime.metrics.util.TestReporter;
-import org.apache.flink.runtime.metrics.util.TestingHistogram;
 import org.apache.flink.util.TestLogger;
 
 import org.junit.Test;
@@ -243,7 +243,7 @@ public class JMXReporterTest extends TestLogger {
 
 			TaskManagerMetricGroup metricGroup = new TaskManagerMetricGroup(registry, "localhost",
"tmId");
 
-			TestingHistogram histogram = new TestingHistogram();
+			TestHistogram histogram = new TestHistogram();
 
 			metricGroup.histogram(histogramName, histogram);
 
@@ -307,7 +307,7 @@ public class JMXReporterTest extends TestLogger {
 
 			assertEquals(2, attributeInfos.length);
 
-			assertEquals(meter.getRate(),  mBeanServer.getAttribute(objectName, "Rate"));
+			assertEquals(meter.getRate(), mBeanServer.getAttribute(objectName, "Rate"));
 			assertEquals(meter.getCount(), mBeanServer.getAttribute(objectName, "Count"));
 
 		} finally {

http://git-wip-us.apache.org/repos/asf/flink/blob/94a0eccb/flink-metrics/flink-metrics-prometheus/pom.xml
----------------------------------------------------------------------
diff --git a/flink-metrics/flink-metrics-prometheus/pom.xml b/flink-metrics/flink-metrics-prometheus/pom.xml
index 46df495..544843c 100644
--- a/flink-metrics/flink-metrics-prometheus/pom.xml
+++ b/flink-metrics/flink-metrics-prometheus/pom.xml
@@ -77,7 +77,7 @@ under the License.
 
 		<dependency>
 			<groupId>org.apache.flink</groupId>
-			<artifactId>flink-runtime_${scala.binary.version}</artifactId>
+			<artifactId>flink-metrics-core</artifactId>
 			<version>${project.version}</version>
 			<scope>test</scope>
 			<type>test-jar</type>

http://git-wip-us.apache.org/repos/asf/flink/blob/94a0eccb/flink-metrics/flink-metrics-prometheus/src/test/java/org/apache/flink/metrics/prometheus/PrometheusReporterTaskScopeTest.java
----------------------------------------------------------------------
diff --git a/flink-metrics/flink-metrics-prometheus/src/test/java/org/apache/flink/metrics/prometheus/PrometheusReporterTaskScopeTest.java
b/flink-metrics/flink-metrics-prometheus/src/test/java/org/apache/flink/metrics/prometheus/PrometheusReporterTaskScopeTest.java
index 55ddc00..d4ad1f9 100644
--- a/flink-metrics/flink-metrics-prometheus/src/test/java/org/apache/flink/metrics/prometheus/PrometheusReporterTaskScopeTest.java
+++ b/flink-metrics/flink-metrics-prometheus/src/test/java/org/apache/flink/metrics/prometheus/PrometheusReporterTaskScopeTest.java
@@ -24,6 +24,7 @@ import org.apache.flink.metrics.Gauge;
 import org.apache.flink.metrics.Histogram;
 import org.apache.flink.metrics.Meter;
 import org.apache.flink.metrics.SimpleCounter;
+import org.apache.flink.metrics.util.TestHistogram;
 import org.apache.flink.metrics.util.TestMeter;
 import org.apache.flink.runtime.jobgraph.JobVertexID;
 import org.apache.flink.runtime.metrics.MetricRegistryConfiguration;
@@ -31,7 +32,6 @@ import org.apache.flink.runtime.metrics.MetricRegistryImpl;
 import org.apache.flink.runtime.metrics.groups.TaskManagerJobMetricGroup;
 import org.apache.flink.runtime.metrics.groups.TaskManagerMetricGroup;
 import org.apache.flink.runtime.metrics.groups.TaskMetricGroup;
-import org.apache.flink.runtime.metrics.util.TestingHistogram;
 import org.apache.flink.util.AbstractID;
 
 import com.mashape.unirest.http.exceptions.UnirestException;
@@ -151,7 +151,7 @@ public class PrometheusReporterTaskScopeTest {
 
 	@Test
 	public void histogramsCanBeAddedSeveralTimesIfTheyDifferInLabels() throws UnirestException
{
-		Histogram histogram = new TestingHistogram();
+		Histogram histogram = new TestHistogram();
 
 		taskMetricGroup1.histogram("my_histogram", histogram);
 		taskMetricGroup2.histogram("my_histogram", histogram);

http://git-wip-us.apache.org/repos/asf/flink/blob/94a0eccb/flink-metrics/flink-metrics-prometheus/src/test/java/org/apache/flink/metrics/prometheus/PrometheusReporterTest.java
----------------------------------------------------------------------
diff --git a/flink-metrics/flink-metrics-prometheus/src/test/java/org/apache/flink/metrics/prometheus/PrometheusReporterTest.java
b/flink-metrics/flink-metrics-prometheus/src/test/java/org/apache/flink/metrics/prometheus/PrometheusReporterTest.java
index 6704189..d905c25 100644
--- a/flink-metrics/flink-metrics-prometheus/src/test/java/org/apache/flink/metrics/prometheus/PrometheusReporterTest.java
+++ b/flink-metrics/flink-metrics-prometheus/src/test/java/org/apache/flink/metrics/prometheus/PrometheusReporterTest.java
@@ -27,12 +27,12 @@ import org.apache.flink.metrics.Histogram;
 import org.apache.flink.metrics.Meter;
 import org.apache.flink.metrics.Metric;
 import org.apache.flink.metrics.SimpleCounter;
+import org.apache.flink.metrics.util.TestHistogram;
 import org.apache.flink.metrics.util.TestMeter;
 import org.apache.flink.runtime.metrics.MetricRegistryConfiguration;
 import org.apache.flink.runtime.metrics.MetricRegistryImpl;
 import org.apache.flink.runtime.metrics.groups.FrontMetricGroup;
 import org.apache.flink.runtime.metrics.groups.TaskManagerMetricGroup;
-import org.apache.flink.runtime.metrics.util.TestingHistogram;
 import org.apache.flink.util.TestLogger;
 
 import com.mashape.unirest.http.HttpResponse;
@@ -141,7 +141,7 @@ public class PrometheusReporterTest extends TestLogger {
 
 	@Test
 	public void histogramIsReportedAsPrometheusSummary() throws UnirestException {
-		Histogram testHistogram = new TestingHistogram();
+		Histogram testHistogram = new TestHistogram();
 
 		String histogramName = "testHistogram";
 		String summaryName = SCOPE_PREFIX + histogramName;

http://git-wip-us.apache.org/repos/asf/flink/blob/94a0eccb/flink-metrics/flink-metrics-slf4j/pom.xml
----------------------------------------------------------------------
diff --git a/flink-metrics/flink-metrics-slf4j/pom.xml b/flink-metrics/flink-metrics-slf4j/pom.xml
index 677be02..d610af2 100644
--- a/flink-metrics/flink-metrics-slf4j/pom.xml
+++ b/flink-metrics/flink-metrics-slf4j/pom.xml
@@ -58,16 +58,16 @@ under the License.
 
 		<dependency>
 			<groupId>org.apache.flink</groupId>
-			<artifactId>flink-runtime_${scala.binary.version}</artifactId>
+			<artifactId>flink-metrics-core</artifactId>
 			<version>${project.version}</version>
 			<scope>test</scope>
+			<type>test-jar</type>
 		</dependency>
 
 		<dependency>
 			<groupId>org.apache.flink</groupId>
 			<artifactId>flink-runtime_${scala.binary.version}</artifactId>
 			<version>${project.version}</version>
-			<type>test-jar</type>
 			<scope>test</scope>
 		</dependency>
 

http://git-wip-us.apache.org/repos/asf/flink/blob/94a0eccb/flink-metrics/flink-metrics-slf4j/src/test/java/org/apache/flink/metrics/slf4j/Slf4jReporterTest.java
----------------------------------------------------------------------
diff --git a/flink-metrics/flink-metrics-slf4j/src/test/java/org/apache/flink/metrics/slf4j/Slf4jReporterTest.java
b/flink-metrics/flink-metrics-slf4j/src/test/java/org/apache/flink/metrics/slf4j/Slf4jReporterTest.java
index ba7c5a1..f538bc7 100644
--- a/flink-metrics/flink-metrics-slf4j/src/test/java/org/apache/flink/metrics/slf4j/Slf4jReporterTest.java
+++ b/flink-metrics/flink-metrics-slf4j/src/test/java/org/apache/flink/metrics/slf4j/Slf4jReporterTest.java
@@ -27,13 +27,13 @@ import org.apache.flink.metrics.Histogram;
 import org.apache.flink.metrics.Meter;
 import org.apache.flink.metrics.MeterView;
 import org.apache.flink.metrics.SimpleCounter;
+import org.apache.flink.metrics.util.TestHistogram;
 import org.apache.flink.runtime.executiongraph.ExecutionAttemptID;
 import org.apache.flink.runtime.jobgraph.JobVertexID;
 import org.apache.flink.runtime.metrics.MetricRegistryConfiguration;
 import org.apache.flink.runtime.metrics.MetricRegistryImpl;
 import org.apache.flink.runtime.metrics.groups.TaskManagerMetricGroup;
 import org.apache.flink.runtime.metrics.groups.TaskMetricGroup;
-import org.apache.flink.runtime.metrics.util.TestingHistogram;
 import org.apache.flink.util.TestLogger;
 
 import org.junit.AfterClass;
@@ -136,7 +136,7 @@ public class Slf4jReporterTest extends TestLogger {
 	public void testAddHistogram() throws Exception {
 		String histogramName = "histogram";
 
-		Histogram histogram = taskMetricGroup.histogram(histogramName, new TestingHistogram());
+		Histogram histogram = taskMetricGroup.histogram(histogramName, new TestHistogram());
 		assertTrue(reporter.getHistograms().containsKey(histogram));
 
 		String expectedHistogramName = reporter.filterCharacters(HOST_NAME) + delimiter

http://git-wip-us.apache.org/repos/asf/flink/blob/94a0eccb/flink-metrics/flink-metrics-statsd/pom.xml
----------------------------------------------------------------------
diff --git a/flink-metrics/flink-metrics-statsd/pom.xml b/flink-metrics/flink-metrics-statsd/pom.xml
index 48ccbdc..b8e4d88 100644
--- a/flink-metrics/flink-metrics-statsd/pom.xml
+++ b/flink-metrics/flink-metrics-statsd/pom.xml
@@ -51,6 +51,14 @@ under the License.
 
 		<dependency>
 			<groupId>org.apache.flink</groupId>
+			<artifactId>flink-metrics-core</artifactId>
+			<version>${project.version}</version>
+			<scope>test</scope>
+			<type>test-jar</type>
+		</dependency>
+
+		<dependency>
+			<groupId>org.apache.flink</groupId>
 			<artifactId>flink-runtime_${scala.binary.version}</artifactId>
 			<version>${project.version}</version>
 			<scope>test</scope>

http://git-wip-us.apache.org/repos/asf/flink/blob/94a0eccb/flink-runtime/pom.xml
----------------------------------------------------------------------
diff --git a/flink-runtime/pom.xml b/flink-runtime/pom.xml
index 4abf658..2dc198f 100644
--- a/flink-runtime/pom.xml
+++ b/flink-runtime/pom.xml
@@ -208,6 +208,14 @@ under the License.
 
 		<dependency>
 			<groupId>org.apache.flink</groupId>
+			<artifactId>flink-metrics-core</artifactId>
+			<version>${project.version}</version>
+			<scope>test</scope>
+			<type>test-jar</type>
+		</dependency>
+
+		<dependency>
+			<groupId>org.apache.flink</groupId>
 			<artifactId>flink-core</artifactId>
 			<version>${project.version}</version>
 			<scope>test</scope>

http://git-wip-us.apache.org/repos/asf/flink/blob/94a0eccb/flink-runtime/src/test/java/org/apache/flink/runtime/metrics/dump/MetricDumpSerializerTest.java
----------------------------------------------------------------------
diff --git a/flink-runtime/src/test/java/org/apache/flink/runtime/metrics/dump/MetricDumpSerializerTest.java
b/flink-runtime/src/test/java/org/apache/flink/runtime/metrics/dump/MetricDumpSerializerTest.java
index d36c469..5f83e79 100644
--- a/flink-runtime/src/test/java/org/apache/flink/runtime/metrics/dump/MetricDumpSerializerTest.java
+++ b/flink-runtime/src/test/java/org/apache/flink/runtime/metrics/dump/MetricDumpSerializerTest.java
@@ -24,7 +24,7 @@ import org.apache.flink.metrics.Gauge;
 import org.apache.flink.metrics.Histogram;
 import org.apache.flink.metrics.Meter;
 import org.apache.flink.metrics.SimpleCounter;
-import org.apache.flink.runtime.metrics.util.TestingHistogram;
+import org.apache.flink.metrics.util.TestHistogram;
 
 import org.junit.Assert;
 import org.junit.Test;
@@ -113,7 +113,7 @@ public class MetricDumpSerializerTest {
 			}
 		};
 
-		Histogram h1 = new TestingHistogram();
+		Histogram h1 = new TestHistogram();
 
 		Meter m1 = new Meter() {
 			@Override

http://git-wip-us.apache.org/repos/asf/flink/blob/94a0eccb/flink-runtime/src/test/java/org/apache/flink/runtime/metrics/dump/MetricQueryServiceTest.java
----------------------------------------------------------------------
diff --git a/flink-runtime/src/test/java/org/apache/flink/runtime/metrics/dump/MetricQueryServiceTest.java
b/flink-runtime/src/test/java/org/apache/flink/runtime/metrics/dump/MetricQueryServiceTest.java
index 55ba3a9..1acaf61 100644
--- a/flink-runtime/src/test/java/org/apache/flink/runtime/metrics/dump/MetricQueryServiceTest.java
+++ b/flink-runtime/src/test/java/org/apache/flink/runtime/metrics/dump/MetricQueryServiceTest.java
@@ -24,11 +24,11 @@ import org.apache.flink.metrics.Gauge;
 import org.apache.flink.metrics.Histogram;
 import org.apache.flink.metrics.Meter;
 import org.apache.flink.metrics.SimpleCounter;
+import org.apache.flink.metrics.util.TestHistogram;
 import org.apache.flink.runtime.akka.AkkaUtils;
 import org.apache.flink.runtime.metrics.MetricRegistryConfiguration;
 import org.apache.flink.runtime.metrics.MetricRegistryImpl;
 import org.apache.flink.runtime.metrics.groups.TaskManagerMetricGroup;
-import org.apache.flink.runtime.metrics.util.TestingHistogram;
 import org.apache.flink.util.TestLogger;
 
 import akka.actor.ActorRef;
@@ -60,7 +60,7 @@ public class MetricQueryServiceTest extends TestLogger {
 				return "Hello";
 			}
 		};
-		final Histogram h = new TestingHistogram();
+		final Histogram h = new TestHistogram();
 		final Meter m = new Meter() {
 
 			@Override

http://git-wip-us.apache.org/repos/asf/flink/blob/94a0eccb/flink-runtime/src/test/java/org/apache/flink/runtime/metrics/util/TestingHistogram.java
----------------------------------------------------------------------
diff --git a/flink-runtime/src/test/java/org/apache/flink/runtime/metrics/util/TestingHistogram.java
b/flink-runtime/src/test/java/org/apache/flink/runtime/metrics/util/TestingHistogram.java
deleted file mode 100644
index 8565ed3..0000000
--- a/flink-runtime/src/test/java/org/apache/flink/runtime/metrics/util/TestingHistogram.java
+++ /dev/null
@@ -1,77 +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.flink.runtime.metrics.util;
-
-import org.apache.flink.metrics.Histogram;
-import org.apache.flink.metrics.HistogramStatistics;
-
-/**
- * Stateless test histogram for which all methods return a static value.
- */
-public class TestingHistogram implements Histogram {
-
-	@Override
-	public void update(long value) {
-	}
-
-	@Override
-	public long getCount() {
-		return 1;
-	}
-
-	@Override
-	public HistogramStatistics getStatistics() {
-		return new HistogramStatistics() {
-			@Override
-			public double getQuantile(double quantile) {
-				return quantile;
-			}
-
-			@Override
-			public long[] getValues() {
-				return new long[0];
-			}
-
-			@Override
-			public int size() {
-				return 3;
-			}
-
-			@Override
-			public double getMean() {
-				return 4;
-			}
-
-			@Override
-			public double getStdDev() {
-				return 5;
-			}
-
-			@Override
-			public long getMax() {
-				return 6;
-			}
-
-			@Override
-			public long getMin() {
-				return 7;
-			}
-		};
-	}
-}

http://git-wip-us.apache.org/repos/asf/flink/blob/94a0eccb/flink-runtime/src/test/java/org/apache/flink/runtime/rest/handler/legacy/metrics/MetricFetcherTest.java
----------------------------------------------------------------------
diff --git a/flink-runtime/src/test/java/org/apache/flink/runtime/rest/handler/legacy/metrics/MetricFetcherTest.java
b/flink-runtime/src/test/java/org/apache/flink/runtime/rest/handler/legacy/metrics/MetricFetcherTest.java
index 9562b58..e5f1bd0 100644
--- a/flink-runtime/src/test/java/org/apache/flink/runtime/rest/handler/legacy/metrics/MetricFetcherTest.java
+++ b/flink-runtime/src/test/java/org/apache/flink/runtime/rest/handler/legacy/metrics/MetricFetcherTest.java
@@ -26,6 +26,7 @@ import org.apache.flink.metrics.Gauge;
 import org.apache.flink.metrics.Histogram;
 import org.apache.flink.metrics.Meter;
 import org.apache.flink.metrics.SimpleCounter;
+import org.apache.flink.metrics.util.TestHistogram;
 import org.apache.flink.runtime.clusterframework.types.ResourceID;
 import org.apache.flink.runtime.concurrent.Executors;
 import org.apache.flink.runtime.jobmaster.JobManagerGateway;
@@ -34,7 +35,6 @@ import org.apache.flink.runtime.messages.webmonitor.MultipleJobsDetails;
 import org.apache.flink.runtime.metrics.dump.MetricDumpSerialization;
 import org.apache.flink.runtime.metrics.dump.MetricQueryService;
 import org.apache.flink.runtime.metrics.dump.QueryScopeInfo;
-import org.apache.flink.runtime.metrics.util.TestingHistogram;
 import org.apache.flink.runtime.webmonitor.retriever.GatewayRetriever;
 import org.apache.flink.runtime.webmonitor.retriever.MetricQueryServiceGateway;
 import org.apache.flink.runtime.webmonitor.retriever.MetricQueryServiceRetriever;
@@ -176,7 +176,7 @@ public class MetricFetcherTest extends TestLogger {
 				return "x";
 			}
 		}, new Tuple2<>(new QueryScopeInfo.TaskManagerQueryScopeInfo(tmRID.toString(), "abc"),
"gauge"));
-		histograms.put(new TestingHistogram(), new Tuple2<>(new QueryScopeInfo.JobManagerQueryScopeInfo("abc"),
"hist"));
+		histograms.put(new TestHistogram(), new Tuple2<>(new QueryScopeInfo.JobManagerQueryScopeInfo("abc"),
"hist"));
 
 		MetricDumpSerialization.MetricDumpSerializer serializer = new MetricDumpSerialization.MetricDumpSerializer();
 		MetricDumpSerialization.MetricSerializationResult dump = serializer.serialize(counters,
gauges, histograms, meters);


Mime
View raw message