提交 bb7cfd94 编写于 作者: K Kohsuke Kawaguchi

Merge branch 'master' of github.com:jenkinsci/jenkins

...@@ -719,7 +719,7 @@ public class MatrixProject extends AbstractProject<MatrixProject,MatrixBuild> im ...@@ -719,7 +719,7 @@ public class MatrixProject extends AbstractProject<MatrixProject,MatrixBuild> im
buildWrappers.rebuild(req, json, BuildWrappers.getFor(this)); buildWrappers.rebuild(req, json, BuildWrappers.getFor(this));
builders.rebuildHetero(req, json, Builder.all(), "builder"); builders.rebuildHetero(req, json, Builder.all(), "builder");
publishers.rebuild(req, json, BuildStepDescriptor.filter(Publisher.all(),this.getClass())); publishers.rebuildHetero(req, json, Publisher.all(), "publisher");
rebuildConfigurations(); rebuildConfigurations();
} }
......
...@@ -200,7 +200,7 @@ public abstract class Project<P extends Project<P,B>,B extends Build<P,B>> ...@@ -200,7 +200,7 @@ public abstract class Project<P extends Project<P,B>,B extends Build<P,B>>
buildWrappers.rebuild(req,json, BuildWrappers.getFor(this)); buildWrappers.rebuild(req,json, BuildWrappers.getFor(this));
builders.rebuildHetero(req,json, Builder.all(), "builder"); builders.rebuildHetero(req,json, Builder.all(), "builder");
publishers.rebuild(req, json, BuildStepDescriptor.filter(Publisher.all(), this.getClass())); publishers.rebuildHetero(req, json, Publisher.all(), "publisher");
} }
@Override @Override
......
...@@ -83,5 +83,5 @@ THE SOFTWARE. ...@@ -83,5 +83,5 @@ THE SOFTWARE.
<p:config-buildWrappers /> <p:config-buildWrappers />
<p:config-builders /> <p:config-builders />
<p:config-publishers /> <p:config-publishers2 />
</j:jelly> </j:jelly>
...@@ -35,5 +35,5 @@ THE SOFTWARE. ...@@ -35,5 +35,5 @@ THE SOFTWARE.
<p:config-buildWrappers /> <p:config-buildWrappers />
<p:config-builders /> <p:config-builders />
<p:config-publishers /> <p:config-publishers2 />
</j:jelly> </j:jelly>
\ No newline at end of file
...@@ -27,15 +27,11 @@ THE SOFTWARE. ...@@ -27,15 +27,11 @@ THE SOFTWARE.
--> -->
<?jelly escape-by-default='true'?> <?jelly escape-by-default='true'?>
<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:p="/lib/hudson/project"> <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:p="/lib/hudson/project">
<f:section title="${%Post-build Actions}"> <st:documentation>
<f:block> Deprecated as of 1.463. Use &lt;config-publishers2> and update your code to do
<f:hetero-list name="publisher" hasHeader="true" publishers.rebuildHetero(req, json, Publisher.all(), "publisher");
descriptors="${h.getPublisherDescriptors(it)}" </st:documentation>
items="${it.publishersList}" <f:descriptorList title="${%Post-build Actions}"
oneEach="true" descriptors="${h.getPublisherDescriptors(it)}"
menuAlign="bl-tl" instances="${it.publishers}" />
honorOrder="true"
addCaption="${%Add post-build action}"/>
</f:block>
</f:section>
</j:jelly> </j:jelly>
\ No newline at end of file
<!--
The MIT License
Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-->
<!--
Publisher config pane
-->
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:f="/lib/form">
<f:section title="${%Post-build Actions}">
<f:block>
<f:hetero-list name="publisher" hasHeader="true"
descriptors="${h.getPublisherDescriptors(it)}"
items="${it.publishersList}"
oneEach="true"
menuAlign="bl-tl"
honorOrder="true"
addCaption="${%Add post-build action}"/>
</f:block>
</f:section>
</j:jelly>
\ No newline at end of file
# The MIT License
#
# Copyright (c) 2004-2010, Sun Microsystems, Inc. Kohsuke Kawaguchi. Knud Poulsen.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
Post-build\ Actions=Post-byg Handlinger
# The MIT License
#
# Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi, Simon Wiest
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
Post-build\ Actions=Post-Build-Aktionen
# The MIT License
#
# Copyright (c) 2004-2010, Sun Microsystems, Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
Post-build\ Actions=Acciones para ejecutar después.
# The MIT License
#
# Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi, Eric Lefevre-Ardant
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
Post-build\ Actions=Actions à la suite du build
# The MIT License
#
# Copyright (c) 2004-2010, Sun Microsystems, Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
Post-build\ Actions=Azioni dopo la build
# The MIT License
#
# Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
Post-build\ Actions=\u30d3\u30eb\u30c9\u5f8c\u306e\u51e6\u7406
# The MIT License
#
# Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi, id:sorokh
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
Post-build\ Actions=Acties na bouwpoging
\ No newline at end of file
# The MIT License
#
# Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi, Reginaldo L. Russinholi, Cleiber Silva
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
Post-build\ Actions=A\u00e7\u00f5es p\u00f3s-constru\u00e7\u00e3o
# The MIT License
#
# Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi, Mike Salnikov
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
Post-build\ Actions=\u041f\u043e\u0441\u043b\u0435\u0441\u0431\u043e\u0440\u043e\u0447\u043d\u044b\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438
# The MIT License
#
# Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi, Oguz Dag
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
Post-build\ Actions=Yap\u0131land\u0131rma-sonras\u0131 Aksiyonlar
# The MIT License
#
# Copyright (c) 2004-2010, Sun Microsystems, Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
Post-build\ Actions=\u6784\u5EFA\u540E\u64CD\u4F5C
...@@ -1042,7 +1042,7 @@ public class MavenModuleSet extends AbstractMavenProject<MavenModuleSet,MavenMod ...@@ -1042,7 +1042,7 @@ public class MavenModuleSet extends AbstractMavenProject<MavenModuleSet,MavenMod
processPlugins = req.hasParameter( "maven.processPlugins" ); processPlugins = req.hasParameter( "maven.processPlugins" );
mavenValidationLevel = NumberUtils.toInt( req.getParameter( "maven.validationLevel" ), -1 ); mavenValidationLevel = NumberUtils.toInt( req.getParameter( "maven.validationLevel" ), -1 );
reporters.rebuild(req,json,MavenReporters.getConfigurableList()); reporters.rebuild(req,json,MavenReporters.getConfigurableList());
publishers.rebuild(req,json,BuildStepDescriptor.filter(Publisher.all(),this.getClass())); publishers.rebuildHetero(req, json, Publisher.all(), "publisher");
buildWrappers.rebuild(req,json,BuildWrappers.getFor(this)); buildWrappers.rebuild(req,json,BuildWrappers.getFor(this));
settingConfigId = req.getParameter( "maven.mavenSettingsConfigId" ); settingConfigId = req.getParameter( "maven.mavenSettingsConfigId" );
globalSettingConfigId = req.getParameter( "maven.mavenGlobalSettingConfigId" ); globalSettingConfigId = req.getParameter( "maven.mavenGlobalSettingConfigId" );
......
...@@ -167,5 +167,5 @@ THE SOFTWARE. ...@@ -167,5 +167,5 @@ THE SOFTWARE.
<p:config-buildWrappers /> <p:config-buildWrappers />
<p:config-publishers /> <p:config-publishers2 />
</j:jelly> </j:jelly>
...@@ -53,23 +53,19 @@ public class Operation2174Test extends HudsonTestCase { ...@@ -53,23 +53,19 @@ public class Operation2174Test extends HudsonTestCase {
HtmlForm form = page.getFormByName("config"); HtmlForm form = page.getFormByName("config");
// configure downstream build // configure downstream build
DescriptorImpl btd = hudson.getDescriptorByType(DescriptorImpl.class); up.getPublishersList().add(new BuildTrigger("dp",false));
form.getInputByName(btd.getJsonSafeClassName()).click(); configRoundtrip(up);
form.getInputByName("buildTrigger.childProjects").setValueAttribute("dp");
submit(form);
// verify that the relationship is set up // verify that the relationship is set up
BuildTrigger trigger = up.getPublishersList().get(BuildTrigger.class); BuildTrigger trigger = up.getPublishersList().get(BuildTrigger.class);
assertEquals(trigger.getChildProjects(), Collections.singletonList(dp)); assertEquals(trigger.getChildProjects(up), Collections.singletonList(dp));
// now go ahead and edit the downstream // now go ahead and edit the downstream
page = webClient.getPage(dp,"configure"); configRoundtrip(dp);
form = page.getFormByName("config");
submit(form);
// verify that the relationship is set up // verify that the relationship is set up
trigger = up.getPublishersList().get(BuildTrigger.class); trigger = up.getPublishersList().get(BuildTrigger.class);
assertNotNull(trigger); assertNotNull(trigger);
assertEquals(trigger.getChildProjects(), Collections.singletonList(dp)); assertEquals(trigger.getChildProjects(up), Collections.singletonList(dp));
} }
} }
package hudson.model; package hudson.model;
import hudson.Functions;
import hudson.tasks.BuildStepMonitor;
import org.jvnet.hudson.test.HudsonTestCase; import org.jvnet.hudson.test.HudsonTestCase;
import com.gargoylesoftware.htmlunit.html.HtmlPage; import com.gargoylesoftware.htmlunit.html.HtmlPage;
import com.gargoylesoftware.htmlunit.html.HtmlAnchor; import com.gargoylesoftware.htmlunit.html.HtmlAnchor;
...@@ -33,8 +35,9 @@ public class HelpLinkTest extends HudsonTestCase { ...@@ -33,8 +35,9 @@ public class HelpLinkTest extends HudsonTestCase {
clickAllHelpLinks(createMatrixProject()); clickAllHelpLinks(createMatrixProject());
} }
private void clickAllHelpLinks(Job j) throws Exception { private void clickAllHelpLinks(AbstractProject j) throws Exception {
clickAllHelpLinks(new WebClient().getPage(j,"configure")); // TODO: how do we add all the builders and publishers so that we can test this meaningfully?
clickAllHelpLinks(new WebClient().getPage(j, "configure"));
} }
private void clickAllHelpLinks(HtmlPage p) throws Exception { private void clickAllHelpLinks(HtmlPage p) throws Exception {
...@@ -46,7 +49,7 @@ public class HelpLinkTest extends HudsonTestCase { ...@@ -46,7 +49,7 @@ public class HelpLinkTest extends HudsonTestCase {
helpLink.click(); helpLink.click();
} }
public static class HelpNotFoundBuilder extends Builder { public static class HelpNotFoundBuilder extends Publisher {
public static final class DescriptorImpl extends BuildStepDescriptor { public static final class DescriptorImpl extends BuildStepDescriptor {
public boolean isApplicable(Class jobType) { public boolean isApplicable(Class jobType) {
return true; return true;
...@@ -61,6 +64,10 @@ public class HelpLinkTest extends HudsonTestCase { ...@@ -61,6 +64,10 @@ public class HelpLinkTest extends HudsonTestCase {
return "I don't have the help file"; return "I don't have the help file";
} }
} }
public BuildStepMonitor getRequiredMonitorService() {
return BuildStepMonitor.BUILD;
}
} }
/** /**
...@@ -71,7 +78,9 @@ public class HelpLinkTest extends HudsonTestCase { ...@@ -71,7 +78,9 @@ public class HelpLinkTest extends HudsonTestCase {
DescriptorImpl d = new DescriptorImpl(); DescriptorImpl d = new DescriptorImpl();
Publisher.all().add(d); Publisher.all().add(d);
try { try {
clickAllHelpLinks(createFreeStyleProject()); FreeStyleProject p = createFreeStyleProject();
p.getPublishersList().add(new HelpNotFoundBuilder());
clickAllHelpLinks(p);
fail("should detect a failure"); fail("should detect a failure");
} catch(AssertionError e) { } catch(AssertionError e) {
if(e.getMessage().contains(d.getHelpFile())) if(e.getMessage().contains(d.getHelpFile()))
......
...@@ -90,11 +90,13 @@ public class MailerTest extends HudsonTestCase { ...@@ -90,11 +90,13 @@ public class MailerTest extends HudsonTestCase {
verifyRoundtrip(m); verifyRoundtrip(m);
} }
private void verifyRoundtrip(Mailer m) throws Exception { private void verifyRoundtrip(Mailer before) throws Exception {
FreeStyleProject p = createFreeStyleProject(); FreeStyleProject p = createFreeStyleProject();
p.getPublishersList().add(m); p.getPublishersList().add(before);
submit(new WebClient().getPage(p,"configure").getFormByName("config")); submit(new WebClient().getPage(p,"configure").getFormByName("config"));
assertEqualBeans(m,p.getPublishersList().get(Mailer.class),"recipients,dontNotifyEveryUnstableBuild,sendToIndividuals"); Mailer after = p.getPublishersList().get(Mailer.class);
assertNotSame(before,after);
assertEqualBeans(before,after,"recipients,dontNotifyEveryUnstableBuild,sendToIndividuals");
} }
public void testGlobalConfigRoundtrip() throws Exception { public void testGlobalConfigRoundtrip() throws Exception {
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
package hudson.util; package hudson.util;
import hudson.model.FreeStyleProject; import hudson.model.FreeStyleProject;
import hudson.tasks.BuildStepMonitor;
import hudson.tasks.Builder; import hudson.tasks.Builder;
import hudson.tasks.BuildStepDescriptor; import hudson.tasks.BuildStepDescriptor;
import hudson.tasks.Publisher; import hudson.tasks.Publisher;
...@@ -43,7 +44,7 @@ public class FormFieldValidatorTest extends HudsonTestCase { ...@@ -43,7 +44,7 @@ public class FormFieldValidatorTest extends HudsonTestCase {
new WebClient().getPage(p,"configure"); new WebClient().getPage(p,"configure");
} }
public static class BrokenFormValidatorBuilder extends Builder { public static class BrokenFormValidatorBuilder extends Publisher {
public static final class DescriptorImpl extends BuildStepDescriptor { public static final class DescriptorImpl extends BuildStepDescriptor {
public boolean isApplicable(Class jobType) { public boolean isApplicable(Class jobType) {
return true; return true;
...@@ -57,6 +58,10 @@ public class FormFieldValidatorTest extends HudsonTestCase { ...@@ -57,6 +58,10 @@ public class FormFieldValidatorTest extends HudsonTestCase {
return "I have broken form field validation"; return "I have broken form field validation";
} }
} }
public BuildStepMonitor getRequiredMonitorService() {
return BuildStepMonitor.BUILD;
}
} }
/** /**
...@@ -68,6 +73,7 @@ public class FormFieldValidatorTest extends HudsonTestCase { ...@@ -68,6 +73,7 @@ public class FormFieldValidatorTest extends HudsonTestCase {
Publisher.all().add(d); Publisher.all().add(d);
try { try {
FreeStyleProject p = createFreeStyleProject(); FreeStyleProject p = createFreeStyleProject();
p.getPublishersList().add(new BrokenFormValidatorBuilder());
new WebClient().getPage(p,"configure"); new WebClient().getPage(p,"configure");
fail("should have failed"); fail("should have failed");
} catch(AssertionError e) { } catch(AssertionError e) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册