Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Parameter provider of Base64EncodedString is implemented for Rebuilder.
The new provider class helps rebuild plugin to correctly display Base64EncodedString parameters. When rebuilder plugin rebuilt a Gerrit event triggered build, the parameters page was not displayed properly without this provider class. matrix_build.xml is modified to pass a failed test after changing dependency of Rebuild from v1.1 to v1.22. Please consider the following test scenario of the provider class: Given a Jenkins instance And Gerrit Trigger plugin installed on that Jenkins And an existing Gerrit instance configured on that Jenkins And Parameterized Trigger plugin installed on that Jenkins And Rebuilder plugin installed on that Jenkins And an upstream job that is triggered by Gerrit events And 'Commit message as human readable' is NOT set in the upstream job And once a build is finished, upstream job triggers a parameterized build of downstream job with 'current parameters' When upstream job is triggered by a Gerrit event And the first build of both job completes And GERRIT_CHANGE_COMMIT_MESSAGE parameter is displayed properly in first build of both jobs And I rebuild the first build of the downstream job Then the second build of downstream job should complete And GERRIT_CHANGE_COMMIT_MESSAGE parameter is displayed properly in second build of the downstream job The test scenario is beyond scope of a unit test as it requires multiple plugins preinstalled and it tests compatibility of these plugins. Therefore its test should be written in Jenkins ATH rather than in Gerrit Trigger project. Our goal is to add such a test to ATH in the near future. [FIXED JENKINS-26756]
- Loading branch information
Bowen Cheng
committed
Feb 3, 2015
1 parent
e8a0862
commit 3d956c2
Showing
5 changed files
with
63 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
...plugins/gerrit/trigger/hudsontrigger/parameters/Base64EncodedStringParameterProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/* | ||
* The MIT License | ||
* | ||
* Copyright (c) 2014 Ericsson | ||
* | ||
* 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. | ||
*/ | ||
|
||
package com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.parameters; | ||
|
||
import hudson.Extension; | ||
import hudson.model.ParameterValue; | ||
|
||
import com.sonyericsson.rebuild.RebuildParameterPage; | ||
import com.sonyericsson.rebuild.RebuildParameterProvider; | ||
|
||
/** | ||
* An extension class to inject {@link Base64EncodedStringParameterProvider} to rebuild-plugin. | ||
* | ||
* @author Scott.Hebert <Scott.Hebert@ericsson.com>. | ||
* @author Bowen.Cheng <Bowen.Cheng@ericsson.com>. | ||
*/ | ||
@Extension(optional = true) | ||
public class Base64EncodedStringParameterProvider extends RebuildParameterProvider { | ||
/** | ||
* @param value ParameterValue to have rebuild page created for it. | ||
* @return rebuild page for Base64EncodedStringParameterValue | ||
* @see com.sonyericsson.rebuild.RebuildParameterProvider#getRebuildPage(hudson.model.ParameterValue) | ||
*/ | ||
@Override | ||
public RebuildParameterPage getRebuildPage(ParameterValue value) { | ||
if (value instanceof Base64EncodedStringParameterValue) { | ||
return new RebuildParameterPage(Base64EncodedStringParameterValue.class, | ||
"Base64EncodedStringParameterValue.jelly"); | ||
} | ||
|
||
return null; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters