aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorakozak2011-11-21 08:33:35 (EST)
committerWinston Prakash2011-12-01 20:46:51 (EST)
commita4449a68fba4050d7abec5a7edd479995b73b92c (patch)
treed12f83f129ff1f73311358e05a566e6cbd6e87de
parent719ac7e19de1f727856eff1f9f68b2b635d93cad (diff)
downloadorg.eclipse.hudson.core-a4449a68fba4050d7abec5a7edd479995b73b92c.zip
org.eclipse.hudson.core-a4449a68fba4050d7abec5a7edd479995b73b92c.tar.gz
org.eclipse.hudson.core-a4449a68fba4050d7abec5a7edd479995b73b92c.tar.bz2
Implement backward compatible getters and setters for boolean values. Cover methods with unit-tests
Signed-off-by: Winston Prakash <winston.prakash@gmail.com>
-rw-r--r--hudson-core/src/main/java/hudson/model/AbstractProject.java112
-rw-r--r--hudson-core/src/main/java/hudson/model/IAbstractProject.java4
-rw-r--r--hudson-core/src/test/java/hudson/model/FreeStyleProjectTest.java181
3 files changed, 261 insertions, 36 deletions
diff --git a/hudson-core/src/main/java/hudson/model/AbstractProject.java b/hudson-core/src/main/java/hudson/model/AbstractProject.java
index bb4ff8a..2f1e2b7 100644
--- a/hudson-core/src/main/java/hudson/model/AbstractProject.java
+++ b/hudson-core/src/main/java/hudson/model/AbstractProject.java
@@ -23,6 +23,7 @@ import hudson.FeedAdapter;
import hudson.FilePath;
import hudson.Functions;
import hudson.Launcher;
+import hudson.RestrictedSince;
import hudson.Util;
import hudson.cli.declarative.CLIMethod;
import hudson.cli.declarative.CLIResolver;
@@ -92,6 +93,8 @@ import net.sf.json.JSONObject;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.math.NumberUtils;
+import org.kohsuke.accmod.Restricted;
+import org.kohsuke.accmod.restrictions.NoExternalUse;
import org.kohsuke.args4j.Argument;
import org.kohsuke.args4j.CmdLineException;
import org.kohsuke.stapler.ForwardToView;
@@ -221,13 +224,20 @@ public abstract class AbstractProject<P extends AbstractProject<P,R>,R extends A
@CopyOnWrite
protected transient volatile List<Action> transientActions = new Vector<Action>();
-
- private boolean concurrentBuild;
+ /**
+ * Note: this field was made protected for testing purpose. Access it via {@link #isConcurrentBuild()} method
+ */
+ @Restricted(NoExternalUse.class)
+ @RestrictedSince("2.1.2")
+ protected Boolean concurrentBuild = false;
/**
- * True to clean the workspace prior to each build.
- */
- private volatile boolean cleanWorkspaceRequired;
+ * True to clean the workspace prior to each build.
+ * Note: this field was made protected for testing purpose. Access it via {@link #isCleanWorkspaceRequired()} method
+ */
+ @Restricted(NoExternalUse.class)
+ @RestrictedSince("2.1.2")
+ protected volatile Boolean cleanWorkspaceRequired = false;
protected AbstractProject(ItemGroup parent, String name) {
super(parent, name);
@@ -258,7 +268,7 @@ public abstract class AbstractProject<P extends AbstractProject<P,R>,R extends A
super.onLoad(parent, name);
this.builds = new RunMap<R>();
- this.builds.load(this,new Constructor<R>() {
+ this.builds.load(this, new Constructor<R>() {
public R create(File dir) throws IOException {
return loadBuild(dir);
}
@@ -278,6 +288,21 @@ public abstract class AbstractProject<P extends AbstractProject<P,R>,R extends A
if(transientActions==null)
transientActions = new Vector<Action>(); // happens when loaded from disk
+
+ //Initialize boolean values since from 2.1.2 primitive wrappers were used.
+ if (null == blockBuildWhenDownstreamBuilding) {
+ blockBuildWhenDownstreamBuilding = false;
+ }
+ if (null == blockBuildWhenUpstreamBuilding) {
+ blockBuildWhenUpstreamBuilding = false;
+ }
+ if (null == cleanWorkspaceRequired) {
+ cleanWorkspaceRequired = false;
+ }
+ if (null == concurrentBuild) {
+ concurrentBuild = false;
+ }
+
updateTransientActions();
}
@@ -301,20 +326,55 @@ public abstract class AbstractProject<P extends AbstractProject<P,R>,R extends A
*/
@Exported
public boolean isConcurrentBuild() {
- return Hudson.CONCURRENT_BUILD && concurrentBuild;
+ if (null != concurrentBuild) {
+ return Hudson.CONCURRENT_BUILD && concurrentBuild;
+ }
+ return null != getTemplate() && getTemplate().isConcurrentBuild();
}
+ /**
+ * @param b boolean value.
+ * @throws IOException if any.
+ * @since 2.1.2
+ * @deprecated
+ */
public void setConcurrentBuild(boolean b) throws IOException {
- concurrentBuild = b;
+ setConcurrentBuild(Boolean.valueOf(b));
+ }
+
+ public void setConcurrentBuild(Boolean b) throws IOException {
+ if (!(hasParentTemplate()
+ && ObjectUtils.equals(getTemplate().isConcurrentBuild(), b))) {
+ concurrentBuild = b;
+ } else {
+ this.concurrentBuild = null;
+ }
save();
}
public boolean isCleanWorkspaceRequired() {
- return cleanWorkspaceRequired;
+ if (null != cleanWorkspaceRequired) {
+ return cleanWorkspaceRequired;
+ }
+ return hasParentTemplate() && getTemplate().isCleanWorkspaceRequired();
}
+ /**
+ * @param cleanWorkspaceRequired boolean value.
+ * @since 2.1.2
+ * @deprecated
+ */
public void setCleanWorkspaceRequired(boolean cleanWorkspaceRequired) {
- this.cleanWorkspaceRequired = cleanWorkspaceRequired;
+ setCleanWorkspaceRequired(Boolean.valueOf(cleanWorkspaceRequired));
+ }
+
+ public void setCleanWorkspaceRequired(Boolean cleanWorkspaceRequired) {
+ if (!(hasParentTemplate()
+ && ObjectUtils.equals(getTemplate().isCleanWorkspaceRequired(), cleanWorkspaceRequired))) {
+ this.cleanWorkspaceRequired = cleanWorkspaceRequired;
+ } else {
+ this.cleanWorkspaceRequired = null;
+ }
}
/**
@@ -603,13 +663,23 @@ public abstract class AbstractProject<P extends AbstractProject<P,R>,R extends A
return true;
}
- public Boolean blockBuildWhenDownstreamBuilding() {
+ public boolean blockBuildWhenDownstreamBuilding() {
if (null != blockBuildWhenDownstreamBuilding) {
return blockBuildWhenDownstreamBuilding;
}
return hasParentTemplate() && getTemplate().blockBuildWhenDownstreamBuilding();
}
+ /**
+ * @param b boolean value.
+ * @throws IOException if any.
+ * @since 2.1.2
+ * @deprecated
+ */
+ public void setBlockBuildWhenDownstreamBuilding(boolean b) throws IOException {
+ setBlockBuildWhenDownstreamBuilding(Boolean.valueOf(b));
+ }
+
public void setBlockBuildWhenDownstreamBuilding(Boolean b) throws IOException {
if (!(hasParentTemplate() && ObjectUtils.equals(getTemplate().blockBuildWhenDownstreamBuilding(), b))) {
blockBuildWhenDownstreamBuilding = b;
@@ -619,13 +689,23 @@ public abstract class AbstractProject<P extends AbstractProject<P,R>,R extends A
save();
}
- public Boolean blockBuildWhenUpstreamBuilding() {
+ public boolean blockBuildWhenUpstreamBuilding() {
if (null != blockBuildWhenUpstreamBuilding) {
return blockBuildWhenUpstreamBuilding;
}
return hasParentTemplate() && getTemplate().blockBuildWhenUpstreamBuilding();
}
+ /**
+ * @param b boolean value.
+ * @throws IOException if any.
+ * @since 2.1.2
+ * @deprecated
+ */
+ public void setBlockBuildWhenUpstreamBuilding(boolean b) throws IOException {
+ setBlockBuildWhenUpstreamBuilding(Boolean.valueOf(b));
+ }
+
public void setBlockBuildWhenUpstreamBuilding(Boolean b) throws IOException {
if (!(hasParentTemplate() && ObjectUtils.equals(getTemplate().blockBuildWhenUpstreamBuilding(), b))) {
blockBuildWhenUpstreamBuilding = b;
@@ -1764,8 +1844,8 @@ public abstract class AbstractProject<P extends AbstractProject<P,R>,R extends A
setQuietPeriod(null != req.getParameter("hasCustomQuietPeriod") ? req.getParameter("quiet_period") : null);
setScmCheckoutRetryCount(null != req.getParameter("hasCustomScmCheckoutRetryCount")
? req.getParameter("scmCheckoutRetryCount") : null);
- setBlockBuildWhenDownstreamBuilding(null != req.getParameter("blockBuildWhenDownstreamBuilding"));
- setBlockBuildWhenUpstreamBuilding(null != req.getParameter("blockBuildWhenUpstreamBuilding"));
+ setBlockBuildWhenDownstreamBuilding((Boolean) (null != req.getParameter("blockBuildWhenDownstreamBuilding")));
+ setBlockBuildWhenUpstreamBuilding((Boolean) (null != req.getParameter("blockBuildWhenUpstreamBuilding")));
if (req.getParameter("hasSlaveAffinity") != null) {
// New logic for handling whether this choice came from the dropdown or textfield.
@@ -1782,11 +1862,11 @@ public abstract class AbstractProject<P extends AbstractProject<P,R>,R extends A
}
- setCleanWorkspaceRequired(null != req.getParameter("cleanWorkspaceRequired"));
+ setCleanWorkspaceRequired((Boolean) (null != req.getParameter("cleanWorkspaceRequired")));
canRoam = assignedNode==null;
- setConcurrentBuild(req.getSubmittedForm().has("concurrentBuild"));
+ setConcurrentBuild((Boolean) (req.getSubmittedForm().has("concurrentBuild")));
authToken = BuildAuthorizationToken.create(req);
diff --git a/hudson-core/src/main/java/hudson/model/IAbstractProject.java b/hudson-core/src/main/java/hudson/model/IAbstractProject.java
index 67b6899..147c8e2 100644
--- a/hudson-core/src/main/java/hudson/model/IAbstractProject.java
+++ b/hudson-core/src/main/java/hudson/model/IAbstractProject.java
@@ -68,14 +68,14 @@ public interface IAbstractProject extends IJob {
*
* @return true if yes, false - otherwise.
*/
- Boolean blockBuildWhenDownstreamBuilding();
+ boolean blockBuildWhenDownstreamBuilding();
/**
* Indicates whether build should be blocked while upstream project is building.
*
* @return true if yes, false - otherwise.
*/
- Boolean blockBuildWhenUpstreamBuilding();
+ boolean blockBuildWhenUpstreamBuilding();
/**
* Checks whether scmRetryCount is configured
diff --git a/hudson-core/src/test/java/hudson/model/FreeStyleProjectTest.java b/hudson-core/src/test/java/hudson/model/FreeStyleProjectTest.java
index e7069ce..8947a6e 100644
--- a/hudson-core/src/test/java/hudson/model/FreeStyleProjectTest.java
+++ b/hudson-core/src/test/java/hudson/model/FreeStyleProjectTest.java
@@ -538,7 +538,7 @@ public class FreeStyleProjectTest {
@Test
public void testSetBlockBuildWhenDownstreamBuildingEqualsWithParent() throws IOException {
- boolean blockBuildWhenDownstreamBuilding = true;
+ Boolean blockBuildWhenDownstreamBuilding = true;
FreeStyleProject parentProject = new FreeStyleProjectMock("parent");
parentProject.allowSave.set(false);
parentProject.setBlockBuildWhenDownstreamBuilding(blockBuildWhenDownstreamBuilding);
@@ -546,16 +546,13 @@ public class FreeStyleProjectTest {
childProject.allowSave.set(false);
childProject.setTemplate(parentProject);
childProject.setBlockBuildWhenDownstreamBuilding(blockBuildWhenDownstreamBuilding);
- assertEquals(childProject.blockBuildWhenDownstreamBuilding(), (Boolean) blockBuildWhenDownstreamBuilding);
- childProject.setBlockBuildWhenDownstreamBuilding(null);
assertNull(childProject.blockBuildWhenDownstreamBuilding);
- assertEquals(childProject.blockBuildWhenDownstreamBuilding(), (Boolean) blockBuildWhenDownstreamBuilding);
}
@Test
public void testSetBlockBuildWhenDownstreamBuildingNotEqualsWithParent() throws IOException {
- boolean childBlockBuildWhenDownstreamBuilding = false;
- boolean parentBlockBuildWhenDownstreamBuilding = true;
+ Boolean childBlockBuildWhenDownstreamBuilding = false;
+ Boolean parentBlockBuildWhenDownstreamBuilding = true;
FreeStyleProject parentProject = new FreeStyleProjectMock("parent");
parentProject.allowSave.set(false);
parentProject.setBlockBuildWhenDownstreamBuilding(parentBlockBuildWhenDownstreamBuilding);
@@ -563,22 +560,41 @@ public class FreeStyleProjectTest {
childProject.allowSave.set(false);
childProject.setTemplate(parentProject);
childProject.setBlockBuildWhenDownstreamBuilding(childBlockBuildWhenDownstreamBuilding);
+ //if child value is not equals to parent one, field should be populated
assertNotNull(childProject.blockBuildWhenDownstreamBuilding);
- assertEquals(childProject.blockBuildWhenDownstreamBuilding(), (Boolean) childBlockBuildWhenDownstreamBuilding);
}
@Test
public void testSetBlockBuildWhenDownstreamBuildingParentNull() throws IOException {
- boolean blockBuildWhenDownstreamBuilding = true;
+ Boolean blockBuildWhenDownstreamBuilding = true;
FreeStyleProject childProject = new FreeStyleProjectMock("child");
childProject.allowSave.set(false);
childProject.setBlockBuildWhenDownstreamBuilding(blockBuildWhenDownstreamBuilding);
- assertEquals(childProject.blockBuildWhenDownstreamBuilding(), (Boolean) blockBuildWhenDownstreamBuilding);
+ //if parent is not set, value should be populated according to existing logic
+ assertEquals(blockBuildWhenDownstreamBuilding, childProject.blockBuildWhenDownstreamBuilding);
+ }
+
+ @Test
+ public void testBlockBuildWhenDownstreamBuilding() throws IOException {
+ Boolean childBlockBuildWhenDownstreamBuilding = false;
+ Boolean parentBlockBuildWhenDownstreamBuilding = true;
+ FreeStyleProject parentProject = new FreeStyleProjectMock("parent");
+ parentProject.allowSave.set(false);
+ parentProject.setBlockBuildWhenDownstreamBuilding(parentBlockBuildWhenDownstreamBuilding);
+ FreeStyleProject childProject = new FreeStyleProjectMock("child");
+ childProject.allowSave.set(false);
+ childProject.setBlockBuildWhenDownstreamBuilding(null);
+ childProject.setTemplate(parentProject);
+ //Value should be taken from template
+ assertEquals(parentBlockBuildWhenDownstreamBuilding, (Boolean) childProject.blockBuildWhenDownstreamBuilding());
+ childProject.setBlockBuildWhenDownstreamBuilding(childBlockBuildWhenDownstreamBuilding);
+ //Child value is not equals to parent - override value in child.
+ assertEquals(childBlockBuildWhenDownstreamBuilding, (Boolean) childProject.blockBuildWhenDownstreamBuilding());
}
@Test
public void testSetBlockBuildWhenUpstreamBuildingEqualsWithParent() throws IOException {
- boolean blockBuildWhenUpstreamBuilding = true;
+ Boolean blockBuildWhenUpstreamBuilding = true;
FreeStyleProject parentProject = new FreeStyleProjectMock("parent");
parentProject.allowSave.set(false);
parentProject.setBlockBuildWhenUpstreamBuilding(blockBuildWhenUpstreamBuilding);
@@ -586,16 +602,13 @@ public class FreeStyleProjectTest {
childProject.allowSave.set(false);
childProject.setTemplate(parentProject);
childProject.setBlockBuildWhenUpstreamBuilding(blockBuildWhenUpstreamBuilding);
- assertEquals(childProject.blockBuildWhenUpstreamBuilding(), (Boolean) blockBuildWhenUpstreamBuilding);
- childProject.setBlockBuildWhenUpstreamBuilding(null);
assertNull(childProject.blockBuildWhenUpstreamBuilding);
- assertEquals(childProject.blockBuildWhenUpstreamBuilding(), (Boolean) blockBuildWhenUpstreamBuilding);
}
@Test
public void testSetBlockBuildWhenUpstreamBuildingNotEqualsWithParent() throws IOException {
- boolean childBlockBuildWhenUpstreamBuilding = false;
- boolean parentBlockBuildWhenUpstreamBuilding = true;
+ Boolean childBlockBuildWhenUpstreamBuilding = false;
+ Boolean parentBlockBuildWhenUpstreamBuilding = true;
FreeStyleProject parentProject = new FreeStyleProjectMock("parent");
parentProject.allowSave.set(false);
parentProject.setBlockBuildWhenUpstreamBuilding(parentBlockBuildWhenUpstreamBuilding);
@@ -603,17 +616,149 @@ public class FreeStyleProjectTest {
childProject.allowSave.set(false);
childProject.setTemplate(parentProject);
childProject.setBlockBuildWhenUpstreamBuilding(childBlockBuildWhenUpstreamBuilding);
+ //if child value is not equals to parent one, field should be populated
assertNotNull(childProject.blockBuildWhenUpstreamBuilding);
- assertEquals(childProject.blockBuildWhenUpstreamBuilding(), (Boolean) childBlockBuildWhenUpstreamBuilding);
}
@Test
public void testSetBlockBuildWhenUpstreamBuildingParentNull() throws IOException {
- boolean blockBuildWhenUpstreamBuilding = true;
+ Boolean blockBuildWhenUpstreamBuilding = true;
FreeStyleProject childProject = new FreeStyleProjectMock("child");
childProject.allowSave.set(false);
childProject.setBlockBuildWhenUpstreamBuilding(blockBuildWhenUpstreamBuilding);
- assertEquals(childProject.blockBuildWhenUpstreamBuilding(), (Boolean) blockBuildWhenUpstreamBuilding);
+ //if parent is not set, value should be populated according to existing logic
+ assertEquals(blockBuildWhenUpstreamBuilding, childProject.blockBuildWhenUpstreamBuilding);
+ }
+
+ @Test
+ public void testBlockBuildWhenUpstreamBuilding() throws IOException {
+ Boolean childBlockBuildWhenUpstreamBuilding = false;
+ Boolean parentBlockBuildWhenUpstreamBuilding = true;
+ FreeStyleProject parentProject = new FreeStyleProjectMock("parent");
+ parentProject.allowSave.set(false);
+ parentProject.setBlockBuildWhenUpstreamBuilding(parentBlockBuildWhenUpstreamBuilding);
+ FreeStyleProject childProject = new FreeStyleProjectMock("child");
+ childProject.allowSave.set(false);
+ childProject.setBlockBuildWhenUpstreamBuilding(null);
+ childProject.setTemplate(parentProject);
+ //Value should be taken from template
+ assertEquals(parentBlockBuildWhenUpstreamBuilding, (Boolean) childProject.blockBuildWhenUpstreamBuilding());
+ childProject.setBlockBuildWhenUpstreamBuilding(childBlockBuildWhenUpstreamBuilding);
+ //Child value is not equals to parent - override value in child.
+ assertEquals(childBlockBuildWhenUpstreamBuilding, (Boolean) childProject.blockBuildWhenUpstreamBuilding());
+ }
+
+// ---
+ @Test
+ public void testSetCleanWorkspaceRequiredEqualsWithParent() throws IOException {
+ Boolean cleanWorkspaceRequired = true;
+ FreeStyleProject parentProject = new FreeStyleProjectMock("parent");
+ parentProject.allowSave.set(false);
+ parentProject.setCleanWorkspaceRequired(cleanWorkspaceRequired);
+ FreeStyleProject childProject = new FreeStyleProjectMock("child");
+ childProject.allowSave.set(false);
+ childProject.setTemplate(parentProject);
+ childProject.setCleanWorkspaceRequired(cleanWorkspaceRequired);
+ assertNull(childProject.cleanWorkspaceRequired);
+ }
+
+ @Test
+ public void testSetCleanWorkspaceRequiredNotEqualsWithParent() throws IOException {
+ Boolean childCleanWorkspaceRequired = false;
+ Boolean parentCleanWorkspaceRequired = true;
+ FreeStyleProject parentProject = new FreeStyleProjectMock("parent");
+ parentProject.allowSave.set(false);
+ parentProject.setCleanWorkspaceRequired(parentCleanWorkspaceRequired);
+ FreeStyleProject childProject = new FreeStyleProjectMock("child");
+ childProject.allowSave.set(false);
+ childProject.setTemplate(parentProject);
+ childProject.setCleanWorkspaceRequired(childCleanWorkspaceRequired);
+ //if child value is not equals to parent one, field should be populated
+ assertNotNull(childProject.cleanWorkspaceRequired);
+ }
+
+ @Test
+ public void testSetCleanWorkspaceRequiredParentNull() throws IOException {
+ Boolean cleanWorkspaceRequired = true;
+ FreeStyleProject childProject = new FreeStyleProjectMock("child");
+ childProject.allowSave.set(false);
+ childProject.setCleanWorkspaceRequired(cleanWorkspaceRequired);
+ //if parent is not set, value should be populated according to existing logic
+ assertEquals(cleanWorkspaceRequired, childProject.cleanWorkspaceRequired);
+ }
+
+ @Test
+ public void testIsCleanWorkspaceRequired() throws IOException {
+ Boolean childCleanWorkspaceRequired = false;
+ Boolean parentCleanWorkspaceRequired = true;
+ FreeStyleProject parentProject = new FreeStyleProjectMock("parent");
+ parentProject.allowSave.set(false);
+ parentProject.setCleanWorkspaceRequired(parentCleanWorkspaceRequired);
+ FreeStyleProject childProject = new FreeStyleProjectMock("child");
+ childProject.allowSave.set(false);
+ childProject.setCleanWorkspaceRequired(null);
+ childProject.setTemplate(parentProject);
+ //Value should be taken from template
+ assertEquals(parentCleanWorkspaceRequired, (Boolean) childProject.isCleanWorkspaceRequired());
+ childProject.setCleanWorkspaceRequired(childCleanWorkspaceRequired);
+ //Child value is not equals to parent - override value in child.
+ assertEquals(childCleanWorkspaceRequired, (Boolean) childProject.isCleanWorkspaceRequired());
+ }
+
+ @Test
+ public void testSetConcurrentBuildEqualsWithParent() throws IOException {
+ Boolean concurrentBuild = true;
+ FreeStyleProject parentProject = new FreeStyleProjectMock("parent");
+ parentProject.allowSave.set(false);
+ parentProject.setConcurrentBuild(concurrentBuild);
+ FreeStyleProject childProject = new FreeStyleProjectMock("child");
+ childProject.allowSave.set(false);
+ childProject.setTemplate(parentProject);
+ childProject.setConcurrentBuild(concurrentBuild);
+ assertNull(childProject.concurrentBuild);
+ }
+
+ @Test
+ public void testSetConcurrentBuildNotEqualsWithParent() throws IOException {
+ Boolean childConcurrentBuild = false;
+ Boolean parentConcurrentBuild = true;
+ FreeStyleProject parentProject = new FreeStyleProjectMock("parent");
+ parentProject.allowSave.set(false);
+ parentProject.setConcurrentBuild(parentConcurrentBuild);
+ FreeStyleProject childProject = new FreeStyleProjectMock("child");
+ childProject.allowSave.set(false);
+ childProject.setTemplate(parentProject);
+ childProject.setConcurrentBuild(childConcurrentBuild);
+ //if child value is not equals to parent one, field should be populated
+ assertEquals(childConcurrentBuild, childProject.concurrentBuild);
+ }
+
+ @Test
+ public void testSetConcurrentBuildParentNull() throws IOException {
+ Boolean concurrentBuild = true;
+ FreeStyleProject childProject = new FreeStyleProjectMock("child");
+ childProject.allowSave.set(false);
+ childProject.setConcurrentBuild(concurrentBuild);
+ //if parent is not set, value should be populated according to existing logic
+ assertEquals(concurrentBuild, childProject.concurrentBuild);
+ }
+
+ @Test
+ public void testIsConcurrentBuild() throws IOException {
+ Boolean childConcurrentBuild = false;
+ Boolean parentConcurrentBuild = true;
+ FreeStyleProject parentProject = new FreeStyleProjectMock("parent");
+ parentProject.allowSave.set(false);
+ parentProject.setConcurrentBuild(parentConcurrentBuild);
+ FreeStyleProject childProject = new FreeStyleProjectMock("child");
+ childProject.allowSave.set(false);
+ childProject.setConcurrentBuild(null);
+ childProject.setTemplate(parentProject);
+ //Value should be taken from template
+ assertEquals(parentConcurrentBuild, (Boolean) childProject.isConcurrentBuild());
+ childProject.setConcurrentBuild(childConcurrentBuild);
+ //Child value is not equals to parent - override value in child.
+ assertEquals(childConcurrentBuild, (Boolean) childProject.isConcurrentBuild());
}
private class FreeStyleProjectMock extends FreeStyleProject {