Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 276457 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/equinox/p2/tests/repository/FileReaderTest.java (-4 / +26 lines)
Lines 11-21 Link Here
11
11
12
package org.eclipse.equinox.p2.tests.repository;
12
package org.eclipse.equinox.p2.tests.repository;
13
13
14
import java.io.ByteArrayOutputStream;
14
import java.io.*;
15
import java.io.OutputStream;
16
import java.net.*;
15
import java.net.*;
17
import org.eclipse.core.runtime.IStatus;
16
import org.eclipse.core.runtime.*;
18
import org.eclipse.core.runtime.NullProgressMonitor;
19
import org.eclipse.equinox.internal.p2.repository.RepositoryTransport;
17
import org.eclipse.equinox.internal.p2.repository.RepositoryTransport;
20
import org.eclipse.equinox.p2.tests.testserver.helper.AbstractTestServerClientCase;
18
import org.eclipse.equinox.p2.tests.testserver.helper.AbstractTestServerClientCase;
21
19
Lines 44-49 Link Here
44
		assertTrue("Should be a connect exception", status.getException() instanceof ConnectException);
42
		assertTrue("Should be a connect exception", status.getException() instanceof ConnectException);
45
		assertTrue("Should begin with 'Connection refused'", status.getException().getMessage().startsWith("Connection refused"));
43
		assertTrue("Should begin with 'Connection refused'", status.getException().getMessage().startsWith("Connection refused"));
46
	}
44
	}
45
46
	/**
47
	 * Tests a successful read.
48
	 */
49
	public void testReadStream() throws URISyntaxException, CoreException, IOException {
50
		RepositoryTransport transport = RepositoryTransport.getInstance();
51
		URI toDownload = new URI("http://localhost:8080/public/index.html");
52
		final NullProgressMonitor monitor = new NullProgressMonitor();
53
		InputStream stream = transport.stream(toDownload, monitor);
54
		stream.close();
55
		assertFalse("1.0", monitor.isCanceled());
56
	}
57
58
	/**
59
	 * Tests a successful read.
60
	 */
61
	public void testRead() throws URISyntaxException, CoreException, IOException {
62
		RepositoryTransport transport = RepositoryTransport.getInstance();
63
		URI toDownload = new URI("http://localhost:8080/public/index.html");
64
		OutputStream target = new ByteArrayOutputStream();
65
		final NullProgressMonitor monitor = new NullProgressMonitor();
66
		IStatus result = transport.download(toDownload, target, monitor);
67
		assertTrue("1.0", result.isOK());
68
	}
47
	// TODO: test
69
	// TODO: test
48
	// timeout, cancel of timeout (TimeoutTest)
70
	// timeout, cancel of timeout (TimeoutTest)
49
	// bad date returned, very old, and in the future
71
	// bad date returned, very old, and in the future

Return to bug 276457