flink-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ches...@apache.org
Subject [19/21] flink git commit: [FLINK-6786] [metrics] Deduplicate QueryScopeIntoTest
Date Sun, 25 Jun 2017 06:45:02 GMT
[FLINK-6786] [metrics] Deduplicate QueryScopeIntoTest

This closes #4034.


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

Branch: refs/heads/master
Commit: b863b90c80a63e950106b4460bb81f733819dbc2
Parents: 1f6be83
Author: zentol <chesnay@apache.org>
Authored: Wed May 31 16:42:26 2017 +0200
Committer: zentol <chesnay@apache.org>
Committed: Sat Jun 24 22:09:06 2017 +0200

----------------------------------------------------------------------
 .../metrics/dump/QueryScopeInfoTest.java        | 140 ++++++++++++----
 .../metrics/groups/QueryScopeInfoTest.java      | 161 -------------------
 2 files changed, 111 insertions(+), 190 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flink/blob/b863b90c/flink-runtime/src/test/java/org/apache/flink/runtime/metrics/dump/QueryScopeInfoTest.java
----------------------------------------------------------------------
diff --git a/flink-runtime/src/test/java/org/apache/flink/runtime/metrics/dump/QueryScopeInfoTest.java
b/flink-runtime/src/test/java/org/apache/flink/runtime/metrics/dump/QueryScopeInfoTest.java
index f4f9515..d09063a 100644
--- a/flink-runtime/src/test/java/org/apache/flink/runtime/metrics/dump/QueryScopeInfoTest.java
+++ b/flink-runtime/src/test/java/org/apache/flink/runtime/metrics/dump/QueryScopeInfoTest.java
@@ -20,11 +20,6 @@ package org.apache.flink.runtime.metrics.dump;
 
 import org.junit.Test;
 
-import static org.apache.flink.runtime.metrics.dump.QueryScopeInfo.INFO_CATEGORY_JM;
-import static org.apache.flink.runtime.metrics.dump.QueryScopeInfo.INFO_CATEGORY_JOB;
-import static org.apache.flink.runtime.metrics.dump.QueryScopeInfo.INFO_CATEGORY_OPERATOR;
-import static org.apache.flink.runtime.metrics.dump.QueryScopeInfo.INFO_CATEGORY_TASK;
-import static org.apache.flink.runtime.metrics.dump.QueryScopeInfo.INFO_CATEGORY_TM;
 import static org.junit.Assert.assertEquals;
 
 /**
@@ -32,46 +27,133 @@ import static org.junit.Assert.assertEquals;
  */
 public class QueryScopeInfoTest {
 	@Test
-	public void testJobManagerMetricInfo() {
-		QueryScopeInfo.JobManagerQueryScopeInfo info = new QueryScopeInfo.JobManagerQueryScopeInfo("abc");
-		assertEquals("abc", info.scope);
-		assertEquals(INFO_CATEGORY_JM, info.getCategory());
+	public void testJobManagerQueryScopeInfo() {
+		QueryScopeInfo.JobManagerQueryScopeInfo info = new QueryScopeInfo.JobManagerQueryScopeInfo();
+		assertEquals(QueryScopeInfo.INFO_CATEGORY_JM, info.getCategory());
+		assertEquals("", info.scope);
+
+		info = info.copy("world");
+		assertEquals(QueryScopeInfo.INFO_CATEGORY_JM, info.getCategory());
+		assertEquals("world", info.scope);
+
+		info = new QueryScopeInfo.JobManagerQueryScopeInfo("hello");
+		assertEquals(QueryScopeInfo.INFO_CATEGORY_JM, info.getCategory());
+		assertEquals("hello", info.scope);
+
+		info = info.copy("world");
+		assertEquals(QueryScopeInfo.INFO_CATEGORY_JM, info.getCategory());
+		assertEquals("hello.world", info.scope);
 	}
 
 	@Test
-	public void testTaskManagerMetricInfo() {
-		QueryScopeInfo.TaskManagerQueryScopeInfo info = new QueryScopeInfo.TaskManagerQueryScopeInfo("tmid",
"abc");
-		assertEquals("abc", info.scope);
+	public void testTaskManagerQueryScopeInfo() {
+		QueryScopeInfo.TaskManagerQueryScopeInfo info = new QueryScopeInfo.TaskManagerQueryScopeInfo("tmid");
+		assertEquals(QueryScopeInfo.INFO_CATEGORY_TM, info.getCategory());
+		assertEquals("", info.scope);
+		assertEquals("tmid", info.taskManagerID);
+
+		info = info.copy("world");
+		assertEquals(QueryScopeInfo.INFO_CATEGORY_TM, info.getCategory());
+		assertEquals("world", info.scope);
+		assertEquals("tmid", info.taskManagerID);
+
+		info = new QueryScopeInfo.TaskManagerQueryScopeInfo("tmid", "hello");
+		assertEquals(QueryScopeInfo.INFO_CATEGORY_TM, info.getCategory());
+		assertEquals("hello", info.scope);
+		assertEquals("tmid", info.taskManagerID);
+
+		info = info.copy("world");
+		assertEquals(QueryScopeInfo.INFO_CATEGORY_TM, info.getCategory());
+		assertEquals("hello.world", info.scope);
 		assertEquals("tmid", info.taskManagerID);
-		assertEquals(INFO_CATEGORY_TM, info.getCategory());
 	}
 
 	@Test
-	public void testJobMetricInfo() {
-		QueryScopeInfo.JobQueryScopeInfo info = new QueryScopeInfo.JobQueryScopeInfo("jobid", "abc");
-		assertEquals("abc", info.scope);
+	public void testJobQueryScopeInfo() {
+		QueryScopeInfo.JobQueryScopeInfo info = new QueryScopeInfo.JobQueryScopeInfo("jobid");
+		assertEquals(QueryScopeInfo.INFO_CATEGORY_JOB, info.getCategory());
+		assertEquals("", info.scope);
+		assertEquals("jobid", info.jobID);
+
+		info = info.copy("world");
+		assertEquals(QueryScopeInfo.INFO_CATEGORY_JOB, info.getCategory());
+		assertEquals("world", info.scope);
+		assertEquals("jobid", info.jobID);
+
+		info = new QueryScopeInfo.JobQueryScopeInfo("jobid", "hello");
+		assertEquals(QueryScopeInfo.INFO_CATEGORY_JOB, info.getCategory());
+		assertEquals("hello", info.scope);
+		assertEquals("jobid", info.jobID);
+
+		info = info.copy("world");
+		assertEquals(QueryScopeInfo.INFO_CATEGORY_JOB, info.getCategory());
+		assertEquals("hello.world", info.scope);
 		assertEquals("jobid", info.jobID);
-		assertEquals(INFO_CATEGORY_JOB, info.getCategory());
 	}
 
 	@Test
-	public void testTaskMetricInfo() {
-		QueryScopeInfo.TaskQueryScopeInfo info = new QueryScopeInfo.TaskQueryScopeInfo("jid", "vid",
2, "abc");
-		assertEquals("abc", info.scope);
-		assertEquals("jid", info.jobID);
-		assertEquals("vid", info.vertexID);
+	public void testTaskQueryScopeInfo() {
+		QueryScopeInfo.TaskQueryScopeInfo info = new QueryScopeInfo.TaskQueryScopeInfo("jobid",
"taskid", 2);
+		assertEquals(QueryScopeInfo.INFO_CATEGORY_TASK, info.getCategory());
+		assertEquals("", info.scope);
+		assertEquals("jobid", info.jobID);
+		assertEquals("taskid", info.vertexID);
+		assertEquals(2, info.subtaskIndex);
+
+		info = info.copy("world");
+		assertEquals(QueryScopeInfo.INFO_CATEGORY_TASK, info.getCategory());
+		assertEquals("world", info.scope);
+		assertEquals("jobid", info.jobID);
+		assertEquals("taskid", info.vertexID);
+		assertEquals(2, info.subtaskIndex);
+
+		info = new QueryScopeInfo.TaskQueryScopeInfo("jobid", "taskid", 2, "hello");
+		assertEquals(QueryScopeInfo.INFO_CATEGORY_TASK, info.getCategory());
+		assertEquals("hello", info.scope);
+		assertEquals("jobid", info.jobID);
+		assertEquals("taskid", info.vertexID);
+		assertEquals(2, info.subtaskIndex);
+
+		info = info.copy("world");
+		assertEquals(QueryScopeInfo.INFO_CATEGORY_TASK, info.getCategory());
+		assertEquals("hello.world", info.scope);
+		assertEquals("jobid", info.jobID);
+		assertEquals("taskid", info.vertexID);
 		assertEquals(2, info.subtaskIndex);
-		assertEquals(INFO_CATEGORY_TASK, info.getCategory());
 	}
 
 	@Test
-	public void testOperatorMetricInfo() {
-		QueryScopeInfo.OperatorQueryScopeInfo info = new QueryScopeInfo.OperatorQueryScopeInfo("jid",
"vid", 2, "opname", "abc");
-		assertEquals("abc", info.scope);
-		assertEquals("jid", info.jobID);
-		assertEquals("vid", info.vertexID);
+	public void testOperatorQueryScopeInfo() {
+		QueryScopeInfo.OperatorQueryScopeInfo info = new QueryScopeInfo.OperatorQueryScopeInfo("jobid",
"taskid", 2, "opname");
+		assertEquals(QueryScopeInfo.INFO_CATEGORY_OPERATOR, info.getCategory());
+		assertEquals("", info.scope);
+		assertEquals("jobid", info.jobID);
+		assertEquals("taskid", info.vertexID);
+		assertEquals("opname", info.operatorName);
+		assertEquals(2, info.subtaskIndex);
+
+		info = info.copy("world");
+		assertEquals(QueryScopeInfo.INFO_CATEGORY_OPERATOR, info.getCategory());
+		assertEquals("world", info.scope);
+		assertEquals("jobid", info.jobID);
+		assertEquals("taskid", info.vertexID);
+		assertEquals("opname", info.operatorName);
+		assertEquals(2, info.subtaskIndex);
+
+		info = new QueryScopeInfo.OperatorQueryScopeInfo("jobid", "taskid", 2, "opname", "hello");
+		assertEquals(QueryScopeInfo.INFO_CATEGORY_OPERATOR, info.getCategory());
+		assertEquals("hello", info.scope);
+		assertEquals("jobid", info.jobID);
+		assertEquals("taskid", info.vertexID);
+		assertEquals("opname", info.operatorName);
+		assertEquals(2, info.subtaskIndex);
+
+		info = info.copy("world");
+		assertEquals(QueryScopeInfo.INFO_CATEGORY_OPERATOR, info.getCategory());
+		assertEquals("hello.world", info.scope);
+		assertEquals("jobid", info.jobID);
+		assertEquals("taskid", info.vertexID);
 		assertEquals("opname", info.operatorName);
 		assertEquals(2, info.subtaskIndex);
-		assertEquals(INFO_CATEGORY_OPERATOR, info.getCategory());
 	}
 }

http://git-wip-us.apache.org/repos/asf/flink/blob/b863b90c/flink-runtime/src/test/java/org/apache/flink/runtime/metrics/groups/QueryScopeInfoTest.java
----------------------------------------------------------------------
diff --git a/flink-runtime/src/test/java/org/apache/flink/runtime/metrics/groups/QueryScopeInfoTest.java
b/flink-runtime/src/test/java/org/apache/flink/runtime/metrics/groups/QueryScopeInfoTest.java
deleted file mode 100644
index f6a1277..0000000
--- a/flink-runtime/src/test/java/org/apache/flink/runtime/metrics/groups/QueryScopeInfoTest.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.flink.runtime.metrics.groups;
-
-import org.apache.flink.runtime.metrics.dump.QueryScopeInfo;
-
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-
-/**
- * Tests for the {@link QueryScopeInfo} classes.
- */
-public class QueryScopeInfoTest {
-	@Test
-	public void testJobManagerQueryScopeInfo() {
-		QueryScopeInfo.JobManagerQueryScopeInfo info = new QueryScopeInfo.JobManagerQueryScopeInfo();
-		assertEquals(QueryScopeInfo.INFO_CATEGORY_JM, info.getCategory());
-		assertEquals("", info.scope);
-
-		info = info.copy("world");
-		assertEquals(QueryScopeInfo.INFO_CATEGORY_JM, info.getCategory());
-		assertEquals("world", info.scope);
-
-		info = new QueryScopeInfo.JobManagerQueryScopeInfo("hello");
-		assertEquals(QueryScopeInfo.INFO_CATEGORY_JM, info.getCategory());
-		assertEquals("hello", info.scope);
-
-		info = info.copy("world");
-		assertEquals(QueryScopeInfo.INFO_CATEGORY_JM, info.getCategory());
-		assertEquals("hello.world", info.scope);
-	}
-
-	@Test
-	public void testTaskManagerQueryScopeInfo() {
-		QueryScopeInfo.TaskManagerQueryScopeInfo info = new QueryScopeInfo.TaskManagerQueryScopeInfo("tmid");
-		assertEquals(QueryScopeInfo.INFO_CATEGORY_TM, info.getCategory());
-		assertEquals("", info.scope);
-		assertEquals("tmid", info.taskManagerID);
-
-		info = info.copy("world");
-		assertEquals(QueryScopeInfo.INFO_CATEGORY_TM, info.getCategory());
-		assertEquals("world", info.scope);
-		assertEquals("tmid", info.taskManagerID);
-
-		info = new QueryScopeInfo.TaskManagerQueryScopeInfo("tmid", "hello");
-		assertEquals(QueryScopeInfo.INFO_CATEGORY_TM, info.getCategory());
-		assertEquals("hello", info.scope);
-		assertEquals("tmid", info.taskManagerID);
-
-		info = info.copy("world");
-		assertEquals(QueryScopeInfo.INFO_CATEGORY_TM, info.getCategory());
-		assertEquals("hello.world", info.scope);
-		assertEquals("tmid", info.taskManagerID);
-	}
-
-	@Test
-	public void testJobQueryScopeInfo() {
-		QueryScopeInfo.JobQueryScopeInfo info = new QueryScopeInfo.JobQueryScopeInfo("jobid");
-		assertEquals(QueryScopeInfo.INFO_CATEGORY_JOB, info.getCategory());
-		assertEquals("", info.scope);
-		assertEquals("jobid", info.jobID);
-
-		info = info.copy("world");
-		assertEquals(QueryScopeInfo.INFO_CATEGORY_JOB, info.getCategory());
-		assertEquals("world", info.scope);
-		assertEquals("jobid", info.jobID);
-
-		info = new QueryScopeInfo.JobQueryScopeInfo("jobid", "hello");
-		assertEquals(QueryScopeInfo.INFO_CATEGORY_JOB, info.getCategory());
-		assertEquals("hello", info.scope);
-		assertEquals("jobid", info.jobID);
-
-		info = info.copy("world");
-		assertEquals(QueryScopeInfo.INFO_CATEGORY_JOB, info.getCategory());
-		assertEquals("hello.world", info.scope);
-		assertEquals("jobid", info.jobID);
-	}
-
-	@Test
-	public void testTaskQueryScopeInfo() {
-		QueryScopeInfo.TaskQueryScopeInfo info = new QueryScopeInfo.TaskQueryScopeInfo("jobid",
"taskid", 2);
-		assertEquals(QueryScopeInfo.INFO_CATEGORY_TASK, info.getCategory());
-		assertEquals("", info.scope);
-		assertEquals("jobid", info.jobID);
-		assertEquals("taskid", info.vertexID);
-		assertEquals(2, info.subtaskIndex);
-
-		info = info.copy("world");
-		assertEquals(QueryScopeInfo.INFO_CATEGORY_TASK, info.getCategory());
-		assertEquals("world", info.scope);
-		assertEquals("jobid", info.jobID);
-		assertEquals("taskid", info.vertexID);
-		assertEquals(2, info.subtaskIndex);
-
-		info = new QueryScopeInfo.TaskQueryScopeInfo("jobid", "taskid", 2, "hello");
-		assertEquals(QueryScopeInfo.INFO_CATEGORY_TASK, info.getCategory());
-		assertEquals("hello", info.scope);
-		assertEquals("jobid", info.jobID);
-		assertEquals("taskid", info.vertexID);
-		assertEquals(2, info.subtaskIndex);
-
-		info = info.copy("world");
-		assertEquals(QueryScopeInfo.INFO_CATEGORY_TASK, info.getCategory());
-		assertEquals("hello.world", info.scope);
-		assertEquals("jobid", info.jobID);
-		assertEquals("taskid", info.vertexID);
-		assertEquals(2, info.subtaskIndex);
-	}
-
-	@Test
-	public void testOperatorQueryScopeInfo() {
-		QueryScopeInfo.OperatorQueryScopeInfo info = new QueryScopeInfo.OperatorQueryScopeInfo("jobid",
"taskid", 2, "opname");
-		assertEquals(QueryScopeInfo.INFO_CATEGORY_OPERATOR, info.getCategory());
-		assertEquals("", info.scope);
-		assertEquals("jobid", info.jobID);
-		assertEquals("taskid", info.vertexID);
-		assertEquals("opname", info.operatorName);
-		assertEquals(2, info.subtaskIndex);
-
-		info = info.copy("world");
-		assertEquals(QueryScopeInfo.INFO_CATEGORY_OPERATOR, info.getCategory());
-		assertEquals("world", info.scope);
-		assertEquals("jobid", info.jobID);
-		assertEquals("taskid", info.vertexID);
-		assertEquals("opname", info.operatorName);
-		assertEquals(2, info.subtaskIndex);
-
-		info = new QueryScopeInfo.OperatorQueryScopeInfo("jobid", "taskid", 2, "opname", "hello");
-		assertEquals(QueryScopeInfo.INFO_CATEGORY_OPERATOR, info.getCategory());
-		assertEquals("hello", info.scope);
-		assertEquals("jobid", info.jobID);
-		assertEquals("taskid", info.vertexID);
-		assertEquals("opname", info.operatorName);
-		assertEquals(2, info.subtaskIndex);
-
-		info = info.copy("world");
-		assertEquals(QueryScopeInfo.INFO_CATEGORY_OPERATOR, info.getCategory());
-		assertEquals("hello.world", info.scope);
-		assertEquals("jobid", info.jobID);
-		assertEquals("taskid", info.vertexID);
-		assertEquals("opname", info.operatorName);
-		assertEquals(2, info.subtaskIndex);
-	}
-}


Mime
View raw message