Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
JENKINS-32170 - add Cli Parameter submission for JiraIssueParameterDe…
…finition
- Loading branch information
Showing
4 changed files
with
75 additions
and
18 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
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
54 changes: 54 additions & 0 deletions
54
src/test/java/hudson/plugins/jira/listissuesparameter/CliParameterTests.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,54 @@ | ||
package hudson.plugins.jira.listissuesparameter; | ||
|
||
import hudson.cli.BuildCommand; | ||
import hudson.cli.CLICommandInvoker; | ||
import hudson.model.FreeStyleProject; | ||
import hudson.model.ParametersDefinitionProperty; | ||
import hudson.plugins.jira.versionparameter.JiraVersionParameterDefinition; | ||
import org.junit.Rule; | ||
import org.junit.Test; | ||
import org.junit.rules.TemporaryFolder; | ||
import org.jvnet.hudson.test.JenkinsRule; | ||
|
||
import static org.junit.Assert.*; | ||
import static hudson.cli.CLICommandInvoker.Matcher.*; | ||
|
||
|
||
public class CliParameterTests { | ||
|
||
@Rule | ||
public JenkinsRule jenkins = new JenkinsRule(); | ||
|
||
@Rule | ||
public TemporaryFolder temporaryFolderRule = new TemporaryFolder(); | ||
|
||
@Test | ||
public void testJiraIssueParameterViaCli() throws Exception { | ||
FreeStyleProject project = jenkins.createFreeStyleProject(); | ||
|
||
project.addProperty( | ||
new ParametersDefinitionProperty( | ||
new JiraIssueParameterDefinition("jiraissue","description","filter") | ||
) | ||
); | ||
|
||
CLICommandInvoker invoker = new CLICommandInvoker(jenkins, new BuildCommand()); | ||
CLICommandInvoker.Result result = invoker.invokeWithArgs(project.getName(),"-p","jiraissue=TEST-1"); | ||
assertThat(result, succeeded()); | ||
} | ||
|
||
@Test | ||
public void testJiraVersionParameterViaCli() throws Exception { | ||
FreeStyleProject project = jenkins.createFreeStyleProject(); | ||
|
||
project.addProperty( | ||
new ParametersDefinitionProperty( | ||
new JiraVersionParameterDefinition("jiraversion","description","PROJ","RELEASE","true","false") | ||
) | ||
); | ||
|
||
CLICommandInvoker invoker = new CLICommandInvoker(jenkins, new BuildCommand()); | ||
CLICommandInvoker.Result result = invoker.invokeWithArgs(project.getName(),"-p","jiraversion=1.0"); | ||
assertThat(result, succeeded()); | ||
} | ||
} |