Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrank Becker2016-07-23 13:50:04 -0400
committerSam Davis2016-07-25 14:47:28 -0400
commit7e5534c82054fc763ae7fd51c8d4b5ed5466fe8e (patch)
treed288604c7f0c93fc1624570fd86d2e1be03cbffe /connector-bugzilla-rest
parentd3cdd7b5193eb6c2a4ce3099e8b856caa982dfae (diff)
downloadorg.eclipse.mylyn.tasks-7e5534c82054fc763ae7fd51c8d4b5ed5466fe8e.tar.gz
org.eclipse.mylyn.tasks-7e5534c82054fc763ae7fd51c8d4b5ed5466fe8e.tar.xz
org.eclipse.mylyn.tasks-7e5534c82054fc763ae7fd51c8d4b5ed5466fe8e.zip
493278: Bugzilla REST integration tests should run as part of
integration-connectors, not integration Change-Id: I6b1bf55f77917d9f7bea938f9bec198089f4fc66 Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=493278 Signed-off-by: Frank Becker <eclipse@frank-becker.de>
Diffstat (limited to 'connector-bugzilla-rest')
-rw-r--r--connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core.tests/src/org/eclipse/mylyn/bugzilla/rest/core/tests/AllBugzillaRestCoreTests.java39
-rw-r--r--connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core.tests/src/org/eclipse/mylyn/bugzilla/rest/core/tests/BugzillaRestConfigurationTest.java14
-rw-r--r--connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core.tests/src/org/eclipse/mylyn/bugzilla/rest/core/tests/RepositoryKeyTest.java34
-rw-r--r--connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core.tests/src/org/eclipse/mylyn/bugzilla/rest/test/support/BugzillaRestTestFixture.java38
4 files changed, 98 insertions, 27 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 36eeb6706..0bcfc8119 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,12 +11,41 @@
package org.eclipse.mylyn.bugzilla.rest.core.tests;
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-import org.junit.runners.Suite.SuiteClasses;
+import org.eclipse.mylyn.commons.sdk.util.CommonTestUtil;
+import org.eclipse.mylyn.commons.sdk.util.ManagedTestSuite;
+import org.eclipse.mylyn.commons.sdk.util.TestConfiguration;
+
+import junit.framework.JUnit4TestAdapter;
+import junit.framework.Test;
+import junit.framework.TestSuite;
-@RunWith(Suite.class)
-@SuiteClasses({ BugzillaRestClientTest.class, BugzillaRestConfigurationTest.class, BugzillaRestConnectorTest.class })
public class AllBugzillaRestCoreTests {
+ public static Test suite() {
+ 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));
+ }
+ }
}
diff --git a/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core.tests/src/org/eclipse/mylyn/bugzilla/rest/core/tests/BugzillaRestConfigurationTest.java b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core.tests/src/org/eclipse/mylyn/bugzilla/rest/core/tests/BugzillaRestConfigurationTest.java
index 03769380e..3eb87935e 100644
--- a/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core.tests/src/org/eclipse/mylyn/bugzilla/rest/core/tests/BugzillaRestConfigurationTest.java
+++ b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core.tests/src/org/eclipse/mylyn/bugzilla/rest/core/tests/BugzillaRestConfigurationTest.java
@@ -12,9 +12,7 @@
package org.eclipse.mylyn.bugzilla.rest.core.tests;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
import java.io.IOException;
@@ -26,9 +24,7 @@ import org.eclipse.mylyn.commons.sdk.util.Junit4TestFixtureRunner;
import org.eclipse.mylyn.commons.sdk.util.Junit4TestFixtureRunner.FixtureDefinition;
import org.eclipse.mylyn.internal.bugzilla.rest.core.BugzillaRestConfiguration;
import org.eclipse.mylyn.internal.bugzilla.rest.core.BugzillaRestConnector;
-import org.eclipse.mylyn.internal.bugzilla.rest.core.RepositoryKey;
import org.eclipse.mylyn.internal.tasks.core.TaskRepositoryManager;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
import org.junit.After;
import org.junit.Before;
import org.junit.BeforeClass;
@@ -69,16 +65,6 @@ public class BugzillaRestConfigurationTest {
}
@Test
- public void testRepositoryKey() throws CoreException {
- RepositoryKey rep1 = new RepositoryKey(new TaskRepository("xx", "url"));
- RepositoryKey rep2 = new RepositoryKey(new TaskRepository("xx1", "url1"));
- RepositoryKey rep3 = new RepositoryKey(new TaskRepository("xx", "url"));
- assertTrue(rep1.equals(rep1));
- assertTrue(rep1.equals(rep3));
- assertFalse(rep1.equals(rep2));
- }
-
- @Test
public void testConfigurationFromConnector() throws CoreException, IOException {
BugzillaRestConfiguration configuration = connector.getRepositoryConfiguration(actualFixture.repository());
assertNotNull(configuration);
diff --git a/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core.tests/src/org/eclipse/mylyn/bugzilla/rest/core/tests/RepositoryKeyTest.java b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core.tests/src/org/eclipse/mylyn/bugzilla/rest/core/tests/RepositoryKeyTest.java
new file mode 100644
index 000000000..37d87d9d4
--- /dev/null
+++ b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core.tests/src/org/eclipse/mylyn/bugzilla/rest/core/tests/RepositoryKeyTest.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2016 Frank Becker and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Frank Becker - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.mylyn.bugzilla.rest.core.tests;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.mylyn.internal.bugzilla.rest.core.RepositoryKey;
+import org.eclipse.mylyn.tasks.core.TaskRepository;
+import org.junit.Test;
+
+public class RepositoryKeyTest {
+
+ @Test
+ public void testRepositoryKey() throws CoreException {
+ RepositoryKey rep1 = new RepositoryKey(new TaskRepository("xx", "url"));
+ RepositoryKey rep2 = new RepositoryKey(new TaskRepository("xx1", "url1"));
+ RepositoryKey rep3 = new RepositoryKey(new TaskRepository("xx", "url"));
+ assertTrue(rep1.equals(rep1));
+ assertTrue(rep1.equals(rep3));
+ assertFalse(rep1.equals(rep2));
+ }
+
+}
diff --git a/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core.tests/src/org/eclipse/mylyn/bugzilla/rest/test/support/BugzillaRestTestFixture.java b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core.tests/src/org/eclipse/mylyn/bugzilla/rest/test/support/BugzillaRestTestFixture.java
index ad22630d7..8e0c9d747 100644
--- a/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core.tests/src/org/eclipse/mylyn/bugzilla/rest/test/support/BugzillaRestTestFixture.java
+++ b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core.tests/src/org/eclipse/mylyn/bugzilla/rest/test/support/BugzillaRestTestFixture.java
@@ -13,16 +13,16 @@ package org.eclipse.mylyn.bugzilla.rest.test.support;
import org.eclipse.mylyn.commons.net.AuthenticationCredentials;
import org.eclipse.mylyn.commons.repositories.core.auth.UserCredentials;
-import org.eclipse.mylyn.commons.sdk.util.AbstractTestFixture;
import org.eclipse.mylyn.commons.sdk.util.CommonTestUtil;
import org.eclipse.mylyn.commons.sdk.util.CommonTestUtil.PrivilegeLevel;
import org.eclipse.mylyn.commons.sdk.util.FixtureConfiguration;
+import org.eclipse.mylyn.commons.sdk.util.RepositoryTestFixture;
import org.eclipse.mylyn.commons.sdk.util.TestConfiguration;
import org.eclipse.mylyn.internal.bugzilla.rest.core.BugzillaRestConnector;
import org.eclipse.mylyn.internal.bugzilla.rest.core.BugzillaRestCore;
import org.eclipse.mylyn.tasks.core.TaskRepository;
-public class BugzillaRestTestFixture extends AbstractTestFixture {
+public class BugzillaRestTestFixture extends RepositoryTestFixture {
public final String version;
@@ -30,15 +30,37 @@ public class BugzillaRestTestFixture extends AbstractTestFixture {
private final BugzillaRestConnector connector = new BugzillaRestConnector();
- @Override
- protected AbstractTestFixture getDefault() {
+ public static final BugzillaRestTestFixture DEFAULT = discoverDefault();
+
+ private static BugzillaRestTestFixture discoverDefault() {
return TestConfiguration.getDefault().discoverDefault(BugzillaRestTestFixture.class, "bugzillaREST");
}
- public BugzillaRestTestFixture(FixtureConfiguration config) {
- super(BugzillaRestCore.CONNECTOR_KIND, config);
- version = config.getVersion();
- setInfo("Bugzilla", config.getVersion(), config.getInfo());
+ private static BugzillaRestTestFixture current;
+
+ public static BugzillaRestTestFixture current() {
+ if (current == null) {
+ DEFAULT.activate();
+ }
+ return current;
+ }
+
+ @Override
+ protected BugzillaRestTestFixture activate() {
+ current = this;
+ return this;
+ }
+
+ @Override
+ protected BugzillaRestTestFixture getDefault() {
+ return DEFAULT;
+ }
+
+ public BugzillaRestTestFixture(FixtureConfiguration configuration) {
+ super(BugzillaRestCore.CONNECTOR_KIND, configuration.getUrl());
+ version = configuration.getVersion();
+ setInfo("Bugzilla", configuration.getVersion(), configuration.getInfo());
+ setDefaultproperties(configuration.getProperties());
}
public String getVersion() {

Back to the top