summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorakozak2011-11-23 02:05:11 (EST)
committer Winston Prakash2011-12-01 20:47:04 (EST)
commit983e7167720f3696b28dfa1864cecc5cfec07f12 (patch)
treea31bc13493820dd4cdf99f398b9f379eb55f6bfa
parent5c8054a734320e9578c29900c81d6213ca3cd362 (diff)
downloadorg.eclipse.hudson.core-983e7167720f3696b28dfa1864cecc5cfec07f12.zip
org.eclipse.hudson.core-983e7167720f3696b28dfa1864cecc5cfec07f12.tar.gz
org.eclipse.hudson.core-983e7167720f3696b28dfa1864cecc5cfec07f12.tar.bz2
Implement cascading support for hetero-list.jelly. Add css style for div.modified
Signed-off-by: Winston Prakash <winston.prakash@gmail.com>
-rw-r--r--hudson-core/src/main/java/hudson/model/AbstractProject.java19
-rw-r--r--hudson-core/src/main/resources/hudson/matrix/MatrixProject/configure-entries.jelly3
-rw-r--r--hudson-core/src/test/java/hudson/matrix/MatrixProjectTest.java60
3 files changed, 75 insertions, 7 deletions
diff --git a/hudson-core/src/main/java/hudson/model/AbstractProject.java b/hudson-core/src/main/java/hudson/model/AbstractProject.java
index 7d53e58..e6b14b7 100644
--- a/hudson-core/src/main/java/hudson/model/AbstractProject.java
+++ b/hudson-core/src/main/java/hudson/model/AbstractProject.java
@@ -128,6 +128,7 @@ public abstract class AbstractProject<P extends AbstractProject<P,R>,R extends A
public static final String SCM_CHECKOUT_RETRY_COUNT_PROPERTY_NAME = "scmCheckoutRetryCount";
public static final String CUSTOM_WORKSPACE_PROPERTY_NAME = "customWorkspace";
public static final String JDK_PROPERTY_NAME = "jdk";
+ public static final String PROPERTY_NAME_SEPARATOR = ";";
/**
* {@link SCM} associated with the project.
@@ -1890,12 +1891,22 @@ public abstract class AbstractProject<P extends AbstractProject<P,R>,R extends A
}
}
- public void doResetProjectProperty(@QueryParameter final String propertyName) {
+ /**
+ * Resets overridden properties to the values defined in parent.
+ *
+ * @param propertyName the name of the properties. It possible to pass several names
+ * separated with {@link #PROPERTY_NAME_SEPARATOR}.
+ * @throws java.io.IOException exception.
+ */
+ public void doResetProjectProperty(@QueryParameter final String propertyName) throws IOException {
checkPermission(CONFIGURE);
- final IProjectProperty property = getProperty(propertyName);
- if (null != property) {
- property.resetValue();
+ for (String name : StringUtils.split(propertyName, PROPERTY_NAME_SEPARATOR)) {
+ final IProjectProperty property = getProperty(name);
+ if (null != property) {
+ property.resetValue();
+ }
}
+ save();
}
public boolean cleanWorkspace() throws IOException, InterruptedException{
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 6b41486..e47e23d 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
@@ -81,7 +81,8 @@
<f:optionalBlock name="hasTouchStoneCombinationFilter" title="${%Execute touchstone builds first}"
checked="${!empty(touchStoneCombinationFilter)}"
isPropertyOverridden="${touchStoneCombinationFilterProperty.isOverridden() || touchStoneResultConditionProperty.isOverridden()}"
- resetUrl="${jobUrl}/resetProjectProperty?propertyName=${it.TOUCH_STONE_COMBINATION_FILTER_PROPERTY_NAME}"
+ resetUrl="${jobUrl}/resetProjectProperty?propertyName=${it.TOUCH_STONE_COMBINATION_FILTER_PROPERTY_NAME +
+ it.PROPERTY_NAME_SEPARATOR + it.TOUCH_STONE_RESULT_CONDITION_PROPERTY_NAME}"
help="/help/matrix/touchstone.html">
<f:entry title="${%Filter}">
<f:textbox name="touchStoneCombinationFilter" value="${touchStoneCombinationFilter}" />
diff --git a/hudson-core/src/test/java/hudson/matrix/MatrixProjectTest.java b/hudson-core/src/test/java/hudson/matrix/MatrixProjectTest.java
index 3f1ddbc..9dbc483 100644
--- a/hudson-core/src/test/java/hudson/matrix/MatrixProjectTest.java
+++ b/hudson-core/src/test/java/hudson/matrix/MatrixProjectTest.java
@@ -15,10 +15,15 @@
package hudson.matrix;
import hudson.model.Result;
+import hudson.security.Permission;
import java.io.IOException;
-import org.junit.Ignore;
+import org.eclipse.hudson.api.model.IProjectProperty;
+import org.eclipse.hudson.api.model.project.property.ResultProjectProperty;
+import org.eclipse.hudson.api.model.project.property.StringProjectProperty;
import org.junit.Test;
+import static hudson.model.AbstractProject.PROPERTY_NAME_SEPARATOR;
+import static org.easymock.EasyMock.*;
import static org.junit.Assert.*;
/**
@@ -337,8 +342,51 @@ public class MatrixProjectTest {
assertEquals(childProject1.getCustomWorkspace(), parentWorkspace);
}
- private class MatrixProjectMock extends MatrixProject {
+ @Test
+ public void testDoResetProjectPropertyOneProperty() throws IOException {
+ final IProjectProperty filterProperty = createMock(StringProjectProperty.class);
+ String input = MatrixProject.TOUCH_STONE_COMBINATION_FILTER_PROPERTY_NAME;
+ MatrixProject project = new MatrixProjectMock("parent") {
+ public IProjectProperty getProperty(String key) {
+ if (MatrixProject.TOUCH_STONE_COMBINATION_FILTER_PROPERTY_NAME.equals(key)) {
+ return filterProperty;
+ } else {
+ return null;
+ }
+ }
+ };
+ filterProperty.resetValue();
+ replay(filterProperty);
+ project.doResetProjectProperty(input);
+ verify(filterProperty);
+ }
+ @Test
+ public void testDoResetProjectPropertyTwoProperties() throws IOException {
+ final IProjectProperty filterProperty = createMock(StringProjectProperty.class);
+ final IProjectProperty resultProperty = createMock(ResultProjectProperty.class);
+
+ String input = MatrixProject.TOUCH_STONE_COMBINATION_FILTER_PROPERTY_NAME + PROPERTY_NAME_SEPARATOR +
+ MatrixProject.TOUCH_STONE_RESULT_CONDITION_PROPERTY_NAME;
+ MatrixProject project = new MatrixProjectMock("parent") {
+ public IProjectProperty getProperty(String key) {
+ if (MatrixProject.TOUCH_STONE_COMBINATION_FILTER_PROPERTY_NAME.equals(key)) {
+ return filterProperty;
+ } else if (MatrixProject.TOUCH_STONE_RESULT_CONDITION_PROPERTY_NAME.equals(key)) {
+ return resultProperty;
+ } else {
+ return null;
+ }
+ }
+ };
+ filterProperty.resetValue();
+ resultProperty.resetValue();
+ replay(filterProperty, resultProperty);
+ project.doResetProjectProperty(input);
+ verify(filterProperty, resultProperty);
+ }
+
+ private class MatrixProjectMock extends MatrixProject {
private MatrixProjectMock(String name) {
super(null, name);
setAllowSave(false);
@@ -351,5 +399,13 @@ public class MatrixProjectTest {
@Override
void rebuildConfigurations() throws IOException {
}
+
+ @Override
+ public void checkPermission(Permission p) {
+ }
+
+ @Override
+ public synchronized void save() throws IOException {
+ }
}
}