Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorspingel2007-05-28 22:45:35 +0000
committerspingel2007-05-28 22:45:35 +0000
commitead5ed554c0f7ec004911899ecc725a5e70352d0 (patch)
tree964e5c48378c0a97d1597e10b8ede952855a1e6a /org.eclipse.mylyn.trac.tests
parent8397bf0e1b4224a457e00657599f93db018a639b (diff)
downloadorg.eclipse.mylyn.tasks-ead5ed554c0f7ec004911899ecc725a5e70352d0.tar.gz
org.eclipse.mylyn.tasks-ead5ed554c0f7ec004911899ecc725a5e70352d0.tar.xz
org.eclipse.mylyn.tasks-ead5ed554c0f7ec004911899ecc725a5e70352d0.zip
NEW - bug 143011: [api] synchronization jobs should be cancellable
https://bugs.eclipse.org/bugs/show_bug.cgi?id=143011
Diffstat (limited to 'org.eclipse.mylyn.trac.tests')
-rw-r--r--org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/TracAttachmentHandlerTest.java19
-rw-r--r--org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/TracRepositoryConnectorTest.java12
-rw-r--r--org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/TracTaskDataHandlerTest.java7
3 files changed, 20 insertions, 18 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 bec55a9e3..0b6184b83 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
@@ -20,6 +20,7 @@ import java.io.OutputStream;
import junit.framework.TestCase;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.mylar.context.tests.support.MylarTestUtils;
import org.eclipse.mylar.context.tests.support.MylarTestUtils.Credentials;
import org.eclipse.mylar.context.tests.support.MylarTestUtils.PrivilegeLevel;
@@ -95,14 +96,14 @@ public class TracAttachmentHandlerTest extends TestCase {
private void downloadAttachmentXmlRpc(String url) throws Exception {
init(url, Version.XML_RPC);
- TracTask task = (TracTask) connector.createTaskFromExistingId(repository, data.attachmentTicketId + "");
+ TracTask task = (TracTask) connector.createTaskFromExistingId(repository, data.attachmentTicketId + "", new NullProgressMonitor());
TasksUiPlugin.getSynchronizationManager().synchronize(connector, task, true, null);
RepositoryTaskData taskData = TasksUiPlugin.getDefault().getTaskDataManager().getNewTaskData(task.getHandleIdentifier());
assertTrue(taskData.getAttachments().size() > 0);
File file = File.createTempFile("attachment", null);
file.deleteOnExit();
- attachmentHandler.downloadAttachment(repository, taskData.getAttachments().get(0), file);
+ attachmentHandler.downloadAttachment(repository, taskData.getAttachments().get(0), file, new NullProgressMonitor());
byte[] result = new byte[6];
InputStream in = new FileInputStream(file);
@@ -125,7 +126,7 @@ public class TracAttachmentHandlerTest extends TestCase {
private void getAttachmentDataXmlRpc(String url) throws Exception {
init(url, Version.XML_RPC);
- TracTask task = (TracTask) connector.createTaskFromExistingId(repository, data.attachmentTicketId + "");
+ TracTask task = (TracTask) connector.createTaskFromExistingId(repository, data.attachmentTicketId + "", new NullProgressMonitor());
TasksUiPlugin.getSynchronizationManager().synchronize(connector, task, true, null);
RepositoryTaskData taskData = TasksUiPlugin.getDefault().getTaskDataManager().getNewTaskData(task.getHandleIdentifier());
@@ -144,7 +145,7 @@ public class TracAttachmentHandlerTest extends TestCase {
private void uploadAttachmentXmlRpc(String url) throws Exception {
init(url, Version.XML_RPC);
- TracTask task = (TracTask) connector.createTaskFromExistingId(repository, data.attachmentTicketId + "");
+ TracTask task = (TracTask) connector.createTaskFromExistingId(repository, data.attachmentTicketId + "", new NullProgressMonitor());
File file = File.createTempFile("attachment", null);
file.deleteOnExit();
OutputStream out = new FileOutputStream(file);
@@ -153,7 +154,7 @@ public class TracAttachmentHandlerTest extends TestCase {
} finally {
out.close();
}
- attachmentHandler.uploadAttachment(repository, task, "comment", "description", file, "", false);
+ attachmentHandler.uploadAttachment(repository, task, "comment", "description", file, "", false, new NullProgressMonitor());
ITracClient client = connector.getClientManager().getRepository(repository);
byte[] result = client.getAttachmentData(data.attachmentTicketId, file.getName());
@@ -162,25 +163,25 @@ public class TracAttachmentHandlerTest extends TestCase {
public void testCanUploadAttachmentXmlRpc() throws CoreException {
init(Constants.TEST_TRAC_010_URL, Version.XML_RPC);
- TracTask task = (TracTask) connector.createTaskFromExistingId(repository, data.attachmentTicketId + "");
+ TracTask task = (TracTask) connector.createTaskFromExistingId(repository, data.attachmentTicketId + "", new NullProgressMonitor());
assertTrue(attachmentHandler.canUploadAttachment(repository, task));
}
public void testCanUploadAttachmentWeb() throws CoreException {
init(Constants.TEST_TRAC_010_URL, Version.TRAC_0_9);
- TracTask task = (TracTask) connector.createTaskFromExistingId(repository, data.attachmentTicketId + "");
+ TracTask task = (TracTask) connector.createTaskFromExistingId(repository, data.attachmentTicketId + "", new NullProgressMonitor());
assertFalse(attachmentHandler.canUploadAttachment(repository, task));
}
public void testCanDownloadAttachmentXmlRpc() throws Exception {
init(Constants.TEST_TRAC_010_URL, Version.XML_RPC);
- TracTask task = (TracTask) connector.createTaskFromExistingId(repository, data.attachmentTicketId + "");
+ TracTask task = (TracTask) connector.createTaskFromExistingId(repository, data.attachmentTicketId + "", new NullProgressMonitor());
assertTrue(attachmentHandler.canDownloadAttachment(repository, task));
}
public void testCanDownloadAttachmentWeb() throws Exception {
init(Constants.TEST_TRAC_010_URL, Version.TRAC_0_9);
- TracTask task = (TracTask) connector.createTaskFromExistingId(repository, data.attachmentTicketId + "");
+ TracTask task = (TracTask) connector.createTaskFromExistingId(repository, data.attachmentTicketId + "", new NullProgressMonitor());
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 896910930..16a5f514c 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,14 +143,14 @@ public class TracRepositoryConnectorTest extends TestCase {
protected void createTaskFromExistingKey() throws CoreException {
String id = data.tickets.get(0).getId() + "";
- ITask task = connector.createTaskFromExistingId(repository, id);
+ ITask task = connector.createTaskFromExistingId(repository, id, new NullProgressMonitor());
assertNotNull(task);
assertEquals(TracTask.class, task.getClass());
assertTrue(task.getSummary().contains("summary1"));
assertEquals(repository.getUrl() + ITracClient.TICKET_URL + id, task.getTaskUrl());
try {
- task = connector.createTaskFromExistingId(repository, "does not exist");
+ task = connector.createTaskFromExistingId(repository, "does not exist", new NullProgressMonitor());
fail("Expected CoreException");
} catch (CoreException e) {
}
@@ -308,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.createTaskFromExistingId(repository, data.attachmentTicketId + "");
+ TracTask task = (TracTask) connector.createTaskFromExistingId(repository, data.attachmentTicketId + "", new NullProgressMonitor());
TasksUiPlugin.getSynchronizationManager().synchronize(connector, task, true, null);
//int size = task.getTaskData().getAttachments().size();
@@ -317,7 +317,7 @@ public class TracRepositoryConnectorTest extends TestCase {
sourceContextFile.createNewFile();
sourceContextFile.deleteOnExit();
- assertTrue(connector.attachContext(repository, task, ""));
+ assertTrue(connector.attachContext(repository, task, "", new NullProgressMonitor()));
TasksUiPlugin.getSynchronizationManager().synchronize(connector, task, true, null);
// TODO attachment may have been overridden therefore size may not have changed
@@ -329,14 +329,14 @@ public class TracRepositoryConnectorTest extends TestCase {
public void testContextWeb096() throws Exception {
init(Constants.TEST_TRAC_096_URL, Version.TRAC_0_9);
- TracTask task = (TracTask) connector.createTaskFromExistingId(repository, data.attachmentTicketId + "");
+ TracTask task = (TracTask) connector.createTaskFromExistingId(repository, data.attachmentTicketId + "", new NullProgressMonitor());
File sourceContextFile = ContextCorePlugin.getContextManager().getFileForContext(task.getHandleIdentifier());
sourceContextFile.createNewFile();
sourceContextFile.deleteOnExit();
try {
- connector.attachContext(repository, task, "");
+ connector.attachContext(repository, task, "", new NullProgressMonitor());
fail("expected CoreException"); // operation should not be supported
} catch (CoreException e) {
}
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 c12e6058f..30767ea97 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
@@ -17,6 +17,7 @@ import java.util.Set;
import junit.framework.TestCase;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.mylar.context.tests.support.MylarTestUtils;
import org.eclipse.mylar.context.tests.support.MylarTestUtils.Credentials;
import org.eclipse.mylar.context.tests.support.MylarTestUtils.PrivilegeLevel;
@@ -78,7 +79,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.createTaskFromExistingId(repository, data.offlineHandlerTicketId + "");
+ TracTask task = (TracTask) connector.createTaskFromExistingId(repository, data.offlineHandlerTicketId + "", new NullProgressMonitor());
Set<AbstractRepositoryTask> tasks = new HashSet<AbstractRepositoryTask>();
tasks.add(task);
@@ -104,7 +105,7 @@ public class TracTaskDataHandlerTest extends TestCase {
}
private void getChangedSinceLastSync() throws Exception {
- TracTask task = (TracTask) connector.createTaskFromExistingId(repository, data.offlineHandlerTicketId + "");
+ TracTask task = (TracTask) connector.createTaskFromExistingId(repository, data.offlineHandlerTicketId + "", new NullProgressMonitor());
TasksUiPlugin.getSynchronizationManager().synchronize(connector, task, true, null);
RepositoryTaskData taskData = TasksUiPlugin.getDefault().getTaskDataManager().getNewTaskData(task.getHandleIdentifier());
@@ -144,7 +145,7 @@ public class TracTaskDataHandlerTest extends TestCase {
public void testNonNumericTaskId() {
try {
- connector.getTaskDataHandler().getTaskData(repository, "abc");
+ connector.getTaskDataHandler().getTaskData(repository, "abc", new NullProgressMonitor());
fail("Expected CoreException");
} catch (CoreException e) {
}

Back to the top