Search in sources :

Example 6 with WarningsAction

use of org.jenkinsci.test.acceptance.plugins.warnings.WarningsAction in project acceptance-test-harness by jenkinsci.

the class WarningsPluginTest method assertThatFoldersTabIsCorrectlyFilled.

private void assertThatFoldersTabIsCorrectlyFilled(final MatrixProject job) {
    SortedMap<String, Integer> expectedConfigurationDetails = new TreeMap<>();
    expectedConfigurationDetails.put("axis/one", 4);
    expectedConfigurationDetails.put("axis/two", 6);
    expectedConfigurationDetails.put("axis/three", 2);
    WarningsAction action = createJavaProjectAction(job);
    assertThat(action.getPackagesTabContents(), is(expectedConfigurationDetails));
}
Also used : CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) WarningsAction(org.jenkinsci.test.acceptance.plugins.warnings.WarningsAction)

Example 7 with WarningsAction

use of org.jenkinsci.test.acceptance.plugins.warnings.WarningsAction in project acceptance-test-harness by jenkinsci.

the class WarningsPluginTest method assertThatFilesTabIsCorrectlyFilled.

private void assertThatFilesTabIsCorrectlyFilled(final MatrixProject job) {
    SortedMap<String, Integer> expectedConfigurationDetails = new TreeMap<>();
    WarningsAction action = createJavaProjectAction(job);
    expectedConfigurationDetails.put("FileOne.c", 4);
    expectedConfigurationDetails.put("FileTwo.c", 6);
    expectedConfigurationDetails.put("FileThree.c", 2);
    assertThat(action.getFileTabContents(), is(expectedConfigurationDetails));
}
Also used : CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) WarningsAction(org.jenkinsci.test.acceptance.plugins.warnings.WarningsAction)

Example 8 with WarningsAction

use of org.jenkinsci.test.acceptance.plugins.warnings.WarningsAction 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)

Example 9 with WarningsAction

use of org.jenkinsci.test.acceptance.plugins.warnings.WarningsAction in project acceptance-test-harness by jenkinsci.

the class WarningsPluginTest method should_skip_warnings_in_ignored_parts.

/**
 * Checks whether the warnings plugin picks only specific warnings. The warnings to exclude are given by three
 * exclude patterns {".*ignore1.*, .*ignore2.*, .*default.*"}. The result should be a build with 4 Java Warnings
 * (from a file that contains 9 warnings).
 */
@Test
public void should_skip_warnings_in_ignored_parts() {
    FreeStyleJob job = createFreeStyleJob(WARNINGS_FILE_FOR_INCLUDE_EXCLUDE_TESTS, settings -> {
        settings.addWorkspaceScanner(JAVA_TITLE, "**/*");
        settings.setIncludePattern(".*/.*");
        settings.setExcludePattern(".*/ignore1/.*, .*/ignore2/.*, .*/default/.*");
    });
    Build build = buildSuccessfulJob(job);
    assertThatActionExists(job, build, "Java Warnings");
    WarningsAction action = createJavaResultAction(build);
    assertThatWarningsCountInSummaryIs(action, 4);
    assertThatNewWarningsCountInSummaryIs(action, 4);
}
Also used : Build(org.jenkinsci.test.acceptance.po.Build) FreeStyleJob(org.jenkinsci.test.acceptance.po.FreeStyleJob) WarningsAction(org.jenkinsci.test.acceptance.plugins.warnings.WarningsAction) Test(org.junit.Test)

Example 10 with WarningsAction

use of org.jenkinsci.test.acceptance.plugins.warnings.WarningsAction in project acceptance-test-harness by jenkinsci.

the class WarningsPluginTest method detailsTabContentWithOneWarningTest.

@Test
@WithDocker
@WithCredentials(credentialType = WithCredentials.SSH_USERNAME_PRIVATE_KEY, values = { CREDENTIALS_ID, CREDENTIALS_KEY })
@WithPlugins("ssh-slaves")
public void detailsTabContentWithOneWarningTest() throws ExecutionException, InterruptedException {
    WarningsAction action = createAndBuildCompileJobOnAgent(resource("/warnings_plugin/WarningMain2.java"), "javac -Xlint:all WarningMain2.java");
    SortedMap<String, String> details = action.getDetailsTabContents();
    assertThat("Assert the proper detail count.", details.entrySet(), hasSize(1));
    assertThatDetailsAre(details, "redundant cast to TextClass", "WarningMain2.java:9");
}
Also used : WarningsAction(org.jenkinsci.test.acceptance.plugins.warnings.WarningsAction) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) 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)

Aggregations

WarningsAction (org.jenkinsci.test.acceptance.plugins.warnings.WarningsAction)14 Test (org.junit.Test)10 FreeStyleJob (org.jenkinsci.test.acceptance.po.FreeStyleJob)9 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)8 Build (org.jenkinsci.test.acceptance.po.Build)8 WithPlugins (org.jenkinsci.test.acceptance.junit.WithPlugins)5 WithCredentials (org.jenkinsci.test.acceptance.junit.WithCredentials)3 WithDocker (org.jenkinsci.test.acceptance.junit.WithDocker)3 Issue (org.jvnet.hudson.test.Issue)3 WarningsPublisher (org.jenkinsci.test.acceptance.plugins.warnings.WarningsPublisher)2 DumbSlave (org.jenkinsci.test.acceptance.po.DumbSlave)2 ShellBuildStep (org.jenkinsci.test.acceptance.po.ShellBuildStep)2 Ignore (org.junit.Ignore)1 WebElement (org.openqa.selenium.WebElement)1