Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfbecker2010-09-02 21:38:33 +0000
committerfbecker2010-09-02 21:38:33 +0000
commitc33e3f29c94d4702c25109485ed091ebdf8aa007 (patch)
tree2b7cd9bc3452c01ad931b5b16dc0a128a725ea32 /org.eclipse.mylyn.bugzilla.tests
parentc378122a262b1e3277e809dd500eac71804592fb (diff)
downloadorg.eclipse.mylyn.tasks-c33e3f29c94d4702c25109485ed091ebdf8aa007.tar.gz
org.eclipse.mylyn.tasks-c33e3f29c94d4702c25109485ed091ebdf8aa007.tar.xz
org.eclipse.mylyn.tasks-c33e3f29c94d4702c25109485ed091ebdf8aa007.zip
ASSIGNED - bug 322081: [patch] refactor Strings for Flags
https://bugs.eclipse.org/bugs/show_bug.cgi?id=322081
Diffstat (limited to 'org.eclipse.mylyn.bugzilla.tests')
-rw-r--r--org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaAttachmentHandlerTest.java40
-rw-r--r--org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/core/BugzillaFlagsTest.java15
2 files changed, 30 insertions, 25 deletions
diff --git a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaAttachmentHandlerTest.java b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaAttachmentHandlerTest.java
index 61258aa3d..c863f4636 100644
--- a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaAttachmentHandlerTest.java
+++ b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaAttachmentHandlerTest.java
@@ -57,6 +57,7 @@ public class BugzillaAttachmentHandlerTest extends AbstractBugzillaTest {
super.tearDown();
}
+ @SuppressWarnings("null")
public void testUpdateAttachmentFlags() throws Exception {
TaskData taskData = BugzillaFixture.current().createTask(PrivilegeLevel.USER, "update of Attachment Flags",
"description for testUpdateAttachmentFlags");
@@ -96,18 +97,19 @@ public class BugzillaAttachmentHandlerTest extends AbstractBugzillaTest {
assertNotNull(taskData);
numAttached = taskData.getAttributeMapper().getAttributesByType(taskData, TaskAttribute.TYPE_ATTACHMENT).size();
assertEquals(1, numAttached);
- TaskAttribute attachmentAttribute = taskData.getAttributeMapper().getAttributesByType(taskData,
- TaskAttribute.TYPE_ATTACHMENT).get(0);
+ TaskAttribute attachmentAttribute = taskData.getAttributeMapper()
+ .getAttributesByType(taskData, TaskAttribute.TYPE_ATTACHMENT)
+ .get(0);
int flagCount = 0;
int flagCountUnused = 0;
TaskAttribute attachmentFlag1 = null;
TaskAttribute attachmentFlag2 = null;
for (TaskAttribute attribute : attachmentAttribute.getAttributes().values()) {
- if (!attribute.getId().startsWith("task.common.kind.flag")) { //$NON-NLS-1$
+ if (!attribute.getId().startsWith(BugzillaAttribute.KIND_FLAG)) {
continue;
}
flagCount++;
- if (attribute.getId().startsWith("task.common.kind.flag_type")) { //$NON-NLS-1$
+ if (attribute.getId().startsWith(BugzillaAttribute.KIND_FLAG_TYPE)) {
flagCountUnused++;
TaskAttribute stateAttribute = taskData.getAttributeMapper().getAssoctiatedAttribute(attribute);
if (stateAttribute.getMetaData().getLabel().equals("AttachmentFlag1")) {
@@ -141,11 +143,11 @@ public class BugzillaAttachmentHandlerTest extends AbstractBugzillaTest {
TaskAttribute attachmentFlag2used = null;
for (TaskAttribute attribute : attachmentAttribute.getAttributes().values()) {
- if (!attribute.getId().startsWith("task.common.kind.flag")) { //$NON-NLS-1$
+ if (!attribute.getId().startsWith(BugzillaAttribute.KIND_FLAG)) {
continue;
}
flagCount++;
- if (attribute.getId().startsWith("task.common.kind.flag_type")) { //$NON-NLS-1$
+ if (attribute.getId().startsWith(BugzillaAttribute.KIND_FLAG_TYPE)) {
flagCountUnused++;
TaskAttribute stateAttribute = taskData.getAttributeMapper().getAssoctiatedAttribute(attribute);
if (stateAttribute.getMetaData().getLabel().equals("AttachmentFlag1")) {
@@ -193,11 +195,11 @@ public class BugzillaAttachmentHandlerTest extends AbstractBugzillaTest {
attachmentFlag2used = null;
for (TaskAttribute attribute : attachmentAttribute.getAttributes().values()) {
- if (!attribute.getId().startsWith("task.common.kind.flag")) { //$NON-NLS-1$
+ if (!attribute.getId().startsWith(BugzillaAttribute.KIND_FLAG)) {
continue;
}
flagCount++;
- if (attribute.getId().startsWith("task.common.kind.flag_type")) { //$NON-NLS-1$
+ if (attribute.getId().startsWith(BugzillaAttribute.KIND_FLAG_TYPE)) {
flagCountUnused++;
TaskAttribute stateAttribute = taskData.getAttributeMapper().getAssoctiatedAttribute(attribute);
if (stateAttribute.getMetaData().getLabel().equals("AttachmentFlag1")) {
@@ -265,8 +267,8 @@ public class BugzillaAttachmentHandlerTest extends AbstractBugzillaTest {
taskData = BugzillaFixture.current().getTask(taskData.getTaskId(), client);
assertNotNull(taskData);
- assertEquals(numAttached, taskData.getAttributeMapper().getAttributesByType(taskData,
- TaskAttribute.TYPE_ATTACHMENT).size());
+ assertEquals(numAttached,
+ taskData.getAttributeMapper().getAttributesByType(taskData, TaskAttribute.TYPE_ATTACHMENT).size());
/* Test attempt to upload an empty file */
String fileName = "test-attach-" + System.currentTimeMillis() + ".txt";
@@ -290,8 +292,8 @@ public class BugzillaAttachmentHandlerTest extends AbstractBugzillaTest {
taskData = BugzillaFixture.current().getTask(taskData.getTaskId(), client);
assertNotNull(taskData);
- assertEquals(numAttached, taskData.getAttributeMapper().getAttributesByType(taskData,
- TaskAttribute.TYPE_ATTACHMENT).size());
+ assertEquals(numAttached,
+ taskData.getAttributeMapper().getAttributesByType(taskData, TaskAttribute.TYPE_ATTACHMENT).size());
/* Test uploading a proper file */
write.write("test file");
@@ -305,8 +307,8 @@ public class BugzillaAttachmentHandlerTest extends AbstractBugzillaTest {
taskData = BugzillaFixture.current().getTask(taskData.getTaskId(), client);
assertNotNull(taskData);
- assertEquals(numAttached + 1, taskData.getAttributeMapper().getAttributesByType(taskData,
- TaskAttribute.TYPE_ATTACHMENT).size());
+ assertEquals(numAttached + 1,
+ taskData.getAttributeMapper().getAttributesByType(taskData, TaskAttribute.TYPE_ATTACHMENT).size());
// use assertion to track clean-up
assertTrue(attachFile.delete());
}
@@ -320,8 +322,9 @@ public class BugzillaAttachmentHandlerTest extends AbstractBugzillaTest {
taskData = BugzillaFixture.current().getTask(taskData.getTaskId(), client);
assertNotNull(taskData);
- TaskAttribute attachment = taskData.getAttributeMapper().getAttributesByType(taskData,
- TaskAttribute.TYPE_ATTACHMENT).get(0);
+ TaskAttribute attachment = taskData.getAttributeMapper()
+ .getAttributesByType(taskData, TaskAttribute.TYPE_ATTACHMENT)
+ .get(0);
assertNotNull(attachment);
TaskAttribute obsolete = attachment.getMappedAttribute(TaskAttribute.ATTACHMENT_IS_DEPRECATED);
assertNotNull(obsolete);
@@ -411,8 +414,9 @@ public class BugzillaAttachmentHandlerTest extends AbstractBugzillaTest {
taskData = BugzillaFixture.current().getTask(taskData.getTaskId(), client);
assertNotNull(taskData);
- TaskAttribute attachment = taskData.getAttributeMapper().getAttributesByType(taskData,
- TaskAttribute.TYPE_ATTACHMENT).get(0);
+ TaskAttribute attachment = taskData.getAttributeMapper()
+ .getAttributesByType(taskData, TaskAttribute.TYPE_ATTACHMENT)
+ .get(0);
assertNotNull(attachment);
TaskAttribute obsolete = attachment.getMappedAttribute(TaskAttribute.ATTACHMENT_IS_DEPRECATED);
assertNotNull(obsolete);
diff --git a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/core/BugzillaFlagsTest.java b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/core/BugzillaFlagsTest.java
index dfe622dcc..4b4bdf09a 100644
--- a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/core/BugzillaFlagsTest.java
+++ b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/core/BugzillaFlagsTest.java
@@ -19,6 +19,7 @@ import java.util.Set;
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.BugzillaClient;
import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
import org.eclipse.mylyn.tasks.core.data.TaskData;
@@ -54,7 +55,7 @@ public class BugzillaFlagsTest extends TestCase {
TaskAttribute stateC = null;
TaskAttribute stateD = null;
for (TaskAttribute taskAttribute : a) {
- if (taskAttribute.getId().startsWith("task.common.kind.flag")) {
+ if (taskAttribute.getId().startsWith(BugzillaAttribute.KIND_FLAG)) {
TaskAttribute state = taskAttribute.getAttribute("state");
if (state.getMetaData().getLabel().equals("BugFlag1")) {
flagA = taskAttribute;
@@ -83,10 +84,10 @@ public class BugzillaFlagsTest extends TestCase {
assertEquals("flagB is set(wrong precondidion)", " ", stateB.getValue());
assertEquals("flagC is set(wrong precondidion)", " ", stateC.getValue());
assertEquals("flagD is set(wrong precondidion)", " ", stateD.getValue());
- assertEquals("task.common.kind.flag_type1", flagA.getId());
- assertEquals("task.common.kind.flag_type2", flagB.getId());
- assertEquals("task.common.kind.flag_type5", flagC.getId());
- assertEquals("task.common.kind.flag_type6", flagD.getId());
+ assertEquals(BugzillaAttribute.KIND_FLAG_TYPE + "1", flagA.getId());
+ assertEquals(BugzillaAttribute.KIND_FLAG_TYPE + "2", flagB.getId());
+ assertEquals(BugzillaAttribute.KIND_FLAG_TYPE + "5", flagC.getId());
+ assertEquals(BugzillaAttribute.KIND_FLAG_TYPE + "6", flagD.getId());
Map<String, String> optionA = stateA.getOptions();
Map<String, String> optionB = stateB.getOptions();
Map<String, String> optionC = stateC.getOptions();
@@ -134,7 +135,7 @@ public class BugzillaFlagsTest extends TestCase {
TaskAttribute stateC2 = null;
stateD = null;
for (TaskAttribute taskAttribute : a) {
- if (taskAttribute.getId().startsWith("task.common.kind.flag")) {
+ if (taskAttribute.getId().startsWith(BugzillaAttribute.KIND_FLAG)) {
TaskAttribute state = taskAttribute.getAttribute("state");
if (state.getMetaData().getLabel().equals("BugFlag1")) {
flagA = taskAttribute;
@@ -198,7 +199,7 @@ public class BugzillaFlagsTest extends TestCase {
stateC2 = null;
stateD = null;
for (TaskAttribute taskAttribute : a) {
- if (taskAttribute.getId().startsWith("task.common.kind.flag")) {
+ if (taskAttribute.getId().startsWith(BugzillaAttribute.KIND_FLAG)) {
TaskAttribute state = taskAttribute.getAttribute("state");
if (state.getMetaData().getLabel().equals("BugFlag1")) {
flagA = taskAttribute;

Back to the top