summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteffen Pingel2013-04-26 07:57:52 (EDT)
committer Steffen Pingel2013-04-26 07:57:52 (EDT)
commit31f0684617b89626585405bad6a84d3feb6fc84c (patch)
tree0eeb76f6b2bc6a4aef70dce7366189170a2c458f
parent20c98b377a2144802a9b6429e0a98c7fe7b0935f (diff)
downloadorg.eclipse.mylyn.tasks-31f0684617b89626585405bad6a84d3feb6fc84c.zip
org.eclipse.mylyn.tasks-31f0684617b89626585405bad6a84d3feb6fc84c.tar.gz
org.eclipse.mylyn.tasks-31f0684617b89626585405bad6a84d3feb6fc84c.tar.bz2
406647: re-enable disabled testsrefs/changes/32/12232/1
Change-Id: I61120fefe90b907cb89a348856a1640fb240f829 Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=406647
-rw-r--r--org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/data/TaskDataExternalizerTest.java99
-rw-r--r--org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/data/Xml11InputStreamTest.java1
-rw-r--r--org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/data/XmlExternalizationTest.java3
-rw-r--r--org.eclipse.mylyn.tasks.tests/testdata/taskdata-1.0-bug-219897.zipbin4526 -> 4575 bytes
4 files changed, 38 insertions, 65 deletions
diff --git a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/data/TaskDataExternalizerTest.java b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/data/TaskDataExternalizerTest.java
index d0abf79..799d9f3 100644
--- a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/data/TaskDataExternalizerTest.java
+++ b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/data/TaskDataExternalizerTest.java
@@ -13,6 +13,9 @@ package org.eclipse.mylyn.tasks.tests.data;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.util.zip.ZipInputStream;
import junit.framework.TestCase;
@@ -21,8 +24,10 @@ import org.eclipse.mylyn.internal.tasks.core.data.TaskDataExternalizer;
import org.eclipse.mylyn.internal.tasks.core.data.TaskDataExternalizer.Xml11InputStream;
import org.eclipse.mylyn.internal.tasks.core.data.TaskDataState;
import org.eclipse.mylyn.tasks.core.TaskRepository;
+import org.eclipse.mylyn.tasks.core.data.ITaskDataWorkingCopy;
import org.eclipse.mylyn.tasks.core.data.TaskAttributeMapper;
import org.eclipse.mylyn.tasks.core.data.TaskData;
+import org.eclipse.mylyn.tasks.tests.TaskTestUtil;
import org.eclipse.mylyn.tasks.tests.connector.MockRepositoryConnector;
import org.xml.sax.SAXParseException;
@@ -39,74 +44,42 @@ public class TaskDataExternalizerTest extends TestCase {
protected void setUp() throws Exception {
TaskRepositoryManager taskRepositoryManager = new TaskRepositoryManager();
taskRepositoryManager.addRepositoryConnector(new MockRepositoryConnector());
- //taskRepositoryManager.addRepositoryConnector(new BugzillaRepositoryConnector());
repository = new TaskRepository(MockRepositoryConnector.CONNECTOR_KIND, MockRepositoryConnector.REPOSITORY_URL);
taskRepositoryManager.addRepository(repository);
externalizer = new TaskDataExternalizer(taskRepositoryManager);
}
-// public void testMapFromLegacy() throws Exception {
-// File file = TaskTestUtil.getFile("testdata/taskdata-1.0-bug-219897.zip");
-// ZipInputStream in = new ZipInputStream(new FileInputStream(file));
-// ITaskDataWorkingCopy state;
-// try {
-// in.getNextEntry();
-// state = externalizer.readState(in);
-// } finally {
-// in.close();
-// }
-//
-// TaskData taskData = state.getRepositoryData();
-// @SuppressWarnings("unused")
-// TaskMapper taskScheme = new TaskMapper(taskData);
-//
-// RepositoryTaskData legacyData = TaskDataUtil.toLegacyData(taskData, IdentityAttributeFactory.getInstance());
-// assertEquals(taskData.getConnectorKind(), legacyData.getConnectorKind());
-// assertEquals(taskData.getRepositoryUrl(), legacyData.getRepositoryUrl());
-// assertEquals(taskData.getTaskId(), legacyData.getTaskId());
-// assertEquals(taskScheme.getTaskKind(), legacyData.getTaskKind());
-// assertEquals(taskScheme.getComments().length, legacyData.getComments().size());
-// assertEquals(taskScheme.getAttachments().length, legacyData.getAttachments().size());
-//
-// TaskData taskData2 = TaskDataUtil.toTaskData(legacyData, IdentityAttributeMapper.getInstance());
-// assertEquals(taskData.getConnectorKind(), taskData2.getConnectorKind());
-// assertEquals(taskData.getRepositoryUrl(), taskData2.getRepositoryUrl());
-// assertEquals(taskData.getTaskId(), taskData2.getTaskId());
-//
-// assertEquals(taskData.getRoot().toString(), taskData2.getRoot().toString());
-// }
-//
-// public void testRead() throws Exception {
-// File file = TaskTestUtil.getFile("testdata/taskdata-1.0-bug-219897.zip");
-// ZipInputStream in = new ZipInputStream(new FileInputStream(file));
-// try {
-// in.getNextEntry();
-// @SuppressWarnings("unused")
-// ITaskDataWorkingCopy state = externalizer.readState(in);
-// } finally {
-// in.close();
-// }
-// }
-//
-// public void testReadWrite() throws Exception {
-// File file = TaskTestUtil.getFile("testdata/taskdata-1.0-bug-219897.zip");
-// ZipInputStream in = new ZipInputStream(new FileInputStream(file));
-// ITaskDataWorkingCopy state;
-// try {
-// in.getNextEntry();
-// state = externalizer.readState(in);
-// } finally {
-// in.close();
-// }
-// ByteArrayOutputStream out = new ByteArrayOutputStream();
-// externalizer.writeState(out, state);
-// TaskDataState state2 = externalizer.readState(new ByteArrayInputStream(out.toByteArray()));
-// assertEquals(state.getConnectorKind(), state2.getConnectorKind());
-// assertEquals(state.getRepositoryUrl(), state2.getRepositoryUrl());
-// assertEquals(state.getTaskId(), state2.getTaskId());
-//
-// assertEquals(state.getRepositoryData().getRoot().toString(), state2.getRepositoryData().getRoot().toString());
-// }
+ public void testRead() throws Exception {
+ File file = TaskTestUtil.getFile("testdata/taskdata-1.0-bug-219897.zip");
+ ZipInputStream in = new ZipInputStream(new FileInputStream(file));
+ try {
+ in.getNextEntry();
+ @SuppressWarnings("unused")
+ ITaskDataWorkingCopy state = externalizer.readState(in);
+ } finally {
+ in.close();
+ }
+ }
+
+ public void testReadWrite() throws Exception {
+ File file = TaskTestUtil.getFile("testdata/taskdata-1.0-bug-219897.zip");
+ ZipInputStream in = new ZipInputStream(new FileInputStream(file));
+ ITaskDataWorkingCopy state;
+ try {
+ in.getNextEntry();
+ state = externalizer.readState(in);
+ } finally {
+ in.close();
+ }
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ externalizer.writeState(out, state);
+ TaskDataState state2 = externalizer.readState(new ByteArrayInputStream(out.toByteArray()));
+ assertEquals(state.getConnectorKind(), state2.getConnectorKind());
+ assertEquals(state.getRepositoryUrl(), state2.getRepositoryUrl());
+ assertEquals(state.getTaskId(), state2.getTaskId());
+
+ assertEquals(state.getRepositoryData().getRoot().toString(), state2.getRepositoryData().getRoot().toString());
+ }
public void testReadWriteInvalidCharacters() throws Exception {
TaskData data = new TaskData(new TaskAttributeMapper(repository), repository.getConnectorKind(),
diff --git a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/data/Xml11InputStreamTest.java b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/data/Xml11InputStreamTest.java
index ae8a1be..05c1294 100644
--- a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/data/Xml11InputStreamTest.java
+++ b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/data/Xml11InputStreamTest.java
@@ -23,6 +23,7 @@ import org.eclipse.mylyn.internal.tasks.core.data.TaskDataExternalizer.Xml11Inpu
/**
* @author Steffen Pingel
*/
+@SuppressWarnings("resource")
public class Xml11InputStreamTest extends TestCase {
public void testShortStream() throws Exception {
diff --git a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/data/XmlExternalizationTest.java b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/data/XmlExternalizationTest.java
index 35ee298..e588cc9 100644
--- a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/data/XmlExternalizationTest.java
+++ b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/data/XmlExternalizationTest.java
@@ -21,7 +21,6 @@ import javax.xml.transform.sax.SAXTransformerFactory;
import javax.xml.transform.sax.TransformerHandler;
import javax.xml.transform.stream.StreamResult;
-import junit.framework.Assert;
import junit.framework.TestCase;
import org.eclipse.mylyn.internal.tasks.core.data.ITaskDataConstants;
@@ -50,7 +49,7 @@ public class XmlExternalizationTest extends TestCase {
@Override
public void characters(char[] ch, int start, int length) throws SAXException {
//System.err.println(Arrays.toString(ch));
- Assert.assertEquals(1, length);
+ assertEquals(1, length);
this.ch = ch[start];
}
diff --git a/org.eclipse.mylyn.tasks.tests/testdata/taskdata-1.0-bug-219897.zip b/org.eclipse.mylyn.tasks.tests/testdata/taskdata-1.0-bug-219897.zip
index 8242f58..bc4540c 100644
--- a/org.eclipse.mylyn.tasks.tests/testdata/taskdata-1.0-bug-219897.zip
+++ b/org.eclipse.mylyn.tasks.tests/testdata/taskdata-1.0-bug-219897.zip
Binary files differ