diff options
author | Sam Davis | 2016-07-21 21:39:05 +0000 |
---|---|---|
committer | Sam Davis | 2016-07-21 21:39:05 +0000 |
commit | 646e30a360627e4b625142308ed465ed1ff1d840 (patch) | |
tree | 4919f64b4f296913cfbd8505558c180f967a4aad /org.eclipse.mylyn.bugzilla.tests | |
parent | b7621a8cb6f0306a65499b3802640a23f01c9ac0 (diff) | |
download | org.eclipse.mylyn.tasks-646e30a360627e4b625142308ed465ed1ff1d840.tar.gz org.eclipse.mylyn.tasks-646e30a360627e4b625142308ed465ed1ff1d840.tar.xz org.eclipse.mylyn.tasks-646e30a360627e4b625142308ed465ed1ff1d840.zip |
495085: do not use BugzillaFixture in local tests
Otherwise it will try to connect to mylyn.org to discover fixtures.
Change-Id: I1d9a7a4e1fb0ff8e78d12dc3be6613c76c67e713
Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=495085
Diffstat (limited to 'org.eclipse.mylyn.bugzilla.tests')
2 files changed, 123 insertions, 124 deletions
diff --git a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/core/BugzillaAttributeTest.java b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/core/BugzillaAttributeTest.java index 5fb813d49..f0aed2585 100644 --- a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/core/BugzillaAttributeTest.java +++ b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/core/BugzillaAttributeTest.java @@ -1,49 +1,48 @@ -/******************************************************************************* - * Copyright (c) 2013 Frank Becker and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse @Test - 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.tests.core; - -import junit.framework.TestCase; - -import org.apache.commons.io.IOUtils; -import org.eclipse.mylyn.bugzilla.tests.support.BugzillaFixture; -import org.eclipse.mylyn.commons.sdk.util.CommonTestUtil; -import org.eclipse.mylyn.internal.bugzilla.core.BugzillaAttribute; -import org.eclipse.mylyn.internal.bugzilla.core.BugzillaAttributeMapper; -import org.eclipse.mylyn.internal.bugzilla.core.BugzillaCorePlugin; -import org.eclipse.mylyn.internal.bugzilla.core.BugzillaRepositoryConnector; -import org.eclipse.mylyn.tasks.core.TaskRepository; -import org.eclipse.mylyn.tasks.core.data.TaskAttribute; -import org.eclipse.mylyn.tasks.core.data.TaskData; - -/** - * @author Steffen Pingel - */ -public class BugzillaAttributeTest extends TestCase { - - public void testTaskDataSchema() throws Exception { - BugzillaRepositoryConnector connector = BugzillaFixture.current().connector(); - TaskRepository repository = new TaskRepository(BugzillaCorePlugin.CONNECTOR_KIND, "http://repository"); - BugzillaAttributeMapper mapper = new BugzillaAttributeMapper(repository, connector); - TaskData taskData = new TaskData(mapper, repository.getConnectorKind(), repository.getRepositoryUrl(), ""); - BugzillaAttribute[] attributes = BugzillaAttribute.values(); - for (BugzillaAttribute attribute : attributes) { - TaskAttribute taskDataAttribute = taskData.getRoot().createAttribute(attribute.getKey()); - taskDataAttribute.getMetaData().setReadOnly(attribute.isReadOnly()); - taskDataAttribute.getMetaData().setKind(attribute.getKind()); - taskDataAttribute.getMetaData().setType(attribute.getType()); - } - assertEquals(IOUtils.toString(CommonTestUtil.getResource(this, "testdata/schema/taskdata.txt")), - taskData.getRoot().toString()); - } - +/*******************************************************************************
+ * Copyright (c) 2013 Frank Becker and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse @Test
+ 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.tests.core;
+
+import org.apache.commons.io.IOUtils;
+import org.eclipse.mylyn.commons.sdk.util.CommonTestUtil;
+import org.eclipse.mylyn.internal.bugzilla.core.BugzillaAttribute;
+import org.eclipse.mylyn.internal.bugzilla.core.BugzillaAttributeMapper;
+import org.eclipse.mylyn.internal.bugzilla.core.BugzillaCorePlugin;
+import org.eclipse.mylyn.internal.bugzilla.core.BugzillaRepositoryConnector;
+import org.eclipse.mylyn.tasks.core.TaskRepository;
+import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
+import org.eclipse.mylyn.tasks.core.data.TaskData;
+
+import junit.framework.TestCase;
+
+/**
+ * @author Steffen Pingel
+ */
+public class BugzillaAttributeTest extends TestCase {
+
+ public void testTaskDataSchema() throws Exception {
+ BugzillaRepositoryConnector connector = new BugzillaRepositoryConnector();
+ TaskRepository repository = new TaskRepository(BugzillaCorePlugin.CONNECTOR_KIND, "http://repository");
+ BugzillaAttributeMapper mapper = new BugzillaAttributeMapper(repository, connector);
+ TaskData taskData = new TaskData(mapper, repository.getConnectorKind(), repository.getRepositoryUrl(), "");
+ BugzillaAttribute[] attributes = BugzillaAttribute.values();
+ for (BugzillaAttribute attribute : attributes) {
+ TaskAttribute taskDataAttribute = taskData.getRoot().createAttribute(attribute.getKey());
+ taskDataAttribute.getMetaData().setReadOnly(attribute.isReadOnly());
+ taskDataAttribute.getMetaData().setKind(attribute.getKind());
+ taskDataAttribute.getMetaData().setType(attribute.getType());
+ }
+ assertEquals(IOUtils.toString(CommonTestUtil.getResource(this, "testdata/schema/taskdata.txt")),
+ taskData.getRoot().toString());
+ }
+
}
\ No newline at end of file diff --git a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/core/RepositoryConfigurationTest.java b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/core/RepositoryConfigurationTest.java index 9f02f2f24..7337bce18 100644 --- a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/core/RepositoryConfigurationTest.java +++ b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/core/RepositoryConfigurationTest.java @@ -1,76 +1,76 @@ -/******************************************************************************* - * Copyright (c) 2013, 2016 Tasktop Technologies 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: - * Tasktop Technologies - initial API and implementation - *******************************************************************************/ - -package org.eclipse.mylyn.bugzilla.tests.core; - -import java.util.List; - -import org.eclipse.mylyn.bugzilla.tests.support.BugzillaFixture; -import org.eclipse.mylyn.internal.bugzilla.core.BugzillaAttribute; -import org.eclipse.mylyn.internal.bugzilla.core.BugzillaAttributeMapper; -import org.eclipse.mylyn.internal.bugzilla.core.BugzillaCorePlugin; -import org.eclipse.mylyn.internal.bugzilla.core.RepositoryConfiguration; -import org.eclipse.mylyn.tasks.core.TaskRepository; -import org.eclipse.mylyn.tasks.core.data.TaskData; - -import junit.framework.TestCase; - -public class RepositoryConfigurationTest extends TestCase { - - private final static String PRODUCT = "product"; - - RepositoryConfiguration cfg; - - @Override - protected void setUp() throws Exception { - cfg = new RepositoryConfiguration(); - cfg.addProduct(PRODUCT); - } - - public void testGetUnconfirmedAllowed_product() throws Exception { - assertFalse(cfg.getUnconfirmedAllowed(PRODUCT)); - } - - public void testGetUnconfirmedAllowed_productFalse() throws Exception { - cfg.addUnconfirmedAllowed(PRODUCT, Boolean.FALSE); - assertFalse(cfg.getUnconfirmedAllowed(PRODUCT)); - } - - public void testGetUnconfirmedAllowed_productNull() throws Exception { - cfg.addUnconfirmedAllowed(PRODUCT, null); - assertFalse(cfg.getUnconfirmedAllowed(PRODUCT)); - } - - public void testGetUnconfirmedAllowed_productTrue() throws Exception { - cfg.addUnconfirmedAllowed(PRODUCT, Boolean.TRUE); - assertTrue(cfg.getUnconfirmedAllowed(PRODUCT)); - } - - public void testGetUnconfirmedAllowed_noProduct() throws Exception { - assertFalse(cfg.getUnconfirmedAllowed("no-product")); - } - - public void testGetAttributeOptions() throws Exception { - TaskRepository repository = new TaskRepository(BugzillaCorePlugin.CONNECTOR_KIND, "http://repository"); - BugzillaAttributeMapper mapper = new BugzillaAttributeMapper(repository, BugzillaFixture.current().connector()); - TaskData taskData = new TaskData(mapper, repository.getConnectorKind(), repository.getRepositoryUrl(), ""); - - cfg.addItem(BugzillaAttribute.REP_PLATFORM, "3"); - cfg.addItem(BugzillaAttribute.REP_PLATFORM, "2"); - cfg.addItem(BugzillaAttribute.REP_PLATFORM, "1"); - List<String> options = cfg.getAttributeOptions(PRODUCT, - taskData.getRoot().createAttribute(BugzillaAttribute.REP_PLATFORM.getKey())); - assertEquals(3, options.size()); - assertEquals("1", options.get(0)); - assertEquals("2", options.get(1)); - assertEquals("3", options.get(2)); - } -} +/*******************************************************************************
+ * Copyright (c) 2013, 2016 Tasktop Technologies 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:
+ * Tasktop Technologies - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.mylyn.bugzilla.tests.core;
+
+import java.util.List;
+
+import org.eclipse.mylyn.internal.bugzilla.core.BugzillaAttribute;
+import org.eclipse.mylyn.internal.bugzilla.core.BugzillaAttributeMapper;
+import org.eclipse.mylyn.internal.bugzilla.core.BugzillaCorePlugin;
+import org.eclipse.mylyn.internal.bugzilla.core.BugzillaRepositoryConnector;
+import org.eclipse.mylyn.internal.bugzilla.core.RepositoryConfiguration;
+import org.eclipse.mylyn.tasks.core.TaskRepository;
+import org.eclipse.mylyn.tasks.core.data.TaskData;
+
+import junit.framework.TestCase;
+
+public class RepositoryConfigurationTest extends TestCase {
+
+ private final static String PRODUCT = "product";
+
+ RepositoryConfiguration cfg;
+
+ @Override
+ protected void setUp() throws Exception {
+ cfg = new RepositoryConfiguration();
+ cfg.addProduct(PRODUCT);
+ }
+
+ public void testGetUnconfirmedAllowed_product() throws Exception {
+ assertFalse(cfg.getUnconfirmedAllowed(PRODUCT));
+ }
+
+ public void testGetUnconfirmedAllowed_productFalse() throws Exception {
+ cfg.addUnconfirmedAllowed(PRODUCT, Boolean.FALSE);
+ assertFalse(cfg.getUnconfirmedAllowed(PRODUCT));
+ }
+
+ public void testGetUnconfirmedAllowed_productNull() throws Exception {
+ cfg.addUnconfirmedAllowed(PRODUCT, null);
+ assertFalse(cfg.getUnconfirmedAllowed(PRODUCT));
+ }
+
+ public void testGetUnconfirmedAllowed_productTrue() throws Exception {
+ cfg.addUnconfirmedAllowed(PRODUCT, Boolean.TRUE);
+ assertTrue(cfg.getUnconfirmedAllowed(PRODUCT));
+ }
+
+ public void testGetUnconfirmedAllowed_noProduct() throws Exception {
+ assertFalse(cfg.getUnconfirmedAllowed("no-product"));
+ }
+
+ public void testGetAttributeOptions() throws Exception {
+ TaskRepository repository = new TaskRepository(BugzillaCorePlugin.CONNECTOR_KIND, "http://repository");
+ BugzillaAttributeMapper mapper = new BugzillaAttributeMapper(repository, new BugzillaRepositoryConnector());
+ TaskData taskData = new TaskData(mapper, repository.getConnectorKind(), repository.getRepositoryUrl(), "");
+
+ cfg.addItem(BugzillaAttribute.REP_PLATFORM, "3");
+ cfg.addItem(BugzillaAttribute.REP_PLATFORM, "2");
+ cfg.addItem(BugzillaAttribute.REP_PLATFORM, "1");
+ List<String> options = cfg.getAttributeOptions(PRODUCT,
+ taskData.getRoot().createAttribute(BugzillaAttribute.REP_PLATFORM.getKey()));
+ assertEquals(3, options.size());
+ assertEquals("1", options.get(0));
+ assertEquals("2", options.get(1));
+ assertEquals("3", options.get(2));
+ }
+}
|