Search in sources :

Example 1 with WarningsPublisher

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");
}
Also used : Build(org.jenkinsci.test.acceptance.po.Build) WarningsPublisher(org.jenkinsci.test.acceptance.plugins.warnings.WarningsPublisher)

Example 2 with WarningsPublisher

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;"));
}
Also used : Build(org.jenkinsci.test.acceptance.po.Build) WarningsPublisher(org.jenkinsci.test.acceptance.plugins.warnings.WarningsPublisher) ShellBuildStep(org.jenkinsci.test.acceptance.po.ShellBuildStep) FreeStyleJob(org.jenkinsci.test.acceptance.po.FreeStyleJob) WarningsAction(org.jenkinsci.test.acceptance.plugins.warnings.WarningsAction) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) DumbSlave(org.jenkinsci.test.acceptance.po.DumbSlave) WithCredentials(org.jenkinsci.test.acceptance.junit.WithCredentials) Test(org.junit.Test) WithPlugins(org.jenkinsci.test.acceptance.junit.WithPlugins) WithDocker(org.jenkinsci.test.acceptance.junit.WithDocker)

Example 3 with WarningsPublisher

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;
}
Also used : Build(org.jenkinsci.test.acceptance.po.Build) WarningsPublisher(org.jenkinsci.test.acceptance.plugins.warnings.WarningsPublisher) ShellBuildStep(org.jenkinsci.test.acceptance.po.ShellBuildStep) FreeStyleJob(org.jenkinsci.test.acceptance.po.FreeStyleJob) WarningsAction(org.jenkinsci.test.acceptance.plugins.warnings.WarningsAction) DumbSlave(org.jenkinsci.test.acceptance.po.DumbSlave)

Aggregations

WarningsPublisher (org.jenkinsci.test.acceptance.plugins.warnings.WarningsPublisher)3 Build (org.jenkinsci.test.acceptance.po.Build)3 WarningsAction (org.jenkinsci.test.acceptance.plugins.warnings.WarningsAction)2 DumbSlave (org.jenkinsci.test.acceptance.po.DumbSlave)2 FreeStyleJob (org.jenkinsci.test.acceptance.po.FreeStyleJob)2 ShellBuildStep (org.jenkinsci.test.acceptance.po.ShellBuildStep)2 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)1 WithCredentials (org.jenkinsci.test.acceptance.junit.WithCredentials)1 WithDocker (org.jenkinsci.test.acceptance.junit.WithDocker)1 WithPlugins (org.jenkinsci.test.acceptance.junit.WithPlugins)1 Test (org.junit.Test)1