diff options
5 files changed, 26 insertions, 43 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 c9ceeecdf..330180ce1 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 @@ -36,13 +36,13 @@ public class AllTracHeadlessStandaloneTests { suite.addTestSuite(TracSearchTest.class); suite.addTestSuite(TracTicketTest.class); suite.addTestSuite(TracRepositoryInfoTest.class); - suite.addTestSuite(TracClientFactoryTest.class); suite.addTestSuite(TracClientProxyTest.class); // core tests suite.addTestSuite(TracClientManagerTest.class); // network tests for (TracFixture fixture : TracFixture.ALL) { fixture.createSuite(suite); + fixture.add(TracClientFactoryTest.class); fixture.add(TracClientTest.class); if (fixture.getAccessMode() == Version.XML_RPC) { fixture.add(TracXmlRpcClientTest.class); @@ -52,6 +52,7 @@ public class AllTracHeadlessStandaloneTests { // validation tests for (TracFixture fixture : TracFixture.MISC) { fixture.createSuite(suite); + fixture.add(TracClientFactoryTest.class); fixture.add(TracClientTest.class); fixture.done(); } 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 5c57bf91c..135a5f6e8 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 @@ -16,69 +16,51 @@ import junit.framework.TestCase; import org.eclipse.mylyn.commons.net.WebLocation; 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; 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.internal.trac.core.client.ITracClient.Version; 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; +import org.eclipse.mylyn.trac.tests.support.TracFixture; /** * @author Steffen Pingel */ public class TracClientFactoryTest extends TestCase { - public void testCreateClient() throws Exception { - WebLocation location = new WebLocation(TracTestConstants.TEST_TRAC_010_URL, "user", "password"); - ITracClient client = TracClientFactory.createClient(location, Version.TRAC_0_9); - assertTrue(client instanceof TracWebClient); + private TracFixture fixture; - location = new WebLocation(TracTestConstants.TEST_TRAC_010_SSL_URL, "user", "password"); - client = TracClientFactory.createClient(location, Version.TRAC_0_9); - assertTrue(client instanceof TracWebClient); - - location = new WebLocation(TracTestConstants.TEST_TRAC_010_URL, "user", "password"); - client = TracClientFactory.createClient(location, Version.XML_RPC); - assertTrue(client instanceof TracXmlRpcClient); + @Override + protected void setUp() throws Exception { + fixture = TracFixture.current(); + } - location = new WebLocation(TracTestConstants.TEST_TRAC_010_SSL_URL, "user", "password"); - client = TracClientFactory.createClient(location, Version.XML_RPC); - assertTrue(client instanceof TracXmlRpcClient); + public void testCreateClient() throws Exception { + WebLocation location = new WebLocation(fixture.getRepositoryUrl(), "user", "password"); + ITracClient client = TracClientFactory.createClient(location, fixture.getAccessMode()); + if (fixture.getAccessMode() == Version.TRAC_0_9) { + assertTrue(client instanceof TracWebClient); + } else { + assertTrue(client instanceof TracXmlRpcClient); + } } public void testCreateClientNull() throws Exception { try { - WebLocation location = new WebLocation(TracTestConstants.TEST_TRAC_010_URL, "user", "password"); + WebLocation location = new WebLocation(fixture.getRepositoryUrl(), "user", "password"); TracClientFactory.createClient(location, null); fail("Expected Exception"); } catch (Exception e) { } } - public void testProbeClient096() throws Exception { - probeClient(TracTestConstants.TEST_TRAC_096_URL, false); - } - - public void testProbeClient010() throws Exception { - probeClient(TracTestConstants.TEST_TRAC_010_URL, true); - } - - public void testProbeClient010DigestAuth() throws Exception { - probeClient(TracTestConstants.TEST_TRAC_010_DIGEST_AUTH_URL, true); - } - - public void testProbeClient010FormAuth() throws Exception { - probeClient(TracTestConstants.TEST_TRAC_010_FORM_AUTH_URL, true); - } - - public void testProbeClient011() throws Exception { - probeClient(TracTestConstants.TEST_TRAC_011_URL, true); - } + public void testProbeClient() throws Exception { + String url = fixture.getRepositoryUrl(); + boolean xmlrpcInstalled = (fixture.getAccessMode() == Version.XML_RPC); - protected void probeClient(String url, boolean xmlrpcInstalled) throws Exception { Credentials credentials = TestUtil.readCredentials(PrivilegeLevel.USER); WebLocation location = new WebLocation(url, credentials.username, credentials.password); Version version = TracClientFactory.probeClient(location); diff --git a/org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/core/TracClientManagerTest.java b/org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/core/TracClientManagerTest.java index b58275e52..1f80b09c9 100644 --- a/org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/core/TracClientManagerTest.java +++ b/org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/core/TracClientManagerTest.java @@ -34,7 +34,7 @@ public class TracClientManagerTest extends TestCase { public void testNullCache() throws Exception { TaskRepository taskRepository = new TaskRepository(TracCorePlugin.CONNECTOR_KIND, - TracTestConstants.TEST_TRAC_096_URL); + TracTestConstants.TEST_TRAC_010_URL); taskRepository.setVersion(Version.TRAC_0_9.name()); TracClientManager manager = new TracClientManager(null, new TaskRepositoryLocationFactory()); @@ -47,7 +47,7 @@ public class TracClientManagerTest extends TestCase { public void testReadCache() throws Exception { TaskRepository taskRepository = new TaskRepository(TracCorePlugin.CONNECTOR_KIND, - TracTestConstants.TEST_TRAC_096_URL); + TracTestConstants.TEST_TRAC_010_URL); taskRepository.setVersion(Version.TRAC_0_9.name()); File file = File.createTempFile("mylyn", null); @@ -60,7 +60,7 @@ public class TracClientManagerTest extends TestCase { public void testWriteCache() throws Exception { TaskRepository taskRepository = new TaskRepository(TracCorePlugin.CONNECTOR_KIND, - TracTestConstants.TEST_TRAC_096_URL); + TracTestConstants.TEST_TRAC_010_URL); taskRepository.setVersion(Version.TRAC_0_9.name()); taskRepository.setCredentials(AuthenticationType.REPOSITORY, null, false); 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 9e9e207a4..63d76fe29 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 @@ -77,7 +77,7 @@ public class TracFixture extends TestFixture { public static TracFixture TRAC_TRUNK_XML_RPC = new TracFixture(Version.XML_RPC, TracTestConstants.TEST_TRAC_TRUNK_URL, "0.12dev-r0", "XML-RPC"); - public static TracFixture DEFAULT = TRAC_0_11_XML_RPC; + public static TracFixture DEFAULT = TRAC_0_12_XML_RPC; //public static TracFixture DEFAULT = TRAC_0_11_WEB; diff --git a/org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/support/TracTestConstants.java b/org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/support/TracTestConstants.java index 889849935..358d08aca 100644 --- a/org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/support/TracTestConstants.java +++ b/org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/support/TracTestConstants.java @@ -18,7 +18,7 @@ public class TracTestConstants { public static final String SERVER = System.getProperty("mylyn.trac.server", "mylyn.eclipse.org"); - public static final String TEST_TRAC_096_URL = "http://" + SERVER + "/trac096"; +// public static final String TEST_TRAC_096_URL = "http://" + SERVER + "/trac096"; public static final String TEST_TRAC_010_URL = "http://" + SERVER + "/trac010"; |