Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrelves2007-02-16 16:15:33 -0500
committerrelves2007-02-16 16:15:33 -0500
commitac26f704999be2a33e6034fa6fdbce85e0ef514b (patch)
tree25ba4ad51413e566d417755bf82e7406e22faa23
parent3e36455c555fec53dacd9e3a48bd72970dafa5fa (diff)
downloadorg.eclipse.mylyn.tasks-ac26f704999be2a33e6034fa6fdbce85e0ef514b.tar.gz
org.eclipse.mylyn.tasks-ac26f704999be2a33e6034fa6fdbce85e0ef514b.tar.xz
org.eclipse.mylyn.tasks-ac26f704999be2a33e6034fa6fdbce85e0ef514b.zip
ASSIGNED - bug 174363: TaskRevision objects are not always completely filled out
https://bugs.eclipse.org/bugs/show_bug.cgi?id=174363
-rw-r--r--org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/history/TaskRevision.java11
-rw-r--r--org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/headless/BugzillaTaskHistoryTest.java42
2 files changed, 47 insertions, 6 deletions
diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/history/TaskRevision.java b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/history/TaskRevision.java
index 1ebbc2dd7..8c06cc881 100644
--- a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/history/TaskRevision.java
+++ b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/history/TaskRevision.java
@@ -41,23 +41,24 @@ public class TaskRevision implements Comparable<TaskRevision> {
public static TaskRevision createEvent(String type, String change) {
TaskRevision event = new TaskRevision();
+ event.setWhat(type);
+
if (STATUS.equals(type)) {
- return new StatusEvent(StatusType.convert(change));
+ event = new StatusEvent(StatusType.convert(change));
}
if (RESOLUTION.equals(type)) {
- return new ResolutionEvent(ResolutionType.convert(change));
+ event = new ResolutionEvent(ResolutionType.convert(change));
}
if (ASSIGNMENT.equals(type)) {
- return new AssignmentEvent(change);
+ event = new AssignmentEvent(change);
}
if (type.contains(ATTACHMENT) && type.contains("Flag")) {
- return new AttachmentEvent(AttachmentEvent.parseId(type), AttachmentEvent.parseFlags(change));
+ event = new AttachmentEvent(AttachmentEvent.parseId(type), AttachmentEvent.parseFlags(change));
}
- event.setWhat(type);
event.setAdded(change);
return event;
}
diff --git a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/headless/BugzillaTaskHistoryTest.java b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/headless/BugzillaTaskHistoryTest.java
index 6669ad4ee..36d843be5 100644
--- a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/headless/BugzillaTaskHistoryTest.java
+++ b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/headless/BugzillaTaskHistoryTest.java
@@ -18,6 +18,8 @@ import org.eclipse.mylar.internal.bugzilla.core.BugzillaCorePlugin;
import org.eclipse.mylar.internal.bugzilla.core.BugzillaRepositoryConnector;
import org.eclipse.mylar.internal.bugzilla.core.IBugzillaConstants;
import org.eclipse.mylar.internal.bugzilla.core.history.AssignmentEvent;
+import org.eclipse.mylar.internal.bugzilla.core.history.ResolutionEvent;
+import org.eclipse.mylar.internal.bugzilla.core.history.StatusEvent;
import org.eclipse.mylar.internal.bugzilla.core.history.TaskHistory;
import org.eclipse.mylar.tasks.core.TaskList;
import org.eclipse.mylar.tasks.core.TaskRepository;
@@ -33,6 +35,7 @@ public class BugzillaTaskHistoryTest extends AbstractBugzillaTest {
connector = new BugzillaRepositoryConnector();
connector.init(new TaskList());
repository = new TaskRepository(BugzillaCorePlugin.REPOSITORY_KIND, IBugzillaConstants.TEST_BUGZILLA_222_URL);
+
Credentials credentials = MylarTestUtils.readCredentials();
repository.setAuthenticationCredentials(credentials.username, credentials.password);
}
@@ -45,8 +48,17 @@ public class BugzillaTaskHistoryTest extends AbstractBugzillaTest {
assertNotNull(history);
assertEquals(1, history.getAssignmentEvents().size());
- assertEquals(1, history.getStatusEvents().size());
+ assertEquals(2, history.getStatusEvents().size());
+ assertEquals(1, history.getResolutionEvents().size());
assertEquals(12, history.getOtherEvents().size());
+ }
+
+ public void testAssignmentEvent() throws Exception {
+ BugzillaClient client = connector.getClientManager().getClient(repository);
+ assertNotNull(client);
+ TaskHistory history = client.getHistory("1");
+ assertNotNull(history);
+
AssignmentEvent assignment = history.getAssignmentEvents().get(0);
assertEquals("nhapke@cs.ubc.ca", assignment.getName());
assertEquals("user@mylar.eclipse.org", assignment.getAssigned());
@@ -56,4 +68,32 @@ public class BugzillaTaskHistoryTest extends AbstractBugzillaTest {
assertEquals("AssignedTo", assignment.getWhat());
}
+ public void testStatusEvent() throws Exception {
+
+ BugzillaClient client = connector.getClientManager().getClient(repository);
+ assertNotNull(client);
+ TaskHistory history = client.getHistory("1");
+ assertNotNull(history);
+
+ StatusEvent statusChange = history.getStatusEvents().get(0);
+ assertEquals("nhapke@cs.ubc.ca", statusChange.getName());
+ assertEquals("2006-08-25 19:18:05", statusChange.getDate());
+ assertEquals("NEW", statusChange.getRemoved());
+ assertEquals("ASSIGNED", statusChange.getAdded());
+ assertEquals("Status", statusChange.getWhat());
+ }
+
+ public void testResolutionEvent() throws Exception {
+ BugzillaClient client = connector.getClientManager().getClient(repository);
+ assertNotNull(client);
+ TaskHistory history = client.getHistory("1");
+ assertNotNull(history);
+
+ ResolutionEvent resolutionChange = history.getResolutionEvents().get(0);
+ assertEquals("janvik@cs.ubc.ca", resolutionChange.getName());
+ assertEquals("2007-02-15 14:52:51", resolutionChange.getDate());
+ assertEquals("", resolutionChange.getRemoved());
+ assertEquals("FIXED", resolutionChange.getAdded());
+ assertEquals("Resolution", resolutionChange.getWhat());
+ }
}

Back to the top