seojangho commented on a change in pull request #124: [NEMO-185] BeamSQL TPC-H
Integration Test
URL: https://github.com/apache/incubator-nemo/pull/124#discussion_r227242474
##########
File path:
common/src/main/java/org/apache/nemo/common/test/ExampleTestUtil.java
##########
@@ -41,46 +42,25 @@ private ExampleTestUtil() {
*
* @param resourcePath root folder for both resources.
* @param outputFileName output file name.
- * @param testResourceFileName the test result file name.
+ * @param expectedFileName the test result file name.
* @throws RuntimeException if the output is invalid.
*/
public static void ensureOutputValidity(final String resourcePath,
final String outputFileName,
- final String testResourceFileName)
throws IOException {
-
- final String testOutput;
- try (final Stream<Path> fileStream = Files.list(Paths.get(resourcePath))) {
- testOutput = fileStream
- .filter(Files::isRegularFile)
- .filter(path ->
path.getFileName().toString().startsWith(outputFileName))
- .flatMap(path -> {
- try {
- return Files.lines(path);
- } catch (final IOException e) {
- throw new RuntimeException(e);
- }
- })
- .sorted()
- .reduce("", (p, q) -> (p + "\n" + q));
- }
-
- final String resourceOutput;
-
- try (final Stream<String> lineStream = Files.lines(Paths.get(resourcePath
+ testResourceFileName))) {
- resourceOutput = lineStream
- .sorted()
- .reduce("", (p, q) -> (p + "\n" + q));
- }
-
- if (!testOutput.equals(resourceOutput)) {
+ final String expectedFileName)
throws IOException {
+ final String testOutput =
+ getSortedLineStream(resourcePath, outputFileName, false).reduce("", (p,
q) -> (p + "\n" + q));
+ final String expectedOutput =
+ getSortedLineStream(resourcePath, expectedFileName, true).reduce("", (p,
q) -> (p + "\n" + q));
+ if (!testOutput.equals(expectedOutput)) {
final String outputMsg =
Review comment:
Let's use StringBuilder or `String.format`
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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