openinx 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_r346108134
 
 

 ##########
 File path: 
flink-end-to-end-tests/flink-end-to-end-tests-common/src/main/java/org/apache/flink/tests/util/TestUtils.java
 ##########
 @@ -0,0 +1,113 @@
+/*
+ * 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.tests.util;
+
+import org.apache.flink.util.Preconditions;
+
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.nio.file.FileAlreadyExistsException;
+import java.nio.file.FileVisitResult;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.nio.file.SimpleFileVisitor;
+import java.nio.file.StandardCopyOption;
+import java.nio.file.attribute.BasicFileAttributes;
+import java.util.List;
+import java.util.regex.Pattern;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+/**
+ * General test utilities.
+ */
+public class 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
+        * @return Path pointing to the matching jar
+        * @throws RuntimeException if none or multiple jars could be found
+        */
+       public static Path getResourceJar(final String jarNameRegex) {
+               String moduleDirProp = System.getProperty("moduleDir");
+               Preconditions.checkNotNull(moduleDirProp);
 
 Review comment:
   OK

----------------------------------------------------------------
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

Reply via email to