use of org.jenkinsci.test.acceptance.plugins.warnings.WarningsPublisher in project acceptance-test-harness by jenkinsci.
the class WarningsPluginTest method assertThatCodeNarcActionExists.
private void assertThatCodeNarcActionExists(FreeStyleJob job) {
job.configure();
job.copyResource(resource(RESOURCE_CODE_NARC_REPORT_PATH));
WarningsPublisher warningsPublisher = job.addPublisher(WarningsPublisher.class);
warningsPublisher.addWorkspaceFileScanner("Codenarc", RESOURCE_CODE_NARC_REPORT);
job.save();
Build build = job.startBuild().shouldSucceed();
assertThatActionExists(job, build, "Codenarc Warnings");
}
use of org.jenkinsci.test.acceptance.plugins.warnings.WarningsPublisher in project acceptance-test-harness by jenkinsci.
the class WarningsPluginTest method should_scan_console_log_of_slave_build.
@Test
@WithDocker
@WithCredentials(credentialType = WithCredentials.SSH_USERNAME_PRIVATE_KEY, values = { CREDENTIALS_ID, CREDENTIALS_KEY })
@WithPlugins("ssh-slaves")
public void should_scan_console_log_of_slave_build() throws ExecutionException, InterruptedException {
DumbSlave dockerSlave = createDockerAgent();
FreeStyleJob job = prepareDockerSlave(dockerSlave);
job.configure();
job.copyResource(resource(RESOURCE_WARNING_MAIN_JAVA_PATH));
ShellBuildStep shellBuildStep = job.addBuildStep(ShellBuildStep.class);
shellBuildStep.command(CMD_WARNING_MAIN_JAVA_CONSOLE);
WarningsPublisher warningsPublisher = job.addPublisher(WarningsPublisher.class);
warningsPublisher.addConsoleScanner(JAVA_ID);
job.save();
Build build = job.startBuild().shouldSucceed();
assertThatActionExists(job, build, "Java Warnings");
WarningsAction action = createJavaResultAction(build);
assertThatWarningsCountInSummaryIs(action, 3);
String codeLine = action.getLinkedSourceFileText(AnalysisAction.Tab.DETAILS, "WarningMain.java", 10);
String[] codeLineArr = codeLine.trim().split("\\s+", 2);
assertThat("Warning should be at line", codeLineArr[0], is("10"));
assertThat("Assert failed comparing code line is", codeLineArr[1], is("text = (TextClass) text2;"));
}
use of org.jenkinsci.test.acceptance.plugins.warnings.WarningsPublisher in project acceptance-test-harness by jenkinsci.
the class WarningsPluginTest method createAndBuildCompileJobOnAgent.
private WarningsAction createAndBuildCompileJobOnAgent(Resource resource, String command) {
DumbSlave dockerSlave = createDockerAgent();
FreeStyleJob job = prepareDockerSlave(dockerSlave);
job.configure();
job.copyResource(resource);
ShellBuildStep shellBuildStep = job.addBuildStep(ShellBuildStep.class);
shellBuildStep.command(command);
WarningsPublisher warningsPublisher = job.addPublisher(WarningsPublisher.class);
warningsPublisher.addConsoleScanner(JAVA_ID);
job.save();
Build build = buildSuccessfulJob(job);
assertThatActionExists(job, build, "Java Warnings");
WarningsAction action = createJavaResultAction(build);
action.open();
return action;
}
Aggregations