-
-
Notifications
You must be signed in to change notification settings - Fork 282
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
81 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import java.util.ResourceBundle; | ||
|
||
public final class JiraConfig { | ||
|
||
private static final ResourceBundle CONFIG = ResourceBundle | ||
.getBundle("jira"); | ||
|
||
public static String getUrl() { | ||
return CONFIG.getString("url"); | ||
} | ||
|
||
public static String getUsername() { | ||
return CONFIG.getString("username"); | ||
} | ||
|
||
public static String getPassword() { | ||
return CONFIG.getString("password"); | ||
} | ||
} |
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 |
---|---|---|
@@ -1,32 +1,62 @@ | ||
import hudson.plugins.jira.soap.JiraSoapService; | ||
import hudson.plugins.jira.soap.JiraSoapServiceService; | ||
import hudson.plugins.jira.soap.JiraSoapServiceServiceLocator; | ||
import hudson.plugins.jira.soap.RemoteField; | ||
import hudson.plugins.jira.soap.RemoteIssue; | ||
import hudson.plugins.jira.soap.RemoteNamedObject; | ||
import hudson.plugins.jira.soap.RemoteProject; | ||
import hudson.plugins.jira.soap.RemoteStatus; | ||
|
||
import java.net.URL; | ||
|
||
/** | ||
* Test bed to play with JIRA. | ||
* | ||
* | ||
* @author Kohsuke Kawaguchi | ||
*/ | ||
public class JiraTester { | ||
public static void main(String[] args) throws Exception { | ||
JiraSoapServiceService jiraSoapServiceGetter = new JiraSoapServiceServiceLocator(); | ||
|
||
JiraSoapService service = jiraSoapServiceGetter.getJirasoapserviceV2( | ||
new URL("http://issues.apache.org/jira/rpc/soap/jirasoapservice-v2")); | ||
String token = service.login("kohsuke", "kohsuke"); | ||
|
||
// key can be used. | ||
RemoteProject[] projects = service.getProjectsNoSchemes(token); | ||
for (RemoteProject p : projects) { | ||
System.out.println(p.getKey()); | ||
} | ||
|
||
RemoteIssue issue = service.getIssue(token, "JENKINS-1"); | ||
System.out.println(issue); | ||
issue.getSummary(); // gives you title of the issue | ||
} | ||
public static void main(String[] args) throws Exception { | ||
JiraSoapServiceService jiraSoapServiceGetter = new JiraSoapServiceServiceLocator(); | ||
|
||
JiraSoapService service = jiraSoapServiceGetter | ||
.getJirasoapserviceV2(new URL(JiraConfig.getUrl())); | ||
String token = service.login(JiraConfig.getUsername(), | ||
JiraConfig.getPassword()); | ||
|
||
// key can be used. | ||
// RemoteProject[] projects = service.getProjectsNoSchemes(token); | ||
// for (RemoteProject p : projects) { | ||
// System.out.println(p.getKey()); | ||
// } | ||
|
||
String issueId = "TESTPROJEKT-60"; | ||
String actionId = "21"; | ||
|
||
RemoteIssue issue = service.getIssue(token, "TESTPROJEKT-61"); | ||
System.out.println("Issue Status: " + issue.getStatus()); | ||
|
||
RemoteNamedObject[] actions = service.getAvailableActions(token, | ||
issueId); | ||
for (RemoteNamedObject action : actions) { | ||
System.out.println("Action: " + action.getId() + " - " | ||
+ action.getName()); | ||
} | ||
|
||
RemoteField[] actionFields = service.getFieldsForAction(token, issueId, | ||
actionId); | ||
for (RemoteField actionField : actionFields) { | ||
System.out.println("ActionField: " + actionField.getId() + " - " | ||
+ actionField.getName()); | ||
} | ||
|
||
RemoteField[] customFields = service.getCustomFields(token); | ||
for(RemoteField field:customFields){ | ||
System.out.println("Field: "+field.getId() + " - "+field.getName()); | ||
} | ||
|
||
RemoteIssue updatedIssues = service.progressWorkflowAction(token, | ||
issueId, actionId, null); | ||
System.out.println("Issue Status: " + updatedIssues.getStatus()); | ||
|
||
} | ||
} |
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,3 @@ | ||
url=http://host/jira/rpc/soap/jirasoapservice-v2 | ||
username=user | ||
password=passwd |