use of org.jenkinsci.test.acceptance.plugins.maven.MavenBuildStep in project acceptance-test-harness by jenkinsci.
the class AbstractAnalysisTest method setMavenGoal.
public void setMavenGoal(final FreeStyleJob job, final String goal) {
MavenInstallation.ensureThatMavenIsInstalled(jenkins);
job.configure(() -> {
MavenBuildStep maven = job.addBuildStep(MavenBuildStep.class);
maven.setGoals(goal);
maven.useDefaultMavenVersion();
});
}
use of org.jenkinsci.test.acceptance.plugins.maven.MavenBuildStep in project acceptance-test-harness by jenkinsci.
the class JacocoPluginTest method checkSuccessfulExecutionAndsummary.
@Test
public void checkSuccessfulExecutionAndsummary() {
MavenInstallation.installSomeMaven(jenkins);
FreeStyleJob job = jenkins.jobs.create();
{
job.copyDir(resource("/jacoco/test"));
MavenBuildStep maven = job.addBuildStep(MavenBuildStep.class);
maven.targets.set("clean package -B");
maven.properties("jacoco.version=" + getJacocoLibraryVersion(), true);
JacocoPublisher publisher = job.addPublisher(JacocoPublisher.class);
publisher.changeBuildStatus.check();
}
job.save();
Build build = job.startBuild().waitUntilFinished().shouldSucceed();
assertThat(build, hasAction("Coverage Report"));
JacocoResultPage total = new JacocoResultPage(build);
assertEquals(45.45, total.instructionCoverage(), 0.01);
assertEquals(50.0, total.branchCoverage(), 0.01);
assertEquals(33.33, total.complexityScore(), 0.01);
assertEquals(50.0, total.lineCoverage(), 0.01);
assertEquals(50.0, total.methodCoverage(), 0.01);
assertEquals(100.0, total.classCoverage(), 0.01);
JacocoResultPage pkg = new JacocoResultPage(total, "(default)/App");
assertEquals(45.45, pkg.instructionCoverage(), 0.01);
assertEquals(50.0, pkg.branchCoverage(), 0.01);
assertEquals(33.33, pkg.complexityScore(), 0.01);
assertEquals(50.0, pkg.lineCoverage(), 0.01);
assertEquals(50.0, pkg.methodCoverage(), 0.01);
assertEquals(100.0, pkg.classCoverage(), 0.01);
}
use of org.jenkinsci.test.acceptance.plugins.maven.MavenBuildStep in project acceptance-test-harness by jenkinsci.
the class JavadocPluginTest method setup.
private void setup(Job job) {
// https://wiki.jenkins.io/display/JENKINS/Configuring+Content+Security+Policy#ConfiguringContentSecurityPolicy-JavadocPlugin
jenkins.runScript("System.setProperty('hudson.model.DirectoryBrowserSupport.CSP', \"default-src 'none'; img-src 'self'; style-src 'self'; child-src 'self'; frame-src 'self';\")");
job.configure();
MavenBuildStep m = job.addBuildStep(MavenBuildStep.class);
m.targets.set("archetype:generate -DarchetypeGroupId=org.apache.maven.archetypes -DgroupId=com.mycompany.app -DartifactId=my-app -Dversion=1.0 -B");
m = job.addBuildStep(MavenBuildStep.class);
m.targets.set("javadoc:javadoc -f my-app/pom.xml");
JavadocPublisher jd = job.addPublisher(JavadocPublisher.class);
jd.javadocDir.set("my-app/target/site/apidocs/");
job.save();
}
use of org.jenkinsci.test.acceptance.plugins.maven.MavenBuildStep in project acceptance-test-harness by jenkinsci.
the class MavenPluginTest method preserve_backslash_in_property.
@Test
@Issue("JENKINS-10539")
@Since("1.527")
public void preserve_backslash_in_property() {
installSomeMaven(jenkins);
FreeStyleJob job = jenkins.jobs.create(FreeStyleJob.class);
job.configure();
job.addParameter(StringParameter.class).setName("CMD");
job.addParameter(StringParameter.class).setName("PROPERTY");
MavenBuildStep step = job.addBuildStep(MavenBuildStep.class);
step.targets.set(GENERATE + " -Dcmdline.property=$CMD");
step.properties("property.property=$PROPERTY", true);
job.save();
Map<String, String> params = new HashMap<>();
params.put("CMD", "\"C:\\\\System\"");
params.put("PROPERTY", "C:\\Windows");
job.startBuild(params).shouldSucceed().shouldContainsConsoleOutput("cmdline.property=C:\\\\System").shouldContainsConsoleOutput("property.property=C:\\\\Windows");
}
use of org.jenkinsci.test.acceptance.plugins.maven.MavenBuildStep in project acceptance-test-harness by jenkinsci.
the class MavenPluginTest method autoinstall_maven_for_freestyle_job.
@Test
public void autoinstall_maven_for_freestyle_job() {
installMaven(jenkins, "maven_3.6.3", "3.6.3");
FreeStyleJob job = jenkins.jobs.create();
job.configure();
MavenBuildStep step = job.addBuildStep(MavenBuildStep.class);
step.version.select("maven_3.6.3");
step.targets.set("-version");
job.save();
job.startBuild().shouldSucceed().shouldContainsConsoleOutput("Apache Maven 3.6.3");
}
Aggregations