IDEA-75975 Wrong coding in Open Task from

This commit is contained in:
Dmitry Avdeev
2012-01-26 17:50:13 +04:00
parent 272f420d1f
commit d35c11949e
3 changed files with 65 additions and 5 deletions
@@ -23,10 +23,7 @@ import com.intellij.tasks.impl.BaseRepositoryImpl;
import com.intellij.tasks.impl.LocalTaskImpl;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.xmlb.annotations.Tag;
import org.apache.xmlrpc.CommonsXmlRpcTransport;
import org.apache.xmlrpc.XmlRpcClient;
import org.apache.xmlrpc.XmlRpcException;
import org.apache.xmlrpc.XmlRpcRequest;
import org.apache.xmlrpc.*;
import org.jetbrains.annotations.Nullable;
import java.io.IOException;
@@ -41,6 +38,10 @@ import java.util.*;
@SuppressWarnings({"UseOfObsoleteCollectionType", "unchecked"})
public class TracRepository extends BaseRepositoryImpl {
static {
XmlRpc.setDefaultInputEncoding("UTF-8");
}
private String myDefaultSearch = "status!=closed&owner={username}&summary~={query}";
private Boolean myMaxSupported;
@@ -96,7 +97,7 @@ public class TracRepository extends BaseRepositoryImpl {
}
private XmlRpcClient getRpcClient() throws MalformedURLException {
return new XmlRpcClient(new URL(getUrl()));
return new XmlRpcClient(getUrl());
}
@Override
@@ -14,6 +14,8 @@
<orderEntry type="library" scope="TEST" name="JUnit4" level="project" />
<orderEntry type="module" module-name="testFramework-java" scope="TEST" />
<orderEntry type="module" module-name="vcs-impl" />
<orderEntry type="library" name="XmlRPC" level="project" />
<orderEntry type="module" module-name="spellchecker" scope="RUNTIME" />
</component>
</module>
@@ -0,0 +1,57 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.tasks.integration;
import com.intellij.tasks.Task;
import com.intellij.tasks.TaskManagerTestCase;
import com.intellij.tasks.trac.TracRepository;
import org.apache.xmlrpc.CommonsXmlRpcTransport;
import org.apache.xmlrpc.XmlRpc;
import org.apache.xmlrpc.XmlRpcClient;
import org.apache.xmlrpc.XmlRpcRequest;
import java.net.URL;
import java.util.Arrays;
import java.util.Vector;
/**
* @author Dmitry Avdeev
* Date: 1/25/12
*/
public abstract class TracIntegrationTest extends TaskManagerTestCase {
public void testTracEncoding() throws Exception {
XmlRpc.setDefaultInputEncoding("UTF-8");
XmlRpcClient client = new XmlRpcClient("http://trac.shopware.de/trac/login/rpc");
// client.setBasicAuthentication();
CommonsXmlRpcTransport transport = new CommonsXmlRpcTransport(new URL("http://trac.shopware.de/trac/login/rpc"));
transport.setBasicAuthentication("jetbrains", "jetbrains");
Object o = client.execute(new XmlRpcRequest("ticket.get", new Vector(Arrays.asList("5358"))),
transport);
System.out.println(o);
TracRepository repository = new TracRepository();
repository.setPassword("jetbrains");
repository.setUsername("jetbrains");
repository.setUrl("http://trac.shopware.de/trac/login/rpc");
Task[] issues = repository.getIssues("", 10, 0);
Task task = repository.findTask("5358");
System.out.println(task.getDescription());
}
}