From 17cc2ee0cbb90b36f3deeceeefca2126f55a9327 Mon Sep 17 00:00:00 2001 From: spingel Date: Thu, 1 Jul 2010 03:35:13 +0000 Subject: RESOLVED - bug 318111: [releng] run tests frequently on mylyn.eclipse.org https://bugs.eclipse.org/bugs/show_bug.cgi?id=318111 --- .../trac/tests/client/TracClientFactoryTest.java | 56 ++++++++-------------- .../trac/tests/core/TracClientManagerTest.java | 6 +-- .../trac/tests/support/TracTestConstants.java | 2 +- 3 files changed, 23 insertions(+), 41 deletions(-) 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/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"; -- cgit v1.2.3