summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteffen Pingel2012-03-03 11:29:26 (EST)
committerSteffen Pingel2012-03-03 11:29:26 (EST)
commit71dd781b3871ea984b27b1295487aa5253a590c9 (patch)
tree9d8ce17d59eefa8ce9244a1efc007f84d4f27abc
parente6c68d8288c4476487902093b002a07821f8ac77 (diff)
downloadorg.eclipse.mylyn.tasks-71dd781b3871ea984b27b1295487aa5253a590c9.zip
org.eclipse.mylyn.tasks-71dd781b3871ea984b27b1295487aa5253a590c9.tar.gz
org.eclipse.mylyn.tasks-71dd781b3871ea984b27b1295487aa5253a590c9.tar.bz2
REOPENED - bug 367861: fields marked as incoming on Eclipse.org that had
no changes https://bugs.eclipse.org/bugs/show_bug.cgi?id=367861 Change-Id: I3455c35d0345842d8a98ad2a534dddc8e176334c
-rw-r--r--org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaAttributeMapper.java17
-rw-r--r--org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/AllBugzillaHeadlessStandaloneTests.java2
-rw-r--r--org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/core/BugzillaAttributeMapperTest.java118
3 files changed, 135 insertions, 2 deletions
diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaAttributeMapper.java b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaAttributeMapper.java
index 8337968..b920d0b 100644
--- a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaAttributeMapper.java
+++ b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaAttributeMapper.java
@@ -321,14 +321,27 @@ public class BugzillaAttributeMapper extends TaskAttributeMapper {
// the ID mapping for Bugzilla changed in Mylyn 3.7, always consider existing comments equal
return true;
}
- if (oldAttribute.getId().startsWith(TaskAttribute.PREFIX_ATTACHMENT)) {
+ String id = oldAttribute.getId();
+ if (id.startsWith(TaskAttribute.PREFIX_ATTACHMENT)) {
TaskAttachmentMapper oldAttachment;
oldAttachment = TaskAttachmentMapper.createFrom(oldAttribute);
TaskAttachmentMapper newAttachment;
newAttachment = TaskAttachmentMapper.createFrom(newAttribute);
return newAttachment.equals(oldAttachment);
}
- return super.equals(newAttribute, oldAttribute);
+ boolean result = super.equals(newAttribute, oldAttribute);
+ // bug 367861: avoid showing incomings for fields that were previously not part of the schema when empty
+ if (!result //
+ && (BugzillaAttribute.RESOLUTION.getKey().equals(id)
+ || BugzillaAttribute.BUG_FILE_LOC.getKey().equals(id)
+ || BugzillaAttribute.STATUS_WHITEBOARD.getKey().equals(id) //
+ || BugzillaAttribute.KEYWORDS.getKey().equals(id))) {
+ if (oldAttribute.getValue().length() == 0 && newAttribute.getValue().length() == 0
+ && oldAttribute.getValues().size() <= 1 && newAttribute.getValues().size() <= 1) {
+ return true;
+ }
+ }
+ return result;
}
@Override
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 9b5b9a7..7bbbc66 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
@@ -15,6 +15,7 @@ package org.eclipse.mylyn.bugzilla.tests;
import junit.framework.Test;
import junit.framework.TestSuite;
+import org.eclipse.mylyn.bugzilla.tests.core.BugzillaAttributeMapperTest;
import org.eclipse.mylyn.bugzilla.tests.core.BugzillaClientTest;
import org.eclipse.mylyn.bugzilla.tests.core.BugzillaConfigurationTest;
import org.eclipse.mylyn.bugzilla.tests.core.BugzillaCustomFieldsTest;
@@ -43,6 +44,7 @@ public class AllBugzillaHeadlessStandaloneTests {
suite.addTestSuite(BugzillaConfigurationTest.class);
suite.addTestSuite(BugzillaVersionTest.class);
suite.addTestSuite(BugzillaDateTimeTests.class);
+ suite.addTestSuite(BugzillaAttributeMapperTest.class);
if (!configuration.isLocalOnly()) {
// network tests
suite.addTestSuite(BugzillaTaskCompletionTest.class);
diff --git a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/core/BugzillaAttributeMapperTest.java b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/core/BugzillaAttributeMapperTest.java
new file mode 100644
index 0000000..27e7aac
--- /dev/null
+++ b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/core/BugzillaAttributeMapperTest.java
@@ -0,0 +1,118 @@
+/*******************************************************************************
+ * Copyright (c) 2012 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 junit.framework.TestCase;
+
+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.tasks.core.TaskRepository;
+import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
+import org.eclipse.mylyn.tasks.core.data.TaskData;
+import org.junit.Test;
+
+/**
+ * @author Steffen Pingel
+ */
+public class BugzillaAttributeMapperTest extends TestCase {
+
+ private BugzillaAttributeMapper mapper;
+
+ private TaskData oldTaskData;
+
+ private TaskData newTaskData;
+
+ @Override
+ protected void setUp() throws Exception {
+ TaskRepository repository = new TaskRepository(BugzillaCorePlugin.CONNECTOR_KIND, "http://repository");
+ mapper = new BugzillaAttributeMapper(repository, null);
+ oldTaskData = new TaskData(mapper, BugzillaCorePlugin.CONNECTOR_KIND, "http://repository", "id");
+ newTaskData = new TaskData(mapper, BugzillaCorePlugin.CONNECTOR_KIND, "http://repository", "id");
+ }
+
+ @Test
+ public void testEqualsTaskAttributeResolution() {
+ TaskAttribute oldAttribute = oldTaskData.getRoot().createAttribute(BugzillaAttribute.RESOLUTION.getKey());
+ TaskAttribute newAttribute = newTaskData.getRoot().createAttribute(BugzillaAttribute.RESOLUTION.getKey());
+
+ assertTrue(mapper.equals(newAttribute, oldAttribute));
+
+ oldAttribute.setValue("");
+ assertTrue(mapper.equals(newAttribute, oldAttribute));
+
+ newAttribute.setValue("");
+ assertTrue(mapper.equals(newAttribute, oldAttribute));
+ }
+
+ @Test
+ public void testEqualsTaskAttributeDescription() {
+ TaskAttribute oldAttribute = oldTaskData.getRoot().createAttribute(BugzillaAttribute.DESC.getKey());
+ TaskAttribute newAttribute = newTaskData.getRoot().createAttribute(BugzillaAttribute.DESC.getKey());
+
+ assertTrue(mapper.equals(newAttribute, oldAttribute));
+
+ oldAttribute.setValue("");
+ assertFalse(mapper.equals(newAttribute, oldAttribute));
+
+ newAttribute.setValue("");
+ assertTrue(mapper.equals(newAttribute, oldAttribute));
+ }
+
+ @Test
+ public void testEqualsTaskAttributeBugFileLoc() {
+ TaskAttribute oldAttribute = oldTaskData.getRoot().createAttribute(BugzillaAttribute.BUG_FILE_LOC.getKey());
+ TaskAttribute newAttribute = newTaskData.getRoot().createAttribute(BugzillaAttribute.BUG_FILE_LOC.getKey());
+
+ assertTrue(mapper.equals(newAttribute, oldAttribute));
+
+ oldAttribute.setValue("");
+ assertTrue(mapper.equals(newAttribute, oldAttribute));
+
+ newAttribute.setValue("");
+ assertTrue(mapper.equals(newAttribute, oldAttribute));
+ }
+
+ @Test
+ public void testEqualsTaskAttributeStatusWhiteboard() {
+ TaskAttribute oldAttribute = oldTaskData.getRoot()
+ .createAttribute(BugzillaAttribute.STATUS_WHITEBOARD.getKey());
+ TaskAttribute newAttribute = newTaskData.getRoot()
+ .createAttribute(BugzillaAttribute.STATUS_WHITEBOARD.getKey());
+
+ assertTrue(mapper.equals(newAttribute, oldAttribute));
+
+ oldAttribute.setValue("");
+ assertTrue(mapper.equals(newAttribute, oldAttribute));
+
+ newAttribute.setValue("");
+ assertTrue(mapper.equals(newAttribute, oldAttribute));
+ }
+
+ @Test
+ public void testEqualsTaskAttributeKeywords() {
+ TaskAttribute oldAttribute = oldTaskData.getRoot().createAttribute(BugzillaAttribute.KEYWORDS.getKey());
+ TaskAttribute newAttribute = newTaskData.getRoot().createAttribute(BugzillaAttribute.KEYWORDS.getKey());
+
+ assertTrue(mapper.equals(newAttribute, oldAttribute));
+
+ oldAttribute.setValue("");
+ assertTrue(mapper.equals(newAttribute, oldAttribute));
+
+ newAttribute.setValue("");
+ assertTrue(mapper.equals(newAttribute, oldAttribute));
+
+ newAttribute.addValue("AA");
+ assertFalse(mapper.equals(newAttribute, oldAttribute));
+ }
+
+}