Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrank Becker2012-11-10 15:27:11 -0500
committerFrank Becker2012-11-10 15:27:11 -0500
commit107375ddaf942a0500a8e68b60a0dccd88ae975a (patch)
tree9a1c00ed1e6c4c93fb05480c5110093a7084b5cd /org.eclipse.mylyn.bugzilla.tests/src
parente6bbeba9bc7202bc081eb772f84ff61358d53cb3 (diff)
downloadorg.eclipse.mylyn.tasks-107375ddaf942a0500a8e68b60a0dccd88ae975a.tar.gz
org.eclipse.mylyn.tasks-107375ddaf942a0500a8e68b60a0dccd88ae975a.tar.xz
org.eclipse.mylyn.tasks-107375ddaf942a0500a8e68b60a0dccd88ae975a.zip
393640: fix for testDownloadAttachmentFile
https://bugs.eclipse.org/bugs/show_bug.cgi?id=393640 Change-Id: I2a00a662ffe549dbfa095fa665512ca94663e0a7
Diffstat (limited to 'org.eclipse.mylyn.bugzilla.tests/src')
-rw-r--r--org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaAttachmentHandlerTest.java17
1 files changed, 9 insertions, 8 deletions
diff --git a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaAttachmentHandlerTest.java b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaAttachmentHandlerTest.java
index d98014f66..676954d7c 100644
--- a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaAttachmentHandlerTest.java
+++ b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaAttachmentHandlerTest.java
@@ -11,16 +11,18 @@
package org.eclipse.mylyn.bugzilla.tests;
+import java.io.BufferedOutputStream;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileInputStream;
+import java.io.FileOutputStream;
import java.io.FileWriter;
+import java.io.OutputStream;
import java.util.Date;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Status;
import org.eclipse.mylyn.bugzilla.tests.support.BugzillaFixture;
import org.eclipse.mylyn.commons.net.AuthenticationCredentials;
import org.eclipse.mylyn.commons.net.AuthenticationType;
@@ -35,7 +37,6 @@ import org.eclipse.mylyn.internal.tasks.core.TaskTask;
import org.eclipse.mylyn.internal.tasks.core.data.FileTaskAttachmentSource;
import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
import org.eclipse.mylyn.internal.tasks.ui.util.AttachmentUtil;
-import org.eclipse.mylyn.internal.tasks.ui.util.DownloadAttachmentJob;
import org.eclipse.mylyn.tasks.core.ITask;
import org.eclipse.mylyn.tasks.core.ITask.SynchronizationState;
import org.eclipse.mylyn.tasks.core.ITaskAttachment;
@@ -569,12 +570,12 @@ public class BugzillaAttachmentHandlerTest extends AbstractBugzillaTest {
ITaskAttachment taskAttachment;
taskAttachment = new TaskAttachment(repository, iTask, attachmentAttribute);
- DownloadAttachmentJob job = new DownloadAttachmentJob(taskAttachment, file);
- job.schedule();
- job.join();
-
- assertEquals(Status.OK_STATUS, job.getResult());
-
+ OutputStream out = new BufferedOutputStream(new FileOutputStream(file));
+ try {
+ AttachmentUtil.downloadAttachment(taskAttachment, out, new NullProgressMonitor());
+ } finally {
+ out.close();
+ }
FileInputStream raf = new FileInputStream(file);
byte[] data = new byte[expected.length()];

Back to the top