Search in sources :

Example 11 with XmlRpcRequest

use of org.apache.xmlrpc.XmlRpcRequest 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)

Aggregations

XmlRpcRequest (org.apache.xmlrpc.XmlRpcRequest)11 XmlRpcRequestImpl (org.apache.camel.component.xmlrpc.XmlRpcRequestImpl)5 Test (org.junit.Test)5 MockEndpoint (org.apache.camel.component.mock.MockEndpoint)4 JsonObject (com.google.gson.JsonObject)2 URL (java.net.URL)2 CamelContext (org.apache.camel.CamelContext)2 Converter (org.apache.camel.Converter)2 DefaultCamelContext (org.apache.camel.impl.DefaultCamelContext)2 CommonsXmlRpcTransport (org.apache.xmlrpc.CommonsXmlRpcTransport)2 XmlRpcClient (org.apache.xmlrpc.XmlRpcClient)2 JiraLegacyApi (com.intellij.tasks.jira.soap.JiraLegacyApi)1 IOException (java.io.IOException)1 MalformedURLException (java.net.MalformedURLException)1 SocketTimeoutException (java.net.SocketTimeoutException)1 ServletException (javax.servlet.ServletException)1 Exchange (org.apache.camel.Exchange)1 ProducerTemplate (org.apache.camel.ProducerTemplate)1 RouteBuilder (org.apache.camel.builder.RouteBuilder)1 XmlRpcDataFormat (org.apache.camel.dataformat.xmlrpc.XmlRpcDataFormat)1