diff --git a/pom.xml b/pom.xml index be2b7039bd..1c2f83a870 100644 --- a/pom.xml +++ b/pom.xml @@ -50,6 +50,8 @@ THE SOFTWARE. core war + test-harness + test-harness-tools test cli plugins diff --git a/test-harness-tools/pom.xml b/test-harness-tools/pom.xml new file mode 100644 index 0000000000..62206c9a54 --- /dev/null +++ b/test-harness-tools/pom.xml @@ -0,0 +1,52 @@ + + + + 4.0.0 + + + org.jenkins-ci.main + pom + 1.645-SNAPSHOT + + + jenkins-test-harness-tools + + Test harness tools + Tool installations that may be used by functional tests. + + + + ${project.groupId} + jenkins-test-harness + ${project.version} + + + org.jenkins-ci.plugins + ant + 1.2 + + + + diff --git a/test-harness-tools/src/main/java/org/jvnet/hudson/test/ToolInstallations.java b/test-harness-tools/src/main/java/org/jvnet/hudson/test/ToolInstallations.java new file mode 100644 index 0000000000..ccfe529ce6 --- /dev/null +++ b/test-harness-tools/src/main/java/org/jvnet/hudson/test/ToolInstallations.java @@ -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() { + } + +} diff --git a/test/src/main/resources/apache-ant-1.8.1-bin.zip b/test-harness-tools/src/main/resources/apache-ant-1.8.1-bin.zip similarity index 100% rename from test/src/main/resources/apache-ant-1.8.1-bin.zip rename to test-harness-tools/src/main/resources/apache-ant-1.8.1-bin.zip diff --git a/test/src/main/resources/apache-maven-2.2.1-bin.zip b/test-harness-tools/src/main/resources/apache-maven-2.2.1-bin.zip similarity index 100% rename from test/src/main/resources/apache-maven-2.2.1-bin.zip rename to test-harness-tools/src/main/resources/apache-maven-2.2.1-bin.zip diff --git a/test/src/main/resources/apache-maven-3.0.1-bin.zip b/test-harness-tools/src/main/resources/apache-maven-3.0.1-bin.zip similarity index 100% rename from test/src/main/resources/apache-maven-3.0.1-bin.zip rename to test-harness-tools/src/main/resources/apache-maven-3.0.1-bin.zip diff --git a/test/src/main/resources/apache-maven-3.1.0-bin.zip b/test-harness-tools/src/main/resources/apache-maven-3.1.0-bin.zip similarity index 100% rename from test/src/main/resources/apache-maven-3.1.0-bin.zip rename to test-harness-tools/src/main/resources/apache-maven-3.1.0-bin.zip diff --git a/test/src/main/resources/maven-2.0.7-bin.zip b/test-harness-tools/src/main/resources/maven-2.0.7-bin.zip similarity index 100% rename from test/src/main/resources/maven-2.0.7-bin.zip rename to test-harness-tools/src/main/resources/maven-2.0.7-bin.zip diff --git a/test-harness/pom.xml b/test-harness/pom.xml new file mode 100644 index 0000000000..aa6b210546 --- /dev/null +++ b/test-harness/pom.xml @@ -0,0 +1,185 @@ + + + + 4.0.0 + + + org.jenkins-ci.main + pom + 1.645-SNAPSHOT + + + jenkins-test-harness + + Test harness for Jenkins and plugins + Harness used to run functional tests of Jenkins core and plugins. + + + + + ${project.groupId} + jenkins-war + 1.580.1 + war-for-test + + + org.jenkins-ci.modules + sshd + + + + + org.mortbay.jetty + jetty + 6.1.26 + + + junit + junit + + + org.hamcrest + hamcrest-library + 1.3 + + + net.sourceforge.htmlunit + htmlunit + 2.18 + + + commons-codec + commons-codec + + + + + org.jvnet.hudson + embedded-rhino-debugger + 1.2 + + + org.jvnet.hudson + htmlunit-core-js + + + + + org.netbeans.modules + org-netbeans-insane + RELEASE72 + + + com.github.stephenc.findbugs + findbugs-annotations + 1.3.9-1 + + + org.jenkins-ci.lib + lib-jenkins-maven-embedder + 3.11 + + + org.sonatype.sisu + sisu-guice + + + + + org.jenkins-ci.plugins + matrix-auth + 1.0.2 + test + + + + + + + org.kohsuke.stapler + maven-stapler-plugin + + true + + + org.apache.maven.plugins + maven-surefire-plugin + + + -Dfile.encoding=UTF-8 -Xmx256m -XX:MaxPermSize=128m + + + true + ${mavenDebug} + ${project.build.directory} + ${ignore.random.failures} + + + + + org.codehaus.gmaven + gmaven-plugin + + + + preset-packager + process-resources + + execute + + + ${pom.basedir}/src/main/preset-data/package.groovy + + + + + + org.apache.ant + ant + 1.8.0 + + + + org.apache.ant + ant-launcher + 1.8.0 + + + org.codehaus.gmaven.runtime + gmaven-runtime-2.0 + 1.5-jenkins-1 + + + + 2.0 + + + + + + diff --git a/test/src/main/java/com/gargoylesoftware/htmlunit/README.md b/test-harness/src/main/java/com/gargoylesoftware/htmlunit/README.md similarity index 100% rename from test/src/main/java/com/gargoylesoftware/htmlunit/README.md rename to test-harness/src/main/java/com/gargoylesoftware/htmlunit/README.md diff --git a/test/src/main/java/com/gargoylesoftware/htmlunit/WebClientUtil.java b/test-harness/src/main/java/com/gargoylesoftware/htmlunit/WebClientUtil.java similarity index 100% rename from test/src/main/java/com/gargoylesoftware/htmlunit/WebClientUtil.java rename to test-harness/src/main/java/com/gargoylesoftware/htmlunit/WebClientUtil.java diff --git a/test/src/main/java/com/gargoylesoftware/htmlunit/WebResponseListener.java b/test-harness/src/main/java/com/gargoylesoftware/htmlunit/WebResponseListener.java similarity index 100% rename from test/src/main/java/com/gargoylesoftware/htmlunit/WebResponseListener.java rename to test-harness/src/main/java/com/gargoylesoftware/htmlunit/WebResponseListener.java diff --git a/test/src/main/java/com/gargoylesoftware/htmlunit/html/DomNodeUtil.java b/test-harness/src/main/java/com/gargoylesoftware/htmlunit/html/DomNodeUtil.java similarity index 100% rename from test/src/main/java/com/gargoylesoftware/htmlunit/html/DomNodeUtil.java rename to test-harness/src/main/java/com/gargoylesoftware/htmlunit/html/DomNodeUtil.java diff --git a/test/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlElementUtil.java b/test-harness/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlElementUtil.java similarity index 100% rename from test/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlElementUtil.java rename to test-harness/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlElementUtil.java diff --git a/test/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlFormUtil.java b/test-harness/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlFormUtil.java similarity index 100% rename from test/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlFormUtil.java rename to test-harness/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlFormUtil.java diff --git a/test/src/main/java/hudson/cli/CLICommandInvoker.java b/test-harness/src/main/java/hudson/cli/CLICommandInvoker.java similarity index 83% rename from test/src/main/java/hudson/cli/CLICommandInvoker.java rename to test-harness/src/main/java/hudson/cli/CLICommandInvoker.java index ad8ac1f229..00c603a970 100644 --- a/test/src/main/java/hudson/cli/CLICommandInvoker.java +++ b/test-harness/src/main/java/hudson/cli/CLICommandInvoker.java @@ -27,18 +27,22 @@ package hudson.cli; import hudson.Extension; import hudson.model.User; import hudson.security.ACL; +import hudson.security.AuthorizationStrategy; import hudson.security.Permission; -import hudson.security.GlobalMatrixAuthorizationStrategy; +import hudson.security.SidACL; import java.io.ByteArrayOutputStream; import java.io.InputStream; import java.io.PrintStream; import java.util.Arrays; +import java.util.Collection; import java.util.Collections; import java.util.List; import java.util.Locale; import jenkins.model.Jenkins; +import org.acegisecurity.acls.sid.PrincipalSid; +import org.acegisecurity.acls.sid.Sid; import org.hamcrest.Description; import org.hamcrest.TypeSafeMatcher; @@ -120,6 +124,37 @@ public class CLICommandInvoker { return new Result(returnCode, out, err); } + private static class GrantPermissions extends AuthorizationStrategy { + final String username; + final List permissions; + GrantPermissions(String username, List permissions) { + this.username = username; + this.permissions = permissions; + for (Permission p : permissions) { + p.setEnabled(true); + } + } + @Override + public ACL getRootACL() { + return new SidACL() { + @Override + protected Boolean hasPermission(Sid u, Permission permission) { + if (u instanceof PrincipalSid && ((PrincipalSid) u).getPrincipal().equals(username)) { + for (Permission p = permission; p != null; p = p.impliedBy) { + if (permissions.contains(p)) { + return true; + } + } + } + return false; + } + }; + } + @Override + public Collection getGroups() { + return Collections.emptySet(); + } + } private void setAuth() { if (permissions.isEmpty()) return; @@ -128,12 +163,7 @@ public class CLICommandInvoker { realm.addGroups(username, "group"); rule.jenkins.setSecurityRealm(realm); - GlobalMatrixAuthorizationStrategy auth = new GlobalMatrixAuthorizationStrategy(); - for(Permission p: permissions) { - p.setEnabled(true); - auth.add(p, username); - } - rule.jenkins.setAuthorizationStrategy(auth); + rule.jenkins.setAuthorizationStrategy(new GrantPermissions(username, permissions)); command.setTransportAuth(user().impersonate()); // Otherwise it is SYSTEM, which would be relevant for a command overriding main: diff --git a/test/src/main/java/hudson/util/SecretHelper.java b/test-harness/src/main/java/hudson/util/SecretHelper.java similarity index 100% rename from test/src/main/java/hudson/util/SecretHelper.java rename to test-harness/src/main/java/hudson/util/SecretHelper.java diff --git a/test/src/main/java/jenkins/model/JenkinsAdaptor.java b/test-harness/src/main/java/jenkins/model/JenkinsAdaptor.java similarity index 100% rename from test/src/main/java/jenkins/model/JenkinsAdaptor.java rename to test-harness/src/main/java/jenkins/model/JenkinsAdaptor.java diff --git a/test/src/main/java/jenkins/model/WorkspaceWriter.java b/test-harness/src/main/java/jenkins/model/WorkspaceWriter.java similarity index 100% rename from test/src/main/java/jenkins/model/WorkspaceWriter.java rename to test-harness/src/main/java/jenkins/model/WorkspaceWriter.java diff --git a/test/src/main/java/org/jvnet/hudson/test/BuildWatcher.java b/test-harness/src/main/java/org/jvnet/hudson/test/BuildWatcher.java similarity index 100% rename from test/src/main/java/org/jvnet/hudson/test/BuildWatcher.java rename to test-harness/src/main/java/org/jvnet/hudson/test/BuildWatcher.java diff --git a/test/src/main/java/org/jvnet/hudson/test/CaptureEnvironmentBuilder.java b/test-harness/src/main/java/org/jvnet/hudson/test/CaptureEnvironmentBuilder.java similarity index 100% rename from test/src/main/java/org/jvnet/hudson/test/CaptureEnvironmentBuilder.java rename to test-harness/src/main/java/org/jvnet/hudson/test/CaptureEnvironmentBuilder.java diff --git a/test/src/main/java/org/jvnet/hudson/test/ChannelShutdownListener.java b/test-harness/src/main/java/org/jvnet/hudson/test/ChannelShutdownListener.java similarity index 100% rename from test/src/main/java/org/jvnet/hudson/test/ChannelShutdownListener.java rename to test-harness/src/main/java/org/jvnet/hudson/test/ChannelShutdownListener.java diff --git a/test/src/main/java/org/jvnet/hudson/test/ClosureExecuterAction.java b/test-harness/src/main/java/org/jvnet/hudson/test/ClosureExecuterAction.java similarity index 100% rename from test/src/main/java/org/jvnet/hudson/test/ClosureExecuterAction.java rename to test-harness/src/main/java/org/jvnet/hudson/test/ClosureExecuterAction.java diff --git a/test/src/main/java/org/jvnet/hudson/test/ComputerConnectorTester.java b/test-harness/src/main/java/org/jvnet/hudson/test/ComputerConnectorTester.java similarity index 93% rename from test/src/main/java/org/jvnet/hudson/test/ComputerConnectorTester.java rename to test-harness/src/main/java/org/jvnet/hudson/test/ComputerConnectorTester.java index 67a24eaa0a..c1b320c05e 100644 --- a/test/src/main/java/org/jvnet/hudson/test/ComputerConnectorTester.java +++ b/test-harness/src/main/java/org/jvnet/hudson/test/ComputerConnectorTester.java @@ -57,5 +57,10 @@ public class ComputerConnectorTester extends AbstractDescribableImpl {} + public static class DescriptorImpl extends Descriptor { + @Override // TODO 1.635+ delete + public String getDisplayName() { + return "ComputerConnectorTester"; + } + } } diff --git a/test/src/main/java/org/jvnet/hudson/test/CreateFileBuilder.java b/test-harness/src/main/java/org/jvnet/hudson/test/CreateFileBuilder.java similarity index 100% rename from test/src/main/java/org/jvnet/hudson/test/CreateFileBuilder.java rename to test-harness/src/main/java/org/jvnet/hudson/test/CreateFileBuilder.java diff --git a/test/src/main/java/org/jvnet/hudson/test/DefaultConstructorChecker.java b/test-harness/src/main/java/org/jvnet/hudson/test/DefaultConstructorChecker.java similarity index 100% rename from test/src/main/java/org/jvnet/hudson/test/DefaultConstructorChecker.java rename to test-harness/src/main/java/org/jvnet/hudson/test/DefaultConstructorChecker.java diff --git a/test/src/main/java/org/jvnet/hudson/test/EndOfTestListener.java b/test-harness/src/main/java/org/jvnet/hudson/test/EndOfTestListener.java similarity index 100% rename from test/src/main/java/org/jvnet/hudson/test/EndOfTestListener.java rename to test-harness/src/main/java/org/jvnet/hudson/test/EndOfTestListener.java diff --git a/test/src/main/java/org/jvnet/hudson/test/ExtractChangeLogParser.java b/test-harness/src/main/java/org/jvnet/hudson/test/ExtractChangeLogParser.java similarity index 100% rename from test/src/main/java/org/jvnet/hudson/test/ExtractChangeLogParser.java rename to test-harness/src/main/java/org/jvnet/hudson/test/ExtractChangeLogParser.java diff --git a/test/src/main/java/org/jvnet/hudson/test/ExtractChangeLogSet.java b/test-harness/src/main/java/org/jvnet/hudson/test/ExtractChangeLogSet.java similarity index 100% rename from test/src/main/java/org/jvnet/hudson/test/ExtractChangeLogSet.java rename to test-harness/src/main/java/org/jvnet/hudson/test/ExtractChangeLogSet.java diff --git a/test/src/main/java/org/jvnet/hudson/test/ExtractResourceSCM.java b/test-harness/src/main/java/org/jvnet/hudson/test/ExtractResourceSCM.java similarity index 100% rename from test/src/main/java/org/jvnet/hudson/test/ExtractResourceSCM.java rename to test-harness/src/main/java/org/jvnet/hudson/test/ExtractResourceSCM.java diff --git a/test/src/main/java/org/jvnet/hudson/test/ExtractResourceWithChangesSCM.java b/test-harness/src/main/java/org/jvnet/hudson/test/ExtractResourceWithChangesSCM.java similarity index 96% rename from test/src/main/java/org/jvnet/hudson/test/ExtractResourceWithChangesSCM.java rename to test-harness/src/main/java/org/jvnet/hudson/test/ExtractResourceWithChangesSCM.java index 0c01c35a98..cd6c0c714e 100644 --- a/test/src/main/java/org/jvnet/hudson/test/ExtractResourceWithChangesSCM.java +++ b/test-harness/src/main/java/org/jvnet/hudson/test/ExtractResourceWithChangesSCM.java @@ -142,7 +142,12 @@ public class ExtractResourceWithChangesSCM extends NullSCM { private Object writeReplace() { return new Object(); } @Override public SCMDescriptor getDescriptor() { - return new SCMDescriptor(ExtractResourceWithChangesSCM.class, null) {}; + return new SCMDescriptor(ExtractResourceWithChangesSCM.class, null) { + @Override // TODO 1.635+ delete + public String getDisplayName() { + return "ExtractResourceWithChangesSCM"; + } +}; } } diff --git a/test/src/main/java/org/jvnet/hudson/test/FailureBuilder.java b/test-harness/src/main/java/org/jvnet/hudson/test/FailureBuilder.java similarity index 93% rename from test/src/main/java/org/jvnet/hudson/test/FailureBuilder.java rename to test-harness/src/main/java/org/jvnet/hudson/test/FailureBuilder.java index ec74d11280..2c5e486427 100644 --- a/test/src/main/java/org/jvnet/hudson/test/FailureBuilder.java +++ b/test-harness/src/main/java/org/jvnet/hudson/test/FailureBuilder.java @@ -45,5 +45,10 @@ public class FailureBuilder extends MockBuilder { public FailureBuilder newInstance(StaplerRequest req, JSONObject data) { return new FailureBuilder(); } + + @Override // TODO 1.635+ delete + public String getDisplayName() { + return "FailureBuilder"; + } } } diff --git a/test/src/main/java/org/jvnet/hudson/test/FakeChangeLogSCM.java b/test-harness/src/main/java/org/jvnet/hudson/test/FakeChangeLogSCM.java similarity index 95% rename from test/src/main/java/org/jvnet/hudson/test/FakeChangeLogSCM.java rename to test-harness/src/main/java/org/jvnet/hudson/test/FakeChangeLogSCM.java index 0ad8d74f3b..640302fdaa 100644 --- a/test/src/main/java/org/jvnet/hudson/test/FakeChangeLogSCM.java +++ b/test-harness/src/main/java/org/jvnet/hudson/test/FakeChangeLogSCM.java @@ -77,7 +77,12 @@ public class FakeChangeLogSCM extends NullSCM { } @Override public SCMDescriptor getDescriptor() { - return new SCMDescriptor(null) {}; + return new SCMDescriptor(null) { + @Override // TODO 1.635+ delete + public String getDisplayName() { + return "FakeChangeLogSCM"; + } +}; } public static class ChangelogAction extends InvisibleAction { diff --git a/test/src/main/java/org/jvnet/hudson/test/FakeLauncher.java b/test-harness/src/main/java/org/jvnet/hudson/test/FakeLauncher.java similarity index 100% rename from test/src/main/java/org/jvnet/hudson/test/FakeLauncher.java rename to test-harness/src/main/java/org/jvnet/hudson/test/FakeLauncher.java diff --git a/test/src/main/java/org/jvnet/hudson/test/GroovyHudsonTestCase.java b/test-harness/src/main/java/org/jvnet/hudson/test/GroovyHudsonTestCase.java similarity index 100% rename from test/src/main/java/org/jvnet/hudson/test/GroovyHudsonTestCase.java rename to test-harness/src/main/java/org/jvnet/hudson/test/GroovyHudsonTestCase.java diff --git a/test/src/main/java/org/jvnet/hudson/test/GroovyJenkinsRule.java b/test-harness/src/main/java/org/jvnet/hudson/test/GroovyJenkinsRule.java similarity index 100% rename from test/src/main/java/org/jvnet/hudson/test/GroovyJenkinsRule.java rename to test-harness/src/main/java/org/jvnet/hudson/test/GroovyJenkinsRule.java diff --git a/test/src/main/java/org/jvnet/hudson/test/HudsonHomeLoader.java b/test-harness/src/main/java/org/jvnet/hudson/test/HudsonHomeLoader.java similarity index 100% rename from test/src/main/java/org/jvnet/hudson/test/HudsonHomeLoader.java rename to test-harness/src/main/java/org/jvnet/hudson/test/HudsonHomeLoader.java diff --git a/test/src/main/java/org/jvnet/hudson/test/HudsonPageCreator.java b/test-harness/src/main/java/org/jvnet/hudson/test/HudsonPageCreator.java similarity index 100% rename from test/src/main/java/org/jvnet/hudson/test/HudsonPageCreator.java rename to test-harness/src/main/java/org/jvnet/hudson/test/HudsonPageCreator.java diff --git a/test/src/main/java/org/jvnet/hudson/test/HudsonTestCase.java b/test-harness/src/main/java/org/jvnet/hudson/test/HudsonTestCase.java similarity index 91% rename from test/src/main/java/org/jvnet/hudson/test/HudsonTestCase.java rename to test-harness/src/main/java/org/jvnet/hudson/test/HudsonTestCase.java index 9afb80e606..f2ce2d2d80 100644 --- a/test/src/main/java/org/jvnet/hudson/test/HudsonTestCase.java +++ b/test-harness/src/main/java/org/jvnet/hudson/test/HudsonTestCase.java @@ -39,7 +39,6 @@ import hudson.DescriptorExtensionList; import hudson.EnvVars; import hudson.Extension; import hudson.ExtensionList; -import hudson.FilePath; import hudson.Functions; import hudson.Functions.ThreadGroupMap; import hudson.Launcher; @@ -48,16 +47,6 @@ import hudson.Main; import hudson.PluginManager; import hudson.Util; import hudson.WebAppMain; -import hudson.matrix.MatrixBuild; -import hudson.matrix.MatrixProject; -import hudson.matrix.MatrixRun; -import hudson.maven.MavenBuild; -import hudson.maven.MavenEmbedder; -import hudson.maven.MavenEmbedderException; -import hudson.maven.MavenModule; -import hudson.maven.MavenModuleSet; -import hudson.maven.MavenModuleSetBuild; -import hudson.maven.MavenUtil; import hudson.model.*; import hudson.model.Executor; import hudson.model.Node.Mode; @@ -75,14 +64,9 @@ import hudson.slaves.ComputerListener; import hudson.slaves.DumbSlave; import hudson.slaves.NodeProperty; import hudson.slaves.RetentionStrategy; -import hudson.tasks.Ant; -import hudson.tasks.Ant.AntInstallation; import hudson.tasks.BuildWrapper; import hudson.tasks.BuildWrapperDescriptor; import hudson.tasks.Builder; -import hudson.tasks.Mailer; -import hudson.tasks.Maven; -import hudson.tasks.Maven.MavenInstallation; import hudson.tasks.Publisher; import hudson.tools.ToolProperty; import hudson.util.PersistedList; @@ -106,7 +90,6 @@ import java.net.URISyntaxException; import java.net.URL; import java.net.URLClassLoader; import java.net.URLConnection; -import java.nio.charset.Charset; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; @@ -187,6 +170,10 @@ import com.gargoylesoftware.htmlunit.html.HtmlPage; import com.gargoylesoftware.htmlunit.javascript.HtmlUnitContextFactory; import com.gargoylesoftware.htmlunit.javascript.host.xml.XMLHttpRequest; import com.gargoylesoftware.htmlunit.xml.XmlPage; +import hudson.maven.MavenEmbedder; +import hudson.maven.MavenEmbedderException; +import hudson.maven.MavenRequest; +import java.net.HttpURLConnection; import jenkins.model.JenkinsLocationConfiguration; @@ -343,8 +330,7 @@ public abstract class HudsonTestCase extends TestCase implements RootAction { jenkins.servletContext.setAttribute("app", jenkins); jenkins.servletContext.setAttribute("version","?"); WebAppMain.installExpressionFactory(new ServletContextEvent(jenkins.servletContext)); - Mailer.descriptor().setHudsonUrl(getURL().toExternalForm()); // for compatibility only - JenkinsLocationConfiguration.get().setUrl(getURL().toString()); // in case we are using older mailer plugin + JenkinsLocationConfiguration.get().setUrl(getURL().toString()); // set a default JDK to be the one that the harness is using. jenkins.getJDKs().add(new JDK("default",System.getProperty("java.home"))); @@ -564,96 +550,6 @@ public abstract class HudsonTestCase extends TestCase implements RootAction { return realm; } - /** - * Returns the older default Maven, while still allowing specification of other bundled Mavens. - */ - protected MavenInstallation configureDefaultMaven() throws Exception { - return configureDefaultMaven("apache-maven-2.2.1", MavenInstallation.MAVEN_20); - } - - protected MavenInstallation configureMaven3() throws Exception { - MavenInstallation mvn = configureDefaultMaven("apache-maven-3.0.1", MavenInstallation.MAVEN_30); - - MavenInstallation m3 = new MavenInstallation("apache-maven-3.0.1",mvn.getHome(), NO_PROPERTIES); - jenkins.getDescriptorByType(Maven.DescriptorImpl.class).setInstallations(m3); - return m3; - } - - protected MavenInstallation configureMaven31() throws Exception { - MavenInstallation mvn = configureDefaultMaven("apache-maven-3.1.0", MavenInstallation.MAVEN_30); - - MavenInstallation m3 = new MavenInstallation("apache-maven-3.1.0",mvn.getHome(), NO_PROPERTIES); - jenkins.getDescriptorByType(Maven.DescriptorImpl.class).setInstallations(m3); - return m3; - } - - /** - * Locates Maven and configures that as the only Maven in the system. - */ - protected MavenInstallation configureDefaultMaven(String mavenVersion, int mavenReqVersion) throws Exception { - // Does it exists in the buildDirectory - i.e. already extracted from previous test? - // defined in jenkins-test-harness POM, but not plugins; TODO should not use relative paths as we do not know what CWD is - File buildDirectory = new File(System.getProperty("buildDirectory", "target")); - File mvnHome = new File(buildDirectory, mavenVersion); - if (mvnHome.exists()) { - MavenInstallation mavenInstallation = new MavenInstallation("default", mvnHome.getAbsolutePath(), NO_PROPERTIES); - jenkins.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) { - MavenInstallation mavenInstallation = new MavenInstallation("default",home, NO_PROPERTIES); - if (mavenInstallation.meetsMavenReqVersion(createLocalLauncher(), mavenReqVersion)) { - jenkins.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.warning("Extracting a copy of Maven bundled in the test harness into " + mvnHome + ". " + - "To avoid a performance hit, set the system property 'maven.home' to point to a Maven2 installation."); - FilePath mvn = jenkins.getRootPath().createTempFile("maven", "zip"); - mvn.copyFrom(HudsonTestCase.class.getClassLoader().getResource(mavenVersion + "-bin.zip")); - mvn.unzip(new FilePath(buildDirectory)); - // TODO: switch to tar that preserves file permissions more easily - if(!Functions.isWindows()) { - PosixAPI.jnr().chmod(new File(mvnHome, "bin/mvn").getPath(), 0755); - } - - MavenInstallation mavenInstallation = new MavenInstallation("default", - mvnHome.getAbsolutePath(), NO_PROPERTIES); - jenkins.getDescriptorByType(Maven.DescriptorImpl.class).setInstallations(mavenInstallation); - return mavenInstallation; - } - - /** - * Extracts Ant and configures it. - */ - protected Ant.AntInstallation configureDefaultAnt() throws Exception { - Ant.AntInstallation antInstallation; - if (System.getenv("ANT_HOME") != null) { - antInstallation = new AntInstallation("default", System.getenv("ANT_HOME"), 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.getRootPath().createTempFile("ant", "zip"); - ant.copyFrom(HudsonTestCase.class.getClassLoader().getResource("apache-ant-1.8.1-bin.zip")); - File antHome = createTmpDir(); - ant.unzip(new FilePath(antHome)); - // TODO: switch to tar that preserves file permissions more easily - if(!Functions.isWindows()) { - PosixAPI.jnr().chmod(new File(antHome,"apache-ant-1.8.1/bin/ant").getPath(),0755); - } - - antInstallation = new AntInstallation("default", new File(antHome,"apache-ant-1.8.1").getAbsolutePath(),NO_PROPERTIES); - } - jenkins.getDescriptorByType(Ant.DescriptorImpl.class).setInstallations(antInstallation); - return antInstallation; - } - // // Convenience methods // @@ -666,34 +562,6 @@ public abstract class HudsonTestCase extends TestCase implements RootAction { return jenkins.createProject(FreeStyleProject.class, name); } - protected MatrixProject createMatrixProject() throws IOException { - return createMatrixProject(createUniqueProjectName()); - } - - protected MatrixProject createMatrixProject(String name) throws IOException { - return jenkins.createProject(MatrixProject.class, name); - } - - /** - * Creates a empty Maven project with an unique name. - * - * @see #configureDefaultMaven() - */ - protected MavenModuleSet createMavenProject() throws IOException { - return createMavenProject(createUniqueProjectName()); - } - - /** - * Creates a empty Maven project with the given name. - * - * @see #configureDefaultMaven() - */ - protected MavenModuleSet createMavenProject(String name) throws IOException { - MavenModuleSet mavenModuleSet = jenkins.createProject(MavenModuleSet.class,name); - mavenModuleSet.setRunHeadless( true ); - return mavenModuleSet; - } - protected String createUniqueProjectName() { return "test"+ jenkins.getItems().size(); } @@ -957,12 +825,6 @@ public abstract class HudsonTestCase extends TestCase implements RootAction { // dump the build output in failure message String msg = "unexpected build status; build log was:\n------\n" + getLog(r) + "\n------\n"; - if(r instanceof MatrixBuild) { - MatrixBuild mb = (MatrixBuild)r; - for (MatrixRun mr : mb.getRuns()) { - msg+="--- "+mr.getParent().getCombination()+" ---\n"+getLog(mr)+"\n------\n"; - } - } assertEquals(msg, status,r.getResult()); return r; } @@ -1007,12 +869,6 @@ public abstract class HudsonTestCase extends TestCase implements RootAction { public FreeStyleBuild buildAndAssertSuccess(FreeStyleProject job) throws Exception { return assertBuildStatusSuccess(job.scheduleBuild2(0)); } - public MavenModuleSetBuild buildAndAssertSuccess(MavenModuleSet job) throws Exception { - return assertBuildStatusSuccess(job.scheduleBuild2(0)); - } - public MavenBuild buildAndAssertSuccess(MavenModule job) throws Exception { - return assertBuildStatusSuccess(job.scheduleBuild2(0)); - } /** * Asserts that the console output of the build contains the given substring. @@ -1466,7 +1322,8 @@ public abstract class HudsonTestCase extends TestCase implements RootAction { String dependencies = m.getMainAttributes().getValue("Plugin-Dependencies"); if(dependencies!=null) { - MavenEmbedder embedder = MavenUtil.createEmbedder(new StreamTaskListener(System.out,Charset.defaultCharset()),(File)null,null); + // TODO can we switch this to use Aether directly? + MavenEmbedder embedder = new MavenEmbedder(MavenEmbedder.class.getClassLoader(), new MavenRequest()); for( String dep : dependencies.split(",")) { String suffix = ";resolution:=optional"; boolean optional = dep.endsWith(suffix); @@ -1542,7 +1399,7 @@ public abstract class HudsonTestCase extends TestCase implements RootAction { private File resolvePluginFile(MavenEmbedder embedder, String artifactId, String version, String groupId, String type) throws MavenEmbedderException, ComponentLookupException, AbstractArtifactResolutionException { final Artifact jpi = embedder.createArtifact(groupId, artifactId, version, "compile"/*doesn't matter*/, type); - embedder.resolve(jpi, Arrays.asList(embedder.createRepository("http://maven.glassfish.org/content/groups/public/","repo")),embedder.getLocalRepository()); + embedder.resolve(jpi, Arrays.asList(embedder.createRepository("http://repo.jenkins-ci.org/public/", "repo.jenkins-ci.org")),embedder.getLocalRepository()); return jpi.getFile(); } @@ -2046,6 +1903,11 @@ public abstract class HudsonTestCase extends TestCase implements RootAction { public BuildWrapper newInstance(StaplerRequest req, JSONObject formData) { throw new UnsupportedOperationException(); } + + @Override // TODO 1.635+ delete + public String getDisplayName() { + return "TestBuildWrapper"; + } } } } diff --git a/test/src/main/java/org/jvnet/hudson/test/JavaNetReverseProxy.java b/test-harness/src/main/java/org/jvnet/hudson/test/JavaNetReverseProxy.java similarity index 100% rename from test/src/main/java/org/jvnet/hudson/test/JavaNetReverseProxy.java rename to test-harness/src/main/java/org/jvnet/hudson/test/JavaNetReverseProxy.java diff --git a/test/src/main/java/org/jvnet/hudson/test/JellyTestSuiteBuilder.java b/test-harness/src/main/java/org/jvnet/hudson/test/JellyTestSuiteBuilder.java similarity index 100% rename from test/src/main/java/org/jvnet/hudson/test/JellyTestSuiteBuilder.java rename to test-harness/src/main/java/org/jvnet/hudson/test/JellyTestSuiteBuilder.java diff --git a/test/src/main/java/org/jvnet/hudson/test/JenkinsComputerConnectorTester.java b/test-harness/src/main/java/org/jvnet/hudson/test/JenkinsComputerConnectorTester.java similarity index 93% rename from test/src/main/java/org/jvnet/hudson/test/JenkinsComputerConnectorTester.java rename to test-harness/src/main/java/org/jvnet/hudson/test/JenkinsComputerConnectorTester.java index f3a2e98f3d..595101116e 100644 --- a/test/src/main/java/org/jvnet/hudson/test/JenkinsComputerConnectorTester.java +++ b/test-harness/src/main/java/org/jvnet/hudson/test/JenkinsComputerConnectorTester.java @@ -58,5 +58,10 @@ public class JenkinsComputerConnectorTester extends AbstractDescribableImpl {} + public static class DescriptorImpl extends Descriptor { + @Override // TODO 1.635+ delete + public String getDisplayName() { + return "JenkinsComputerConnectorTester"; + } +} } diff --git a/test/src/main/java/org/jvnet/hudson/test/JenkinsMatchers.java b/test-harness/src/main/java/org/jvnet/hudson/test/JenkinsMatchers.java similarity index 100% rename from test/src/main/java/org/jvnet/hudson/test/JenkinsMatchers.java rename to test-harness/src/main/java/org/jvnet/hudson/test/JenkinsMatchers.java diff --git a/test/src/main/java/org/jvnet/hudson/test/JenkinsRecipe.java b/test-harness/src/main/java/org/jvnet/hudson/test/JenkinsRecipe.java similarity index 100% rename from test/src/main/java/org/jvnet/hudson/test/JenkinsRecipe.java rename to test-harness/src/main/java/org/jvnet/hudson/test/JenkinsRecipe.java diff --git a/test/src/main/java/org/jvnet/hudson/test/JenkinsRule.java b/test-harness/src/main/java/org/jvnet/hudson/test/JenkinsRule.java similarity index 92% rename from test/src/main/java/org/jvnet/hudson/test/JenkinsRule.java rename to test-harness/src/main/java/org/jvnet/hudson/test/JenkinsRule.java index 03b63178a5..ca259a9403 100644 --- a/test/src/main/java/org/jvnet/hudson/test/JenkinsRule.java +++ b/test-harness/src/main/java/org/jvnet/hudson/test/JenkinsRule.java @@ -53,23 +53,14 @@ import hudson.DescriptorExtensionList; import hudson.EnvVars; import hudson.Extension; import hudson.ExtensionList; -import hudson.FilePath; import hudson.Functions; import hudson.Launcher; import hudson.Main; import hudson.PluginManager; import hudson.Util; import hudson.WebAppMain; -import hudson.matrix.MatrixBuild; -import hudson.matrix.MatrixProject; -import hudson.matrix.MatrixRun; -import hudson.maven.MavenBuild; import hudson.maven.MavenEmbedder; import hudson.maven.MavenEmbedderException; -import hudson.maven.MavenModule; -import hudson.maven.MavenModuleSet; -import hudson.maven.MavenModuleSetBuild; -import hudson.maven.MavenUtil; import hudson.model.AbstractBuild; import hudson.model.AbstractProject; import hudson.model.BuildListener; @@ -105,11 +96,9 @@ import hudson.slaves.ComputerListener; import hudson.slaves.DumbSlave; import hudson.slaves.OfflineCause; import hudson.slaves.RetentionStrategy; -import hudson.tasks.Ant; import hudson.tasks.BuildWrapper; import hudson.tasks.BuildWrapperDescriptor; import hudson.tasks.Builder; -import hudson.tasks.Maven; import hudson.tasks.Publisher; import hudson.tools.ToolProperty; import hudson.util.PersistedList; @@ -133,7 +122,6 @@ import java.net.URISyntaxException; import java.net.URL; import java.net.URLClassLoader; import java.net.URLConnection; -import java.nio.charset.Charset; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; @@ -195,6 +183,8 @@ import org.junit.runners.model.FrameworkMethod; import org.junit.runners.model.Statement; import com.gargoylesoftware.htmlunit.html.DomNodeUtil; import com.gargoylesoftware.htmlunit.html.HtmlFormUtil; +import hudson.maven.MavenRequest; +import java.net.HttpURLConnection; import java.nio.channels.ClosedByInterruptException; import org.jvnet.hudson.test.recipes.Recipe; import org.jvnet.hudson.test.rhino.JavaScriptDebugger; @@ -654,86 +644,6 @@ public class JenkinsRule implements TestRule, MethodRule, RootAction { return realm; } - - /** - * Returns the older default Maven, while still allowing specification of other bundled Mavens. - */ - public Maven.MavenInstallation configureDefaultMaven() throws Exception { - return configureDefaultMaven("apache-maven-2.2.1", Maven.MavenInstallation.MAVEN_20); - } - - public 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(), NO_PROPERTIES); - jenkins.getDescriptorByType(Maven.DescriptorImpl.class).setInstallations(m3); - return m3; - } - - /** - * Locates Maven2 and configure that as the only Maven in the system. - */ - public 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(), NO_PROPERTIES); - jenkins.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, NO_PROPERTIES); - if (mavenInstallation.meetsMavenReqVersion(createLocalLauncher(), mavenReqVersion)) { - jenkins.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.warning("Extracting a copy of Maven bundled in the test harness into " + mvnHome + ". " + - "To avoid a performance hit, set the system property 'maven.home' to point to a Maven2 installation."); - FilePath mvn = jenkins.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 - if(Functions.isGlibcSupported()) - GNUCLibrary.LIBC.chmod(new File(mvnHome, "bin/mvn").getPath(),0755); - - Maven.MavenInstallation mavenInstallation = new Maven.MavenInstallation("default", - mvnHome.getAbsolutePath(), NO_PROPERTIES); - jenkins.getDescriptorByType(Maven.DescriptorImpl.class).setInstallations(mavenInstallation); - return mavenInstallation; - } - - /** - * Extracts Ant and configures it. - */ - public Ant.AntInstallation configureDefaultAnt() throws Exception { - Ant.AntInstallation antInstallation; - if (System.getenv("ANT_HOME") != null) { - antInstallation = new Ant.AntInstallation("default", System.getenv("ANT_HOME"), 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.getRootPath().createTempFile("ant", "zip"); - ant.copyFrom(JenkinsRule.class.getClassLoader().getResource("apache-ant-1.8.1-bin.zip")); - File antHome = createTmpDir(); - ant.unzip(new FilePath(antHome)); - // TODO: switch to tar that preserves file permissions more easily - if(Functions.isGlibcSupported()) - GNUCLibrary.LIBC.chmod(new File(antHome,"apache-ant-1.8.1/bin/ant").getPath(),0755); - - antInstallation = new Ant.AntInstallation("default", new File(antHome,"apache-ant-1.8.1").getAbsolutePath(),NO_PROPERTIES); - } - jenkins.getDescriptorByType(Ant.DescriptorImpl.class).setInstallations(antInstallation); - return antInstallation; - } - // // Convenience methods // @@ -746,34 +656,6 @@ public class JenkinsRule implements TestRule, MethodRule, RootAction { return jenkins.createProject(FreeStyleProject.class, name); } - public MatrixProject createMatrixProject() throws IOException { - return createMatrixProject(createUniqueProjectName()); - } - - public MatrixProject createMatrixProject(String name) throws IOException { - return jenkins.createProject(MatrixProject.class, name); - } - - /** - * Creates a empty Maven project with an unique name. - * - * @see #configureDefaultMaven() - */ - public MavenModuleSet createMavenProject() throws IOException { - return createMavenProject(createUniqueProjectName()); - } - - /** - * Creates a empty Maven project with the given name. - * - * @see #configureDefaultMaven() - */ - public MavenModuleSet createMavenProject(String name) throws IOException { - MavenModuleSet mavenModuleSet = jenkins.createProject(MavenModuleSet.class,name); - mavenModuleSet.setRunHeadless( true ); - return mavenModuleSet; - } - /** * Creates a simple folder that other jobs can be placed in. * @since 1.494 @@ -1102,14 +984,8 @@ public class JenkinsRule implements TestRule, MethodRule, RootAction { if(status==r.getResult()) return r; - // dump the build output in failure message + // dump the build output in failure message (in case BuildWatcher is not being used) String msg = "unexpected build status; build log was:\n------\n" + getLog(r) + "\n------\n"; - if(r instanceof MatrixBuild) { - MatrixBuild mb = (MatrixBuild)r; - for (MatrixRun mr : mb.getRuns()) { - msg+="--- "+mr.getParent().getCombination()+" ---\n"+getLog(mr)+"\n------\n"; - } - } assertThat(msg, r.getResult(), is(status)); return r; } @@ -1154,12 +1030,6 @@ public class JenkinsRule implements TestRule, MethodRule, RootAction { public FreeStyleBuild buildAndAssertSuccess(FreeStyleProject job) throws Exception { return assertBuildStatusSuccess(job.scheduleBuild2(0)); } - public MavenModuleSetBuild buildAndAssertSuccess(MavenModuleSet job) throws Exception { - return assertBuildStatusSuccess(job.scheduleBuild2(0)); - } - public MavenBuild buildAndAssertSuccess(MavenModule job) throws Exception { - return assertBuildStatusSuccess(job.scheduleBuild2(0)); - } /** * Asserts that the console output of the build contains the given substring. @@ -1716,8 +1586,7 @@ public class JenkinsRule implements TestRule, MethodRule, RootAction { private MavenEmbedder getMavenEmbedder() throws MavenEmbedderException, IOException { if (embedder==null) - embedder = MavenUtil.createEmbedder(new StreamTaskListener(System.out, Charset.defaultCharset()), - (File) null, null); + embedder = new MavenEmbedder(MavenEmbedder.class.getClassLoader(), new MavenRequest()); return embedder; } @@ -1789,7 +1658,7 @@ public class JenkinsRule implements TestRule, MethodRule, RootAction { private @CheckForNull File resolvePluginFile(String artifactId, String version, String groupId, String type) throws Exception { final Artifact jpi = getMavenEmbedder().createArtifact(groupId, artifactId, version, "compile"/*doesn't matter*/, type); getMavenEmbedder().resolve(jpi, - Arrays.asList(getMavenEmbedder().createRepository("http://maven.glassfish.org/content/groups/public/", "repo")), embedder.getLocalRepository()); + Arrays.asList(getMavenEmbedder().createRepository("http://repo.jenkins-ci.org/public/", "repo.jenkins-ci.org")), embedder.getLocalRepository()); return jpi.getFile(); } @@ -2330,13 +2199,13 @@ public class JenkinsRule implements TestRule, MethodRule, RootAction { // this also prevents tests from falsely advertising Hudson DNSMultiCast.disabled = true; - if (Functions.isGlibcSupported()) { - try { - GNUCLibrary.LIBC.unsetenv("MAVEN_OPTS"); - GNUCLibrary.LIBC.unsetenv("MAVEN_DEBUG_OPTS"); - } catch (Exception e) { - LOGGER.log(Level.WARNING,"Failed to cancel out MAVEN_OPTS",e); - } + try { + GNUCLibrary.LIBC.unsetenv("MAVEN_OPTS"); + GNUCLibrary.LIBC.unsetenv("MAVEN_DEBUG_OPTS"); + } catch (LinkageError x) { + // skip; TODO 1.630+ can use Functions.isGlibcSupported + } catch (Exception e) { + LOGGER.log(Level.WARNING,"Failed to cancel out MAVEN_OPTS",e); } } @@ -2365,6 +2234,11 @@ public class JenkinsRule implements TestRule, MethodRule, RootAction { public BuildWrapper newInstance(StaplerRequest req, JSONObject formData) { throw new UnsupportedOperationException(); } + + @Override + public String getDisplayName() { + return "TestBuildWrapper"; + } } } diff --git a/test/src/main/java/org/jvnet/hudson/test/LenientRunnable.java b/test-harness/src/main/java/org/jvnet/hudson/test/LenientRunnable.java similarity index 100% rename from test/src/main/java/org/jvnet/hudson/test/LenientRunnable.java rename to test-harness/src/main/java/org/jvnet/hudson/test/LenientRunnable.java diff --git a/test/src/main/java/org/jvnet/hudson/test/MemoryAssert.java b/test-harness/src/main/java/org/jvnet/hudson/test/MemoryAssert.java similarity index 100% rename from test/src/main/java/org/jvnet/hudson/test/MemoryAssert.java rename to test-harness/src/main/java/org/jvnet/hudson/test/MemoryAssert.java diff --git a/test/src/main/java/org/jvnet/hudson/test/MilliSecLogFormatter.java b/test-harness/src/main/java/org/jvnet/hudson/test/MilliSecLogFormatter.java similarity index 100% rename from test/src/main/java/org/jvnet/hudson/test/MilliSecLogFormatter.java rename to test-harness/src/main/java/org/jvnet/hudson/test/MilliSecLogFormatter.java diff --git a/test/src/main/java/org/jvnet/hudson/test/MockBuilder.java b/test-harness/src/main/java/org/jvnet/hudson/test/MockBuilder.java similarity index 90% rename from test/src/main/java/org/jvnet/hudson/test/MockBuilder.java rename to test-harness/src/main/java/org/jvnet/hudson/test/MockBuilder.java index 2a57ad33bb..e2741cd03f 100644 --- a/test/src/main/java/org/jvnet/hudson/test/MockBuilder.java +++ b/test-harness/src/main/java/org/jvnet/hudson/test/MockBuilder.java @@ -41,6 +41,11 @@ public class MockBuilder extends Builder { public Builder newInstance(StaplerRequest req, JSONObject data) { throw new UnsupportedOperationException(); } + + @Override // TODO 1.635+ delete + public String getDisplayName() { + return "MockBuilder"; + } } } diff --git a/test/src/main/java/org/jvnet/hudson/test/MockFolder.java b/test-harness/src/main/java/org/jvnet/hudson/test/MockFolder.java similarity index 98% rename from test/src/main/java/org/jvnet/hudson/test/MockFolder.java rename to test-harness/src/main/java/org/jvnet/hudson/test/MockFolder.java index d5c98bc37c..7ba608aec2 100644 --- a/test/src/main/java/org/jvnet/hudson/test/MockFolder.java +++ b/test-harness/src/main/java/org/jvnet/hudson/test/MockFolder.java @@ -275,6 +275,11 @@ public class MockFolder extends AbstractItem implements DirectlyModifiableTopLev return new MockFolder(parent, name); } + @Override // TODO 1.635+ delete + public String getDisplayName() { + return "MockFolder"; + } + } } diff --git a/test/src/main/java/org/jvnet/hudson/test/MockQueueItemAuthenticator.java b/test-harness/src/main/java/org/jvnet/hudson/test/MockQueueItemAuthenticator.java similarity index 93% rename from test/src/main/java/org/jvnet/hudson/test/MockQueueItemAuthenticator.java rename to test-harness/src/main/java/org/jvnet/hudson/test/MockQueueItemAuthenticator.java index 7c8324598f..1713c37631 100644 --- a/test/src/main/java/org/jvnet/hudson/test/MockQueueItemAuthenticator.java +++ b/test-harness/src/main/java/org/jvnet/hudson/test/MockQueueItemAuthenticator.java @@ -59,6 +59,11 @@ public final class MockQueueItemAuthenticator extends QueueItemAuthenticator { } } - @Extension public static final class DescriptorImpl extends QueueItemAuthenticatorDescriptor {} + @Extension public static final class DescriptorImpl extends QueueItemAuthenticatorDescriptor { + @Override // TODO 1.635+ delete + public String getDisplayName() { + return "MockQueueItemAuthenticator"; + } +} } diff --git a/test/src/main/java/org/jvnet/hudson/test/NoListenerConfiguration.java b/test-harness/src/main/java/org/jvnet/hudson/test/NoListenerConfiguration.java similarity index 100% rename from test/src/main/java/org/jvnet/hudson/test/NoListenerConfiguration.java rename to test-harness/src/main/java/org/jvnet/hudson/test/NoListenerConfiguration.java diff --git a/test/src/main/java/org/jvnet/hudson/test/PluginAutomaticTestBuilder.java b/test-harness/src/main/java/org/jvnet/hudson/test/PluginAutomaticTestBuilder.java similarity index 100% rename from test/src/main/java/org/jvnet/hudson/test/PluginAutomaticTestBuilder.java rename to test-harness/src/main/java/org/jvnet/hudson/test/PluginAutomaticTestBuilder.java diff --git a/test/src/main/java/org/jvnet/hudson/test/PretendSlave.java b/test-harness/src/main/java/org/jvnet/hudson/test/PretendSlave.java similarity index 93% rename from test/src/main/java/org/jvnet/hudson/test/PretendSlave.java rename to test-harness/src/main/java/org/jvnet/hudson/test/PretendSlave.java index c284aefe89..bef814cf2c 100644 --- a/test/src/main/java/org/jvnet/hudson/test/PretendSlave.java +++ b/test-harness/src/main/java/org/jvnet/hudson/test/PretendSlave.java @@ -53,5 +53,10 @@ public class PretendSlave extends Slave { } @Extension - public static final class DescriptorImpl extends SlaveDescriptor {} + public static final class DescriptorImpl extends SlaveDescriptor { + @Override // TODO 1.635+ delete + public String getDisplayName() { + return "PretendSlave"; + } +} } diff --git a/test/src/main/java/org/jvnet/hudson/test/PropertiesTestSuite.java b/test-harness/src/main/java/org/jvnet/hudson/test/PropertiesTestSuite.java similarity index 100% rename from test/src/main/java/org/jvnet/hudson/test/PropertiesTestSuite.java rename to test-harness/src/main/java/org/jvnet/hudson/test/PropertiesTestSuite.java diff --git a/test/src/main/java/org/jvnet/hudson/test/RandomlyFails.java b/test-harness/src/main/java/org/jvnet/hudson/test/RandomlyFails.java similarity index 100% rename from test/src/main/java/org/jvnet/hudson/test/RandomlyFails.java rename to test-harness/src/main/java/org/jvnet/hudson/test/RandomlyFails.java diff --git a/test/src/main/java/org/jvnet/hudson/test/RestartableJenkinsRule.java b/test-harness/src/main/java/org/jvnet/hudson/test/RestartableJenkinsRule.java similarity index 100% rename from test/src/main/java/org/jvnet/hudson/test/RestartableJenkinsRule.java rename to test-harness/src/main/java/org/jvnet/hudson/test/RestartableJenkinsRule.java diff --git a/test/src/main/java/org/jvnet/hudson/test/RunLoadCounter.java b/test-harness/src/main/java/org/jvnet/hudson/test/RunLoadCounter.java similarity index 100% rename from test/src/main/java/org/jvnet/hudson/test/RunLoadCounter.java rename to test-harness/src/main/java/org/jvnet/hudson/test/RunLoadCounter.java diff --git a/test/src/main/java/org/jvnet/hudson/test/SecuredMockFolder.java b/test-harness/src/main/java/org/jvnet/hudson/test/SecuredMockFolder.java similarity index 100% rename from test/src/main/java/org/jvnet/hudson/test/SecuredMockFolder.java rename to test-harness/src/main/java/org/jvnet/hudson/test/SecuredMockFolder.java diff --git a/test/src/main/java/org/jvnet/hudson/test/SequenceLock.java b/test-harness/src/main/java/org/jvnet/hudson/test/SequenceLock.java similarity index 100% rename from test/src/main/java/org/jvnet/hudson/test/SequenceLock.java rename to test-harness/src/main/java/org/jvnet/hudson/test/SequenceLock.java diff --git a/test/src/main/java/org/jvnet/hudson/test/SingleFileSCM.java b/test-harness/src/main/java/org/jvnet/hudson/test/SingleFileSCM.java similarity index 100% rename from test/src/main/java/org/jvnet/hudson/test/SingleFileSCM.java rename to test-harness/src/main/java/org/jvnet/hudson/test/SingleFileSCM.java diff --git a/test/src/main/java/org/jvnet/hudson/test/SleepBuilder.java b/test-harness/src/main/java/org/jvnet/hudson/test/SleepBuilder.java similarity index 93% rename from test/src/main/java/org/jvnet/hudson/test/SleepBuilder.java rename to test-harness/src/main/java/org/jvnet/hudson/test/SleepBuilder.java index ce2052f3a1..a248ab23bb 100644 --- a/test/src/main/java/org/jvnet/hudson/test/SleepBuilder.java +++ b/test-harness/src/main/java/org/jvnet/hudson/test/SleepBuilder.java @@ -53,5 +53,10 @@ public class SleepBuilder extends Builder { } @Extension - public static final class DescriptorImpl extends Descriptor {} + public static final class DescriptorImpl extends Descriptor { + @Override // TODO 1.635+ delete + public String getDisplayName() { + return "SleepBuilder"; + } + } } diff --git a/test/src/main/java/org/jvnet/hudson/test/TemporaryDirectoryAllocator.java b/test-harness/src/main/java/org/jvnet/hudson/test/TemporaryDirectoryAllocator.java similarity index 100% rename from test/src/main/java/org/jvnet/hudson/test/TemporaryDirectoryAllocator.java rename to test-harness/src/main/java/org/jvnet/hudson/test/TemporaryDirectoryAllocator.java diff --git a/test/src/main/java/org/jvnet/hudson/test/TestBuilder.java b/test-harness/src/main/java/org/jvnet/hudson/test/TestBuilder.java similarity index 94% rename from test/src/main/java/org/jvnet/hudson/test/TestBuilder.java rename to test-harness/src/main/java/org/jvnet/hudson/test/TestBuilder.java index a466e4d4ab..c29d30419b 100644 --- a/test/src/main/java/org/jvnet/hudson/test/TestBuilder.java +++ b/test-harness/src/main/java/org/jvnet/hudson/test/TestBuilder.java @@ -53,6 +53,11 @@ public abstract class TestBuilder extends Builder { public boolean isApplicable(Class jobType) { return true; } + + @Override // TODO 1.635+ delete + public String getDisplayName() { + return "TestBuilder"; + } }; } diff --git a/test/src/main/java/org/jvnet/hudson/test/TestCrumbIssuer.java b/test-harness/src/main/java/org/jvnet/hudson/test/TestCrumbIssuer.java similarity index 91% rename from test/src/main/java/org/jvnet/hudson/test/TestCrumbIssuer.java rename to test-harness/src/main/java/org/jvnet/hudson/test/TestCrumbIssuer.java index 3160f0f413..87354e26f7 100644 --- a/test/src/main/java/org/jvnet/hudson/test/TestCrumbIssuer.java +++ b/test-harness/src/main/java/org/jvnet/hudson/test/TestCrumbIssuer.java @@ -45,6 +45,11 @@ public class TestCrumbIssuer extends CrumbIssuer public TestCrumbIssuer newInstance(StaplerRequest req, JSONObject formData) throws FormException { return new TestCrumbIssuer(); } + + @Override // TODO 1.635+ delete + public String getDisplayName() { + return "TestCrumbIssuer"; + } } } diff --git a/test/src/main/java/org/jvnet/hudson/test/TestEnvironment.java b/test-harness/src/main/java/org/jvnet/hudson/test/TestEnvironment.java similarity index 100% rename from test/src/main/java/org/jvnet/hudson/test/TestEnvironment.java rename to test-harness/src/main/java/org/jvnet/hudson/test/TestEnvironment.java diff --git a/test/src/main/java/org/jvnet/hudson/test/TestExtension.java b/test-harness/src/main/java/org/jvnet/hudson/test/TestExtension.java similarity index 100% rename from test/src/main/java/org/jvnet/hudson/test/TestExtension.java rename to test-harness/src/main/java/org/jvnet/hudson/test/TestExtension.java diff --git a/test/src/main/java/org/jvnet/hudson/test/TestExtensionLoader.java b/test-harness/src/main/java/org/jvnet/hudson/test/TestExtensionLoader.java similarity index 100% rename from test/src/main/java/org/jvnet/hudson/test/TestExtensionLoader.java rename to test-harness/src/main/java/org/jvnet/hudson/test/TestExtensionLoader.java diff --git a/test/src/main/java/org/jvnet/hudson/test/TestNotifier.java b/test-harness/src/main/java/org/jvnet/hudson/test/TestNotifier.java similarity index 93% rename from test/src/main/java/org/jvnet/hudson/test/TestNotifier.java rename to test-harness/src/main/java/org/jvnet/hudson/test/TestNotifier.java index 91fd8a4862..f704761106 100644 --- a/test/src/main/java/org/jvnet/hudson/test/TestNotifier.java +++ b/test-harness/src/main/java/org/jvnet/hudson/test/TestNotifier.java @@ -41,6 +41,10 @@ public abstract class TestNotifier extends Notifier { public boolean isApplicable(Class jobType) { return true; } + @Override // TODO 1.635+ delete + public String getDisplayName() { + return "TestNotifier"; + } }; } diff --git a/test/src/main/java/org/jvnet/hudson/test/TestPluginManager.java b/test-harness/src/main/java/org/jvnet/hudson/test/TestPluginManager.java similarity index 100% rename from test/src/main/java/org/jvnet/hudson/test/TestPluginManager.java rename to test-harness/src/main/java/org/jvnet/hudson/test/TestPluginManager.java diff --git a/test/src/main/java/org/jvnet/hudson/test/ThreadPoolImpl.java b/test-harness/src/main/java/org/jvnet/hudson/test/ThreadPoolImpl.java similarity index 100% rename from test/src/main/java/org/jvnet/hudson/test/ThreadPoolImpl.java rename to test-harness/src/main/java/org/jvnet/hudson/test/ThreadPoolImpl.java diff --git a/test/src/main/java/org/jvnet/hudson/test/TouchBuilder.java b/test-harness/src/main/java/org/jvnet/hudson/test/TouchBuilder.java similarity index 100% rename from test/src/main/java/org/jvnet/hudson/test/TouchBuilder.java rename to test-harness/src/main/java/org/jvnet/hudson/test/TouchBuilder.java diff --git a/test/src/main/java/org/jvnet/hudson/test/UnstableBuilder.java b/test-harness/src/main/java/org/jvnet/hudson/test/UnstableBuilder.java similarity index 93% rename from test/src/main/java/org/jvnet/hudson/test/UnstableBuilder.java rename to test-harness/src/main/java/org/jvnet/hudson/test/UnstableBuilder.java index cca54539e9..dde21edbd6 100644 --- a/test/src/main/java/org/jvnet/hudson/test/UnstableBuilder.java +++ b/test-harness/src/main/java/org/jvnet/hudson/test/UnstableBuilder.java @@ -45,5 +45,10 @@ public class UnstableBuilder extends MockBuilder { public UnstableBuilder newInstance(StaplerRequest req, JSONObject data) { return new UnstableBuilder(); } + + @Override // TODO 1.635+ delete + public String getDisplayName() { + return "UnstableBuilder"; + } } } diff --git a/test/src/main/java/org/jvnet/hudson/test/WarExploder.java b/test-harness/src/main/java/org/jvnet/hudson/test/WarExploder.java similarity index 100% rename from test/src/main/java/org/jvnet/hudson/test/WarExploder.java rename to test-harness/src/main/java/org/jvnet/hudson/test/WarExploder.java diff --git a/test/src/main/java/org/jvnet/hudson/test/WithoutJenkins.java b/test-harness/src/main/java/org/jvnet/hudson/test/WithoutJenkins.java similarity index 100% rename from test/src/main/java/org/jvnet/hudson/test/WithoutJenkins.java rename to test-harness/src/main/java/org/jvnet/hudson/test/WithoutJenkins.java diff --git a/test/src/main/java/org/jvnet/hudson/test/WorkspaceCopyFileBuilder.java b/test-harness/src/main/java/org/jvnet/hudson/test/WorkspaceCopyFileBuilder.java similarity index 100% rename from test/src/main/java/org/jvnet/hudson/test/WorkspaceCopyFileBuilder.java rename to test-harness/src/main/java/org/jvnet/hudson/test/WorkspaceCopyFileBuilder.java diff --git a/test/src/main/java/org/jvnet/hudson/test/junit/FailedTest.java b/test-harness/src/main/java/org/jvnet/hudson/test/junit/FailedTest.java similarity index 100% rename from test/src/main/java/org/jvnet/hudson/test/junit/FailedTest.java rename to test-harness/src/main/java/org/jvnet/hudson/test/junit/FailedTest.java diff --git a/test/src/main/java/org/jvnet/hudson/test/junit/GroupedTest.java b/test-harness/src/main/java/org/jvnet/hudson/test/junit/GroupedTest.java similarity index 100% rename from test/src/main/java/org/jvnet/hudson/test/junit/GroupedTest.java rename to test-harness/src/main/java/org/jvnet/hudson/test/junit/GroupedTest.java diff --git a/test/src/main/java/org/jvnet/hudson/test/package-info.java b/test-harness/src/main/java/org/jvnet/hudson/test/package-info.java similarity index 100% rename from test/src/main/java/org/jvnet/hudson/test/package-info.java rename to test-harness/src/main/java/org/jvnet/hudson/test/package-info.java diff --git a/test/src/main/java/org/jvnet/hudson/test/recipes/LocalData.java b/test-harness/src/main/java/org/jvnet/hudson/test/recipes/LocalData.java similarity index 100% rename from test/src/main/java/org/jvnet/hudson/test/recipes/LocalData.java rename to test-harness/src/main/java/org/jvnet/hudson/test/recipes/LocalData.java diff --git a/test/src/main/java/org/jvnet/hudson/test/recipes/PresetData.java b/test-harness/src/main/java/org/jvnet/hudson/test/recipes/PresetData.java similarity index 100% rename from test/src/main/java/org/jvnet/hudson/test/recipes/PresetData.java rename to test-harness/src/main/java/org/jvnet/hudson/test/recipes/PresetData.java diff --git a/test/src/main/java/org/jvnet/hudson/test/recipes/Recipe.java b/test-harness/src/main/java/org/jvnet/hudson/test/recipes/Recipe.java similarity index 100% rename from test/src/main/java/org/jvnet/hudson/test/recipes/Recipe.java rename to test-harness/src/main/java/org/jvnet/hudson/test/recipes/Recipe.java diff --git a/test/src/main/java/org/jvnet/hudson/test/recipes/WithPlugin.java b/test-harness/src/main/java/org/jvnet/hudson/test/recipes/WithPlugin.java similarity index 100% rename from test/src/main/java/org/jvnet/hudson/test/recipes/WithPlugin.java rename to test-harness/src/main/java/org/jvnet/hudson/test/recipes/WithPlugin.java diff --git a/test/src/main/java/org/jvnet/hudson/test/recipes/WithPluginManager.java b/test-harness/src/main/java/org/jvnet/hudson/test/recipes/WithPluginManager.java similarity index 100% rename from test/src/main/java/org/jvnet/hudson/test/recipes/WithPluginManager.java rename to test-harness/src/main/java/org/jvnet/hudson/test/recipes/WithPluginManager.java diff --git a/test/src/main/java/org/jvnet/hudson/test/recipes/WithTimeout.java b/test-harness/src/main/java/org/jvnet/hudson/test/recipes/WithTimeout.java similarity index 100% rename from test/src/main/java/org/jvnet/hudson/test/recipes/WithTimeout.java rename to test-harness/src/main/java/org/jvnet/hudson/test/recipes/WithTimeout.java diff --git a/test/src/main/java/org/jvnet/hudson/test/recipes/package-info.java b/test-harness/src/main/java/org/jvnet/hudson/test/recipes/package-info.java similarity index 100% rename from test/src/main/java/org/jvnet/hudson/test/recipes/package-info.java rename to test-harness/src/main/java/org/jvnet/hudson/test/recipes/package-info.java diff --git a/test/src/main/java/org/jvnet/hudson/test/rhino/CallStackFrame.java b/test-harness/src/main/java/org/jvnet/hudson/test/rhino/CallStackFrame.java similarity index 100% rename from test/src/main/java/org/jvnet/hudson/test/rhino/CallStackFrame.java rename to test-harness/src/main/java/org/jvnet/hudson/test/rhino/CallStackFrame.java diff --git a/test/src/main/java/org/jvnet/hudson/test/rhino/JavaScriptDebugger.java b/test-harness/src/main/java/org/jvnet/hudson/test/rhino/JavaScriptDebugger.java similarity index 100% rename from test/src/main/java/org/jvnet/hudson/test/rhino/JavaScriptDebugger.java rename to test-harness/src/main/java/org/jvnet/hudson/test/rhino/JavaScriptDebugger.java diff --git a/test/src/main/java/org/jvnet/hudson/test/rhino/package-info.java b/test-harness/src/main/java/org/jvnet/hudson/test/rhino/package-info.java similarity index 100% rename from test/src/main/java/org/jvnet/hudson/test/rhino/package-info.java rename to test-harness/src/main/java/org/jvnet/hudson/test/rhino/package-info.java diff --git a/test/src/main/preset-data/anonymous-readonly/config.xml b/test-harness/src/main/preset-data/anonymous-readonly/config.xml similarity index 100% rename from test/src/main/preset-data/anonymous-readonly/config.xml rename to test-harness/src/main/preset-data/anonymous-readonly/config.xml diff --git a/test/src/main/preset-data/anonymous-readonly/readme.txt b/test-harness/src/main/preset-data/anonymous-readonly/readme.txt similarity index 100% rename from test/src/main/preset-data/anonymous-readonly/readme.txt rename to test-harness/src/main/preset-data/anonymous-readonly/readme.txt diff --git a/test/src/main/preset-data/no-anonymous-readaccess/config.xml b/test-harness/src/main/preset-data/no-anonymous-readaccess/config.xml similarity index 100% rename from test/src/main/preset-data/no-anonymous-readaccess/config.xml rename to test-harness/src/main/preset-data/no-anonymous-readaccess/config.xml diff --git a/test/src/main/preset-data/no-anonymous-readaccess/readme.txt b/test-harness/src/main/preset-data/no-anonymous-readaccess/readme.txt similarity index 100% rename from test/src/main/preset-data/no-anonymous-readaccess/readme.txt rename to test-harness/src/main/preset-data/no-anonymous-readaccess/readme.txt diff --git a/test/src/main/preset-data/package.groovy b/test-harness/src/main/preset-data/package.groovy similarity index 98% rename from test/src/main/preset-data/package.groovy rename to test-harness/src/main/preset-data/package.groovy index e20d6b99d2..437a8b3545 100644 --- a/test/src/main/preset-data/package.groovy +++ b/test-harness/src/main/preset-data/package.groovy @@ -31,7 +31,6 @@ targetDir.mkdirs(); File dataSetRoot = new File(baseDir,"src/main/preset-data"); dataSetRoot.eachDir { d -> - if(d.name==".svn") return; // if(!new File(d,"config.xml").exists()) return; Zip zip = new Zip(); diff --git a/test/src/main/preset-data/readme.txt b/test-harness/src/main/preset-data/readme.txt similarity index 100% rename from test/src/main/preset-data/readme.txt rename to test-harness/src/main/preset-data/readme.txt diff --git a/test/src/main/preset-data/secured-acegi/config.xml b/test-harness/src/main/preset-data/secured-acegi/config.xml similarity index 100% rename from test/src/main/preset-data/secured-acegi/config.xml rename to test-harness/src/main/preset-data/secured-acegi/config.xml diff --git a/test/src/main/preset-data/secured-acegi/readme.txt b/test-harness/src/main/preset-data/secured-acegi/readme.txt similarity index 100% rename from test/src/main/preset-data/secured-acegi/readme.txt rename to test-harness/src/main/preset-data/secured-acegi/readme.txt diff --git a/test/src/main/preset-data/secured-acegi/users/alice/config.xml b/test-harness/src/main/preset-data/secured-acegi/users/alice/config.xml similarity index 100% rename from test/src/main/preset-data/secured-acegi/users/alice/config.xml rename to test-harness/src/main/preset-data/secured-acegi/users/alice/config.xml diff --git a/test/src/main/resources/org/jvnet/hudson/test/CaptureEnvironmentBuilder/config.jelly b/test-harness/src/main/resources/org/jvnet/hudson/test/CaptureEnvironmentBuilder/config.jelly similarity index 100% rename from test/src/main/resources/org/jvnet/hudson/test/CaptureEnvironmentBuilder/config.jelly rename to test-harness/src/main/resources/org/jvnet/hudson/test/CaptureEnvironmentBuilder/config.jelly diff --git a/test/src/main/resources/org/jvnet/hudson/test/ComputerConnectorTester/configure.jelly b/test-harness/src/main/resources/org/jvnet/hudson/test/ComputerConnectorTester/configure.jelly similarity index 100% rename from test/src/main/resources/org/jvnet/hudson/test/ComputerConnectorTester/configure.jelly rename to test-harness/src/main/resources/org/jvnet/hudson/test/ComputerConnectorTester/configure.jelly diff --git a/test/src/main/resources/org/jvnet/hudson/test/ComputerConnectorTester/configure_es.properties b/test-harness/src/main/resources/org/jvnet/hudson/test/ComputerConnectorTester/configure_es.properties similarity index 100% rename from test/src/main/resources/org/jvnet/hudson/test/ComputerConnectorTester/configure_es.properties rename to test-harness/src/main/resources/org/jvnet/hudson/test/ComputerConnectorTester/configure_es.properties diff --git a/test/src/main/resources/org/jvnet/hudson/test/ComputerConnectorTester/configure_fr.properties b/test-harness/src/main/resources/org/jvnet/hudson/test/ComputerConnectorTester/configure_fr.properties similarity index 100% rename from test/src/main/resources/org/jvnet/hudson/test/ComputerConnectorTester/configure_fr.properties rename to test-harness/src/main/resources/org/jvnet/hudson/test/ComputerConnectorTester/configure_fr.properties diff --git a/test/src/main/resources/org/jvnet/hudson/test/ComputerConnectorTester/configure_pt.properties b/test-harness/src/main/resources/org/jvnet/hudson/test/ComputerConnectorTester/configure_pt.properties similarity index 100% rename from test/src/main/resources/org/jvnet/hudson/test/ComputerConnectorTester/configure_pt.properties rename to test-harness/src/main/resources/org/jvnet/hudson/test/ComputerConnectorTester/configure_pt.properties diff --git a/test/src/main/resources/org/jvnet/hudson/test/ComputerConnectorTester/configure_pt_BR.properties b/test-harness/src/main/resources/org/jvnet/hudson/test/ComputerConnectorTester/configure_pt_BR.properties similarity index 100% rename from test/src/main/resources/org/jvnet/hudson/test/ComputerConnectorTester/configure_pt_BR.properties rename to test-harness/src/main/resources/org/jvnet/hudson/test/ComputerConnectorTester/configure_pt_BR.properties diff --git a/test/src/main/resources/org/jvnet/hudson/test/ComputerConnectorTester/configure_zh_TW.properties b/test-harness/src/main/resources/org/jvnet/hudson/test/ComputerConnectorTester/configure_zh_TW.properties similarity index 100% rename from test/src/main/resources/org/jvnet/hudson/test/ComputerConnectorTester/configure_zh_TW.properties rename to test-harness/src/main/resources/org/jvnet/hudson/test/ComputerConnectorTester/configure_zh_TW.properties diff --git a/test/src/main/resources/org/jvnet/hudson/test/FailureBuilder/config.jelly b/test-harness/src/main/resources/org/jvnet/hudson/test/FailureBuilder/config.jelly similarity index 100% rename from test/src/main/resources/org/jvnet/hudson/test/FailureBuilder/config.jelly rename to test-harness/src/main/resources/org/jvnet/hudson/test/FailureBuilder/config.jelly diff --git a/test/src/main/resources/org/jvnet/hudson/test/MockBuilder/config.jelly b/test-harness/src/main/resources/org/jvnet/hudson/test/MockBuilder/config.jelly similarity index 100% rename from test/src/main/resources/org/jvnet/hudson/test/MockBuilder/config.jelly rename to test-harness/src/main/resources/org/jvnet/hudson/test/MockBuilder/config.jelly diff --git a/test/src/main/resources/org/jvnet/hudson/test/SleepBuilder/config.jelly b/test-harness/src/main/resources/org/jvnet/hudson/test/SleepBuilder/config.jelly similarity index 100% rename from test/src/main/resources/org/jvnet/hudson/test/SleepBuilder/config.jelly rename to test-harness/src/main/resources/org/jvnet/hudson/test/SleepBuilder/config.jelly diff --git a/test/src/main/resources/org/jvnet/hudson/test/SleepBuilder/config_pt.properties b/test-harness/src/main/resources/org/jvnet/hudson/test/SleepBuilder/config_pt.properties similarity index 100% rename from test/src/main/resources/org/jvnet/hudson/test/SleepBuilder/config_pt.properties rename to test-harness/src/main/resources/org/jvnet/hudson/test/SleepBuilder/config_pt.properties diff --git a/test/src/main/resources/org/jvnet/hudson/test/SleepBuilder/config_pt_BR.properties b/test-harness/src/main/resources/org/jvnet/hudson/test/SleepBuilder/config_pt_BR.properties similarity index 100% rename from test/src/main/resources/org/jvnet/hudson/test/SleepBuilder/config_pt_BR.properties rename to test-harness/src/main/resources/org/jvnet/hudson/test/SleepBuilder/config_pt_BR.properties diff --git a/test/src/main/resources/org/jvnet/hudson/test/UnstableBuilder/config.jelly b/test-harness/src/main/resources/org/jvnet/hudson/test/UnstableBuilder/config.jelly similarity index 100% rename from test/src/main/resources/org/jvnet/hudson/test/UnstableBuilder/config.jelly rename to test-harness/src/main/resources/org/jvnet/hudson/test/UnstableBuilder/config.jelly diff --git a/test/src/test/java/org/jvnet/hudson/main/AppTest.java b/test-harness/src/test/java/org/jvnet/hudson/main/AppTest.java similarity index 100% rename from test/src/test/java/org/jvnet/hudson/main/AppTest.java rename to test-harness/src/test/java/org/jvnet/hudson/main/AppTest.java diff --git a/test/src/test/java/org/jvnet/hudson/main/JenkinsRuleTimeoutTest.java b/test-harness/src/test/java/org/jvnet/hudson/main/JenkinsRuleTimeoutTest.java similarity index 100% rename from test/src/test/java/org/jvnet/hudson/main/JenkinsRuleTimeoutTest.java rename to test-harness/src/test/java/org/jvnet/hudson/main/JenkinsRuleTimeoutTest.java diff --git a/test/src/test/java/org/jvnet/hudson/main/UseRecipesWithJenkinsRuleTest.java b/test-harness/src/test/java/org/jvnet/hudson/main/UseRecipesWithJenkinsRuleTest.java similarity index 100% rename from test/src/test/java/org/jvnet/hudson/main/UseRecipesWithJenkinsRuleTest.java rename to test-harness/src/test/java/org/jvnet/hudson/main/UseRecipesWithJenkinsRuleTest.java diff --git a/test/src/test/java/org/jvnet/hudson/test/HudsonTestCaseShutdownSlaveTest.java b/test-harness/src/test/java/org/jvnet/hudson/test/HudsonTestCaseShutdownSlaveTest.java similarity index 100% rename from test/src/test/java/org/jvnet/hudson/test/HudsonTestCaseShutdownSlaveTest.java rename to test-harness/src/test/java/org/jvnet/hudson/test/HudsonTestCaseShutdownSlaveTest.java diff --git a/test/src/test/java/org/jvnet/hudson/test/JenkinsRuleTest.java b/test-harness/src/test/java/org/jvnet/hudson/test/JenkinsRuleTest.java similarity index 100% rename from test/src/test/java/org/jvnet/hudson/test/JenkinsRuleTest.java rename to test-harness/src/test/java/org/jvnet/hudson/test/JenkinsRuleTest.java diff --git a/test/src/test/java/org/jvnet/hudson/test/MemoryAssertTest.java b/test-harness/src/test/java/org/jvnet/hudson/test/MemoryAssertTest.java similarity index 100% rename from test/src/test/java/org/jvnet/hudson/test/MemoryAssertTest.java rename to test-harness/src/test/java/org/jvnet/hudson/test/MemoryAssertTest.java diff --git a/test/src/test/java/org/jvnet/hudson/test/MockFolderTest.java b/test-harness/src/test/java/org/jvnet/hudson/test/MockFolderTest.java similarity index 100% rename from test/src/test/java/org/jvnet/hudson/test/MockFolderTest.java rename to test-harness/src/test/java/org/jvnet/hudson/test/MockFolderTest.java diff --git a/test/src/test/resources/org/jvnet/hudson/main/UseRecipesWithJenkinsRuleTest/testGetItemFromLocalData/config.xml b/test-harness/src/test/resources/org/jvnet/hudson/main/UseRecipesWithJenkinsRuleTest/testGetItemFromLocalData/config.xml similarity index 100% rename from test/src/test/resources/org/jvnet/hudson/main/UseRecipesWithJenkinsRuleTest/testGetItemFromLocalData/config.xml rename to test-harness/src/test/resources/org/jvnet/hudson/main/UseRecipesWithJenkinsRuleTest/testGetItemFromLocalData/config.xml diff --git a/test/src/test/resources/org/jvnet/hudson/main/UseRecipesWithJenkinsRuleTest/testGetItemFromLocalData/jobs/testJob/config.xml b/test-harness/src/test/resources/org/jvnet/hudson/main/UseRecipesWithJenkinsRuleTest/testGetItemFromLocalData/jobs/testJob/config.xml similarity index 100% rename from test/src/test/resources/org/jvnet/hudson/main/UseRecipesWithJenkinsRuleTest/testGetItemFromLocalData/jobs/testJob/config.xml rename to test-harness/src/test/resources/org/jvnet/hudson/main/UseRecipesWithJenkinsRuleTest/testGetItemFromLocalData/jobs/testJob/config.xml diff --git a/test/src/main/resources/plugins/tasks.jpi b/test-harness/src/test/resources/plugins/tasks.jpi similarity index 100% rename from test/src/main/resources/plugins/tasks.jpi rename to test-harness/src/test/resources/plugins/tasks.jpi diff --git a/test/pom.xml b/test/pom.xml index 0e432c6075..7cd321bb1e 100644 --- a/test/pom.xml +++ b/test/pom.xml @@ -31,10 +31,10 @@ THE SOFTWARE. 1.645-SNAPSHOT - jenkins-test-harness + test - Test harness for Jenkins and plugins - Unit test harness (src/main) and Unit tests for Jenkins core (src/test) + Tests for Jenkins core + Functional tests for Jenkins core 2 @@ -60,6 +60,18 @@ THE SOFTWARE. + + ${project.groupId} + jenkins-test-harness + ${project.version} + test + + + ${project.groupId} + jenkins-test-harness-tools + ${project.version} + test + ${project.groupId} maven-plugin @@ -87,20 +99,11 @@ THE SOFTWARE. - - org.jenkins-ci.plugins - ant - 1.2 - - + org.jenkins-ci.plugins subversion 1.45 - - - org.jenkins-ci.plugins - mailer - 1.10 + test org.jenkins-ci.plugins @@ -111,6 +114,7 @@ THE SOFTWARE. org.jenkins-ci.plugins antisamy-markup-formatter 1.0 + test org.jenkins-ci.plugins @@ -121,57 +125,26 @@ THE SOFTWARE. org.jenkins-ci.plugins junit 1.2-beta-4 - - - org.mortbay.jetty - jetty - 6.1.26 - - - org.jenkins-ci - test-annotations - ${test-annotations.version} - - compile + test org.jvnet.mock-javamail mock-javamail 1.7 - - junit - junit - org.hamcrest - hamcrest-library + hamcrest-core 1.3 - - net.sourceforge.htmlunit - htmlunit - 2.18 - - - commons-codec - commons-codec - - - xalan xalan 2.7.1 - - - org.jvnet.hudson - embedded-rhino-debugger - 1.2 - org.jvnet.hudson - htmlunit-core-js + xml-apis + xml-apis @@ -191,16 +164,6 @@ THE SOFTWARE. mockito-core test - - org.netbeans.modules - org-netbeans-insane - RELEASE72 - - - com.github.stephenc.findbugs - findbugs-annotations - 1.3.9-1 - org.codehaus.geb geb-implicit-assertions @@ -258,16 +221,6 @@ THE SOFTWARE. testCompile - - preset-packager - process-resources - - execute - - - ${pom.basedir}/src/main/preset-data/package.groovy - - diff --git a/test/src/main/preset-data/simple-projects/build.xml b/test/src/main/preset-data/simple-projects/build.xml deleted file mode 100644 index 05968f48ac..0000000000 --- a/test/src/main/preset-data/simple-projects/build.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/test/src/main/preset-data/simple-projects/pom.xml b/test/src/main/preset-data/simple-projects/pom.xml deleted file mode 100644 index 942d26c344..0000000000 --- a/test/src/main/preset-data/simple-projects/pom.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - 4.0.0 - - com.example - test.prop.hudson - 1.0 - pom - - - default - - diff --git a/test/src/main/preset-data/svn-repo/conf/authz b/test/src/main/preset-data/svn-repo/conf/authz deleted file mode 100644 index 0b9a41074e..0000000000 --- a/test/src/main/preset-data/svn-repo/conf/authz +++ /dev/null @@ -1,32 +0,0 @@ -### This file is an example authorization file for svnserve. -### Its format is identical to that of mod_authz_svn authorization -### files. -### As shown below each section defines authorizations for the path and -### (optional) repository specified by the section name. -### The authorizations follow. An authorization line can refer to: -### - a single user, -### - a group of users defined in a special [groups] section, -### - an alias defined in a special [aliases] section, -### - all authenticated users, using the '$authenticated' token, -### - only anonymous users, using the '$anonymous' token, -### - anyone, using the '*' wildcard. -### -### A match can be inverted by prefixing the rule with '~'. Rules can -### grant read ('r') access, read-write ('rw') access, or no access -### (''). - -[aliases] -# joe = /C=XZ/ST=Dessert/L=Snake City/O=Snake Oil, Ltd./OU=Research Institute/CN=Joe Average - -[groups] -# harry_and_sally = harry,sally -# harry_sally_and_joe = harry,sally,&joe - -# [/foo/bar] -# harry = rw -# &joe = r -# * = - -# [repository:/baz/fuz] -# @harry_and_sally = rw -# * = r diff --git a/test/src/main/preset-data/svn-repo/conf/passwd b/test/src/main/preset-data/svn-repo/conf/passwd deleted file mode 100644 index ecaa08dcec..0000000000 --- a/test/src/main/preset-data/svn-repo/conf/passwd +++ /dev/null @@ -1,8 +0,0 @@ -### This file is an example password file for svnserve. -### Its format is similar to that of svnserve.conf. As shown in the -### example below it contains one section labelled [users]. -### The name and password for each user follow, one account per line. - -[users] -# harry = harryssecret -# sally = sallyssecret diff --git a/test/src/main/preset-data/svn-repo/conf/svnserve.conf b/test/src/main/preset-data/svn-repo/conf/svnserve.conf deleted file mode 100644 index e62a01eccc..0000000000 --- a/test/src/main/preset-data/svn-repo/conf/svnserve.conf +++ /dev/null @@ -1,47 +0,0 @@ -### This file controls the configuration of the svnserve daemon, if you -### use it to allow access to this repository. (If you only allow -### access through http: and/or file: URLs, then this file is -### irrelevant.) - -### Visit http://subversion.tigris.org/ for more information. - -[general] -### These options control access to the repository for unauthenticated -### and authenticated users. Valid values are "write", "read", -### and "none". The sample settings below are the defaults. -# anon-access = read -# auth-access = write -### The password-db option controls the location of the password -### database file. Unless you specify a path starting with a /, -### the file's location is relative to the directory containing -### this configuration file. -### If SASL is enabled (see below), this file will NOT be used. -### Uncomment the line below to use the default password file. -# password-db = passwd -### The authz-db option controls the location of the authorization -### rules for path-based access control. Unless you specify a path -### starting with a /, the file's location is relative to the the -### directory containing this file. If you don't specify an -### authz-db, no path-based access control is done. -### Uncomment the line below to use the default authorization file. -# authz-db = authz -### This option specifies the authentication realm of the repository. -### If two repositories have the same authentication realm, they should -### have the same password database, and vice versa. The default realm -### is repository's uuid. -# realm = My First Repository - -[sasl] -### This option specifies whether you want to use the Cyrus SASL -### library for authentication. Default is false. -### This section will be ignored if svnserve is not built with Cyrus -### SASL support; to check, run 'svnserve --version' and look for a line -### reading 'Cyrus SASL authentication is available.' -# use-sasl = true -### These options specify the desired strength of the security layer -### that you want SASL to provide. 0 means no encryption, 1 means -### integrity-checking only, values larger than 1 are correlated -### to the effective key length for encryption (e.g. 128 means 128-bit -### encryption). The values below are the defaults. -# min-encryption = 0 -# max-encryption = 256 diff --git a/test/src/main/preset-data/svn-repo/db/current b/test/src/main/preset-data/svn-repo/db/current deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/src/main/preset-data/svn-repo/db/current +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/src/main/preset-data/svn-repo/db/format b/test/src/main/preset-data/svn-repo/db/format deleted file mode 100644 index ef83e21c67..0000000000 --- a/test/src/main/preset-data/svn-repo/db/format +++ /dev/null @@ -1,2 +0,0 @@ -3 -layout sharded 1000 diff --git a/test/src/main/preset-data/svn-repo/db/fs-type b/test/src/main/preset-data/svn-repo/db/fs-type deleted file mode 100644 index 4fdd95313f..0000000000 --- a/test/src/main/preset-data/svn-repo/db/fs-type +++ /dev/null @@ -1 +0,0 @@ -fsfs diff --git a/test/src/main/preset-data/svn-repo/db/revprops/0/0 b/test/src/main/preset-data/svn-repo/db/revprops/0/0 deleted file mode 100644 index 904f0aa048..0000000000 --- a/test/src/main/preset-data/svn-repo/db/revprops/0/0 +++ /dev/null @@ -1,5 +0,0 @@ -K 8 -svn:date -V 27 -2008-09-24T14:51:25.674211Z -END diff --git a/test/src/main/preset-data/svn-repo/db/revprops/0/1 b/test/src/main/preset-data/svn-repo/db/revprops/0/1 deleted file mode 100644 index 58fd5a2ddd..0000000000 --- a/test/src/main/preset-data/svn-repo/db/revprops/0/1 +++ /dev/null @@ -1,13 +0,0 @@ -K 10 -svn:author -V 7 -kohsuke -K 8 -svn:date -V 27 -2008-09-24T14:52:50.612794Z -K 7 -svn:log -V 15 -initial commits -END diff --git a/test/src/main/preset-data/svn-repo/db/revs/0/0 b/test/src/main/preset-data/svn-repo/db/revs/0/0 deleted file mode 100644 index 10f5c45f9d..0000000000 --- a/test/src/main/preset-data/svn-repo/db/revs/0/0 +++ /dev/null @@ -1,11 +0,0 @@ -PLAIN -END -ENDREP -id: 0.0.r0/17 -type: dir -count: 0 -text: 0 0 4 4 2d2977d1c96f487abe4a1e202dd03b4e -cpath: / - - -17 107 diff --git a/test/src/main/preset-data/svn-repo/db/revs/0/1 b/test/src/main/preset-data/svn-repo/db/revs/0/1 deleted file mode 100644 index 010a85d5c2..0000000000 Binary files a/test/src/main/preset-data/svn-repo/db/revs/0/1 and /dev/null differ diff --git a/test/src/main/preset-data/svn-repo/db/txn-current b/test/src/main/preset-data/svn-repo/db/txn-current deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/src/main/preset-data/svn-repo/db/txn-current +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/src/main/preset-data/svn-repo/db/txn-current-lock b/test/src/main/preset-data/svn-repo/db/txn-current-lock deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/src/main/preset-data/svn-repo/db/uuid b/test/src/main/preset-data/svn-repo/db/uuid deleted file mode 100644 index 448e4dcb53..0000000000 --- a/test/src/main/preset-data/svn-repo/db/uuid +++ /dev/null @@ -1 +0,0 @@ -a73f0dfb-3e07-491e-ae4c-8e8eaa23c11d diff --git a/test/src/main/preset-data/svn-repo/db/write-lock b/test/src/main/preset-data/svn-repo/db/write-lock deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/src/main/preset-data/svn-repo/format b/test/src/main/preset-data/svn-repo/format deleted file mode 100644 index 7ed6ff82de..0000000000 --- a/test/src/main/preset-data/svn-repo/format +++ /dev/null @@ -1 +0,0 @@ -5 diff --git a/test/src/main/preset-data/svn-repo/hooks/post-commit.tmpl b/test/src/main/preset-data/svn-repo/hooks/post-commit.tmpl deleted file mode 100644 index 694326113b..0000000000 --- a/test/src/main/preset-data/svn-repo/hooks/post-commit.tmpl +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/sh - -# POST-COMMIT HOOK -# -# The post-commit hook is invoked after a commit. Subversion runs -# this hook by invoking a program (script, executable, binary, etc.) -# named 'post-commit' (for which this file is a template) with the -# following ordered arguments: -# -# [1] REPOS-PATH (the path to this repository) -# [2] REV (the number of the revision just committed) -# -# The default working directory for the invocation is undefined, so -# the program should set one explicitly if it cares. -# -# Because the commit has already completed and cannot be undone, -# the exit code of the hook program is ignored. The hook program -# can use the 'svnlook' utility to help it examine the -# newly-committed tree. -# -# On a Unix system, the normal procedure is to have 'post-commit' -# invoke other programs to do the real work, though it may do the -# work itself too. -# -# Note that 'post-commit' must be executable by the user(s) who will -# invoke it (typically the user httpd runs as), and that user must -# have filesystem-level permission to access the repository. -# -# On a Windows system, you should name the hook program -# 'post-commit.bat' or 'post-commit.exe', -# but the basic idea is the same. -# -# The hook program typically does not inherit the environment of -# its parent process. For example, a common problem is for the -# PATH environment variable to not be set to its usual value, so -# that subprograms fail to launch unless invoked via absolute path. -# If you're having unexpected problems with a hook program, the -# culprit may be unusual (or missing) environment variables. -# -# Here is an example hook script, for a Unix /bin/sh interpreter. -# For more examples and pre-written hooks, see those in -# the Subversion repository at -# http://svn.collab.net/repos/svn/trunk/tools/hook-scripts/ and -# http://svn.collab.net/repos/svn/trunk/contrib/hook-scripts/ - - -REPOS="$1" -REV="$2" - -/usr/share/subversion/hook-scripts/commit-email.pl \ - "$REPOS" "$REV" commit-watchers@example.org diff --git a/test/src/main/preset-data/svn-repo/hooks/post-lock.tmpl b/test/src/main/preset-data/svn-repo/hooks/post-lock.tmpl deleted file mode 100644 index fc2e05cc5a..0000000000 --- a/test/src/main/preset-data/svn-repo/hooks/post-lock.tmpl +++ /dev/null @@ -1,45 +0,0 @@ -#!/bin/sh - -# POST-LOCK HOOK -# -# The post-lock hook is run after a path is locked. Subversion runs -# this hook by invoking a program (script, executable, binary, etc.) -# named 'post-lock' (for which this file is a template) with the -# following ordered arguments: -# -# [1] REPOS-PATH (the path to this repository) -# [2] USER (the user who created the lock) -# -# The paths that were just locked are passed to the hook via STDIN (as -# of Subversion 1.2, only one path is passed per invocation, but the -# plan is to pass all locked paths at once, so the hook program -# should be written accordingly). -# -# The default working directory for the invocation is undefined, so -# the program should set one explicitly if it cares. -# -# Because the lock has already been created and cannot be undone, -# the exit code of the hook program is ignored. The hook program -# can use the 'svnlook' utility to help it examine the -# newly-created lock. -# -# On a Unix system, the normal procedure is to have 'post-lock' -# invoke other programs to do the real work, though it may do the -# work itself too. -# -# Note that 'post-lock' must be executable by the user(s) who will -# invoke it (typically the user httpd runs as), and that user must -# have filesystem-level permission to access the repository. -# -# On a Windows system, you should name the hook program -# 'post-lock.bat' or 'post-lock.exe', -# but the basic idea is the same. -# -# Here is an example hook script, for a Unix /bin/sh interpreter: - -REPOS="$1" -USER="$2" - -# Send email to interested parties, let them know a lock was created: -/usr/share/subversion/hook-scripts/mailer/mailer.py lock \ - "$REPOS" "$USER" "$REPOS"/hooks/mailer.conf diff --git a/test/src/main/preset-data/svn-repo/hooks/post-revprop-change.tmpl b/test/src/main/preset-data/svn-repo/hooks/post-revprop-change.tmpl deleted file mode 100644 index 43f9b6accc..0000000000 --- a/test/src/main/preset-data/svn-repo/hooks/post-revprop-change.tmpl +++ /dev/null @@ -1,57 +0,0 @@ -#!/bin/sh - -# POST-REVPROP-CHANGE HOOK -# -# The post-revprop-change hook is invoked after a revision property -# has been added, modified or deleted. Subversion runs this hook by -# invoking a program (script, executable, binary, etc.) named -# 'post-revprop-change' (for which this file is a template), with the -# following ordered arguments: -# -# [1] REPOS-PATH (the path to this repository) -# [2] REV (the revision that was tweaked) -# [3] USER (the username of the person tweaking the property) -# [4] PROPNAME (the property that was changed) -# [5] ACTION (the property was 'A'dded, 'M'odified, or 'D'eleted) -# -# [STDIN] PROPVAL ** the old property value is passed via STDIN. -# -# Because the propchange has already completed and cannot be undone, -# the exit code of the hook program is ignored. The hook program -# can use the 'svnlook' utility to help it examine the -# new property value. -# -# On a Unix system, the normal procedure is to have 'post-revprop-change' -# invoke other programs to do the real work, though it may do the -# work itself too. -# -# Note that 'post-revprop-change' must be executable by the user(s) who will -# invoke it (typically the user httpd runs as), and that user must -# have filesystem-level permission to access the repository. -# -# On a Windows system, you should name the hook program -# 'post-revprop-change.bat' or 'post-revprop-change.exe', -# but the basic idea is the same. -# -# The hook program typically does not inherit the environment of -# its parent process. For example, a common problem is for the -# PATH environment variable to not be set to its usual value, so -# that subprograms fail to launch unless invoked via absolute path. -# If you're having unexpected problems with a hook program, the -# culprit may be unusual (or missing) environment variables. -# -# Here is an example hook script, for a Unix /bin/sh interpreter. -# For more examples and pre-written hooks, see those in -# the Subversion repository at -# http://svn.collab.net/repos/svn/trunk/tools/hook-scripts/ and -# http://svn.collab.net/repos/svn/trunk/contrib/hook-scripts/ - - -REPOS="$1" -REV="$2" -USER="$3" -PROPNAME="$4" -ACTION="$5" - -/usr/share/subversion/hook-scripts/commit-email.pl --revprop-change \ - "$REPOS" "$REV" "$USER" "$PROPNAME" watchers@example.org diff --git a/test/src/main/preset-data/svn-repo/hooks/post-unlock.tmpl b/test/src/main/preset-data/svn-repo/hooks/post-unlock.tmpl deleted file mode 100644 index 667723e3c1..0000000000 --- a/test/src/main/preset-data/svn-repo/hooks/post-unlock.tmpl +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/sh - -# POST-UNLOCK HOOK -# -# The post-unlock hook runs after a path is unlocked. Subversion runs -# this hook by invoking a program (script, executable, binary, etc.) -# named 'post-unlock' (for which this file is a template) with the -# following ordered arguments: -# -# [1] REPOS-PATH (the path to this repository) -# [2] USER (the user who destroyed the lock) -# -# The paths that were just unlocked are passed to the hook via STDIN -# (as of Subversion 1.2, only one path is passed per invocation, but -# the plan is to pass all unlocked paths at once, so the hook program -# should be written accordingly). -# -# The default working directory for the invocation is undefined, so -# the program should set one explicitly if it cares. -# -# Because the lock has already been destroyed and cannot be undone, -# the exit code of the hook program is ignored. -# -# On a Unix system, the normal procedure is to have 'post-unlock' -# invoke other programs to do the real work, though it may do the -# work itself too. -# -# Note that 'post-unlock' must be executable by the user(s) who will -# invoke it (typically the user httpd runs as), and that user must -# have filesystem-level permission to access the repository. -# -# On a Windows system, you should name the hook program -# 'post-unlock.bat' or 'post-unlock.exe', -# but the basic idea is the same. -# -# Here is an example hook script, for a Unix /bin/sh interpreter: - -REPOS="$1" -USER="$2" - -# Send email to interested parties, let them know a lock was removed: -/usr/share/subversion/hook-scripts/mailer.py unlock \ - "$REPOS" "$USER" "$REPOS"/mailer.conf diff --git a/test/src/main/preset-data/svn-repo/hooks/pre-commit.tmpl b/test/src/main/preset-data/svn-repo/hooks/pre-commit.tmpl deleted file mode 100644 index 716d0603cf..0000000000 --- a/test/src/main/preset-data/svn-repo/hooks/pre-commit.tmpl +++ /dev/null @@ -1,71 +0,0 @@ -#!/bin/sh - -# PRE-COMMIT HOOK -# -# The pre-commit hook is invoked before a Subversion txn is -# committed. Subversion runs this hook by invoking a program -# (script, executable, binary, etc.) named 'pre-commit' (for which -# this file is a template), with the following ordered arguments: -# -# [1] REPOS-PATH (the path to this repository) -# [2] TXN-NAME (the name of the txn about to be committed) -# -# The default working directory for the invocation is undefined, so -# the program should set one explicitly if it cares. -# -# If the hook program exits with success, the txn is committed; but -# if it exits with failure (non-zero), the txn is aborted, no commit -# takes place, and STDERR is returned to the client. The hook -# program can use the 'svnlook' utility to help it examine the txn. -# -# On a Unix system, the normal procedure is to have 'pre-commit' -# invoke other programs to do the real work, though it may do the -# work itself too. -# -# *** NOTE: THE HOOK PROGRAM MUST NOT MODIFY THE TXN, EXCEPT *** -# *** FOR REVISION PROPERTIES (like svn:log or svn:author). *** -# -# This is why we recommend using the read-only 'svnlook' utility. -# In the future, Subversion may enforce the rule that pre-commit -# hooks should not modify the versioned data in txns, or else come -# up with a mechanism to make it safe to do so (by informing the -# committing client of the changes). However, right now neither -# mechanism is implemented, so hook writers just have to be careful. -# -# Note that 'pre-commit' must be executable by the user(s) who will -# invoke it (typically the user httpd runs as), and that user must -# have filesystem-level permission to access the repository. -# -# On a Windows system, you should name the hook program -# 'pre-commit.bat' or 'pre-commit.exe', -# but the basic idea is the same. -# -# The hook program typically does not inherit the environment of -# its parent process. For example, a common problem is for the -# PATH environment variable to not be set to its usual value, so -# that subprograms fail to launch unless invoked via absolute path. -# If you're having unexpected problems with a hook program, the -# culprit may be unusual (or missing) environment variables. -# -# Here is an example hook script, for a Unix /bin/sh interpreter. -# For more examples and pre-written hooks, see those in -# the Subversion repository at -# http://svn.collab.net/repos/svn/trunk/tools/hook-scripts/ and -# http://svn.collab.net/repos/svn/trunk/contrib/hook-scripts/ - - -REPOS="$1" -TXN="$2" - -# Make sure that the log message contains some text. -SVNLOOK=/usr/bin/svnlook -$SVNLOOK log -t "$TXN" "$REPOS" | \ - grep "[a-zA-Z0-9]" > /dev/null || exit 1 - -# Check that the author of this commit has the rights to perform -# the commit on the files and directories being modified. -/usr/share/subversion/hook-scripts/commit-access-control.pl \ - "$REPOS" "$TXN" "$REPOS"/commit-access-control.cfg || exit 1 - -# All checks passed, so allow the commit. -exit 0 diff --git a/test/src/main/preset-data/svn-repo/hooks/pre-lock.tmpl b/test/src/main/preset-data/svn-repo/hooks/pre-lock.tmpl deleted file mode 100644 index 20d0451f0a..0000000000 --- a/test/src/main/preset-data/svn-repo/hooks/pre-lock.tmpl +++ /dev/null @@ -1,64 +0,0 @@ -#!/bin/sh - -# PRE-LOCK HOOK -# -# The pre-lock hook is invoked before an exclusive lock is -# created. Subversion runs this hook by invoking a program -# (script, executable, binary, etc.) named 'pre-lock' (for which -# this file is a template), with the following ordered arguments: -# -# [1] REPOS-PATH (the path to this repository) -# [2] PATH (the path in the repository about to be locked) -# [3] USER (the user creating the lock) -# -# The default working directory for the invocation is undefined, so -# the program should set one explicitly if it cares. -# -# If the hook program exits with success, the lock is created; but -# if it exits with failure (non-zero), the lock action is aborted -# and STDERR is returned to the client. - -# On a Unix system, the normal procedure is to have 'pre-lock' -# invoke other programs to do the real work, though it may do the -# work itself too. -# -# Note that 'pre-lock' must be executable by the user(s) who will -# invoke it (typically the user httpd runs as), and that user must -# have filesystem-level permission to access the repository. -# -# On a Windows system, you should name the hook program -# 'pre-lock.bat' or 'pre-lock.exe', -# but the basic idea is the same. -# -# Here is an example hook script, for a Unix /bin/sh interpreter: - -REPOS="$1" -PATH="$2" -USER="$3" - -# If a lock exists and is owned by a different person, don't allow it -# to be stolen (e.g., with 'svn lock --force ...'). - -# (Maybe this script could send email to the lock owner?) -SVNLOOK=/usr/bin/svnlook -GREP=/bin/grep -SED=/bin/sed - -LOCK_OWNER=`$SVNLOOK lock "$REPOS" "$PATH" | \ - $GREP '^Owner: ' | $SED 's/Owner: //'` - -# If we get no result from svnlook, there's no lock, allow the lock to -# happen: -if [ "$LOCK_OWNER" = "" ]; then - exit 0 -fi - -# If the person locking matches the lock's owner, allow the lock to -# happen: -if [ "$LOCK_OWNER" = "$USER" ]; then - exit 0 -fi - -# Otherwise, we've got an owner mismatch, so return failure: -echo "Error: $PATH already locked by ${LOCK_OWNER}." 1>&2 -exit 1 diff --git a/test/src/main/preset-data/svn-repo/hooks/pre-revprop-change.tmpl b/test/src/main/preset-data/svn-repo/hooks/pre-revprop-change.tmpl deleted file mode 100644 index 2f2de98489..0000000000 --- a/test/src/main/preset-data/svn-repo/hooks/pre-revprop-change.tmpl +++ /dev/null @@ -1,66 +0,0 @@ -#!/bin/sh - -# PRE-REVPROP-CHANGE HOOK -# -# The pre-revprop-change hook is invoked before a revision property -# is added, modified or deleted. Subversion runs this hook by invoking -# a program (script, executable, binary, etc.) named 'pre-revprop-change' -# (for which this file is a template), with the following ordered -# arguments: -# -# [1] REPOS-PATH (the path to this repository) -# [2] REVISION (the revision being tweaked) -# [3] USER (the username of the person tweaking the property) -# [4] PROPNAME (the property being set on the revision) -# [5] ACTION (the property is being 'A'dded, 'M'odified, or 'D'eleted) -# -# [STDIN] PROPVAL ** the new property value is passed via STDIN. -# -# If the hook program exits with success, the propchange happens; but -# if it exits with failure (non-zero), the propchange doesn't happen. -# The hook program can use the 'svnlook' utility to examine the -# existing value of the revision property. -# -# WARNING: unlike other hooks, this hook MUST exist for revision -# properties to be changed. If the hook does not exist, Subversion -# will behave as if the hook were present, but failed. The reason -# for this is that revision properties are UNVERSIONED, meaning that -# a successful propchange is destructive; the old value is gone -# forever. We recommend the hook back up the old value somewhere. -# -# On a Unix system, the normal procedure is to have 'pre-revprop-change' -# invoke other programs to do the real work, though it may do the -# work itself too. -# -# Note that 'pre-revprop-change' must be executable by the user(s) who will -# invoke it (typically the user httpd runs as), and that user must -# have filesystem-level permission to access the repository. -# -# On a Windows system, you should name the hook program -# 'pre-revprop-change.bat' or 'pre-revprop-change.exe', -# but the basic idea is the same. -# -# The hook program typically does not inherit the environment of -# its parent process. For example, a common problem is for the -# PATH environment variable to not be set to its usual value, so -# that subprograms fail to launch unless invoked via absolute path. -# If you're having unexpected problems with a hook program, the -# culprit may be unusual (or missing) environment variables. -# -# Here is an example hook script, for a Unix /bin/sh interpreter. -# For more examples and pre-written hooks, see those in -# the Subversion repository at -# http://svn.collab.net/repos/svn/trunk/tools/hook-scripts/ and -# http://svn.collab.net/repos/svn/trunk/contrib/hook-scripts/ - - -REPOS="$1" -REV="$2" -USER="$3" -PROPNAME="$4" -ACTION="$5" - -if [ "$ACTION" = "M" -a "$PROPNAME" = "svn:log" ]; then exit 0; fi - -echo "Changing revision properties other than svn:log is prohibited" >&2 -exit 1 diff --git a/test/src/main/preset-data/svn-repo/hooks/pre-unlock.tmpl b/test/src/main/preset-data/svn-repo/hooks/pre-unlock.tmpl deleted file mode 100644 index e92a0263e5..0000000000 --- a/test/src/main/preset-data/svn-repo/hooks/pre-unlock.tmpl +++ /dev/null @@ -1,61 +0,0 @@ -#!/bin/sh - -# PRE-UNLOCK HOOK -# -# The pre-unlock hook is invoked before an exclusive lock is -# destroyed. Subversion runs this hook by invoking a program -# (script, executable, binary, etc.) named 'pre-unlock' (for which -# this file is a template), with the following ordered arguments: -# -# [1] REPOS-PATH (the path to this repository) -# [2] PATH (the path in the repository about to be unlocked) -# [3] USER (the user destroying the lock) -# -# The default working directory for the invocation is undefined, so -# the program should set one explicitly if it cares. -# -# If the hook program exits with success, the lock is destroyed; but -# if it exits with failure (non-zero), the unlock action is aborted -# and STDERR is returned to the client. - -# On a Unix system, the normal procedure is to have 'pre-unlock' -# invoke other programs to do the real work, though it may do the -# work itself too. -# -# Note that 'pre-unlock' must be executable by the user(s) who will -# invoke it (typically the user httpd runs as), and that user must -# have filesystem-level permission to access the repository. -# -# On a Windows system, you should name the hook program -# 'pre-unlock.bat' or 'pre-unlock.exe', -# but the basic idea is the same. -# -# Here is an example hook script, for a Unix /bin/sh interpreter: - -REPOS="$1" -PATH="$2" -USER="$3" - -# If a lock is owned by a different person, don't allow it be broken. -# (Maybe this script could send email to the lock owner?) - -SVNLOOK=/usr/bin/svnlook -GREP=/bin/grep -SED=/bin/sed - -LOCK_OWNER=`$SVNLOOK lock "$REPOS" "$PATH" | \ - $GREP '^Owner: ' | $SED 's/Owner: //'` - -# If we get no result from svnlook, there's no lock, return success: -if [ "$LOCK_OWNER" = "" ]; then - exit 0 -fi - -# If the person unlocking matches the lock's owner, return success: -if [ "$LOCK_OWNER" = "$USER" ]; then - exit 0 -fi - -# Otherwise, we've got an owner mismatch, so return failure: -echo "Error: $PATH locked by ${LOCK_OWNER}." 1>&2 -exit 1 diff --git a/test/src/main/preset-data/svn-repo/hooks/start-commit.tmpl b/test/src/main/preset-data/svn-repo/hooks/start-commit.tmpl deleted file mode 100644 index 7597f58a28..0000000000 --- a/test/src/main/preset-data/svn-repo/hooks/start-commit.tmpl +++ /dev/null @@ -1,65 +0,0 @@ -#!/bin/sh - -# START-COMMIT HOOK -# -# The start-commit hook is invoked before a Subversion txn is created -# in the process of doing a commit. Subversion runs this hook -# by invoking a program (script, executable, binary, etc.) named -# 'start-commit' (for which this file is a template) -# with the following ordered arguments: -# -# [1] REPOS-PATH (the path to this repository) -# [2] USER (the authenticated user attempting to commit) -# [3] CAPABILITIES (a colon-separated list of capabilities reported -# by the client; see note below) -# -# Note: The CAPABILITIES parameter is new in Subversion 1.5, and 1.5 -# clients will typically report at least the "mergeinfo" capability. -# If there are other capabilities, then the list is colon-separated, -# e.g.: "mergeinfo:some-other-capability" (the order is undefined). -# -# The list is self-reported by the client. Therefore, you should not -# make security assumptions based on the capabilities list, nor should -# you assume that clients reliably report every capability they have. -# -# The working directory for this hook program's invocation is undefined, -# so the program should set one explicitly if it cares. -# -# If the hook program exits with success, the commit continues; but -# if it exits with failure (non-zero), the commit is stopped before -# a Subversion txn is created, and STDERR is returned to the client. -# -# On a Unix system, the normal procedure is to have 'start-commit' -# invoke other programs to do the real work, though it may do the -# work itself too. -# -# Note that 'start-commit' must be executable by the user(s) who will -# invoke it (typically the user httpd runs as), and that user must -# have filesystem-level permission to access the repository. -# -# On a Windows system, you should name the hook program -# 'start-commit.bat' or 'start-commit.exe', -# but the basic idea is the same. -# -# The hook program typically does not inherit the environment of -# its parent process. For example, a common problem is for the -# PATH environment variable to not be set to its usual value, so -# that subprograms fail to launch unless invoked via absolute path. -# If you're having unexpected problems with a hook program, the -# culprit may be unusual (or missing) environment variables. -# -# Here is an example hook script, for a Unix /bin/sh interpreter. -# For more examples and pre-written hooks, see those in -# the Subversion repository at -# http://svn.collab.net/repos/svn/trunk/tools/hook-scripts/ and -# http://svn.collab.net/repos/svn/trunk/contrib/hook-scripts/ - - -REPOS="$1" -USER="$2" - -commit-allower.pl --repository "$REPOS" --user "$USER" || exit 1 -special-auth-check.py --user "$USER" --auth-level 3 || exit 1 - -# All checks passed, so allow the commit. -exit 0 diff --git a/test/src/main/preset-data/svn-repo/locks/db-logs.lock b/test/src/main/preset-data/svn-repo/locks/db-logs.lock deleted file mode 100644 index 20dd6369be..0000000000 --- a/test/src/main/preset-data/svn-repo/locks/db-logs.lock +++ /dev/null @@ -1,3 +0,0 @@ -This file is not used by Subversion 1.3.x or later. -However, its existence is required for compatibility with -Subversion 1.2.x or earlier. diff --git a/test/src/main/preset-data/svn-repo/locks/db.lock b/test/src/main/preset-data/svn-repo/locks/db.lock deleted file mode 100644 index 20dd6369be..0000000000 --- a/test/src/main/preset-data/svn-repo/locks/db.lock +++ /dev/null @@ -1,3 +0,0 @@ -This file is not used by Subversion 1.3.x or later. -However, its existence is required for compatibility with -Subversion 1.2.x or earlier. diff --git a/test/src/main/preset-data/svn-repo/readme.txt b/test/src/main/preset-data/svn-repo/readme.txt deleted file mode 100644 index 2f3a44d1aa..0000000000 --- a/test/src/main/preset-data/svn-repo/readme.txt +++ /dev/null @@ -1 +0,0 @@ -Subversion repository that contains test data. \ No newline at end of file diff --git a/test/src/test/java/hudson/bugs/seasar/Operation2174Test.java b/test/src/test/java/hudson/bugs/seasar/Operation2174Test.java index 690a0ecd46..a93381238b 100644 --- a/test/src/test/java/hudson/bugs/seasar/Operation2174Test.java +++ b/test/src/test/java/hudson/bugs/seasar/Operation2174Test.java @@ -43,7 +43,7 @@ public class Operation2174Test extends HudsonTestCase { */ public void testBuildChains() throws Exception { FreeStyleProject up = createFreeStyleProject("up"); - MavenModuleSet dp = createMavenProject("dp"); + MavenModuleSet dp = jenkins.createProject(MavenModuleSet.class, "dp"); // designate 'dp' as the downstream in 'up' WebClient webClient = new WebClient(); diff --git a/test/src/main/java/hudson/core/PluginManagerOverrideTest.java b/test/src/test/java/hudson/core/PluginManagerOverrideTest.java similarity index 100% rename from test/src/main/java/hudson/core/PluginManagerOverrideTest.java rename to test/src/test/java/hudson/core/PluginManagerOverrideTest.java diff --git a/test/src/test/java/hudson/model/AutoCompletionCandidatesTest.java b/test/src/test/java/hudson/model/AutoCompletionCandidatesTest.java index ff6b2f18bb..7f81ffc3d4 100644 --- a/test/src/test/java/hudson/model/AutoCompletionCandidatesTest.java +++ b/test/src/test/java/hudson/model/AutoCompletionCandidatesTest.java @@ -24,7 +24,7 @@ public class AutoCompletionCandidatesTest { @Test public void completion() throws Exception { FreeStyleProject foo = j.createFreeStyleProject("foo"); - MatrixProject bar = j.createMatrixProject("bar"); + MatrixProject bar = j.jenkins.createProject(MatrixProject.class, "bar"); bar.setAxes(new AxisList(new TextAxis("x","1","2","3"))); MatrixConfiguration x3 = bar.getItem("x=3"); diff --git a/test/src/test/java/hudson/model/GetEnvironmentOutsideBuildTest.java b/test/src/test/java/hudson/model/GetEnvironmentOutsideBuildTest.java index 969aa71339..e87597b537 100644 --- a/test/src/test/java/hudson/model/GetEnvironmentOutsideBuildTest.java +++ b/test/src/test/java/hudson/model/GetEnvironmentOutsideBuildTest.java @@ -16,6 +16,7 @@ import jenkins.model.Jenkins; import org.jvnet.hudson.test.Issue; import org.jvnet.hudson.test.ExtractResourceSCM; import org.jvnet.hudson.test.HudsonTestCase; +import org.jvnet.hudson.test.ToolInstallations; /** * Tests that getEnvironment() calls outside of builds are safe. @@ -51,8 +52,8 @@ public class GetEnvironmentOutsideBuildTest extends HudsonTestCase { } private MavenModuleSet createSimpleMavenProject() throws Exception { - MavenModuleSet project = createMavenProject(); - MavenInstallation mi = configureMaven3(); + MavenModuleSet project = jenkins.createProject(MavenModuleSet.class, "mms"); + MavenInstallation mi = ToolInstallations.configureMaven3(); project.setScm(new ExtractResourceSCM(getClass().getResource( "/simple-projects.zip"))); project.setMaven(mi.getName()); @@ -78,7 +79,7 @@ public class GetEnvironmentOutsideBuildTest extends HudsonTestCase { } public void testMatrix() throws Exception { - MatrixProject createMatrixProject = createMatrixProject(); + MatrixProject createMatrixProject = jenkins.createProject(MatrixProject.class, "mp"); assertGetEnvironmentCallOutsideBuildWorks(createMatrixProject); } diff --git a/test/src/test/java/hudson/model/HelpLinkTest.java b/test/src/test/java/hudson/model/HelpLinkTest.java index 2ec0eca93a..9fbc06a31a 100644 --- a/test/src/test/java/hudson/model/HelpLinkTest.java +++ b/test/src/test/java/hudson/model/HelpLinkTest.java @@ -11,6 +11,8 @@ import org.junit.Rule; import org.junit.Test; import com.gargoylesoftware.htmlunit.html.HtmlPage; import com.gargoylesoftware.htmlunit.html.HtmlAnchor; +import hudson.matrix.MatrixProject; +import hudson.maven.MavenModuleSet; import java.util.List; @@ -41,12 +43,12 @@ public class HelpLinkTest { @Test public void mavenConfig() throws Exception { - clickAllHelpLinks(j.createMavenProject()); + clickAllHelpLinks(j.jenkins.createProject(MavenModuleSet.class, "mms")); } @Test public void matrixConfig() throws Exception { - clickAllHelpLinks(j.createMatrixProject()); + clickAllHelpLinks(j.jenkins.createProject(MatrixProject.class, "mp")); } private void clickAllHelpLinks(AbstractProject p) throws Exception { diff --git a/test/src/test/java/hudson/model/ListViewTest.java b/test/src/test/java/hudson/model/ListViewTest.java index c82df5b591..1a8959df1b 100644 --- a/test/src/test/java/hudson/model/ListViewTest.java +++ b/test/src/test/java/hudson/model/ListViewTest.java @@ -47,7 +47,6 @@ import static org.junit.Assert.*; import org.junit.Rule; import org.junit.Test; import org.jvnet.hudson.test.Issue; -import org.jvnet.hudson.test.Issue; import org.jvnet.hudson.test.JenkinsRule; import org.jvnet.hudson.test.JenkinsRule.WebClient; import org.jvnet.hudson.test.MockFolder; @@ -110,7 +109,7 @@ public class ListViewTest { @Issue("JENKINS-20415") @Test public void nonTopLevelItemGroup() throws Exception { - MatrixProject mp = j.createMatrixProject(); + MatrixProject mp = j.jenkins.createProject(MatrixProject.class, "mp"); mp.setAxes(new AxisList(new TextAxis("axis", "one", "two"))); assertEquals(2, mp.getItems().size()); ListView v = new ListView("v"); diff --git a/test/src/test/java/hudson/model/NodeTest.java b/test/src/test/java/hudson/model/NodeTest.java index 25b842e437..093e06b2c0 100644 --- a/test/src/test/java/hudson/model/NodeTest.java +++ b/test/src/test/java/hudson/model/NodeTest.java @@ -251,7 +251,7 @@ public class NodeTest { public void testGetAssignedLabelWithJobs() throws Exception { final Node node = j.createOnlineSlave(); node.setLabelString("label1 label2"); - MavenModuleSet mavenProject = j.createMavenProject(); + MavenModuleSet mavenProject = j.jenkins.createProject(MavenModuleSet.class, "p"); mavenProject.setAssignedLabel(j.jenkins.getLabel("label1")); RunLoadCounter.prepare(mavenProject); j.assertBuildStatus(Result.FAILURE, mavenProject.scheduleBuild2(0).get()); @@ -294,12 +294,12 @@ public class NodeTest { final Node node2 = j.createOnlineSlave(); node1.setLabelString("label1"); - MavenModuleSet project = j.createMavenProject(); + MavenModuleSet project = j.jenkins.createProject(MavenModuleSet.class, "p1"); final Label label = j.jenkins.getLabel("label1"); project.setAssignedLabel(label); j.assertBuildStatus(Result.FAILURE, project.scheduleBuild2(0).get()); - MavenModuleSet project2 = j.createMavenProject(); + MavenModuleSet project2 = j.jenkins.createProject(MavenModuleSet.class, "p2"); project2.setAssignedLabel(label); j.assertBuildStatus(Result.FAILURE, project2.scheduleBuild2(0).get()); @@ -316,7 +316,7 @@ public class NodeTest { final Node node = j.createOnlineSlave(); node.setLabelString("label1"); - MavenModuleSet project = j.createMavenProject(); + MavenModuleSet project = j.jenkins.createProject(MavenModuleSet.class, "p"); final Label label = j.jenkins.getLabel("label1"); project.setAssignedLabel(label); j.assertBuildStatus(Result.FAILURE, project.scheduleBuild2(0).get()); diff --git a/test/src/test/java/hudson/model/QueueTest.java b/test/src/test/java/hudson/model/QueueTest.java index 951b6808cc..a868ab1e6d 100644 --- a/test/src/test/java/hudson/model/QueueTest.java +++ b/test/src/test/java/hudson/model/QueueTest.java @@ -373,7 +373,7 @@ public class QueueTest { @Issue("JENKINS-8790") @Test public void flyweightTasks() throws Exception { - MatrixProject m = r.createMatrixProject(); + MatrixProject m = r.jenkins.createProject(MatrixProject.class, "p"); m.addProperty(new ParametersDefinitionProperty( new StringParameterDefinition("FOO","value") )); @@ -398,7 +398,7 @@ public class QueueTest { r.jenkins.clouds.add(cloud); r.jenkins.setNumExecutors(0); r.jenkins.setNodes(Collections.emptyList()); - MatrixProject m = r.createMatrixProject(); + MatrixProject m = r.jenkins.createProject(MatrixProject.class, "p"); m.setAxes(new AxisList(new LabelAxis("label", Arrays.asList("remote")))); MatrixBuild build; try { @@ -797,7 +797,7 @@ public class QueueTest { * and the flyweight task will be executed. */ public void shouldRunFlyweightTaskOnProvisionedNodeWhenNodeRestricted() throws Exception { - MatrixProject matrixProject = r.createMatrixProject(); + MatrixProject matrixProject = r.jenkins.createProject(MatrixProject.class, "p"); matrixProject.setAxes(new AxisList( new Axis("axis", "a", "b") )); @@ -812,7 +812,7 @@ public class QueueTest { @Test public void shouldBeAbleToBlockFlyweightTaskAtTheLastMinute() throws Exception { - MatrixProject matrixProject = r.createMatrixProject("downstream"); + MatrixProject matrixProject = r.jenkins.createProject(MatrixProject.class, "downstream"); matrixProject.setDisplayName("downstream"); matrixProject.setAxes(new AxisList( new Axis("axis", "a", "b") diff --git a/test/src/test/java/hudson/model/ViewTest.java b/test/src/test/java/hudson/model/ViewTest.java index eb3d5e0da0..67e1c2a019 100644 --- a/test/src/test/java/hudson/model/ViewTest.java +++ b/test/src/test/java/hudson/model/ViewTest.java @@ -215,7 +215,7 @@ public class ViewTest { inView1.setAssignedLabel(j.jenkins.getLabelAtom("without-any-slave")); view1.add(inView1); - MatrixProject inView2 = j.createMatrixProject("in-view2"); + MatrixProject inView2 = j.jenkins.createProject(MatrixProject.class, "in-view2"); inView2.setAssignedLabel(j.jenkins.getLabelAtom("without-any-slave")); view2.add(inView2); @@ -277,7 +277,7 @@ public class ViewTest { view1.add(freestyleJob); freestyleJob.setAssignedLabel(j.jenkins.getLabel("label0||label2")); - MatrixProject matrixJob = j.createMatrixProject("matrix"); + MatrixProject matrixJob = j.jenkins.createProject(MatrixProject.class, "matrix"); view1.add(matrixJob); matrixJob.setAxes(new AxisList( new LabelAxis("label", Arrays.asList("label1")) @@ -346,7 +346,7 @@ public class ViewTest { public void testGetItem() throws Exception{ ListView view = listView("foo"); FreeStyleProject job1 = j.createFreeStyleProject("free"); - MatrixProject job2 = j.createMatrixProject("matrix"); + MatrixProject job2 = j.jenkins.createProject(MatrixProject.class, "matrix"); FreeStyleProject job3 = j.createFreeStyleProject("not-included"); view.jobNames.add(job2.getDisplayName()); view.jobNames.add(job1.getDisplayName()); diff --git a/test/src/test/java/hudson/tasks/BuildTriggerTest.java b/test/src/test/java/hudson/tasks/BuildTriggerTest.java index 0a55bf6ff6..636adab4df 100644 --- a/test/src/test/java/hudson/tasks/BuildTriggerTest.java +++ b/test/src/test/java/hudson/tasks/BuildTriggerTest.java @@ -79,6 +79,7 @@ import org.jvnet.hudson.test.TestBuilder; import org.jvnet.hudson.test.TestNotifier; import org.jvnet.hudson.test.MockBuilder; import org.jvnet.hudson.test.MockQueueItemAuthenticator; +import org.jvnet.hudson.test.ToolInstallations; import org.xml.sax.SAXException; /** @@ -150,8 +151,8 @@ public class BuildTriggerTest { } } FreeStyleProject dp = createDownstreamProject(); - j.configureDefaultMaven(); - MavenModuleSet m = j.createMavenProject(); + ToolInstallations.configureDefaultMaven(); + MavenModuleSet m = j.jenkins.createProject(MavenModuleSet.class, "p"); m.getPublishersList().add(new BuildTrigger("downstream", evenWhenUnstable)); if (!evenWhenUnstable) { // Configure for UNSTABLE diff --git a/test/src/test/java/hudson/tasks/EnvVarsInConfigTasksTest.java b/test/src/test/java/hudson/tasks/EnvVarsInConfigTasksTest.java index fb5b7e2e1e..22d16c43b5 100644 --- a/test/src/test/java/hudson/tasks/EnvVarsInConfigTasksTest.java +++ b/test/src/test/java/hudson/tasks/EnvVarsInConfigTasksTest.java @@ -18,29 +18,33 @@ import org.junit.Assume; import org.jvnet.hudson.test.ExtractResourceSCM; import org.jvnet.hudson.test.HudsonTestCase; import static hudson.tasks._ant.Messages.Ant_ExecutableNotFound; +import org.junit.rules.TemporaryFolder; +import org.jvnet.hudson.test.ToolInstallations; public class EnvVarsInConfigTasksTest extends HudsonTestCase { public static final String DUMMY_LOCATION_VARNAME = "TOOLS_DUMMY_LOCATION"; private DumbSlave slaveEnv = null; private DumbSlave slaveRegular = null; + private TemporaryFolder tmp = new TemporaryFolder(); public void setUp() throws Exception { super.setUp(); + tmp.create(); // until we can switch to JenkinsRule and tmp becomes a @Rule itself JDK defaultJDK = jenkins.getJDK(null); JDK varJDK = new JDK("varJDK", withVariable(defaultJDK.getHome())); jenkins.getJDKs().add(varJDK); // Maven with a variable in its path - configureDefaultMaven(); + ToolInstallations.configureDefaultMaven(); MavenInstallation defaultMaven = jenkins.getDescriptorByType(Maven.DescriptorImpl.class).getInstallations()[0]; MavenInstallation varMaven = new MavenInstallation("varMaven", withVariable(defaultMaven.getHome()), NO_PROPERTIES); jenkins.getDescriptorByType(Maven.DescriptorImpl.class).setInstallations(varMaven); // Ant with a variable in its path - AntInstallation ant = configureDefaultAnt(); + AntInstallation ant = ToolInstallations.configureDefaultAnt(tmp); AntInstallation antInstallation = new AntInstallation("varAnt", withVariable(ant.getHome()),NO_PROPERTIES); jenkins.getDescriptorByType(Ant.DescriptorImpl.class).setInstallations(antInstallation); @@ -51,6 +55,12 @@ public class EnvVarsInConfigTasksTest extends HudsonTestCase { slaveRegular = createSlave(new LabelAtom("slaveRegular")); } + @Override + protected void tearDown() throws Exception { + super.tearDown(); + tmp.delete(); + } + private String withVariable(String s) { return s + "${" + DUMMY_LOCATION_VARNAME + "}"; } @@ -173,7 +183,7 @@ public class EnvVarsInConfigTasksTest extends HudsonTestCase { } public void testNativeMavenOnSlave() throws Exception { - MavenModuleSet project = createMavenProject(); + MavenModuleSet project = jenkins.createProject(MavenModuleSet.class, "p"); project.setJDK(jenkins.getJDK("varJDK")); project.setScm(new ExtractResourceSCM(getClass().getResource( "/simple-projects.zip"))); diff --git a/test/src/test/java/hudson/tasks/FingerprinterTest.java b/test/src/test/java/hudson/tasks/FingerprinterTest.java index 611bd048a8..c2bbea2a4a 100644 --- a/test/src/test/java/hudson/tasks/FingerprinterTest.java +++ b/test/src/test/java/hudson/tasks/FingerprinterTest.java @@ -212,7 +212,7 @@ public class FingerprinterTest { } @Test public void matrixDependency() throws Exception { - MatrixProject matrixProject = j.createMatrixProject(); + MatrixProject matrixProject = j.jenkins.createProject(MatrixProject.class, "p"); matrixProject.setAxes(new AxisList(new Axis("foo", "a", "b"))); FreeStyleProject freestyleProject = createFreeStyleProjectWithFingerprints(singleContents, singleFiles); addFingerprinterToProject(matrixProject, singleContents, singleFiles); diff --git a/test/src/test/java/hudson/tasks/MavenTest.java b/test/src/test/java/hudson/tasks/MavenTest.java index b70c8e733e..a95a2285de 100644 --- a/test/src/test/java/hudson/tasks/MavenTest.java +++ b/test/src/test/java/hudson/tasks/MavenTest.java @@ -61,6 +61,7 @@ import org.junit.Rule; import org.junit.Test; import org.jvnet.hudson.test.ExtractResourceSCM; import org.jvnet.hudson.test.JenkinsRule; +import org.jvnet.hudson.test.ToolInstallations; /** * @author Kohsuke Kawaguchi @@ -95,7 +96,7 @@ public class MavenTest { } @Test public void withNodeProperty() throws Exception { - MavenInstallation maven = j.configureDefaultMaven(); + MavenInstallation maven = ToolInstallations.configureDefaultMaven(); String mavenHome = maven.getHome(); String mavenHomeVar = "${VAR_MAVEN}" + mavenHome.substring(3); String mavenVar = mavenHome.substring(0, 3); @@ -124,7 +125,7 @@ public class MavenTest { } @Test public void withParameter() throws Exception { - MavenInstallation maven = j.configureDefaultMaven(); + MavenInstallation maven = ToolInstallations.configureDefaultMaven(); String mavenHome = maven.getHome(); String mavenHomeVar = "${VAR_MAVEN}" + mavenHome.substring(3); String mavenVar = mavenHome.substring(0, 3); @@ -270,7 +271,7 @@ public class MavenTest { @Issue("JENKINS-26684") @Test public void specialCharsInBuildVariablesPassedAsProperties() throws Exception { - MavenInstallation maven = j.configureMaven3(); + MavenInstallation maven = ToolInstallations.configureMaven3(); FreeStyleProject p = j.createFreeStyleProject(); p.getBuildersList().add(new Maven("--help", maven.getName())); diff --git a/test/src/test/java/hudson/tools/ToolLocationNodePropertyTest.java b/test/src/test/java/hudson/tools/ToolLocationNodePropertyTest.java index 1bba877c8b..f9e1581969 100644 --- a/test/src/test/java/hudson/tools/ToolLocationNodePropertyTest.java +++ b/test/src/test/java/hudson/tools/ToolLocationNodePropertyTest.java @@ -52,6 +52,8 @@ import org.jvnet.hudson.test.ExtractResourceSCM; import com.gargoylesoftware.htmlunit.html.HtmlForm; import com.gargoylesoftware.htmlunit.html.HtmlPage; +import org.junit.rules.TemporaryFolder; +import org.jvnet.hudson.test.ToolInstallations; /** * This class tests that environment variables from node properties are applied, @@ -62,6 +64,8 @@ public class ToolLocationNodePropertyTest { @Rule public JenkinsRule j = new JenkinsRule(); + @Rule + public TemporaryFolder tmp = new TemporaryFolder(); private DumbSlave slave; private FreeStyleProject project; @@ -109,7 +113,7 @@ public class ToolLocationNodePropertyTest { @Test public void maven() throws Exception { - MavenInstallation maven = j.configureDefaultMaven(); + MavenInstallation maven = ToolInstallations.configureDefaultMaven(); String mavenPath = maven.getHome(); Jenkins.getInstance().getDescriptorByType(Maven.DescriptorImpl.class).setInstallations(new MavenInstallation("maven", "THIS IS WRONG", j.NO_PROPERTIES)); @@ -136,7 +140,7 @@ public class ToolLocationNodePropertyTest { @Test public void ant() throws Exception { - Ant.AntInstallation ant = j.configureDefaultAnt(); + Ant.AntInstallation ant = ToolInstallations.configureDefaultAnt(tmp); String antPath = ant.getHome(); Jenkins.getInstance().getDescriptorByType(Ant.DescriptorImpl.class).setInstallations(new AntInstallation("ant", "THIS IS WRONG")); @@ -158,11 +162,11 @@ public class ToolLocationNodePropertyTest { @Test public void nativeMaven() throws Exception { - MavenInstallation maven = j.configureDefaultMaven(); + MavenInstallation maven = ToolInstallations.configureDefaultMaven(); String mavenPath = maven.getHome(); Jenkins.getInstance().getDescriptorByType(Maven.DescriptorImpl.class).setInstallations(new MavenInstallation("maven", "THIS IS WRONG", j.NO_PROPERTIES)); - MavenModuleSet project = j.createMavenProject(); + MavenModuleSet project = j.jenkins.createProject(MavenModuleSet.class, "p"); project.setScm(new ExtractResourceSCM(getClass().getResource( "/simple-projects.zip"))); project.setAssignedLabel(slave.getSelfLabel()); diff --git a/test/src/test/java/jenkins/model/JenkinsTest.java b/test/src/test/java/jenkins/model/JenkinsTest.java index 6664193d57..936e1ae977 100644 --- a/test/src/test/java/jenkins/model/JenkinsTest.java +++ b/test/src/test/java/jenkins/model/JenkinsTest.java @@ -242,7 +242,7 @@ public class JenkinsTest { j.submit(f); // build a dummy project - MavenModuleSet m = j.createMavenProject(); + MavenModuleSet m = j.jenkins.createProject(MavenModuleSet.class, "p"); m.setScm(new ExtractResourceSCM(getClass().getResource("/simple-projects.zip"))); MavenModuleSetBuild b = m.scheduleBuild2(0).get(); diff --git a/test/src/test/java/lib/hudson/ListScmBrowsersTest.java b/test/src/test/java/lib/hudson/ListScmBrowsersTest.java index f920bde13c..d4848d43f2 100644 --- a/test/src/test/java/lib/hudson/ListScmBrowsersTest.java +++ b/test/src/test/java/lib/hudson/ListScmBrowsersTest.java @@ -6,6 +6,8 @@ import com.gargoylesoftware.htmlunit.html.DomNodeUtil; import com.gargoylesoftware.htmlunit.html.HtmlOption; import com.gargoylesoftware.htmlunit.html.HtmlPage; import com.gargoylesoftware.htmlunit.html.HtmlSelect; +import hudson.matrix.MatrixProject; +import hudson.maven.MavenModuleSet; import hudson.model.Item; import org.junit.Rule; import org.junit.Test; @@ -32,12 +34,12 @@ public class ListScmBrowsersTest { @Test public void selectBoxesUnique_MavenProject() throws Exception { - check(j.createMavenProject()); + check(j.jenkins.createProject(MavenModuleSet.class, "p")); } @Test public void selectBoxesUnique_MatrixProject() throws Exception { - check(j.createMatrixProject()); + check(j.jenkins.createProject(MatrixProject.class, "p")); } private void check(Item p) throws IOException, SAXException { diff --git a/test/src/main/resources/hudson/core/PluginManagerOverrideTest/BasicPluginManagerOverride/newview.jelly b/test/src/test/resources/hudson/core/PluginManagerOverrideTest/BasicPluginManagerOverride/newview.jelly similarity index 100% rename from test/src/main/resources/hudson/core/PluginManagerOverrideTest/BasicPluginManagerOverride/newview.jelly rename to test/src/test/resources/hudson/core/PluginManagerOverrideTest/BasicPluginManagerOverride/newview.jelly diff --git a/test/src/main/resources/plugins/htmlpublisher.jpi b/test/src/test/resources/plugins/htmlpublisher.jpi similarity index 100% rename from test/src/main/resources/plugins/htmlpublisher.jpi rename to test/src/test/resources/plugins/htmlpublisher.jpi diff --git a/test/src/main/resources/plugins/legacy.hpi b/test/src/test/resources/plugins/legacy.hpi similarity index 100% rename from test/src/main/resources/plugins/legacy.hpi rename to test/src/test/resources/plugins/legacy.hpi diff --git a/test/src/main/resources/plugins/tasks-update-center.json b/test/src/test/resources/plugins/tasks-update-center.json similarity index 100% rename from test/src/main/resources/plugins/tasks-update-center.json rename to test/src/test/resources/plugins/tasks-update-center.json diff --git a/test/src/test/resources/plugins/tasks.jpi b/test/src/test/resources/plugins/tasks.jpi new file mode 100644 index 0000000000..b93dcead46 Binary files /dev/null and b/test/src/test/resources/plugins/tasks.jpi differ diff --git a/test/src/test/resources/simple-projects.zip b/test/src/test/resources/simple-projects.zip new file mode 100644 index 0000000000..60824525dd Binary files /dev/null and b/test/src/test/resources/simple-projects.zip differ diff --git a/war/pom.xml b/war/pom.xml index 270103371d..c23b3a4ae0 100644 --- a/war/pom.xml +++ b/war/pom.xml @@ -73,13 +73,6 @@ THE SOFTWARE. - - - ${project.groupId} - maven-plugin - ${maven-plugin.version} - provided - ${project.groupId} remoting @@ -263,6 +256,7 @@ THE SOFTWARE. ${project.groupId} maven-plugin + ${maven-plugin.version} hpi