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 2018/09/23 16:44:29 UTC
[flink] 02/02: [hotfix] Move
TestingYarnClusterDescriptor#TestJarFinder into YarnTestUtils
This is an automated email from the ASF dual-hosted git repository.
trohrmann pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink.git
commit d018eedf4b8ef49c4943cd2d4c47b53a56640812
Author: Till Rohrmann <tr...@apache.org>
AuthorDate: Thu Sep 20 10:02:52 2018 +0200
[hotfix] Move TestingYarnClusterDescriptor#TestJarFinder into YarnTestUtils
In order to reuse the TestJarFinder class, this commit moves it into the YarnTestUtils
class.
---
.../flink/yarn/TestingYarnClusterDescriptor.java | 22 ++++------------------
.../java/org/apache/flink/yarn/YARNITCase.java | 3 ++-
.../org/apache/flink/yarn/util/YarnTestUtils.java | 19 +++++++++++++++++++
3 files changed, 25 insertions(+), 19 deletions(-)
diff --git a/flink-yarn-tests/src/test/java/org/apache/flink/yarn/TestingYarnClusterDescriptor.java b/flink-yarn-tests/src/test/java/org/apache/flink/yarn/TestingYarnClusterDescriptor.java
index 37b8d41..a16cb0b 100644
--- a/flink-yarn-tests/src/test/java/org/apache/flink/yarn/TestingYarnClusterDescriptor.java
+++ b/flink-yarn-tests/src/test/java/org/apache/flink/yarn/TestingYarnClusterDescriptor.java
@@ -22,12 +22,12 @@ import org.apache.flink.client.deployment.ClusterSpecification;
import org.apache.flink.configuration.Configuration;
import org.apache.flink.runtime.jobgraph.JobGraph;
import org.apache.flink.util.Preconditions;
+import org.apache.flink.yarn.util.YarnTestUtils;
import org.apache.hadoop.yarn.client.api.YarnClient;
import org.apache.hadoop.yarn.conf.YarnConfiguration;
import java.io.File;
-import java.io.FilenameFilter;
import java.util.ArrayList;
import java.util.List;
@@ -52,15 +52,15 @@ public class TestingYarnClusterDescriptor extends LegacyYarnClusterDescriptor {
sharedYarnClient);
List<File> filesToShip = new ArrayList<>();
- File testingJar = YarnTestBase.findFile("..", new TestJarFinder("flink-yarn-tests"));
+ File testingJar = YarnTestBase.findFile("..", new YarnTestUtils.TestJarFinder("flink-yarn-tests"));
Preconditions.checkNotNull(testingJar, "Could not find the flink-yarn-tests tests jar. " +
"Make sure to package the flink-yarn-tests module.");
- File testingRuntimeJar = YarnTestBase.findFile("..", new TestJarFinder("flink-runtime"));
+ File testingRuntimeJar = YarnTestBase.findFile("..", new YarnTestUtils.TestJarFinder("flink-runtime"));
Preconditions.checkNotNull(testingRuntimeJar, "Could not find the flink-runtime tests " +
"jar. Make sure to package the flink-runtime module.");
- File testingYarnJar = YarnTestBase.findFile("..", new TestJarFinder("flink-yarn"));
+ File testingYarnJar = YarnTestBase.findFile("..", new YarnTestUtils.TestJarFinder("flink-yarn"));
Preconditions.checkNotNull(testingRuntimeJar, "Could not find the flink-yarn tests " +
"jar. Make sure to package the flink-yarn module.");
@@ -89,18 +89,4 @@ public class TestingYarnClusterDescriptor extends LegacyYarnClusterDescriptor {
throw new UnsupportedOperationException("Cannot deploy a per-job cluster yet.");
}
- static class TestJarFinder implements FilenameFilter {
-
- private final String jarName;
-
- TestJarFinder(final String jarName) {
- this.jarName = jarName;
- }
-
- @Override
- public boolean accept(File dir, String name) {
- return name.startsWith(jarName) && name.endsWith("-tests.jar") &&
- dir.getAbsolutePath().contains(dir.separator + jarName + dir.separator);
- }
- }
}
diff --git a/flink-yarn-tests/src/test/java/org/apache/flink/yarn/YARNITCase.java b/flink-yarn-tests/src/test/java/org/apache/flink/yarn/YARNITCase.java
index 56cfdb6..814e808 100644
--- a/flink-yarn-tests/src/test/java/org/apache/flink/yarn/YARNITCase.java
+++ b/flink-yarn-tests/src/test/java/org/apache/flink/yarn/YARNITCase.java
@@ -29,6 +29,7 @@ import org.apache.flink.runtime.jobmaster.JobResult;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
import org.apache.flink.streaming.api.functions.sink.DiscardingSink;
import org.apache.flink.streaming.api.functions.source.ParallelSourceFunction;
+import org.apache.flink.yarn.util.YarnTestUtils;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.yarn.api.records.ApplicationId;
@@ -88,7 +89,7 @@ public class YARNITCase extends YarnTestBase {
final JobGraph jobGraph = env.getStreamGraph().getJobGraph();
- File testingJar = YarnTestBase.findFile("..", new TestingYarnClusterDescriptor.TestJarFinder("flink-yarn-tests"));
+ File testingJar = YarnTestBase.findFile("..", new YarnTestUtils.TestJarFinder("flink-yarn-tests"));
jobGraph.addJar(new org.apache.flink.core.fs.Path(testingJar.toURI()));
diff --git a/flink-yarn-tests/src/test/java/org/apache/flink/yarn/util/YarnTestUtils.java b/flink-yarn-tests/src/test/java/org/apache/flink/yarn/util/YarnTestUtils.java
index 25d833b..f7a9634 100644
--- a/flink-yarn-tests/src/test/java/org/apache/flink/yarn/util/YarnTestUtils.java
+++ b/flink-yarn-tests/src/test/java/org/apache/flink/yarn/util/YarnTestUtils.java
@@ -20,6 +20,7 @@ package org.apache.flink.yarn.util;
import java.io.File;
import java.io.FileNotFoundException;
+import java.io.FilenameFilter;
/**
* Utility methods for YARN tests.
@@ -33,4 +34,22 @@ public class YarnTestUtils {
}
return f;
}
+
+ /**
+ * Filename filter which finds the test jar for the given name.
+ */
+ public static class TestJarFinder implements FilenameFilter {
+
+ private final String jarName;
+
+ public TestJarFinder(final String jarName) {
+ this.jarName = jarName;
+ }
+
+ @Override
+ public boolean accept(File dir, String name) {
+ return name.startsWith(jarName) && name.endsWith("-tests.jar") &&
+ dir.getAbsolutePath().contains(File.separator + jarName + File.separator);
+ }
+ }
}