This is an automated email from the ASF dual-hosted git repository. tison pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/flink.git
commit 7741eed6a1e7f3f388c6accc086962c1b812a59c Author: tison <wander4...@gmail.com> AuthorDate: Fri Nov 29 09:48:52 2019 +0800 [FLINK-14762][tests] Introduce TestingJobClient --- .../java/ExecutorDiscoveryAndJobClientTest.java | 13 +------ .../apache/flink/api/java/TestingJobClient.java | 43 ++++++++++++++++++++++ .../ExecutorDiscoveryAndJobClientTest.java | 13 +------ .../streaming/environment/TestingJobClient.java | 43 ++++++++++++++++++++++ 4 files changed, 88 insertions(+), 24 deletions(-) diff --git a/flink-java/src/test/java/org/apache/flink/api/java/ExecutorDiscoveryAndJobClientTest.java b/flink-java/src/test/java/org/apache/flink/api/java/ExecutorDiscoveryAndJobClientTest.java index 176d50f..4a6e3ee 100644 --- a/flink-java/src/test/java/org/apache/flink/api/java/ExecutorDiscoveryAndJobClientTest.java +++ b/flink-java/src/test/java/org/apache/flink/api/java/ExecutorDiscoveryAndJobClientTest.java @@ -19,7 +19,6 @@ package org.apache.flink.api.java; import org.apache.flink.api.common.JobExecutionResult; -import org.apache.flink.api.common.JobID; import org.apache.flink.api.java.io.DiscardingOutputFormat; import org.apache.flink.configuration.Configuration; import org.apache.flink.configuration.DeploymentOptions; @@ -82,17 +81,7 @@ public class ExecutorDiscoveryAndJobClientTest { @Override public Executor getExecutor(Configuration configuration) { - return (pipeline, executionConfig) -> CompletableFuture.completedFuture(new JobClient() { - @Override - public JobID getJobID() { - return new JobID(); - } - - @Override - public CompletableFuture<JobExecutionResult> getJobExecutionResult(ClassLoader userClassloader) { - return CompletableFuture.completedFuture(new JobExecutionResult(new JobID(), 0L, Collections.emptyMap())); - } - }); + return (pipeline, executionConfig) -> CompletableFuture.completedFuture(new TestingJobClient()); } } } diff --git a/flink-java/src/test/java/org/apache/flink/api/java/TestingJobClient.java b/flink-java/src/test/java/org/apache/flink/api/java/TestingJobClient.java new file mode 100644 index 0000000..f8af3fc --- /dev/null +++ b/flink-java/src/test/java/org/apache/flink/api/java/TestingJobClient.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.flink.api.java; + +import org.apache.flink.api.common.JobExecutionResult; +import org.apache.flink.api.common.JobID; +import org.apache.flink.core.execution.JobClient; + +import java.util.Collections; +import java.util.concurrent.CompletableFuture; + +/** + * Testing implementation of {@link JobClient}. + */ +public class TestingJobClient implements JobClient { + + @Override + public JobID getJobID() { + return new JobID(); + } + + @Override + public CompletableFuture<JobExecutionResult> getJobExecutionResult(ClassLoader userClassloader) { + return CompletableFuture.completedFuture(new JobExecutionResult(new JobID(), 0L, Collections.emptyMap())); + } + +} diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/environment/ExecutorDiscoveryAndJobClientTest.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/environment/ExecutorDiscoveryAndJobClientTest.java index 6dc8be2..e0bd426 100644 --- a/flink-streaming-java/src/test/java/org/apache/flink/streaming/environment/ExecutorDiscoveryAndJobClientTest.java +++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/environment/ExecutorDiscoveryAndJobClientTest.java @@ -19,7 +19,6 @@ package org.apache.flink.streaming.environment; import org.apache.flink.api.common.JobExecutionResult; -import org.apache.flink.api.common.JobID; import org.apache.flink.configuration.Configuration; import org.apache.flink.configuration.DeploymentOptions; import org.apache.flink.core.execution.Executor; @@ -82,17 +81,7 @@ public class ExecutorDiscoveryAndJobClientTest { @Override public Executor getExecutor(Configuration configuration) { - return (pipeline, executionConfig) -> CompletableFuture.completedFuture(new JobClient() { - @Override - public JobID getJobID() { - return new JobID(); - } - - @Override - public CompletableFuture<JobExecutionResult> getJobExecutionResult(ClassLoader userClassloader) { - return CompletableFuture.completedFuture(new JobExecutionResult(new JobID(), 0L, Collections.emptyMap())); - } - }); + return (pipeline, executionConfig) -> CompletableFuture.completedFuture(new TestingJobClient()); } } } diff --git a/flink-streaming-java/src/test/java/org/apache/flink/streaming/environment/TestingJobClient.java b/flink-streaming-java/src/test/java/org/apache/flink/streaming/environment/TestingJobClient.java new file mode 100644 index 0000000..a36c6e1 --- /dev/null +++ b/flink-streaming-java/src/test/java/org/apache/flink/streaming/environment/TestingJobClient.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.flink.streaming.environment; + +import org.apache.flink.api.common.JobExecutionResult; +import org.apache.flink.api.common.JobID; +import org.apache.flink.core.execution.JobClient; + +import java.util.Collections; +import java.util.concurrent.CompletableFuture; + +/** + * Testing implementation of {@link JobClient}. + */ +public class TestingJobClient implements JobClient { + + @Override + public JobID getJobID() { + return new JobID(); + } + + @Override + public CompletableFuture<JobExecutionResult> getJobExecutionResult(ClassLoader userClassloader) { + return CompletableFuture.completedFuture(new JobExecutionResult(new JobID(), 0L, Collections.emptyMap())); + } + +}