summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteffen Pingel2011-10-14 09:49:16 (EDT)
committerSteffen Pingel2011-10-14 09:49:16 (EDT)
commitbe91008417471f686d8b2f55481159d2173f1ff0 (patch)
tree305030a5028c99f89b15d07e5a8b62db94342b15
parent3123275438c2aa4402b1aaa1763c51846902459d (diff)
downloadorg.eclipse.mylyn.tasks-be91008417471f686d8b2f55481159d2173f1ff0.zip
org.eclipse.mylyn.tasks-be91008417471f686d8b2f55481159d2173f1ff0.tar.gz
org.eclipse.mylyn.tasks-be91008417471f686d8b2f55481159d2173f1ff0.tar.bz2
ASSIGNED - bug 359976: rework of some Bugzilla Test
https://bugs.eclipse.org/bugs/show_bug.cgi?id=359976 Change-Id: I3c2f230e4755f2d38709ae4f8c5cdab9a6f7cdd8
-rw-r--r--org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/AllBugzillaHeadlessStandaloneTests.java22
-rw-r--r--org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/AllBugzillaTests.java23
-rw-r--r--org.eclipse.mylyn.tests.util/src/org/eclipse/mylyn/tests/util/TestFixture.java8
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 40cf0fd..7d9882b 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 4501fd8..a5583f6 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 732e274..17c694f 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());
+ }
+
}