| author | akozak | 2011-11-23 01:45:44 (EST) |
|---|---|---|
| committer | Winston Prakash | 2011-12-01 20:47:03 (EST) |
| commit | 358769d6f1c22d538322fd9f621b4973c0364baa (patch) (side-by-side diff) | |
| tree | da359817d71c18549be7afd51abfd58760143d91 | |
| parent | 231bf91d42ffa4e9fd4ce2c7f35d3771c8024ebc (diff) | |
| download | org.eclipse.hudson.core-358769d6f1c22d538322fd9f621b4973c0364baa.zip org.eclipse.hudson.core-358769d6f1c22d538322fd9f621b4973c0364baa.tar.gz org.eclipse.hudson.core-358769d6f1c22d538322fd9f621b4973c0364baa.tar.bz2 | |
Improved Matrix configuration page.
Signed-off-by: Winston Prakash <winston.prakash@gmail.com>
6 files changed, 106 insertions, 9 deletions
diff --git a/hudson-core/src/main/java/hudson/matrix/MatrixConfiguration.java b/hudson-core/src/main/java/hudson/matrix/MatrixConfiguration.java index fcc6396..b3f29d3 100644 --- a/hudson-core/src/main/java/hudson/matrix/MatrixConfiguration.java +++ b/hudson-core/src/main/java/hudson/matrix/MatrixConfiguration.java @@ -277,7 +277,8 @@ public class MatrixConfiguration extends Project<MatrixConfiguration,MatrixRun> */ @Override public void setLogRotator(LogRotator logRotator) { - throw new UnsupportedOperationException(); + //TODO fins the reason + //throw new UnsupportedOperationException(); } /** diff --git a/hudson-core/src/main/java/hudson/matrix/MatrixProject.java b/hudson-core/src/main/java/hudson/matrix/MatrixProject.java index d411388..3911421 100644 --- a/hudson-core/src/main/java/hudson/matrix/MatrixProject.java +++ b/hudson-core/src/main/java/hudson/matrix/MatrixProject.java @@ -89,10 +89,10 @@ public class MatrixProject extends AbstractProject<MatrixProject, MatrixBuild> i public static final String TOUCH_STONE_RESULT_CONDITION_PARAM = "touchStoneResultCondition"; public static final String CUSTOM_WORKSPACE_PARAM = "customWorkspace"; public static final String CUSTOM_WORKSPACE_DIRECTORY_PARAM = "customWorkspace.directory"; - public static final String RUN_SEQUENTIALLY_PROPERTY_NAME = "runSequentially"; public static final String COMBINATION_FILTER_PROPERTY_NAME = "combinationFilter"; public static final String TOUCH_STONE_COMBINATION_FILTER_PROPERTY_NAME = "touchStoneCombinationFilter"; + public static final String TOUCH_STONE_RESULT_CONDITION_PROPERTY_NAME = "touchStoneResultCondition"; /** * Configuration axes. @@ -151,6 +151,7 @@ public class MatrixProject extends AbstractProject<MatrixProject, MatrixBuild> i /** * Required result on the touchstone combinations, in order to * continue with the rest. + * @deprecated as of 2.2.0, use #getTouchStoneResultCondition() and #setTouchStoneResultCondition() instead */ private Result touchStoneResultCondition; @@ -237,14 +238,14 @@ public class MatrixProject extends AbstractProject<MatrixProject, MatrixBuild> i * @inheritDoc */ public Result getTouchStoneResultCondition() { - return touchStoneResultCondition; + return getResultProperty(TOUCH_STONE_RESULT_CONDITION_PROPERTY_NAME).getValue(); } /** * @inheritDoc */ public void setTouchStoneResultCondition(Result touchStoneResultCondition) { - this.touchStoneResultCondition = touchStoneResultCondition; + getResultProperty(TOUCH_STONE_RESULT_CONDITION_PROPERTY_NAME).setValue(touchStoneResultCondition); } /** diff --git a/hudson-core/src/main/java/hudson/model/Job.java b/hudson-core/src/main/java/hudson/model/Job.java index 46a6c1f..4d9e7fc 100644 --- a/hudson-core/src/main/java/hudson/model/Job.java +++ b/hudson-core/src/main/java/hudson/model/Job.java @@ -21,6 +21,7 @@ import hudson.Functions; 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.ResultProjectProperty; import org.eclipse.hudson.api.model.project.property.StringProjectProperty; import hudson.util.graph.GraphSeries; import hudson.widgets.Widget; @@ -247,6 +248,10 @@ public abstract class Job<JobT extends Job<JobT, RunT>, RunT extends Run<JobT, R return (StringProjectProperty) getProperty(key, StringProjectProperty.class); } + public ResultProjectProperty getResultProperty(String key) { + return (ResultProjectProperty) getProperty(key, ResultProjectProperty.class); + } + public BooleanProjectProperty getBooleanProperty(String key){ return (BooleanProjectProperty) getProperty(key, BooleanProjectProperty.class); } diff --git a/hudson-core/src/main/java/org/eclipse/hudson/api/model/project/property/ResultProjectProperty.java b/hudson-core/src/main/java/org/eclipse/hudson/api/model/project/property/ResultProjectProperty.java new file mode 100644 index 0000000..92a4ffc --- a/dev/null +++ b/hudson-core/src/main/java/org/eclipse/hudson/api/model/project/property/ResultProjectProperty.java @@ -0,0 +1,32 @@ +/******************************************************************************* + * + * Copyright (c) 2011 Oracle Corporation. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * + * Anton Kozak + * + *******************************************************************************/ + +package org.eclipse.hudson.api.model.project.property; +import hudson.model.Result; +import org.eclipse.hudson.api.model.IJob; + +/** + * Represents {@link Result} property. + * <p/> + * Date: 9/23/11 + * + * @author Anton Kozak + */ +public class ResultProjectProperty extends BaseProjectProperty<Result> { + + public ResultProjectProperty(IJob job) { + super(job); + } +} 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 7cd17a7..6b41486 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 @@ -1,6 +1,6 @@ <!-- ************************************************************************** # -# Copyright (c) 2004-2010 Oracle Corporation. +# Copyright (c) 2004-2011 Oracle Corporation. # # All rights reserved. This program and the accompanying materials # are made available under the terms of the Eclipse Public License v1.0 @@ -22,6 +22,7 @@ <j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form" xmlns:i="jelly:fmt" xmlns:p="/lib/hudson/project"> <p:config-disableBuild/> + <j:set var="jobUrl" value="${h.getNearestAncestorUrl(request,it)}"/> <f:section title="${%Advanced Project Options}"> <f:advanced> @@ -57,6 +58,7 @@ checked="${runSequentially}" field="runSequentially" title="${%Run each configuration sequentially}" + resetUrl="${jobUrl}/resetProjectProperty?propertyName=${it.RUN_SEQUENTIALLY_PROPERTY_NAME}" isPropertyOverridden="${runSequentiallyProperty.isOverridden()}"/> <j:set var="combinationFilterProperty" value="${it.getStringProperty(it.COMBINATION_FILTER_PROPERTY_NAME)}"/> @@ -64,6 +66,7 @@ <f:optionalBlock name="hasCombinationFilter" title="${%Combination Filter}" checked="${!empty(combinationFilter)}" isPropertyOverridden="${combinationFilterProperty.isOverridden()}" + resetUrl="${jobUrl}/resetProjectProperty?propertyName=${it.COMBINATION_FILTER_PROPERTY_NAME}" help="/help/matrix/combinationfilter.html"> <f:entry title="${%Filter}"> <f:textbox name="combinationFilter" value="${combinationFilter}" /> @@ -72,17 +75,21 @@ <j:set var="touchStoneCombinationFilterProperty" value="${it.getStringProperty(it.TOUCH_STONE_COMBINATION_FILTER_PROPERTY_NAME)}"/> <j:set var="touchStoneCombinationFilter" value="${touchStoneCombinationFilterProperty.getValue()}"/> + <j:set var="touchStoneResultConditionProperty" value="${it.getResultProperty(it.TOUCH_STONE_RESULT_CONDITION_PROPERTY_NAME)}"/> + <j:set var="touchStoneResultCondition" value="${touchStoneResultConditionProperty.getValue()}"/> + <f:optionalBlock name="hasTouchStoneCombinationFilter" title="${%Execute touchstone builds first}" checked="${!empty(touchStoneCombinationFilter)}" - isPropertyOverridden="${touchStoneCombinationFilterProperty.isOverridden()}" + isPropertyOverridden="${touchStoneCombinationFilterProperty.isOverridden() || touchStoneResultConditionProperty.isOverridden()}" + resetUrl="${jobUrl}/resetProjectProperty?propertyName=${it.TOUCH_STONE_COMBINATION_FILTER_PROPERTY_NAME}" help="/help/matrix/touchstone.html"> <f:entry title="${%Filter}"> <f:textbox name="touchStoneCombinationFilter" value="${touchStoneCombinationFilter}" /> </f:entry> <f:entry title="${%Required result}" description="${%required.result.description}"> <select name="touchStoneResultCondition"> - <f:option value="SUCCESS" selected='${it.touchStoneResultCondition.toExportedObject()=="SUCCESS"}'>${%Stable}</f:option> - <f:option value="UNSTABLE" selected='${it.touchStoneResultCondition.toExportedObject()=="UNSTABLE"}'>${%Unstable}</f:option> + <f:option value="SUCCESS" selected='${touchStoneResultCondition.toExportedObject()=="SUCCESS"}'>${%Stable}</f:option> + <f:option value="UNSTABLE" selected='${touchStoneResultCondition.toExportedObject()=="UNSTABLE"}'>${%Unstable}</f:option> </select> </f:entry> </f:optionalBlock> @@ -91,4 +98,4 @@ <p:config-buildWrappers /> <p:config-builders /> <p:config-publishers /> -</j:jelly>
\ No newline at end of file +</j:jelly> diff --git a/hudson-core/src/test/java/hudson/matrix/MatrixProjectTest.java b/hudson-core/src/test/java/hudson/matrix/MatrixProjectTest.java index 7dcc846..3f1ddbc 100644 --- a/hudson-core/src/test/java/hudson/matrix/MatrixProjectTest.java +++ b/hudson-core/src/test/java/hudson/matrix/MatrixProjectTest.java @@ -223,6 +223,57 @@ public class MatrixProjectTest { } @Test + public void testGetTouchStoneResultConditionParentValue() throws IOException { + Result parentResultCondition = Result.SUCCESS; + MatrixProject parentProject = new MatrixProjectMock("parent"); + parentProject.setTouchStoneResultCondition(parentResultCondition); + + MatrixProject childProject1 = new MatrixProjectMock("child1"); + childProject1.setCascadingProject(parentProject); + assertEquals(childProject1.getTouchStoneResultCondition(), parentResultCondition); + } + + @Test + public void testSetTouchStoneResultConditionDifferentValues() throws IOException { + Result parentResultCondition = Result.SUCCESS; + Result childResultCondition = Result.FAILURE; + MatrixProject parentProject = new MatrixProjectMock("parent"); + parentProject.setTouchStoneResultCondition(parentResultCondition); + + MatrixProject childProject1 = new MatrixProjectMock("child1"); + childProject1.setCascadingProject(parentProject); + childProject1.setTouchStoneResultCondition(childResultCondition); + assertEquals(childProject1.getTouchStoneResultCondition(), childResultCondition); + } + + @Test + public void testSetTouchStoneResultConditionTheSameValues() throws IOException { + Result parentResultCondition = Result.SUCCESS; + MatrixProject parentProject = new MatrixProjectMock("parent"); + parentProject.setTouchStoneResultCondition(parentResultCondition); + + MatrixProject childProject1 = new MatrixProjectMock("child1"); + childProject1.setCascadingProject(parentProject); + childProject1.setTouchStoneResultCondition(parentResultCondition); + assertEquals(childProject1.getTouchStoneResultCondition(), parentResultCondition); + } + + @Test + public void testSetTouchStoneResultConditionParentNull() throws IOException { + Result childResultCondition = Result.FAILURE; + + MatrixProject childProject1 = new MatrixProjectMock("child1"); + childProject1.setTouchStoneResultCondition(childResultCondition); + assertEquals(childProject1.getTouchStoneResultCondition(), childResultCondition); + } + + @Test + public void testSetTouchStoneResultConditionNull() throws IOException { + MatrixProject childProject1 = new MatrixProjectMock("child1"); + assertNull(childProject1.getTouchStoneResultCondition()); + } + + @Test public void testGetCustomWorkspaceChildValue() throws IOException { String parentWorkspace = "/tmp"; String childWorkspace = "/tmp2"; |

