use of org.jenkinsci.test.acceptance.po.Job in project acceptance-test-harness by jenkinsci.
the class AnalysisCollectorPluginTest method addAndConfigureTasksPublisher.
private void addAndConfigureTasksPublisher(final FreeStyleJob job) {
TasksFreestyleSettings taskScannerSettings = job.addPublisher(TasksFreestyleSettings.class);
AnalysisConfigurator<TasksFreestyleSettings> configurator = settings -> {
settings.setHighPriorityTags("PRIO1");
settings.setNormalPriorityTags("PRIO2,TODO");
settings.setLowPriorityTags("PRIO3");
};
configurator.accept(taskScannerSettings);
}
use of org.jenkinsci.test.acceptance.po.Job in project acceptance-test-harness by jenkinsci.
the class AnalysisCollectorPluginTest method addAndConfigureWarningsPublisher.
private void addAndConfigureWarningsPublisher(final FreeStyleJob job) {
WarningsBuildSettings warningsSettings = job.addPublisher(WarningsBuildSettings.class);
AnalysisConfigurator<WarningsBuildSettings> warningsConfigurator = settings -> {
settings.addWorkspaceScanner("Java Compiler (javac)", "**/*");
settings.addWorkspaceScanner("JavaDoc Tool", "**/*");
settings.addWorkspaceScanner("MSBuild", "**/*");
};
warningsConfigurator.accept(warningsSettings);
}
use of org.jenkinsci.test.acceptance.po.Job in project acceptance-test-harness by jenkinsci.
the class JobDslPluginTest method job_filters_status_failed_exclude_unmatched.
/**
* This test creates a job and runs a build which fails. Afterwards 4 new jobs get created as well as a listView.
* The job filter of the listView is set to not show jobs which build status is not 'FAILED'.
*/
@Test
@WithPlugins("view-job-filters")
public void job_filters_status_failed_exclude_unmatched() {
Job failedJob = createJobThatFails();
List<Job> jobs = createAmountOfJobs(4, true);
String jobDslScript = "listView('" + LIST_VIEW_NAME + "') {\n" + " columns {\n" + " name()\n" + " }\n" + " jobs{\n" + " names('" + failedJob.name + "','" + jobs.get(0).name + "','" + jobs.get(1).name + "','" + jobs.get(2).name + "','" + jobs.get(3).name + "')\n" + " }\n" + " jobFilters {\n" + " status {\n" + " matchType(MatchType.EXCLUDE_UNMATCHED)\n" + " status(Status.FAILED)\n" + " }\n" + " }\n" + "}";
View view = openNewlyCreatedListView(jobDslScript, LIST_VIEW_NAME);
assertThat(view, containsJob(failedJob));
assertThat(view, not(containsJob(jobs.get(0))));
assertThat(view, not(containsJob(jobs.get(1))));
assertThat(view, not(containsJob(jobs.get(2))));
assertThat(view, not(containsJob(jobs.get(3))));
}
use of org.jenkinsci.test.acceptance.po.Job in project acceptance-test-harness by jenkinsci.
the class JobDslPluginTest method job_filters_regex_name_include_unmatched.
/**
* This test creates a listView and 4 jobs. The job filters are checking the name with a regex and
* jobs not matching the regex are included in the listView.
*/
@Test
@WithPlugins("view-job-filters")
public void job_filters_regex_name_include_unmatched() {
Job job1 = createJobWithName(EXAMPLE_DISABLED_NAME);
Job job2 = createJobWithName(EXAMPLE_ENABLED_NAME);
List<Job> jobs = createAmountOfJobs(2, false);
String jobDslScript = "listView('" + LIST_VIEW_NAME + "') {\n" + " columns {\n" + " name()\n" + " }\n" + " jobFilters {\n" + " regex {\n" + " matchType(MatchType.INCLUDE_UNMATCHED)\n" + " matchValue(RegexMatchValue.NAME)\n" + " regex('" + LIST_VIEW_REGEX + "')\n" + " }\n" + " }\n" + "}";
View view = openNewlyCreatedListView(jobDslScript, LIST_VIEW_NAME);
assertThat(view, not(containsJob(job1)));
assertThat(view, not(containsJob(job2)));
assertThat(view, containsJob(jobs.get(0)));
assertThat(view, containsJob(jobs.get(1)));
}
use of org.jenkinsci.test.acceptance.po.Job in project acceptance-test-harness by jenkinsci.
the class JobDslPluginTest method should_create_two_jobs_if_first_has_own_dsl.
/**
* Tests whether a first job generated by JobDsl and a second job that is specified
* in first jobs dsl are created when the seed job is build.
*/
@Test
public void should_create_two_jobs_if_first_has_own_dsl() {
// Arrange
String firstJobName = "Level1Job";
String secondJobName = "Level2Job";
String jobDslScript = String.format("job('%s') { steps { dsl { job('%s') } } }", firstJobName, secondJobName);
Job seed = createSeedJobWithJobDsl(jobDslScript);
// Act
seed.startBuild().waitUntilFinished();
// Assert
Job firstJob = jenkins.jobs.get(Job.class, firstJobName);
Job secondJob = jenkins.jobs.get(Job.class, secondJobName);
assertThat(firstJob, pageObjectExists());
assertThat(secondJob, pageObjectExists());
}
Aggregations