提交 2677d57f 编写于 作者: C chegar

6937703: java/net regression test issues with samevm

Reviewed-by: alanb
上级 0bde254d
......@@ -684,8 +684,6 @@ java/net/SocketInputStream/SocketClosedException.java generic-all
java/net/SocketInputStream/SocketTimeout.java generic-all
# Linux i586, address already in use or timeout, samevm issues
java/net/URLConnection/B5052093.java generic-all
java/net/URLConnection/contentHandler/UserContentHandler.java generic-all
java/net/URLConnection/DisconnectAfterEOF.java generic-all
java/net/URLConnection/HandleContentTypeWithAttrs.java generic-all
java/net/URLConnection/Responses.java generic-all
......@@ -696,8 +694,6 @@ java/net/URLConnection/ZeroContentLength.java generic-all
java/net/ResponseCache/B6181108.java generic-all
java/net/ResponseCache/ResponseCacheTest.java generic-all
java/net/URL/GetContent.java generic-all
java/net/URL/TestIPv6Addresses.java generic-all
java/net/URLClassLoader/HttpTest.java generic-all
java/net/URLConnection/HttpContinueStackOverflow.java generic-all
java/net/URLConnection/Redirect307Test.java generic-all
java/net/URLConnection/RedirectLimit.java generic-all
......@@ -726,9 +722,6 @@ sun/net/www/http/KeepAliveCache/KeepAliveTimerThread.java generic-all
# Connection refused, windows samevm
sun/net/www/protocol/http/DigestTest.java generic-all
# Fails on Fedora 9 32bit & 64bit & Solaris 10, wrong proxy for http://localhost/index.html
java/net/ProxySelector/B6737819.java generic-all
############################################################################
# jdk_nio
......
......@@ -23,9 +23,15 @@
/*
* @test
* @bug 6737819
* @run main/othervm B6737819
* @summary sun.misc.net.DefaultProxySelector doesn't use proxy setting to localhost
*/
/* Run in othervm mode since the test sets HTTP proxy system properties that
* are read once and cached by the protocol handler. A previous test using the
* HTTP handler may run and these system properties may be ignored for this test.
*/
import java.net.ProxySelector;
import java.net.Proxy;
import java.net.URI;
......
......@@ -150,10 +150,14 @@ static class NameVerifier implements HostnameVerifier {
}
}
public static void main(String args[]) throws Exception {
try {
ResponseCache.setDefault(new MyResponseCache());
FNPrefix = System.getProperty("test.src", ".")+"/";
OutFNPrefix = System.getProperty("test.scratch", ".")+"/";
new ResponseCacheTest();
} finally{
ResponseCache.setDefault(null);
}
}
static class MyResponseCache extends ResponseCache {
......
......@@ -30,8 +30,7 @@
import java.net.*;
import java.util.*;
import java.io.*;
import java.nio.*;
import sun.net.www.ParseUtil;
/**
* Request should get serviced by the cache handler. Response get
......@@ -52,9 +51,13 @@ public class getResponseCode {
}
}
public static void main(String args[]) throws Exception {
try {
ResponseCache.setDefault(new MyResponseCache());
FNPrefix = System.getProperty("test.src", ".")+"/";
new getResponseCode();
} finally{
ResponseCache.setDefault(null);
}
}
static class MyResponseCache extends ResponseCache {
......
......@@ -23,8 +23,12 @@
/* @test
* @bug 4451522 4460484
* @run main/othervm TestIPv6Addresses
* @summary URI and URL getHost() methods don't comform to RFC 2732
*/
// Run in othervm because the tests sets a SecurityManager
import java.net.*;
public class TestIPv6Addresses {
......
......@@ -56,9 +56,9 @@ public class HttpTest {
}
public void run() {
InputStream in = null;
try {
InputStream in = s.getInputStream();
in = s.getInputStream();
for (;;) {
// read entire request from client
......@@ -111,6 +111,9 @@ public class HttpTest {
} // for
} catch (Exception e) {
unexpected(e);
} finally {
if (in != null) { try {in.close(); } catch(IOException e) {unexpected(e);} }
}
}
}
......@@ -131,6 +134,11 @@ public class HttpTest {
}
}
void unexpected(Exception e) {
System.out.println(e);
e.printStackTrace();
}
public static HttpServer create() throws Exception {
if (svr != null)
return svr;
......@@ -211,6 +219,7 @@ public class HttpTest {
// one GET request
svr.counters().reset();
InputStream in = cl.getResourceAsStream("foo2.gif");
in.close();
System.out.println(svr.counters());
if (svr.counters().getCount() > 1) {
failed = true;
......
/*
* Copyright (c) 2007 Sun Microsystems, Inc. All Rights Reserved.
* Copyright 2007 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun in the LICENSE file that accompanied this code.
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
......@@ -66,17 +64,29 @@ public class B5052093 implements HttpCallback {
public static void main(String[] args) throws Exception {
server = new HttpServer(new B5052093(), 1, 10, 0);
try {
URL url = new URL("http://localhost:"+server.getLocalPort()+"/foo");
URLConnection conn = url.openConnection();
int i = conn.getContentLength();
long l = conn.getContentLengthLong();
if (i != -1 || l != testSize)
if (i != -1 || l != testSize) {
System.out.println("conn.getContentLength = " + i);
System.out.println("conn.getContentLengthLong = " + l);
System.out.println("testSize = " + testSize);
throw new RuntimeException("Wrong content-length from http");
}
URLConnection fu = new LargeFileURLConnection(new LargeFile());
i = fu.getContentLength();
l = fu.getContentLengthLong();
if (i != -1 || l != testSize)
if (i != -1 || l != testSize) {
System.out.println("fu.getContentLength = " + i);
System.out.println("fu.getContentLengthLong = " + l);
System.out.println("testSize = " + testSize);
throw new RuntimeException("Wrong content-length from file");
}
} finally {
server.terminate();
}
}
}
......@@ -25,8 +25,16 @@
* @bug 4191147
* @summary 1.2beta4 does not load user defined content handlers
* @build UserContentHandler
* @run main UserContentHandler
* @run main/othervm UserContentHandler
*/
/* Run in othervm mode since the test sets a system property, java.content.handler.pkgs,
* that prepends a specific package prefix defining a text/plain content
* handler. If other URLConnection tests run before this one they might trigger
* the Sun implementation text/plain content handler in sun.net.www.content
* to be loaded and cached, this will break this test.
*/
import java.net.*;
import java.io.*;
import java.util.*;
......@@ -55,7 +63,7 @@ public class UserContentHandler implements Runnable {
// don't close the connection immediately as otherwise
// the http headers may not have been received and the
// http client will re-connect.
Thread.currentThread().sleep(2000);
Thread.sleep(2000);
s.close();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册