diff options
3 files changed, 24 insertions, 29 deletions
diff --git a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/AllBugzillaHeadlessStandaloneTests.java b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/AllBugzillaHeadlessStandaloneTests.java index 40cf0fd11..7d9882b59 100644 --- a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/AllBugzillaHeadlessStandaloneTests.java +++ b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/AllBugzillaHeadlessStandaloneTests.java @@ -7,6 +7,7 @@ * * Contributors: * Tasktop Technologies - initial API and implementation + * Frank Becker - improvements *******************************************************************************/ package org.eclipse.mylyn.bugzilla.tests; @@ -28,15 +29,15 @@ import org.eclipse.mylyn.internal.bugzilla.core.BugzillaVersion; /** * @author Steffen Pingel * @author Thomas Ehrnhoefer + * @author Frank Becker */ public class AllBugzillaHeadlessStandaloneTests { public static Test suite() { - String[] empty = { "" }; - return suite(false, empty); + return suite(false); } - public static Test suite(boolean defaultOnly, String[] excludeFixtureArray) { + public static Test suite(boolean defaultOnly) { TestSuite suite = new TestSuite(AllBugzillaHeadlessStandaloneTests.class.getName()); // tests that only need to run once (i.e. no network i/o so doesn't matter which repository) suite.addTestSuite(BugzillaConfigurationTest.class); @@ -47,17 +48,6 @@ public class AllBugzillaHeadlessStandaloneTests { addTests(suite, BugzillaFixture.DEFAULT); } else { for (BugzillaFixture fixture : BugzillaFixture.ALL) { - String fixtureURL = fixture.getRepositoryUrl(); - boolean excludeFound = false; - for (String excludeFixtureURL : excludeFixtureArray) { - if (excludeFixtureURL.equals(fixtureURL)) { - excludeFound = true; - break; - } - } - if (excludeFound) { - continue; - } addTests(suite, fixture); } } @@ -65,6 +55,10 @@ public class AllBugzillaHeadlessStandaloneTests { } protected static void addTests(TestSuite suite, BugzillaFixture fixture) { + if (fixture.isExcluded()) { + return; + } + fixture.createSuite(suite); // XXX: re-enable when webservice is used for retrieval of history // fixture.add(fixtureSuite, BugzillaTaskHistoryTest.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 4501fd8a0..a5583f6dd 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 @@ -7,6 +7,7 @@ * * Contributors: * Tasktop Technologies - initial API and implementation + * Frank Becker - improvements *******************************************************************************/ package org.eclipse.mylyn.bugzilla.tests; @@ -26,6 +27,8 @@ import org.eclipse.mylyn.tests.util.TestUtil; /** * @author Mik Kersten + * @author Steffen Pingel + * @author Frank Becker */ public class AllBugzillaTests { @@ -42,11 +45,8 @@ public class AllBugzillaTests { } private static void addTests(boolean defaultOnly, TestSuite suite) { - String excludeFixture = System.getProperty("mylyn.test.exclude", ""); - String[] excludeFixtureArray = excludeFixture.split(","); - // Standalone tests (Don't require an instance of Eclipse) - suite.addTest(AllBugzillaHeadlessStandaloneTests.suite(defaultOnly, excludeFixtureArray)); + suite.addTest(AllBugzillaHeadlessStandaloneTests.suite(defaultOnly)); // Tests that only need to run once (i.e. no network io so doesn't matter which repository) suite.addTestSuite(TaskEditorTest.class); @@ -62,23 +62,16 @@ public class AllBugzillaTests { addTests(suite, BugzillaFixture.DEFAULT); } else { for (BugzillaFixture fixture : BugzillaFixture.ALL) { - String fixtureURL = fixture.getRepositoryUrl(); - boolean excludeFound = false; - for (String excludeFixtureURL : excludeFixtureArray) { - if (excludeFixtureURL.equals(fixtureURL)) { - excludeFound = true; - break; - } - } - if (excludeFound) { - continue; - } addTests(suite, fixture); } } } private static void addTests(TestSuite suite, BugzillaFixture fixture) { + if (fixture.isExcluded()) { + return; + } + fixture.createSuite(suite); fixture.add(RepositoryReportFactoryTest.class); fixture.add(BugzillaTaskDataHandlerTest.class); diff --git a/org.eclipse.mylyn.tests.util/src/org/eclipse/mylyn/tests/util/TestFixture.java b/org.eclipse.mylyn.tests.util/src/org/eclipse/mylyn/tests/util/TestFixture.java index 732e2740c..17c694f34 100644 --- a/org.eclipse.mylyn.tests.util/src/org/eclipse/mylyn/tests/util/TestFixture.java +++ b/org.eclipse.mylyn.tests.util/src/org/eclipse/mylyn/tests/util/TestFixture.java @@ -12,6 +12,8 @@ package org.eclipse.mylyn.tests.util; import java.net.Proxy; +import java.util.Arrays; +import java.util.HashSet; import junit.framework.TestCase; import junit.framework.TestSuite; @@ -237,4 +239,10 @@ public abstract class TestFixture { } } + public boolean isExcluded() { + String excludeFixture = System.getProperty("mylyn.test.exclude", ""); + String[] excludeFixtureArray = excludeFixture.split(","); + return new HashSet<String>(Arrays.asList(excludeFixtureArray)).contains(getRepositoryUrl()); + } + } |