Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrelves2007-04-20 13:49:00 -0400
committerrelves2007-04-20 13:49:00 -0400
commita3295df5e2b56aa51fa93775f2e6fb8139f5a2a7 (patch)
treec314880a97fab69812412798041bc4a297570063 /org.eclipse.mylyn.trac.tests
parentc0794e09f3b510736d103bad8072f630be36010a (diff)
downloadorg.eclipse.mylyn.tasks-a3295df5e2b56aa51fa93775f2e6fb8139f5a2a7.tar.gz
org.eclipse.mylyn.tasks-a3295df5e2b56aa51fa93775f2e6fb8139f5a2a7.tar.xz
org.eclipse.mylyn.tasks-a3295df5e2b56aa51fa93775f2e6fb8139f5a2a7.zip
NEW - bug 181038: [api] Pull RepositoryTaskData from AbstractRepositoryTask and fix synch of data
https://bugs.eclipse.org/bugs/show_bug.cgi?id=181038
Diffstat (limited to 'org.eclipse.mylyn.trac.tests')
-rw-r--r--org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/TracAttachmentHandlerTest.java27
-rw-r--r--org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/TracRepositoryConnectorTest.java20
-rw-r--r--org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/TracTaskDataHandlerTest.java9
3 files changed, 33 insertions, 23 deletions
diff --git a/org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/TracAttachmentHandlerTest.java b/org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/TracAttachmentHandlerTest.java
index 3aaed918a..48476907e 100644
--- a/org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/TracAttachmentHandlerTest.java
+++ b/org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/TracAttachmentHandlerTest.java
@@ -30,6 +30,7 @@ import org.eclipse.mylar.internal.trac.core.TracTask;
import org.eclipse.mylar.internal.trac.core.ITracClient.Version;
import org.eclipse.mylar.tasks.core.AbstractRepositoryConnector;
import org.eclipse.mylar.tasks.core.IAttachmentHandler;
+import org.eclipse.mylar.tasks.core.RepositoryTaskData;
import org.eclipse.mylar.tasks.core.TaskRepository;
import org.eclipse.mylar.tasks.core.TaskRepositoryManager;
import org.eclipse.mylar.tasks.ui.TasksUiPlugin;
@@ -94,12 +95,14 @@ public class TracAttachmentHandlerTest extends TestCase {
private void downloadAttachmentXmlRpc(String url) throws Exception {
init(url, Version.XML_RPC);
- TracTask task = (TracTask) connector.createTaskFromExistingKey(repository, data.attachmentTicketId + "");
+ TracTask task = (TracTask) connector.createTaskFromExistingId(repository, data.attachmentTicketId + "");
TasksUiPlugin.getSynchronizationManager().synchronize(connector, task, true, null);
- assertTrue(task.getTaskData().getAttachments().size() > 0);
+ RepositoryTaskData taskData = TasksUiPlugin.getDefault().getTaskDataManager().getRepositoryTaskData(task.getHandleIdentifier());
+
+ assertTrue(taskData.getAttachments().size() > 0);
File file = File.createTempFile("attachment", null);
file.deleteOnExit();
- attachmentHandler.downloadAttachment(repository, task.getTaskData().getAttachments().get(0), file);
+ attachmentHandler.downloadAttachment(repository, taskData.getAttachments().get(0), file);
byte[] result = new byte[6];
InputStream in = new FileInputStream(file);
@@ -122,10 +125,12 @@ public class TracAttachmentHandlerTest extends TestCase {
private void getAttachmentDataXmlRpc(String url) throws Exception {
init(url, Version.XML_RPC);
- TracTask task = (TracTask) connector.createTaskFromExistingKey(repository, data.attachmentTicketId + "");
+ TracTask task = (TracTask) connector.createTaskFromExistingId(repository, data.attachmentTicketId + "");
TasksUiPlugin.getSynchronizationManager().synchronize(connector, task, true, null);
- assertTrue(task.getTaskData().getAttachments().size() > 0);
- byte[] result = attachmentHandler.getAttachmentData(repository, task.getTaskData().getAttachments().get(0));
+ RepositoryTaskData taskData = TasksUiPlugin.getDefault().getTaskDataManager().getRepositoryTaskData(task.getHandleIdentifier());
+
+ assertTrue(taskData.getAttachments().size() > 0);
+ byte[] result = attachmentHandler.getAttachmentData(repository,taskData.getAttachments().get(0));
assertEquals("Mylar\n", new String(result));
}
@@ -139,7 +144,7 @@ public class TracAttachmentHandlerTest extends TestCase {
private void uploadAttachmentXmlRpc(String url) throws Exception {
init(url, Version.XML_RPC);
- TracTask task = (TracTask) connector.createTaskFromExistingKey(repository, data.attachmentTicketId + "");
+ TracTask task = (TracTask) connector.createTaskFromExistingId(repository, data.attachmentTicketId + "");
File file = File.createTempFile("attachment", null);
file.deleteOnExit();
OutputStream out = new FileOutputStream(file);
@@ -157,25 +162,25 @@ public class TracAttachmentHandlerTest extends TestCase {
public void testCanUploadAttachmentXmlRpc() throws CoreException {
init(Constants.TEST_TRAC_010_URL, Version.XML_RPC);
- TracTask task = (TracTask) connector.createTaskFromExistingKey(repository, data.attachmentTicketId + "");
+ TracTask task = (TracTask) connector.createTaskFromExistingId(repository, data.attachmentTicketId + "");
assertTrue(attachmentHandler.canUploadAttachment(repository, task));
}
public void testCanUploadAttachmentWeb() throws CoreException {
init(Constants.TEST_TRAC_010_URL, Version.TRAC_0_9);
- TracTask task = (TracTask) connector.createTaskFromExistingKey(repository, data.attachmentTicketId + "");
+ TracTask task = (TracTask) connector.createTaskFromExistingId(repository, data.attachmentTicketId + "");
assertFalse(attachmentHandler.canUploadAttachment(repository, task));
}
public void testCanDownloadAttachmentXmlRpc() throws Exception {
init(Constants.TEST_TRAC_010_URL, Version.XML_RPC);
- TracTask task = (TracTask) connector.createTaskFromExistingKey(repository, data.attachmentTicketId + "");
+ TracTask task = (TracTask) connector.createTaskFromExistingId(repository, data.attachmentTicketId + "");
assertTrue(attachmentHandler.canDownloadAttachment(repository, task));
}
public void testCanDownloadAttachmentWeb() throws Exception {
init(Constants.TEST_TRAC_010_URL, Version.TRAC_0_9);
- TracTask task = (TracTask) connector.createTaskFromExistingKey(repository, data.attachmentTicketId + "");
+ TracTask task = (TracTask) connector.createTaskFromExistingId(repository, data.attachmentTicketId + "");
assertFalse(attachmentHandler.canDownloadAttachment(repository, task));
}
diff --git a/org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/TracRepositoryConnectorTest.java b/org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/TracRepositoryConnectorTest.java
index d6300b2e1..c59d29124 100644
--- a/org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/TracRepositoryConnectorTest.java
+++ b/org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/TracRepositoryConnectorTest.java
@@ -143,23 +143,25 @@ public class TracRepositoryConnectorTest extends TestCase {
protected void createTaskFromExistingKey() throws CoreException {
String id = data.tickets.get(0).getId() + "";
- ITask task = connector.createTaskFromExistingKey(repository, id);
+ ITask task = connector.createTaskFromExistingId(repository, id);
assertNotNull(task);
assertEquals(TracTask.class, task.getClass());
assertTrue(task.getSummary().contains("summary1"));
assertEquals(repository.getUrl() + ITracClient.TICKET_URL + id, task.getTaskUrl());
try {
- task = connector.createTaskFromExistingKey(repository, "does not exist");
+ task = connector.createTaskFromExistingId(repository, "does not exist");
fail("Expected CoreException");
} catch (CoreException e) {
}
- try {
- task = connector.createTaskFromExistingKey(repository, Integer.MAX_VALUE + "");
- fail("Expected CoreException");
- } catch (CoreException e) {
- }
+ // No longer parsing as an integer
+ // try {
+ // task = connector.createTaskFromExistingId(repository,
+ // Integer.MAX_VALUE + "");
+ // fail("Expected CoreException");
+ // } catch (CoreException e) {
+ // }
}
public void testClientManagerChangeTaskRepositorySettings() throws MalformedURLException {
@@ -306,7 +308,7 @@ public class TracRepositoryConnectorTest extends TestCase {
public void testContextXmlRpc010() throws Exception {
init(Constants.TEST_TRAC_010_URL, Version.XML_RPC);
- TracTask task = (TracTask) connector.createTaskFromExistingKey(repository, data.attachmentTicketId + "");
+ TracTask task = (TracTask) connector.createTaskFromExistingId(repository, data.attachmentTicketId + "");
TasksUiPlugin.getSynchronizationManager().synchronize(connector, task, true, null);
//int size = task.getTaskData().getAttachments().size();
@@ -327,7 +329,7 @@ public class TracRepositoryConnectorTest extends TestCase {
public void testContextWeb096() throws Exception {
init(Constants.TEST_TRAC_096_URL, Version.TRAC_0_9);
- TracTask task = (TracTask) connector.createTaskFromExistingKey(repository, data.attachmentTicketId + "");
+ TracTask task = (TracTask) connector.createTaskFromExistingId(repository, data.attachmentTicketId + "");
File sourceContextFile = ContextCorePlugin.getContextManager().getFileForContext(task.getHandleIdentifier());
sourceContextFile.createNewFile();
diff --git a/org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/TracTaskDataHandlerTest.java b/org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/TracTaskDataHandlerTest.java
index a2c9b324c..be11061ad 100644
--- a/org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/TracTaskDataHandlerTest.java
+++ b/org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/TracTaskDataHandlerTest.java
@@ -28,6 +28,7 @@ import org.eclipse.mylar.internal.trac.core.ITracClient.Version;
import org.eclipse.mylar.internal.trac.core.model.TracTicket;
import org.eclipse.mylar.internal.trac.core.model.TracTicket.Key;
import org.eclipse.mylar.tasks.core.AbstractRepositoryTask;
+import org.eclipse.mylar.tasks.core.RepositoryTaskData;
import org.eclipse.mylar.tasks.core.TaskRepository;
import org.eclipse.mylar.tasks.core.TaskRepositoryManager;
import org.eclipse.mylar.tasks.ui.TasksUiPlugin;
@@ -77,7 +78,7 @@ public class TracTaskDataHandlerTest extends TestCase {
public void testGetChangedSinceLastSyncWeb096() throws Exception {
init(Constants.TEST_TRAC_096_URL, Version.TRAC_0_9);
- TracTask task = (TracTask) connector.createTaskFromExistingKey(repository, data.offlineHandlerTicketId + "");
+ TracTask task = (TracTask) connector.createTaskFromExistingId(repository, data.offlineHandlerTicketId + "");
Set<AbstractRepositoryTask> tasks = new HashSet<AbstractRepositoryTask>();
tasks.add(task);
@@ -103,9 +104,11 @@ public class TracTaskDataHandlerTest extends TestCase {
}
private void getChangedSinceLastSync() throws Exception {
- TracTask task = (TracTask) connector.createTaskFromExistingKey(repository, data.offlineHandlerTicketId + "");
+ TracTask task = (TracTask) connector.createTaskFromExistingId(repository, data.offlineHandlerTicketId + "");
TasksUiPlugin.getSynchronizationManager().synchronize(connector, task, true, null);
- int lastModified = Integer.parseInt(task.getTaskData().getLastModified());
+ RepositoryTaskData taskData = TasksUiPlugin.getDefault().getTaskDataManager().getRepositoryTaskData(task.getHandleIdentifier());
+
+ int lastModified = Integer.parseInt(taskData.getLastModified());
Set<AbstractRepositoryTask> tasks = new HashSet<AbstractRepositoryTask>();
tasks.add(task);

Back to the top