Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormkersten2006-02-19 18:18:32 -0500
committermkersten2006-02-19 18:18:32 -0500
commitdb2c80a67c5d2e8041a38e61099e3c80e660a2bc (patch)
treef0012330a55626696190e7fb126b5e7fe5322613
parentce49d932c4c3749a3a6b17ffc0d0e1cd43629cb6 (diff)
downloadorg.eclipse.mylyn.tasks-db2c80a67c5d2e8041a38e61099e3c80e660a2bc.tar.gz
org.eclipse.mylyn.tasks-db2c80a67c5d2e8041a38e61099e3c80e660a2bc.tar.xz
org.eclipse.mylyn.tasks-db2c80a67c5d2e8041a38e61099e3c80e660a2bc.zip
Progress on: Bug 126775: >fix task archive and category duplication
https://bugs.eclipse.org/bugs/show_bug.cgi?id=126775
-rw-r--r--org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasklist/tests/TaskDataImportTest.java22
-rw-r--r--org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasklist/tests/TaskListManagerTest.java20
-rw-r--r--org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasklist/tests/TaskTestUtil.java14
-rw-r--r--org.eclipse.mylyn.tasks.tests/testdata/legacy/tasklist_0_4_8.xml1
-rw-r--r--org.eclipse.mylyn.tasks.tests/testdata/taskdataimporttest/context-history.xml (renamed from org.eclipse.mylyn.tasks.tests/taskdataimporttest/context-history.xml)0
-rw-r--r--org.eclipse.mylyn.tasks.tests/testdata/taskdataimporttest/local-69.xml (renamed from org.eclipse.mylyn.tasks.tests/taskdataimporttest/local-69.xml)0
-rw-r--r--org.eclipse.mylyn.tasks.tests/testdata/taskdataimporttest/local-70.xml (renamed from org.eclipse.mylyn.tasks.tests/taskdataimporttest/local-70.xml)0
-rw-r--r--org.eclipse.mylyn.tasks.tests/testdata/taskdataimporttest/mylardata-2006-02-16.zip (renamed from org.eclipse.mylyn.tasks.tests/taskdataimporttest/mylardata-2006-02-16.zip)bin2340 -> 2340 bytes
-rw-r--r--org.eclipse.mylyn.tasks.tests/testdata/taskdataimporttest/tasklist.xml (renamed from org.eclipse.mylyn.tasks.tests/taskdataimporttest/tasklist.xml)0
9 files changed, 39 insertions, 18 deletions
diff --git a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasklist/tests/TaskDataImportTest.java b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasklist/tests/TaskDataImportTest.java
index 173ef85c6..cc9883a2b 100644
--- a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasklist/tests/TaskDataImportTest.java
+++ b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasklist/tests/TaskDataImportTest.java
@@ -11,11 +11,8 @@
package org.eclipse.mylar.tasklist.tests;
import java.io.File;
-import java.io.IOException;
-import java.net.URL;
import java.util.Set;
-import org.eclipse.core.runtime.FileLocator;
import org.eclipse.mylar.core.MylarPlugin;
import org.eclipse.mylar.core.tests.AbstractContextTest;
import org.eclipse.mylar.internal.tasklist.ITask;
@@ -37,11 +34,11 @@ public class TaskDataImportTest extends AbstractContextTest {
private TaskDataImportWizardPage wizardPage = null;
- private String sourceDir = "taskdataimporttest";
+ private String sourceDir = "testdata/taskdataimporttest";
private File sourceDirFile = null;
- private String sourceZipPath = "taskdataimporttest/mylardata-2006-02-16.zip";
+ private String sourceZipPath = "testdata/taskdataimporttest/mylardata-2006-02-16.zip";
private File sourceZipFile = null;
@@ -60,9 +57,9 @@ public class TaskDataImportTest extends AbstractContextTest {
manager.createNewTaskList();
assertTrue(manager.getTaskList().getRoots().size() == 1);
- sourceDirFile = getLocalFile(sourceDir);
+ sourceDirFile = TaskTestUtil.getLocalFile(sourceDir);
assertTrue(sourceDirFile.exists());
- sourceZipFile = getLocalFile(sourceZipPath);
+ sourceZipFile = TaskTestUtil.getLocalFile(sourceZipPath);
assertTrue(sourceZipFile.exists());
// make sure no tasks and categories exist prior to import tests
@@ -107,15 +104,4 @@ public class TaskDataImportTest extends AbstractContextTest {
assertTrue(MylarPlugin.getContextManager().hasContext(task.getHandleIdentifier()));
}
}
-
- private File getLocalFile(String path) {
- try {
- URL installURL = MylarTasksTestsPlugin.getDefault().getBundle().getEntry(path);
- URL localURL = FileLocator.toFileURL(installURL);
- return new File(localURL.getFile());
- } catch (IOException e) {
- return null;
- }
- }
-
}
diff --git a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasklist/tests/TaskListManagerTest.java b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasklist/tests/TaskListManagerTest.java
index 0d5026907..8fab23e62 100644
--- a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasklist/tests/TaskListManagerTest.java
+++ b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasklist/tests/TaskListManagerTest.java
@@ -13,6 +13,7 @@
*/
package org.eclipse.mylar.tasklist.tests;
+import java.io.File;
import java.net.URL;
import java.util.HashSet;
import java.util.Iterator;
@@ -65,6 +66,25 @@ public class TaskListManagerTest extends TestCase {
MylarTaskListPlugin.getRepositoryManager().removeRepository(repository);
}
+ public void testLegacyTaskListReading() {
+ File legacyList = TaskTestUtil.getLocalFile("testdata/legacy/tasklist_0_4_8.xml");
+ assertTrue(legacyList.exists());
+
+ manager.setTaskListFile(legacyList);
+ manager.readExistingOrCreateNewList();
+
+ int allTasks = manager.getTaskList().getAllTasks().size();
+ int allRootTasks = manager.getTaskList().getRoots().size();
+
+ manager.saveTaskList();
+ TaskList list = new TaskList();
+ manager.setTaskList(list);
+ manager.readExistingOrCreateNewList();
+
+ assertEquals(allTasks, manager.getTaskList().getAllTasks().size());
+ assertEquals(allRootTasks, manager.getTaskList().getRootTasks().size());
+ }
+
public void testRepositoryUrlHandles() {
String repository = IBugzillaConstants.ECLIPSE_BUGZILLA_URL;
diff --git a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasklist/tests/TaskTestUtil.java b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasklist/tests/TaskTestUtil.java
index 5eb708c31..642ca1a83 100644
--- a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasklist/tests/TaskTestUtil.java
+++ b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasklist/tests/TaskTestUtil.java
@@ -11,8 +11,12 @@
package org.eclipse.mylar.tasklist.tests;
+import java.io.File;
+import java.io.IOException;
+import java.net.URL;
import java.util.Date;
+import org.eclipse.core.runtime.FileLocator;
import org.eclipse.mylar.bugzilla.core.Attribute;
import org.eclipse.mylar.bugzilla.core.BugReport;
import org.eclipse.mylar.bugzilla.core.Comment;
@@ -24,6 +28,16 @@ import org.eclipse.mylar.internal.bugzilla.ui.tasklist.BugzillaTask;
*/
public class TaskTestUtil {
+ public static File getLocalFile(String path) {
+ try {
+ URL installURL = MylarTasksTestsPlugin.getDefault().getBundle().getEntry(path);
+ URL localURL = FileLocator.toFileURL(installURL);
+ return new File(localURL.getFile());
+ } catch (IOException e) {
+ return null;
+ }
+ }
+
public static void setBugTaskCompleted(BugzillaTask bugzillaTask, boolean completed) {
BugReport report = new BugReport(1, IBugzillaConstants.ECLIPSE_BUGZILLA_URL);
bugzillaTask.setBugReport(report);
diff --git a/org.eclipse.mylyn.tasks.tests/testdata/legacy/tasklist_0_4_8.xml b/org.eclipse.mylyn.tasks.tests/testdata/legacy/tasklist_0_4_8.xml
new file mode 100644
index 000000000..8468001c7
--- /dev/null
+++ b/org.eclipse.mylyn.tasks.tests/testdata/legacy/tasklist_0_4_8.xml
@@ -0,0 +1 @@
+<?xml version="1.0" encoding="UTF-8"?><TaskList Version="1.0.1"><Task Active="false" Complete="false" CreationDate="2006-02-19 15:17:17.286 PST" Elapsed="10" EndDate="" Estimated="0" Handle="local-104123" IssueURL="" Kind="" Label="task 1" Notes="" Priority="P3" Reminded="false" ReminderDate=""/><Task Active="false" Complete="false" CreationDate="2006-02-19 15:17:17.507 PST" Elapsed="10" EndDate="" Estimated="0" Handle="local-104128" IssueURL="" Kind="" Label="task 1" Notes="" Priority="P3" Reminded="false" ReminderDate=""/><Task Active="false" Complete="false" CreationDate="2006-02-19 15:17:17.507 PST" Elapsed="10" EndDate="" Estimated="0" Handle="local-104131" IssueURL="" Kind="" Label="task 4" Notes="" Priority="P3" Reminded="false" ReminderDate=""/><Task Active="false" Complete="false" CreationDate="2006-02-19 15:17:17.507 PST" Elapsed="10" EndDate="" Estimated="0" Handle="local-104132" IssueURL="" Kind="" Label="task 5" Notes="" Priority="P3" Reminded="false" ReminderDate=""/><Task Active="false" Complete="false" CreationDate="2006-02-19 15:17:17.286 PST" Elapsed="30" EndDate="" Estimated="0" Handle="local-104126" IssueURL="" Kind="" Label="task 4" Notes="" Priority="P3" Reminded="false" ReminderDate=""/><Task Active="false" Complete="false" CreationDate="2006-02-19 15:17:17.507 PST" Elapsed="10" EndDate="" Estimated="0" Handle="local-104129" IssueURL="" Kind="" Label="task 2" Notes="" Priority="P3" Reminded="false" ReminderDate=""/><Task Active="false" Complete="false" CreationDate="2006-02-19 15:17:17.286 PST" Elapsed="0" EndDate="" Estimated="0" Handle="local-104127" IssueURL="" Kind="" Label="task 5" Notes="" Priority="P3" Reminded="false" ReminderDate=""/><Task Active="false" Complete="false" CreationDate="2006-02-19 15:17:17.286 PST" Elapsed="40" EndDate="" Estimated="0" Handle="local-104124" IssueURL="" Kind="" Label="task 2" Notes="" Priority="P3" Reminded="false" ReminderDate=""/><Task Active="false" Complete="false" CreationDate="2006-02-19 15:17:17.507 PST" Elapsed="0" EndDate="" Estimated="0" Handle="local-104130" IssueURL="" Kind="" Label="task 3" Notes="" Priority="P3" Reminded="false" ReminderDate=""/><Task Active="false" Complete="false" CreationDate="2006-02-19 15:17:17.647 PST" Elapsed="0" EndDate="" Estimated="0" Handle="local-104133" IssueURL="" Kind="" Label="Export Test Task" Notes="" Priority="P3" Reminded="false" ReminderDate=""/><Task Active="false" Complete="false" CreationDate="2006-02-19 15:17:18.798 PST" Elapsed="0" EndDate="" Estimated="0" Handle="local-104134" IssueURL="" Kind="" Label="Export Test Task" Notes="" Priority="P3" Reminded="false" ReminderDate=""/><Task Active="false" Complete="false" CreationDate="2006-02-19 15:17:17.286 PST" Elapsed="30" EndDate="" Estimated="0" Handle="local-104125" IssueURL="" Kind="" Label="task 3" Notes="" Priority="P3" Reminded="false" ReminderDate=""/></TaskList> \ No newline at end of file
diff --git a/org.eclipse.mylyn.tasks.tests/taskdataimporttest/context-history.xml b/org.eclipse.mylyn.tasks.tests/testdata/taskdataimporttest/context-history.xml
index 00635a83f..00635a83f 100644
--- a/org.eclipse.mylyn.tasks.tests/taskdataimporttest/context-history.xml
+++ b/org.eclipse.mylyn.tasks.tests/testdata/taskdataimporttest/context-history.xml
diff --git a/org.eclipse.mylyn.tasks.tests/taskdataimporttest/local-69.xml b/org.eclipse.mylyn.tasks.tests/testdata/taskdataimporttest/local-69.xml
index 6fa996e7d..6fa996e7d 100644
--- a/org.eclipse.mylyn.tasks.tests/taskdataimporttest/local-69.xml
+++ b/org.eclipse.mylyn.tasks.tests/testdata/taskdataimporttest/local-69.xml
diff --git a/org.eclipse.mylyn.tasks.tests/taskdataimporttest/local-70.xml b/org.eclipse.mylyn.tasks.tests/testdata/taskdataimporttest/local-70.xml
index 2b043aaf6..2b043aaf6 100644
--- a/org.eclipse.mylyn.tasks.tests/taskdataimporttest/local-70.xml
+++ b/org.eclipse.mylyn.tasks.tests/testdata/taskdataimporttest/local-70.xml
diff --git a/org.eclipse.mylyn.tasks.tests/taskdataimporttest/mylardata-2006-02-16.zip b/org.eclipse.mylyn.tasks.tests/testdata/taskdataimporttest/mylardata-2006-02-16.zip
index 6538612f8..6538612f8 100644
--- a/org.eclipse.mylyn.tasks.tests/taskdataimporttest/mylardata-2006-02-16.zip
+++ b/org.eclipse.mylyn.tasks.tests/testdata/taskdataimporttest/mylardata-2006-02-16.zip
Binary files differ
diff --git a/org.eclipse.mylyn.tasks.tests/taskdataimporttest/tasklist.xml b/org.eclipse.mylyn.tasks.tests/testdata/taskdataimporttest/tasklist.xml
index c5848ef42..c5848ef42 100644
--- a/org.eclipse.mylyn.tasks.tests/taskdataimporttest/tasklist.xml
+++ b/org.eclipse.mylyn.tasks.tests/testdata/taskdataimporttest/tasklist.xml

Back to the top