Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Green2012-10-16 17:36:27 +0000
committerSteffen Pingel2012-10-30 11:09:06 +0000
commit69fc142feb6892ec2ae7c15c3b622c7478d18032 (patch)
treed3f26ea35cfe8ba85b1849a7a1725a429112ee06 /org.eclipse.mylyn.tasks.index.tests
parent8f8a84b050f645df615c00acf1bcaf778026c6d5 (diff)
downloadorg.eclipse.mylyn.tasks-69fc142feb6892ec2ae7c15c3b622c7478d18032.tar.gz
org.eclipse.mylyn.tasks-69fc142feb6892ec2ae7c15c3b622c7478d18032.tar.xz
org.eclipse.mylyn.tasks-69fc142feb6892ec2ae7c15c3b622c7478d18032.zip
392100: task list index should include attachment names
Add attachment name as a field to the index. Add attachment descriptions to the content field. Change-Id: Ice69e2e5a26cbc2c070fa2ef08e0637a2d91ae5b Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=392100
Diffstat (limited to 'org.eclipse.mylyn.tasks.index.tests')
-rw-r--r--org.eclipse.mylyn.tasks.index.tests/src/org/eclipse/mylyn/internal/tasks/index/tests/TaskListIndexTest.java37
1 files changed, 36 insertions, 1 deletions
diff --git a/org.eclipse.mylyn.tasks.index.tests/src/org/eclipse/mylyn/internal/tasks/index/tests/TaskListIndexTest.java b/org.eclipse.mylyn.tasks.index.tests/src/org/eclipse/mylyn/internal/tasks/index/tests/TaskListIndexTest.java
index 5d5ac6baa..22f6e4466 100644
--- a/org.eclipse.mylyn.tasks.index.tests/src/org/eclipse/mylyn/internal/tasks/index/tests/TaskListIndexTest.java
+++ b/org.eclipse.mylyn.tasks.index.tests/src/org/eclipse/mylyn/internal/tasks/index/tests/TaskListIndexTest.java
@@ -44,6 +44,7 @@ import org.eclipse.mylyn.internal.tasks.index.core.TaskListIndex;
import org.eclipse.mylyn.internal.tasks.index.core.TaskListIndex.TaskCollector;
import org.eclipse.mylyn.tasks.core.ITask;
import org.eclipse.mylyn.tasks.core.data.DefaultTaskSchema;
+import org.eclipse.mylyn.tasks.core.data.TaskAttachmentMapper;
import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
import org.eclipse.mylyn.tasks.core.data.TaskData;
import org.eclipse.mylyn.tasks.core.data.TaskMapper;
@@ -446,6 +447,40 @@ public class TaskListIndexTest extends AbstractTaskListIndexTest {
}
}
+ @Test
+ public void testFindByTaskAttachmentName() throws CoreException, InterruptedException {
+ setupIndex();
+
+ ITask repositoryTask = context.createRepositoryTask();
+
+ index.waitUntilIdle();
+
+ index.setDefaultField(TaskListIndex.FIELD_CONTENT);
+
+ TaskData taskData = context.getDataManager().getTaskData(repositoryTask);
+
+ TaskAttribute attachmentAttribute = taskData.getRoot().createAttribute("attachment-0");
+ attachmentAttribute.getMetaData().setType(TaskAttribute.TYPE_ATTACHMENT);
+
+ TaskAttachmentMapper attachmentMapper = TaskAttachmentMapper.createFrom(attachmentAttribute);
+ attachmentMapper.setFileName("test-file.txt");
+ attachmentMapper.setDescription("test file " + System.currentTimeMillis());
+ attachmentMapper.applyTo(attachmentAttribute);
+
+ context.getDataManager().putSubmittedTaskData(repositoryTask, taskData, new DelegatingProgressMonitor());
+ context.getTaskList().notifyElementsChanged(Collections.singleton(repositoryTask));
+
+ index.waitUntilIdle();
+
+ assertTrue(index.matches(repositoryTask, "\"" + attachmentMapper.getDescription() + "\""));
+ assertTrue(index.matches(repositoryTask, TaskListIndex.FIELD_ATTACHMENT_NAME.getIndexKey() + ":\""
+ + attachmentMapper.getFileName() + "\""));
+ assertFalse(index.matches(repositoryTask,
+ TaskListIndex.FIELD_CONTENT.getIndexKey() + ":\"" + attachmentMapper.getFileName() + "\""));
+ assertFalse(index.matches(repositoryTask, TaskListIndex.FIELD_ATTACHMENT_NAME.getIndexKey() + ":\""
+ + attachmentMapper.getDescription() + "\""));
+ }
+
private void assertCanFindTask(ITask task) {
TestTaskCollector collector = new TestTaskCollector();
index.find(task.getSummary(), collector, 1000);
@@ -454,4 +489,4 @@ public class TaskListIndexTest extends AbstractTaskListIndexTest {
assertTrue(collector.getTasks().contains(task));
}
-} \ No newline at end of file
+}

Back to the top