summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorakozak2011-11-21 10:37:03 (EST)
committer Winston Prakash2011-12-01 20:46:53 (EST)
commit9366778a24956c500d659603201f4f8226457ac2 (patch)
tree6d81884162d9c0d00cf6cf4f50d102baaeac595a
parentf81a85721d82e139af1e39df028b01d36ec8588a (diff)
downloadorg.eclipse.hudson.core-9366778a24956c500d659603201f4f8226457ac2.zip
org.eclipse.hudson.core-9366778a24956c500d659603201f4f8226457ac2.tar.gz
org.eclipse.hudson.core-9366778a24956c500d659603201f4f8226457ac2.tar.bz2
"template" property was renamed to "cascadingProject"
Signed-off-by: Winston Prakash <winston.prakash@gmail.com>
-rw-r--r--hudson-core/src/main/java/hudson/matrix/MatrixProject.java38
-rw-r--r--hudson-core/src/main/java/hudson/model/AbstractProject.java38
-rw-r--r--hudson-core/src/main/java/hudson/model/FreeStyleProject.java6
-rw-r--r--hudson-core/src/main/java/hudson/model/IAbstractProject.java6
-rw-r--r--hudson-core/src/main/java/hudson/model/IJob.java15
-rw-r--r--hudson-core/src/main/java/hudson/model/Job.java59
-rw-r--r--hudson-core/src/test/java/hudson/matrix/MatrixProjectTest.java38
-rw-r--r--hudson-core/src/test/java/hudson/model/FreeStyleProjectTest.java74
8 files changed, 143 insertions, 131 deletions
diff --git a/hudson-core/src/main/java/hudson/matrix/MatrixProject.java b/hudson-core/src/main/java/hudson/matrix/MatrixProject.java
index eab80fd..f186d65 100644
--- a/hudson-core/src/main/java/hudson/matrix/MatrixProject.java
+++ b/hudson-core/src/main/java/hudson/matrix/MatrixProject.java
@@ -170,14 +170,14 @@ public class MatrixProject extends AbstractProject<MatrixProject, MatrixBuild> i
* @inheritDoc
*/
public AxisList getAxes() {
- return axes!= null ? axes : (hasParentTemplate()? getTemplate().getAxes() : null);
+ return axes!= null ? axes : (hasCascadingProject()? getCascadingProject().getAxes() : null);
}
/**
* @inheritDoc
*/
public void setAxes(AxisList axes) throws IOException {
- if (!(hasParentTemplate() && ObjectUtils.equals(getTemplate().getAxes(), axes))) {
+ if (!(hasCascadingProject() && ObjectUtils.equals(getCascadingProject().getAxes(), axes))) {
this.axes = new AxisList(axes);
} else {
this.axes = null;
@@ -191,7 +191,7 @@ public class MatrixProject extends AbstractProject<MatrixProject, MatrixBuild> i
* @inheritDoc
*/
public boolean isRunSequentially() {
- return runSequentially!= null ? runSequentially : (hasParentTemplate() && getTemplate().isRunSequentially());
+ return runSequentially!= null ? runSequentially : (hasCascadingProject() && getCascadingProject().isRunSequentially());
}
/**
@@ -206,7 +206,7 @@ public class MatrixProject extends AbstractProject<MatrixProject, MatrixBuild> i
* @inheritDoc
*/
public void setRunSequentially(Boolean runSequentially) throws IOException {
- if (!(hasParentTemplate() && ObjectUtils.equals(getTemplate().isRunSequentially(), runSequentially))) {
+ if (!(hasCascadingProject() && ObjectUtils.equals(getCascadingProject().isRunSequentially(), runSequentially))) {
this.runSequentially = runSequentially;
} else {
this.runSequentially = null;
@@ -219,7 +219,7 @@ public class MatrixProject extends AbstractProject<MatrixProject, MatrixBuild> i
* @inheritDoc
*/
public void setCombinationFilter(String combinationFilter) throws IOException {
- if (!(hasParentTemplate() && ObjectUtils.equals(getTemplate().getCombinationFilter(), combinationFilter))) {
+ if (!(hasCascadingProject() && ObjectUtils.equals(getCascadingProject().getCombinationFilter(), combinationFilter))) {
this.combinationFilter = combinationFilter;
} else {
this.combinationFilter = null;
@@ -233,7 +233,7 @@ public class MatrixProject extends AbstractProject<MatrixProject, MatrixBuild> i
*/
public String getCombinationFilter() {
return combinationFilter != null ? combinationFilter
- : (hasParentTemplate() ? getTemplate().getCombinationFilter() : null);
+ : (hasCascadingProject() ? getCascadingProject().getCombinationFilter() : null);
}
/**
@@ -241,14 +241,14 @@ public class MatrixProject extends AbstractProject<MatrixProject, MatrixBuild> i
*/
public String getTouchStoneCombinationFilter() {
return touchStoneCombinationFilter != null ? touchStoneCombinationFilter
- : (hasParentTemplate() ? getTemplate().getTouchStoneCombinationFilter() : null);
+ : (hasCascadingProject() ? getCascadingProject().getTouchStoneCombinationFilter() : null);
}
/**
* @inheritDoc
*/
public void setTouchStoneCombinationFilter(String touchStoneCombinationFilter) {
- if (!(hasParentTemplate() && ObjectUtils.equals(getTemplate().getTouchStoneCombinationFilter(),
+ if (!(hasCascadingProject() && ObjectUtils.equals(getCascadingProject().getTouchStoneCombinationFilter(),
touchStoneCombinationFilter))) {
this.touchStoneCombinationFilter = touchStoneCombinationFilter;
} else {
@@ -261,14 +261,14 @@ public class MatrixProject extends AbstractProject<MatrixProject, MatrixBuild> i
*/
public Result getTouchStoneResultCondition() {
return touchStoneResultCondition != null ? touchStoneResultCondition
- : (hasParentTemplate() ? getTemplate().getTouchStoneResultCondition() : null);
+ : (hasCascadingProject() ? getCascadingProject().getTouchStoneResultCondition() : null);
}
/**
* @inheritDoc
*/
public void setTouchStoneResultCondition(Result touchStoneResultCondition) {
- if (!(hasParentTemplate() && ObjectUtils.equals(getTemplate().getTouchStoneResultCondition(),
+ if (!(hasCascadingProject() && ObjectUtils.equals(getCascadingProject().getTouchStoneResultCondition(),
touchStoneResultCondition))) {
this.touchStoneResultCondition = touchStoneResultCondition;
} else {
@@ -281,14 +281,14 @@ public class MatrixProject extends AbstractProject<MatrixProject, MatrixBuild> i
*/
public String getCustomWorkspace() {
return customWorkspace != null ? customWorkspace
- : (hasParentTemplate() ? getTemplate().getCustomWorkspace() : null);
+ : (hasCascadingProject() ? getCascadingProject().getCustomWorkspace() : null);
}
/**
* @inheritDoc
*/
public void setCustomWorkspace(String customWorkspace) throws IOException {
- if (!(hasParentTemplate() && ObjectUtils.equals(getTemplate().getTouchStoneResultCondition(),
+ if (!(hasCascadingProject() && ObjectUtils.equals(getCascadingProject().getTouchStoneResultCondition(),
customWorkspace))) {
this.customWorkspace = customWorkspace;
} else {
@@ -307,7 +307,7 @@ public class MatrixProject extends AbstractProject<MatrixProject, MatrixBuild> i
//TODO improve it
public DescribableList<Builder,Descriptor<Builder>> getBuildersList() {
return !(builders == null || builders.isEmpty()) ? builders
- : (hasParentTemplate() ? getTemplate().getBuildersList() : null);
+ : (hasCascadingProject() ? getCascadingProject().getBuildersList() : null);
}
/**
@@ -324,7 +324,7 @@ public class MatrixProject extends AbstractProject<MatrixProject, MatrixBuild> i
//TODO improve it
public DescribableList<Publisher,Descriptor<Publisher>> getPublishersList() {
return !(publishers == null || publishers.isEmpty()) ? publishers
- : (hasParentTemplate() ? getTemplate().getPublishersList() : null);
+ : (hasCascadingProject() ? getCascadingProject().getPublishersList() : null);
}
/**
@@ -333,7 +333,7 @@ public class MatrixProject extends AbstractProject<MatrixProject, MatrixBuild> i
//TODO improve it
public DescribableList<BuildWrapper, Descriptor<BuildWrapper>> getBuildWrappersList() {
return !(buildWrappers == null || buildWrappers.isEmpty()) ? buildWrappers
- : (hasParentTemplate() ? getTemplate().getBuildWrappersList() : null);
+ : (hasCascadingProject() ? getCascadingProject().getBuildWrappersList() : null);
}
/**
@@ -736,12 +736,12 @@ public class MatrixProject extends AbstractProject<MatrixProject, MatrixBuild> i
}
/**
- * For the unit tests only. Sets template for the job.
+ * For the unit tests only. Sets cascadingProject for the job.
*
- * @param template parent job
+ * @param cascadingProject parent job
*/
- void setTemplate(MatrixProject template) {
- this.template = template;
+ void setCascadingProject(MatrixProject cascadingProject) {
+ this.cascadingProject = cascadingProject;
}
/**
diff --git a/hudson-core/src/main/java/hudson/model/AbstractProject.java b/hudson-core/src/main/java/hudson/model/AbstractProject.java
index 8535556..5baedcd 100644
--- a/hudson-core/src/main/java/hudson/model/AbstractProject.java
+++ b/hudson-core/src/main/java/hudson/model/AbstractProject.java
@@ -312,7 +312,7 @@ public abstract class AbstractProject<P extends AbstractProject<P,R>,R extends A
if (null != concurrentBuild) {
return Hudson.CONCURRENT_BUILD && concurrentBuild;
}
- return hasParentTemplate() && getTemplate().isConcurrentBuild();
+ return hasCascadingProject() && getCascadingProject().isConcurrentBuild();
}
}
@@ -327,8 +327,8 @@ public abstract class AbstractProject<P extends AbstractProject<P,R>,R extends A
}
public void setConcurrentBuild(Boolean b) throws IOException {
- if (!(hasParentTemplate()
- && ObjectUtils.equals(getTemplate().isConcurrentBuild(), b))) {
+ if (!(hasCascadingProject()
+ && ObjectUtils.equals(getCascadingProject().isConcurrentBuild(), b))) {
concurrentBuild = b;
} else {
this.concurrentBuild = null;
@@ -348,7 +348,7 @@ public abstract class AbstractProject<P extends AbstractProject<P,R>,R extends A
if (null != cleanWorkspaceRequired) {
return cleanWorkspaceRequired;
}
- return hasParentTemplate() && getTemplate().isCleanWorkspaceRequired();
+ return hasCascadingProject() && getCascadingProject().isCleanWorkspaceRequired();
}
}
@@ -362,8 +362,8 @@ public abstract class AbstractProject<P extends AbstractProject<P,R>,R extends A
}
public void setCleanWorkspaceRequired(Boolean cleanWorkspaceRequired) {
- if (!(hasParentTemplate()
- && ObjectUtils.equals(getTemplate().isCleanWorkspaceRequired(), cleanWorkspaceRequired))) {
+ if (!(hasCascadingProject()
+ && ObjectUtils.equals(getCascadingProject().isCleanWorkspaceRequired(), cleanWorkspaceRequired))) {
this.cleanWorkspaceRequired = cleanWorkspaceRequired;
} else {
this.cleanWorkspaceRequired = null;
@@ -571,19 +571,19 @@ public abstract class AbstractProject<P extends AbstractProject<P,R>,R extends A
if (null != quietPeriod) {
return quietPeriod;
}
- return hasParentTemplate() ? getTemplate().getQuietPeriod() : Hudson.getInstance().getQuietPeriod();
+ return hasCascadingProject() ? getCascadingProject().getQuietPeriod() : Hudson.getInstance().getQuietPeriod();
}
public int getScmCheckoutRetryCount() {
if (null != scmCheckoutRetryCount) {
return scmCheckoutRetryCount;
}
- return hasParentTemplate() ?
- getTemplate().getScmCheckoutRetryCount() : Hudson.getInstance().getScmCheckoutRetryCount();
+ return hasCascadingProject() ?
+ getCascadingProject().getScmCheckoutRetryCount() : Hudson.getInstance().getScmCheckoutRetryCount();
}
public void setScmCheckoutRetryCount(Integer retryCount) {
- if (!(hasParentTemplate() && ObjectUtils.equals(getTemplate().getScmCheckoutRetryCount(), retryCount))) {
+ if (!(hasCascadingProject() && ObjectUtils.equals(getCascadingProject().getScmCheckoutRetryCount(), retryCount))) {
this.scmCheckoutRetryCount = retryCount;
} else {
this.scmCheckoutRetryCount = null;
@@ -616,7 +616,7 @@ public abstract class AbstractProject<P extends AbstractProject<P,R>,R extends A
* @throws IOException if any.
*/
public void setQuietPeriod(Integer seconds) throws IOException {
- if (!(hasParentTemplate() && ObjectUtils.equals(getTemplate().getQuietPeriod(), seconds))) {
+ if (!(hasCascadingProject() && ObjectUtils.equals(getCascadingProject().getQuietPeriod(), seconds))) {
this.quietPeriod = seconds;
} else {
this.quietPeriod = null;
@@ -668,7 +668,7 @@ public abstract class AbstractProject<P extends AbstractProject<P,R>,R extends A
if (null != blockBuildWhenDownstreamBuilding) {
return blockBuildWhenDownstreamBuilding;
}
- return hasParentTemplate() && getTemplate().blockBuildWhenDownstreamBuilding();
+ return hasCascadingProject() && getCascadingProject().blockBuildWhenDownstreamBuilding();
}
}
@@ -683,7 +683,7 @@ public abstract class AbstractProject<P extends AbstractProject<P,R>,R extends A
}
public void setBlockBuildWhenDownstreamBuilding(Boolean b) throws IOException {
- if (!(hasParentTemplate() && ObjectUtils.equals(getTemplate().blockBuildWhenDownstreamBuilding(), b))) {
+ if (!(hasCascadingProject() && ObjectUtils.equals(getCascadingProject().blockBuildWhenDownstreamBuilding(), b))) {
blockBuildWhenDownstreamBuilding = b;
} else {
blockBuildWhenDownstreamBuilding = null;
@@ -703,7 +703,7 @@ public abstract class AbstractProject<P extends AbstractProject<P,R>,R extends A
if (null != blockBuildWhenUpstreamBuilding) {
return blockBuildWhenUpstreamBuilding;
}
- return hasParentTemplate() && getTemplate().blockBuildWhenUpstreamBuilding();
+ return hasCascadingProject() && getCascadingProject().blockBuildWhenUpstreamBuilding();
}
}
@@ -718,7 +718,7 @@ public abstract class AbstractProject<P extends AbstractProject<P,R>,R extends A
}
public void setBlockBuildWhenUpstreamBuilding(Boolean b) throws IOException {
- if (!(hasParentTemplate() && ObjectUtils.equals(getTemplate().blockBuildWhenUpstreamBuilding(), b))) {
+ if (!(hasCascadingProject() && ObjectUtils.equals(getCascadingProject().blockBuildWhenUpstreamBuilding(), b))) {
blockBuildWhenUpstreamBuilding = b;
} else {
blockBuildWhenUpstreamBuilding = null;
@@ -1052,7 +1052,7 @@ public abstract class AbstractProject<P extends AbstractProject<P,R>,R extends A
if (StringUtils.isNotBlank(jdk)) {
return jdk;
}
- return hasParentTemplate()? getTemplate().getJDKName() : null;
+ return hasCascadingProject()? getCascadingProject().getJDKName() : null;
}
/**
@@ -1071,8 +1071,8 @@ public abstract class AbstractProject<P extends AbstractProject<P,R>,R extends A
}
public void setJDK(String jdk) {
- if (!(hasParentTemplate()
- && StringUtils.equalsIgnoreCase(getTemplate().getJDKName(), jdk))) {
+ if (!(hasCascadingProject()
+ && StringUtils.equalsIgnoreCase(getCascadingProject().getJDKName(), jdk))) {
this.jdk = jdk;
} else {
this.jdk = null;
@@ -1850,7 +1850,7 @@ public abstract class AbstractProject<P extends AbstractProject<P,R>,R extends A
super.submit(req,rsp);
makeDisabled(null != req.getParameter("disable"));
- setTemplateName(StringUtils.trimToNull(req.getParameter("templateName")));
+ setCascadingProjectName(StringUtils.trimToNull(req.getParameter("cascadingProjectName")));
setJDK(req.getParameter("jdk"));
setQuietPeriod(null != req.getParameter("hasCustomQuietPeriod") ? req.getParameter("quiet_period") : null);
setScmCheckoutRetryCount(null != req.getParameter("hasCustomScmCheckoutRetryCount")
diff --git a/hudson-core/src/main/java/hudson/model/FreeStyleProject.java b/hudson-core/src/main/java/hudson/model/FreeStyleProject.java
index 92ea80e..d577524 100644
--- a/hudson-core/src/main/java/hudson/model/FreeStyleProject.java
+++ b/hudson-core/src/main/java/hudson/model/FreeStyleProject.java
@@ -61,7 +61,7 @@ public class FreeStyleProject extends Project<FreeStyleProject,FreeStyleBuild> i
if (!useParentValue || StringUtils.isNotBlank(customWorkspace)) {
return customWorkspace;
}
- return hasParentTemplate()? getTemplate().getCustomWorkspace() : null;
+ return hasCascadingProject()? getCascadingProject().getCustomWorkspace() : null;
}
public String getCustomWorkspace() {
@@ -90,8 +90,8 @@ public class FreeStyleProject extends Project<FreeStyleProject,FreeStyleBuild> i
* @throws IOException if any.
*/
public void setCustomWorkspace(String customWorkspace) throws IOException {
- if (!(hasParentTemplate()
- && StringUtils.equalsIgnoreCase(getTemplate().getCustomWorkspace(), customWorkspace))) {
+ if (!(hasCascadingProject()
+ && StringUtils.equalsIgnoreCase(getCascadingProject().getCustomWorkspace(), customWorkspace))) {
this.customWorkspace = customWorkspace;
} else {
this.customWorkspace = null;
diff --git a/hudson-core/src/main/java/hudson/model/IAbstractProject.java b/hudson-core/src/main/java/hudson/model/IAbstractProject.java
index 147c8e2..01d4ea3 100644
--- a/hudson-core/src/main/java/hudson/model/IAbstractProject.java
+++ b/hudson-core/src/main/java/hudson/model/IAbstractProject.java
@@ -27,12 +27,6 @@ import java.util.Map;
* @author Nikita Levyankov
*/
public interface IAbstractProject extends IJob {
- /**
- * Returns template name if project based on template, null otherwise..
- *
- * @return template name.
- */
- String getTemplateName();
/**
* Returns configured SCM for project,
diff --git a/hudson-core/src/main/java/hudson/model/IJob.java b/hudson-core/src/main/java/hudson/model/IJob.java
index 1a4584d..5493a36 100644
--- a/hudson-core/src/main/java/hudson/model/IJob.java
+++ b/hudson-core/src/main/java/hudson/model/IJob.java
@@ -25,6 +25,21 @@ import java.util.Map;
* @author Nikita Levyankov
*/
public interface IJob<T> {
+
+ /**
+ * Returns cascading project name.
+ *
+ * @return cascading project name.
+ */
+ String getCascadingProjectName();
+
+ /**
+ * Returns selected cascading project.
+ *
+ * @return cascading project.
+ */
+ IJob getCascadingProject();
+
/**
* @return whether the name of this job can be changed by user.
*/
diff --git a/hudson-core/src/main/java/hudson/model/Job.java b/hudson-core/src/main/java/hudson/model/Job.java
index 4c03128..387cc85 100644
--- a/hudson-core/src/main/java/hudson/model/Job.java
+++ b/hudson-core/src/main/java/hudson/model/Job.java
@@ -145,14 +145,14 @@ public abstract class Job<JobT extends Job<JobT, RunT>, RunT extends Run<JobT, R
protected CopyOnWriteList<JobProperty<? super JobT>> properties = new CopyOnWriteList<JobProperty<? super JobT>>();
/**
- * The name of the template.
+ * The name of the cascadingProject.
*/
- private String templateName;
+ private String cascadingProjectName;
/**
- * Selected template for this job.
+ * Selected cascadingProject for this job.
*/
- protected transient JobT template;
+ protected transient JobT cascadingProject;
protected transient ThreadLocal<Boolean> allowSave = new ThreadLocal<Boolean>() {
@Override
@@ -178,7 +178,8 @@ public abstract class Job<JobT extends Job<JobT, RunT>, RunT extends Run<JobT, R
public void onLoad(ItemGroup<? extends Item> parent, String name)
throws IOException {
super.onLoad(parent, name);
- template = (JobT) Functions.getItemByName(Hudson.getInstance().getAllItems(this.getClass()), templateName);
+ cascadingProject = (JobT) Functions.getItemByName(Hudson.getInstance().getAllItems(this.getClass()),
+ cascadingProjectName);
//TODO investigate why allowSave is null
if (null == allowSave) {// Initialize property if null.
allowSave = new ThreadLocal<Boolean>() {
@@ -362,7 +363,7 @@ public abstract class Job<JobT extends Job<JobT, RunT>, RunT extends Run<JobT, R
* Returns the log rotator for this job, or null if none.
*/
public LogRotator getLogRotator() {
- return logRotator!= null ? logRotator : (hasParentTemplate()? getTemplate().getLogRotator() : null);
+ return logRotator!= null ? logRotator : (hasCascadingProject()? getCascadingProject().getLogRotator() : null);
}
/**
@@ -371,7 +372,7 @@ public abstract class Job<JobT extends Job<JobT, RunT>, RunT extends Run<JobT, R
* @param logRotator log rotator.
*/
public void setLogRotator(LogRotator logRotator) {
- if (!(hasParentTemplate() && ObjectUtils.equals(getTemplate().getLogRotator(), logRotator))) {
+ if (!(hasCascadingProject() && ObjectUtils.equals(getCascadingProject().getLogRotator(), logRotator))) {
this.logRotator = logRotator;
} else {
this.logRotator = null;
@@ -1227,53 +1228,55 @@ public abstract class Job<JobT extends Job<JobT, RunT>, RunT extends Run<JobT, R
}
/**
- * Returns template name.
+ * Returns cascading project name.
*
- * @return template name.
+ * @return cascading project name.
*/
- public String getTemplateName() {
- return templateName;
+ public String getCascadingProjectName() {
+ return cascadingProjectName;
}
/**
- * Sets template name.
+ * Sets cascadingProject name.
*
- * @param templateName template name.
+ * @param cascadingProjectName cascadingProject name.
*/
@SuppressWarnings("unchecked")
- public void setTemplateName(String templateName) {
- this.templateName = templateName;
- this.template = (JobT)Functions.getItemByName(Hudson.getInstance().getAllItems(this.getClass()), templateName);
+ public void setCascadingProjectName(String cascadingProjectName) {
+ this.cascadingProjectName = cascadingProjectName;
+ this.cascadingProject = (JobT)Functions.getItemByName(Hudson.getInstance().getAllItems(this.getClass()),
+ cascadingProjectName);
}
/**
- * Returns selected template.
+ * Returns selected ccascading project.
*
- * @return template.
+ * @return cascading project.
*/
@SuppressWarnings({"unchecked"})
- public JobT getTemplate() {
- if (StringUtils.isNotBlank(templateName) && template == null) {
- template = (JobT) Functions.getItemByName(Hudson.getInstance().getAllItems(this.getClass()), templateName);
+ public synchronized JobT getCascadingProject() {
+ if (StringUtils.isNotBlank(cascadingProjectName) && cascadingProject == null) {
+ cascadingProject = (JobT) Functions.getItemByName(Hudson.getInstance().getAllItems(this.getClass()),
+ cascadingProjectName);
}
- return template;
+ return cascadingProject;
}
/**
- * For the unit tests only. Sets template for the job.
+ * For the unit tests only. Sets cascadingProject for the job.
*
- * @param template parent job
+ * @param cascadingProject parent job
*/
- void setTemplate(JobT template) {
- this.template = template;
+ void setCascadingProject(JobT cascadingProject) {
+ this.cascadingProject = cascadingProject;
}
/**
* Checks whether current job is inherited from other project.
* @return boolean.
*/
- public boolean hasParentTemplate() {
- return null != getTemplate();
+ protected boolean hasCascadingProject() {
+ return null != getCascadingProject();
}
public Graph getBuildTimeGraph() {
diff --git a/hudson-core/src/test/java/hudson/matrix/MatrixProjectTest.java b/hudson-core/src/test/java/hudson/matrix/MatrixProjectTest.java
index 4bf0b84..06bc0ac 100644
--- a/hudson-core/src/test/java/hudson/matrix/MatrixProjectTest.java
+++ b/hudson-core/src/test/java/hudson/matrix/MatrixProjectTest.java
@@ -21,7 +21,7 @@ import org.junit.Test;
import static org.junit.Assert.*;
/**
- * Test for {@link hudson.matrix.MatrixProject}
+ * Tests for {@link hudson.matrix.MatrixProject}
*/
public class MatrixProjectTest {
@@ -32,7 +32,7 @@ public class MatrixProjectTest {
parentProject.setRunSequentially(Boolean.TRUE);
MatrixProject childProject1 = new MatrixProject("child1");
- childProject1.setTemplate(parentProject);
+ childProject1.setCascadingProject(parentProject);
childProject1.setAllowSave(false);
assertTrue(childProject1.isRunSequentially());
}
@@ -44,7 +44,7 @@ public class MatrixProjectTest {
parentProject.setRunSequentially(Boolean.FALSE);
MatrixProject childProject1 = new MatrixProject("child1");
- childProject1.setTemplate(parentProject);
+ childProject1.setCascadingProject(parentProject);
childProject1.setAllowSave(false);
assertFalse(childProject1.isRunSequentially());
}
@@ -63,7 +63,7 @@ public class MatrixProjectTest {
parentProject.setRunSequentially(Boolean.FALSE);
MatrixProject childProject1 = new MatrixProject("child1");
- childProject1.setTemplate(parentProject);
+ childProject1.setCascadingProject(parentProject);
childProject1.runSequentially = Boolean.TRUE;
childProject1.setAllowSave(false);
assertTrue(childProject1.isRunSequentially());
@@ -76,7 +76,7 @@ public class MatrixProjectTest {
parentProject.setRunSequentially(Boolean.TRUE);
MatrixProject childProject1 = new MatrixProject("child1");
- childProject1.setTemplate(parentProject);
+ childProject1.setCascadingProject(parentProject);
childProject1.runSequentially = Boolean.FALSE;
childProject1.setAllowSave(false);
assertFalse(childProject1.isRunSequentially());
@@ -89,12 +89,13 @@ public class MatrixProjectTest {
parentProject.setRunSequentially(null);
MatrixProject childProject1 = new MatrixProject("child1");
- childProject1.setTemplate(parentProject);
+ childProject1.setCascadingProject(parentProject);
childProject1.runSequentially = Boolean.TRUE;
childProject1.setAllowSave(false);
assertTrue(childProject1.isRunSequentially());
}
+
@Test
public void testGetCombinationFilterChildValue() throws IOException {
String parentCombinationFilter = "parent_filter";
@@ -110,7 +111,7 @@ public class MatrixProjectTest {
};
childProject1.setAllowSave(false);
childProject1.setCombinationFilter(childCombinationFilter);
- childProject1.setTemplate(parentProject);
+ childProject1.setCascadingProject(parentProject);
assertEquals(childProject1.getCombinationFilter(), childCombinationFilter);
}
@@ -127,7 +128,7 @@ public class MatrixProjectTest {
}
};
childProject1.setAllowSave(false);
- childProject1.setTemplate(parentProject);
+ childProject1.setCascadingProject(parentProject);
assertEquals(childProject1.getCombinationFilter(), parentCombinationFilter);
}
@@ -145,7 +146,7 @@ public class MatrixProjectTest {
}
};
childProject1.setAllowSave(false);
- childProject1.setTemplate(parentProject);
+ childProject1.setCascadingProject(parentProject);
childProject1.setCombinationFilter(childCombinationFilter);
assertEquals(childProject1.combinationFilter, childCombinationFilter);
}
@@ -163,7 +164,7 @@ public class MatrixProjectTest {
}
};
childProject1.setAllowSave(false);
- childProject1.setTemplate(parentProject);
+ childProject1.setCascadingProject(parentProject);
childProject1.setCombinationFilter(combinationFilter);
assertNull(childProject1.combinationFilter);
assertEquals(childProject1.getCombinationFilter(), combinationFilter);
@@ -199,7 +200,7 @@ public class MatrixProjectTest {
};
childProject1.setAllowSave(false);
childProject1.setTouchStoneCombinationFilter(childCombinationFilter);
- childProject1.setTemplate(parentProject);
+ childProject1.setCascadingProject(parentProject);
assertEquals(childProject1.getTouchStoneCombinationFilter(), childCombinationFilter);
}
@@ -216,7 +217,7 @@ public class MatrixProjectTest {
}
};
childProject1.setAllowSave(false);
- childProject1.setTemplate(parentProject);
+ childProject1.setCascadingProject(parentProject);
assertEquals(childProject1.getTouchStoneCombinationFilter(), parentCombinationFilter);
}
@@ -234,7 +235,7 @@ public class MatrixProjectTest {
}
};
childProject1.setAllowSave(false);
- childProject1.setTemplate(parentProject);
+ childProject1.setCascadingProject(parentProject);
childProject1.setTouchStoneCombinationFilter(childCombinationFilter);
assertEquals(childProject1.touchStoneCombinationFilter, childCombinationFilter);
}
@@ -252,7 +253,7 @@ public class MatrixProjectTest {
}
};
childProject1.setAllowSave(false);
- childProject1.setTemplate(parentProject);
+ childProject1.setCascadingProject(parentProject);
childProject1.setTouchStoneCombinationFilter(combinationFilter);
assertNull(childProject1.touchStoneCombinationFilter);
assertEquals(childProject1.getTouchStoneCombinationFilter(), combinationFilter);
@@ -288,7 +289,7 @@ public class MatrixProjectTest {
};
childProject1.setAllowSave(false);
childProject1.setTouchStoneResultCondition(childResultCondition);
- childProject1.setTemplate(parentProject);
+ childProject1.setCascadingProject(parentProject);
assertEquals(childProject1.getTouchStoneResultCondition(), childResultCondition);
}
@@ -305,7 +306,7 @@ public class MatrixProjectTest {
}
};
childProject1.setAllowSave(false);
- childProject1.setTemplate(parentProject);
+ childProject1.setCascadingProject(parentProject);
assertEquals(childProject1.getTouchStoneResultCondition(), parentResultCondition);
}
@@ -323,7 +324,7 @@ public class MatrixProjectTest {
}
};
childProject1.setAllowSave(false);
- childProject1.setTemplate(parentProject);
+ childProject1.setCascadingProject(parentProject);
childProject1.setTouchStoneResultCondition(childResultCondition);
assertEquals(childProject1.touchStoneResultCondition, childResultCondition);
}
@@ -341,7 +342,7 @@ public class MatrixProjectTest {
}
};
childProject1.setAllowSave(false);
- childProject1.setTemplate(parentProject);
+ childProject1.setCascadingProject(parentProject);
childProject1.setTouchStoneResultCondition(parentResultCondition);
assertNull(childProject1.touchStoneResultCondition);
assertEquals(childProject1.getTouchStoneResultCondition(), parentResultCondition);
@@ -378,4 +379,3 @@ public class MatrixProjectTest {
}
}
}
-
diff --git a/hudson-core/src/test/java/hudson/model/FreeStyleProjectTest.java b/hudson-core/src/test/java/hudson/model/FreeStyleProjectTest.java
index dba4ce9..dcfebc9 100644
--- a/hudson-core/src/test/java/hudson/model/FreeStyleProjectTest.java
+++ b/hudson-core/src/test/java/hudson/model/FreeStyleProjectTest.java
@@ -40,7 +40,7 @@ import static org.powermock.api.easymock.PowerMock.replayAll;
import static org.powermock.api.easymock.PowerMock.verifyAll;
/**
- * Test for {@link FreeStyleProject}
+ * Tests for {@link FreeStyleProject}
* <p/>
* Date: 5/20/11
*
@@ -198,7 +198,7 @@ public class FreeStyleProjectTest {
parentProject.setLogRotator(new LogRotator(10,11,12,13));
FreeStyleProject childProject1 = new FreeStyleProjectMock("child1");
- childProject1.setTemplate(parentProject);
+ childProject1.setCascadingProject(parentProject);
LogRotator result = childProject1.getLogRotator();
assertNotNull(result);
assertEquals(result.getDaysToKeep(), 10);
@@ -211,7 +211,7 @@ public class FreeStyleProjectTest {
FreeStyleProject childProject1 = new FreeStyleProjectMock("child1");
childProject1.setLogRotator(new LogRotator(20, 20, 20, 20));
- childProject1.setTemplate(parentProject);
+ childProject1.setCascadingProject(parentProject);
LogRotator result = childProject1.getLogRotator();
assertNotNull(result);
assertEquals(result.getDaysToKeep(), 20);
@@ -223,9 +223,9 @@ public class FreeStyleProjectTest {
parentProject.setLogRotator(new LogRotator(10,11,12,13));
FreeStyleProject childProject1 = new FreeStyleProjectMock("child1");
- childProject1.setTemplate(parentProject);
- childProject1.setLogRotator(new LogRotator(10,11,12,13));
- childProject1.setTemplate(null); // else log rotator will be taken from parent
+ childProject1.setCascadingProject(parentProject);
+ childProject1.setLogRotator(new LogRotator(10, 11, 12, 13));
+ childProject1.setCascadingProject(null); // else log rotator will be taken from parent
assertNull(childProject1.getLogRotator());
}
@@ -245,9 +245,9 @@ public class FreeStyleProjectTest {
parentProject.setCustomWorkspace(customWorkspace);
FreeStyleProject childProject = new FreeStyleProjectMock("child");
childProject.allowSave.set(false);
- childProject.setTemplate(parentProject);
+ childProject.setCascadingProject(parentProject);
childProject.setCustomWorkspace(customWorkspace);
- childProject.setTemplate(null);
+ childProject.setCascadingProject(null);
assertNull(childProject.getCustomWorkspace());
}
@@ -260,7 +260,7 @@ public class FreeStyleProjectTest {
parentProject.setCustomWorkspace(parentCustomWorkspace);
FreeStyleProject childProject = new FreeStyleProjectMock("child");
childProject.allowSave.set(false);
- childProject.setTemplate(parentProject);
+ childProject.setCascadingProject(parentProject);
childProject.setCustomWorkspace(childCustomWorkspace);
assertEquals(childCustomWorkspace, childProject.getCustomWorkspace());
}
@@ -286,7 +286,7 @@ public class FreeStyleProjectTest {
parentProject.allowSave.set(false);
parentProject.setCustomWorkspace(customWorkspace);
childProject.setCustomWorkspace(" ");
- childProject.setTemplate(parentProject);
+ childProject.setCascadingProject(parentProject);
assertEquals(customWorkspace, childProject.getCustomWorkspace());
parentProject.setCustomWorkspace(" ");
assertNull(childProject.getCustomWorkspace());
@@ -300,9 +300,9 @@ public class FreeStyleProjectTest {
parentProject.setJDK(jdkName);
FreeStyleProject childProject = new FreeStyleProjectMock("child");
childProject.allowSave.set(false);
- childProject.setTemplate(parentProject);
+ childProject.setCascadingProject(parentProject);
childProject.setJDK(jdkName);
- childProject.setTemplate(null);
+ childProject.setCascadingProject(null);
assertNull(childProject.getJDKName());
}
@@ -315,7 +315,7 @@ public class FreeStyleProjectTest {
parentProject.setJDK(parentJdkName);
FreeStyleProject childProject = new FreeStyleProjectMock("child");
childProject.allowSave.set(false);
- childProject.setTemplate(parentProject);
+ childProject.setCascadingProject(parentProject);
childProject.setJDK(childJdkName);
assertEquals(childJdkName, childProject.getJDKName());
}
@@ -341,7 +341,7 @@ public class FreeStyleProjectTest {
parentProject.allowSave.set(false);
parentProject.setJDK(JdkName);
childProject.setJDK(" ");
- childProject.setTemplate(parentProject);
+ childProject.setCascadingProject(parentProject);
assertEquals(JdkName, childProject.getJDKName());
parentProject.setJDK(" ");
assertNull(childProject.getJDKName());
@@ -356,9 +356,9 @@ public class FreeStyleProjectTest {
parentProject.setQuietPeriod(quietPeriod);
FreeStyleProject childProject = new FreeStyleProjectMock("child");
childProject.allowSave.set(false);
- childProject.setTemplate(parentProject);
+ childProject.setCascadingProject(parentProject);
childProject.setQuietPeriod(quietPeriod);
- childProject.setTemplate(null);
+ childProject.setCascadingProject(null);
Hudson hudson = createMock(Hudson.class);
expect(hudson.getQuietPeriod()).andReturn(globalQuietPeriod);
@@ -378,7 +378,7 @@ public class FreeStyleProjectTest {
parentProject.setQuietPeriod(parentQuietPeriod);
FreeStyleProject childProject = new FreeStyleProjectMock("child");
childProject.allowSave.set(false);
- childProject.setTemplate(parentProject);
+ childProject.setCascadingProject(parentProject);
childProject.setQuietPeriod(childQuietPeriod);
Hudson hudson = createMock(Hudson.class);
@@ -434,7 +434,7 @@ public class FreeStyleProjectTest {
parentProject.allowSave.set(false);
parentProject.setQuietPeriod(quietPeriodString);
childProject.setQuietPeriod(" ");
- childProject.setTemplate(parentProject);
+ childProject.setCascadingProject(parentProject);
assertEquals(childProject.getQuietPeriod(), quietPeriod);
parentProject.setQuietPeriod(" ");
@@ -457,7 +457,7 @@ public class FreeStyleProjectTest {
expect(Hudson.getInstance()).andReturn(hudson).anyTimes();
replayAll();
assertEquals(childProject.getScmCheckoutRetryCount(), globalScmCheckoutRetryCount);
- childProject.setTemplate(parentProject);
+ childProject.setCascadingProject(parentProject);
childProject.setScmCheckoutRetryCount(scmCheckoutRetryCount);
assertEquals(childProject.getScmCheckoutRetryCount(), Integer.parseInt(scmCheckoutRetryCount));
verifyAll();
@@ -472,7 +472,7 @@ public class FreeStyleProjectTest {
parentProject.setScmCheckoutRetryCount(parentScmCheckoutRetryCount);
FreeStyleProject childProject = new FreeStyleProjectMock("child");
childProject.allowSave.set(false);
- childProject.setTemplate(parentProject);
+ childProject.setCascadingProject(parentProject);
childProject.setScmCheckoutRetryCount(childScmCheckoutRetryCount);
Hudson hudson = createMock(Hudson.class);
@@ -528,7 +528,7 @@ public class FreeStyleProjectTest {
parentProject.allowSave.set(false);
parentProject.setScmCheckoutRetryCount(scmCheckoutRetryCountString);
childProject.setScmCheckoutRetryCount(" ");
- childProject.setTemplate(parentProject);
+ childProject.setCascadingProject(parentProject);
assertEquals(childProject.getScmCheckoutRetryCount(), scmCheckoutRetryCount);
parentProject.setScmCheckoutRetryCount(" ");
@@ -544,7 +544,7 @@ public class FreeStyleProjectTest {
parentProject.setBlockBuildWhenDownstreamBuilding(blockBuildWhenDownstreamBuilding);
FreeStyleProject childProject = new FreeStyleProjectMock("child");
childProject.allowSave.set(false);
- childProject.setTemplate(parentProject);
+ childProject.setCascadingProject(parentProject);
childProject.setBlockBuildWhenDownstreamBuilding(blockBuildWhenDownstreamBuilding);
assertNull(childProject.blockBuildWhenDownstreamBuilding);
}
@@ -558,7 +558,7 @@ public class FreeStyleProjectTest {
parentProject.setBlockBuildWhenDownstreamBuilding(parentBlockBuildWhenDownstreamBuilding);
FreeStyleProject childProject = new FreeStyleProjectMock("child");
childProject.allowSave.set(false);
- childProject.setTemplate(parentProject);
+ childProject.setCascadingProject(parentProject);
childProject.setBlockBuildWhenDownstreamBuilding(childBlockBuildWhenDownstreamBuilding);
//if child value is not equals to parent one, field should be populated
assertNotNull(childProject.blockBuildWhenDownstreamBuilding);
@@ -584,8 +584,8 @@ public class FreeStyleProjectTest {
FreeStyleProject childProject = new FreeStyleProjectMock("child");
childProject.allowSave.set(false);
childProject.setBlockBuildWhenDownstreamBuilding(null);
- childProject.setTemplate(parentProject);
- //Value should be taken from template
+ childProject.setCascadingProject(parentProject);
+ //Value should be taken from cascadingProject
assertEquals(parentBlockBuildWhenDownstreamBuilding, (Boolean) childProject.blockBuildWhenDownstreamBuilding());
childProject.setBlockBuildWhenDownstreamBuilding(childBlockBuildWhenDownstreamBuilding);
//Child value is not equals to parent - override value in child.
@@ -600,7 +600,7 @@ public class FreeStyleProjectTest {
parentProject.setBlockBuildWhenUpstreamBuilding(blockBuildWhenUpstreamBuilding);
FreeStyleProject childProject = new FreeStyleProjectMock("child");
childProject.allowSave.set(false);
- childProject.setTemplate(parentProject);
+ childProject.setCascadingProject(parentProject);
childProject.setBlockBuildWhenUpstreamBuilding(blockBuildWhenUpstreamBuilding);
assertNull(childProject.blockBuildWhenUpstreamBuilding(false));
}
@@ -614,7 +614,7 @@ public class FreeStyleProjectTest {
parentProject.setBlockBuildWhenUpstreamBuilding(parentBlockBuildWhenUpstreamBuilding);
FreeStyleProject childProject = new FreeStyleProjectMock("child");
childProject.allowSave.set(false);
- childProject.setTemplate(parentProject);
+ childProject.setCascadingProject(parentProject);
childProject.setBlockBuildWhenUpstreamBuilding(childBlockBuildWhenUpstreamBuilding);
//if child value is not equals to parent one, field should be populated
assertNotNull(childProject.blockBuildWhenUpstreamBuilding(false));
@@ -640,8 +640,8 @@ public class FreeStyleProjectTest {
FreeStyleProject childProject = new FreeStyleProjectMock("child");
childProject.allowSave.set(false);
childProject.setBlockBuildWhenUpstreamBuilding(null);
- childProject.setTemplate(parentProject);
- //Value should be taken from template
+ childProject.setCascadingProject(parentProject);
+ //Value should be taken from cascadingProject
assertEquals(parentBlockBuildWhenUpstreamBuilding, (Boolean) childProject.blockBuildWhenUpstreamBuilding());
childProject.setBlockBuildWhenUpstreamBuilding(childBlockBuildWhenUpstreamBuilding);
//Child value is not equals to parent - override value in child.
@@ -657,7 +657,7 @@ public class FreeStyleProjectTest {
parentProject.setCleanWorkspaceRequired(cleanWorkspaceRequired);
FreeStyleProject childProject = new FreeStyleProjectMock("child");
childProject.allowSave.set(false);
- childProject.setTemplate(parentProject);
+ childProject.setCascadingProject(parentProject);
childProject.setCleanWorkspaceRequired(cleanWorkspaceRequired);
assertNull(childProject.isCleanWorkspaceRequired(false));
}
@@ -671,7 +671,7 @@ public class FreeStyleProjectTest {
parentProject.setCleanWorkspaceRequired(parentCleanWorkspaceRequired);
FreeStyleProject childProject = new FreeStyleProjectMock("child");
childProject.allowSave.set(false);
- childProject.setTemplate(parentProject);
+ childProject.setCascadingProject(parentProject);
childProject.setCleanWorkspaceRequired(childCleanWorkspaceRequired);
//if child value is not equals to parent one, field should be populated
assertNotNull(childProject.isCleanWorkspaceRequired(false));
@@ -697,8 +697,8 @@ public class FreeStyleProjectTest {
FreeStyleProject childProject = new FreeStyleProjectMock("child");
childProject.allowSave.set(false);
childProject.setCleanWorkspaceRequired(null);
- childProject.setTemplate(parentProject);
- //Value should be taken from template
+ childProject.setCascadingProject(parentProject);
+ //Value should be taken from cascadingProject
assertEquals(parentCleanWorkspaceRequired, (Boolean) childProject.isCleanWorkspaceRequired());
childProject.setCleanWorkspaceRequired(childCleanWorkspaceRequired);
//Child value is not equals to parent - override value in child.
@@ -713,7 +713,7 @@ public class FreeStyleProjectTest {
parentProject.setConcurrentBuild(concurrentBuild);
FreeStyleProject childProject = new FreeStyleProjectMock("child");
childProject.allowSave.set(false);
- childProject.setTemplate(parentProject);
+ childProject.setCascadingProject(parentProject);
childProject.setConcurrentBuild(concurrentBuild);
assertNull(childProject.isConcurrentBuild(false));
}
@@ -727,7 +727,7 @@ public class FreeStyleProjectTest {
parentProject.setConcurrentBuild(parentConcurrentBuild);
FreeStyleProject childProject = new FreeStyleProjectMock("child");
childProject.allowSave.set(false);
- childProject.setTemplate(parentProject);
+ childProject.setCascadingProject(parentProject);
childProject.setConcurrentBuild(childConcurrentBuild);
//if child value is not equals to parent one, field should be populated
assertEquals(childConcurrentBuild, (Boolean) childProject.isConcurrentBuild(false));
@@ -753,8 +753,8 @@ public class FreeStyleProjectTest {
FreeStyleProject childProject = new FreeStyleProjectMock("child");
childProject.allowSave.set(false);
childProject.setConcurrentBuild(null);
- childProject.setTemplate(parentProject);
- //Value should be taken from template
+ childProject.setCascadingProject(parentProject);
+ //Value should be taken from cascadingProject
assertEquals(parentConcurrentBuild, (Boolean) childProject.isConcurrentBuild());
childProject.setConcurrentBuild(childConcurrentBuild);
//Child value is not equals to parent - override value in child.