Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorspingel2009-09-23 04:34:49 +0000
committerspingel2009-09-23 04:34:49 +0000
commit7032f6c9cea4f9937563699363acb967ebb2bf02 (patch)
treeaa46c416978f63eca65174f338a4ebe03d7df15d /org.eclipse.mylyn.trac.tests
parent09c4288b589847327af47b9e0e67806f987ab5fc (diff)
downloadorg.eclipse.mylyn.tasks-7032f6c9cea4f9937563699363acb967ebb2bf02.tar.gz
org.eclipse.mylyn.tasks-7032f6c9cea4f9937563699363acb967ebb2bf02.tar.xz
org.eclipse.mylyn.tasks-7032f6c9cea4f9937563699363acb967ebb2bf02.zip
NEW - bug 290198: move test utilities to a separate plug-in
https://bugs.eclipse.org/bugs/show_bug.cgi?id=290198
Diffstat (limited to 'org.eclipse.mylyn.trac.tests')
-rw-r--r--org.eclipse.mylyn.trac.tests/META-INF/MANIFEST.MF2
-rw-r--r--org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/support/TestFixture.java130
-rw-r--r--org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/support/TracFixture.java1
-rw-r--r--org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/ui/TracTaskEditorTest.java4
4 files changed, 4 insertions, 133 deletions
diff --git a/org.eclipse.mylyn.trac.tests/META-INF/MANIFEST.MF b/org.eclipse.mylyn.trac.tests/META-INF/MANIFEST.MF
index cd4faf7a7..ce5456caa 100644
--- a/org.eclipse.mylyn.trac.tests/META-INF/MANIFEST.MF
+++ b/org.eclipse.mylyn.trac.tests/META-INF/MANIFEST.MF
@@ -15,7 +15,7 @@ Require-Bundle: org.apache.xmlrpc;bundle-version="3.0.0",
org.eclipse.mylyn.context.tests,
org.eclipse.mylyn.tasks.ui,
org.eclipse.mylyn.tasks.core,
- org.eclipse.mylyn.tasks.tests,
+ org.eclipse.mylyn.tests.util,
org.eclipse.mylyn.trac.ui,
org.eclipse.mylyn.trac.core
Export-Package: org.eclipse.mylyn.internal.trac.ui;x-internal:=true,
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
deleted file mode 100644
index 3d9b5ccb9..000000000
--- a/org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/support/TestFixture.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/*******************************************************************************
- * 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Steffen Pingel - initial API and implementation
- *******************************************************************************/
-
-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;
-import org.eclipse.mylyn.commons.net.IProxyProvider;
-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;
-
-/**
- * @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 getInfo() {
- return info;
- }
-
- public String getRepositoryUrl() {
- return repositoryUrl;
- }
-
- public AbstractWebLocation location() throws Exception {
- return location(PrivilegeLevel.USER);
- }
-
- public AbstractWebLocation location(PrivilegeLevel level) throws Exception {
- return location(level, Proxy.NO_PROXY);
- }
-
- public AbstractWebLocation location(PrivilegeLevel level, Proxy proxy) throws Exception {
- Credentials credentials = TestUtil.readCredentials(level);
- return location(credentials.username, credentials.password, proxy);
- }
-
- public AbstractWebLocation location(String username, String password) throws Exception {
- return location(username, password, Proxy.NO_PROXY);
- }
-
- public AbstractWebLocation location(String username, String password, final Proxy proxy) throws Exception {
- return new WebLocation(repositoryUrl, username, password, new IProxyProvider() {
- public Proxy getProxyForHost(String host, String proxyType) {
- return proxy;
- }
- });
- }
-
- 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 07dffd848..55e3687b9 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
@@ -27,6 +27,7 @@ import org.eclipse.mylyn.internal.trac.core.TracCorePlugin;
import org.eclipse.mylyn.internal.trac.core.client.ITracClient;
import org.eclipse.mylyn.internal.trac.core.client.ITracClient.Version;
import org.eclipse.mylyn.tasks.core.TaskRepository;
+import org.eclipse.mylyn.tests.util.TestFixture;
/**
* Initializes Trac repositories to a defined state. This is done once per test run, since cleaning and initializing the
diff --git a/org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/ui/TracTaskEditorTest.java b/org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/ui/TracTaskEditorTest.java
index 49b5d6760..f25c09fcb 100644
--- a/org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/ui/TracTaskEditorTest.java
+++ b/org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/ui/TracTaskEditorTest.java
@@ -18,8 +18,8 @@ import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
import org.eclipse.mylyn.internal.tasks.ui.views.TaskListView;
import org.eclipse.mylyn.tasks.core.ITask;
import org.eclipse.mylyn.tasks.core.TaskRepository;
-import org.eclipse.mylyn.tasks.tests.TaskTestUtil;
import org.eclipse.mylyn.tasks.ui.TasksUiUtil;
+import org.eclipse.mylyn.tests.util.TestFixture;
import org.eclipse.mylyn.trac.tests.support.TracFixture;
import org.eclipse.mylyn.trac.tests.support.TracTestUtil;
@@ -30,7 +30,7 @@ public class TracTaskEditorTest extends TestCase {
@Override
protected void setUp() throws Exception {
- TaskTestUtil.resetTaskList();
+ TestFixture.resetTaskList();
}
public void testGetSelectedRepository() throws Exception {

Back to the top