| author | akozak | 2011-11-24 08:34:07 (EST) |
|---|---|---|
| committer | Winston Prakash | 2011-12-01 20:47:26 (EST) |
| commit | 3db0506fc8675dd0ed206c43ea36e0090a576bc3 (patch) (side-by-side diff) | |
| tree | 2eb35cd70ea6b1bd488d44b174eaeb6cd5574d90 | |
| parent | 6dc25a8df9150ce6bd444daecc5b72893b6cb938 (diff) | |
| download | org.eclipse.hudson.core-3db0506fc8675dd0ed206c43ea36e0090a576bc3.zip org.eclipse.hudson.core-3db0506fc8675dd0ed206c43ea36e0090a576bc3.tar.gz org.eclipse.hudson.core-3db0506fc8675dd0ed206c43ea36e0090a576bc3.tar.bz2 | |
Added cascading for "Restrict where this project can be run"
Signed-off-by: Winston Prakash <winston.prakash@gmail.com>
12 files changed, 356 insertions, 67 deletions
diff --git a/hudson-core/src/main/java/hudson/model/AbstractProject.java b/hudson-core/src/main/java/hudson/model/AbstractProject.java index 5d132cf..ed73899 100644 --- a/hudson-core/src/main/java/hudson/model/AbstractProject.java +++ b/hudson-core/src/main/java/hudson/model/AbstractProject.java @@ -138,6 +138,11 @@ public abstract class AbstractProject<P extends AbstractProject<P,R>,R extends A public static final String HAS_QUIET_PERIOD_PROPERTY_NAME = "hasQuietPeriod"; public static final String HAS_SCM_CHECKOUT_RETRY_COUNT_PROPERTY_NAME = "hasScmCheckoutRetryCount"; public static final String BUILD_TRIGGER_PROPERTY_NAME = "hudson-tasks-BuildTrigger"; + public static final String APPOINTED_NODE_PROPERTY_NAME = "appointedNode"; + public static final String BASIC_KEY = "basic"; + public static final String AFFINITY_CHO0SER_KEY = "affinityChooser"; + public static final String SLAVE_KEY = "slave"; + public static final String ASSIGNED_LABEL_KEY = "_.assignedLabelString"; /** * {@link SCM} associated with the project. @@ -188,12 +193,22 @@ public abstract class AbstractProject<P extends AbstractProject<P,R>,R extends A * with the master node. * * @see #canRoam + * + * @deprecated as of 2.2.0 + * don't use this field directly, logic was moved to + * {@link hudson.model.AbstractProject#getAppointedNode()#getName()}. */ + @Deprecated private String assignedNode; /** * Node list is dropdown or textfield + * + * @deprecated as of 2.2.0 + * don't use this field directly, logic was moved to + * {@link hudson.model.AbstractProject#getAppointedNode()#isAdvancedAffinityChooser()}. */ + @Deprecated private Boolean advancedAffinityChooser; /** @@ -202,7 +217,12 @@ public abstract class AbstractProject<P extends AbstractProject<P,R>,R extends A * <p> * This somewhat ugly flag combination is so that we can migrate * existing Hudson installations nicely. + * + * @deprecated as of 2.2.0 + * don't use this field directly, logic was moved to + * {@link hudson.model.AbstractProject#getAppointedNode()#getCanRoam}. */ + @Deprecated private volatile boolean canRoam; /** @@ -291,11 +311,12 @@ public abstract class AbstractProject<P extends AbstractProject<P,R>,R extends A protected AbstractProject(ItemGroup parent, String name) { super(parent, name); - if (Hudson.getInstance() != null && !Hudson.getInstance().getNodes().isEmpty()) { + //TODO: Investigate when this case happens. + //if (Hudson.getInstance() != null && !Hudson.getInstance().getNodes().isEmpty()) { // if a new job is configured with Hudson that already has slave nodes // make it roamable by default - canRoam = true; - } + // canRoam = true; + //} } @Override @@ -347,6 +368,7 @@ public abstract class AbstractProject<P extends AbstractProject<P,R>,R extends A convertScmCheckoutRetryCountProperty(); convertJDKProperty(); convertTriggerProperties(); + convertAppointedNode(); } void convertBlockBuildWhenUpstreamBuildingProperty() throws IOException { @@ -411,6 +433,15 @@ public abstract class AbstractProject<P extends AbstractProject<P,R>,R extends A triggers = null; } } + + void convertAppointedNode() { + if (assignedNode != null && getProperty(APPOINTED_NODE_PROPERTY_NAME) == null) { + setAppointedNode(new AppointedNode(assignedNode, advancedAffinityChooser)); + assignedNode = null; + advancedAffinityChooser = null; + } + } + @Override protected void performDelete() throws IOException, InterruptedException { // prevent a new build while a delete operation is in progress @@ -454,40 +485,21 @@ public abstract class AbstractProject<P extends AbstractProject<P,R>,R extends A * return that {@link Node}. Otherwise null. */ public Label getAssignedLabel() { - if(canRoam) - return null; - - if(assignedNode==null) - return Hudson.getInstance().getSelfLabel(); - return Hudson.getInstance().getLabel(assignedNode); + return getAppointedNode() == null ? null : getAppointedNode().getAssignedLabel(); } /** * Gets the textual representation of the assigned label as it was entered by the user. */ public String getAssignedLabelString() { - if (canRoam || assignedNode==null) return null; - try { - LabelExpression.parseExpression(assignedNode); - return assignedNode; - } catch (ANTLRException e) { - // must be old label or host name that includes whitespace or other unsafe chars - return LabelAtom.escape(assignedNode); - } + return getAppointedNode() == null ? null : getAppointedNode().getAssignedLabelString(); } /** * Sets the assigned label. */ public void setAssignedLabel(Label l) throws IOException { - if(l==null) { - canRoam = true; - assignedNode = null; - } else { - canRoam = false; - if(l==Hudson.getInstance().getSelfLabel()) assignedNode = null; - else assignedNode = l.getExpression(); - } + getAppointedNode().setAssignedLabel(l); save(); } @@ -506,10 +518,7 @@ public abstract class AbstractProject<P extends AbstractProject<P,R>,R extends A public boolean isAdvancedAffinityChooser() { //For newly created project advanced chooser is not used. //Set value to false in order to avoid NullPointerException - if (null == advancedAffinityChooser) { - advancedAffinityChooser = false; - } - return advancedAffinityChooser; + return getAppointedNode() != null && getAppointedNode().getAdvancedAffinityChooser(); } /** @@ -518,11 +527,30 @@ public abstract class AbstractProject<P extends AbstractProject<P,R>,R extends A * @param b true - advanced chooser, false - otherwise */ public void setAdvancedAffinityChooser(boolean b) throws IOException { - advancedAffinityChooser = b; + getAppointedNode().setAdvancedAffinityChooser(b); save(); } /** + * Sets {@link AppointedNode}. + * + * @param appointedNode {@link AppointedNode}. + */ + @SuppressWarnings("unchecked") + public void setAppointedNode(AppointedNode appointedNode) { + CascadingUtil.getBaseProjectProperty(this, APPOINTED_NODE_PROPERTY_NAME).setValue(appointedNode); + } + + /** + * Returns {@link AppointedNode}. Returned value is not null. + * + * @return appointedNode {@link AppointedNode}. + */ + public AppointedNode getAppointedNode() { + return (AppointedNode)CascadingUtil.getBaseProjectProperty(this, APPOINTED_NODE_PROPERTY_NAME).getValue(); + } + + /** * Get the term used in the UI to represent this kind of {@link AbstractProject}. * Must start with a capital letter. */ @@ -871,7 +899,7 @@ public abstract class AbstractProject<P extends AbstractProject<P,R>,R extends A if (!p.isConfigurable()) continue; boolean isUpstream = upstream.contains(p); synchronized(p) { - // does 'p' include us in its BuildTrigger? + // does 'p' include us in its BuildTrigger? DescribableList<Publisher,Descriptor<Publisher>> pl = p.getPublishersList(); BuildTrigger trigger = pl.get(BuildTrigger.class); List<AbstractProject> newChildProjects = trigger == null ? new ArrayList<AbstractProject>():trigger.getChildProjects(); @@ -1903,25 +1931,22 @@ public abstract class AbstractProject<P extends AbstractProject<P,R>,R extends A setBlockBuildWhenDownstreamBuilding(null != req.getParameter("blockBuildWhenDownstreamBuilding")); setBlockBuildWhenUpstreamBuilding(null != req.getParameter("blockBuildWhenUpstreamBuilding")); - if (req.getParameter("hasSlaveAffinity") != null) { + if (req.getParameter(APPOINTED_NODE_PROPERTY_NAME) != null) { // New logic for handling whether this choice came from the dropdown or textfield. - if ("basic".equals(req.getParameter("affinityChooser"))) { - assignedNode = Util.fixEmptyAndTrim(req.getParameter("slave")); - advancedAffinityChooser = false; + if (BASIC_KEY.equals(req.getParameter(AFFINITY_CHO0SER_KEY))) { + setAppointedNode( + new AppointedNode(Util.fixEmptyAndTrim(req.getParameter(SLAVE_KEY)), false)); } else { - assignedNode = Util.fixEmptyAndTrim(req.getParameter("_.assignedLabelString")); - advancedAffinityChooser = true; + setAppointedNode( + new AppointedNode(Util.fixEmptyAndTrim(req.getParameter(ASSIGNED_LABEL_KEY)), true)); } + } else { - assignedNode = null; - advancedAffinityChooser = false; + setAppointedNode(null); } - setCleanWorkspaceRequired(null != req.getParameter("cleanWorkspaceRequired")); - canRoam = assignedNode==null; - setConcurrentBuild(req.getSubmittedForm().has("concurrentBuild")); authToken = BuildAuthorizationToken.create(req); @@ -1931,6 +1956,7 @@ public abstract class AbstractProject<P extends AbstractProject<P,R>,R extends A buildTriggers(req, req.getSubmittedForm(), Trigger.for_(this)); } + /** * @deprecated * As of 1.261. Use {@link #buildDescribable(StaplerRequest, List)} instead. diff --git a/hudson-core/src/main/java/hudson/model/AppointedNode.java b/hudson-core/src/main/java/hudson/model/AppointedNode.java new file mode 100644 index 0000000..d46f20c --- a/dev/null +++ b/hudson-core/src/main/java/hudson/model/AppointedNode.java @@ -0,0 +1,165 @@ +/******************************************************************************* + * + * 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 hudson.model; + +import antlr.ANTLRException; +import hudson.model.labels.LabelAtom; +import hudson.model.labels.LabelExpression; +import java.io.Serializable; +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; + +/** + * Appointed node holder for {@link AbstractProject}. + * + * Date: 11/1/11 + */ +public class AppointedNode implements Serializable { + + /** + * If this project is configured to be only built on a certain label, + * this value will be set to that label. + */ + private String nodeName; + + /** + * Node list dropdown or textfield. + */ + private Boolean advancedAffinityChooser; + + /** + * True if this project can be built on any node. + */ + private volatile boolean canRoam; + + public AppointedNode(String nodeName, Boolean advancedAffinityChooser) { + this.nodeName = nodeName; + this.advancedAffinityChooser = advancedAffinityChooser; + this.canRoam = nodeName == null; + } + + /** + * Returns the name of the node. + * + * @return the name of the node. + */ + public String getNodeName() { + return nodeName; + } + + /** + * Sets the name of the node. + * + * @param nodeName the name of the node. + */ + public void setNodeName(String nodeName) { + this.nodeName = nodeName; + } + + /** + * Gets whether this project is using the advanced affinity chooser UI. + * + * @return true - advanced chooser, false - simple textfield. + */ + public Boolean getAdvancedAffinityChooser() { + if (null == advancedAffinityChooser) { + advancedAffinityChooser = false; + } + return advancedAffinityChooser; + } + + /** + * Sets true if the node configured with advanced label expression + * and false if with combobox. + * + * @param advancedAffinityChooser boolean. + */ + public void setAdvancedAffinityChooser(Boolean advancedAffinityChooser) { + this.advancedAffinityChooser = advancedAffinityChooser; + } + + /** + * If this project is configured to be always built on this node, + * return that {@link Node}. Otherwise null. + * + * @return assigned label + */ + public Label getAssignedLabel() { + if (canRoam) { + return null; + } + if (nodeName == null) { + return Hudson.getInstance().getSelfLabel(); + } + return Hudson.getInstance().getLabel(nodeName); + } + + /** + * Gets the textual representation of the assigned label as it was entered by the user. + * + * @return assigned label as string + */ + public String getAssignedLabelString() { + if (canRoam || nodeName == null) { + return null; + } + try { + LabelExpression.parseExpression(nodeName); + return nodeName; + } catch (ANTLRException e) { + // must be old label or host name that includes whitespace or other unsafe chars + return LabelAtom.escape(nodeName); + } + } + + /** + * Sets the assigned label. + * + * @param l Label + */ + public void setAssignedLabel(Label l) { + if (l == null) { + canRoam = true; + nodeName = null; + } else { + canRoam = false; + nodeName = l == Hudson.getInstance().getSelfLabel() ? null : l.getExpression(); + } + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AppointedNode that = (AppointedNode) o; + return new EqualsBuilder() + .append(advancedAffinityChooser, that.advancedAffinityChooser) + .append(nodeName, that.nodeName) + .isEquals(); + } + + @Override + public int hashCode() { + return new HashCodeBuilder() + .append(advancedAffinityChooser) + .append(nodeName) + .toHashCode(); + } +} diff --git a/hudson-core/src/main/java/hudson/model/Items.java b/hudson-core/src/main/java/hudson/model/Items.java index fd10b57..d3b6cbb 100644 --- a/hudson-core/src/main/java/hudson/model/Items.java +++ b/hudson-core/src/main/java/hudson/model/Items.java @@ -151,5 +151,7 @@ public class Items { XSTREAM.alias("axis-list-property", AxisListProjectProperty.class); XSTREAM.alias("describable-list-property", DescribableListProjectProperty.class); XSTREAM.aliasField("project-properties", Job.class, "jobProperties"); + //TODO: think about migrating to xstream's annotations. + XSTREAM.alias("appointed-node-property", AppointedNode.class); } } 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 9b33868..f93fa85 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 @@ -48,14 +48,19 @@ </j:if> <!-- master/slave --> + <j:set var="nodeChooserProperty" value="${cu.getBaseProjectProperty(it, it.APPOINTED_NODE_PROPERTY_NAME)}"/> + <j:set var="isNodeOverridden" value="${nodeChooserProperty.isOverridden()}" /> <j:if test="${app.labels.size() gt 1 || app.clouds.size() gt 0 || (it.assignedLabel!=null and it.assignedLabel!=app.selfLabel)}"> - <f:optionalBlock name="hasSlaveAffinity" title="${%Restrict where this project can be run}" + <f:optionalBlock name="${it.APPOINTED_NODE_PROPERTY_NAME}" title="${%Restrict where this project can be run}" checked="${it.assignedLabel!=null}" + isPropertyOverridden="${isNodeOverridden}" + resetUrl="${jobUrl}/resetProjectProperty?propertyName=${it.APPOINTED_NODE_PROPERTY_NAME}" help="/help/project-config/slave.html"> - <f:radioBlock name="affinityChooser" value="basic" title="${%Node and label menu}" - checked="${!it.advancedAffinityChooser and it.assignedLabel!=null}"> - <f:entry title="${%Node}"> - <select class="setting-input" name="slave"> + <f:radioBlock name="${it.AFFINITY_CHO0SER_KEY}" value="${it.BASIC_KEY}" title="${%Node and label menu}" + checked="${!it.advancedAffinityChooser and it.assignedLabel!=null}" + isPropertyOverridden="${isNodeOverridden}"> + <f:entry title="${%Node}" isPropertyOverridden="${isNodeOverridden}"> + <select class="setting-input" name="${it.SLAVE_KEY}"> <j:forEach var="s" items="${app.labels}"> <j:if test="${s.isAssignable()}"> <f:option selected="${s==it.assignedLabel}" value="${s.name}">${s.name} @@ -66,9 +71,11 @@ </select> </f:entry> </f:radioBlock> - <f:radioBlock name="affinityChooser" value="advanced" title="${%Advanced Node and Label expressions}" - checked="${it.advancedAffinityChooser and it.assignedLabel!=null}"> - <f:entry title="${%Label Expression}" field="assignedLabelString"> + <f:radioBlock name="${it.AFFINITY_CHO0SER_KEY}" value="advanced" title="${%Advanced Node and Label expressions}" + checked="${it.advancedAffinityChooser and it.assignedLabel!=null}" + isPropertyOverridden="${isNodeOverridden}"> + <f:entry title="${%Label Expression}" field="assignedLabelString" + isPropertyOverridden="${isNodeOverridden}"> <f:textbox/> </f:entry> </f:radioBlock> diff --git a/hudson-core/src/test/java/hudson/model/AppointedNodeEqualsHashCodeTest.java b/hudson-core/src/test/java/hudson/model/AppointedNodeEqualsHashCodeTest.java new file mode 100644 index 0000000..4fdfad4 --- a/dev/null +++ b/hudson-core/src/test/java/hudson/model/AppointedNodeEqualsHashCodeTest.java @@ -0,0 +1,65 @@ +/******************************************************************************* + * + * 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 hudson.model; + +import java.util.Arrays; +import java.util.Collection; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; + +import static junit.framework.Assert.assertEquals; + +/** + * Test for equals() and hashCode methods of {@link AppointedNode}. + * + * Date: 11/2/11 + */ +@RunWith(Parameterized.class) +public class AppointedNodeEqualsHashCodeTest { + + private boolean expectedResult; + private AppointedNode node1; + private AppointedNode node2; + + public AppointedNodeEqualsHashCodeTest(boolean expectedResult, AppointedNode node1, AppointedNode node2) { + this.expectedResult = expectedResult; + this.node1 = node1; + this.node2 = node2; + } + + @Parameterized.Parameters + public static Collection generateData() { + return Arrays.asList(new Object[][] { + {true, new AppointedNode("node", true), new AppointedNode("node", true)}, + {false, new AppointedNode("node", true), new AppointedNode("node2", true)}, + {false, new AppointedNode("node", true), new AppointedNode(null, true)}, + {false, new AppointedNode("node", false), new AppointedNode("node", true)}, + {false, new AppointedNode("node", true), new AppointedNode("node", null)}, + {true, new AppointedNode(null, false), new AppointedNode(null, false)}, + {true, new AppointedNode("node", null), new AppointedNode("node", null)} + }); + } + + @Test + public void testEquals() { + assertEquals(expectedResult, node1.equals(node2)); + } + + @Test + public void testHashCode() { + assertEquals(expectedResult, node1.hashCode() == node2.hashCode()); + } +} diff --git a/hudson-core/src/test/java/hudson/model/FreeStyleProjectTest.java b/hudson-core/src/test/java/hudson/model/FreeStyleProjectTest.java index d6d3bae..0e5d0d9 100644 --- a/hudson-core/src/test/java/hudson/model/FreeStyleProjectTest.java +++ b/hudson-core/src/test/java/hudson/model/FreeStyleProjectTest.java @@ -15,7 +15,6 @@ package hudson.model; -import com.google.common.collect.Lists; import hudson.matrix.MatrixProject; import hudson.security.AuthorizationMatrixProperty; import hudson.security.AuthorizationStrategy; @@ -56,7 +55,6 @@ public class FreeStyleProjectTest { @Test public void testOnCreatedFromScratch() { Hudson hudson = createMock(Hudson.class); - expect(hudson.getNodes()).andReturn(Lists.<Node>newArrayList()); AuthorizationStrategy authorizationStrategy = createMock(ProjectMatrixAuthorizationStrategy.class); expect(hudson.getAuthorizationStrategy()).andReturn(authorizationStrategy); mockStatic(Hudson.class); @@ -82,7 +80,6 @@ public class FreeStyleProjectTest { @Test public void testOnCreatedFromScratchGlobalMatrixAuthorizationStrategy() { Hudson hudson = createMock(Hudson.class); - expect(hudson.getNodes()).andReturn(Lists.<Node>newArrayList()); AuthorizationStrategy authorizationStrategy = createMock(GlobalMatrixAuthorizationStrategy.class); expect(hudson.getAuthorizationStrategy()).andReturn(authorizationStrategy); mockStatic(Hudson.class); @@ -104,7 +101,6 @@ public class FreeStyleProjectTest { @Test public void testOnCreatedFromScratchAnonymousAuthentication() { Hudson hudson = createMock(Hudson.class); - expect(hudson.getNodes()).andReturn(Lists.<Node>newArrayList()); mockStatic(Hudson.class); expect(Hudson.getInstance()).andReturn(hudson).anyTimes(); mockStatic(User.class); @@ -122,7 +118,6 @@ public class FreeStyleProjectTest { @Test public void testOnCopiedFrom() { Hudson hudson = createMock(Hudson.class); - expect(hudson.getNodes()).andReturn(Lists.<Node>newArrayList()).times(2); AuthorizationStrategy authorizationStrategy = createMock(ProjectMatrixAuthorizationStrategy.class); expect(hudson.getAuthorizationStrategy()).andReturn(authorizationStrategy); mockStatic(Hudson.class); @@ -151,7 +146,6 @@ public class FreeStyleProjectTest { @Test public void testOnCopiedFromGlobalMatrixAuthorizationStrategy() { Hudson hudson = createMock(Hudson.class); - expect(hudson.getNodes()).andReturn(Lists.<Node>newArrayList()).times(2); AuthorizationStrategy authorizationStrategy = createMock(GlobalMatrixAuthorizationStrategy.class); expect(hudson.getAuthorizationStrategy()).andReturn(authorizationStrategy); mockStatic(Hudson.class); @@ -175,7 +169,6 @@ public class FreeStyleProjectTest { @Test public void testOnCopiedFromAnonymousAuthentication() { Hudson hudson = createMock(Hudson.class); - expect(hudson.getNodes()).andReturn(Lists.<Node>newArrayList()).times(2); mockStatic(Hudson.class); expect(Hudson.getInstance()).andReturn(hudson).anyTimes(); mockStatic(User.class); diff --git a/hudson-core/src/test/java/hudson/model/LegacyProjectTest.java b/hudson-core/src/test/java/hudson/model/LegacyProjectTest.java index 70b33c7..d13392a 100644 --- a/hudson-core/src/test/java/hudson/model/LegacyProjectTest.java +++ b/hudson-core/src/test/java/hudson/model/LegacyProjectTest.java @@ -9,7 +9,7 @@ * * Contributors: * - * Nikita Levyankov + * Nikita Levyankov, Anton Kozak * *******************************************************************************/ package hudson.model; @@ -23,6 +23,7 @@ import hudson.triggers.TimerTrigger; import hudson.triggers.Trigger; import hudson.triggers.TriggerDescriptor; import java.io.File; +import java.io.IOException; import java.net.URISyntaxException; import org.eclipse.hudson.api.model.IProjectProperty; import org.eclipse.hudson.api.model.project.property.BooleanProjectProperty; @@ -321,4 +322,21 @@ public class LegacyProjectTest { assertEquals("*/10 * * * *", trigger.getSpec()); verifyAll(); } + + /** + * Tests unmarshalling FreeStyleProject configuration and checks whether assignedNode and advancedAffinityChooser + * properties from AbstractProject are configured. + * + * @throws java.io.IOException if any + */ + @Test + public void testConvertLegacyNodePropertes() throws IOException { + AbstractProject project = (AbstractProject) Items.getConfigFile(config).read(); + project.setAllowSave(false); + project.initProjectProperties(); + assertNull(project.getProperty(AbstractProject.APPOINTED_NODE_PROPERTY_NAME)); + project.convertAppointedNode(); + assertNotNull(project.getProperty(AbstractProject.APPOINTED_NODE_PROPERTY_NAME)); + assertTrue(project.isAdvancedAffinityChooser()); + } } diff --git a/hudson-core/src/test/resources/hudson/model/freestyle/config.xml b/hudson-core/src/test/resources/hudson/model/freestyle/config.xml index d582a06..8fcdc60 100644 --- a/hudson-core/src/test/resources/hudson/model/freestyle/config.xml +++ b/hudson-core/src/test/resources/hudson/model/freestyle/config.xml @@ -12,8 +12,9 @@ <creationTime>1316762043103</creationTime> <quietPeriod>5</quietPeriod> <scmCheckoutRetryCount>5</scmCheckoutRetryCount> - <advancedAffinityChooser>false</advancedAffinityChooser> - <canRoam>true</canRoam> + <assignedNode>node-name</assignedNode> + <advancedAffinityChooser>true</advancedAffinityChooser> + <canRoam>false</canRoam> <disabled>false</disabled> <blockBuildWhenDownstreamBuilding>true</blockBuildWhenDownstreamBuilding> <blockBuildWhenUpstreamBuilding>true</blockBuildWhenUpstreamBuilding> diff --git a/hudson-war/src/main/webapp/help/project-config/parameterized-build.html b/hudson-war/src/main/webapp/help/project-config/parameterized-build.html index 3d8c151..98567b3 100644 --- a/hudson-war/src/main/webapp/help/project-config/parameterized-build.html +++ b/hudson-war/src/main/webapp/help/project-config/parameterized-build.html @@ -1,6 +1,6 @@ <!-- ************************************************************************** # -# Copyright (C) 2004-2009 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 @@ -8,7 +8,7 @@ # http://www.eclipse.org/legal/epl-v10.html # # Contributors: -# Kohsuke Kawaguchi +# Kohsuke Kawaguchi, Anton Kozak # #************************************************************************** --> @@ -25,4 +25,7 @@ <p> See <a href="http://wiki.hudson-ci.org/display/HUDSON/Parameterized+Build">the Wiki topic</a> for more discussions about this feature. + <p> + It's possible to use Project cascading feature for this property. Please review <a href="http://wiki.hudson-ci.org/display/HUDSON/Project+cascading"> + this document</a>. </div> diff --git a/hudson-war/src/main/webapp/help/project-config/parameterized-build_ru.html b/hudson-war/src/main/webapp/help/project-config/parameterized-build_ru.html index 6f10201..24ed4bf 100644 --- a/hudson-war/src/main/webapp/help/project-config/parameterized-build_ru.html +++ b/hudson-war/src/main/webapp/help/project-config/parameterized-build_ru.html @@ -24,4 +24,7 @@ <p> Для получения деталей по этой функции используйте <a href="http://wiki.hudson-ci.org/display/HUDSON/Parameterized+Build">Wiki раздел</a>. + <p> + Для этого свойства возможно использовать Проектное каскадирование. Детали доступны в <a href="http://wiki.hudson-ci.org/display/HUDSON/Project+cascading"> + этом документе</a>. </div>
\ No newline at end of file diff --git a/hudson-war/src/main/webapp/help/project-config/slave.html b/hudson-war/src/main/webapp/help/project-config/slave.html index de55c11..1d677a9 100644 --- a/hudson-war/src/main/webapp/help/project-config/slave.html +++ b/hudson-war/src/main/webapp/help/project-config/slave.html @@ -1,6 +1,6 @@ <!-- ************************************************************************** # -# Copyright (C) 2004-2009 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 @@ -8,7 +8,7 @@ # http://www.eclipse.org/legal/epl-v10.html # # Contributors: -# Kohsuke Kawaguchi +# Kohsuke Kawaguchi, Anton Kozak # #************************************************************************** --> @@ -28,4 +28,7 @@ <p> This option is also useful when you'd like to make sure that a project can be built on a particular node. -</div> + <p> + It's possible to use Project cascading feature for this property. Please review <a href="http://wiki.hudson-ci.org/display/HUDSON/Project+cascading"> + this document</a>. +</div>
\ No newline at end of file diff --git a/hudson-war/src/main/webapp/help/project-config/slave_ru.html b/hudson-war/src/main/webapp/help/project-config/slave_ru.html index 112b691..11c67c3 100644 --- a/hudson-war/src/main/webapp/help/project-config/slave_ru.html +++ b/hudson-war/src/main/webapp/help/project-config/slave_ru.html @@ -1,6 +1,6 @@ <!-- ************************************************************************** # -# Copyright (C) 2004-2009 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 @@ -8,7 +8,7 @@ # http://www.eclipse.org/legal/epl-v10.html # # Contributors: -# Kohsuke Kawaguchi +# Kohsuke Kawaguchi, Anton Kozak # #************************************************************************** --> @@ -23,4 +23,7 @@ <p> Эта опция также полезна если вы желаете удостовериться в том, что проект может собираться на каком-то конкретном узле. + <p> + It's possible to use Project cascading feature for this property. Please review <a href="http://wiki.hudson-ci.org/display/HUDSON/Project+cascading"> + this document</a>. </div> |

