Skip to content
Permalink
Browse files
Merge pull request #62 from jglick/dropdownDescriptorSelector-JENKINS…
…-28011

[JENKINS-28011] Using the standard f:dropdownDescriptorSelector
  • Loading branch information
ikedam committed Apr 25, 2015
2 parents d574c00 + 3602ed8 commit ff6073c766284cb2f189975ecfd314d9c5ed4679
Showing with 73 additions and 23 deletions.
  1. +5 −4 src/main/java/hudson/plugins/copyartifact/CopyArtifact.java
  2. +2 −2 src/main/java/hudson/plugins/copyartifact/StatusBuildSelector.java
  3. +2 −2 src/main/java/hudson/plugins/copyartifact/TriggeredBuildSelector.java
  4. +1 −2 src/main/resources/hudson/plugins/copyartifact/CopyArtifact/config.jelly
  5. 0 .../help-buildSelector.html → resources/hudson/plugins/copyartifact/CopyArtifact/help-selector.html}
  6. 0 ...buildSelector_de.html → resources/hudson/plugins/copyartifact/CopyArtifact/help-selector_de.html}
  7. 0 ...buildSelector_ja.html → resources/hudson/plugins/copyartifact/CopyArtifact/help-selector_ja.html}
  8. +27 −0 src/main/resources/hudson/plugins/copyartifact/LastCompletedBuildSelector/config.jelly
  9. +2 −3 src/main/resources/hudson/plugins/copyartifact/ParameterizedBuildSelector/config.jelly
  10. 0 ...ebapp → resources/hudson/plugins/copyartifact/ParameterizedBuildSelector}/help-parameterName.html
  11. 0 ...pp → resources/hudson/plugins/copyartifact/ParameterizedBuildSelector}/help-parameterName_de.html
  12. 0 ...pp → resources/hudson/plugins/copyartifact/ParameterizedBuildSelector}/help-parameterName_ja.html
  13. +27 −0 src/main/resources/hudson/plugins/copyartifact/SavedBuildSelector/config.jelly
  14. +2 −2 src/main/resources/hudson/plugins/copyartifact/SpecificBuildSelector/config.jelly
  15. 0 ...icBuild.html → resources/hudson/plugins/copyartifact/SpecificBuildSelector/help-buildNumber.html}
  16. +2 −3 src/main/resources/hudson/plugins/copyartifact/StatusBuildSelector/config.jelly
  17. +2 −3 src/main/resources/hudson/plugins/copyartifact/TriggeredBuildSelector/config.jelly
  18. +1 −1 src/test/java/hudson/plugins/copyartifact/BuildSelectorParameterTest.java
  19. +0 −1 src/test/java/hudson/plugins/copyartifact/CopyArtifactTest.java
@@ -26,7 +26,6 @@
import com.thoughtworks.xstream.converters.UnmarshallingContext;

import hudson.AbortException;
import hudson.DescriptorExtensionList;
import hudson.EnvVars;
import hudson.Extension;
import hudson.FilePath;
@@ -268,10 +267,15 @@ public String getParameters() {
return parameters;
}

@Deprecated
public BuildSelector getBuildSelector() {
return selector;
}

public BuildSelector getSelector() {
return selector;
}

public String getFilter() {
return filter;
}
@@ -523,9 +527,6 @@ public String getDisplayName() {
return Messages.CopyArtifact_DisplayName();
}

public DescriptorExtensionList<BuildSelector,Descriptor<BuildSelector>> getBuildSelectors() {
return Hudson.getInstance().<BuildSelector,Descriptor<BuildSelector>>getDescriptorList(BuildSelector.class);
}
}

// Listen for project renames and update property here if needed.
@@ -38,8 +38,8 @@
private Boolean stable;

@DataBoundConstructor
public StatusBuildSelector(boolean stableOnly) {
this.stable = stableOnly ? Boolean.TRUE : null;
public StatusBuildSelector(boolean stable) {
this.stable = stable ? Boolean.TRUE : null;
}

public boolean isStable() {
@@ -95,8 +95,8 @@ public boolean isForGlobalSetting() {
private final UpstreamFilterStrategy upstreamFilterStrategy;

@DataBoundConstructor
public TriggeredBuildSelector(boolean fallback, UpstreamFilterStrategy upstreamFilterStrategy) {
this.fallbackToLastSuccessful = fallback ? Boolean.TRUE : null;
public TriggeredBuildSelector(boolean fallbackToLastSuccessful, UpstreamFilterStrategy upstreamFilterStrategy) {
this.fallbackToLastSuccessful = fallbackToLastSuccessful ? Boolean.TRUE : null;
this.upstreamFilterStrategy = upstreamFilterStrategy;
}

@@ -26,8 +26,7 @@ THE SOFTWARE.
<f:entry title="${%Project name}" field="projectName">
<f:editableComboBox items="${app.topLevelItemNames}" clazz="setting-input"/>
</f:entry>
<ca:selectorList currentSelector="${instance.buildSelector}"
name="selector" title="${%Which build}"/>
<f:dropdownDescriptorSelector field="selector" title="${%Which build}"/>
<f:entry title="${%Artifacts to copy}" field="filter">
<f:textbox/>
</f:entry>
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
The MIT License
Copyright 2015 Jesse Glick.
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.
-->

<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core"/>
@@ -23,8 +23,7 @@ THE SOFTWARE.
-->
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:f="/lib/form">
<f:entry title="${%Parameter Name}" help="/plugin/copyartifact/help-parameterName.html">
<f:textbox clazz="required" name="parameterName" value="${selector.parameterName}"
default="BUILD_SELECTOR"/>
<f:entry field="parameterName" title="${%Parameter Name}">
<f:textbox clazz="required" default="BUILD_SELECTOR"/>
</f:entry>
</j:jelly>
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
The MIT License
Copyright 2015 Jesse Glick.
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.
-->

<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core"/>
@@ -23,7 +23,7 @@ THE SOFTWARE.
-->
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:f="/lib/form">
<f:entry title="${%Build number}" help="/plugin/copyartifact/help-specificBuild.html">
<f:textbox name="buildNumber" value="${selector.buildNumber}"/>
<f:entry field="buildNumber" title="${%Build number}">
<f:textbox/>
</f:entry>
</j:jelly>
File renamed without changes.
@@ -23,8 +23,7 @@ THE SOFTWARE.
-->
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:f="/lib/form">
<f:entry title="">
<f:checkbox name="stableOnly" checked="${selector.isStable()}"/>
<label class="attach-previous">${%Stable build only}</label>
<f:entry field="stable">
<f:checkbox title="${%Stable build only}"/>
</f:entry>
</j:jelly>
@@ -23,9 +23,8 @@ THE SOFTWARE.
-->
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:f="/lib/form">
<f:entry title="">
<f:checkbox name="fallback" checked="${selector.isFallbackToLastSuccessful()}"/>
<label class="attach-previous">${%Use "Last successful build" as fallback}</label>
<f:entry field="fallbackToLastSuccessful">
<f:checkbox title="${%Use &quot;Last successful build&quot; as fallback}"/>
</f:entry>
<f:advanced>
<f:entry field="upstreamFilterStrategy" title="${%Which for multiple upstream}">
@@ -59,7 +59,7 @@ public void testParameter() throws Exception {
wc.setPrintContentOnFailingStatusCode(false);
HtmlForm form = wc.getPage(job, "build").getFormByName("parameters");
form.getSelectByName("").getOptionByText("Specific build").setSelected(true);
form.getInputByName("buildNumber").setValueAttribute("6");
form.getInputByName("_.buildNumber").setValueAttribute("6");
submit(form);
Queue.Item q = hudson.getQueue().getItem(job);
if (q != null) q.getFuture().get();
@@ -1160,7 +1160,6 @@ public void testFieldValidation() throws Exception {
// Other descriptor methods
assertTrue(descriptor.isApplicable(null));
assertTrue(descriptor.getDisplayName().length() > 0);
assertTrue(descriptor.getBuildSelectors().size() > 0);
}

@LocalData

0 comments on commit ff6073c

Please sign in to comment.