diff options
author | Frank Becker | 2016-10-14 06:40:41 +0000 |
---|---|---|
committer | Gerrit Code Review @ Eclipse.org | 2016-10-21 16:56:27 +0000 |
commit | 3630c390facf5251fbc3fc4e7c2b17bae70a402a (patch) | |
tree | 2cc6606c6e78889b5cc9d1402819150a67e7192a | |
parent | 6acaf16af156b3fea92e8e0c4523ae6e3e1cc3ef (diff) | |
download | org.eclipse.mylyn.tasks-3630c390facf5251fbc3fc4e7c2b17bae70a402a.tar.gz org.eclipse.mylyn.tasks-3630c390facf5251fbc3fc4e7c2b17bae70a402a.tar.xz org.eclipse.mylyn.tasks-3630c390facf5251fbc3fc4e7c2b17bae70a402a.zip |
503109: create ManagedSuite for junit4
Change-Id: I439c781fdce1524b69450360b8d67878507cf3ef
Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=503109
3 files changed, 63 insertions, 84 deletions
diff --git a/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core.tests/src/org/eclipse/mylyn/bugzilla/rest/core/tests/AllBugzillaRestCoreTests.java b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core.tests/src/org/eclipse/mylyn/bugzilla/rest/core/tests/AllBugzillaRestCoreTests.java index 0bcfc8119..6f829bfc0 100644 --- a/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core.tests/src/org/eclipse/mylyn/bugzilla/rest/core/tests/AllBugzillaRestCoreTests.java +++ b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core.tests/src/org/eclipse/mylyn/bugzilla/rest/core/tests/AllBugzillaRestCoreTests.java @@ -11,41 +11,32 @@ package org.eclipse.mylyn.bugzilla.rest.core.tests; +import java.util.List; + import org.eclipse.mylyn.commons.sdk.util.CommonTestUtil; -import org.eclipse.mylyn.commons.sdk.util.ManagedTestSuite; +import org.eclipse.mylyn.commons.sdk.util.ManagedSuite; +import org.eclipse.mylyn.commons.sdk.util.ManagedSuite.SuiteClassProvider; +import org.eclipse.mylyn.commons.sdk.util.ManagedSuite.TestConfigurationProperty; import org.eclipse.mylyn.commons.sdk.util.TestConfiguration; +import org.junit.runner.RunWith; +import org.junit.runners.Suite; -import junit.framework.JUnit4TestAdapter; -import junit.framework.Test; -import junit.framework.TestSuite; - +@RunWith(ManagedSuite.class) +@Suite.SuiteClasses({ RepositoryKeyTest.class }) +@TestConfigurationProperty() public class AllBugzillaRestCoreTests { - public static Test suite() { + static { if (CommonTestUtil.fixProxyConfiguration()) { CommonTestUtil.dumpSystemInfo(System.err); } - - TestSuite suite = new ManagedTestSuite(AllBugzillaRestCoreTests.class.getName()); - addTests(suite, TestConfiguration.getDefault()); - return suite; } - public static Test suite(TestConfiguration configuration) { - TestSuite suite = new TestSuite(AllBugzillaRestCoreTests.class.getName()); - addTests(suite, configuration); - return suite; - } - - public static void addTests(TestSuite suite, TestConfiguration configuration) { - // Tests that only need to run once (i.e. no network io so doesn't matter which repository) - suite.addTest(new JUnit4TestAdapter(RepositoryKeyTest.class)); - - // network tests - if (!configuration.isLocalOnly()) { - suite.addTest(new JUnit4TestAdapter(BugzillaRestClientTest.class)); - suite.addTest(new JUnit4TestAdapter(BugzillaRestConfigurationTest.class)); - suite.addTest(new JUnit4TestAdapter(BugzillaRestConnectorTest.class)); + @SuiteClassProvider + public static void add2SuiteClasses(List<Class<?>> suiteClassList, TestConfiguration testConfiguration) { + if (!testConfiguration.isLocalOnly()) { + suiteClassList.add(BugzillaRestClientTest.class); + suiteClassList.add(BugzillaRestConfigurationTest.class); + suiteClassList.add(BugzillaRestConnectorTest.class); } } - } diff --git a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/AllBugzillaTests.java b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/AllBugzillaTests.java index 556e95b80..82ef5290e 100644 --- a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/AllBugzillaTests.java +++ b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/AllBugzillaTests.java @@ -14,9 +14,6 @@ package org.eclipse.mylyn.bugzilla.tests; import java.util.List; -import junit.framework.Test; -import junit.framework.TestSuite; - import org.eclipse.mylyn.bugzilla.tests.core.BugzillaXmlRpcClientTest; import org.eclipse.mylyn.bugzilla.tests.support.BugzillaFixture; import org.eclipse.mylyn.bugzilla.tests.ui.BugzillaHyperlinkDetectorTest; @@ -25,9 +22,13 @@ import org.eclipse.mylyn.bugzilla.tests.ui.BugzillaSearchPageTest; import org.eclipse.mylyn.bugzilla.tests.ui.BugzillaTaskEditorTest; import org.eclipse.mylyn.bugzilla.tests.ui.BugzillaTaskHyperlinkDetectorTest; import org.eclipse.mylyn.commons.sdk.util.CommonTestUtil; +import org.eclipse.mylyn.commons.sdk.util.ManagedSuite; import org.eclipse.mylyn.commons.sdk.util.ManagedTestSuite; import org.eclipse.mylyn.commons.sdk.util.TestConfiguration; +import junit.framework.Test; +import junit.framework.TestSuite; + /** * @author Mik Kersten * @author Steffen Pingel @@ -41,7 +42,8 @@ public class AllBugzillaTests { } TestSuite suite = new ManagedTestSuite(AllBugzillaTests.class.getName()); - addTests(suite, TestConfiguration.getDefault()); + TestConfiguration testConfiguration = ManagedSuite.getTestConfigurationOrCreateDefault(); + addTests(suite, testConfiguration); return suite; } diff --git a/org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/AllTracTests.java b/org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/AllTracTests.java index 2de3cfef5..e7dd3fd50 100644 --- a/org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/AllTracTests.java +++ b/org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/AllTracTests.java @@ -11,27 +11,13 @@ package org.eclipse.mylyn.trac.tests; -import java.util.List; - -import junit.framework.Test; -import junit.framework.TestSuite; - import org.eclipse.mylyn.commons.sdk.util.CommonTestUtil; -import org.eclipse.mylyn.commons.sdk.util.CommonTestUtil.PrivilegeLevel; +import org.eclipse.mylyn.commons.sdk.util.ManagedSuite; import org.eclipse.mylyn.commons.sdk.util.ManagedTestSuite; import org.eclipse.mylyn.commons.sdk.util.TestConfiguration; -import org.eclipse.mylyn.commons.sdk.util.TestConfiguration.TestKind; -import org.eclipse.mylyn.internal.trac.core.client.ITracClient.Version; -import org.eclipse.mylyn.trac.tests.core.TracAttachmentHandlerTest; -import org.eclipse.mylyn.trac.tests.core.TracRepositoryConnectorTest; -import org.eclipse.mylyn.trac.tests.core.TracRepositoryConnectorWebTest; -import org.eclipse.mylyn.trac.tests.core.TracRepositoryQueryTest; -import org.eclipse.mylyn.trac.tests.core.TracTaskDataHandlerXmlRpcTest; -import org.eclipse.mylyn.trac.tests.core.TracUtilTest; -import org.eclipse.mylyn.trac.tests.support.TracFixture; -import org.eclipse.mylyn.trac.tests.support.TracTestCleanupUtil; -import org.eclipse.mylyn.trac.tests.ui.TracHyperlinkUtilTest; -import org.eclipse.mylyn.trac.tests.ui.TracRepositorySettingsPageTest; + +import junit.framework.Test; +import junit.framework.TestSuite; /** * @author Mik Kersten @@ -43,10 +29,10 @@ public class AllTracTests { if (CommonTestUtil.fixProxyConfiguration()) { CommonTestUtil.dumpSystemInfo(System.err); } - + TestConfiguration testConfiguration = ManagedSuite.getTestConfigurationOrCreateDefault(); TestSuite suite = new ManagedTestSuite(AllTracTests.class.getName()); -// addTests(suite, TestConfiguration.getDefault()); - addEmptyTest(suite, TestConfiguration.getDefault()); +// addTests(suite, testConfiguration); + addEmptyTest(suite, testConfiguration); return suite; } @@ -61,38 +47,38 @@ public class AllTracTests { suite.addTestSuite(EmptyTest.class); } - public static void addTests(TestSuite suite, TestConfiguration configuration) { - suite.addTest(AllTracHeadlessStandaloneTests.suite(configuration)); - suite.addTestSuite(TracUtilTest.class); - suite.addTestSuite(TracHyperlinkUtilTest.class); - - if (!configuration.isLocalOnly()) { - suite.addTestSuite(TracRepositoryQueryTest.class); - suite.addTestSuite(TracRepositorySettingsPageTest.class); - // network tests - List<TracFixture> fixtures = configuration.discover(TracFixture.class, "trac"); - for (TracFixture fixture : fixtures) { - if (!fixture.hasTag(TracFixture.TAG_MISC)) { - addTests(suite, configuration, fixture); - } - } - } - } - - protected static void addTests(TestSuite suite, TestConfiguration configuration, TracFixture fixture) { - fixture.createSuite(suite); - if (configuration.hasKind(TestKind.INTEGRATION) && !configuration.isLocalOnly() - && CommonTestUtil.hasCredentials(PrivilegeLevel.ADMIN)) { - fixture.add(TracTestCleanupUtil.class); - } - fixture.add(TracRepositoryConnectorTest.class); - if (fixture.getAccessMode() == Version.XML_RPC) { - fixture.add(TracTaskDataHandlerXmlRpcTest.class); - fixture.add(TracAttachmentHandlerTest.class); - } else { - fixture.add(TracRepositoryConnectorWebTest.class); - } - fixture.done(); - } +// public static void addTests(TestSuite suite, TestConfiguration configuration) { +// suite.addTest(AllTracHeadlessStandaloneTests.suite(configuration)); +// suite.addTestSuite(TracUtilTest.class); +// suite.addTestSuite(TracHyperlinkUtilTest.class); +// +// if (!configuration.isLocalOnly()) { +// suite.addTestSuite(TracRepositoryQueryTest.class); +// suite.addTestSuite(TracRepositorySettingsPageTest.class); +// // network tests +// List<TracFixture> fixtures = configuration.discover(TracFixture.class, "trac"); +// for (TracFixture fixture : fixtures) { +// if (!fixture.hasTag(TracFixture.TAG_MISC)) { +// addTests(suite, configuration, fixture); +// } +// } +// } +// } +// +// protected static void addTests(TestSuite suite, TestConfiguration configuration, TracFixture fixture) { +// fixture.createSuite(suite); +// if (configuration.hasKind(TestKind.INTEGRATION) && !configuration.isLocalOnly() +// && CommonTestUtil.hasCredentials(PrivilegeLevel.ADMIN)) { +// fixture.add(TracTestCleanupUtil.class); +// } +// fixture.add(TracRepositoryConnectorTest.class); +// if (fixture.getAccessMode() == Version.XML_RPC) { +// fixture.add(TracTaskDataHandlerXmlRpcTest.class); +// fixture.add(TracAttachmentHandlerTest.class); +// } else { +// fixture.add(TracRepositoryConnectorWebTest.class); +// } +// fixture.done(); +// } }
\ No newline at end of file |