diff options
author | Przemyslaw Szczepaniak <pszczepaniak@google.com> | 2015-11-20 15:22:24 +0000 |
---|---|---|
committer | Narayan Kamath <narayan@google.com> | 2015-11-21 14:46:44 +0000 |
commit | bafdbfec31bfafcd15f117662732a190619c7588 (patch) | |
tree | 0dca0b5c5d256e73f51c1f29297f76ccadac79f4 | |
parent | f0f45c2a4179835241557c9b6311bedf8de75dc0 (diff) | |
download | apache-harmony-bafdbfec31bfafcd15f117662732a190619c7588.tar.gz |
Fix for OpenJdk libcore switch
Classes tested by FileURLConnectionTest URLClassLoaderImplTest
are no longer included in libcore build. I managed to update
URLClassLoaderImplTest to test against openJdk equivalent,
but FileURLConnectionTest needs more work.
Change-Id: Id621bd04e9e12db4462106b273c62aa1b86c2de1
2 files changed, 74 insertions, 74 deletions
diff --git a/luni/src/test/api/common/org/apache/harmony/luni/tests/internal/net/www/protocol/file/FileURLConnectionTest.java b/luni/src/test/api/common/org/apache/harmony/luni/tests/internal/net/www/protocol/file/FileURLConnectionTest.java index 5887869..17a061c 100644 --- a/luni/src/test/api/common/org/apache/harmony/luni/tests/internal/net/www/protocol/file/FileURLConnectionTest.java +++ b/luni/src/test/api/common/org/apache/harmony/luni/tests/internal/net/www/protocol/file/FileURLConnectionTest.java @@ -14,87 +14,87 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.harmony.luni.tests.internal.net.www.protocol.file; +// package org.apache.harmony.luni.tests.internal.net.www.protocol.file; -import java.io.IOException; -import java.net.URL; -import java.net.URLConnection; +// import java.io.IOException; +// import java.net.URL; +// import java.net.URLConnection; -import junit.framework.TestCase; +// import junit.framework.TestCase; -import libcore.net.url.FileURLConnection; +// import libcore.net.url.FileURLConnection; -/** - * Tests for <code>FileURLConnection</code> class constructors and methods. - */ -public class FileURLConnectionTest extends TestCase { +// /** +// * Tests for <code>FileURLConnection</code> class constructors and methods. +// */ +// public class FileURLConnectionTest extends TestCase { - static String getContentType(String fileName) throws IOException { - String resourceName = "org/apache/harmony/luni/tests/" + fileName; - URL url = ClassLoader.getSystemClassLoader().getResource(resourceName); - assertNotNull("Cannot find test resource " + resourceName, url); - return new FileURLConnection(url).getContentType(); - } +// static String getContentType(String fileName) throws IOException { +// String resourceName = "org/apache/harmony/luni/tests/" + fileName; +// URL url = ClassLoader.getSystemClassLoader().getResource(resourceName); +// assertNotNull("Cannot find test resource " + resourceName, url); +// return new FileURLConnection(url).getContentType(); +// } - public void testGetContentType() throws IOException { - // Regression for HARMONY-4699 - assertEquals("application/rtf", getContentType("test.rtf")); - assertEquals("text/plain", getContentType("test.java")); - // RI would return "content/unknown" - assertEquals("application/msword", getContentType("test.doc")); - assertEquals("text/html", getContentType("test.htx")); - assertEquals("application/xml", getContentType("test.xml")); - assertEquals("text/plain", getContentType(".")); - } +// public void testGetContentType() throws IOException { +// // Regression for HARMONY-4699 +// assertEquals("application/rtf", getContentType("test.rtf")); +// assertEquals("text/plain", getContentType("test.java")); +// // RI would return "content/unknown" +// assertEquals("application/msword", getContentType("test.doc")); +// assertEquals("text/html", getContentType("test.htx")); +// assertEquals("application/xml", getContentType("test.xml")); +// assertEquals("text/plain", getContentType(".")); +// } - public void testGetInputStream() throws IOException { - // Regression for Harmony-5737 - String resourceName = "org/apache/harmony/luni/tests/" + "test.rtf"; - URL url = ClassLoader.getSystemClassLoader().getResource(resourceName); - URL anchorUrl = new URL(url, "#anchor"); - assertNotNull("Cannot find test resource " + resourceName, anchorUrl); +// public void testGetInputStream() throws IOException { +// // Regression for Harmony-5737 +// String resourceName = "org/apache/harmony/luni/tests/" + "test.rtf"; +// URL url = ClassLoader.getSystemClassLoader().getResource(resourceName); +// URL anchorUrl = new URL(url, "#anchor"); +// assertNotNull("Cannot find test resource " + resourceName, anchorUrl); - FileURLConnection conn = new FileURLConnection(anchorUrl); - assertNotNull(conn.getInputStream()); +// FileURLConnection conn = new FileURLConnection(anchorUrl); +// assertNotNull(conn.getInputStream()); - // Regression for Harmony-5779 - String localURLString = "file://localhost/" + url.getFile(); - URL localURL = new URL(localURLString); - conn = new FileURLConnection(localURL); - assertNotNull(conn.getInputStream()); - assertEquals("file", conn.getURL().getProtocol()); - } +// // Regression for Harmony-5779 +// String localURLString = "file://localhost/" + url.getFile(); +// URL localURL = new URL(localURLString); +// conn = new FileURLConnection(localURL); +// assertNotNull(conn.getInputStream()); +// assertEquals("file", conn.getURL().getProtocol()); +// } - public void testHeaderFunctions() throws IOException { - String resourceName = "org/apache/harmony/luni/tests/"; //folder name - URL url = ClassLoader.getSystemClassLoader().getResource(resourceName); - FileURLConnection conn = new FileURLConnection(url); - assertNotNull(conn.getInputStream()); - assertEquals(conn.getContentType(), conn.getHeaderField("content-type")); +// public void testHeaderFunctions() throws IOException { +// String resourceName = "org/apache/harmony/luni/tests/"; //folder name +// URL url = ClassLoader.getSystemClassLoader().getResource(resourceName); +// FileURLConnection conn = new FileURLConnection(url); +// assertNotNull(conn.getInputStream()); +// assertEquals(conn.getContentType(), conn.getHeaderField("content-type")); - resourceName = "org/apache/harmony/luni/tests/" + "test.rtf"; - ; //folder name - url = ClassLoader.getSystemClassLoader().getResource(resourceName); - conn = new FileURLConnection(url); - assertNotNull(conn.getInputStream()); - assertEquals(conn.getContentType(), conn.getHeaderField("content-type")); - assertEquals(Integer.toString(conn.getContentLength()), conn.getHeaderField("content-length")); - assertEquals(conn.getHeaderField(0), conn.getHeaderField("content-type")); - assertEquals(conn.getHeaderField(1), conn.getHeaderField("content-length")); - assertEquals(conn.getHeaderField(2), conn.getHeaderField("last-modified")); - assertEquals("last-modified", conn.getHeaderFieldKey(2)); - assertEquals("content-length", conn.getHeaderFieldKey(1)); - assertEquals("content-type", conn.getHeaderFieldKey(0)); - } +// resourceName = "org/apache/harmony/luni/tests/" + "test.rtf"; +// ; //folder name +// url = ClassLoader.getSystemClassLoader().getResource(resourceName); +// conn = new FileURLConnection(url); +// assertNotNull(conn.getInputStream()); +// assertEquals(conn.getContentType(), conn.getHeaderField("content-type")); +// assertEquals(Integer.toString(conn.getContentLength()), conn.getHeaderField("content-length")); +// assertEquals(conn.getHeaderField(0), conn.getHeaderField("content-type")); +// assertEquals(conn.getHeaderField(1), conn.getHeaderField("content-length")); +// assertEquals(conn.getHeaderField(2), conn.getHeaderField("last-modified")); +// assertEquals("last-modified", conn.getHeaderFieldKey(2)); +// assertEquals("content-length", conn.getHeaderFieldKey(1)); +// assertEquals("content-type", conn.getHeaderFieldKey(0)); +// } - public void testHeader_BoundaryCheck() throws IOException { - String resourceName = "org/apache/harmony/luni/tests/"; - URL url = ClassLoader.getSystemClassLoader().getResource(resourceName); - URLConnection urlConnection = url.openConnection(); - assertNull(urlConnection.getHeaderField(Integer.MIN_VALUE)); - assertNull(urlConnection.getHeaderField(Integer.MAX_VALUE)); - assertNull(urlConnection.getHeaderFieldKey(Integer.MIN_VALUE)); - assertNull(urlConnection.getHeaderFieldKey(Integer.MAX_VALUE)); - assertNull(urlConnection.getHeaderField(null)); - } -} +// public void testHeader_BoundaryCheck() throws IOException { +// String resourceName = "org/apache/harmony/luni/tests/"; +// URL url = ClassLoader.getSystemClassLoader().getResource(resourceName); +// URLConnection urlConnection = url.openConnection(); +// assertNull(urlConnection.getHeaderField(Integer.MIN_VALUE)); +// assertNull(urlConnection.getHeaderField(Integer.MAX_VALUE)); +// assertNull(urlConnection.getHeaderFieldKey(Integer.MIN_VALUE)); +// assertNull(urlConnection.getHeaderFieldKey(Integer.MAX_VALUE)); +// assertNull(urlConnection.getHeaderField(null)); +// } +// } diff --git a/luni/src/test/impl/common/org/apache/harmony/luni/tests/java/net/URLClassLoaderImplTest.java b/luni/src/test/impl/common/org/apache/harmony/luni/tests/java/net/URLClassLoaderImplTest.java index d239c1c..ab0bfc1 100644 --- a/luni/src/test/impl/common/org/apache/harmony/luni/tests/java/net/URLClassLoaderImplTest.java +++ b/luni/src/test/impl/common/org/apache/harmony/luni/tests/java/net/URLClassLoaderImplTest.java @@ -25,7 +25,7 @@ import java.net.URLStreamHandlerFactory; import junit.framework.TestCase; -import libcore.net.url.JarHandler; +import sun.net.www.protocol.jar.Handler; /** * Depends on: file://<basedir>/src/test/resources/org/apache/harmony/luni/tests/java/net/lf.jar @@ -41,7 +41,7 @@ public class URLClassLoaderImplTest extends TestCase { class TestFactory implements URLStreamHandlerFactory { public URLStreamHandler createURLStreamHandler(String protocol) { if ("jar".equals(protocol)) { - return new JarHandler(); + return new Handler(); } fail("Should be JarHandler. But " + protocol); |