Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormkersten2006-08-24 23:59:32 -0400
committermkersten2006-08-24 23:59:32 -0400
commitf032ec390866831a55500bfb87d329a2100ea929 (patch)
tree905ce0baa81bb984178c853dc002ac689ae4151d /org.eclipse.mylyn.trac.tests
parent04c3ba72b1ee24dc875d13f32d8657b342fcdb45 (diff)
downloadorg.eclipse.mylyn.tasks-f032ec390866831a55500bfb87d329a2100ea929.tar.gz
org.eclipse.mylyn.tasks-f032ec390866831a55500bfb87d329a2100ea929.tar.xz
org.eclipse.mylyn.tasks-f032ec390866831a55500bfb87d329a2100ea929.zip
Completed: 155145: priorities for Trac tasks not displayed correctlyR_0_6_1_prerefactoring
https://bugs.eclipse.org/bugs/show_bug.cgi?id=155145
Diffstat (limited to 'org.eclipse.mylyn.trac.tests')
-rw-r--r--org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/AllTracTests.java2
-rw-r--r--org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/TracQueryHitTest.java35
-rw-r--r--org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/TracRepositoryConnectorTest.java13
-rw-r--r--org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/TracTaskTest.java44
4 files changed, 89 insertions, 5 deletions
diff --git a/org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/AllTracTests.java b/org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/AllTracTests.java
index 6e29dde2c..d01300bcb 100644
--- a/org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/AllTracTests.java
+++ b/org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/AllTracTests.java
@@ -40,6 +40,8 @@ public class AllTracTests {
suite.addTestSuite(TracAttachmentHandlerTest.class);
suite.addTestSuite(RepositorySearchQueryTest.class);
suite.addTestSuite(TracOfflineTaskHandlerTest.class);
+ suite.addTestSuite(TracTaskTest.class);
+ suite.addTestSuite(TracQueryHitTest.class);
// $JUnit-END$
return suite;
}
diff --git a/org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/TracQueryHitTest.java b/org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/TracQueryHitTest.java
new file mode 100644
index 000000000..a89085c9e
--- /dev/null
+++ b/org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/TracQueryHitTest.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2006 - 2006 Mylar eclipse.org project 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:
+ * Mylar project committers - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.mylar.trac.tests;
+
+import junit.framework.TestCase;
+
+import org.eclipse.mylar.internal.trac.TracQueryHit;
+import org.eclipse.mylar.internal.trac.TracTask;
+
+/**
+ * @author Steffen Pingel
+ */
+public class TracQueryHitTest extends TestCase {
+
+ public void testAttributes() {
+ TracQueryHit hit = new TracQueryHit("url", "description", "123");
+ hit.setPriority("P1");
+ hit.setCompleted(true);
+
+ TracTask task = (TracTask) hit.getOrCreateCorrespondingTask();
+ assertEquals("url-123", task.getHandleIdentifier());
+ assertEquals("P1", task.getPriority());
+ assertEquals(true, task.isCompleted());
+ }
+
+}
diff --git a/org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/TracRepositoryConnectorTest.java b/org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/TracRepositoryConnectorTest.java
index 32f84982a..2336698d7 100644
--- a/org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/TracRepositoryConnectorTest.java
+++ b/org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/TracRepositoryConnectorTest.java
@@ -42,6 +42,7 @@ import org.eclipse.mylar.internal.trac.model.TracVersion;
import org.eclipse.mylar.internal.trac.model.TracTicket.Key;
import org.eclipse.mylar.internal.trac.ui.wizard.TracRepositorySettingsPage;
import org.eclipse.mylar.tasks.core.AbstractQueryHit;
+import org.eclipse.mylar.tasks.core.AbstractRepositoryTask;
import org.eclipse.mylar.tasks.core.ITask;
import org.eclipse.mylar.tasks.core.RepositoryAttachment;
import org.eclipse.mylar.tasks.core.TaskList;
@@ -200,9 +201,11 @@ public class TracRepositoryConnectorTest extends TestCase {
ticket.putBuiltinValue(Key.SUMMARY, "mysummary");
ticket.putBuiltinValue(Key.TYPE, "mytype");
- TracTask task = new TracTask("", "", true);
- TracRepositoryConnector.updateTaskDetails(Constants.TEST_TRAC_010_URL, task, ticket, false);
-
+ TracTask task = new TracTask(AbstractRepositoryTask.getHandle(Constants.TEST_TRAC_010_URL, 123), "desc", true);
+ assertEquals(Constants.TEST_TRAC_010_URL + ITracClient.TICKET_URL + "123", task.getUrl());
+ assertEquals("desc", task.getDescription());
+
+ TracRepositoryConnector.updateTaskDetails(task, ticket, false);
assertEquals(Constants.TEST_TRAC_010_URL + ITracClient.TICKET_URL + "123", task.getUrl());
assertEquals("123: mysummary", task.getDescription());
assertEquals("P3", task.getPriority());
@@ -213,9 +216,9 @@ public class TracRepositoryConnectorTest extends TestCase {
TracTicket ticket = new TracTicket(456);
ticket.putBuiltinValue(Key.SUMMARY, "mysummary");
- TracTask task = new TracTask("", "", true);
- TracRepositoryConnector.updateTaskDetails(Constants.TEST_TRAC_010_URL, task, ticket, false);
+ TracTask task = new TracTask(AbstractRepositoryTask.getHandle(Constants.TEST_TRAC_010_URL, 456), "desc", true);
+ TracRepositoryConnector.updateTaskDetails(task, ticket, false);
assertEquals(Constants.TEST_TRAC_010_URL + ITracClient.TICKET_URL + "456", task.getUrl());
assertEquals("456: mysummary", task.getDescription());
assertEquals("P3", task.getPriority());
diff --git a/org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/TracTaskTest.java b/org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/TracTaskTest.java
new file mode 100644
index 000000000..b6199e30b
--- /dev/null
+++ b/org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/TracTaskTest.java
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Copyright (c) 2006 - 2006 Mylar eclipse.org project 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:
+ * Mylar project committers - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.mylar.trac.tests;
+
+import junit.framework.TestCase;
+
+import org.eclipse.mylar.internal.trac.TracTask;
+
+/**
+ * @author Steffen Pingel
+ */
+public class TracTaskTest extends TestCase {
+
+ public void testIsCompleted() {
+ assertTrue(TracTask.isCompleted("closed"));
+ assertFalse(TracTask.isCompleted("Closed"));
+ assertFalse(TracTask.isCompleted("new"));
+ assertFalse(TracTask.isCompleted("assigned"));
+ assertFalse(TracTask.isCompleted("reopened"));
+ assertFalse(TracTask.isCompleted("foobar"));
+ assertFalse(TracTask.isCompleted(""));
+ assertFalse(TracTask.isCompleted(null));
+ }
+
+ public void testGetMylarPriority() {
+ assertEquals("P1", TracTask.getMylarPriority("blocker"));
+ assertEquals("P2", TracTask.getMylarPriority("critical"));
+ assertEquals("P3", TracTask.getMylarPriority("major"));
+ assertEquals("P3", TracTask.getMylarPriority(null));
+ assertEquals("P3", TracTask.getMylarPriority(""));
+ assertEquals("P3", TracTask.getMylarPriority("foo bar"));
+ assertEquals("P4", TracTask.getMylarPriority("minor"));
+ assertEquals("P5", TracTask.getMylarPriority("trivial"));
+ }
+}

Back to the top