mirror of
https://github.com/openjdk/jdk.git
synced 2026-04-08 05:58:38 +00:00
Remove the need for multiple test files
This commit is contained in:
parent
a33278efdc
commit
b49afc91c1
@ -1,47 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2018, Oracle and/or its affiliates. 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.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import java.net.http.HttpClient.Version;
|
||||
import java.time.Duration;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @summary Tests for connection related timeouts
|
||||
* @bug 8208391
|
||||
* @run testng/othervm ConnectTimeoutNoProxyAsync
|
||||
*/
|
||||
|
||||
public class ConnectTimeoutNoProxyAsync extends AbstractConnectTimeout {
|
||||
|
||||
@Test(dataProvider = "variants")
|
||||
@Override
|
||||
public void timeoutNoProxyAsync(Version requestVersion,
|
||||
String scheme,
|
||||
String method,
|
||||
Duration connectTimeout,
|
||||
Duration requestduration)
|
||||
{
|
||||
super.timeoutNoProxyAsync(requestVersion, scheme, method, connectTimeout, requestduration);
|
||||
}
|
||||
}
|
||||
@ -1,48 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2018, Oracle and/or its affiliates. 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.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import java.net.http.HttpClient.Version;
|
||||
import java.time.Duration;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @summary Tests for connection related timeouts
|
||||
* @bug 8208391
|
||||
* @run testng/othervm ConnectTimeoutNoProxySync
|
||||
*/
|
||||
|
||||
public class ConnectTimeoutNoProxySync extends AbstractConnectTimeout {
|
||||
|
||||
@Test(dataProvider = "variants")
|
||||
@Override
|
||||
public void timeoutNoProxySync(Version requestVersion,
|
||||
String scheme,
|
||||
String method,
|
||||
Duration connectTimeout,
|
||||
Duration requestTimeout)
|
||||
throws Exception
|
||||
{
|
||||
super.timeoutNoProxySync(requestVersion, scheme, method, connectTimeout, requestTimeout);
|
||||
}
|
||||
}
|
||||
@ -48,6 +48,8 @@ import java.util.stream.IntStream;
|
||||
|
||||
import org.testng.annotations.AfterClass;
|
||||
import org.testng.annotations.DataProvider;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import static java.lang.System.out;
|
||||
import static java.net.http.HttpClient.Builder.NO_PROXY;
|
||||
import static java.net.http.HttpClient.Version.HTTP_1_1;
|
||||
@ -56,7 +58,17 @@ import static java.time.Duration.*;
|
||||
import static java.util.concurrent.TimeUnit.NANOSECONDS;
|
||||
import static org.testng.Assert.fail;
|
||||
|
||||
public abstract class AbstractConnectTimeout {
|
||||
/*
|
||||
* @test
|
||||
* @bug 8208391 8375352
|
||||
* @summary Verifies behavior on `connect()` timeouts
|
||||
* @run testng/othervm ${test.main.class}
|
||||
* @run testng/othervm -Dtest.proxy ${test.main.class}
|
||||
* @run testng/othervm -Dtest.async ${test.main.class}
|
||||
* @run testng/othervm -Dtest.async -Dtest.proxy ${test.main.class}
|
||||
*/
|
||||
|
||||
public final class ConnectTimeoutTest {
|
||||
|
||||
private static final int BACKLOG = 1;
|
||||
|
||||
@ -159,26 +171,21 @@ public abstract class AbstractConnectTimeout {
|
||||
return l.stream().toArray(Object[][]::new);
|
||||
}
|
||||
|
||||
//@Test(dataProvider = "variants")
|
||||
protected void timeoutNoProxySync(Version requestVersion,
|
||||
String scheme,
|
||||
String method,
|
||||
Duration connectTimeout,
|
||||
Duration requestTimeout)
|
||||
throws Exception
|
||||
{
|
||||
timeoutSync(requestVersion, scheme, method, connectTimeout, requestTimeout, NO_PROXY);
|
||||
}
|
||||
|
||||
//@Test(dataProvider = "variants")
|
||||
protected void timeoutWithProxySync(Version requestVersion,
|
||||
String scheme,
|
||||
String method,
|
||||
Duration connectTimeout,
|
||||
Duration requestTimeout)
|
||||
throws Exception
|
||||
{
|
||||
timeoutSync(requestVersion, scheme, method, connectTimeout, requestTimeout, PROXY_SELECTOR);
|
||||
@Test(dataProvider = "variants")
|
||||
public void test(
|
||||
Version requestVersion,
|
||||
String scheme,
|
||||
String method,
|
||||
Duration connectTimeout,
|
||||
Duration requestTimeout)
|
||||
throws Exception {
|
||||
ProxySelector proxySelector = System.getProperty("test.proxy") != null ? PROXY_SELECTOR : NO_PROXY;
|
||||
boolean async = System.getProperty("test.async") != null;
|
||||
if (async) {
|
||||
timeoutAsync(requestVersion, scheme, method, connectTimeout, requestTimeout, proxySelector);
|
||||
} else {
|
||||
timeoutSync(requestVersion, scheme, method, connectTimeout, requestTimeout, proxySelector);
|
||||
}
|
||||
}
|
||||
|
||||
private void timeoutSync(Version requestVersion,
|
||||
@ -222,24 +229,6 @@ public abstract class AbstractConnectTimeout {
|
||||
}
|
||||
}
|
||||
|
||||
//@Test(dataProvider = "variants")
|
||||
protected void timeoutNoProxyAsync(Version requestVersion,
|
||||
String scheme,
|
||||
String method,
|
||||
Duration connectTimeout,
|
||||
Duration requestTimeout) {
|
||||
timeoutAsync(requestVersion, scheme, method, connectTimeout, requestTimeout, NO_PROXY);
|
||||
}
|
||||
|
||||
//@Test(dataProvider = "variants")
|
||||
protected void timeoutWithProxyAsync(Version requestVersion,
|
||||
String scheme,
|
||||
String method,
|
||||
Duration connectTimeout,
|
||||
Duration requestTimeout) {
|
||||
timeoutAsync(requestVersion, scheme, method, connectTimeout, requestTimeout, PROXY_SELECTOR);
|
||||
}
|
||||
|
||||
private void timeoutAsync(Version requestVersion,
|
||||
String scheme,
|
||||
String method,
|
||||
@ -1,47 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2018, Oracle and/or its affiliates. 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.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import java.net.http.HttpClient.Version;
|
||||
import java.time.Duration;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @summary Tests for connection related timeouts
|
||||
* @bug 8208391
|
||||
* @run testng/othervm ConnectTimeoutWithProxyAsync
|
||||
*/
|
||||
|
||||
public class ConnectTimeoutWithProxyAsync extends AbstractConnectTimeout {
|
||||
|
||||
@Test(dataProvider = "variants")
|
||||
@Override
|
||||
public void timeoutWithProxyAsync(Version requestVersion,
|
||||
String scheme,
|
||||
String method,
|
||||
Duration connectTimeout,
|
||||
Duration requestTimeout)
|
||||
{
|
||||
super.timeoutWithProxyAsync(requestVersion, scheme, method, connectTimeout, requestTimeout);
|
||||
}
|
||||
}
|
||||
@ -1,48 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2018, Oracle and/or its affiliates. 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.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import java.net.http.HttpClient.Version;
|
||||
import java.time.Duration;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @summary Tests for connection related timeouts
|
||||
* @bug 8208391
|
||||
* @run testng/othervm ConnectTimeoutWithProxySync
|
||||
*/
|
||||
|
||||
public class ConnectTimeoutWithProxySync extends AbstractConnectTimeout {
|
||||
|
||||
@Test(dataProvider = "variants")
|
||||
@Override
|
||||
public void timeoutWithProxySync(Version requestVersion,
|
||||
String scheme,
|
||||
String method,
|
||||
Duration connectTimeout,
|
||||
Duration requestTimeout)
|
||||
throws Exception
|
||||
{
|
||||
super.timeoutWithProxySync(requestVersion, scheme, method, connectTimeout, requestTimeout);
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user