diff options
author | Steffen Pingel | 2012-03-03 16:29:26 +0000 |
---|---|---|
committer | Steffen Pingel | 2012-03-03 16:29:26 +0000 |
commit | 71dd781b3871ea984b27b1295487aa5253a590c9 (patch) | |
tree | 9d8ce17d59eefa8ce9244a1efc007f84d4f27abc /org.eclipse.mylyn.bugzilla.tests/src | |
parent | e6c68d8288c4476487902093b002a07821f8ac77 (diff) | |
download | org.eclipse.mylyn.tasks-71dd781b3871ea984b27b1295487aa5253a590c9.tar.gz org.eclipse.mylyn.tasks-71dd781b3871ea984b27b1295487aa5253a590c9.tar.xz org.eclipse.mylyn.tasks-71dd781b3871ea984b27b1295487aa5253a590c9.zip |
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
Diffstat (limited to 'org.eclipse.mylyn.bugzilla.tests/src')
2 files changed, 120 insertions, 0 deletions
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 9b5b9a718..7bbbc6604 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 000000000..27e7aac38 --- /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)); + } + +} |