diff --git a/core/src/main/java/hudson/model/Hudson.java b/core/src/main/java/hudson/model/Hudson.java index fbd44d29a36d0234af3047a31bc54d93b0530167..fa671576a85c75a090037a791f0b520d55bfc719 100644 --- a/core/src/main/java/hudson/model/Hudson.java +++ b/core/src/main/java/hudson/model/Hudson.java @@ -1240,10 +1240,6 @@ public final class Hudson extends Node implements ItemGroup, Stapl return nodeProperties; } - public void setNodeProperties(Collection> nodeProperties) throws IOException { - this.nodeProperties.replaceBy(nodeProperties); - } - /** * Resets all labels and remove invalid ones. */ diff --git a/core/src/main/java/hudson/model/Node.java b/core/src/main/java/hudson/model/Node.java index cb900209a158737d2fb2c964f98915c196bc02e7..8b5af18c73dbfecdb5696d5f95cc885f4a4f903d 100644 --- a/core/src/main/java/hudson/model/Node.java +++ b/core/src/main/java/hudson/model/Node.java @@ -186,18 +186,13 @@ public abstract class Node extends AbstractModelObject implements Describable, NodePropertyDescriptor> getNodeProperties(); - - public abstract void setNodeProperties(Collection> nodeProperties) throws IOException; public > N getNodeProperty(Class clazz) { - for (NodeProperty p: getNodeProperties()) { - if (clazz.isInstance(p)) { - return clazz.cast(p); - } - } - return null; + return getNodeProperties().get(clazz); } public ACL getACL() { diff --git a/core/src/main/java/hudson/model/Slave.java b/core/src/main/java/hudson/model/Slave.java index a3795649fadd3b1b5ecdb4c2495037ba604247b1..163ca5b0b094c9f9c75cf61a49eae9d3851b3be8 100644 --- a/core/src/main/java/hudson/model/Slave.java +++ b/core/src/main/java/hudson/model/Slave.java @@ -214,10 +214,6 @@ public abstract class Slave extends Node implements Serializable { return nodeProperties; } - public void setNodeProperties(Collection> nodeProperties) throws IOException { - this.nodeProperties.replaceBy(nodeProperties); - } - public RetentionStrategy getRetentionStrategy() { return retentionStrategy == null ? RetentionStrategy.Always.INSTANCE : retentionStrategy; } diff --git a/core/src/test/java/hudson/slaves/NodeListTest.java b/core/src/test/java/hudson/slaves/NodeListTest.java index cad3fabd4b424597ac360e0ef7f0416ffb62e519..0f792c755f631ca5f2febc22bf2bb0b97d702245 100644 --- a/core/src/test/java/hudson/slaves/NodeListTest.java +++ b/core/src/test/java/hudson/slaves/NodeListTest.java @@ -106,12 +106,6 @@ public class NodeListTest extends TestCase { public DescribableList, NodePropertyDescriptor> getNodeProperties() { throw new UnsupportedOperationException(); } - - @Override - public void setNodeProperties(Collection> nodeProperties) - throws IOException { - throw new UnsupportedOperationException(); - } } static class EphemeralNode extends DummyNode implements hudson.slaves.EphemeralNode { public Cloud getCloud() { diff --git a/test/src/test/java/hudson/model/AbstractBuildTest.java b/test/src/test/java/hudson/model/AbstractBuildTest.java index 5d2bb5b8936a151d43eb0975314f76158fbb8c56..b7dded42c0068be020d13d53b2b6a70f26d8dd5c 100644 --- a/test/src/test/java/hudson/model/AbstractBuildTest.java +++ b/test/src/test/java/hudson/model/AbstractBuildTest.java @@ -17,9 +17,8 @@ public class AbstractBuildTest extends HudsonTestCase { public void testVariablesResolved() throws Exception { FreeStyleProject project = createFreeStyleProject(); - Hudson.getInstance().setNodeProperties( - Collections - .>singleton(new EnvironmentVariablesNodeProperty( + Hudson.getInstance().getNodeProperties().replaceBy( + Collections.singleton(new EnvironmentVariablesNodeProperty( new Entry("KEY1", "value"), new Entry("KEY2", "$KEY1")))); CaptureEnvironmentBuilder builder = new CaptureEnvironmentBuilder();