Search in sources :

Example 1 with CommonsXmlRpcTransport

use of org.apache.xmlrpc.CommonsXmlRpcTransport in project intellij-community by JetBrains.

the class JiraIntegrationTest method createIssueViaXmlRpc.

@SuppressWarnings("UseOfObsoleteCollectionType")
@NotNull
private String createIssueViaXmlRpc(@NotNull String project, @NotNull String summary) throws Exception {
    final URL url = new URL(myRepository.getUrl() + "/rpc/xmlrpc");
    final XmlRpcClient xmlRpcClient = new XmlRpcClient(url);
    final Map<String, Object> issue = new Hashtable<>();
    issue.put("summary", summary);
    issue.put("project", project);
    issue.put("assignee", myRepository.getUsername());
    // Bug
    issue.put("type", 1);
    // Open
    issue.put("state", 1);
    // empty token because of HTTP basic auth
    final Vector<Object> params = new Vector<>(Arrays.asList("", issue));
    final Hashtable result = (Hashtable) xmlRpcClient.execute(new XmlRpcRequest("jira1.createIssue", params), new CommonsXmlRpcTransport(url, myRepository.getHttpClient()));
    return (String) result.get("key");
}
Also used : XmlRpcClient(org.apache.xmlrpc.XmlRpcClient) JsonObject(com.google.gson.JsonObject) XmlRpcRequest(org.apache.xmlrpc.XmlRpcRequest) CommonsXmlRpcTransport(org.apache.xmlrpc.CommonsXmlRpcTransport) URL(java.net.URL) NotNull(org.jetbrains.annotations.NotNull)

Example 2 with CommonsXmlRpcTransport

use of org.apache.xmlrpc.CommonsXmlRpcTransport in project intellij-community by JetBrains.

the class JiraRepository method createLegacyApi.

private JiraLegacyApi createLegacyApi() {
    try {
        XmlRpcClient client = new XmlRpcClient(getUrl());
        Vector<String> parameters = new Vector<>(Collections.singletonList(""));
        XmlRpcRequest request = new XmlRpcRequest("jira1.getServerInfo", parameters);
        @SuppressWarnings("unchecked") Hashtable<String, Object> response = (Hashtable<String, Object>) client.execute(request, new CommonsXmlRpcTransport(new URL(getUrl()), getHttpClient()));
        if (response != null) {
            myJiraVersion = (String) response.get("version");
        }
    } catch (Exception e) {
        LOG.error("Cannot find out JIRA version via XML-RPC", e);
    }
    return new JiraLegacyApi(this);
}
Also used : JiraLegacyApi(com.intellij.tasks.jira.soap.JiraLegacyApi) XmlRpcClient(org.apache.xmlrpc.XmlRpcClient) CommonsXmlRpcTransport(org.apache.xmlrpc.CommonsXmlRpcTransport) URL(java.net.URL) MalformedURLException(java.net.MalformedURLException) XmlRpcRequest(org.apache.xmlrpc.XmlRpcRequest) JsonObject(com.google.gson.JsonObject)

Aggregations

JsonObject (com.google.gson.JsonObject)2 URL (java.net.URL)2 CommonsXmlRpcTransport (org.apache.xmlrpc.CommonsXmlRpcTransport)2 XmlRpcClient (org.apache.xmlrpc.XmlRpcClient)2 XmlRpcRequest (org.apache.xmlrpc.XmlRpcRequest)2 JiraLegacyApi (com.intellij.tasks.jira.soap.JiraLegacyApi)1 MalformedURLException (java.net.MalformedURLException)1 NotNull (org.jetbrains.annotations.NotNull)1