Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorslewis2007-02-02 03:03:16 +0000
committerslewis2007-02-02 03:03:16 +0000
commitc7ca5b59e34b03889110a19937be22697211ba29 (patch)
tree5bba7b942972594a6a0e8fed67eb044c0081889f /tests/bundles/org.eclipse.ecf.tests
parentb0c25e67e5316dd618700f20107977e0435be842 (diff)
downloadorg.eclipse.ecf-c7ca5b59e34b03889110a19937be22697211ba29.tar.gz
org.eclipse.ecf-c7ca5b59e34b03889110a19937be22697211ba29.tar.xz
org.eclipse.ecf-c7ca5b59e34b03889110a19937be22697211ba29.zip
new urlStreamHandlerService extension point and test code
Diffstat (limited to 'tests/bundles/org.eclipse.ecf.tests')
-rwxr-xr-xtests/bundles/org.eclipse.ecf.tests/plugin.xml10
-rwxr-xr-xtests/bundles/org.eclipse.ecf.tests/src/org/eclipse/ecf/tests/filetransfer/TestURLStreamHandlerService.java63
-rwxr-xr-xtests/bundles/org.eclipse.ecf.tests/src/org/eclipse/ecf/tests/filetransfer/URLConnectionFactory.java21
3 files changed, 68 insertions, 26 deletions
diff --git a/tests/bundles/org.eclipse.ecf.tests/plugin.xml b/tests/bundles/org.eclipse.ecf.tests/plugin.xml
index 290c201dd..bb59216fb 100755
--- a/tests/bundles/org.eclipse.ecf.tests/plugin.xml
+++ b/tests/bundles/org.eclipse.ecf.tests/plugin.xml
@@ -2,11 +2,11 @@
<?eclipse version="3.2"?>
<plugin>
<extension
- point="org.eclipse.ecf.filetransfer.urlConnectionFactory">
- <urlConnectionFactory
- class="org.eclipse.ecf.tests.filetransfer.URLConnectionFactory"
- protocol="foobar">
- </urlConnectionFactory>
+ point="org.eclipse.ecf.filetransfer.urlStreamHandlerService">
+ <urlStreamHandlerService
+ protocol="foobar"
+ serviceClass="org.eclipse.ecf.tests.filetransfer.TestURLStreamHandlerService">
+ </urlStreamHandlerService>
</extension>
</plugin>
diff --git a/tests/bundles/org.eclipse.ecf.tests/src/org/eclipse/ecf/tests/filetransfer/TestURLStreamHandlerService.java b/tests/bundles/org.eclipse.ecf.tests/src/org/eclipse/ecf/tests/filetransfer/TestURLStreamHandlerService.java
new file mode 100755
index 000000000..d8e64a955
--- /dev/null
+++ b/tests/bundles/org.eclipse.ecf.tests/src/org/eclipse/ecf/tests/filetransfer/TestURLStreamHandlerService.java
@@ -0,0 +1,63 @@
+/****************************************************************************
+ * Copyright (c) 2004 Composent, Inc. and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Composent, Inc. - initial API and implementation
+ *****************************************************************************/
+
+package org.eclipse.ecf.tests.filetransfer;
+
+import java.io.IOException;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.net.URLConnection;
+
+import org.osgi.service.url.AbstractURLStreamHandlerService;
+
+/**
+ *
+ */
+public class TestURLStreamHandlerService extends
+ AbstractURLStreamHandlerService {
+
+ class TestHttpURLConnection extends HttpURLConnection {
+
+ /**
+ * @param u
+ */
+ protected TestHttpURLConnection(URL u) {
+ super(u);
+ }
+
+ /* (non-Javadoc)
+ * @see java.net.HttpURLConnection#disconnect()
+ */
+ public void disconnect() {
+ }
+
+ /* (non-Javadoc)
+ * @see java.net.HttpURLConnection#usingProxy()
+ */
+ public boolean usingProxy() {
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see java.net.URLConnection#connect()
+ */
+ public void connect() throws IOException {
+ }
+
+ }
+ /* (non-Javadoc)
+ * @see org.osgi.service.url.AbstractURLStreamHandlerService#openConnection(java.net.URL)
+ */
+ public URLConnection openConnection(URL u) throws IOException {
+ return new TestHttpURLConnection(u);
+ }
+
+}
diff --git a/tests/bundles/org.eclipse.ecf.tests/src/org/eclipse/ecf/tests/filetransfer/URLConnectionFactory.java b/tests/bundles/org.eclipse.ecf.tests/src/org/eclipse/ecf/tests/filetransfer/URLConnectionFactory.java
deleted file mode 100755
index 547a5ec2a..000000000
--- a/tests/bundles/org.eclipse.ecf.tests/src/org/eclipse/ecf/tests/filetransfer/URLConnectionFactory.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package org.eclipse.ecf.tests.filetransfer;
-
-import java.io.IOException;
-import java.net.URL;
-import java.net.URLConnection;
-
-import org.eclipse.ecf.filetransfer.urlservice.IURLConnectionFactory;
-
-public class URLConnectionFactory implements IURLConnectionFactory {
-
- public URLConnectionFactory() {
- }
-
- public URLConnection createURLConnection(URL url) throws IOException {
- return new URLConnection(url) {
- public void connect() throws IOException {
- throw new IOException("can't connect");
- }};
- }
-
-}

Back to the top