Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorspingel2009-08-31 04:52:16 +0000
committerspingel2009-08-31 04:52:16 +0000
commit62226af8c1bee0c840c105345c7f79189a821fe0 (patch)
tree04f280c0d16755e00560d3ec37c67340ac1278c7 /org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac
parent92cff1937b7263e739c820ba8e67ae2a91fdb5db (diff)
downloadorg.eclipse.mylyn.tasks-62226af8c1bee0c840c105345c7f79189a821fe0.tar.gz
org.eclipse.mylyn.tasks-62226af8c1bee0c840c105345c7f79189a821fe0.tar.xz
org.eclipse.mylyn.tasks-62226af8c1bee0c840c105345c7f79189a821fe0.zip
NEW - bug 288070: fix failing tests in TracClientTest
https://bugs.eclipse.org/bugs/show_bug.cgi?id=288070
Diffstat (limited to 'org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac')
-rw-r--r--org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/AllTracHeadlessStandaloneTests.java5
-rw-r--r--org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/client/TracClientTest.java4
-rw-r--r--org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/client/TracXmlRpcClientTest.java4
-rw-r--r--org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/support/TestFixture.java76
-rw-r--r--org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/support/TracFixture.java34
5 files changed, 82 insertions, 41 deletions
diff --git a/org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/AllTracHeadlessStandaloneTests.java b/org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/AllTracHeadlessStandaloneTests.java
index 6e14bcc55..df5ddee17 100644
--- a/org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/AllTracHeadlessStandaloneTests.java
+++ b/org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/AllTracHeadlessStandaloneTests.java
@@ -43,12 +43,13 @@ public class AllTracHeadlessStandaloneTests {
// network tests
for (TracFixture fixture : TracFixture.ALL) {
TestSuite fixtureSuite = fixture.createSuite();
- fixtureSuite.addTestSuite(TracClientTest.class);
+ fixture.add(fixtureSuite, TracClientTest.class);
if (fixture.getAccessMode() == Version.XML_RPC) {
- fixtureSuite.addTestSuite(TracXmlRpcClientTest.class);
+ fixture.add(fixtureSuite, TracXmlRpcClientTest.class);
}
suite.addTest(fixtureSuite);
}
return suite;
}
+
} \ No newline at end of file
diff --git a/org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/client/TracClientTest.java b/org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/client/TracClientTest.java
index 53d7edce2..616824a40 100644
--- a/org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/client/TracClientTest.java
+++ b/org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/client/TracClientTest.java
@@ -93,7 +93,7 @@ public class TracClientTest extends TestCase {
}
}
- public void testGetTicketUmlaute010() throws Exception {
+ public void testGetTicketUmlaute() throws Exception {
// if (version == Version.TRAC_0_9) {
// // XXX need to fix bug 175211
// return;
@@ -133,7 +133,7 @@ public class TracClientTest extends TestCase {
assertEquals(0, result.size());
}
- public void testSearchExactMatch010() throws Exception {
+ public void testSearchExactMatch() throws Exception {
TracSearch search = new TracSearch();
search.addFilter("milestone", "milestone1");
search.addFilter("summary", "summary1");
diff --git a/org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/client/TracXmlRpcClientTest.java b/org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/client/TracXmlRpcClientTest.java
index 8ff51c784..d81b48039 100644
--- a/org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/client/TracXmlRpcClientTest.java
+++ b/org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/client/TracXmlRpcClientTest.java
@@ -33,8 +33,8 @@ import org.eclipse.mylyn.internal.trac.core.model.TracVersion;
import org.eclipse.mylyn.internal.trac.core.model.TracWikiPage;
import org.eclipse.mylyn.internal.trac.core.model.TracWikiPageInfo;
import org.eclipse.mylyn.internal.trac.core.model.TracTicket.Key;
-import org.eclipse.mylyn.trac.tests.support.TracTestConstants;
import org.eclipse.mylyn.trac.tests.support.TracFixture;
+import org.eclipse.mylyn.trac.tests.support.TracTestConstants;
import org.eclipse.mylyn.trac.tests.support.TracTestUtil;
import org.eclipse.mylyn.trac.tests.support.XmlRpcServer.TestData;
import org.eclipse.mylyn.trac.tests.support.XmlRpcServer.Ticket;
@@ -110,7 +110,7 @@ public class TracXmlRpcClientTest extends TestCase {
// assertEquals("", result.get(0).getValue(Key.VERSION));
}
- public void testGetTicketActions010() throws Exception {
+ public void testGetTicketActions() throws Exception {
if (client.getUrl().equals(TracTestConstants.TEST_TRAC_010_URL)) {
TracTicket ticket = client.getTicket(tickets.get(0).getId(), null);
TracAction[] actions = ticket.getActions();
diff --git a/org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/support/TestFixture.java b/org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/support/TestFixture.java
index dec79ff9c..3d9b5ccb9 100644
--- a/org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/support/TestFixture.java
+++ b/org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/support/TestFixture.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2008 Steffen Pingel and others.
+ * Copyright (c) 2009 Steffen Pingel and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -13,6 +13,9 @@ package org.eclipse.mylyn.trac.tests.support;
import java.net.Proxy;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
import org.eclipse.mylyn.commons.net.AbstractWebLocation;
import org.eclipse.mylyn.commons.net.AuthenticationCredentials;
import org.eclipse.mylyn.commons.net.AuthenticationType;
@@ -21,33 +24,58 @@ import org.eclipse.mylyn.commons.net.WebLocation;
import org.eclipse.mylyn.context.tests.support.TestUtil;
import org.eclipse.mylyn.context.tests.support.TestUtil.Credentials;
import org.eclipse.mylyn.context.tests.support.TestUtil.PrivilegeLevel;
+import org.eclipse.mylyn.internal.tasks.core.TaskRepositoryManager;
+import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
+import org.eclipse.mylyn.internal.trac.core.TracCorePlugin;
import org.eclipse.mylyn.tasks.core.TaskRepository;
-public class TestFixture {
-
- protected final String repositoryUrl;
+/**
+ * @author Steffen Pingel
+ */
+public abstract class TestFixture {
private final String connectorKind;
+ private String info;
+
+ protected final String repositoryUrl;
+
public TestFixture(String connectorKind, String repositoryUrl) {
this.connectorKind = connectorKind;
this.repositoryUrl = repositoryUrl;
}
+ protected abstract TestFixture activate();
+
+ public void add(TestSuite suite, Class<? extends TestCase> clazz) {
+ if (Boolean.parseBoolean(System.getProperty("mylyn.tests.annotate")) && getInfo() != null) {
+ suite.addTest(new TestSuite(clazz, clazz.getName() + " [" + getInfo() + "]"));
+ } else {
+ suite.addTestSuite(clazz);
+ }
+ }
+
+ public TestSuite createSuite() {
+ TestSuite suite = new TestSuite("Testing on " + getInfo());
+ suite.addTest(new TestCase("activiating " + getRepositoryUrl()) {
+ @Override
+ protected void runTest() throws Throwable {
+ activate();
+ }
+ });
+ return suite;
+ }
+
public String getConnectorKind() {
return connectorKind;
}
- public String getRepositoryUrl() {
- return repositoryUrl;
+ public String getInfo() {
+ return info;
}
- public TaskRepository repository() {
- TaskRepository repository = new TaskRepository(connectorKind, repositoryUrl);
- Credentials credentials = TestUtil.readCredentials(PrivilegeLevel.USER);
- repository.setCredentials(AuthenticationType.REPOSITORY, new AuthenticationCredentials(credentials.username,
- credentials.password), false);
- return repository;
+ public String getRepositoryUrl() {
+ return repositoryUrl;
}
public AbstractWebLocation location() throws Exception {
@@ -75,4 +103,28 @@ public class TestFixture {
});
}
+ public TaskRepository repository() {
+ TaskRepository repository = new TaskRepository(connectorKind, repositoryUrl);
+ Credentials credentials = TestUtil.readCredentials(PrivilegeLevel.USER);
+ repository.setCredentials(AuthenticationType.REPOSITORY, new AuthenticationCredentials(credentials.username,
+ credentials.password), false);
+ return repository;
+ }
+
+ protected void setInfo(String info) {
+ this.info = info;
+ }
+
+ public TaskRepository singleRepository() {
+ TaskRepositoryManager manager = TasksUiPlugin.getRepositoryManager();
+ manager.clearRepositories(TasksUiPlugin.getDefault().getRepositoriesFilePath());
+
+ TaskRepository repository = new TaskRepository(TracCorePlugin.CONNECTOR_KIND, repositoryUrl);
+ Credentials credentials = TestUtil.readCredentials(PrivilegeLevel.USER);
+ repository.setCredentials(AuthenticationType.REPOSITORY, new AuthenticationCredentials(credentials.username,
+ credentials.password), false);
+ manager.addRepository(repository);
+ return repository;
+ }
+
}
diff --git a/org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/support/TracFixture.java b/org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/support/TracFixture.java
index 4adf4f0b7..917367f86 100644
--- a/org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/support/TracFixture.java
+++ b/org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/support/TracFixture.java
@@ -13,9 +13,6 @@ package org.eclipse.mylyn.trac.tests.support;
import java.net.Proxy;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
import org.eclipse.mylyn.commons.net.AuthenticationCredentials;
import org.eclipse.mylyn.commons.net.AuthenticationType;
import org.eclipse.mylyn.commons.net.IProxyProvider;
@@ -44,28 +41,28 @@ public class TracFixture extends TestFixture {
public static XmlRpcServer.TestData data010;
public static TracFixture TRAC_0_9_WEB = new TracFixture(Version.TRAC_0_9, TracTestConstants.TEST_TRAC_096_URL,
- "0.9/Web");
+ "0.9", "Web");
public static TracFixture TRAC_0_10_WEB = new TracFixture(Version.TRAC_0_9, TracTestConstants.TEST_TRAC_010_URL,
- "0.10/Web");
+ "0.10", "Web");
public static TracFixture TRAC_0_10_XML_RPC = new TracFixture(Version.XML_RPC, TracTestConstants.TEST_TRAC_010_URL,
- "0.10/XML-RPC");
+ "0.10", "XML-RPC");
public static TracFixture TRAC_0_10_XML_RPC_DIGEST_AUTH = new TracFixture(Version.XML_RPC,
- TracTestConstants.TEST_TRAC_010_DIGEST_AUTH_URL, "0.10/XML-RPC/DigestAuth");
+ TracTestConstants.TEST_TRAC_010_DIGEST_AUTH_URL, "0.10", "XML-RPC/DigestAuth");
public static TracFixture TRAC_0_10_XML_RPC_FORM_AUTH = new TracFixture(Version.XML_RPC,
- TracTestConstants.TEST_TRAC_010_FORM_AUTH_URL, "0.10/XML-RPC/FormAuth");
+ TracTestConstants.TEST_TRAC_010_FORM_AUTH_URL, "0.10", "XML-RPC/FormAuth");
public static TracFixture TRAC_0_10_XML_RPC_SSL = new TracFixture(Version.XML_RPC,
- TracTestConstants.TEST_TRAC_010_SSL_URL, "0.10/XML-RPC/SSL");
+ TracTestConstants.TEST_TRAC_010_SSL_URL, "0.10", "XML-RPC/SSL");
public static TracFixture TRAC_0_11_WEB = new TracFixture(Version.TRAC_0_9, TracTestConstants.TEST_TRAC_011_URL,
- "0.11/Web");
+ "0.11", "Web");
public static TracFixture TRAC_0_11_XML_RPC = new TracFixture(Version.XML_RPC, TracTestConstants.TEST_TRAC_011_URL,
- "0.11/XML-RPC");
+ "0.11", "XML-RPC");
public static TracFixture DEFAULT = TRAC_0_11_XML_RPC;
@@ -129,12 +126,14 @@ public class TracFixture extends TestFixture {
private final String version;
- public TracFixture(Version accessMode, String url, String version) {
+ public TracFixture(Version accessMode, String url, String version, String info) {
super(TracCorePlugin.CONNECTOR_KIND, url);
this.accessMode = accessMode;
this.version = version;
+ setInfo("Trac " + version + "/" + info);
}
+ @Override
public TracFixture activate() {
current = this;
return this;
@@ -175,17 +174,6 @@ public class TracFixture extends TestFixture {
return TracClientFactory.createClient(location, version);
}
- public TestSuite createSuite() {
- TestSuite suite = new TestSuite("Testing on Trac " + getVersion());
- suite.addTest(new TestCase("activiating " + getRepositoryUrl()) {
- @Override
- protected void runTest() throws Throwable {
- TracFixture.this.activate();
- }
- });
- return suite;
- }
-
public Version getAccessMode() {
return accessMode;
}

Back to the top