Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 175453 Details for
Bug 320697
[regression] priorities mapped to P3 when migrating from Bugzilla 3.4 or earlier
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
fix and test case
clipboard.txt (text/plain), 15.41 KB, created by
Steffen Pingel
on 2010-07-29 00:30:02 EDT
(
hide
)
Description:
fix and test case
Filename:
MIME Type:
Creator:
Steffen Pingel
Created:
2010-07-29 00:30:02 EDT
Size:
15.41 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.mylyn.bugzilla.core >Index: src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaRepositoryConnector.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaRepositoryConnector.java,v >retrieving revision 1.181 >diff -u -r1.181 BugzillaRepositoryConnector.java >--- src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaRepositoryConnector.java 8 Jun 2010 23:05:03 -0000 1.181 >+++ src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaRepositoryConnector.java 29 Jul 2010 04:29:38 -0000 >@@ -47,9 +47,9 @@ > import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector; > import org.eclipse.mylyn.tasks.core.IRepositoryQuery; > import org.eclipse.mylyn.tasks.core.ITask; >+import org.eclipse.mylyn.tasks.core.ITask.PriorityLevel; > import org.eclipse.mylyn.tasks.core.RepositoryStatus; > import org.eclipse.mylyn.tasks.core.TaskRepository; >-import org.eclipse.mylyn.tasks.core.ITask.PriorityLevel; > import org.eclipse.mylyn.tasks.core.data.AbstractTaskAttachmentHandler; > import org.eclipse.mylyn.tasks.core.data.AbstractTaskDataHandler; > import org.eclipse.mylyn.tasks.core.data.TaskAttribute; >@@ -665,9 +665,7 @@ > if (bugzillaVersion.compareTo(BugzillaVersion.BUGZILLA_3_6) >= 0) { > BugzillaPriorityLevel bugzillaPriorityLevel = BugzillaPriorityLevel.fromPriority(getPriority()); > if (bugzillaPriorityLevel != null) { >- return BugzillaPriorityLevel.fromPriority(getPriority()).toPriorityLevel(); >- } else { >- PriorityLevel.getDefault(); >+ return bugzillaPriorityLevel.toPriorityLevel(); > } > } > return super.getPriorityLevel(); >@@ -981,11 +979,11 @@ > } > > public enum BugzillaPriorityLevel { >- HIGHEST, HIGH, NORMAL, LOW, LOWEST, NOSELECT; >+ HIGHEST, HIGH, NORMAL, LOW, LOWEST, NONE; > > public static BugzillaPriorityLevel fromPriority(String priority) { > if (priority == null) { >- return NOSELECT; >+ return null; > } > if (priority.equals("Highest")) { //$NON-NLS-1$ > return HIGHEST; >@@ -1002,7 +1000,13 @@ > if (priority.equals("Lowest")) { //$NON-NLS-1$ > return LOWEST; > } >- return NOSELECT; >+ if (priority.equals("Lowest")) { //$NON-NLS-1$ >+ return LOWEST; >+ } >+ if (priority.equals("---")) { //$NON-NLS-1$ >+ return NONE; >+ } >+ return null; > } > > public PriorityLevel toPriorityLevel() { >@@ -1017,6 +1021,8 @@ > return PriorityLevel.P4; > case LOWEST: > return PriorityLevel.P5; >+ case NONE: >+ return PriorityLevel.P3; > default: > return null; > } >@@ -1035,7 +1041,7 @@ > return "Low"; //$NON-NLS-1$ > case LOWEST: > return "Lowest"; //$NON-NLS-1$ >- case NOSELECT: >+ case NONE: > return "---"; //$NON-NLS-1$ > default: > return null; >#P org.eclipse.mylyn.bugzilla.tests >Index: src/org/eclipse/mylyn/bugzilla/tests/AllBugzillaTests.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/AllBugzillaTests.java,v >retrieving revision 1.59 >diff -u -r1.59 AllBugzillaTests.java >--- src/org/eclipse/mylyn/bugzilla/tests/AllBugzillaTests.java 8 Jun 2010 23:06:34 -0000 1.59 >+++ src/org/eclipse/mylyn/bugzilla/tests/AllBugzillaTests.java 29 Jul 2010 04:29:39 -0000 >@@ -14,7 +14,6 @@ > import junit.framework.Test; > import junit.framework.TestSuite; > >-import org.eclipse.mylyn.bugzilla.tests.core.BugzillaPriorityTest; > import org.eclipse.mylyn.bugzilla.tests.support.BugzillaFixture; > import org.eclipse.mylyn.bugzilla.tests.ui.BugzillaHyperlinkDetectorTest; > import org.eclipse.mylyn.bugzilla.tests.ui.BugzillaRepositorySettingsPageTest; >@@ -50,7 +49,6 @@ > 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. >Index: src/org/eclipse/mylyn/bugzilla/tests/core/BugzillaPriorityTest.java >=================================================================== >RCS file: src/org/eclipse/mylyn/bugzilla/tests/core/BugzillaPriorityTest.java >diff -N src/org/eclipse/mylyn/bugzilla/tests/core/BugzillaPriorityTest.java >--- src/org/eclipse/mylyn/bugzilla/tests/core/BugzillaPriorityTest.java 11 May 2010 20:54:30 -0000 1.1 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,80 +0,0 @@ >-/******************************************************************************* >- * 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()); >- } >-} >Index: src/org/eclipse/mylyn/bugzilla/tests/core/BugzillaRepositoryConnectorStandaloneTest.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/core/BugzillaRepositoryConnectorStandaloneTest.java,v >retrieving revision 1.8 >diff -u -r1.8 BugzillaRepositoryConnectorStandaloneTest.java >--- src/org/eclipse/mylyn/bugzilla/tests/core/BugzillaRepositoryConnectorStandaloneTest.java 8 Jun 2010 23:06:34 -0000 1.8 >+++ src/org/eclipse/mylyn/bugzilla/tests/core/BugzillaRepositoryConnectorStandaloneTest.java 29 Jul 2010 04:29:39 -0000 >@@ -8,6 +8,7 @@ > * Contributors: > * Nathan Hapke - initial API and implementation > * Tasktop Technologies - improvements >+ * Frank Becker - improvements > *******************************************************************************/ > > package org.eclipse.mylyn.bugzilla.tests.core; >@@ -26,12 +27,17 @@ > import org.eclipse.mylyn.internal.bugzilla.core.BugzillaAttribute; > import org.eclipse.mylyn.internal.bugzilla.core.BugzillaClient; > import org.eclipse.mylyn.internal.bugzilla.core.BugzillaRepositoryConnector; >+import org.eclipse.mylyn.internal.bugzilla.core.BugzillaVersion; > import org.eclipse.mylyn.internal.tasks.core.AbstractTask; > import org.eclipse.mylyn.internal.tasks.core.RepositoryQuery; > import org.eclipse.mylyn.internal.tasks.core.TaskTask; >+import org.eclipse.mylyn.tasks.core.ITask.PriorityLevel; >+import org.eclipse.mylyn.tasks.core.ITaskMapping; > import org.eclipse.mylyn.tasks.core.RepositoryResponse; > 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.tasks.core.data.TaskDataCollector; > import org.eclipse.mylyn.tests.util.TestUtil.PrivilegeLevel; >@@ -41,6 +47,7 @@ > * @author Rob Elves > * @author Thomas Ehrnhoefer > * @author Steffen Pingel >+ * @author Frank Becker > */ > public class BugzillaRepositoryConnectorStandaloneTest extends TestCase { > >@@ -220,10 +227,14 @@ > + email + "&type0-0-0=notequals&field0-0-1=reporter&value0-0-0=UNCONFIRMED&emailtype1=exact"; > > // make sure initial task is not P1/trivial >- assertFalse(taskData.getRoot().getMappedAttribute(BugzillaAttribute.PRIORITY.getKey()).getValue().equals( >- priority)); >- assertFalse(taskData.getRoot().getMappedAttribute(BugzillaAttribute.BUG_SEVERITY.getKey()).getValue().equals( >- severity)); >+ assertFalse(taskData.getRoot() >+ .getMappedAttribute(BugzillaAttribute.PRIORITY.getKey()) >+ .getValue() >+ .equals(priority)); >+ assertFalse(taskData.getRoot() >+ .getMappedAttribute(BugzillaAttribute.BUG_SEVERITY.getKey()) >+ .getValue() >+ .equals(severity)); > > // run query > RepositoryQuery query = new RepositoryQuery(repository.getConnectorKind(), "handle-testQueryViaConnector"); >@@ -238,8 +249,9 @@ > connector.performQuery(repository, query, collector, null, new NullProgressMonitor()); > > // set priority and severity on task >- taskData.getRoot().getMappedAttribute(BugzillaAttribute.SHORT_DESC.getKey()).setValue( >- System.currentTimeMillis() + ""); >+ taskData.getRoot() >+ .getMappedAttribute(BugzillaAttribute.SHORT_DESC.getKey()) >+ .setValue(System.currentTimeMillis() + ""); > taskData.getRoot().getMappedAttribute(BugzillaAttribute.PRIORITY.getKey()).setValue(priority); > taskData.getRoot().getMappedAttribute(BugzillaAttribute.BUG_SEVERITY.getKey()).setValue(severity); > RepositoryResponse response = BugzillaFixture.current().submitTask(taskData, client); >@@ -261,8 +273,49 @@ > assertEquals(1, changedTaskData2.size()); > taskData = changedTaskData2.get(taskData.getTaskId()); > assertNotNull(taskData); >- assertTrue(taskData.getRoot().getAttribute(BugzillaAttribute.SHORT_DESC.getKey()).getValue().equals( >- taskDataNew.getRoot().getAttribute(BugzillaAttribute.SHORT_DESC.getKey()).getValue())); >+ assertTrue(taskData.getRoot() >+ .getAttribute(BugzillaAttribute.SHORT_DESC.getKey()) >+ .getValue() >+ .equals(taskDataNew.getRoot().getAttribute(BugzillaAttribute.SHORT_DESC.getKey()).getValue())); > } > >+ public void testGetTaskMappingPriority() throws Exception { >+ BugzillaVersion version = new BugzillaVersion(BugzillaFixture.current().getVersion()); >+ >+ 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); >+ >+ taskData.getRoot().createMappedAttribute(BugzillaAttribute.PRIORITY.getKey()).setValue("P1"); >+ assertEquals(PriorityLevel.P1, mapping.getPriorityLevel()); >+ taskData.getRoot().createMappedAttribute(BugzillaAttribute.PRIORITY.getKey()).setValue("P2"); >+ assertEquals(PriorityLevel.P2, mapping.getPriorityLevel()); >+ taskData.getRoot().createMappedAttribute(BugzillaAttribute.PRIORITY.getKey()).setValue("P3"); >+ assertEquals(PriorityLevel.P3, mapping.getPriorityLevel()); >+ taskData.getRoot().createMappedAttribute(BugzillaAttribute.PRIORITY.getKey()).setValue("P4"); >+ assertEquals(PriorityLevel.P4, mapping.getPriorityLevel()); >+ taskData.getRoot().createMappedAttribute(BugzillaAttribute.PRIORITY.getKey()).setValue("P5"); >+ assertEquals(PriorityLevel.P5, mapping.getPriorityLevel()); >+ taskData.getRoot().createMappedAttribute(BugzillaAttribute.PRIORITY.getKey()).setValue("abc"); >+ assertEquals(PriorityLevel.P3, mapping.getPriorityLevel()); >+ if (!version.isSmaller(BugzillaVersion.BUGZILLA_3_6)) { >+ // fresh bugzilla 3.6 databases have a new schema for priorities >+ taskData.getRoot().createMappedAttribute(BugzillaAttribute.PRIORITY.getKey()).setValue("Highest"); >+ assertEquals(PriorityLevel.P1, mapping.getPriorityLevel()); >+ taskData.getRoot().createMappedAttribute(BugzillaAttribute.PRIORITY.getKey()).setValue("High"); >+ assertEquals(PriorityLevel.P2, mapping.getPriorityLevel()); >+ taskData.getRoot().createMappedAttribute(BugzillaAttribute.PRIORITY.getKey()).setValue("Normal"); >+ assertEquals(PriorityLevel.P3, mapping.getPriorityLevel()); >+ taskData.getRoot().createMappedAttribute(BugzillaAttribute.PRIORITY.getKey()).setValue("Low"); >+ assertEquals(PriorityLevel.P4, mapping.getPriorityLevel()); >+ taskData.getRoot().createMappedAttribute(BugzillaAttribute.PRIORITY.getKey()).setValue("Lowest"); >+ assertEquals(PriorityLevel.P5, mapping.getPriorityLevel()); >+ taskData.getRoot().createMappedAttribute(BugzillaAttribute.PRIORITY.getKey()).setValue("---"); >+ assertEquals(PriorityLevel.P3, mapping.getPriorityLevel()); >+ taskData.getRoot().createMappedAttribute(BugzillaAttribute.PRIORITY.getKey()).setValue("abc"); >+ assertEquals(PriorityLevel.P3, mapping.getPriorityLevel()); >+ } >+ } > } >\ No newline at end of file
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 320697
: 175453 |
175454