Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteffen Pingel2012-12-08 15:47:06 -0500
committerSteffen Pingel2012-12-08 15:57:29 -0500
commit6a15b70c52501a22235d8cec9e910806af5c8fda (patch)
tree2bf5b684fd1ecbc9d89a5f97c3b3dc09f69813b3 /org.eclipse.mylyn.bugzilla.tests/src
parentc6c540f90f8f2102135f5be8c70cb015e3a7fc7e (diff)
downloadorg.eclipse.mylyn.tasks-6a15b70c52501a22235d8cec9e910806af5c8fda.tar.gz
org.eclipse.mylyn.tasks-6a15b70c52501a22235d8cec9e910806af5c8fda.tar.xz
org.eclipse.mylyn.tasks-6a15b70c52501a22235d8cec9e910806af5c8fda.zip
310545: changed Bugzilla tasks occasionally do not show as incoming
Change-Id: I10322d4faa6c382f0fca02f93ccf2b8ab61ee04d Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=310545
Diffstat (limited to 'org.eclipse.mylyn.bugzilla.tests/src')
-rw-r--r--org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaRepositoryConnectorTest.java47
1 files changed, 47 insertions, 0 deletions
diff --git a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaRepositoryConnectorTest.java b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaRepositoryConnectorTest.java
index 54dda35ea..14c67cc52 100644
--- a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaRepositoryConnectorTest.java
+++ b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaRepositoryConnectorTest.java
@@ -32,6 +32,7 @@ import org.eclipse.mylyn.internal.bugzilla.core.BugzillaClient;
import org.eclipse.mylyn.internal.bugzilla.core.BugzillaCorePlugin;
import org.eclipse.mylyn.internal.bugzilla.core.BugzillaOperation;
import org.eclipse.mylyn.internal.bugzilla.core.BugzillaStatus;
+import org.eclipse.mylyn.internal.bugzilla.core.BugzillaTaskDataCollector;
import org.eclipse.mylyn.internal.bugzilla.core.BugzillaTaskDataHandler;
import org.eclipse.mylyn.internal.bugzilla.core.BugzillaUserMatchResponse;
import org.eclipse.mylyn.internal.bugzilla.core.BugzillaVersion;
@@ -44,6 +45,7 @@ import org.eclipse.mylyn.internal.tasks.core.sync.SynchronizationSession;
import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
import org.eclipse.mylyn.internal.tasks.ui.util.AttachmentUtil;
import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
+import org.eclipse.mylyn.tasks.core.IRepositoryQuery;
import org.eclipse.mylyn.tasks.core.ITask;
import org.eclipse.mylyn.tasks.core.ITask.SynchronizationState;
import org.eclipse.mylyn.tasks.core.RepositoryResponse;
@@ -949,6 +951,51 @@ public class BugzillaRepositoryConnectorTest extends AbstractBugzillaTest {
}
}
+ public void testMissingHitsWhileTaskChanged() throws Exception {
+ String summary1 = "testMissingHitsWhileTaskChanged" + System.currentTimeMillis();
+ TaskData data1 = BugzillaFixture.current().createTask(PrivilegeLevel.USER, summary1, null);
+ ITask task1 = generateLocalTaskAndDownload(data1.getTaskId());
+ // ensure that time advances by 1 second between creation and query time
+ Thread.sleep(1000);
+
+ repository = BugzillaFixture.current().repository();
+ String stamp = data1.getRoot().getMappedAttribute(TaskAttribute.DATE_MODIFICATION).getValue();
+ repository.setSynchronizationTimeStamp(stamp);
+ SynchronizationSession session = new SynchronizationSession();
+ session.setFullSynchronization(true);
+ session.setTasks(Collections.singleton(task1));
+ session.setTaskRepository(repository);
+
+ // pre synchronization
+ connector.preSynchronization(session, null);
+ Object data = session.getData();
+ assertNotNull(session.getData());
+ assertEquals(Collections.singleton(task1), session.getStaleTasks());
+
+ // update task
+ data1.getRoot().getMappedAttribute(TaskAttribute.SUMMARY).setValue(summary1 + "updated");
+ connector.getTaskDataHandler().postTaskData(repository, data1, null, null);
+
+ // perform query
+ IRepositoryQuery query = TasksUi.getRepositoryModel().createRepositoryQuery(repository);
+ query.setUrl(repository.getUrl()
+ + "buglist.cgi?query_format=advanced&short_desc_type=allwordssubstr&short_desc=" + summary1);
+ BugzillaTaskDataCollector collector = new BugzillaTaskDataCollector();
+ connector.performQuery(repository, query, collector, session, null);
+ assertEquals(data, session.getData());
+
+ // post synchronizaion
+ connector.postSynchronization(session, null);
+ assertFalse(stamp.equals(repository.getSynchronizationTimeStamp()));
+
+ // second pre synchronization
+ SynchronizationSession session2 = new SynchronizationSession();
+ session2.setTasks(Collections.singleton(task1));
+ session2.setTaskRepository(repository);
+ connector.preSynchronization(session2, null);
+ assertEquals(Collections.singleton(task1), session2.getStaleTasks());
+ }
+
public void testAnonymousRepositoryAccess() throws Exception {
assertNotNull(repository);
AuthenticationCredentials anonymousCreds = new AuthenticationCredentials("", "");

Back to the top