You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by tr...@apache.org on 2019/08/09 12:49:49 UTC

[flink] 02/02: [hotfix][tests] Add NoOpJobFailCall singleton

This is an automated email from the ASF dual-hosted git repository.

trohrmann pushed a commit to branch release-1.9
in repository https://gitbox.apache.org/repos/asf/flink.git

commit d4c07d2449bc1bcf21757a19519b3e2951818547
Author: Till Rohrmann <tr...@apache.org>
AuthorDate: Fri Aug 9 13:57:47 2019 +0200

    [hotfix][tests] Add NoOpJobFailCall singleton
---
 .../CheckpointCoordinatorFailureTest.java          |  8 +----
 .../CheckpointCoordinatorMasterHooksTest.java      |  9 +-----
 .../checkpoint/CheckpointCoordinatorTest.java      |  8 +----
 .../checkpoint/CheckpointStateRestoreTest.java     |  8 +----
 .../flink/runtime/checkpoint/NoOpFailJobCall.java  | 34 ++++++++++++++++++++++
 5 files changed, 38 insertions(+), 29 deletions(-)

diff --git a/flink-runtime/src/test/java/org/apache/flink/runtime/checkpoint/CheckpointCoordinatorFailureTest.java b/flink-runtime/src/test/java/org/apache/flink/runtime/checkpoint/CheckpointCoordinatorFailureTest.java
index c3059a1..da181ba 100644
--- a/flink-runtime/src/test/java/org/apache/flink/runtime/checkpoint/CheckpointCoordinatorFailureTest.java
+++ b/flink-runtime/src/test/java/org/apache/flink/runtime/checkpoint/CheckpointCoordinatorFailureTest.java
@@ -68,13 +68,7 @@ public class CheckpointCoordinatorFailureTest extends TestLogger {
 
 		CheckpointFailureManager failureManager = new CheckpointFailureManager(
 			0,
-			new CheckpointFailureManager.FailJobCallback() {
-				@Override
-				public void failJob(Throwable cause) {}
-
-				@Override
-				public void failJobDueToTaskFailure(Throwable cause, ExecutionAttemptID failingTask) {}
-			});
+			NoOpFailJobCall.INSTANCE);
 
 		// set up the coordinator and validate the initial state
 		CheckpointCoordinatorConfiguration chkConfig = new CheckpointCoordinatorConfiguration(
diff --git a/flink-runtime/src/test/java/org/apache/flink/runtime/checkpoint/CheckpointCoordinatorMasterHooksTest.java b/flink-runtime/src/test/java/org/apache/flink/runtime/checkpoint/CheckpointCoordinatorMasterHooksTest.java
index 8067fb4..48b6583 100644
--- a/flink-runtime/src/test/java/org/apache/flink/runtime/checkpoint/CheckpointCoordinatorMasterHooksTest.java
+++ b/flink-runtime/src/test/java/org/apache/flink/runtime/checkpoint/CheckpointCoordinatorMasterHooksTest.java
@@ -444,14 +444,7 @@ public class CheckpointCoordinatorMasterHooksTest {
 				SharedStateRegistry.DEFAULT_FACTORY,
 				new CheckpointFailureManager(
 					0,
-					new CheckpointFailureManager.FailJobCallback() {
-						@Override
-						public void failJob(Throwable cause) {}
-
-						@Override
-						public void failJobDueToTaskFailure(Throwable cause, ExecutionAttemptID failingTask) {}
-				})
-		);
+					NoOpFailJobCall.INSTANCE));
 	}
 
 	private static <T> T mockGeneric(Class<?> clazz) {
diff --git a/flink-runtime/src/test/java/org/apache/flink/runtime/checkpoint/CheckpointCoordinatorTest.java b/flink-runtime/src/test/java/org/apache/flink/runtime/checkpoint/CheckpointCoordinatorTest.java
index ffb148b..98d80fd 100644
--- a/flink-runtime/src/test/java/org/apache/flink/runtime/checkpoint/CheckpointCoordinatorTest.java
+++ b/flink-runtime/src/test/java/org/apache/flink/runtime/checkpoint/CheckpointCoordinatorTest.java
@@ -130,13 +130,7 @@ public class CheckpointCoordinatorTest extends TestLogger {
 	public void setUp() throws Exception {
 		failureManager = new CheckpointFailureManager(
 			0,
-			new CheckpointFailureManager.FailJobCallback() {
-				@Override
-				public void failJob(Throwable cause) {}
-
-				@Override
-				public void failJobDueToTaskFailure(Throwable cause, ExecutionAttemptID failingTask) {}
-		});
+			NoOpFailJobCall.INSTANCE);
 	}
 
 	@Test
diff --git a/flink-runtime/src/test/java/org/apache/flink/runtime/checkpoint/CheckpointStateRestoreTest.java b/flink-runtime/src/test/java/org/apache/flink/runtime/checkpoint/CheckpointStateRestoreTest.java
index a11dfc8..af2e5a3 100644
--- a/flink-runtime/src/test/java/org/apache/flink/runtime/checkpoint/CheckpointStateRestoreTest.java
+++ b/flink-runtime/src/test/java/org/apache/flink/runtime/checkpoint/CheckpointStateRestoreTest.java
@@ -69,13 +69,7 @@ public class CheckpointStateRestoreTest {
 	public void setUp() throws Exception {
 		failureManager = new CheckpointFailureManager(
 			0,
-			new CheckpointFailureManager.FailJobCallback() {
-				@Override
-				public void failJob(Throwable cause) {}
-
-				@Override
-				public void failJobDueToTaskFailure(Throwable cause, ExecutionAttemptID failingTask) {}
-			});
+			NoOpFailJobCall.INSTANCE);
 	}
 
 	/**
diff --git a/flink-runtime/src/test/java/org/apache/flink/runtime/checkpoint/NoOpFailJobCall.java b/flink-runtime/src/test/java/org/apache/flink/runtime/checkpoint/NoOpFailJobCall.java
new file mode 100644
index 0000000..627c9e4
--- /dev/null
+++ b/flink-runtime/src/test/java/org/apache/flink/runtime/checkpoint/NoOpFailJobCall.java
@@ -0,0 +1,34 @@
+/*
+ * 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.checkpoint;
+
+import org.apache.flink.runtime.executiongraph.ExecutionAttemptID;
+
+/**
+ * Testing implementation of {@link CheckpointFailureManager.FailJobCallback} which does nothing.
+ */
+public enum NoOpFailJobCall implements CheckpointFailureManager.FailJobCallback {
+	INSTANCE;
+
+	@Override
+	public void failJob(Throwable cause) {}
+
+	@Override
+	public void failJobDueToTaskFailure(Throwable cause, ExecutionAttemptID failingTask) {}
+}