Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Arthorne2009-05-15 15:13:38 +0000
committerJohn Arthorne2009-05-15 15:13:38 +0000
commita1432f4d30ae160aba4cdc7677cb4d182fd0610a (patch)
treea87cfad0f9a0aaabaa255098c07a181927f93e93 /bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/repository
parenta9418c4d8137da13d07407e54a9bf6c3664abaa3 (diff)
downloadrt.equinox.p2-a1432f4d30ae160aba4cdc7677cb4d182fd0610a.tar.gz
rt.equinox.p2-a1432f4d30ae160aba4cdc7677cb4d182fd0610a.tar.xz
rt.equinox.p2-a1432f4d30ae160aba4cdc7677cb4d182fd0610a.zip
Tests for bug 276457 Install fails without a trace using I20090514-2000.v20090515
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/repository')
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/repository/FileReaderTest.java30
1 files changed, 26 insertions, 4 deletions
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/repository/FileReaderTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/repository/FileReaderTest.java
index cbdfab4cd..b0d20809a 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/repository/FileReaderTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/repository/FileReaderTest.java
@@ -11,11 +11,9 @@
package org.eclipse.equinox.p2.tests.repository;
-import java.io.ByteArrayOutputStream;
-import java.io.OutputStream;
+import java.io.*;
import java.net.*;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.*;
import org.eclipse.equinox.internal.p2.repository.RepositoryTransport;
import org.eclipse.equinox.p2.tests.testserver.helper.AbstractTestServerClientCase;
@@ -44,6 +42,30 @@ public class FileReaderTest extends AbstractTestServerClientCase {
assertTrue("Should be a connect exception", status.getException() instanceof ConnectException);
assertTrue("Should begin with 'Connection refused'", status.getException().getMessage().startsWith("Connection refused"));
}
+
+ /**
+ * Tests a successful read.
+ */
+ public void testReadStream() throws URISyntaxException, CoreException, IOException {
+ RepositoryTransport transport = RepositoryTransport.getInstance();
+ URI toDownload = new URI("http://localhost:8080/public/index.html");
+ final NullProgressMonitor monitor = new NullProgressMonitor();
+ InputStream stream = transport.stream(toDownload, monitor);
+ stream.close();
+ assertFalse("1.0", monitor.isCanceled());
+ }
+
+ /**
+ * Tests a successful read.
+ */
+ public void testRead() throws URISyntaxException, CoreException, IOException {
+ RepositoryTransport transport = RepositoryTransport.getInstance();
+ URI toDownload = new URI("http://localhost:8080/public/index.html");
+ OutputStream target = new ByteArrayOutputStream();
+ final NullProgressMonitor monitor = new NullProgressMonitor();
+ IStatus result = transport.download(toDownload, target, monitor);
+ assertTrue("1.0", result.isOK());
+ }
// TODO: test
// timeout, cancel of timeout (TimeoutTest)
// bad date returned, very old, and in the future

Back to the top