Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWinston Prakash2015-05-13 00:10:33 -0400
committerWinston Prakash2015-05-13 18:35:46 -0400
commit04fcc19506e799f4d4d20504f248a3d7e56ca599 (patch)
tree5d46ef019c3d7a8a97cfca08e3cc9c224d1ec958
parent512a664595710e01de5fac9ce650538d4090a71c (diff)
downloadorg.eclipse.hudson.core-04fcc19506e799f4d4d20504f248a3d7e56ca599.tar.gz
org.eclipse.hudson.core-04fcc19506e799f4d4d20504f248a3d7e56ca599.tar.xz
org.eclipse.hudson.core-04fcc19506e799f4d4d20504f248a3d7e56ca599.zip
Bug Fix: 386082 - Add the ability to disable a step
-rw-r--r--hudson-core/src/main/java/hudson/tasks/Ant.java29
-rw-r--r--hudson-core/src/main/java/hudson/tasks/BatchFile.java7
-rw-r--r--hudson-core/src/main/java/hudson/tasks/Builder.java21
-rw-r--r--hudson-core/src/main/java/hudson/tasks/CommandInterpreter.java11
-rw-r--r--hudson-core/src/main/java/hudson/tasks/Maven.java12
-rw-r--r--hudson-core/src/main/java/hudson/tasks/Shell.java18
-rw-r--r--hudson-core/src/main/resources/hudson/tasks/Ant/config.jelly4
-rw-r--r--hudson-core/src/main/resources/hudson/tasks/BatchFile/config.jelly12
-rw-r--r--hudson-core/src/main/resources/hudson/tasks/Maven/config.jelly6
-rw-r--r--hudson-core/src/main/resources/hudson/tasks/Shell/config.jelly10
-rw-r--r--hudson-core/src/test/java/hudson/tasks/AntEqualsHashCodeTest.java33
-rw-r--r--hudson-core/src/test/java/hudson/tasks/BatchFileEqualsHashCodeTest.java27
-rw-r--r--hudson-core/src/test/java/hudson/tasks/MavenEqualsHashCodeTest.java33
-rw-r--r--hudson-core/src/test/java/hudson/tasks/ShellEqualsHashCodeTest.java27
-rw-r--r--hudson-core/src/test/java/hudson/util/CopyOnWriteListEqualsHashCodeTest.java19
-rw-r--r--hudson-core/src/test/java/hudson/util/PersistedListEqualsHashCodeTest.java27
-rw-r--r--hudson-core/src/test/java/org/eclipse/hudson/model/project/property/DescribableListProjectPropertyTest.java13
-rw-r--r--hudson-war/src/main/webapp/help/disable-builder.html18
18 files changed, 194 insertions, 133 deletions
diff --git a/hudson-core/src/main/java/hudson/tasks/Ant.java b/hudson-core/src/main/java/hudson/tasks/Ant.java
index f729178e..daf6d9d9 100644
--- a/hudson-core/src/main/java/hudson/tasks/Ant.java
+++ b/hudson-core/src/main/java/hudson/tasks/Ant.java
@@ -34,30 +34,29 @@ import hudson.model.TaskListener;
import hudson.remoting.Callable;
import hudson.slaves.NodeSpecific;
import hudson.tasks._ant.AntConsoleAnnotator;
+import hudson.tools.DownloadFromUrlInstaller;
import hudson.tools.ToolDescriptor;
import hudson.tools.ToolInstallation;
-import hudson.tools.DownloadFromUrlInstaller;
import hudson.tools.ToolInstaller;
import hudson.tools.ToolProperty;
import hudson.util.ArgumentListBuilder;
-import hudson.util.VariableResolver;
import hudson.util.FormValidation;
+import hudson.util.VariableResolver;
import hudson.util.XStream2;
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Properties;
+import java.util.Set;
import net.sf.json.JSONObject;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.kohsuke.stapler.DataBoundConstructor;
-import org.kohsuke.stapler.StaplerRequest;
import org.kohsuke.stapler.QueryParameter;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Properties;
-import java.util.List;
-import java.util.Collections;
-import java.util.Set;
+import org.kohsuke.stapler.StaplerRequest;
/**
* Ant launcher.
@@ -91,12 +90,13 @@ public class Ant extends Builder {
private final String properties;
@DataBoundConstructor
- public Ant(String targets, String antName, String antOpts, String buildFile, String properties) {
+ public Ant(String targets, String antName, String antOpts, String buildFile, String properties, boolean disabled) {
this.targets = targets;
this.antName = antName;
this.antOpts = StringUtils.trimToNull(antOpts);
this.buildFile = StringUtils.trimToNull(buildFile);
this.properties = StringUtils.trimToNull(properties);
+ setDisabled(disabled);
}
public String getBuildFile() {
@@ -132,6 +132,11 @@ public class Ant extends Builder {
@Override
public boolean perform(AbstractBuild<?, ?> build, Launcher launcher, BuildListener listener) throws InterruptedException, IOException {
+ if (isDisabled()){
+ listener.getLogger().println("\nThe Ant builder is temporarily disabled.\n");
+ // just continue, this builder is disabled temporarily
+ return true;
+ }
ArgumentListBuilder args = new ArgumentListBuilder();
EnvVars env = build.getEnvironment(listener);
diff --git a/hudson-core/src/main/java/hudson/tasks/BatchFile.java b/hudson-core/src/main/java/hudson/tasks/BatchFile.java
index 91c4a650..44060285 100644
--- a/hudson-core/src/main/java/hudson/tasks/BatchFile.java
+++ b/hudson-core/src/main/java/hudson/tasks/BatchFile.java
@@ -16,8 +16,8 @@
package hudson.tasks;
-import hudson.FilePath;
import hudson.Extension;
+import hudson.FilePath;
import hudson.model.AbstractProject;
import net.sf.json.JSONObject;
import org.kohsuke.stapler.DataBoundConstructor;
@@ -31,8 +31,9 @@ import org.kohsuke.stapler.StaplerRequest;
public class BatchFile extends CommandInterpreter {
@DataBoundConstructor
- public BatchFile(String command) {
+ public BatchFile(String command, boolean disabled) {
super(command);
+ setDisabled(disabled);
}
public String[] buildCommandLine(FilePath script) {
@@ -61,7 +62,7 @@ public class BatchFile extends CommandInterpreter {
@Override
public Builder newInstance(StaplerRequest req, JSONObject data) {
- return new BatchFile(data.getString("command"));
+ return new BatchFile(data.getString("command"), data.getBoolean("disabled"));
}
public boolean isApplicable(Class<? extends AbstractProject> jobType) {
diff --git a/hudson-core/src/main/java/hudson/tasks/Builder.java b/hudson-core/src/main/java/hudson/tasks/Builder.java
index b48ee0a1..dff72eee 100644
--- a/hudson-core/src/main/java/hudson/tasks/Builder.java
+++ b/hudson-core/src/main/java/hudson/tasks/Builder.java
@@ -16,9 +16,9 @@
package hudson.tasks;
-import hudson.ExtensionPoint;
-import hudson.Extension;
import hudson.DescriptorExtensionList;
+import hudson.Extension;
+import hudson.ExtensionPoint;
import hudson.model.Build;
import hudson.model.BuildListener;
import hudson.model.Describable;
@@ -37,7 +37,22 @@ public abstract class Builder extends BuildStepCompatibilityLayer implements Bui
//
// these two methods need to remain to keep binary compatibility with plugins built with Hudson < 1.150
-//
+
+ /**
+ * @since 3.3.0
+ * Ability to temporarily disable a builder with out deleting it
+ * (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=386082)
+ */
+ private boolean disabled = false;
+
+ public boolean isDisabled() {
+ return disabled;
+ }
+
+ public void setDisabled(boolean disabled) {
+ this.disabled = disabled;
+ }
+
/**
* Default implementation that does nothing.
*/
diff --git a/hudson-core/src/main/java/hudson/tasks/CommandInterpreter.java b/hudson-core/src/main/java/hudson/tasks/CommandInterpreter.java
index 537e4c20..10904ae2 100644
--- a/hudson-core/src/main/java/hudson/tasks/CommandInterpreter.java
+++ b/hudson-core/src/main/java/hudson/tasks/CommandInterpreter.java
@@ -16,14 +16,13 @@
package hudson.tasks;
+import hudson.EnvVars;
import hudson.FilePath;
import hudson.Launcher;
import hudson.Util;
-import hudson.EnvVars;
import hudson.model.AbstractBuild;
import hudson.model.BuildListener;
import hudson.model.TaskListener;
-
import java.io.IOException;
import java.util.Map;
import org.apache.commons.lang3.StringUtils;
@@ -51,10 +50,18 @@ public abstract class CommandInterpreter extends Builder {
@Override
public boolean perform(AbstractBuild<?, ?> build, Launcher launcher, BuildListener listener) throws InterruptedException {
+ if (isDisabled()){
+ listener.getLogger().print("\nThe command interpreter builder is temporarily disabled.\n");
+ return true;
+ }
return perform(build, launcher, (TaskListener) listener);
}
public boolean perform(AbstractBuild<?, ?> build, Launcher launcher, TaskListener listener) throws InterruptedException {
+ if (isDisabled()){
+ // just continue, this builder is disabled temporarily
+ return true;
+ }
FilePath ws = build.getWorkspace();
FilePath script = null;
try {
diff --git a/hudson-core/src/main/java/hudson/tasks/Maven.java b/hudson-core/src/main/java/hudson/tasks/Maven.java
index b0afc05a..e9c28649 100644
--- a/hudson-core/src/main/java/hudson/tasks/Maven.java
+++ b/hudson-core/src/main/java/hudson/tasks/Maven.java
@@ -108,21 +108,22 @@ public class Maven extends Builder {
private final static String MAVEN_2_INSTALLATION_COMMON_FILE = "bin/mvn";
public Maven(String targets, String name) {
- this(targets, name, null, null, null, false);
+ this(targets, name, null, null, null, false, false);
}
public Maven(String targets, String name, String pom, String properties, String jvmOptions) {
- this(targets, name, pom, properties, jvmOptions, false);
+ this(targets, name, pom, properties, jvmOptions, false, false);
}
@DataBoundConstructor
- public Maven(String targets, String name, String pom, String properties, String jvmOptions, boolean usePrivateRepository) {
+ public Maven(String targets, String name, String pom, String properties, String jvmOptions, boolean usePrivateRepository, boolean disabled) {
this.targets = targets;
this.mavenName = name;
this.pom = StringUtils.trimToNull(pom);
this.properties = StringUtils.trimToNull(properties);
this.jvmOptions = StringUtils.trimToNull(jvmOptions);
this.usePrivateRepository = usePrivateRepository;
+ setDisabled(disabled);
}
public String getTargets() {
@@ -196,6 +197,11 @@ public class Maven extends Builder {
@Override
public boolean perform(AbstractBuild<?, ?> build, Launcher launcher, BuildListener listener) throws IOException, InterruptedException {
+ if (isDisabled()){
+ listener.getLogger().print("\nThe legacy maven2 builder is temporarily disabled\n");
+ // just continue, this builder is disabled temporarily
+ return true;
+ }
VariableResolver<String> vr = build.getBuildVariableResolver();
EnvVars env = build.getEnvironment(listener);
diff --git a/hudson-core/src/main/java/hudson/tasks/Shell.java b/hudson-core/src/main/java/hudson/tasks/Shell.java
index a2574805..872c5fab 100644
--- a/hudson-core/src/main/java/hudson/tasks/Shell.java
+++ b/hudson-core/src/main/java/hudson/tasks/Shell.java
@@ -16,24 +16,23 @@
package hudson.tasks;
+import hudson.Extension;
import hudson.FilePath;
import hudson.Functions;
import hudson.Util;
-import hudson.Extension;
import hudson.model.AbstractProject;
import hudson.remoting.Callable;
import hudson.remoting.VirtualChannel;
import hudson.util.FormValidation;
import java.io.IOException;
-import net.sf.json.JSONObject;
-import org.kohsuke.stapler.DataBoundConstructor;
-import org.kohsuke.stapler.StaplerRequest;
-import org.kohsuke.stapler.QueryParameter;
-
-import java.util.List;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.List;
import java.util.logging.Logger;
+import net.sf.json.JSONObject;
+import org.kohsuke.stapler.DataBoundConstructor;
+import org.kohsuke.stapler.QueryParameter;
+import org.kohsuke.stapler.StaplerRequest;
/**
* Executes a series of commands by using a shell.
@@ -45,8 +44,9 @@ public class Shell extends CommandInterpreter {
private static final Logger LOGGER = Logger.getLogger(Shell.class.getName());
@DataBoundConstructor
- public Shell(String command) {
+ public Shell(String command, boolean disabled) {
super(fixCrLf(command));
+ this.setDisabled(disabled);
}
/**
@@ -165,7 +165,7 @@ public class Shell extends CommandInterpreter {
@Override
public Builder newInstance(StaplerRequest req, JSONObject data) {
- return new Shell(data.getString("command"));
+ return new Shell(data.getString("command"), data.getBoolean("disabled"));
}
@Override
diff --git a/hudson-core/src/main/resources/hudson/tasks/Ant/config.jelly b/hudson-core/src/main/resources/hudson/tasks/Ant/config.jelly
index c1bcda46..01be9cd7 100644
--- a/hudson-core/src/main/resources/hudson/tasks/Ant/config.jelly
+++ b/hudson-core/src/main/resources/hudson/tasks/Ant/config.jelly
@@ -27,6 +27,10 @@
</select>
</f:entry>
</j:if>
+ <f:entry title="" help="/help/disable-builder.html">
+ <f:checkbox name="disabled" checked="${instance.disabled}"
+ title="${%Temporarily disable this builder}"/>
+ </f:entry>
<f:entry title="${%Targets}" help="/help/ant/ant-targets.html">
<f:expandableTextbox name="ant.targets" value="${instance.targets}" />
</f:entry>
diff --git a/hudson-core/src/main/resources/hudson/tasks/BatchFile/config.jelly b/hudson-core/src/main/resources/hudson/tasks/BatchFile/config.jelly
index cd454767..ebb684c7 100644
--- a/hudson-core/src/main/resources/hudson/tasks/BatchFile/config.jelly
+++ b/hudson-core/src/main/resources/hudson/tasks/BatchFile/config.jelly
@@ -17,8 +17,12 @@
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form">
- <f:entry title="${%Command}"
- description="${%description(rootURL)}">
- <f:textarea name="command" value="${instance.command}" class="fixed-width" />
- </f:entry>
+ <f:entry title="" help="/help/disable-builder.html">
+ <f:checkbox name="disabled" checked="${instance.disabled}"
+ title="${%Temporarily disable this builder}"/>
+ </f:entry>
+ <f:entry title="${%Command}"
+ description="${%description(rootURL)}">
+ <f:textarea name="command" value="${instance.command}" class="fixed-width" />
+ </f:entry>
</j:jelly>
diff --git a/hudson-core/src/main/resources/hudson/tasks/Maven/config.jelly b/hudson-core/src/main/resources/hudson/tasks/Maven/config.jelly
index ac46aee8..79148760 100644
--- a/hudson-core/src/main/resources/hudson/tasks/Maven/config.jelly
+++ b/hudson-core/src/main/resources/hudson/tasks/Maven/config.jelly
@@ -17,7 +17,11 @@
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form">
- <j:if test="${!empty(descriptor.installations)}">
+ <f:entry title="" help="/help/disable-builder.html">
+ <f:checkbox name="disabled" checked="${instance.disabled}"
+ title="${%Temporarily disable this builder}"/>
+ </f:entry>
+ <j:if test="${!empty(descriptor.installations)}">
<f:entry title="${%Maven Version}">
<select class="setting-input" name="maven.name">
<option value="(Default)">(${%Default})</option>
diff --git a/hudson-core/src/main/resources/hudson/tasks/Shell/config.jelly b/hudson-core/src/main/resources/hudson/tasks/Shell/config.jelly
index 9670ca01..7e22f70b 100644
--- a/hudson-core/src/main/resources/hudson/tasks/Shell/config.jelly
+++ b/hudson-core/src/main/resources/hudson/tasks/Shell/config.jelly
@@ -17,7 +17,11 @@
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form">
- <f:entry title="${%Command}" description="${%description(rootURL)}">
- <f:textarea name="command" value="${instance.command}" class="fixed-width" />
- </f:entry>
+ <f:entry title="" help="/help/disable-builder.html">
+ <f:checkbox name="disabled" checked="${instance.disabled}"
+ title="${%Temporarily disable this builder}"/>
+ </f:entry>
+ <f:entry title="${%Command}" description="${%description(rootURL)}">
+ <f:textarea name="command" value="${instance.command}" class="fixed-width" />
+ </f:entry>
</j:jelly>
diff --git a/hudson-core/src/test/java/hudson/tasks/AntEqualsHashCodeTest.java b/hudson-core/src/test/java/hudson/tasks/AntEqualsHashCodeTest.java
index 50b7b249..b40d603f 100644
--- a/hudson-core/src/test/java/hudson/tasks/AntEqualsHashCodeTest.java
+++ b/hudson-core/src/test/java/hudson/tasks/AntEqualsHashCodeTest.java
@@ -15,10 +15,9 @@
*******************************************************************************/
package hudson.tasks;
-import org.junit.Test;
-
import static junit.framework.Assert.assertEquals;
import static junit.framework.Assert.assertFalse;
+import org.junit.Test;
/**
* Verify equals and hashCode methods for Ant object.
@@ -28,18 +27,18 @@ import static junit.framework.Assert.assertFalse;
* @author Nikita Levyankov
*/
public class AntEqualsHashCodeTest {
- private Ant ant = new Ant("targets", "antName", "antOpts", "buildFile", "properties");
+ private Ant ant = new Ant("targets", "antName", "antOpts", "buildFile", "properties", false);
@Test
public void testHashCode() {
- assertEquals(ant.hashCode(), new Ant("targets", "antName", "antOpts", "buildFile", "properties").hashCode());
- assertFalse(ant.hashCode() == new Ant("targets", "antName", "antOpts", "buildFile", "properties1").hashCode());
- assertFalse(ant.hashCode() == new Ant("targets", "antName", "antOpts", "buildFile1", "properties").hashCode());
- assertFalse(ant.hashCode() == new Ant("targets", "antName", "antOpts1", "buildFile", "properties").hashCode());
- assertFalse(ant.hashCode() == new Ant("targets", "antName1", "antOpts", "buildFile", "properties").hashCode());
- assertFalse(ant.hashCode() == new Ant("targets1", "antName", "antOpts", "buildFile", "properties").hashCode());
+ assertEquals(ant.hashCode(), new Ant("targets", "antName", "antOpts", "buildFile", "properties", false).hashCode());
+ assertFalse(ant.hashCode() == new Ant("targets", "antName", "antOpts", "buildFile", "properties1", false).hashCode());
+ assertFalse(ant.hashCode() == new Ant("targets", "antName", "antOpts", "buildFile1", "properties", false).hashCode());
+ assertFalse(ant.hashCode() == new Ant("targets", "antName", "antOpts1", "buildFile", "properties", false).hashCode());
+ assertFalse(ant.hashCode() == new Ant("targets", "antName1", "antOpts", "buildFile", "properties", false).hashCode());
+ assertFalse(ant.hashCode() == new Ant("targets1", "antName", "antOpts", "buildFile", "properties", false).hashCode());
assertFalse(
- ant.hashCode() == new Ant("targets1", "antName1", "antOpts1", "buildFile1", "properties1").hashCode());
+ ant.hashCode() == new Ant("targets1", "antName1", "antOpts1", "buildFile1", "properties1", false).hashCode());
}
@Test
@@ -47,12 +46,12 @@ public class AntEqualsHashCodeTest {
assertEquals(ant, ant);
assertFalse(ant.equals(null));
assertFalse(ant.equals(new Object()));
- assertEquals(ant, new Ant("targets", "antName", "antOpts", "buildFile", "properties"));
- assertFalse(ant.equals(new Ant("targets", "antName", "antOpts", "buildFile", "properties1")));
- assertFalse(ant.equals(new Ant("targets", "antName", "antOpts", "buildFile1", "properties")));
- assertFalse(ant.equals(new Ant("targets", "antName", "antOpts1", "buildFile", "properties")));
- assertFalse(ant.equals(new Ant("targets", "antName1", "antOpts", "buildFile", "properties")));
- assertFalse(ant.equals(new Ant("targets1", "antName", "antOpts", "buildFile", "properties")));
- assertFalse(ant.equals(new Ant("targets1", "antName1", "antOpts1", "buildFile1", "properties1")));
+ assertEquals(ant, new Ant("targets", "antName", "antOpts", "buildFile", "properties", false));
+ assertFalse(ant.equals(new Ant("targets", "antName", "antOpts", "buildFile", "properties1", false)));
+ assertFalse(ant.equals(new Ant("targets", "antName", "antOpts", "buildFile1", "properties", false)));
+ assertFalse(ant.equals(new Ant("targets", "antName", "antOpts1", "buildFile", "properties", false)));
+ assertFalse(ant.equals(new Ant("targets", "antName1", "antOpts", "buildFile", "properties", false)));
+ assertFalse(ant.equals(new Ant("targets1", "antName", "antOpts", "buildFile", "properties", false)));
+ assertFalse(ant.equals(new Ant("targets1", "antName1", "antOpts1", "buildFile1", "properties1", false)));
}
}
diff --git a/hudson-core/src/test/java/hudson/tasks/BatchFileEqualsHashCodeTest.java b/hudson-core/src/test/java/hudson/tasks/BatchFileEqualsHashCodeTest.java
index b21876d2..455ed115 100644
--- a/hudson-core/src/test/java/hudson/tasks/BatchFileEqualsHashCodeTest.java
+++ b/hudson-core/src/test/java/hudson/tasks/BatchFileEqualsHashCodeTest.java
@@ -16,10 +16,9 @@
package hudson.tasks;
-import org.junit.Test;
-
import static junit.framework.Assert.assertEquals;
import static junit.framework.Assert.assertFalse;
+import org.junit.Test;
/**
* Verify equals and hashCode methods for BatchFile object.
@@ -31,23 +30,23 @@ import static junit.framework.Assert.assertFalse;
public class BatchFileEqualsHashCodeTest {
@Test
public void testHashCode() {
- assertEquals(new BatchFile(null).hashCode(), new BatchFile(null).hashCode());
- assertEquals(new BatchFile("").hashCode(), new BatchFile("").hashCode());
- assertEquals(new BatchFile("echo").hashCode(), new BatchFile("echo").hashCode());
- assertFalse(new BatchFile("echo 'test'").hashCode() == new BatchFile("echo '123'").hashCode());
- assertFalse(new BatchFile(null).hashCode() == new BatchFile("echo '123'").hashCode());
+ assertEquals(new BatchFile(null, false).hashCode(), new BatchFile(null, false).hashCode());
+ assertEquals(new BatchFile("", false).hashCode(), new BatchFile("", false).hashCode());
+ assertEquals(new BatchFile("echo", false).hashCode(), new BatchFile("echo", false).hashCode());
+ assertFalse(new BatchFile("echo 'test'", false).hashCode() == new BatchFile("echo '123'", false).hashCode());
+ assertFalse(new BatchFile(null, false).hashCode() == new BatchFile("echo '123'", false).hashCode());
}
@Test
public void testEqual() {
- BatchFile echo = new BatchFile("echo");
+ BatchFile echo = new BatchFile("echo", false);
assertEquals(echo, echo);
- assertFalse(new BatchFile("echo").equals(null));
+ assertFalse(new BatchFile("echo", false).equals(null));
assertFalse(echo.equals(new Object()));
- assertEquals(echo, new BatchFile("echo"));
- assertEquals(new BatchFile(null), new BatchFile(null));
- assertEquals(new BatchFile(""), new BatchFile(""));
- assertFalse(new BatchFile("echo 'test'").equals(new BatchFile("echo '123'")));
- assertFalse(new BatchFile(null).equals(new BatchFile("echo '123'")));
+ assertEquals(echo, new BatchFile("echo", false));
+ assertEquals(new BatchFile(null, false), new BatchFile(null, false));
+ assertEquals(new BatchFile("", false), new BatchFile("", false));
+ assertFalse(new BatchFile("echo 'test'", false).equals(new BatchFile("echo '123'", false)));
+ assertFalse(new BatchFile(null, false).equals(new BatchFile("echo '123'", false)));
}
} \ No newline at end of file
diff --git a/hudson-core/src/test/java/hudson/tasks/MavenEqualsHashCodeTest.java b/hudson-core/src/test/java/hudson/tasks/MavenEqualsHashCodeTest.java
index e1ad3116..ef0fdd5a 100644
--- a/hudson-core/src/test/java/hudson/tasks/MavenEqualsHashCodeTest.java
+++ b/hudson-core/src/test/java/hudson/tasks/MavenEqualsHashCodeTest.java
@@ -15,10 +15,9 @@
*******************************************************************************/
package hudson.tasks;
-import org.junit.Test;
-
import static junit.framework.Assert.assertEquals;
import static junit.framework.Assert.assertFalse;
+import org.junit.Test;
/**
* Verify equals and hashCode methods for Maven object.
@@ -29,24 +28,24 @@ import static junit.framework.Assert.assertFalse;
*/
public class MavenEqualsHashCodeTest {
- private Maven maven = new Maven("targets", "name", "pom", "properties", "jvmOptions", false);
+ private Maven maven = new Maven("targets", "name", "pom", "properties", "jvmOptions", false, false);
@Test
public void testHashCode() {
assertEquals(maven.hashCode(),
- new Maven("targets", "name", "pom", "properties", "jvmOptions", false).hashCode());
+ new Maven("targets", "name", "pom", "properties", "jvmOptions", false, false).hashCode());
assertFalse(
- maven.hashCode() == new Maven("targets", "name", "pom", "properties", "jvmOptions", true).hashCode());
+ maven.hashCode() == new Maven("targets", "name", "pom", "properties", "jvmOptions", true, false).hashCode());
assertFalse(
- maven.hashCode() == new Maven("targets", "name", "pom", "properties", "jvmOptions1", false).hashCode());
+ maven.hashCode() == new Maven("targets", "name", "pom", "properties", "jvmOptions1", false, false).hashCode());
assertFalse(
- maven.hashCode() == new Maven("targets", "name", "pom", "properties1", "jvmOptions", false).hashCode());
+ maven.hashCode() == new Maven("targets", "name", "pom", "properties1", "jvmOptions", false, false).hashCode());
assertFalse(
- maven.hashCode() == new Maven("targets", "name", "pom1", "properties", "jvmOptions", false).hashCode());
+ maven.hashCode() == new Maven("targets", "name", "pom1", "properties", "jvmOptions", false, false).hashCode());
assertFalse(
- maven.hashCode() == new Maven("targets", "name1", "pom", "properties", "jvmOptions", false).hashCode());
+ maven.hashCode() == new Maven("targets", "name1", "pom", "properties", "jvmOptions", false, false).hashCode());
assertFalse(
- maven.hashCode() == new Maven("targets1", "name", "pom", "properties", "jvmOptions", false).hashCode());
+ maven.hashCode() == new Maven("targets1", "name", "pom", "properties", "jvmOptions", false, false).hashCode());
}
@Test
@@ -54,12 +53,12 @@ public class MavenEqualsHashCodeTest {
assertEquals(maven, maven);
assertFalse(maven.equals(null));
assertFalse(maven.equals(new Object()));
- assertEquals(maven, new Maven("targets", "name", "pom", "properties", "jvmOptions", false));
- assertFalse(maven.equals(new Maven("targets", "name", "pom", "properties", "jvmOptions", true)));
- assertFalse(maven.equals(new Maven("targets", "name", "pom", "properties", "jvmOptions1", false)));
- assertFalse(maven.equals(new Maven("targets", "name", "pom1", "properties", "jvmOptions", false)));
- assertFalse(maven.equals(new Maven("targets", "name1", "pom", "properties", "jvmOptions", false)));
- assertFalse(maven.equals(new Maven("targets1", "name", "pom", "properties", "jvmOptions", false)));
- assertFalse(maven.equals(new Maven("targets1", "name1", "pom1", "properties1", "jvmOptions1", true)));
+ assertEquals(maven, new Maven("targets", "name", "pom", "properties", "jvmOptions", false, false));
+ assertFalse(maven.equals(new Maven("targets", "name", "pom", "properties", "jvmOptions", true, false)));
+ assertFalse(maven.equals(new Maven("targets", "name", "pom", "properties", "jvmOptions1", false, false)));
+ assertFalse(maven.equals(new Maven("targets", "name", "pom1", "properties", "jvmOptions", false, false)));
+ assertFalse(maven.equals(new Maven("targets", "name1", "pom", "properties", "jvmOptions", false, false)));
+ assertFalse(maven.equals(new Maven("targets1", "name", "pom", "properties", "jvmOptions", false, false)));
+ assertFalse(maven.equals(new Maven("targets1", "name1", "pom1", "properties1", "jvmOptions1", true, false)));
}
}
diff --git a/hudson-core/src/test/java/hudson/tasks/ShellEqualsHashCodeTest.java b/hudson-core/src/test/java/hudson/tasks/ShellEqualsHashCodeTest.java
index d5684e35..bb47f7ed 100644
--- a/hudson-core/src/test/java/hudson/tasks/ShellEqualsHashCodeTest.java
+++ b/hudson-core/src/test/java/hudson/tasks/ShellEqualsHashCodeTest.java
@@ -15,10 +15,9 @@
*******************************************************************************/
package hudson.tasks;
-import org.junit.Test;
-
import static junit.framework.Assert.assertEquals;
import static junit.framework.Assert.assertFalse;
+import org.junit.Test;
/**
* Verify equals and hashCode methods for Shell object.
@@ -31,23 +30,23 @@ public class ShellEqualsHashCodeTest {
@Test
public void testHashCode() {
- assertEquals(new Shell(null).hashCode(), new Shell(null).hashCode());
- assertEquals(new Shell("").hashCode(), new Shell("").hashCode());
- assertEquals(new Shell("echo").hashCode(), new Shell("echo").hashCode());
- assertFalse(new Shell("echo 'test'").hashCode() == new Shell("echo '123'").hashCode());
- assertFalse(new Shell(null).hashCode() == new Shell("echo '123'").hashCode());
+ assertEquals(new Shell(null, false).hashCode(), new Shell(null, false).hashCode());
+ assertEquals(new Shell("", false).hashCode(), new Shell("", false).hashCode());
+ assertEquals(new Shell("echo", false).hashCode(), new Shell("echo", false).hashCode());
+ assertFalse(new Shell("echo 'test'", false).hashCode() == new Shell("echo '123'", false).hashCode());
+ assertFalse(new Shell(null, false).hashCode() == new Shell("echo '123'", false).hashCode());
}
@Test
public void testEqual() {
- Shell echo = new Shell("echo");
+ Shell echo = new Shell("echo", false);
assertEquals(echo, echo);
- assertFalse(new Shell("echo").equals(null));
+ assertFalse(new Shell("echo", false).equals(null));
assertFalse(echo.equals(new Object()));
- assertEquals(echo, new Shell("echo"));
- assertEquals(new Shell(null), new Shell(null));
- assertEquals(new Shell(""), new Shell(""));
- assertFalse(new Shell("echo 'test'").equals(new Shell("echo '123'")));
- assertFalse(new Shell(null).equals(new Shell("echo '123'")));
+ assertEquals(echo, new Shell("echo", false));
+ assertEquals(new Shell(null, false), new Shell(null, false));
+ assertEquals(new Shell("", false), new Shell("", false));
+ assertFalse(new Shell("echo 'test'", false).equals(new Shell("echo '123'", false)));
+ assertFalse(new Shell(null, false).equals(new Shell("echo '123'", false)));
}
}
diff --git a/hudson-core/src/test/java/hudson/util/CopyOnWriteListEqualsHashCodeTest.java b/hudson-core/src/test/java/hudson/util/CopyOnWriteListEqualsHashCodeTest.java
index 2a38566a..4a8b7908 100644
--- a/hudson-core/src/test/java/hudson/util/CopyOnWriteListEqualsHashCodeTest.java
+++ b/hudson-core/src/test/java/hudson/util/CopyOnWriteListEqualsHashCodeTest.java
@@ -19,11 +19,10 @@ import hudson.tasks.Builder;
import hudson.tasks.Shell;
import java.util.ArrayList;
import java.util.List;
-import org.junit.Before;
-import org.junit.Test;
-
import static junit.framework.Assert.assertEquals;
import static junit.framework.Assert.assertFalse;
+import org.junit.Before;
+import org.junit.Test;
/**
* Verify equals and hashCode methods for CopyOnWriteList object.
@@ -39,13 +38,13 @@ public class CopyOnWriteListEqualsHashCodeTest {
@Before
public void setUp() {
data1 = new ArrayList<Builder>();
- data1.add(new Shell("echo 'test'"));
- data1.add(new Shell("echo 'test1'"));
- data1.add(new Shell("echo 'test2'"));
+ data1.add(new Shell("echo 'test'", false));
+ data1.add(new Shell("echo 'test1'", false));
+ data1.add(new Shell("echo 'test2'", false));
data2 = new ArrayList<Builder>();
- data2.add(new Shell("echo 'test1'"));
- data2.add(new Shell("echo 'test'"));
+ data2.add(new Shell("echo 'test1'", false));
+ data2.add(new Shell("echo 'test'", false));
}
@Test
@@ -53,7 +52,7 @@ public class CopyOnWriteListEqualsHashCodeTest {
assertEquals(new CopyOnWriteList(data1).hashCode(), new CopyOnWriteList(data1).hashCode());
assertFalse(new CopyOnWriteList(data1).hashCode() == new CopyOnWriteList(data2).hashCode());
- data2.add(new Shell("echo 'test2'"));
+ data2.add(new Shell("echo 'test2'", false));
assertFalse(new CopyOnWriteList(data1).hashCode() == new CopyOnWriteList(data2).hashCode());
}
@@ -67,7 +66,7 @@ public class CopyOnWriteListEqualsHashCodeTest {
assertFalse(new CopyOnWriteList(data1).equals(new CopyOnWriteList(data2)));
assertEquals(new CopyOnWriteList(data1), new CopyOnWriteList(data1));
- data2.add(new Shell("echo 'test2'"));
+ data2.add(new Shell("echo 'test2'", false));
assertEquals(new CopyOnWriteList(data1), new CopyOnWriteList(data2));
}
}
diff --git a/hudson-core/src/test/java/hudson/util/PersistedListEqualsHashCodeTest.java b/hudson-core/src/test/java/hudson/util/PersistedListEqualsHashCodeTest.java
index 64b93fa4..1f3471d3 100644
--- a/hudson-core/src/test/java/hudson/util/PersistedListEqualsHashCodeTest.java
+++ b/hudson-core/src/test/java/hudson/util/PersistedListEqualsHashCodeTest.java
@@ -21,11 +21,10 @@ import hudson.model.Saveable;
import hudson.tasks.Shell;
import java.io.IOException;
import java.util.Arrays;
-import org.junit.Before;
-import org.junit.Test;
-
import static junit.framework.Assert.assertEquals;
import static junit.framework.Assert.assertFalse;
+import org.junit.Before;
+import org.junit.Test;
/**
* Verify equals and hashCode methods for PersistedList object.
@@ -55,13 +54,13 @@ public class PersistedListEqualsHashCodeTest {
assertEquals(new PersistedList().hashCode(), new PersistedList().hashCode());
assertEquals(persistedList1.hashCode(), new PersistedList(owner1).hashCode());
assertFalse(persistedList1.hashCode() == persistedList2.hashCode());
- persistedList1.add(new Shell("echo 'test1'"));
+ persistedList1.add(new Shell("echo 'test1'", false));
assertFalse(persistedList1.hashCode() == persistedList2.hashCode());
- persistedList2.add(new Shell("echo 'test1'"));
+ persistedList2.add(new Shell("echo 'test1'", false));
assertFalse(persistedList1.hashCode() == persistedList2.hashCode());
- persistedList3.add(new Shell("echo 'test1'"));
+ persistedList3.add(new Shell("echo 'test1'", false));
assertEquals(persistedList1.hashCode(), persistedList3.hashCode());
- persistedList3.replaceBy(Arrays.asList(new Shell("echo 'test2'")));
+ persistedList3.replaceBy(Arrays.asList(new Shell("echo 'test2'", false)));
assertFalse(persistedList1.hashCode() == persistedList3.hashCode());
}
@@ -72,16 +71,16 @@ public class PersistedListEqualsHashCodeTest {
assertFalse(persistedList1.equals(new Object()));
assertFalse(persistedList1.equals(persistedList2));
assertEquals(persistedList1, persistedList3);
- persistedList1.add(new Shell("echo 'test1'"));
- persistedList3.add(new Shell("echo 'test1'"));
+ persistedList1.add(new Shell("echo 'test1'", false));
+ persistedList3.add(new Shell("echo 'test1'", false));
assertEquals(persistedList1, persistedList3);
- persistedList1.add(new Shell("echo 'test3'"));
- persistedList1.add(new Shell("echo 'test2'"));
- persistedList3.add(new Shell("echo 'test2'"));
- persistedList3.add(new Shell("echo 'test3'"));
+ persistedList1.add(new Shell("echo 'test3'", false));
+ persistedList1.add(new Shell("echo 'test2'", false));
+ persistedList3.add(new Shell("echo 'test2'", false));
+ persistedList3.add(new Shell("echo 'test3'", false));
assertEquals(persistedList1, persistedList3);
- persistedList3.replaceBy(Arrays.asList(new Shell("echo 'test2'")));
+ persistedList3.replaceBy(Arrays.asList(new Shell("echo 'test2'", false)));
assertFalse(persistedList1.equals(persistedList3));
}
}
diff --git a/hudson-core/src/test/java/org/eclipse/hudson/model/project/property/DescribableListProjectPropertyTest.java b/hudson-core/src/test/java/org/eclipse/hudson/model/project/property/DescribableListProjectPropertyTest.java
index 09cc9067..6a639491 100644
--- a/hudson-core/src/test/java/org/eclipse/hudson/model/project/property/DescribableListProjectPropertyTest.java
+++ b/hudson-core/src/test/java/org/eclipse/hudson/model/project/property/DescribableListProjectPropertyTest.java
@@ -19,14 +19,13 @@ import hudson.model.FreeStyleProjectMock;
import hudson.tasks.Shell;
import hudson.util.DescribableList;
import java.util.Arrays;
-import org.junit.Before;
-import org.junit.Test;
-
import static junit.framework.Assert.assertEquals;
import static junit.framework.Assert.assertFalse;
import static junit.framework.Assert.assertNotNull;
import static junit.framework.Assert.assertTrue;
import static junit.framework.Assert.fail;
+import org.junit.Before;
+import org.junit.Test;
/**
* Contains test-cases for {@link DescribableListProjectProperty}.
@@ -120,9 +119,9 @@ public class DescribableListProjectPropertyTest {
assertFalse(property.allowOverrideValue(new DescribableList(project), new DescribableList(project)));
assertFalse(property.allowOverrideValue(new DescribableList(project), new DescribableList(parent)));
DescribableList describableList1 = new DescribableList(project,
- Arrays.asList(new Shell("echo 'test3'"), new Shell("echo 'test2'")));
+ Arrays.asList(new Shell("echo 'test3'", false), new Shell("echo 'test2'", false)));
DescribableList describableList2 = new DescribableList(project,
- Arrays.asList(new Shell("echo 'test2'"), new Shell("echo 'test3'")));
+ Arrays.asList(new Shell("echo 'test2'", false), new Shell("echo 'test3'", false)));
assertFalse(property.allowOverrideValue(describableList1, describableList2));
DescribableList describableList3 = new DescribableList(parent, describableList2.toList());
@@ -137,8 +136,8 @@ public class DescribableListProjectPropertyTest {
assertTrue(property.allowOverrideValue(new DescribableList(project), null));
assertTrue(property.allowOverrideValue(new DescribableList(project),
- new DescribableList(project, Arrays.asList(new Shell("echo 'test1'")))));
- assertTrue(property.allowOverrideValue(new DescribableList(project, Arrays.asList(new Shell("echo 'test1'"))),
+ new DescribableList(project, Arrays.asList(new Shell("echo 'test1'", false)))));
+ assertTrue(property.allowOverrideValue(new DescribableList(project, Arrays.asList(new Shell("echo 'test1'", false))),
new DescribableList(project)));
}
diff --git a/hudson-war/src/main/webapp/help/disable-builder.html b/hudson-war/src/main/webapp/help/disable-builder.html
new file mode 100644
index 00000000..d9611c21
--- /dev/null
+++ b/hudson-war/src/main/webapp/help/disable-builder.html
@@ -0,0 +1,18 @@
+<!-- **************************************************************************
+#
+# Copyright (C) 2015 Oracle Corporation
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# Winston Prakash
+#
+#************************************************************************** -->
+
+<div>
+ <p>When checked, this builder will be disabled temporarily until enabled again.
+ At build time the builder will not perform it's task.</p>
+</div>

Back to the top