zentol commented on a change in pull request #10106: [FLINK-11463][e2e] Design
the e2e java framework so that at least the Kafka streaming tests can run on it
URL: https://github.com/apache/flink/pull/10106#discussion_r346287647
##########
File path:
flink-end-to-end-tests/flink-end-to-end-tests-common/src/main/java/org/apache/flink/tests/util/TestUtils.java
##########
@@ -38,21 +38,26 @@
/**
* General test utilities.
*/
-public class TestUtils {
+public enum TestUtils {
+ ;
/**
* Searches for a jar matching the given regex in the given directory.
This method is primarily intended to be used
* for the initialization of static {@link Path} fields for jars that
reside in the modules {@code target} directory.
*
- * @param jarNameRegex regex pattern to match against
+ * <p>The given relative path is resolved against the {@code moduleDir}
system property. For tests residing under
+ * {@code flink-end-to-end-tests} this value is set to the root
directory of the module that contains the test.
+ *
+ * @param relativeDirectory directory path to search for, relative to
the current working directory
+ * @param jarNameRegex regex pattern to match against
* @return Path pointing to the matching jar
* @throws RuntimeException if none or multiple jars could be found
*/
- public static Path getResourceJar(final String jarNameRegex) {
+ public static Path getResourceJar(final Path relativeDirectory, final
String jarNameRegex) {
String moduleDirProp = System.getProperty("moduleDir");
- Preconditions.checkNotNull(moduleDirProp);
+ Preconditions.checkNotNull(moduleDirProp, "The moduleDir
property was not set, You can set it when running maven via
-DmoduleDir=<path>");
- try (Stream<Path> dependencyJars =
Files.walk(Paths.get(moduleDirProp))) {
+ try (Stream<Path> dependencyJars =
Files.list(Paths.get(moduleDirProp).resolve(relativeDirectory))) {
Review comment:
The walk approach was actually quite nice since we could get rid of
`Paths.get("target/dependencies")` in the test.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services