Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfbecker2010-05-11 16:54:31 -0400
committerfbecker2010-05-11 16:54:31 -0400
commitde52c4bc394e75fc4eabe620a6871a9fd06c7dee (patch)
tree28ede8f2534ba2a0943a8d4470d0c5a909f10793 /org.eclipse.mylyn.bugzilla.tests
parent90e70dc324a5cae7bec2a4ba570accec141dc935 (diff)
downloadorg.eclipse.mylyn.tasks-de52c4bc394e75fc4eabe620a6871a9fd06c7dee.tar.gz
org.eclipse.mylyn.tasks-de52c4bc394e75fc4eabe620a6871a9fd06c7dee.tar.xz
org.eclipse.mylyn.tasks-de52c4bc394e75fc4eabe620a6871a9fd06c7dee.zip
ASSIGNED - bug 310875: Bugzilla Connector doesn't show priorities for Bugzilla 3.6
https://bugs.eclipse.org/bugs/show_bug.cgi?id=310875
Diffstat (limited to 'org.eclipse.mylyn.bugzilla.tests')
-rw-r--r--org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/AllBugzillaTests.java2
-rw-r--r--org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/core/BugzillaPriorityTest.java80
2 files changed, 82 insertions, 0 deletions
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 67b7efc5e..77acf8e81 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,6 +14,7 @@ package org.eclipse.mylyn.bugzilla.tests;
import junit.framework.Test;
import junit.framework.TestSuite;
+import org.eclipse.mylyn.bugzilla.tests.core.BugzillaPriorityTest;
import org.eclipse.mylyn.bugzilla.tests.core.BugzillaXMLRPCTest;
import org.eclipse.mylyn.bugzilla.tests.support.BugzillaFixture;
import org.eclipse.mylyn.bugzilla.tests.ui.BugzillaRepositorySettingsPageTest;
@@ -48,6 +49,7 @@ public class AllBugzillaTests {
fixture.add(BugzillaTaskDataHandlerTest.class);
fixture.add(BugzillaSearchTest.class);
fixture.add(EncodingTest.class);
+ fixture.add(BugzillaPriorityTest.class);
// Move any tests here that are resulting in spurious failures
// due to recent changes in Bugzilla Server head.
diff --git a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/core/BugzillaPriorityTest.java b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/core/BugzillaPriorityTest.java
new file mode 100644
index 000000000..3c5e86ec3
--- /dev/null
+++ b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/core/BugzillaPriorityTest.java
@@ -0,0 +1,80 @@
+/*******************************************************************************
+ * Copyright (c) 2010 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.tests.core;
+
+import junit.framework.TestCase;
+
+import org.eclipse.mylyn.bugzilla.tests.support.BugzillaFixture;
+import org.eclipse.mylyn.internal.bugzilla.core.BugzillaAttribute;
+import org.eclipse.mylyn.internal.bugzilla.core.BugzillaRepositoryConnector;
+import org.eclipse.mylyn.internal.bugzilla.core.BugzillaVersion;
+import org.eclipse.mylyn.tasks.core.ITask.PriorityLevel;
+import org.eclipse.mylyn.tasks.core.ITaskMapping;
+import org.eclipse.mylyn.tasks.core.TaskRepository;
+import org.eclipse.mylyn.tasks.core.data.AbstractTaskDataHandler;
+import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
+import org.eclipse.mylyn.tasks.core.data.TaskAttributeMapper;
+import org.eclipse.mylyn.tasks.core.data.TaskData;
+import org.eclipse.mylyn.tests.util.TestUtil.PrivilegeLevel;
+
+public class BugzillaPriorityTest extends TestCase {
+
+ private TaskRepository repository;
+
+ private BugzillaRepositoryConnector connector;
+
+ @Override
+ public void setUp() throws Exception {
+ BugzillaFixture.current().client(PrivilegeLevel.USER);
+ repository = BugzillaFixture.current().repository();
+ connector = BugzillaFixture.current().connector();
+ }
+
+ public void testPriority() throws Exception {
+ BugzillaVersion version = new BugzillaVersion(BugzillaFixture.current().getVersion());
+ boolean useOldWay = version.isSmaller(BugzillaVersion.BUGZILLA_3_6);
+
+ AbstractTaskDataHandler taskDataHandler = connector.getTaskDataHandler();
+ TaskAttributeMapper mapper = taskDataHandler.getAttributeMapper(repository);
+ TaskData taskData = new TaskData(mapper, repository.getConnectorKind(), repository.getRepositoryUrl(), "");
+ ITaskMapping mapping = connector.getTaskMapping(taskData);
+ taskDataHandler.initializeTaskData(repository, taskData, null, null);
+ String value;
+ PriorityLevel level;
+
+ level = PriorityLevel.P1;
+ value = useOldWay ? level.toString() : "Highest";
+ taskData.getRoot().createMappedAttribute(BugzillaAttribute.PRIORITY.getKey()).setValue(value);
+ assertEquals(value, taskData.getRoot().getMappedAttribute(TaskAttribute.PRIORITY).getValue());
+ assertEquals(level, mapping.getPriorityLevel());
+ level = PriorityLevel.P2;
+ value = useOldWay ? level.toString() : "High";
+ taskData.getRoot().createMappedAttribute(BugzillaAttribute.PRIORITY.getKey()).setValue(value);
+ assertEquals(value, taskData.getRoot().getMappedAttribute(TaskAttribute.PRIORITY).getValue());
+ assertEquals(level, mapping.getPriorityLevel());
+ level = PriorityLevel.P3;
+ value = useOldWay ? level.toString() : "Normal";
+ taskData.getRoot().createMappedAttribute(BugzillaAttribute.PRIORITY.getKey()).setValue(value);
+ assertEquals(value, taskData.getRoot().getMappedAttribute(TaskAttribute.PRIORITY).getValue());
+ assertEquals(level, mapping.getPriorityLevel());
+ level = PriorityLevel.P4;
+ value = useOldWay ? level.toString() : "Low";
+ taskData.getRoot().createMappedAttribute(BugzillaAttribute.PRIORITY.getKey()).setValue(value);
+ assertEquals(value, taskData.getRoot().getMappedAttribute(TaskAttribute.PRIORITY).getValue());
+ assertEquals(level, mapping.getPriorityLevel());
+ level = PriorityLevel.P5;
+ value = useOldWay ? level.toString() : "Lowest";
+ taskData.getRoot().createMappedAttribute(BugzillaAttribute.PRIORITY.getKey()).setValue(value);
+ assertEquals(value, taskData.getRoot().getMappedAttribute(TaskAttribute.PRIORITY).getValue());
+ assertEquals(level, mapping.getPriorityLevel());
+ }
+}

Back to the top