Skip to content

Commit

Permalink
mvn fmt:format
Browse files Browse the repository at this point in the history
  • Loading branch information
Jorge Marin committed Jul 6, 2018
1 parent ae92ff3 commit e0aaa7f
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 12 deletions.
13 changes: 11 additions & 2 deletions src/main/java/hudson/plugins/textfinder/TextFinderPublisher.java
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,8 @@ private void findText(Run<?, ?> run, FilePath workspace, TaskListener listener)
boolean foundText = false;

if (alsoCheckConsoleOutput) {
logger.println("Looking for pattern " + "'" + regexp + "'" + " in the console output");
logger.println(
"Looking for pattern " + "'" + regexp + "'" + " in the console output");
foundText |=
checkFile(
run.getLogFile(),
Expand All @@ -140,7 +141,15 @@ private void findText(Run<?, ?> run, FilePath workspace, TaskListener listener)
// printing this when checking console output will cause the plugin
// to find this line, which would be pointless.
// doing this only when fileSet!=null to avoid
logger.println("Looking for pattern " + "'" + regexp + "'" + " in the file " + "'" + run.getLogFile() + "'");
logger.println(
"Looking for pattern "
+ "'"
+ regexp
+ "'"
+ " in the file "
+ "'"
+ run.getLogFile()
+ "'");
}

final RemoteOutputStream ros = new RemoteOutputStream(logger);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,16 @@ public void failureIfFoundInFileOnAgent() throws Exception {
agent.getNodeName(), agent.getNodeName())));
WorkflowRun build = project.scheduleBuild2(0).get();
rule.waitForCompletion(build);
rule.assertLogContains("Looking for pattern " + "'" + UNIQUE_TEXT + "'" + " in the file " + "'" + build.getLogFile() + "'", build);
rule.assertLogContains(
"Looking for pattern "
+ "'"
+ UNIQUE_TEXT
+ "'"
+ " in the file "
+ "'"
+ build.getLogFile()
+ "'",
build);
assertLogContainsMatch(new File(getWorkspace(build), "out.txt"), UNIQUE_TEXT, build, false);
rule.assertBuildStatus(Result.FAILURE, build);
}
Expand All @@ -79,7 +88,9 @@ public void failureIfFoundInConsoleOnAgent() throws Exception {
agent.getNodeName(), agent.getNodeName())));
WorkflowRun build = project.scheduleBuild2(0).get();
rule.waitForCompletion(build);
rule.assertLogContains("Looking for pattern " + "'" + ECHO_UNIQUE_TEXT + "'" + " in the console output", build);
rule.assertLogContains(
"Looking for pattern " + "'" + ECHO_UNIQUE_TEXT + "'" + " in the console output",
build);
assertLogContainsMatch(build.getLogFile(), ECHO_UNIQUE_TEXT, build, true);
rule.assertBuildStatus(Result.FAILURE, build);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ public void successIfFoundInConsole() throws Exception {
project.getPublishersList().add(textFinder);
FreeStyleBuild build = project.scheduleBuild2(0).get();
rule.waitForCompletion(build);
rule.assertLogContains("Looking for pattern " + "'" + UNIQUE_TEXT + "'" + " in the console output", build);
rule.assertLogContains(
"Looking for pattern " + "'" + UNIQUE_TEXT + "'" + " in the console output", build);
assertLogContainsMatch(build.getLogFile(), ECHO_UNIQUE_TEXT, build, true);
rule.assertBuildStatus(Result.SUCCESS, build);
}
Expand All @@ -66,7 +67,8 @@ public void failureIfFoundInConsole() throws Exception {
project.getPublishersList().add(textFinder);
FreeStyleBuild build = project.scheduleBuild2(0).get();
rule.waitForCompletion(build);
rule.assertLogContains("Looking for pattern " + "'" + UNIQUE_TEXT + "'" + " in the console output", build);
rule.assertLogContains(
"Looking for pattern " + "'" + UNIQUE_TEXT + "'" + " in the console output", build);
assertLogContainsMatch(build.getLogFile(), ECHO_UNIQUE_TEXT, build, true);
rule.assertBuildStatus(Result.FAILURE, build);
}
Expand All @@ -85,7 +87,8 @@ public void unstableIfFoundInConsole() throws Exception {
project.getPublishersList().add(textFinder);
FreeStyleBuild build = project.scheduleBuild2(0).get();
rule.waitForCompletion(build);
rule.assertLogContains("Looking for pattern " + "'" + UNIQUE_TEXT + "'" + " in the console output", build);
rule.assertLogContains(
"Looking for pattern " + "'" + UNIQUE_TEXT + "'" + " in the console output", build);
assertLogContainsMatch(build.getLogFile(), ECHO_UNIQUE_TEXT, build, true);
rule.assertBuildStatus(Result.UNSTABLE, build);
}
Expand All @@ -98,7 +101,8 @@ public void notFoundInConsole() throws Exception {
project.getPublishersList().add(textFinder);
FreeStyleBuild build = project.scheduleBuild2(0).get();
rule.waitForCompletion(build);
rule.assertLogContains("Looking for pattern " + "'" + UNIQUE_TEXT + "'" + " in the console output", build);
rule.assertLogContains(
"Looking for pattern " + "'" + UNIQUE_TEXT + "'" + " in the console output", build);
rule.assertBuildStatus(Result.SUCCESS, build);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ public void successIfFoundInFile() throws Exception {
+ "node {findText regexp: 'foobar', fileSet: 'out.txt', succeedIfFound: true}\n"));
WorkflowRun build = project.scheduleBuild2(0).get();
rule.waitForCompletion(build);
rule.assertLogContains("Looking for pattern 'foobar' in the file " + "'" + build.getLogFile() + "'", build);
rule.assertLogContains(
"Looking for pattern 'foobar' in the file " + "'" + build.getLogFile() + "'",
build);
assertLogContainsMatch(new File(getWorkspace(build), "out.txt"), UNIQUE_TEXT, build, false);
rule.assertBuildStatus(Result.SUCCESS, build);
}
Expand All @@ -72,7 +74,9 @@ public void failureIfFoundInFile() throws Exception {
+ "node {findText regexp: 'foobar', fileSet: 'out.txt'}\n"));
WorkflowRun build = project.scheduleBuild2(0).get();
rule.waitForCompletion(build);
rule.assertLogContains("Looking for pattern 'foobar' in the file " + "'" + build.getLogFile() + "'", build);
rule.assertLogContains(
"Looking for pattern 'foobar' in the file " + "'" + build.getLogFile() + "'",
build);
assertLogContainsMatch(new File(getWorkspace(build), "out.txt"), UNIQUE_TEXT, build, false);
rule.assertBuildStatus(Result.FAILURE, build);
}
Expand All @@ -86,7 +90,9 @@ public void unstableIfFoundInFile() throws Exception {
+ "node {findText regexp: 'foobar', fileSet: 'out.txt', unstableIfFound: true}\n"));
WorkflowRun build = project.scheduleBuild2(0).get();
rule.waitForCompletion(build);
rule.assertLogContains("Looking for pattern 'foobar' in the file " + "'" + build.getLogFile() + "'", build);
rule.assertLogContains(
"Looking for pattern 'foobar' in the file " + "'" + build.getLogFile() + "'",
build);
assertLogContainsMatch(new File(getWorkspace(build), "out.txt"), UNIQUE_TEXT, build, false);
rule.assertBuildStatus(Result.UNSTABLE, build);
}
Expand Down Expand Up @@ -114,7 +120,9 @@ public void notFoundInFile() throws Exception {
+ "node {findText regexp: 'foobar', fileSet: 'out.txt'}\n"));
WorkflowRun build = project.scheduleBuild2(0).get();
rule.waitForCompletion(build);
rule.assertLogContains("Looking for pattern 'foobar' in the file " + "'" + build.getLogFile() + "'", build);
rule.assertLogContains(
"Looking for pattern 'foobar' in the file " + "'" + build.getLogFile() + "'",
build);
rule.assertBuildStatus(Result.SUCCESS, build);
}

Expand Down

0 comments on commit e0aaa7f

Please sign in to comment.