Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteffen Pingel2012-03-02 23:48:34 +0000
committerSteffen Pingel2012-03-02 23:48:34 +0000
commit8467de45a34ee2730b3b6e97a7230876c97d6eb5 (patch)
tree9dfffa69da30fa8778955b20f12c531becbfffc9 /org.eclipse.mylyn.trac.tests
parent2befecfd0c9ea65a84504ad94eea486e317407cf (diff)
downloadorg.eclipse.mylyn.tasks-8467de45a34ee2730b3b6e97a7230876c97d6eb5.tar.gz
org.eclipse.mylyn.tasks-8467de45a34ee2730b3b6e97a7230876c97d6eb5.tar.xz
org.eclipse.mylyn.tasks-8467de45a34ee2730b3b6e97a7230876c97d6eb5.zip
NEW - bug 373165: deprecate TestUtil in favor of CommonTestUtil
https://bugs.eclipse.org/bugs/show_bug.cgi?id=373165 Change-Id: I32cb93b3e05eed4ff6676f2d1c2418d82c16c0f1
Diffstat (limited to 'org.eclipse.mylyn.trac.tests')
-rw-r--r--org.eclipse.mylyn.trac.tests/META-INF/MANIFEST.MF1
-rw-r--r--org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/client/TracClientFactoryTest.java10
-rw-r--r--org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/client/TracClientTest.java12
-rw-r--r--org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/client/TracXmlRpcTest.java12
-rw-r--r--org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/support/TracFixture.java16
-rw-r--r--org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/support/TracTestCleanupUtil.java2
-rw-r--r--org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/support/TracTestUtil.java2
7 files changed, 28 insertions, 27 deletions
diff --git a/org.eclipse.mylyn.trac.tests/META-INF/MANIFEST.MF b/org.eclipse.mylyn.trac.tests/META-INF/MANIFEST.MF
index e3573ca3a..7ac450301 100644
--- a/org.eclipse.mylyn.trac.tests/META-INF/MANIFEST.MF
+++ b/org.eclipse.mylyn.trac.tests/META-INF/MANIFEST.MF
@@ -10,6 +10,7 @@ Require-Bundle: org.junit,
org.eclipse.ui,
org.eclipse.ui.workbench.texteditor,
org.eclipse.mylyn.commons.net,
+ org.eclipse.mylyn.commons.repositories.core,
org.eclipse.mylyn.commons.sdk.util,
org.eclipse.mylyn.tasks.core,
org.eclipse.mylyn.tasks.ui,
diff --git a/org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/client/TracClientFactoryTest.java b/org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/client/TracClientFactoryTest.java
index 31a6e5fc1..49e567f1e 100644
--- a/org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/client/TracClientFactoryTest.java
+++ b/org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/client/TracClientFactoryTest.java
@@ -14,6 +14,9 @@ package org.eclipse.mylyn.trac.tests.client;
import junit.framework.TestCase;
import org.eclipse.mylyn.commons.net.WebLocation;
+import org.eclipse.mylyn.commons.repositories.core.auth.UserCredentials;
+import org.eclipse.mylyn.commons.sdk.util.CommonTestUtil;
+import org.eclipse.mylyn.commons.sdk.util.CommonTestUtil.PrivilegeLevel;
import org.eclipse.mylyn.internal.trac.core.TracClientFactory;
import org.eclipse.mylyn.internal.trac.core.client.ITracClient;
import org.eclipse.mylyn.internal.trac.core.client.ITracClient.Version;
@@ -21,9 +24,6 @@ import org.eclipse.mylyn.internal.trac.core.client.TracException;
import org.eclipse.mylyn.internal.trac.core.client.TracLoginException;
import org.eclipse.mylyn.internal.trac.core.client.TracWebClient;
import org.eclipse.mylyn.internal.trac.core.client.TracXmlRpcClient;
-import org.eclipse.mylyn.tests.util.TestUtil;
-import org.eclipse.mylyn.tests.util.TestUtil.Credentials;
-import org.eclipse.mylyn.tests.util.TestUtil.PrivilegeLevel;
import org.eclipse.mylyn.trac.tests.support.TracFixture;
/**
@@ -57,8 +57,8 @@ public class TracClientFactoryTest extends TestCase {
public void testProbeClient() throws Exception {
String url = fixture.getRepositoryUrl();
- Credentials credentials = TestUtil.readCredentials(PrivilegeLevel.USER);
- WebLocation location = new WebLocation(url, credentials.username, credentials.password);
+ UserCredentials credentials = CommonTestUtil.getCredentials(PrivilegeLevel.USER);
+ WebLocation location = new WebLocation(url, credentials.getUserName(), credentials.getPassword());
Version version = TracClientFactory.probeClient(location);
if (fixture.isXmlRpcEnabled()) {
assertEquals(Version.XML_RPC, version);
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 6dfec1c42..525f371ee 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
@@ -22,6 +22,9 @@ import java.util.List;
import junit.framework.TestCase;
import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.mylyn.commons.repositories.core.auth.UserCredentials;
+import org.eclipse.mylyn.commons.sdk.util.CommonTestUtil;
+import org.eclipse.mylyn.commons.sdk.util.CommonTestUtil.PrivilegeLevel;
import org.eclipse.mylyn.internal.trac.core.TracAttribute;
import org.eclipse.mylyn.internal.trac.core.client.ITracClient;
import org.eclipse.mylyn.internal.trac.core.client.ITracClient.Version;
@@ -34,9 +37,6 @@ import org.eclipse.mylyn.internal.trac.core.model.TracTicket;
import org.eclipse.mylyn.internal.trac.core.model.TracTicket.Key;
import org.eclipse.mylyn.internal.trac.core.model.TracTicketField;
import org.eclipse.mylyn.internal.trac.core.model.TracVersion;
-import org.eclipse.mylyn.tests.util.TestUtil;
-import org.eclipse.mylyn.tests.util.TestUtil.Credentials;
-import org.eclipse.mylyn.tests.util.TestUtil.PrivilegeLevel;
import org.eclipse.mylyn.trac.tests.support.TracFixture;
import org.eclipse.mylyn.trac.tests.support.TracTestUtil;
import org.eclipse.mylyn.trac.tests.support.XmlRpcServer.TestData;
@@ -239,7 +239,7 @@ public class TracClientTest extends TestCase {
}
public void testValidate() throws Exception {
- Credentials credentials = TestUtil.readCredentials(PrivilegeLevel.USER);
+ UserCredentials credentials = CommonTestUtil.getCredentials(PrivilegeLevel.USER);
// standard connect
client.validate(new NullProgressMonitor());
@@ -255,7 +255,7 @@ public class TracClientTest extends TestCase {
String url = TracFixture.current().getRepositoryUrl();
// invalid password
- client = TracFixture.current().connect(url, credentials.username, "wrongpassword");
+ client = TracFixture.current().connect(url, credentials.getUserName(), "wrongpassword");
try {
client.validate(new NullProgressMonitor());
fail("Expected TracLoginException");
@@ -263,7 +263,7 @@ public class TracClientTest extends TestCase {
}
// invalid username
- client = TracFixture.current().connect(url, "wrongusername", credentials.password);
+ client = TracFixture.current().connect(url, "wrongusername", credentials.getPassword());
try {
client.validate(new NullProgressMonitor());
fail("Expected TracLoginException");
diff --git a/org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/client/TracXmlRpcTest.java b/org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/client/TracXmlRpcTest.java
index 3a0aa3ffb..8843c0c5b 100644
--- a/org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/client/TracXmlRpcTest.java
+++ b/org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/client/TracXmlRpcTest.java
@@ -26,10 +26,10 @@ import org.apache.commons.httpclient.HttpClient;
import org.apache.xmlrpc.XmlRpcException;
import org.apache.xmlrpc.client.XmlRpcClient;
import org.apache.xmlrpc.client.XmlRpcClientConfigImpl;
+import org.eclipse.mylyn.commons.repositories.core.auth.UserCredentials;
+import org.eclipse.mylyn.commons.sdk.util.CommonTestUtil;
+import org.eclipse.mylyn.commons.sdk.util.CommonTestUtil.PrivilegeLevel;
import org.eclipse.mylyn.internal.trac.core.util.TracHttpClientTransportFactory;
-import org.eclipse.mylyn.tests.util.TestUtil;
-import org.eclipse.mylyn.tests.util.TestUtil.Credentials;
-import org.eclipse.mylyn.tests.util.TestUtil.PrivilegeLevel;
import org.eclipse.mylyn.trac.tests.support.TracTestConstants;
/**
@@ -61,9 +61,9 @@ public class TracXmlRpcTest extends TestCase {
random = new Random();
- Credentials credentials = TestUtil.readCredentials(PrivilegeLevel.ADMIN);
- createConnection(new URL(TracTestConstants.TEST_TRAC_010_URL + XMLRPC_URL), credentials.username,
- credentials.password);
+ UserCredentials credentials = CommonTestUtil.getCredentials(PrivilegeLevel.ADMIN);
+ createConnection(new URL(TracTestConstants.TEST_TRAC_010_URL + XMLRPC_URL), credentials.getUserName(),
+ credentials.getPassword());
tickets = new ArrayList<Integer>();
}
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 646ddbe73..ce3ae6acb 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
@@ -16,6 +16,9 @@ import java.net.Proxy;
import org.eclipse.mylyn.commons.net.IProxyProvider;
import org.eclipse.mylyn.commons.net.WebLocation;
import org.eclipse.mylyn.commons.net.WebUtil;
+import org.eclipse.mylyn.commons.repositories.core.auth.UserCredentials;
+import org.eclipse.mylyn.commons.sdk.util.CommonTestUtil;
+import org.eclipse.mylyn.commons.sdk.util.CommonTestUtil.PrivilegeLevel;
import org.eclipse.mylyn.internal.trac.core.TracClientFactory;
import org.eclipse.mylyn.internal.trac.core.TracCorePlugin;
import org.eclipse.mylyn.internal.trac.core.TracRepositoryConnector;
@@ -23,9 +26,6 @@ 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;
-import org.eclipse.mylyn.tests.util.TestUtil;
-import org.eclipse.mylyn.tests.util.TestUtil.Credentials;
-import org.eclipse.mylyn.tests.util.TestUtil.PrivilegeLevel;
/**
* Initializes Trac repositories to a defined state. This is done once per test run, since cleaning and initializing the
@@ -118,9 +118,9 @@ public class TracFixture extends TestFixture {
public static XmlRpcServer.TestData init010() throws Exception {
if (data010 == null) {
- Credentials credentials = TestUtil.readCredentials(PrivilegeLevel.USER);
- XmlRpcServer server = new XmlRpcServer(TracTestConstants.TEST_TRAC_010_URL, credentials.username,
- credentials.password);
+ UserCredentials credentials = CommonTestUtil.getCredentials(PrivilegeLevel.USER);
+ XmlRpcServer server = new XmlRpcServer(TracTestConstants.TEST_TRAC_010_URL, credentials.getUserName(),
+ credentials.getPassword());
initializeTestData(server);
data010 = server.getData();
@@ -191,8 +191,8 @@ public class TracFixture extends TestFixture {
}
public ITracClient connect(String url, Proxy proxy, PrivilegeLevel level) throws Exception {
- Credentials credentials = TestUtil.readCredentials(level);
- return connect(url, credentials.username, credentials.password, proxy);
+ UserCredentials credentials = CommonTestUtil.getCredentials(level);
+ return connect(url, credentials.getUserName(), credentials.getPassword(), proxy);
}
public ITracClient connect(String url, String username, String password) throws Exception {
diff --git a/org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/support/TracTestCleanupUtil.java b/org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/support/TracTestCleanupUtil.java
index 34820136a..915a1aa7a 100644
--- a/org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/support/TracTestCleanupUtil.java
+++ b/org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/support/TracTestCleanupUtil.java
@@ -21,7 +21,7 @@ import org.eclipse.mylyn.internal.trac.core.client.TracException;
import org.eclipse.mylyn.internal.trac.core.model.TracAttachment;
import org.eclipse.mylyn.internal.trac.core.model.TracSearch;
import org.eclipse.mylyn.internal.trac.core.model.TracTicket;
-import org.eclipse.mylyn.tests.util.TestUtil.PrivilegeLevel;
+import org.eclipse.mylyn.commons.sdk.util.CommonTestUtil.PrivilegeLevel;
import org.eclipse.mylyn.trac.tests.support.XmlRpcServer.TestData;
/**
diff --git a/org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/support/TracTestUtil.java b/org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/support/TracTestUtil.java
index 7262d06da..687f69363 100644
--- a/org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/support/TracTestUtil.java
+++ b/org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/support/TracTestUtil.java
@@ -58,7 +58,7 @@ public class TracTestUtil {
// TaskRepositoryManager manager = TasksUiPlugin.getRepositoryManager();
// manager.clearRepositories(TasksUiPlugin.getDefault().getRepositoriesFilePath());
//
-// Credentials credentials = TestUtil.readCredentials(PrivilegeLevel.USER);
+// Credentials credentials = CommonTestUtil.getCredentials(PrivilegeLevel.USER);
// TaskRepository repository = new TaskRepository(TracCorePlugin.CONNECTOR_KIND, repositoryUrl);
// repository.setCredentials(AuthenticationType.REPOSITORY, new AuthenticationCredentials(credentials.username,
// credentials.password), false);

Back to the top