summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorakozak2011-11-22 11:49:54 (EST)
committer Winston Prakash2011-12-01 20:47:03 (EST)
commit9c2a8b101d983498d4218d377cc1ff7a2c9d3fb6 (patch)
treeadf975ef54ed8b71063a8afe38fee1f684219a8f
parentb7b3dcbd8f3fcaf86db1c520fca883a9fb9bc66e (diff)
downloadorg.eclipse.hudson.core-9c2a8b101d983498d4218d377cc1ff7a2c9d3fb6.zip
org.eclipse.hudson.core-9c2a8b101d983498d4218d377cc1ff7a2c9d3fb6.tar.gz
org.eclipse.hudson.core-9c2a8b101d983498d4218d377cc1ff7a2c9d3fb6.tar.bz2
Refresh Configuration page after changing cascading parent. Update project properties overridden flag based on chosen cascading parent. Use ProjectProperty.isOverridden instead of ProjectProperty.isPropertyOverridden
Signed-off-by: Winston Prakash <winston.prakash@gmail.com>
-rw-r--r--hudson-core/src/main/java/hudson/model/AbstractProject.java9
-rw-r--r--hudson-core/src/main/java/hudson/model/Job.java26
-rw-r--r--hudson-core/src/main/java/org/eclipse/hudson/api/model/IProjectProperty.java9
-rw-r--r--hudson-core/src/main/java/org/eclipse/hudson/api/model/project/property/BaseProjectProperty.java25
-rw-r--r--hudson-core/src/main/resources/hudson/matrix/MatrixProject/configure-entries.jelly10
-rw-r--r--hudson-core/src/main/resources/hudson/model/AbstractItem/configure-common.jelly6
-rw-r--r--hudson-core/src/main/resources/hudson/model/Job/configure.jelly1
-rw-r--r--hudson-core/src/main/resources/lib/hudson/project/config-blockWhenDownstreamBuilding.jelly2
-rw-r--r--hudson-core/src/main/resources/lib/hudson/project/config-blockWhenUpstreamBuilding.jelly2
-rw-r--r--hudson-core/src/main/resources/lib/hudson/project/config-cleanWorkspace.jelly2
-rw-r--r--hudson-core/src/main/resources/lib/hudson/project/config-customWorkspace.jelly2
-rw-r--r--hudson-core/src/main/resources/lib/hudson/project/config-quietPeriod.jelly4
-rw-r--r--hudson-core/src/main/resources/lib/hudson/project/config-retryCount.jelly4
-rw-r--r--hudson-core/src/main/resources/lib/layout/layout.jelly2
-rw-r--r--hudson-core/src/test/java/org/eclipse/hudson/api/model/project/property/ProjectPropertyTest.java44
-rw-r--r--hudson-parent/pom.xml4
-rw-r--r--hudson-war/src/main/webapp/scripts/cascading.js13
17 files changed, 106 insertions, 59 deletions
diff --git a/hudson-core/src/main/java/hudson/model/AbstractProject.java b/hudson-core/src/main/java/hudson/model/AbstractProject.java
index 38135a4..7d53e58 100644
--- a/hudson-core/src/main/java/hudson/model/AbstractProject.java
+++ b/hudson-core/src/main/java/hudson/model/AbstractProject.java
@@ -38,6 +38,7 @@ import hudson.model.Queue.WaitingItem;
import hudson.model.RunMap.Constructor;
import hudson.model.labels.LabelAtom;
import hudson.model.labels.LabelExpression;
+import org.eclipse.hudson.api.model.IProjectProperty;
import org.eclipse.hudson.api.model.project.property.IntegerProjectProperty;
import hudson.model.queue.CauseOfBlockage;
import hudson.model.queue.SubTask;
@@ -1889,6 +1890,14 @@ public abstract class AbstractProject<P extends AbstractProject<P,R>,R extends A
}
}
+ public void doResetProjectProperty(@QueryParameter final String propertyName) {
+ checkPermission(CONFIGURE);
+ final IProjectProperty property = getProperty(propertyName);
+ if (null != property) {
+ property.resetValue();
+ }
+ }
+
public boolean cleanWorkspace() throws IOException, InterruptedException{
checkPermission(BUILD);
R b = getSomeBuildWithWorkspace();
diff --git a/hudson-core/src/main/java/hudson/model/Job.java b/hudson-core/src/main/java/hudson/model/Job.java
index 7cb5ef3..46a6c1f 100644
--- a/hudson-core/src/main/java/hudson/model/Job.java
+++ b/hudson-core/src/main/java/hudson/model/Job.java
@@ -92,6 +92,7 @@ import org.eclipse.hudson.api.model.IProjectProperty;
import org.jvnet.localizer.Localizable;
import org.kohsuke.args4j.Argument;
import org.kohsuke.args4j.CmdLineException;
+import org.kohsuke.stapler.QueryParameter;
import org.kohsuke.stapler.StaplerOverridable;
import org.kohsuke.stapler.StaplerRequest;
import org.kohsuke.stapler.StaplerResponse;
@@ -1353,6 +1354,10 @@ public abstract class Job<JobT extends Job<JobT, RunT>, RunT extends Run<JobT, R
return cascadingProjectName;
}
+ public synchronized void doUpdateCascadingProject(@QueryParameter(fixEmpty = true) String projectName) {
+ setCascadingProjectName(projectName);
+ }
+
/**
* Sets cascadingProject name.
*
@@ -1360,12 +1365,15 @@ public abstract class Job<JobT extends Job<JobT, RunT>, RunT extends Run<JobT, R
*/
@SuppressWarnings("unchecked")
public synchronized void setCascadingProjectName(String cascadingProjectName) {
- this.cascadingProjectName = cascadingProjectName;
if (StringUtils.isBlank(cascadingProjectName)) {
- this.cascadingProject = null;
- } else {
+ clearCascadingProject();
+ } else if (!StringUtils.equalsIgnoreCase(this.cascadingProjectName, cascadingProjectName)) {
+ this.cascadingProjectName = cascadingProjectName;
this.cascadingProject = (JobT) Functions.getItemByName(Hudson.getInstance().getAllItems(this.getClass()),
cascadingProjectName);
+ for (IProjectProperty property : jobProperties.values()) {
+ property.setOverridden(property.getValue() != property.getCascadingValue());
+ }
}
}
@@ -1392,6 +1400,18 @@ public abstract class Job<JobT extends Job<JobT, RunT>, RunT extends Run<JobT, R
return null != getCascadingProject();
}
+ /**
+ * Remove cascading project data and mark all project properties as non-overridden
+ */
+ private void clearCascadingProject() {
+ this.cascadingProject = null;
+ this.cascadingProjectName = null;
+ for (IProjectProperty property : jobProperties.values()) {
+ property.setOverridden(false);
+ }
+ }
+
+
public Graph getBuildTimeGraph() {
Graph graph = new Graph(getLastBuild().getTimestamp(), 500, 400);
diff --git a/hudson-core/src/main/java/org/eclipse/hudson/api/model/IProjectProperty.java b/hudson-core/src/main/java/org/eclipse/hudson/api/model/IProjectProperty.java
index 48fae06..b9e06a4 100644
--- a/hudson-core/src/main/java/org/eclipse/hudson/api/model/IProjectProperty.java
+++ b/hudson-core/src/main/java/org/eclipse/hudson/api/model/IProjectProperty.java
@@ -64,7 +64,7 @@ public interface IProjectProperty<T> extends Serializable {
/**
* @return true if value inherited from cascading project, false - otherwise,
*/
- boolean isPropertyOverridden();
+ boolean isOverridden();
/**
* Returns property value. If originalValue is not null or value was overridden for this
@@ -85,4 +85,11 @@ public interface IProjectProperty<T> extends Serializable {
* Resets value for given job. Default implementation sets Null value and resets propertyOverridden flag to false.
*/
void resetValue();
+
+ /**
+ * Sets the overridden flag.
+ *
+ * @param overridden true - mark property as overridden, false - otherwise.
+ */
+ void setOverridden(boolean overridden);
}
diff --git a/hudson-core/src/main/java/org/eclipse/hudson/api/model/project/property/BaseProjectProperty.java b/hudson-core/src/main/java/org/eclipse/hudson/api/model/project/property/BaseProjectProperty.java
index 4cd693c..1ee8a9f 100644
--- a/hudson-core/src/main/java/org/eclipse/hudson/api/model/project/property/BaseProjectProperty.java
+++ b/hudson-core/src/main/java/org/eclipse/hudson/api/model/project/property/BaseProjectProperty.java
@@ -69,11 +69,9 @@ public class BaseProjectProperty<T> implements IProjectProperty<T> {
}
/**
- * Sets the overridden flag.
- *
- * @param overridden true - mark property as overridden, false - otherwise.
+ * {@inheritDoc}
*/
- final void setPropertyOverridden(boolean overridden) {
+ public final void setOverridden(boolean overridden) {
propertyOverridden = overridden;
}
@@ -92,7 +90,7 @@ public class BaseProjectProperty<T> implements IProjectProperty<T> {
/**
* {@inheritDoc}
*/
- public boolean isPropertyOverridden() {
+ public boolean isOverridden() {
return propertyOverridden;
}
@@ -107,7 +105,7 @@ public class BaseProjectProperty<T> implements IProjectProperty<T> {
* {@inheritDoc}
*/
public T getValue() {
- if (isPropertyOverridden() || null != originalValue) {
+ if (isOverridden() || null != originalValue) {
return getOriginalValue();
}
return getCascadingValue();
@@ -124,12 +122,15 @@ public class BaseProjectProperty<T> implements IProjectProperty<T> {
value = prepareValue(value);
if (!getJob().hasCascadingProject()) {
originalValue = value;
- } else if (allowOverrideValue(
- (T) getJob().getCascadingProject().getProperty(propertyKey, this.getClass()).getValue(), value)) {
- originalValue = value;
- setPropertyOverridden(true);
} else {
- resetValue();
+ T cascadingValue = (T) getJob().getCascadingProject().getProperty(propertyKey, this.getClass()).getValue();
+ T candidateValue = null == value ? getDefaultValue() : value;
+ if (allowOverrideValue(cascadingValue, candidateValue)) {
+ originalValue = value;
+ setOverridden(true);
+ } else {
+ resetValue();
+ }
}
}
@@ -138,7 +139,7 @@ public class BaseProjectProperty<T> implements IProjectProperty<T> {
*/
public void resetValue() {
this.originalValue = null;
- setPropertyOverridden(false);
+ setOverridden(false);
}
/**
diff --git a/hudson-core/src/main/resources/hudson/matrix/MatrixProject/configure-entries.jelly b/hudson-core/src/main/resources/hudson/matrix/MatrixProject/configure-entries.jelly
index 9bcdf61..7cd17a7 100644
--- a/hudson-core/src/main/resources/hudson/matrix/MatrixProject/configure-entries.jelly
+++ b/hudson-core/src/main/resources/hudson/matrix/MatrixProject/configure-entries.jelly
@@ -9,7 +9,7 @@
#
# Contributors:
#
-# Kohsuke Kawaguchi, Stephen Connolly
+# Kohsuke Kawaguchi, Stephen Connolly, Nikita Levyankov, Anton Kozak
#
#
#************************************************************************** -->
@@ -57,13 +57,13 @@
checked="${runSequentially}"
field="runSequentially"
title="${%Run each configuration sequentially}"
- isPropertyOverridden="${runSequentiallyProperty.isPropertyOverridden()}"/>
+ isPropertyOverridden="${runSequentiallyProperty.isOverridden()}"/>
<j:set var="combinationFilterProperty" value="${it.getStringProperty(it.COMBINATION_FILTER_PROPERTY_NAME)}"/>
<j:set var="combinationFilter" value="${combinationFilterProperty.getValue()}"/>
<f:optionalBlock name="hasCombinationFilter" title="${%Combination Filter}"
checked="${!empty(combinationFilter)}"
- isPropertyOverridden="${combinationFilterProperty.isPropertyOverridden()}"
+ isPropertyOverridden="${combinationFilterProperty.isOverridden()}"
help="/help/matrix/combinationfilter.html">
<f:entry title="${%Filter}">
<f:textbox name="combinationFilter" value="${combinationFilter}" />
@@ -74,7 +74,7 @@
<j:set var="touchStoneCombinationFilter" value="${touchStoneCombinationFilterProperty.getValue()}"/>
<f:optionalBlock name="hasTouchStoneCombinationFilter" title="${%Execute touchstone builds first}"
checked="${!empty(touchStoneCombinationFilter)}"
- isPropertyOverridden="${touchStoneCombinationFilterProperty.isPropertyOverridden()}"
+ isPropertyOverridden="${touchStoneCombinationFilterProperty.isOverridden()}"
help="/help/matrix/touchstone.html">
<f:entry title="${%Filter}">
<f:textbox name="touchStoneCombinationFilter" value="${touchStoneCombinationFilter}" />
@@ -91,4 +91,4 @@
<p:config-buildWrappers />
<p:config-builders />
<p:config-publishers />
-</j:jelly>
+</j:jelly> \ No newline at end of file
diff --git a/hudson-core/src/main/resources/hudson/model/AbstractItem/configure-common.jelly b/hudson-core/src/main/resources/hudson/model/AbstractItem/configure-common.jelly
index 3215af7..b35898a 100644
--- a/hudson-core/src/main/resources/hudson/model/AbstractItem/configure-common.jelly
+++ b/hudson-core/src/main/resources/hudson/model/AbstractItem/configure-common.jelly
@@ -9,7 +9,7 @@
#
# Contributors:
#
-# Kohsuke Kawaguchi,
+# Kohsuke Kawaguchi, Nikita Levyankov, Anton Kozak
#
#
#************************************************************************** -->
@@ -24,13 +24,13 @@
<j:if test="${app.CONCURRENT_BUILD}">
<f:optionalBlock field="concurrentBuild" title="${%title.concurrentbuilds}"/>
</j:if>
-
+ <j:set var="jobUrl" value="${h.getNearestAncestorUrl(request,it)}"/>
<j:set var="jdks" value="${app.JDKs}"/>
<j:if test="${jdks.size() gt 1}">
<!-- if there's only one JDK configured, always use that. -->
<f:entry title="JDK"
description="${%JDK to be used for this project}"
- isPropertyOverridden="${it.getStringProperty(it.JDK_PROPERTY_NAME).isPropertyOverridden()}">
+ isPropertyOverridden="${it.getStringProperty(it.JDK_PROPERTY_NAME).isOverridden()}">
<select class="setting-input validated" name="jdk"
checkUrl="'${rootURL}/defaultJDKCheck?value='+this.value">
<option>${%default.value}</option>
diff --git a/hudson-core/src/main/resources/hudson/model/Job/configure.jelly b/hudson-core/src/main/resources/hudson/model/Job/configure.jelly
index 8774a47..0599cd1 100644
--- a/hudson-core/src/main/resources/hudson/model/Job/configure.jelly
+++ b/hudson-core/src/main/resources/hudson/model/Job/configure.jelly
@@ -43,7 +43,6 @@
</j:if>
</j:forEach>
</select>
- <!--<f:textbox name="cascadingProjectName" value="${it.cascadingProjectName}"/>-->
</f:entry>
</j:if>
<f:entry title="${%Description}" help="/help/project-config/description.html">
diff --git a/hudson-core/src/main/resources/lib/hudson/project/config-blockWhenDownstreamBuilding.jelly b/hudson-core/src/main/resources/lib/hudson/project/config-blockWhenDownstreamBuilding.jelly
index f1d15f3..702b202 100644
--- a/hudson-core/src/main/resources/lib/hudson/project/config-blockWhenDownstreamBuilding.jelly
+++ b/hudson-core/src/main/resources/lib/hudson/project/config-blockWhenDownstreamBuilding.jelly
@@ -24,5 +24,5 @@
title="${%Block build when downstream project is building}"
help="/help/project-config/block-downstream-building.html"
checked="${blockBuildWhenDownstreamBuilding}"
- isPropertyOverridden="${blockBuildWhenDownstreamBuildingProperty.isPropertyOverridden()}"/>
+ isPropertyOverridden="${blockBuildWhenDownstreamBuildingProperty.isOverridden()}"/>
</j:jelly> \ No newline at end of file
diff --git a/hudson-core/src/main/resources/lib/hudson/project/config-blockWhenUpstreamBuilding.jelly b/hudson-core/src/main/resources/lib/hudson/project/config-blockWhenUpstreamBuilding.jelly
index 6878b69..2fbe35c 100644
--- a/hudson-core/src/main/resources/lib/hudson/project/config-blockWhenUpstreamBuilding.jelly
+++ b/hudson-core/src/main/resources/lib/hudson/project/config-blockWhenUpstreamBuilding.jelly
@@ -24,5 +24,5 @@
title="${%Block build when upstream project is building}"
help="/help/project-config/block-upstream-building.html"
checked="${blockBuildWhenUpstreamBuilding}"
- isPropertyOverridden="${blockBuildWhenUpstreamBuildingProperty.isPropertyOverridden()}"/>
+ isPropertyOverridden="${blockBuildWhenUpstreamBuildingProperty.isOverridden()}"/>
</j:jelly>
diff --git a/hudson-core/src/main/resources/lib/hudson/project/config-cleanWorkspace.jelly b/hudson-core/src/main/resources/lib/hudson/project/config-cleanWorkspace.jelly
index ee8b606..df76183 100644
--- a/hudson-core/src/main/resources/lib/hudson/project/config-cleanWorkspace.jelly
+++ b/hudson-core/src/main/resources/lib/hudson/project/config-cleanWorkspace.jelly
@@ -21,6 +21,6 @@
<j:set var="cleanWorkspaceRequired" value="${cleanWorkspaceRequiredProperty.getValue()}"/>
<f:optionalBlock name="cleanWorkspaceRequired" title="${%Clean workspace before build}"
checked="${cleanWorkspaceRequired}"
- isPropertyOverridden="${cleanWorkspaceRequiredProperty.isPropertyOverridden()}"
+ isPropertyOverridden="${cleanWorkspaceRequiredProperty.isOverridden()}"
help="/help/project-config/cleanWorkspace.html" />
</j:jelly>
diff --git a/hudson-core/src/main/resources/lib/hudson/project/config-customWorkspace.jelly b/hudson-core/src/main/resources/lib/hudson/project/config-customWorkspace.jelly
index 52e82e8..2bd8b1f 100644
--- a/hudson-core/src/main/resources/lib/hudson/project/config-customWorkspace.jelly
+++ b/hudson-core/src/main/resources/lib/hudson/project/config-customWorkspace.jelly
@@ -20,7 +20,7 @@
<j:set var="customWorkspaceProperty" value="${it.getStringProperty(it.CUSTOM_WORKSPACE_PROPERTY_NAME)}"/>
<j:set var="customWorkspace" value="${customWorkspaceProperty.getValue()}"/>
<f:optionalBlock name="customWorkspace" title="${%Use custom workspace}" checked="${customWorkspace!=null}"
- isPropertyOverridden="${customWorkspaceProperty.isPropertyOverridden()}"
+ isPropertyOverridden="${customWorkspaceProperty.isOverridden()}"
help="/help/project-config/custom-workspace.html">
<f:entry title="${%Directory}">
<f:textbox name="customWorkspace.directory" value="${customWorkspace}" />
diff --git a/hudson-core/src/main/resources/lib/hudson/project/config-quietPeriod.jelly b/hudson-core/src/main/resources/lib/hudson/project/config-quietPeriod.jelly
index 0c01df3..014c34c 100644
--- a/hudson-core/src/main/resources/lib/hudson/project/config-quietPeriod.jelly
+++ b/hudson-core/src/main/resources/lib/hudson/project/config-quietPeriod.jelly
@@ -9,7 +9,7 @@
#
# Contributors:
#
-# Kohsuke Kawaguchi, id:cactusman
+# Kohsuke Kawaguchi, id:cactusman, Nikita Levyankov, Anton Kozak
#
#
#************************************************************************** -->
@@ -21,7 +21,7 @@
<j:set var="quietPeriod" value="${quietPeriodProperty.getValue()}"/>
<f:optionalBlock name="hasCustomQuietPeriod" title="${%Quiet period}"
checked="${quietPeriod!=null and quietPeriod!=quietPeriodProperty.getDefaultValue()}"
- isPropertyOverridden="${quietPeriodProperty.isPropertyOverridden()}"
+ isPropertyOverridden="${quietPeriodProperty.isOverridden()}"
help="/help/project-config/quietPeriod.html">
<f:entry title="${%Quiet period}"
description="${%Number of seconds}">
diff --git a/hudson-core/src/main/resources/lib/hudson/project/config-retryCount.jelly b/hudson-core/src/main/resources/lib/hudson/project/config-retryCount.jelly
index 99c402c..d4f8de9 100644
--- a/hudson-core/src/main/resources/lib/hudson/project/config-retryCount.jelly
+++ b/hudson-core/src/main/resources/lib/hudson/project/config-retryCount.jelly
@@ -9,7 +9,7 @@
#
# Contributors:
#
-# Shinod
+# Shinod, Nikita Levyankov, Anton Kozak
#
#
#************************************************************************** -->
@@ -21,7 +21,7 @@
<j:set var="scmCheckoutRetryCount" value="${scmCheckoutRetryCountProperty.getValue()}"/>
<f:optionalBlock name="hasCustomScmCheckoutRetryCount" title="${%Retry Count}"
checked="${scmCheckoutRetryCount!=null and scmCheckoutRetryCount!=scmCheckoutRetryCountProperty.getDefaultValue()}"
- isPropertyOverridden="${scmCheckoutRetryCountProperty.isPropertyOverridden()}"
+ isPropertyOverridden="${scmCheckoutRetryCountProperty.isOverridden()}"
help="/help/project-config/scmCheckoutRetryCount.html">
<f:entry title="${%SCM checkout retry count}">
<f:textbox name="scmCheckoutRetryCount" value="${scmCheckoutRetryCount}"/>
diff --git a/hudson-core/src/main/resources/lib/layout/layout.jelly b/hudson-core/src/main/resources/lib/layout/layout.jelly
index ef1673e..6c98df7 100644
--- a/hudson-core/src/main/resources/lib/layout/layout.jelly
+++ b/hudson-core/src/main/resources/lib/layout/layout.jelly
@@ -104,7 +104,7 @@
<!--l:yui module="editor" suffix="-beta" /-->
<script src="${resURL}/scripts/hudson-behavior.js" type="text/javascript"></script>
-
+ <script src="${resURL}/scripts/cascading.js" type="text/javascript"></script>
<script>
crumb.init("${h.getCrumbRequestField()}", "${h.getCrumb(request)}");
</script>
diff --git a/hudson-core/src/test/java/org/eclipse/hudson/api/model/project/property/ProjectPropertyTest.java b/hudson-core/src/test/java/org/eclipse/hudson/api/model/project/property/ProjectPropertyTest.java
index a1ffecc..04ba872 100644
--- a/hudson-core/src/test/java/org/eclipse/hudson/api/model/project/property/ProjectPropertyTest.java
+++ b/hudson-core/src/test/java/org/eclipse/hudson/api/model/project/property/ProjectPropertyTest.java
@@ -17,11 +17,6 @@ package org.eclipse.hudson.api.model.project.property;
import hudson.model.FreeStyleProjectMock;
import hudson.tasks.LogRotator;
-import org.eclipse.hudson.api.model.project.property.BaseProjectProperty;
-import org.eclipse.hudson.api.model.project.property.BooleanProjectProperty;
-import org.eclipse.hudson.api.model.project.property.IntegerProjectProperty;
-import org.eclipse.hudson.api.model.project.property.LogRotatorProjectProperty;
-import org.eclipse.hudson.api.model.project.property.StringProjectProperty;
import org.junit.Before;
import org.junit.Test;
@@ -270,13 +265,13 @@ public class ProjectPropertyTest {
property.setKey(propertyKey);
property.setValue(null);
//If project doesn't have cascading - default boolean value is used for propertyOverridden flag
- assertFalse(property.isPropertyOverridden());
+ assertFalse(property.isOverridden());
assertNull(property.getOriginalValue());
Object value = 12345;
property.setValue(value);
//If project doesn't have cascading - default boolean value is used for propertyOverridden flag
- assertFalse(property.isPropertyOverridden());
+ assertFalse(property.isOverridden());
assertEquals(value, property.getOriginalValue());
String parentValue = "equalValue";
@@ -286,18 +281,21 @@ public class ProjectPropertyTest {
parent.putJobProperty(propertyKey, parentProperty);
project.setCascadingProject(parent);
+ //If value set to null, need to check whether default value is equals to cascading
+ property.setValue(null);
+ assertTrue(property.isOverridden());
String overriddenValue = "newValue";
property.setValue(overriddenValue);
- assertTrue(property.isPropertyOverridden());
+ assertTrue(property.isOverridden());
//Check whether current value is not null, after setting equal-to-cascading value current will be null
assertNotNull(property.getOriginalValue());
- assertTrue(property.isPropertyOverridden());
+ assertTrue(property.isOverridden());
property.setValue(parentValue);
//Reset current property to null
assertNull(property.getOriginalValue());
//Cascading value is equal to current - reset flag to false.
- assertFalse(property.isPropertyOverridden());
+ assertFalse(property.isOverridden());
}
@Test
@@ -314,10 +312,10 @@ public class ProjectPropertyTest {
//if current value is set to null and property is not overridden - defaultValue (Zero) will be taken
Integer value = property.getValue();
assertNotNull(value);
- assertFalse(property.isPropertyOverridden());
+ assertFalse(property.isOverridden());
assertEquals(property.getDefaultValue(), value);
- property.setPropertyOverridden(true);
+ property.setOverridden(true);
//If property is overridden - return its actual value.
assertNull(property.getValue());
@@ -333,12 +331,13 @@ public class ProjectPropertyTest {
assertNull(property.getOriginalValue());
assertEquals(propertyValue, property.getValue());
- property.setPropertyOverridden(true);
+ property.setOverridden(true);
//Property is overridden - return current value even if it is null.
assertNull(property.getOriginalValue());
assertNull(property.getValue());
}
+
/**
* Property should have not null property key.
*/
@@ -375,18 +374,17 @@ public class ProjectPropertyTest {
}
/**
- * Resets project property value,
+ * Test setOverridden method.
*/
@Test
- public void testResetValue() {
+ public void testSetPropertyOverridden() {
BaseProjectProperty property = new BaseProjectProperty(project);
- property.setKey(propertyKey);
- property.setValue(new Object());
- property.setPropertyOverridden(true);
- assertNotNull(property.getOriginalValue());
- assertTrue(property.isPropertyOverridden());
- property.resetValue();
- assertNull(property.getOriginalValue());
- assertFalse(property.isPropertyOverridden());
+ //By default property isOverridden flag is set to false.
+ assertFalse(property.isOverridden());
+ //Test if flag is configured as expected. Set true/false values and check whether they are set correctly.
+ property.setOverridden(true);
+ assertTrue(property.isOverridden());
+ property.setOverridden(false);
+ assertFalse(property.isOverridden());
}
}
diff --git a/hudson-parent/pom.xml b/hudson-parent/pom.xml
index be97691..f308deb 100644
--- a/hudson-parent/pom.xml
+++ b/hudson-parent/pom.xml
@@ -55,8 +55,8 @@
<maven-war-plugin.version>2.1.1</maven-war-plugin.version>
<findbugs-maven-plugin.version>2.3.1</findbugs-maven-plugin.version>
<maven-localizer-plugin.version>1.10</maven-localizer-plugin.version>
- <maven-hpi-plugin.version>2.1.1</maven-hpi-plugin.version>
- <maven-stapler-plugin.version>1.16</maven-stapler-plugin.version>
+ <maven-hpi-plugin.version>2.1.0</maven-hpi-plugin.version>
+ <maven-stapler-plugin.version>1.15</maven-stapler-plugin.version>
<!--Test dependencies-->
<junit.version>4.8.1</junit.version>
diff --git a/hudson-war/src/main/webapp/scripts/cascading.js b/hudson-war/src/main/webapp/scripts/cascading.js
new file mode 100644
index 0000000..14b6329
--- /dev/null
+++ b/hudson-war/src/main/webapp/scripts/cascading.js
@@ -0,0 +1,13 @@
+jQuery(document).ready(function(){
+ jQuery('select[name=cascadingProjectName]').change(function() {
+ var url = window.location.href;
+ var jobUrl = url.substr(0, url.lastIndexOf('/'))+'/updateCascadingProject';
+ var cascadingProject = jQuery(this).val();
+ new Ajax.Request(jobUrl+'?projectName='+cascadingProject, {
+ method : 'get',
+ onSuccess : function(x) {
+ location.reload(true);
+ },
+ });
+ });
+}); \ No newline at end of file