Index: src/test/java/io/jenkins/plugins/analysis/warnings/MavenProjectQualityGateITest.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>ISO-8859-1 =================================================================== --- src/test/java/io/jenkins/plugins/analysis/warnings/MavenProjectQualityGateITest.java (date 1527083251000) +++ src/test/java/io/jenkins/plugins/analysis/warnings/MavenProjectQualityGateITest.java (date 1527088445000) @@ -2,7 +2,14 @@ import java.io.IOException; +import org.junit.Before; +import org.jvnet.hudson.test.ToolInstallations; + +import hudson.FilePath; import hudson.maven.MavenModuleSet; +import hudson.model.TopLevelItem; +import hudson.tasks.Maven; +import hudson.tasks.Maven.MavenInstallation; /** * Integration tests of {@link hudson.maven.MavenModuleSet} with {@link io.jenkins.plugins.analysis.core.quality.QualityGate}. @@ -10,11 +17,18 @@ * @author Michaela Reitschuster */ public class MavenProjectQualityGateITest extends AbstractQualityGateITest { + @Before + public void initializeMaven() throws Exception { + MavenInstallation mvn = ToolInstallations.configureMaven35(); + MavenInstallation m3 = new MavenInstallation("apache-maven-3.3.9", mvn.getHome(), j.NO_PROPERTIES); + j.jenkins.getDescriptorByType(Maven.DescriptorImpl.class).setInstallations(m3); + } @Override protected MavenModuleSet getProject() { MavenModuleSet project = createJob(); copyFilesToWorkspace(project, "checkstyle-qualitygate.xml"); + copyToWorkspace(project, "pom.xml"); return project; } @@ -26,4 +40,25 @@ throw new AssertionError(e); } } + + /** + * Copies the specified files to the workspace. + * + * @param job + * the job to get the workspace for + * @param fileNames + * the files to copy + */ + private void copyToWorkspace(final TopLevelItem job, final String... fileNames) { + try { + FilePath workspace = j.jenkins.getWorkspaceFor(job); + for (String fileName : fileNames) { + workspace.child(fileName).copyFrom(asInputStream(fileName)); + } + } + catch (IOException | InterruptedException e) { + throw new AssertionError(e); + } + } + } Index: src/test/resources/io/jenkins/plugins/analysis/warnings/pom.xml IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- src/test/resources/io/jenkins/plugins/analysis/warnings/pom.xml (date 1527088147000) +++ src/test/resources/io/jenkins/plugins/analysis/warnings/pom.xml (date 1527088147000) @@ -0,0 +1,12 @@ + + 4.0.0 + + warnings-test + jar + Warnings Plug-in Test + 0.0.1-SNAPSHOT + org.jvnet.hudson.plugins + + + Index: pom.xml IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- pom.xml (date 1527083251000) +++ pom.xml (date 1527087817000) @@ -97,6 +97,12 @@ + + org.jenkins-ci.main + jenkins-test-harness-tools + 2.2 + test + org.jvnet.hudson.plugins analysis-test