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));
}
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));
}
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;
}
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);
}
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");
}
Aggregations