Skip to content
Permalink
Browse files

Merge pull request #1977 from jglick/refactor-test-harness

[JENKINS-32478] Split of test harness into separate artifact
  • Loading branch information...
jglick committed Jan 15, 2016
2 parents a2a4f1a + 7493468 commit c87cd281baa04ac20588978bffccfc5c5d441fdc
Showing with 596 additions and 1,099 deletions.
  1. +2 −0 pom.xml
  2. +52 −0 test-harness-tools/pom.xml
  3. +135 −0 test-harness-tools/src/main/java/org/jvnet/hudson/test/ToolInstallations.java
  4. BIN {test → test-harness-tools}/src/main/resources/apache-ant-1.8.1-bin.zip
  5. BIN {test → test-harness-tools}/src/main/resources/apache-maven-2.2.1-bin.zip
  6. BIN {test → test-harness-tools}/src/main/resources/apache-maven-3.0.1-bin.zip
  7. BIN {test → test-harness-tools}/src/main/resources/apache-maven-3.1.0-bin.zip
  8. BIN {test → test-harness-tools}/src/main/resources/maven-2.0.7-bin.zip
  9. +185 −0 test-harness/pom.xml
  10. 0 {test → test-harness}/src/main/java/com/gargoylesoftware/htmlunit/README.md
  11. 0 {test → test-harness}/src/main/java/com/gargoylesoftware/htmlunit/WebClientUtil.java
  12. 0 {test → test-harness}/src/main/java/com/gargoylesoftware/htmlunit/WebResponseListener.java
  13. 0 {test → test-harness}/src/main/java/com/gargoylesoftware/htmlunit/html/DomNodeUtil.java
  14. 0 {test → test-harness}/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlElementUtil.java
  15. 0 {test → test-harness}/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlFormUtil.java
  16. +37 −7 {test → test-harness}/src/main/java/hudson/cli/CLICommandInvoker.java
  17. 0 {test → test-harness}/src/main/java/hudson/util/SecretHelper.java
  18. 0 {test → test-harness}/src/main/java/jenkins/model/JenkinsAdaptor.java
  19. 0 {test → test-harness}/src/main/java/jenkins/model/WorkspaceWriter.java
  20. 0 {test → test-harness}/src/main/java/org/jvnet/hudson/test/BuildWatcher.java
  21. 0 {test → test-harness}/src/main/java/org/jvnet/hudson/test/CaptureEnvironmentBuilder.java
  22. 0 {test → test-harness}/src/main/java/org/jvnet/hudson/test/ChannelShutdownListener.java
  23. 0 {test → test-harness}/src/main/java/org/jvnet/hudson/test/ClosureExecuterAction.java
  24. +6 −1 {test → test-harness}/src/main/java/org/jvnet/hudson/test/ComputerConnectorTester.java
  25. 0 {test → test-harness}/src/main/java/org/jvnet/hudson/test/CreateFileBuilder.java
  26. 0 {test → test-harness}/src/main/java/org/jvnet/hudson/test/DefaultConstructorChecker.java
  27. 0 {test → test-harness}/src/main/java/org/jvnet/hudson/test/EndOfTestListener.java
  28. 0 {test → test-harness}/src/main/java/org/jvnet/hudson/test/ExtractChangeLogParser.java
  29. 0 {test → test-harness}/src/main/java/org/jvnet/hudson/test/ExtractChangeLogSet.java
  30. 0 {test → test-harness}/src/main/java/org/jvnet/hudson/test/ExtractResourceSCM.java
  31. +6 −1 {test → test-harness}/src/main/java/org/jvnet/hudson/test/ExtractResourceWithChangesSCM.java
  32. +5 −0 {test → test-harness}/src/main/java/org/jvnet/hudson/test/FailureBuilder.java
  33. +6 −1 {test → test-harness}/src/main/java/org/jvnet/hudson/test/FakeChangeLogSCM.java
  34. 0 {test → test-harness}/src/main/java/org/jvnet/hudson/test/FakeLauncher.java
  35. 0 {test → test-harness}/src/main/java/org/jvnet/hudson/test/GroovyHudsonTestCase.java
  36. 0 {test → test-harness}/src/main/java/org/jvnet/hudson/test/GroovyJenkinsRule.java
  37. 0 {test → test-harness}/src/main/java/org/jvnet/hudson/test/HudsonHomeLoader.java
  38. 0 {test → test-harness}/src/main/java/org/jvnet/hudson/test/HudsonPageCreator.java
  39. +13 −151 {test → test-harness}/src/main/java/org/jvnet/hudson/test/HudsonTestCase.java
  40. 0 {test → test-harness}/src/main/java/org/jvnet/hudson/test/JavaNetReverseProxy.java
  41. 0 {test → test-harness}/src/main/java/org/jvnet/hudson/test/JellyTestSuiteBuilder.java
  42. +6 −1 {test → test-harness}/src/main/java/org/jvnet/hudson/test/JenkinsComputerConnectorTester.java
  43. 0 {test → test-harness}/src/main/java/org/jvnet/hudson/test/JenkinsMatchers.java
  44. 0 {test → test-harness}/src/main/java/org/jvnet/hudson/test/JenkinsRecipe.java
  45. +17 −143 {test → test-harness}/src/main/java/org/jvnet/hudson/test/JenkinsRule.java
  46. 0 {test → test-harness}/src/main/java/org/jvnet/hudson/test/LenientRunnable.java
  47. 0 {test → test-harness}/src/main/java/org/jvnet/hudson/test/MemoryAssert.java
  48. 0 {test → test-harness}/src/main/java/org/jvnet/hudson/test/MilliSecLogFormatter.java
  49. +5 −0 {test → test-harness}/src/main/java/org/jvnet/hudson/test/MockBuilder.java
  50. +5 −0 {test → test-harness}/src/main/java/org/jvnet/hudson/test/MockFolder.java
  51. +6 −1 {test → test-harness}/src/main/java/org/jvnet/hudson/test/MockQueueItemAuthenticator.java
  52. 0 {test → test-harness}/src/main/java/org/jvnet/hudson/test/NoListenerConfiguration.java
  53. 0 {test → test-harness}/src/main/java/org/jvnet/hudson/test/PluginAutomaticTestBuilder.java
  54. +6 −1 {test → test-harness}/src/main/java/org/jvnet/hudson/test/PretendSlave.java
  55. 0 {test → test-harness}/src/main/java/org/jvnet/hudson/test/PropertiesTestSuite.java
  56. 0 {test → test-harness}/src/main/java/org/jvnet/hudson/test/RandomlyFails.java
  57. 0 {test → test-harness}/src/main/java/org/jvnet/hudson/test/RestartableJenkinsRule.java
  58. 0 {test → test-harness}/src/main/java/org/jvnet/hudson/test/RunLoadCounter.java
  59. 0 {test → test-harness}/src/main/java/org/jvnet/hudson/test/SecuredMockFolder.java
  60. 0 {test → test-harness}/src/main/java/org/jvnet/hudson/test/SequenceLock.java
  61. 0 {test → test-harness}/src/main/java/org/jvnet/hudson/test/SingleFileSCM.java
  62. +6 −1 {test → test-harness}/src/main/java/org/jvnet/hudson/test/SleepBuilder.java
  63. 0 {test → test-harness}/src/main/java/org/jvnet/hudson/test/TemporaryDirectoryAllocator.java
  64. +5 −0 {test → test-harness}/src/main/java/org/jvnet/hudson/test/TestBuilder.java
  65. +5 −0 {test → test-harness}/src/main/java/org/jvnet/hudson/test/TestCrumbIssuer.java
  66. 0 {test → test-harness}/src/main/java/org/jvnet/hudson/test/TestEnvironment.java
  67. 0 {test → test-harness}/src/main/java/org/jvnet/hudson/test/TestExtension.java
  68. 0 {test → test-harness}/src/main/java/org/jvnet/hudson/test/TestExtensionLoader.java
  69. +4 −0 {test → test-harness}/src/main/java/org/jvnet/hudson/test/TestNotifier.java
  70. 0 {test → test-harness}/src/main/java/org/jvnet/hudson/test/TestPluginManager.java
  71. 0 {test → test-harness}/src/main/java/org/jvnet/hudson/test/ThreadPoolImpl.java
  72. 0 {test → test-harness}/src/main/java/org/jvnet/hudson/test/TouchBuilder.java
  73. +5 −0 {test → test-harness}/src/main/java/org/jvnet/hudson/test/UnstableBuilder.java
  74. 0 {test → test-harness}/src/main/java/org/jvnet/hudson/test/WarExploder.java
  75. 0 {test → test-harness}/src/main/java/org/jvnet/hudson/test/WithoutJenkins.java
  76. 0 {test → test-harness}/src/main/java/org/jvnet/hudson/test/WorkspaceCopyFileBuilder.java
  77. 0 {test → test-harness}/src/main/java/org/jvnet/hudson/test/junit/FailedTest.java
  78. 0 {test → test-harness}/src/main/java/org/jvnet/hudson/test/junit/GroupedTest.java
  79. 0 {test → test-harness}/src/main/java/org/jvnet/hudson/test/package-info.java
  80. 0 {test → test-harness}/src/main/java/org/jvnet/hudson/test/recipes/LocalData.java
  81. 0 {test → test-harness}/src/main/java/org/jvnet/hudson/test/recipes/PresetData.java
  82. 0 {test → test-harness}/src/main/java/org/jvnet/hudson/test/recipes/Recipe.java
  83. 0 {test → test-harness}/src/main/java/org/jvnet/hudson/test/recipes/WithPlugin.java
  84. 0 {test → test-harness}/src/main/java/org/jvnet/hudson/test/recipes/WithPluginManager.java
  85. 0 {test → test-harness}/src/main/java/org/jvnet/hudson/test/recipes/WithTimeout.java
  86. 0 {test → test-harness}/src/main/java/org/jvnet/hudson/test/recipes/package-info.java
  87. 0 {test → test-harness}/src/main/java/org/jvnet/hudson/test/rhino/CallStackFrame.java
  88. 0 {test → test-harness}/src/main/java/org/jvnet/hudson/test/rhino/JavaScriptDebugger.java
  89. 0 {test → test-harness}/src/main/java/org/jvnet/hudson/test/rhino/package-info.java
  90. 0 {test → test-harness}/src/main/preset-data/anonymous-readonly/config.xml
  91. 0 {test → test-harness}/src/main/preset-data/anonymous-readonly/readme.txt
  92. 0 {test → test-harness}/src/main/preset-data/no-anonymous-readaccess/config.xml
  93. 0 {test → test-harness}/src/main/preset-data/no-anonymous-readaccess/readme.txt
  94. +0 −1 {test → test-harness}/src/main/preset-data/package.groovy
  95. 0 {test → test-harness}/src/main/preset-data/readme.txt
  96. 0 {test → test-harness}/src/main/preset-data/secured-acegi/config.xml
  97. 0 {test → test-harness}/src/main/preset-data/secured-acegi/readme.txt
  98. 0 {test → test-harness}/src/main/preset-data/secured-acegi/users/alice/config.xml
  99. 0 ...t → test-harness}/src/main/resources/org/jvnet/hudson/test/CaptureEnvironmentBuilder/config.jelly
  100. 0 ... → test-harness}/src/main/resources/org/jvnet/hudson/test/ComputerConnectorTester/configure.jelly
  101. 0 ...harness}/src/main/resources/org/jvnet/hudson/test/ComputerConnectorTester/configure_es.properties
  102. 0 ...harness}/src/main/resources/org/jvnet/hudson/test/ComputerConnectorTester/configure_fr.properties
  103. 0 ...harness}/src/main/resources/org/jvnet/hudson/test/ComputerConnectorTester/configure_pt.properties
  104. 0 ...ness}/src/main/resources/org/jvnet/hudson/test/ComputerConnectorTester/configure_pt_BR.properties
  105. 0 ...ness}/src/main/resources/org/jvnet/hudson/test/ComputerConnectorTester/configure_zh_TW.properties
  106. 0 {test → test-harness}/src/main/resources/org/jvnet/hudson/test/FailureBuilder/config.jelly
  107. 0 {test → test-harness}/src/main/resources/org/jvnet/hudson/test/MockBuilder/config.jelly
  108. 0 {test → test-harness}/src/main/resources/org/jvnet/hudson/test/SleepBuilder/config.jelly
  109. 0 {test → test-harness}/src/main/resources/org/jvnet/hudson/test/SleepBuilder/config_pt.properties
  110. 0 {test → test-harness}/src/main/resources/org/jvnet/hudson/test/SleepBuilder/config_pt_BR.properties
  111. 0 {test → test-harness}/src/main/resources/org/jvnet/hudson/test/UnstableBuilder/config.jelly
  112. 0 {test → test-harness}/src/test/java/org/jvnet/hudson/main/AppTest.java
  113. 0 {test → test-harness}/src/test/java/org/jvnet/hudson/main/JenkinsRuleTimeoutTest.java
  114. 0 {test → test-harness}/src/test/java/org/jvnet/hudson/main/UseRecipesWithJenkinsRuleTest.java
  115. 0 {test → test-harness}/src/test/java/org/jvnet/hudson/test/HudsonTestCaseShutdownSlaveTest.java
  116. 0 {test → test-harness}/src/test/java/org/jvnet/hudson/test/JenkinsRuleTest.java
  117. 0 {test → test-harness}/src/test/java/org/jvnet/hudson/test/MemoryAssertTest.java
  118. 0 {test → test-harness}/src/test/java/org/jvnet/hudson/test/MockFolderTest.java
  119. 0 ...resources/org/jvnet/hudson/main/UseRecipesWithJenkinsRuleTest/testGetItemFromLocalData/config.xml
  120. 0 .../jvnet/hudson/main/UseRecipesWithJenkinsRuleTest/testGetItemFromLocalData/jobs/testJob/config.xml
  121. BIN {test/src/main → test-harness/src/test}/resources/plugins/tasks.jpi
  122. +22 −69 test/pom.xml
  123. +0 −12 test/src/main/preset-data/simple-projects/build.xml
  124. +0 −13 test/src/main/preset-data/simple-projects/pom.xml
  125. +0 −32 test/src/main/preset-data/svn-repo/conf/authz
  126. +0 −8 test/src/main/preset-data/svn-repo/conf/passwd
  127. +0 −47 test/src/main/preset-data/svn-repo/conf/svnserve.conf
  128. +0 −1 test/src/main/preset-data/svn-repo/db/current
  129. +0 −2 test/src/main/preset-data/svn-repo/db/format
  130. +0 −1 test/src/main/preset-data/svn-repo/db/fs-type
  131. +0 −5 test/src/main/preset-data/svn-repo/db/revprops/0/0
  132. +0 −13 test/src/main/preset-data/svn-repo/db/revprops/0/1
  133. +0 −11 test/src/main/preset-data/svn-repo/db/revs/0/0
  134. BIN test/src/main/preset-data/svn-repo/db/revs/0/1
  135. +0 −1 test/src/main/preset-data/svn-repo/db/txn-current
  136. 0 test/src/main/preset-data/svn-repo/db/txn-current-lock
  137. +0 −1 test/src/main/preset-data/svn-repo/db/uuid
  138. 0 test/src/main/preset-data/svn-repo/db/write-lock
  139. +0 −1 test/src/main/preset-data/svn-repo/format
  140. +0 −51 test/src/main/preset-data/svn-repo/hooks/post-commit.tmpl
  141. +0 −45 test/src/main/preset-data/svn-repo/hooks/post-lock.tmpl
  142. +0 −57 test/src/main/preset-data/svn-repo/hooks/post-revprop-change.tmpl
  143. +0 −43 test/src/main/preset-data/svn-repo/hooks/post-unlock.tmpl
  144. +0 −71 test/src/main/preset-data/svn-repo/hooks/pre-commit.tmpl
  145. +0 −64 test/src/main/preset-data/svn-repo/hooks/pre-lock.tmpl
  146. +0 −66 test/src/main/preset-data/svn-repo/hooks/pre-revprop-change.tmpl
  147. +0 −61 test/src/main/preset-data/svn-repo/hooks/pre-unlock.tmpl
  148. +0 −65 test/src/main/preset-data/svn-repo/hooks/start-commit.tmpl
  149. +0 −3 test/src/main/preset-data/svn-repo/locks/db-logs.lock
  150. +0 −3 test/src/main/preset-data/svn-repo/locks/db.lock
  151. +0 −1 test/src/main/preset-data/svn-repo/readme.txt
  152. +1 −1 test/src/test/java/hudson/bugs/seasar/Operation2174Test.java
  153. 0 test/src/{main → test}/java/hudson/core/PluginManagerOverrideTest.java
  154. +1 −1 test/src/test/java/hudson/model/AutoCompletionCandidatesTest.java
  155. +4 −3 test/src/test/java/hudson/model/GetEnvironmentOutsideBuildTest.java
  156. +4 −2 test/src/test/java/hudson/model/HelpLinkTest.java
  157. +1 −2 test/src/test/java/hudson/model/ListViewTest.java
  158. +4 −4 test/src/test/java/hudson/model/NodeTest.java
  159. +4 −4 test/src/test/java/hudson/model/QueueTest.java
  160. +3 −3 test/src/test/java/hudson/model/ViewTest.java
  161. +3 −2 test/src/test/java/hudson/tasks/BuildTriggerTest.java
  162. +13 −3 test/src/test/java/hudson/tasks/EnvVarsInConfigTasksTest.java
  163. +1 −1 test/src/test/java/hudson/tasks/FingerprinterTest.java
  164. +4 −3 test/src/test/java/hudson/tasks/MavenTest.java
  165. +8 −4 test/src/test/java/hudson/tools/ToolLocationNodePropertyTest.java
  166. +1 −1 test/src/test/java/jenkins/model/JenkinsTest.java
  167. +4 −2 test/src/test/java/lib/hudson/ListScmBrowsersTest.java
  168. 0 ... → test}/resources/hudson/core/PluginManagerOverrideTest/BasicPluginManagerOverride/newview.jelly
  169. BIN test/src/{main → test}/resources/plugins/htmlpublisher.jpi
  170. BIN test/src/{main → test}/resources/plugins/legacy.hpi
  171. 0 test/src/{main → test}/resources/plugins/tasks-update-center.json
  172. BIN test/src/test/resources/plugins/tasks.jpi
  173. BIN test/src/test/resources/simple-projects.zip
  174. +1 −7 war/pom.xml
@@ -50,6 +50,8 @@ THE SOFTWARE.
<modules>
<module>core</module>
<module>war</module>
<module>test-harness</module>
<module>test-harness-tools</module>
<module>test</module>
<module>cli</module>
<module>plugins</module>
@@ -0,0 +1,52 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
The MIT License
Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.jenkins-ci.main</groupId>
<artifactId>pom</artifactId>
<version>1.645-SNAPSHOT</version>
</parent>

<artifactId>jenkins-test-harness-tools</artifactId>

<name>Test harness tools</name>
<description>Tool installations that may be used by functional tests.</description>

<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>jenkins-test-harness</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>ant</artifactId>
<version>1.2</version>
</dependency>
</dependencies>

</project>
@@ -0,0 +1,135 @@
/*
* The MIT License
*
* Copyright 2016 CloudBees, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package org.jvnet.hudson.test;

import hudson.FilePath;
import hudson.Functions;
import hudson.Launcher;
import hudson.tasks.Ant;
import hudson.tasks.Maven;
import hudson.util.StreamTaskListener;
import hudson.util.jna.GNUCLibrary;
import java.io.File;
import java.util.logging.Level;
import java.util.logging.Logger;
import jenkins.model.Jenkins;
import org.junit.rules.TemporaryFolder;

/**
* Utility to install standard tools in the Jenkins under test.
*/
public class ToolInstallations {

private static final Logger LOGGER = Logger.getLogger(ToolInstallations.class.getName());

/**
* Returns the older default Maven, while still allowing specification of
* other bundled Mavens.
*/
public static Maven.MavenInstallation configureDefaultMaven() throws Exception {
return configureDefaultMaven("apache-maven-2.2.1", Maven.MavenInstallation.MAVEN_20);
}

public static Maven.MavenInstallation configureMaven3() throws Exception {
Maven.MavenInstallation mvn = configureDefaultMaven("apache-maven-3.0.1", Maven.MavenInstallation.MAVEN_30);

Maven.MavenInstallation m3 = new Maven.MavenInstallation("apache-maven-3.0.1", mvn.getHome(), JenkinsRule.NO_PROPERTIES);
Jenkins.getInstance().getDescriptorByType(Maven.DescriptorImpl.class).setInstallations(m3);
return m3;
}

/**
* Locates Maven2 and configure that as the only Maven in the system.
*/
public static Maven.MavenInstallation configureDefaultMaven(String mavenVersion, int mavenReqVersion) throws Exception {
// first if we are running inside Maven, pick that Maven, if it meets the criteria we require..
File buildDirectory = new File(System.getProperty("buildDirectory", "target")); // TODO relative path
File mvnHome = new File(buildDirectory, mavenVersion);
if (mvnHome.exists()) {
Maven.MavenInstallation mavenInstallation = new Maven.MavenInstallation("default", mvnHome.getAbsolutePath(), JenkinsRule.NO_PROPERTIES);
Jenkins.getInstance().getDescriptorByType(Maven.DescriptorImpl.class).setInstallations(mavenInstallation);
return mavenInstallation;
}

// Does maven.home point to a Maven installation which satisfies mavenReqVersion?
String home = System.getProperty("maven.home");
if (home != null) {
Maven.MavenInstallation mavenInstallation = new Maven.MavenInstallation("default", home, JenkinsRule.NO_PROPERTIES);
if (mavenInstallation.meetsMavenReqVersion(new Launcher.LocalLauncher(StreamTaskListener.fromStdout()), mavenReqVersion)) {
Jenkins.getInstance().getDescriptorByType(Maven.DescriptorImpl.class).setInstallations(mavenInstallation);
return mavenInstallation;
}
}

// otherwise extract the copy we have.
// this happens when a test is invoked from an IDE, for example.
LOGGER.log(Level.WARNING,"Extracting a copy of Maven bundled in the test harness into {0}. "
+ "To avoid a performance hit, set the system property ''maven.home'' to point to a Maven2 installation.", mvnHome);
FilePath mvn = Jenkins.getInstance().getRootPath().createTempFile("maven", "zip");
mvn.copyFrom(JenkinsRule.class.getClassLoader().getResource(mavenVersion + "-bin.zip"));
mvn.unzip(new FilePath(buildDirectory));
// TODO: switch to tar that preserves file permissions more easily
try {
GNUCLibrary.LIBC.chmod(new File(mvnHome, "bin/mvn").getPath(), 0755);
} catch (LinkageError x) {
// skip; TODO 1.630+ can use Functions.isGlibcSupported
}

Maven.MavenInstallation mavenInstallation = new Maven.MavenInstallation("default",
mvnHome.getAbsolutePath(), JenkinsRule.NO_PROPERTIES);
Jenkins.getInstance().getDescriptorByType(Maven.DescriptorImpl.class).setInstallations(mavenInstallation);
return mavenInstallation;
}

/**
* Extracts Ant and configures it.
*/
public static Ant.AntInstallation configureDefaultAnt(TemporaryFolder tmp) throws Exception {
Ant.AntInstallation antInstallation;
if (System.getenv("ANT_HOME") != null) {
antInstallation = new Ant.AntInstallation("default", System.getenv("ANT_HOME"), JenkinsRule.NO_PROPERTIES);
} else {
LOGGER.warning("Extracting a copy of Ant bundled in the test harness. "
+ "To avoid a performance hit, set the environment variable ANT_HOME to point to an Ant installation.");
FilePath ant = Jenkins.getInstance().getRootPath().createTempFile("ant", "zip");
ant.copyFrom(JenkinsRule.class.getClassLoader().getResource("apache-ant-1.8.1-bin.zip"));
File antHome = tmp.newFolder("antHome");
ant.unzip(new FilePath(antHome));
// TODO: switch to tar that preserves file permissions more easily
try {
GNUCLibrary.LIBC.chmod(new File(antHome, "apache-ant-1.8.1/bin/ant").getPath(), 0755);
} catch (LinkageError x) {
// skip; TODO 1.630+ can use Functions.isGlibcSupported
}

antInstallation = new Ant.AntInstallation("default", new File(antHome, "apache-ant-1.8.1").getAbsolutePath(), JenkinsRule.NO_PROPERTIES);
}
Jenkins.getInstance().getDescriptorByType(Ant.DescriptorImpl.class).setInstallations(antInstallation);
return antInstallation;
}

private ToolInstallations() {
}

}
File renamed without changes.
@@ -0,0 +1,185 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
The MIT License
Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.jenkins-ci.main</groupId>
<artifactId>pom</artifactId>
<version>1.645-SNAPSHOT</version>
</parent>

<artifactId>jenkins-test-harness</artifactId>

<name>Test harness for Jenkins and plugins</name>
<description>Harness used to run functional tests of Jenkins core and plugins.</description>

<dependencies>
<dependency>
<!--
put hudson.war in the classpath. we can't pull in the war artifact directly
because Maven excludes all wars from classpath automatically. so we need a jar artifact.
-->
<groupId>${project.groupId}</groupId>
<artifactId>jenkins-war</artifactId>
<version>1.580.1</version>
<classifier>war-for-test</classifier>
<exclusions>
<exclusion>
<groupId>org.jenkins-ci.modules</groupId>
<artifactId>sshd</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty</artifactId>
<version>6.1.26</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-library</artifactId>
<version>1.3</version>
</dependency>
<dependency>
<groupId>net.sourceforge.htmlunit</groupId>
<artifactId>htmlunit</artifactId>
<version>2.18</version>
<exclusions>
<exclusion>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.jvnet.hudson</groupId>
<artifactId>embedded-rhino-debugger</artifactId>
<version>1.2</version>
<exclusions>
<exclusion>
<groupId>org.jvnet.hudson</groupId>
<artifactId>htmlunit-core-js</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.netbeans.modules</groupId>
<artifactId>org-netbeans-insane</artifactId>
<version>RELEASE72</version>
</dependency>
<dependency>
<groupId>com.github.stephenc.findbugs</groupId>
<artifactId>findbugs-annotations</artifactId>
<version>1.3.9-1</version>
</dependency>
<dependency> <!-- TODO can we switch this to use Aether directly? -->
<groupId>org.jenkins-ci.lib</groupId>
<artifactId>lib-jenkins-maven-embedder</artifactId>
<version>3.11</version>
<exclusions>
<exclusion>
<groupId>org.sonatype.sisu</groupId>
<artifactId>sisu-guice</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>matrix-auth</artifactId>
<version>1.0.2</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.kohsuke.stapler</groupId>
<artifactId>maven-stapler-plugin</artifactId>
<!-- version specified in grandparent pom -->
<extensions>true</extensions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<!-- version specified in grandparent pom -->
<configuration>
<argLine>-Dfile.encoding=UTF-8 -Xmx256m -XX:MaxPermSize=128m</argLine>
<systemPropertyVariables>
<!-- use AntClassLoader that supports predictable file handle release -->
<hudson.ClassicPluginStrategy.useAntClassLoader>true</hudson.ClassicPluginStrategy.useAntClassLoader>
<hudson.maven.debug>${mavenDebug}</hudson.maven.debug>
<buildDirectory>${project.build.directory}</buildDirectory>
<ignore.random.failures>${ignore.random.failures}</ignore.random.failures>
</systemPropertyVariables>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.gmaven</groupId>
<artifactId>gmaven-plugin</artifactId>
<!-- version specified in grandparent pom -->
<executions>
<execution>
<id>preset-packager</id>
<phase>process-resources</phase>
<goals>
<goal>execute</goal>
</goals>
<configuration>
<source>${pom.basedir}/src/main/preset-data/package.groovy</source>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant</artifactId>
<version>1.8.0</version>
</dependency>
<!-- Usually a dependency of ant, but some people seem to have an incomplete ant POM. See JENKINS-11416 -->
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant-launcher</artifactId>
<version>1.8.0</version>
</dependency>
<dependency>
<groupId>org.codehaus.gmaven.runtime</groupId>
<artifactId>gmaven-runtime-2.0</artifactId>
<version>1.5-jenkins-1</version>
</dependency>
</dependencies>
<configuration>
<providerSelection>2.0</providerSelection>
</configuration>
</plugin>
</plugins>
</build>

</project>

0 comments on commit c87cd28

Please sign in to comment.
You can’t perform that action at this time.