mirror of
https://github.com/openjdk/jdk.git
synced 2026-01-28 03:58:21 +00:00
8373796: Refactor java/net/httpclient/ThrowingPublishers*.java tests to use JUnit5
Reviewed-by: jpai
This commit is contained in:
parent
e5ca77838b
commit
c6da35d7c7
@ -23,14 +23,6 @@
|
||||
|
||||
import jdk.httpclient.test.lib.http3.Http3TestServer;
|
||||
import jdk.test.lib.net.SimpleSSLContext;
|
||||
import org.testng.ITestContext;
|
||||
import org.testng.ITestResult;
|
||||
import org.testng.SkipException;
|
||||
import org.testng.annotations.AfterClass;
|
||||
import org.testng.annotations.AfterTest;
|
||||
import org.testng.annotations.BeforeMethod;
|
||||
import org.testng.annotations.BeforeTest;
|
||||
import org.testng.annotations.DataProvider;
|
||||
|
||||
import javax.net.ssl.SSLContext;
|
||||
import java.io.IOException;
|
||||
@ -48,7 +40,6 @@ import java.net.http.HttpResponse.BodyHandler;
|
||||
import java.net.http.HttpResponse.BodyHandlers;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Arrays;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
@ -61,6 +52,7 @@ import java.util.concurrent.Executor;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.Flow;
|
||||
import java.util.concurrent.SubmissionPublisher;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
import java.util.function.BiPredicate;
|
||||
@ -78,28 +70,35 @@ import static java.net.http.HttpClient.Version.HTTP_2;
|
||||
import static java.net.http.HttpClient.Version.HTTP_3;
|
||||
import static java.net.http.HttpOption.H3_DISCOVERY;
|
||||
import static java.nio.charset.StandardCharsets.UTF_8;
|
||||
import static org.testng.Assert.assertEquals;
|
||||
import static org.testng.Assert.assertTrue;
|
||||
import org.junit.jupiter.api.AfterAll;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
import org.junit.jupiter.api.Assumptions;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.extension.BeforeEachCallback;
|
||||
import org.junit.jupiter.api.extension.ExtensionContext;
|
||||
import org.junit.jupiter.api.extension.RegisterExtension;
|
||||
import org.junit.jupiter.api.extension.TestWatcher;
|
||||
|
||||
public abstract class AbstractThrowingPublishers implements HttpServerAdapters {
|
||||
|
||||
SSLContext sslContext;
|
||||
HttpTestServer httpTestServer; // HTTP/1.1 [ 4 servers ]
|
||||
HttpTestServer httpsTestServer; // HTTPS/1.1
|
||||
HttpTestServer http2TestServer; // HTTP/2 ( h2c )
|
||||
HttpTestServer https2TestServer; // HTTP/2 ( h2 )
|
||||
HttpTestServer http3TestServer; // HTTP/3 ( h3 )
|
||||
String httpURI_fixed;
|
||||
String httpURI_chunk;
|
||||
String httpsURI_fixed;
|
||||
String httpsURI_chunk;
|
||||
String http2URI_fixed;
|
||||
String http2URI_chunk;
|
||||
String https2URI_fixed;
|
||||
String https2URI_chunk;
|
||||
String http3URI_fixed;
|
||||
String http3URI_chunk;
|
||||
String http3URI_head;
|
||||
static SSLContext sslContext;
|
||||
static HttpTestServer httpTestServer; // HTTP/1.1 [ 4 servers ]
|
||||
static HttpTestServer httpsTestServer; // HTTPS/1.1
|
||||
static HttpTestServer http2TestServer; // HTTP/2 ( h2c )
|
||||
static HttpTestServer https2TestServer; // HTTP/2 ( h2 )
|
||||
static HttpTestServer http3TestServer; // HTTP/3 ( h3 )
|
||||
static String httpURI_fixed;
|
||||
static String httpURI_chunk;
|
||||
static String httpsURI_fixed;
|
||||
static String httpsURI_chunk;
|
||||
static String http2URI_fixed;
|
||||
static String http2URI_chunk;
|
||||
static String https2URI_fixed;
|
||||
static String https2URI_chunk;
|
||||
static String http3URI_fixed;
|
||||
static String http3URI_chunk;
|
||||
static String http3URI_head;
|
||||
|
||||
static final int ITERATION_COUNT = 1;
|
||||
// a shared executor helps reduce the amount of threads created by the test
|
||||
@ -117,8 +116,34 @@ public abstract class AbstractThrowingPublishers implements HttpServerAdapters {
|
||||
return String.format("[%d s, %d ms, %d ns] ", secs, mill, nan);
|
||||
}
|
||||
|
||||
final ReferenceTracker TRACKER = ReferenceTracker.INSTANCE;
|
||||
private volatile HttpClient sharedClient;
|
||||
final static class TestStopper implements TestWatcher, BeforeEachCallback {
|
||||
final AtomicReference<String> failed = new AtomicReference<>();
|
||||
TestStopper() { }
|
||||
@Override
|
||||
public void testFailed(ExtensionContext context, Throwable cause) {
|
||||
if (stopAfterFirstFailure()) {
|
||||
String msg = "Aborting due to: " + cause;
|
||||
failed.compareAndSet(null, msg);
|
||||
FAILURES.putIfAbsent(context.getDisplayName(), cause);
|
||||
System.out.printf("%nTEST FAILED: %s%s%n\tAborting due to %s%n%n",
|
||||
now(), context.getDisplayName(), cause);
|
||||
System.err.printf("%nTEST FAILED: %s%s%n\tAborting due to %s%n%n",
|
||||
now(), context.getDisplayName(), cause);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beforeEach(ExtensionContext context) {
|
||||
String msg = failed.get();
|
||||
Assumptions.assumeTrue(msg == null, msg);
|
||||
}
|
||||
}
|
||||
|
||||
@RegisterExtension
|
||||
static final TestStopper stopper = new TestStopper();
|
||||
|
||||
static final ReferenceTracker TRACKER = ReferenceTracker.INSTANCE;
|
||||
private static volatile HttpClient sharedClient;
|
||||
|
||||
static class TestExecutor implements Executor {
|
||||
final AtomicLong tasks = new AtomicLong();
|
||||
@ -144,21 +169,10 @@ public abstract class AbstractThrowingPublishers implements HttpServerAdapters {
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean stopAfterFirstFailure() {
|
||||
protected static boolean stopAfterFirstFailure() {
|
||||
return Boolean.getBoolean("jdk.internal.httpclient.debug");
|
||||
}
|
||||
|
||||
final AtomicReference<SkipException> skiptests = new AtomicReference<>();
|
||||
void checkSkip() {
|
||||
var skip = skiptests.get();
|
||||
if (skip != null) throw skip;
|
||||
}
|
||||
static String name(ITestResult result) {
|
||||
var params = result.getParameters();
|
||||
return result.getName()
|
||||
+ (params == null ? "()" : Arrays.toString(result.getParameters()));
|
||||
}
|
||||
|
||||
static Version version(String uri) {
|
||||
if (uri.contains("/http1/") || uri.contains("/https1/"))
|
||||
return HTTP_1_1;
|
||||
@ -169,7 +183,7 @@ public abstract class AbstractThrowingPublishers implements HttpServerAdapters {
|
||||
return null;
|
||||
}
|
||||
|
||||
HttpRequest.Builder newRequestBuilder(String uri) {
|
||||
static HttpRequest.Builder newRequestBuilder(String uri) {
|
||||
var builder = HttpRequest.newBuilder(URI.create(uri));
|
||||
if (version(uri) == HTTP_3) {
|
||||
builder.version(HTTP_3);
|
||||
@ -178,7 +192,7 @@ public abstract class AbstractThrowingPublishers implements HttpServerAdapters {
|
||||
return builder;
|
||||
}
|
||||
|
||||
HttpResponse<String> headRequest(HttpClient client)
|
||||
static HttpResponse<String> headRequest(HttpClient client)
|
||||
throws IOException, InterruptedException
|
||||
{
|
||||
System.out.println("\n" + now() + "--- Sending HEAD request ----\n");
|
||||
@ -187,26 +201,16 @@ public abstract class AbstractThrowingPublishers implements HttpServerAdapters {
|
||||
var request = newRequestBuilder(http3URI_head)
|
||||
.HEAD().version(HTTP_2).build();
|
||||
var response = client.send(request, BodyHandlers.ofString());
|
||||
assertEquals(response.statusCode(), 200);
|
||||
assertEquals(response.version(), HTTP_2);
|
||||
assertEquals(200, response.statusCode());
|
||||
assertEquals(HTTP_2, response.version());
|
||||
System.out.println("\n" + now() + "--- HEAD request succeeded ----\n");
|
||||
System.err.println("\n" + now() + "--- HEAD request succeeded ----\n");
|
||||
return response;
|
||||
}
|
||||
|
||||
@BeforeMethod
|
||||
void beforeMethod(ITestContext context) {
|
||||
if (stopAfterFirstFailure() && context.getFailedTests().size() > 0) {
|
||||
if (skiptests.get() == null) {
|
||||
SkipException skip = new SkipException("some tests failed");
|
||||
skip.setStackTrace(new StackTraceElement[0]);
|
||||
skiptests.compareAndSet(null, skip);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
static final void printFailedTests(ITestContext context) {
|
||||
@AfterAll
|
||||
static final void printFailedTests() {
|
||||
out.println("\n=========================");
|
||||
try {
|
||||
// Exceptions should already have been added to FAILURES
|
||||
@ -230,7 +234,7 @@ public abstract class AbstractThrowingPublishers implements HttpServerAdapters {
|
||||
}
|
||||
}
|
||||
|
||||
private String[] uris() {
|
||||
private static String[] uris() {
|
||||
return new String[] {
|
||||
http3URI_fixed,
|
||||
http3URI_chunk,
|
||||
@ -245,8 +249,7 @@ public abstract class AbstractThrowingPublishers implements HttpServerAdapters {
|
||||
};
|
||||
}
|
||||
|
||||
@DataProvider(name = "sanity")
|
||||
public Object[][] sanity() {
|
||||
public static Object[][] sanity() {
|
||||
String[] uris = uris();
|
||||
Object[][] result = new Object[uris.length * 2][];
|
||||
//Object[][] result = new Object[uris.length][];
|
||||
@ -277,7 +280,7 @@ public abstract class AbstractThrowingPublishers implements HttpServerAdapters {
|
||||
}
|
||||
}
|
||||
|
||||
private Object[][] variants(List<Thrower> throwers, Set<Where> whereValues) {
|
||||
private static Object[][] variants(List<Thrower> throwers, Set<Where> whereValues) {
|
||||
String[] uris = uris();
|
||||
Object[][] result = new Object[uris.length * 2 * throwers.size()][];
|
||||
//Object[][] result = new Object[(uris.length/2) * 2 * 2][];
|
||||
@ -296,93 +299,65 @@ public abstract class AbstractThrowingPublishers implements HttpServerAdapters {
|
||||
return result;
|
||||
}
|
||||
|
||||
@DataProvider(name = "subscribeProvider")
|
||||
public Object[][] subscribeProvider(ITestContext context) {
|
||||
if (stopAfterFirstFailure() && context.getFailedTests().size() > 0) {
|
||||
return new Object[0][];
|
||||
}
|
||||
public static Object[][] subscribeProvider() {
|
||||
return variants(List.of(
|
||||
new UncheckedCustomExceptionThrower(),
|
||||
new UncheckedIOExceptionThrower()),
|
||||
EnumSet.of(Where.BEFORE_SUBSCRIBE, Where.AFTER_SUBSCRIBE));
|
||||
}
|
||||
|
||||
@DataProvider(name = "requestProvider")
|
||||
public Object[][] requestProvider(ITestContext context) {
|
||||
if (stopAfterFirstFailure() && context.getFailedTests().size() > 0) {
|
||||
return new Object[0][];
|
||||
}
|
||||
public static Object[][] requestProvider() {
|
||||
return variants(List.of(
|
||||
new UncheckedCustomExceptionThrower(),
|
||||
new UncheckedIOExceptionThrower()),
|
||||
EnumSet.of(Where.BEFORE_REQUEST, Where.AFTER_REQUEST));
|
||||
}
|
||||
|
||||
@DataProvider(name = "nextRequestProvider")
|
||||
public Object[][] nextRequestProvider(ITestContext context) {
|
||||
if (stopAfterFirstFailure() && context.getFailedTests().size() > 0) {
|
||||
return new Object[0][];
|
||||
}
|
||||
public static Object[][] nextRequestProvider() {
|
||||
return variants(List.of(
|
||||
new UncheckedCustomExceptionThrower(),
|
||||
new UncheckedIOExceptionThrower()),
|
||||
EnumSet.of(Where.BEFORE_NEXT_REQUEST, Where.AFTER_NEXT_REQUEST));
|
||||
}
|
||||
|
||||
@DataProvider(name = "beforeCancelProviderIO")
|
||||
public Object[][] beforeCancelProviderIO(ITestContext context) {
|
||||
if (stopAfterFirstFailure() && context.getFailedTests().size() > 0) {
|
||||
return new Object[0][];
|
||||
}
|
||||
public static Object[][] beforeCancelProviderIO() {
|
||||
return variants(List.of(
|
||||
new UncheckedIOExceptionThrower()),
|
||||
EnumSet.of(Where.BEFORE_CANCEL));
|
||||
}
|
||||
|
||||
@DataProvider(name = "afterCancelProviderIO")
|
||||
public Object[][] afterCancelProviderIO(ITestContext context) {
|
||||
if (stopAfterFirstFailure() && context.getFailedTests().size() > 0) {
|
||||
return new Object[0][];
|
||||
}
|
||||
public static Object[][] afterCancelProviderIO() {
|
||||
return variants(List.of(
|
||||
new UncheckedIOExceptionThrower()),
|
||||
EnumSet.of(Where.AFTER_CANCEL));
|
||||
}
|
||||
|
||||
@DataProvider(name = "beforeCancelProviderCustom")
|
||||
public Object[][] beforeCancelProviderCustom(ITestContext context) {
|
||||
if (stopAfterFirstFailure() && context.getFailedTests().size() > 0) {
|
||||
return new Object[0][];
|
||||
}
|
||||
public static Object[][] beforeCancelProviderCustom() {
|
||||
return variants(List.of(
|
||||
new UncheckedCustomExceptionThrower()),
|
||||
EnumSet.of(Where.BEFORE_CANCEL));
|
||||
}
|
||||
|
||||
@DataProvider(name = "afterCancelProviderCustom")
|
||||
public Object[][] afterCancelProvider(ITestContext context) {
|
||||
if (stopAfterFirstFailure() && context.getFailedTests().size() > 0) {
|
||||
return new Object[0][];
|
||||
}
|
||||
public static Object[][] afterCancelProviderCustom() {
|
||||
return variants(List.of(
|
||||
new UncheckedCustomExceptionThrower()),
|
||||
EnumSet.of(Where.AFTER_CANCEL));
|
||||
}
|
||||
|
||||
private HttpClient makeNewClient() {
|
||||
private static HttpClient makeNewClient() {
|
||||
clientCount.incrementAndGet();
|
||||
return TRACKER.track(newClientBuilderForH3()
|
||||
return TRACKER.track(HttpServerAdapters.createClientBuilderForH3()
|
||||
.proxy(HttpClient.Builder.NO_PROXY)
|
||||
.executor(executor)
|
||||
.sslContext(sslContext)
|
||||
.build());
|
||||
}
|
||||
|
||||
HttpClient newHttpClient(boolean share) {
|
||||
static HttpClient newHttpClient(boolean share) {
|
||||
if (!share) return makeNewClient();
|
||||
HttpClient shared = sharedClient;
|
||||
if (shared != null) return shared;
|
||||
synchronized (this) {
|
||||
synchronized (AbstractThrowingPublishers.class) {
|
||||
shared = sharedClient;
|
||||
if (shared == null) {
|
||||
shared = sharedClient = makeNewClient();
|
||||
@ -430,7 +405,7 @@ public abstract class AbstractThrowingPublishers implements HttpServerAdapters {
|
||||
CompletableFuture<HttpResponse<String>> response = client.sendAsync(req, handler);
|
||||
|
||||
String body = response.join().body();
|
||||
assertEquals(body, Stream.of(BODY.split("\\|")).collect(Collectors.joining()));
|
||||
assertEquals(Stream.of(BODY.split("\\|")).collect(Collectors.joining()), body);
|
||||
if (!sameClient) {
|
||||
// Wait for the client to be garbage collected.
|
||||
// we use the ReferenceTracker API rather than HttpClient::close here,
|
||||
@ -474,7 +449,6 @@ public abstract class AbstractThrowingPublishers implements HttpServerAdapters {
|
||||
boolean async, Set<Where> whereValues)
|
||||
throws Exception
|
||||
{
|
||||
checkSkip();
|
||||
out.printf("%n%s%s%n", now(), name);
|
||||
try {
|
||||
testThrowing(uri, sameClient, publishers, finisher, thrower, async, whereValues);
|
||||
@ -778,8 +752,8 @@ public abstract class AbstractThrowingPublishers implements HttpServerAdapters {
|
||||
}
|
||||
|
||||
|
||||
@BeforeTest
|
||||
public void setup() throws Exception {
|
||||
@BeforeAll
|
||||
public static void setup() throws Exception {
|
||||
System.out.println(now() + "setup");
|
||||
System.err.println(now() + "setup");
|
||||
|
||||
@ -861,8 +835,8 @@ public abstract class AbstractThrowingPublishers implements HttpServerAdapters {
|
||||
System.err.println(now() + "setup done");
|
||||
}
|
||||
|
||||
@AfterTest
|
||||
public void teardown() throws Exception {
|
||||
@AfterAll
|
||||
public static void teardown() throws Exception {
|
||||
System.out.println(now() + "teardown");
|
||||
System.err.println(now() + "teardown");
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2018, 2025, 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
|
||||
@ -29,18 +29,20 @@
|
||||
* @build jdk.test.lib.net.SimpleSSLContext
|
||||
* ReferenceTracker AbstractThrowingPublishers ThrowingPublishersCustomAfterCancel
|
||||
* jdk.httpclient.test.lib.common.HttpServerAdapters
|
||||
* @run testng/othervm -Djdk.internal.httpclient.debug=true
|
||||
* @run junit/othervm -Djdk.internal.httpclient.debug=true
|
||||
* -Djdk.httpclient.enableAllMethodRetry=true
|
||||
* ThrowingPublishersCustomAfterCancel
|
||||
*/
|
||||
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import java.util.Set;
|
||||
import org.junit.jupiter.params.ParameterizedTest;
|
||||
import org.junit.jupiter.params.provider.MethodSource;
|
||||
|
||||
public class ThrowingPublishersCustomAfterCancel extends AbstractThrowingPublishers {
|
||||
|
||||
@Test(dataProvider = "afterCancelProviderCustom")
|
||||
@ParameterizedTest
|
||||
@MethodSource("afterCancelProviderCustom")
|
||||
public void testThrowingAsString(String uri, boolean sameClient,
|
||||
Thrower thrower, Set<Where> whereValues)
|
||||
throws Exception
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2018, 2025, 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
|
||||
@ -29,18 +29,20 @@
|
||||
* @build jdk.test.lib.net.SimpleSSLContext
|
||||
* ReferenceTracker AbstractThrowingPublishers ThrowingPublishersCustomBeforeCancel
|
||||
* jdk.httpclient.test.lib.common.HttpServerAdapters
|
||||
* @run testng/othervm -Djdk.internal.httpclient.debug=true
|
||||
* @run junit/othervm -Djdk.internal.httpclient.debug=true
|
||||
* -Djdk.httpclient.enableAllMethodRetry=true
|
||||
* ThrowingPublishersCustomBeforeCancel
|
||||
*/
|
||||
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import java.util.Set;
|
||||
import org.junit.jupiter.params.ParameterizedTest;
|
||||
import org.junit.jupiter.params.provider.MethodSource;
|
||||
|
||||
public class ThrowingPublishersCustomBeforeCancel extends AbstractThrowingPublishers {
|
||||
|
||||
@Test(dataProvider = "beforeCancelProviderCustom")
|
||||
@ParameterizedTest
|
||||
@MethodSource("beforeCancelProviderCustom")
|
||||
public void testThrowingAsString(String uri, boolean sameClient,
|
||||
Thrower thrower, Set<Where> whereValues)
|
||||
throws Exception
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2018, 2025, 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
|
||||
@ -29,18 +29,20 @@
|
||||
* @build jdk.test.lib.net.SimpleSSLContext
|
||||
* ReferenceTracker AbstractThrowingPublishers ThrowingPublishersIOAfterCancel
|
||||
* jdk.httpclient.test.lib.common.HttpServerAdapters
|
||||
* @run testng/othervm -Djdk.internal.httpclient.debug=true
|
||||
* @run junit/othervm -Djdk.internal.httpclient.debug=true
|
||||
* -Djdk.httpclient.enableAllMethodRetry=true
|
||||
* ThrowingPublishersIOAfterCancel
|
||||
*/
|
||||
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import java.util.Set;
|
||||
import org.junit.jupiter.params.ParameterizedTest;
|
||||
import org.junit.jupiter.params.provider.MethodSource;
|
||||
|
||||
public class ThrowingPublishersIOAfterCancel extends AbstractThrowingPublishers {
|
||||
|
||||
@Test(dataProvider = "afterCancelProviderIO")
|
||||
@ParameterizedTest
|
||||
@MethodSource("afterCancelProviderIO")
|
||||
public void testThrowingAsString(String uri, boolean sameClient,
|
||||
Thrower thrower, Set<Where> whereValues)
|
||||
throws Exception
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2018, 2025, 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
|
||||
@ -29,18 +29,20 @@
|
||||
* @build jdk.test.lib.net.SimpleSSLContext
|
||||
* ReferenceTracker AbstractThrowingPublishers ThrowingPublishersIOBeforeCancel
|
||||
* jdk.httpclient.test.lib.common.HttpServerAdapters
|
||||
* @run testng/othervm -Djdk.internal.httpclient.debug=true
|
||||
* @run junit/othervm -Djdk.internal.httpclient.debug=true
|
||||
* -Djdk.httpclient.enableAllMethodRetry=true
|
||||
* ThrowingPublishersIOBeforeCancel
|
||||
*/
|
||||
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import java.util.Set;
|
||||
import org.junit.jupiter.params.ParameterizedTest;
|
||||
import org.junit.jupiter.params.provider.MethodSource;
|
||||
|
||||
public class ThrowingPublishersIOBeforeCancel extends AbstractThrowingPublishers {
|
||||
|
||||
@Test(dataProvider = "beforeCancelProviderIO")
|
||||
@ParameterizedTest
|
||||
@MethodSource("beforeCancelProviderIO")
|
||||
public void testThrowingAsString(String uri, boolean sameClient,
|
||||
Thrower thrower, Set<Where> whereValues)
|
||||
throws Exception
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2018, 2025, 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
|
||||
@ -29,18 +29,20 @@
|
||||
* @build jdk.test.lib.net.SimpleSSLContext
|
||||
* ReferenceTracker AbstractThrowingPublishers ThrowingPublishersInNextRequest
|
||||
* jdk.httpclient.test.lib.common.HttpServerAdapters
|
||||
* @run testng/othervm -Djdk.internal.httpclient.debug=true
|
||||
* @run junit/othervm -Djdk.internal.httpclient.debug=true
|
||||
* -Djdk.httpclient.enableAllMethodRetry=true
|
||||
* ThrowingPublishersInNextRequest
|
||||
*/
|
||||
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import java.util.Set;
|
||||
import org.junit.jupiter.params.ParameterizedTest;
|
||||
import org.junit.jupiter.params.provider.MethodSource;
|
||||
|
||||
public class ThrowingPublishersInNextRequest extends AbstractThrowingPublishers {
|
||||
|
||||
@Test(dataProvider = "nextRequestProvider")
|
||||
@ParameterizedTest
|
||||
@MethodSource("nextRequestProvider")
|
||||
public void testThrowingAsString(String uri, boolean sameClient,
|
||||
Thrower thrower, Set<Where> whereValues)
|
||||
throws Exception
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2018, 2025, 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
|
||||
@ -29,18 +29,20 @@
|
||||
* @build jdk.test.lib.net.SimpleSSLContext
|
||||
* ReferenceTracker AbstractThrowingPublishers ThrowingPublishersInRequest
|
||||
* jdk.httpclient.test.lib.common.HttpServerAdapters
|
||||
* @run testng/othervm -Djdk.internal.httpclient.debug=true
|
||||
* @run junit/othervm -Djdk.internal.httpclient.debug=true
|
||||
* -Djdk.httpclient.enableAllMethodRetry=true
|
||||
* ThrowingPublishersInRequest
|
||||
*/
|
||||
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import java.util.Set;
|
||||
import org.junit.jupiter.params.ParameterizedTest;
|
||||
import org.junit.jupiter.params.provider.MethodSource;
|
||||
|
||||
public class ThrowingPublishersInRequest extends AbstractThrowingPublishers {
|
||||
|
||||
@Test(dataProvider = "requestProvider")
|
||||
@ParameterizedTest
|
||||
@MethodSource("requestProvider")
|
||||
public void testThrowingAsString(String uri, boolean sameClient,
|
||||
Thrower thrower, Set<Where> whereValues)
|
||||
throws Exception
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2018, 2025, 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
|
||||
@ -29,18 +29,20 @@
|
||||
* @build jdk.test.lib.net.SimpleSSLContext
|
||||
* ReferenceTracker AbstractThrowingPublishers ThrowingPublishersInSubscribe
|
||||
* jdk.httpclient.test.lib.common.HttpServerAdapters
|
||||
* @run testng/othervm -Djdk.internal.httpclient.debug=true
|
||||
* @run junit/othervm -Djdk.internal.httpclient.debug=true
|
||||
* -Djdk.httpclient.enableAllMethodRetry=true
|
||||
* ThrowingPublishersInSubscribe
|
||||
*/
|
||||
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import java.util.Set;
|
||||
import org.junit.jupiter.params.ParameterizedTest;
|
||||
import org.junit.jupiter.params.provider.MethodSource;
|
||||
|
||||
public class ThrowingPublishersInSubscribe extends AbstractThrowingPublishers {
|
||||
|
||||
@Test(dataProvider = "subscribeProvider")
|
||||
@ParameterizedTest
|
||||
@MethodSource("subscribeProvider")
|
||||
public void testThrowingAsString(String uri, boolean sameClient,
|
||||
Thrower thrower, Set<Where> whereValues)
|
||||
throws Exception
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2018, 2025, 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
|
||||
@ -29,16 +29,18 @@
|
||||
* @build jdk.test.lib.net.SimpleSSLContext
|
||||
* ReferenceTracker AbstractThrowingPublishers ThrowingPublishersSanity
|
||||
* jdk.httpclient.test.lib.common.HttpServerAdapters
|
||||
* @run testng/othervm -Djdk.internal.httpclient.debug=true
|
||||
* @run junit/othervm -Djdk.internal.httpclient.debug=true
|
||||
* -Djdk.httpclient.enableAllMethodRetry=true
|
||||
* ThrowingPublishersSanity
|
||||
*/
|
||||
|
||||
import org.testng.annotations.Test;
|
||||
import org.junit.jupiter.params.ParameterizedTest;
|
||||
import org.junit.jupiter.params.provider.MethodSource;
|
||||
|
||||
public class ThrowingPublishersSanity extends AbstractThrowingPublishers {
|
||||
|
||||
@Test(dataProvider = "sanity")
|
||||
@ParameterizedTest
|
||||
@MethodSource("sanity")
|
||||
public void testSanity(String uri, boolean sameClient)
|
||||
throws Exception {
|
||||
super.testSanityImpl(uri,sameClient);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user