From 8a47429dc065ad7645a40fa2350d043ef4606d92 Mon Sep 17 00:00:00 2001 From: Jaikiran Pai Date: Wed, 25 Jan 2023 13:38:02 +0000 Subject: [PATCH] 8295944: Move the Http2TestServer and related classes into a package of its own Reviewed-by: dfuchs --- test/jdk/com/sun/net/httpserver/SANTest.java | 12 ++++--- .../net/httpclient/ALPNProxyFailureTest.java | 15 +++------ .../java/net/httpclient/AbstractNoBody.java | 5 ++- .../AbstractThrowingPublishers.java | 4 ++- .../AbstractThrowingPushPromises.java | 13 ++++---- .../AbstractThrowingSubscribers.java | 4 ++- .../httpclient/AggregateRequestBodyTest.java | 12 +++---- .../net/httpclient/AsFileDownloadTest.java | 20 +++++------ .../net/httpclient/AsFileDownloadTest.policy | 6 ++-- .../net/httpclient/AsyncExecutorShutdown.java | 16 ++++----- .../net/httpclient/AuthFilterCacheTest.java | 16 ++++----- .../net/httpclient/BasicRedirectTest.java | 15 +++------ .../net/httpclient/CancelRequestTest.java | 12 +++---- .../httpclient/CancelStreamedBodyTest.java | 12 +++---- .../net/httpclient/ConcurrentResponses.java | 17 ++++------ .../java/net/httpclient/CookieHeaderTest.java | 15 +++------ .../httpclient/CustomRequestPublisher.java | 16 ++++----- .../httpclient/CustomResponseSubscriber.java | 13 ++++---- .../net/httpclient/DependentActionsTest.java | 13 ++++---- .../DependentPromiseActionsTest.java | 13 ++++---- .../java/net/httpclient/DigestEchoClient.java | 16 +++------ .../net/httpclient/DigestEchoClientSSL.java | 12 ++----- .../java/net/httpclient/DigestEchoServer.java | 4 ++- .../net/httpclient/EncodedCharsInURI.java | 13 ++++---- .../net/httpclient/EscapedOctetsInURI.java | 16 ++++----- .../java/net/httpclient/ExecutorShutdown.java | 16 ++++----- .../net/httpclient/ExpectContinueTest.java | 13 +++----- .../FilePublisher/FilePublisherPermsTest.java | 15 ++++----- .../FilePublisherPermsTest1.policy | 6 ++-- .../FilePublisherPermsTest2.policy | 6 ++-- .../FilePublisherPermsTest3.policy | 6 ++-- .../FilePublisher/FilePublisherTest.java | 15 ++++----- .../FilePublisher/FilePublisherTest.policy | 4 +-- .../httpclient/FlowAdapterPublisherTest.java | 18 +++++----- .../httpclient/FlowAdapterSubscriberTest.java | 17 ++++------ .../net/httpclient/ForbiddenHeadTest.java | 19 ++++------- .../net/httpclient/GZIPInputStreamTest.java | 12 +++---- test/jdk/java/net/httpclient/HeadTest.java | 15 +++------ .../httpclient/HttpClientLocalAddrTest.java | 15 ++++----- .../java/net/httpclient/HttpRedirectTest.java | 16 ++++----- .../net/httpclient/HttpSlowServerTest.java | 16 ++++----- .../java/net/httpclient/HttpVersionsTest.java | 18 +++++----- .../net/httpclient/HttpsTunnelAuthTest.java | 16 ++++----- .../java/net/httpclient/HttpsTunnelTest.java | 16 ++++----- .../java/net/httpclient/ISO_8859_1_Test.java | 15 ++++----- .../net/httpclient/ImmutableFlowItems.java | 13 ++++---- ...InvalidInputStreamSubscriptionRequest.java | 11 +++---- .../InvalidSubscriptionRequest.java | 12 +++---- .../net/httpclient/LargeHandshakeTest.java | 16 ++++----- .../net/httpclient/LargeResponseTest.java | 16 ++++----- .../net/httpclient/LineBodyHandlerTest.java | 16 ++++----- .../httpclient/MappingResponseSubscriber.java | 11 +++---- test/jdk/java/net/httpclient/MaxStreams.java | 17 ++++------ .../java/net/httpclient/NoBodyPartOne.java | 10 ++---- .../java/net/httpclient/NoBodyPartTwo.java | 10 ++---- .../net/httpclient/NonAsciiCharsInURI.java | 15 +++------ .../BodyHandlerOfFileDownloadTest.java | 33 +++++++++++-------- .../PathSubscriber/BodyHandlerOfFileTest.java | 32 ++++++++++-------- .../BodySubscriberOfFileTest.java | 31 +++++++++-------- .../httpclient/PathSubscriber/ofFile.policy | 6 ++-- .../PathSubscriber/ofFileDownload.policy | 6 ++-- .../httpclient/ProxyAuthDisabledSchemes.java | 12 ++----- .../ProxyAuthDisabledSchemesSSL.java | 12 ++----- .../net/httpclient/ProxySelectorTest.java | 19 ++++------- .../net/httpclient/RedirectMethodChange.java | 14 +++----- .../net/httpclient/RedirectWithCookie.java | 15 +++------ .../java/net/httpclient/Response1xxTest.java | 16 ++++----- .../net/httpclient/Response204V2Test.java | 14 ++++---- .../net/httpclient/ResponsePublisher.java | 12 +++---- .../java/net/httpclient/RetryWithCookie.java | 17 ++++------ .../java/net/httpclient/ServerCloseTest.java | 13 ++++---- .../net/httpclient/SpecialHeadersTest.java | 17 ++++------ .../java/net/httpclient/StreamCloseTest.java | 15 ++++----- .../java/net/httpclient/StreamingBody.java | 15 +++------ test/jdk/java/net/httpclient/TEST.properties | 9 ++++- .../ThrowingPublishersCustomAfterCancel.java | 11 +++---- .../ThrowingPublishersCustomBeforeCancel.java | 11 +++---- .../ThrowingPublishersIOAfterCancel.java | 11 +++---- .../ThrowingPublishersIOBeforeCancel.java | 11 +++---- .../ThrowingPublishersInNextRequest.java | 11 +++---- .../ThrowingPublishersInRequest.java | 11 +++---- .../ThrowingPublishersInSubscribe.java | 11 +++---- .../httpclient/ThrowingPublishersSanity.java | 11 +++---- ...rowingPushPromisesAsInputStreamCustom.java | 13 +++----- .../ThrowingPushPromisesAsInputStreamIO.java | 13 +++----- .../ThrowingPushPromisesAsLinesCustom.java | 13 +++----- .../ThrowingPushPromisesAsLinesIO.java | 13 +++----- .../ThrowingPushPromisesAsStringCustom.java | 13 +++----- .../ThrowingPushPromisesAsStringIO.java | 13 +++----- .../ThrowingPushPromisesSanity.java | 13 +++----- .../ThrowingSubscribersAsInputStream.java | 13 +++----- ...ThrowingSubscribersAsInputStreamAsync.java | 13 +++----- .../ThrowingSubscribersAsLines.java | 13 +++----- .../ThrowingSubscribersAsLinesAsync.java | 13 +++----- .../ThrowingSubscribersAsString.java | 13 +++----- .../ThrowingSubscribersAsStringAsync.java | 13 +++----- .../httpclient/ThrowingSubscribersSanity.java | 13 +++----- .../java/net/httpclient/TlsContextTest.java | 16 ++++----- .../java/net/httpclient/UnauthorizedTest.java | 15 +++------ .../java/net/httpclient/UserCookieTest.java | 15 +++------ test/jdk/java/net/httpclient/dependent.policy | 6 ++-- .../net/httpclient/http2/BadHeadersTest.java | 24 +++++++------- .../java/net/httpclient/http2/BasicTest.java | 16 +++++---- .../http2/ContinuationFrameTest.java | 25 +++++++------- .../java/net/httpclient/http2/ErrorTest.java | 10 ++++-- .../httpclient/http2/FixedThreadPoolTest.java | 15 +++++---- .../http2/IdleConnectionTimeoutTest.java | 12 +++---- .../httpclient/http2/ImplicitPushCancel.java | 13 ++++---- .../java/net/httpclient/http2/NoBodyTest.java | 13 ++++---- .../java/net/httpclient/http2/ProxyTest2.java | 14 ++++---- .../http2/PushPromiseContinuation.java | 23 ++++++++----- .../net/httpclient/http2/RedirectTest.java | 17 ++++++---- .../java/net/httpclient/http2/ServerPush.java | 16 +++++---- .../http2/ServerPushWithDiffTypes.java | 13 ++++---- .../net/httpclient/http2/TLSConnection.java | 12 +++---- .../net/httpclient/http2/UserInfoTest.java | 13 ++++---- .../httpclient-localaddr-security.policy | 6 ++-- .../lib/common}/ExceptionallyCloseable.java | 4 ++- .../test/lib/common}/HttpServerAdapters.java | 6 +++- .../httpclient/test/lib/common}/TestUtil.java | 4 ++- .../test/lib/http2}/BodyInputStream.java | 4 ++- .../test/lib/http2}/BodyOutputStream.java | 10 +++--- .../test/lib/http2}/EchoHandler.java | 4 ++- .../test/lib/http2}/Http2EchoHandler.java | 3 +- .../test/lib/http2}/Http2Handler.java | 3 +- .../test/lib/http2}/Http2RedirectHandler.java | 4 ++- .../test/lib/http2}/Http2TestExchange.java | 4 ++- .../lib/http2}/Http2TestExchangeImpl.java | 18 +++++----- .../lib/http2}/Http2TestExchangeSupplier.java | 4 ++- .../test/lib/http2}/Http2TestServer.java | 4 ++- .../lib/http2}/Http2TestServerConnection.java | 14 +++++--- .../test/lib/http2}/NoBodyHandler.java | 4 ++- .../test/lib/http2}/OutgoingPushPromise.java | 6 ++-- .../test/lib/http2}/PushHandler.java | 4 ++- .../jdk/httpclient/test/lib/http2}/Queue.java | 6 +++- 135 files changed, 759 insertions(+), 950 deletions(-) rename test/jdk/java/net/httpclient/{http2/server => lib/jdk/httpclient/test/lib/common}/ExceptionallyCloseable.java (95%) rename test/jdk/java/net/httpclient/{ => lib/jdk/httpclient/test/lib/common}/HttpServerAdapters.java (99%) rename test/jdk/java/net/httpclient/{http2/server => lib/jdk/httpclient/test/lib/common}/TestUtil.java (96%) rename test/jdk/java/net/httpclient/{http2/server => lib/jdk/httpclient/test/lib/http2}/BodyInputStream.java (97%) rename test/jdk/java/net/httpclient/{http2/server => lib/jdk/httpclient/test/lib/http2}/BodyOutputStream.java (94%) rename test/jdk/java/net/httpclient/{http2/server => lib/jdk/httpclient/test/lib/http2}/EchoHandler.java (96%) rename test/jdk/java/net/httpclient/{http2/server => lib/jdk/httpclient/test/lib/http2}/Http2EchoHandler.java (97%) rename test/jdk/java/net/httpclient/{http2/server => lib/jdk/httpclient/test/lib/http2}/Http2Handler.java (93%) rename test/jdk/java/net/httpclient/{http2/server => lib/jdk/httpclient/test/lib/http2}/Http2RedirectHandler.java (95%) rename test/jdk/java/net/httpclient/{http2/server => lib/jdk/httpclient/test/lib/http2}/Http2TestExchange.java (95%) rename test/jdk/java/net/httpclient/{http2/server => lib/jdk/httpclient/test/lib/http2}/Http2TestExchangeImpl.java (93%) rename test/jdk/java/net/httpclient/{http2/server => lib/jdk/httpclient/test/lib/http2}/Http2TestExchangeSupplier.java (95%) rename test/jdk/java/net/httpclient/{http2/server => lib/jdk/httpclient/test/lib/http2}/Http2TestServer.java (99%) rename test/jdk/java/net/httpclient/{http2/server => lib/jdk/httpclient/test/lib/http2}/Http2TestServerConnection.java (99%) rename test/jdk/java/net/httpclient/{http2/server => lib/jdk/httpclient/test/lib/http2}/NoBodyHandler.java (94%) rename test/jdk/java/net/httpclient/{http2/server => lib/jdk/httpclient/test/lib/http2}/OutgoingPushPromise.java (93%) rename test/jdk/java/net/httpclient/{http2/server => lib/jdk/httpclient/test/lib/http2}/PushHandler.java (96%) rename test/jdk/java/net/httpclient/{http2/server => lib/jdk/httpclient/test/lib/http2}/Queue.java (96%) diff --git a/test/jdk/com/sun/net/httpserver/SANTest.java b/test/jdk/com/sun/net/httpserver/SANTest.java index db0fc0542d6..dc7f5e7bdd5 100644 --- a/test/jdk/com/sun/net/httpserver/SANTest.java +++ b/test/jdk/com/sun/net/httpserver/SANTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2023, 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 @@ -24,10 +24,10 @@ /** * @test * @bug 8278312 - * @library /test/lib /test/jdk/java/net/httpclient /test/jdk/java/net/httpclient/http2/server - * @build jdk.test.lib.net.SimpleSSLContext HttpServerAdapters Http2Handler - * jdk.test.lib.net.IPSupport - * Http2TestExchange + * @library /test/lib /test/jdk/java/net/httpclient /test/jdk/java/net/httpclient/lib + * @build jdk.test.lib.net.SimpleSSLContext jdk.httpclient.test.lib.common.HttpServerAdapters + * jdk.httpclient.test.lib.http2.Http2TestServer + * jdk.test.lib.net.IPSupport * * @modules java.net.http/jdk.internal.net.http.common * java.net.http/jdk.internal.net.http.frame @@ -52,6 +52,8 @@ import javax.net.ssl.*; import jdk.test.lib.net.SimpleSSLContext; import jdk.test.lib.net.URIBuilder; import jdk.test.lib.net.IPSupport; +import jdk.httpclient.test.lib.common.HttpServerAdapters; +import jdk.httpclient.test.lib.http2.Http2TestServer; /* * Will fail if the testkeys file belonging to SimpleSSLContext diff --git a/test/jdk/java/net/httpclient/ALPNProxyFailureTest.java b/test/jdk/java/net/httpclient/ALPNProxyFailureTest.java index 30489b6c453..ca2e95b70fe 100644 --- a/test/jdk/java/net/httpclient/ALPNProxyFailureTest.java +++ b/test/jdk/java/net/httpclient/ALPNProxyFailureTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2023, 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 @@ -27,17 +27,10 @@ * when a 'Connection reset by peer' exception is raised * during the handshake. * @bug 8217094 - * @library /test/lib http2/server - * @build jdk.test.lib.net.SimpleSSLContext HttpServerAdapters DigestEchoServer + * @library /test/lib /test/jdk/java/net/httpclient/lib + * @build jdk.test.lib.net.SimpleSSLContext DigestEchoServer + * jdk.httpclient.test.lib.common.HttpServerAdapters * ALPNFailureTest ALPNProxyFailureTest - * @modules java.net.http/jdk.internal.net.http.common - * java.net.http/jdk.internal.net.http.frame - * java.net.http/jdk.internal.net.http.hpack - * java.logging - * java.base/sun.net.www.http - * java.base/sun.net.www - * java.base/sun.net - * @build ALPNFailureTest * @run main/othervm -Djdk.internal.httpclient.debug=true -Dtest.nolinger=true ALPNProxyFailureTest HTTP_1_1 * @run main/othervm -Dtest.nolinger=true ALPNProxyFailureTest HTTP_2 */ diff --git a/test/jdk/java/net/httpclient/AbstractNoBody.java b/test/jdk/java/net/httpclient/AbstractNoBody.java index 38ae9b758f6..479094e21ee 100644 --- a/test/jdk/java/net/httpclient/AbstractNoBody.java +++ b/test/jdk/java/net/httpclient/AbstractNoBody.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2023, 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 @@ -35,6 +35,9 @@ import com.sun.net.httpserver.HttpsConfigurator; import com.sun.net.httpserver.HttpsServer; import java.net.http.HttpClient; import javax.net.ssl.SSLContext; +import jdk.httpclient.test.lib.http2.Http2TestServer; +import jdk.httpclient.test.lib.http2.Http2TestExchange; +import jdk.httpclient.test.lib.http2.Http2Handler; import jdk.test.lib.net.SimpleSSLContext; import org.testng.annotations.AfterTest; import org.testng.annotations.BeforeTest; diff --git a/test/jdk/java/net/httpclient/AbstractThrowingPublishers.java b/test/jdk/java/net/httpclient/AbstractThrowingPublishers.java index 646a5cff2a5..7cd5dee64e0 100644 --- a/test/jdk/java/net/httpclient/AbstractThrowingPublishers.java +++ b/test/jdk/java/net/httpclient/AbstractThrowingPublishers.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2023, 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 @@ -72,6 +72,8 @@ import java.util.function.Consumer; import java.util.function.Supplier; import java.util.stream.Collectors; import java.util.stream.Stream; +import jdk.httpclient.test.lib.common.HttpServerAdapters; +import jdk.httpclient.test.lib.http2.Http2TestServer; import static java.lang.String.format; import static java.lang.System.out; diff --git a/test/jdk/java/net/httpclient/AbstractThrowingPushPromises.java b/test/jdk/java/net/httpclient/AbstractThrowingPushPromises.java index 2c15ec67b21..189b2504a61 100644 --- a/test/jdk/java/net/httpclient/AbstractThrowingPushPromises.java +++ b/test/jdk/java/net/httpclient/AbstractThrowingPushPromises.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2023, 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 @@ -30,14 +30,11 @@ * Concrete tests that extend this abstract class will need to include * the following jtreg tags: * - * @library /test/lib http2/server - * @build jdk.test.lib.net.SimpleSSLContext HttpServerAdapters + * @library /test/lib /test/jdk/java/net/httpclient/lib + * @build jdk.test.lib.net.SimpleSSLContext * ReferenceTracker AbstractThrowingPushPromises + * jdk.httpclient.test.lib.common.HttpServerAdapters * - * @modules java.base/sun.net.www.http - * java.net.http/jdk.internal.net.http.common - * java.net.http/jdk.internal.net.http.frame - * java.net.http/jdk.internal.net.http.hpack * @run testng/othervm -Djdk.internal.httpclient.debug=true */ @@ -90,6 +87,8 @@ import java.util.function.Predicate; import java.util.function.Supplier; import java.util.stream.Collectors; import java.util.stream.Stream; +import jdk.httpclient.test.lib.common.HttpServerAdapters; +import jdk.httpclient.test.lib.http2.Http2TestServer; import static java.lang.System.out; import static java.lang.System.err; diff --git a/test/jdk/java/net/httpclient/AbstractThrowingSubscribers.java b/test/jdk/java/net/httpclient/AbstractThrowingSubscribers.java index f6682b73f47..d95e2ac4d75 100644 --- a/test/jdk/java/net/httpclient/AbstractThrowingSubscribers.java +++ b/test/jdk/java/net/httpclient/AbstractThrowingSubscribers.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2023, 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 @@ -71,6 +71,8 @@ import java.util.function.Predicate; import java.util.function.Supplier; import java.util.stream.Collectors; import java.util.stream.Stream; +import jdk.httpclient.test.lib.common.HttpServerAdapters; +import jdk.httpclient.test.lib.http2.Http2TestServer; import static java.lang.System.out; import static java.lang.String.format; diff --git a/test/jdk/java/net/httpclient/AggregateRequestBodyTest.java b/test/jdk/java/net/httpclient/AggregateRequestBodyTest.java index 60a35a42a06..b6288b3073f 100644 --- a/test/jdk/java/net/httpclient/AggregateRequestBodyTest.java +++ b/test/jdk/java/net/httpclient/AggregateRequestBodyTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2023, 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 @@ -24,13 +24,9 @@ /* * @test * @bug 8252374 - * @library /test/lib http2/server - * @build jdk.test.lib.net.SimpleSSLContext HttpServerAdapters + * @library /test/lib /test/jdk/java/net/httpclient/lib + * @build jdk.test.lib.net.SimpleSSLContext jdk.httpclient.test.lib.common.HttpServerAdapters * ReferenceTracker AggregateRequestBodyTest - * @modules java.base/sun.net.www.http - * java.net.http/jdk.internal.net.http.common - * java.net.http/jdk.internal.net.http.frame - * java.net.http/jdk.internal.net.http.hpack * @run testng/othervm -Djdk.internal.httpclient.debug=true * -Djdk.httpclient.HttpClient.log=requests,responses,errors * AggregateRequestBodyTest @@ -70,6 +66,8 @@ import java.util.function.Supplier; import java.util.stream.Collectors; import java.util.stream.LongStream; import java.util.stream.Stream; +import jdk.httpclient.test.lib.common.HttpServerAdapters; +import jdk.httpclient.test.lib.http2.Http2TestServer; import javax.net.ssl.SSLContext; import com.sun.net.httpserver.HttpServer; diff --git a/test/jdk/java/net/httpclient/AsFileDownloadTest.java b/test/jdk/java/net/httpclient/AsFileDownloadTest.java index b076cfb29a2..91d43d11d6e 100644 --- a/test/jdk/java/net/httpclient/AsFileDownloadTest.java +++ b/test/jdk/java/net/httpclient/AsFileDownloadTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2023, 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 @@ -25,17 +25,9 @@ * @test * @summary Basic test for ofFileDownload * @bug 8196965 - * @modules java.base/sun.net.www.http - * java.net.http/jdk.internal.net.http.common - * java.net.http/jdk.internal.net.http.frame - * java.net.http/jdk.internal.net.http.hpack - * java.logging - * jdk.httpserver - * @library /test/lib http2/server - * @build Http2TestServer - * @build jdk.test.lib.net.SimpleSSLContext - * @build jdk.test.lib.Platform - * @build jdk.test.lib.util.FileUtils + * @library /test/lib /test/jdk/java/net/httpclient/lib + * @build jdk.httpclient.test.lib.http2.Http2TestServer jdk.test.lib.net.SimpleSSLContext + * jdk.test.lib.Platform jdk.test.lib.util.FileUtils * @run testng/othervm AsFileDownloadTest * @run testng/othervm/java.security.policy=AsFileDownloadTest.policy AsFileDownloadTest */ @@ -71,6 +63,10 @@ import java.util.Map; import javax.net.ssl.SSLContext; import jdk.test.lib.net.SimpleSSLContext; import jdk.test.lib.util.FileUtils; +import jdk.httpclient.test.lib.common.HttpServerAdapters; +import jdk.httpclient.test.lib.http2.Http2TestServer; +import jdk.httpclient.test.lib.http2.Http2TestExchange; +import jdk.httpclient.test.lib.http2.Http2Handler; import org.testng.annotations.AfterTest; import org.testng.annotations.BeforeTest; import org.testng.annotations.DataProvider; diff --git a/test/jdk/java/net/httpclient/AsFileDownloadTest.policy b/test/jdk/java/net/httpclient/AsFileDownloadTest.policy index 0f38171503d..badef8fe050 100644 --- a/test/jdk/java/net/httpclient/AsFileDownloadTest.policy +++ b/test/jdk/java/net/httpclient/AsFileDownloadTest.policy @@ -1,5 +1,5 @@ // -// Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. +// Copyright (c) 2018, 2023, 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 @@ -27,8 +27,8 @@ grant codeBase "file:${test.classes}/../../../../test/lib/-" { permission java.io.FilePermission "${test.src}/../../../../lib/jdk/test/lib/net/testkeys", "read"; }; -// for JTwork//classes/0/java/net/httpclient/http2/server/* -grant codeBase "file:${test.classes}/../../../../java/net/httpclient/http2/server/*" { +// for classes in JTwork//classes/0/test/jdk/java/net/httpclient/lib/ +grant codeBase "file:${test.classes}/../../../../test/jdk/java/net/httpclient/lib/-" { permission java.lang.RuntimePermission "accessClassInPackage.jdk.internal.net.http.common"; permission java.lang.RuntimePermission "accessClassInPackage.jdk.internal.net.http.frame"; permission java.lang.RuntimePermission "accessClassInPackage.jdk.internal.net.http.hpack"; diff --git a/test/jdk/java/net/httpclient/AsyncExecutorShutdown.java b/test/jdk/java/net/httpclient/AsyncExecutorShutdown.java index bc6c81dc821..97037824a6a 100644 --- a/test/jdk/java/net/httpclient/AsyncExecutorShutdown.java +++ b/test/jdk/java/net/httpclient/AsyncExecutorShutdown.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2023, 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 @@ -26,15 +26,9 @@ * @bug 8277969 * @summary Test for edge case where the executor is not accepting * new tasks while the client is still running - * @modules java.base/sun.net.www.http - * java.net.http/jdk.internal.net.http.common - * java.net.http/jdk.internal.net.http.frame - * java.net.http/jdk.internal.net.http.hpack - * java.logging - * jdk.httpserver - * @library /test/lib http2/server - * @build Http2TestServer - * @build jdk.test.lib.net.SimpleSSLContext ReferenceTracker + * @library /test/lib /test/jdk/java/net/httpclient/lib + * @build jdk.httpclient.test.lib.http2.Http2TestServer jdk.test.lib.net.SimpleSSLContext + * ReferenceTracker * @run testng/othervm * -Djdk.internal.httpclient.debug=true * -Djdk.httpclient.HttpClient.log=trace,headers,requests @@ -69,6 +63,8 @@ import java.util.concurrent.RejectedExecutionException; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicLong; import java.util.function.Function; +import jdk.httpclient.test.lib.common.HttpServerAdapters; +import jdk.httpclient.test.lib.http2.Http2TestServer; import javax.net.ssl.SSLContext; import javax.net.ssl.SSLHandshakeException; diff --git a/test/jdk/java/net/httpclient/AuthFilterCacheTest.java b/test/jdk/java/net/httpclient/AuthFilterCacheTest.java index 09a97197210..0733f7930aa 100644 --- a/test/jdk/java/net/httpclient/AuthFilterCacheTest.java +++ b/test/jdk/java/net/httpclient/AuthFilterCacheTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2023, 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 @@ -31,6 +31,8 @@ import java.util.ArrayList; import java.util.List; import java.util.concurrent.*; import java.util.concurrent.atomic.AtomicLong; +import jdk.httpclient.test.lib.common.HttpServerAdapters; +import jdk.httpclient.test.lib.http2.Http2TestServer; import com.sun.net.httpserver.HttpServer; import com.sun.net.httpserver.HttpsConfigurator; @@ -46,15 +48,9 @@ import javax.net.ssl.SSLContext; * @test * @bug 8232853 * @summary AuthenticationFilter.Cache::remove may throw ConcurrentModificationException - * @library /test/lib http2/server - * @build jdk.test.lib.net.SimpleSSLContext HttpServerAdapters DigestEchoServer HttpRedirectTest - * @modules java.net.http/jdk.internal.net.http.common - * java.net.http/jdk.internal.net.http.frame - * java.net.http/jdk.internal.net.http.hpack - * java.logging - * java.base/sun.net.www.http - * java.base/sun.net.www - * java.base/sun.net + * @library /test/lib /test/jdk/java/net/httpclient/lib + * @build jdk.httpclient.test.lib.common.HttpServerAdapters jdk.test.lib.net.SimpleSSLContext + * DigestEchoServer * @run testng/othervm -Dtest.requiresHost=true * -Djdk.httpclient.HttpClient.log=headers * -Djdk.internal.httpclient.debug=false diff --git a/test/jdk/java/net/httpclient/BasicRedirectTest.java b/test/jdk/java/net/httpclient/BasicRedirectTest.java index 8fb36b7454b..5f8e4ecf325 100644 --- a/test/jdk/java/net/httpclient/BasicRedirectTest.java +++ b/test/jdk/java/net/httpclient/BasicRedirectTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2023, 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 @@ -24,15 +24,8 @@ /* * @test * @summary Basic test for redirect and redirect policies - * @modules java.base/sun.net.www.http - * java.net.http/jdk.internal.net.http.common - * java.net.http/jdk.internal.net.http.frame - * java.net.http/jdk.internal.net.http.hpack - * java.logging - * jdk.httpserver - * @library /test/lib http2/server - * @build Http2TestServer - * @build jdk.test.lib.net.SimpleSSLContext + * @library /test/lib /test/jdk/java/net/httpclient/lib + * @build jdk.httpclient.test.lib.common.HttpServerAdapters jdk.test.lib.net.SimpleSSLContext * @run testng/othervm * -Djdk.httpclient.HttpClient.log=trace,headers,requests * BasicRedirectTest @@ -51,6 +44,8 @@ import java.net.http.HttpClient; import java.net.http.HttpClient.Redirect; import java.net.http.HttpRequest; import java.net.http.HttpResponse; +import jdk.httpclient.test.lib.common.HttpServerAdapters; +import jdk.httpclient.test.lib.http2.Http2TestServer; import java.net.http.HttpResponse.BodyHandlers; import javax.net.ssl.SSLContext; import jdk.test.lib.net.SimpleSSLContext; diff --git a/test/jdk/java/net/httpclient/CancelRequestTest.java b/test/jdk/java/net/httpclient/CancelRequestTest.java index c134f3cd99d..e7b70b8599a 100644 --- a/test/jdk/java/net/httpclient/CancelRequestTest.java +++ b/test/jdk/java/net/httpclient/CancelRequestTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2023, 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 @@ -25,14 +25,10 @@ * @test * @bug 8245462 8229822 8254786 8297075 8297149 8298340 * @summary Tests cancelling the request. - * @library /test/lib http2/server + * @library /test/lib /test/jdk/java/net/httpclient/lib * @key randomness - * @build jdk.test.lib.net.SimpleSSLContext HttpServerAdapters + * @build jdk.httpclient.test.lib.common.HttpServerAdapters jdk.test.lib.net.SimpleSSLContext * ReferenceTracker CancelRequestTest - * @modules java.base/sun.net.www.http - * java.net.http/jdk.internal.net.http.common - * java.net.http/jdk.internal.net.http.frame - * java.net.http/jdk.internal.net.http.hpack * @run testng/othervm -Djdk.internal.httpclient.debug=true * -Djdk.httpclient.enableAllMethodRetry=true * CancelRequestTest @@ -85,6 +81,8 @@ import java.util.concurrent.atomic.AtomicLong; import java.util.concurrent.atomic.AtomicReference; import java.util.stream.Collectors; import java.util.stream.Stream; +import jdk.httpclient.test.lib.common.HttpServerAdapters; +import jdk.httpclient.test.lib.http2.Http2TestServer; import static java.lang.System.arraycopy; import static java.lang.System.out; diff --git a/test/jdk/java/net/httpclient/CancelStreamedBodyTest.java b/test/jdk/java/net/httpclient/CancelStreamedBodyTest.java index bceb3e7ca1e..f3603982c49 100644 --- a/test/jdk/java/net/httpclient/CancelStreamedBodyTest.java +++ b/test/jdk/java/net/httpclient/CancelStreamedBodyTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2023, 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 @@ -26,13 +26,9 @@ * @bug 8294916 8297075 8297149 * @summary Tests that closing a streaming handler (ofInputStream()/ofLines()) * without reading all the bytes unregisters the underlying subscriber. - * @library /test/lib http2/server - * @build jdk.test.lib.net.SimpleSSLContext HttpServerAdapters + * @library /test/lib /test/jdk/java/net/httpclient/lib + * @build jdk.httpclient.test.lib.common.HttpServerAdapters jdk.test.lib.net.SimpleSSLContext * ReferenceTracker CancelStreamedBodyTest - * @modules java.base/sun.net.www.http - * java.net.http/jdk.internal.net.http.common - * java.net.http/jdk.internal.net.http.frame - * java.net.http/jdk.internal.net.http.hpack * @run testng/othervm -Djdk.internal.httpclient.debug=true * CancelStreamedBodyTest */ @@ -82,6 +78,8 @@ import java.util.concurrent.atomic.AtomicLong; import java.util.concurrent.atomic.AtomicReference; import java.util.stream.Collectors; import java.util.stream.Stream; +import jdk.httpclient.test.lib.common.HttpServerAdapters; +import jdk.httpclient.test.lib.http2.Http2TestServer; import static java.lang.System.arraycopy; import static java.lang.System.out; diff --git a/test/jdk/java/net/httpclient/ConcurrentResponses.java b/test/jdk/java/net/httpclient/ConcurrentResponses.java index 718a1b6aee6..ad1af440b1d 100644 --- a/test/jdk/java/net/httpclient/ConcurrentResponses.java +++ b/test/jdk/java/net/httpclient/ConcurrentResponses.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2023, 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 @@ -26,15 +26,8 @@ * @bug 8195823 * @summary Buffers given to response body subscribers should not contain * unprocessed HTTP data - * @modules java.base/sun.net.www.http - * java.net.http/jdk.internal.net.http.common - * java.net.http/jdk.internal.net.http.frame - * java.net.http/jdk.internal.net.http.hpack - * java.logging - * jdk.httpserver - * @library /test/lib http2/server - * @build Http2TestServer - * @build jdk.test.lib.net.SimpleSSLContext + * @library /test/lib /test/jdk/java/net/httpclient/lib + * @build jdk.httpclient.test.lib.http2.Http2TestServer jdk.test.lib.net.SimpleSSLContext * @run testng/othervm * -Djdk.httpclient.HttpClient.log=headers,errors,channel * ConcurrentResponses @@ -67,6 +60,10 @@ import java.net.http.HttpResponse.BodyHandler; import java.net.http.HttpResponse.BodyHandlers; import java.net.http.HttpResponse.BodySubscriber; import java.net.http.HttpResponse.BodySubscribers; +import jdk.httpclient.test.lib.common.HttpServerAdapters; +import jdk.httpclient.test.lib.http2.Http2TestServer; +import jdk.httpclient.test.lib.http2.Http2TestExchange; +import jdk.httpclient.test.lib.http2.Http2Handler; import jdk.test.lib.net.SimpleSSLContext; import org.testng.annotations.AfterTest; import org.testng.annotations.BeforeTest; diff --git a/test/jdk/java/net/httpclient/CookieHeaderTest.java b/test/jdk/java/net/httpclient/CookieHeaderTest.java index ae0957337de..992db068bc1 100644 --- a/test/jdk/java/net/httpclient/CookieHeaderTest.java +++ b/test/jdk/java/net/httpclient/CookieHeaderTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2023, 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 @@ -25,15 +25,8 @@ * @test * @bug 8199851 * @summary Test for multiple vs single cookie header for HTTP/2 vs HTTP/1.1 - * @modules java.base/sun.net.www.http - * java.net.http/jdk.internal.net.http.common - * java.net.http/jdk.internal.net.http.frame - * java.net.http/jdk.internal.net.http.hpack - * java.logging - * jdk.httpserver - * @library /test/lib http2/server - * @build Http2TestServer - * @build jdk.test.lib.net.SimpleSSLContext + * @library /test/lib /test/jdk/java/net/httpclient/lib + * @build jdk.httpclient.test.lib.common.HttpServerAdapters jdk.test.lib.net.SimpleSSLContext * @run testng/othervm * -Djdk.tls.acknowledgeCloseNotify=true * -Djdk.httpclient.HttpClient.log=trace,headers,requests @@ -82,6 +75,8 @@ import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.atomic.AtomicLong; import java.util.stream.Collectors; import java.util.stream.Stream; +import jdk.httpclient.test.lib.common.HttpServerAdapters; +import jdk.httpclient.test.lib.http2.Http2TestServer; import static java.lang.System.out; import static java.nio.charset.StandardCharsets.UTF_8; diff --git a/test/jdk/java/net/httpclient/CustomRequestPublisher.java b/test/jdk/java/net/httpclient/CustomRequestPublisher.java index 34c7f8611ac..03bf9643aca 100644 --- a/test/jdk/java/net/httpclient/CustomRequestPublisher.java +++ b/test/jdk/java/net/httpclient/CustomRequestPublisher.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2023, 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 @@ -24,15 +24,8 @@ /* * @test * @summary Checks correct handling of Publishers that call onComplete without demand - * @modules java.base/sun.net.www.http - * java.net.http/jdk.internal.net.http.common - * java.net.http/jdk.internal.net.http.frame - * java.net.http/jdk.internal.net.http.hpack - * java.logging - * jdk.httpserver - * @library /test/lib http2/server - * @build Http2TestServer - * @build jdk.test.lib.net.SimpleSSLContext + * @library /test/lib /test/jdk/java/net/httpclient/lib + * @build jdk.httpclient.test.lib.http2.Http2TestServer jdk.test.lib.net.SimpleSSLContext * @run testng/othervm CustomRequestPublisher */ @@ -62,6 +55,9 @@ import javax.net.ssl.SSLSession; import java.net.http.HttpClient; import java.net.http.HttpRequest; import java.net.http.HttpResponse; +import jdk.httpclient.test.lib.http2.Http2TestServer; +import jdk.httpclient.test.lib.http2.Http2TestExchange; +import jdk.httpclient.test.lib.http2.Http2Handler; import jdk.test.lib.net.SimpleSSLContext; import org.testng.annotations.AfterTest; import org.testng.annotations.BeforeTest; diff --git a/test/jdk/java/net/httpclient/CustomResponseSubscriber.java b/test/jdk/java/net/httpclient/CustomResponseSubscriber.java index ff7460ec4d5..e0bee8cc74f 100644 --- a/test/jdk/java/net/httpclient/CustomResponseSubscriber.java +++ b/test/jdk/java/net/httpclient/CustomResponseSubscriber.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2023, 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 @@ -24,12 +24,8 @@ /* * @test * @summary Tests response body subscribers's onComplete is not invoked before onSubscribe - * @library /test/lib http2/server - * @build jdk.test.lib.net.SimpleSSLContext - * @modules java.base/sun.net.www.http - * java.net.http/jdk.internal.net.http.common - * java.net.http/jdk.internal.net.http.frame - * java.net.http/jdk.internal.net.http.hpack + * @library /test/lib /test/jdk/java/net/httpclient/lib + * @build jdk.test.lib.net.SimpleSSLContext jdk.httpclient.test.lib.http2.Http2TestServer * @run testng/othervm CustomResponseSubscriber */ @@ -56,6 +52,9 @@ import java.net.http.HttpResponse; import java.net.http.HttpResponse.BodyHandler; import java.net.http.HttpResponse.BodySubscriber; import java.net.http.HttpResponse.BodySubscribers; +import jdk.httpclient.test.lib.http2.Http2TestServer; +import jdk.httpclient.test.lib.http2.Http2TestExchange; +import jdk.httpclient.test.lib.http2.Http2Handler; import javax.net.ssl.SSLContext; import jdk.test.lib.net.SimpleSSLContext; import org.testng.annotations.AfterTest; diff --git a/test/jdk/java/net/httpclient/DependentActionsTest.java b/test/jdk/java/net/httpclient/DependentActionsTest.java index ea715a1832b..2df3bc38a1d 100644 --- a/test/jdk/java/net/httpclient/DependentActionsTest.java +++ b/test/jdk/java/net/httpclient/DependentActionsTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2023, 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 @@ -26,12 +26,9 @@ * @summary Verify that dependent synchronous actions added before the CF * completes are executed either asynchronously in an executor when the * CF later completes, or in the user thread that joins. - * @library /test/lib http2/server - * @build jdk.test.lib.net.SimpleSSLContext HttpServerAdapters DependentActionsTest - * @modules java.base/sun.net.www.http - * java.net.http/jdk.internal.net.http.common - * java.net.http/jdk.internal.net.http.frame - * java.net.http/jdk.internal.net.http.hpack + * @library /test/lib /test/jdk/java/net/httpclient/lib + * @build jdk.httpclient.test.lib.common.HttpServerAdapters jdk.test.lib.net.SimpleSSLContext + * DependentActionsTest * @run testng/othervm -Djdk.internal.httpclient.debug=true DependentActionsTest * @run testng/othervm/java.security.policy=dependent.policy * -Djdk.internal.httpclient.debug=true DependentActionsTest @@ -86,6 +83,8 @@ import java.util.function.Predicate; import java.util.function.Supplier; import java.util.stream.Collectors; import java.util.stream.Stream; +import jdk.httpclient.test.lib.common.HttpServerAdapters; +import jdk.httpclient.test.lib.http2.Http2TestServer; import static java.lang.System.out; import static java.lang.String.format; diff --git a/test/jdk/java/net/httpclient/DependentPromiseActionsTest.java b/test/jdk/java/net/httpclient/DependentPromiseActionsTest.java index 94e7d39e5c8..ae9adf2e718 100644 --- a/test/jdk/java/net/httpclient/DependentPromiseActionsTest.java +++ b/test/jdk/java/net/httpclient/DependentPromiseActionsTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2023, 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 @@ -26,12 +26,9 @@ * @summary Verify that dependent synchronous actions added before the promise CF * completes are executed either asynchronously in an executor when the * CF later completes, or in the user thread that joins. - * @library /test/lib http2/server - * @build jdk.test.lib.net.SimpleSSLContext HttpServerAdapters DependentPromiseActionsTest - * @modules java.base/sun.net.www.http - * java.net.http/jdk.internal.net.http.common - * java.net.http/jdk.internal.net.http.frame - * java.net.http/jdk.internal.net.http.hpack + * @library /test/lib /test/jdk/java/net/httpclient/lib + * @build jdk.httpclient.test.lib.common.HttpServerAdapters jdk.test.lib.net.SimpleSSLContext + * DependentPromiseActionsTest * @run testng/othervm -Djdk.internal.httpclient.debug=true DependentPromiseActionsTest * @run testng/othervm/java.security.policy=dependent.policy * -Djdk.internal.httpclient.debug=true DependentPromiseActionsTest @@ -84,6 +81,8 @@ import java.util.function.Function; import java.util.function.Supplier; import java.util.stream.Collectors; import java.util.stream.Stream; +import jdk.httpclient.test.lib.common.HttpServerAdapters; +import jdk.httpclient.test.lib.http2.Http2TestServer; import static java.lang.System.err; import static java.lang.System.out; diff --git a/test/jdk/java/net/httpclient/DigestEchoClient.java b/test/jdk/java/net/httpclient/DigestEchoClient.java index 699f2b56343..9f963e71658 100644 --- a/test/jdk/java/net/httpclient/DigestEchoClient.java +++ b/test/jdk/java/net/httpclient/DigestEchoClient.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2023, 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 @@ -52,6 +52,7 @@ import java.util.concurrent.atomic.AtomicLong; import java.util.stream.Collectors; import java.util.stream.Stream; import javax.net.ssl.SSLContext; +import jdk.httpclient.test.lib.common.HttpServerAdapters; import jdk.test.lib.net.SimpleSSLContext; import sun.net.NetProperties; import sun.net.www.HeaderParser; @@ -64,16 +65,9 @@ import static java.lang.String.format; * @summary this test verifies that a client may provides authorization * headers directly when connecting with a server. * @bug 8087112 - * @library /test/lib http2/server - * @build jdk.test.lib.net.SimpleSSLContext HttpServerAdapters DigestEchoServer - * ReferenceTracker DigestEchoClient - * @modules java.net.http/jdk.internal.net.http.common - * java.net.http/jdk.internal.net.http.frame - * java.net.http/jdk.internal.net.http.hpack - * java.logging - * java.base/sun.net.www.http - * java.base/sun.net.www - * java.base/sun.net + * @library /test/lib /test/jdk/java/net/httpclient/lib + * @build jdk.httpclient.test.lib.common.HttpServerAdapters jdk.test.lib.net.SimpleSSLContext + * DigestEchoServer ReferenceTracker DigestEchoClient * @run main/othervm DigestEchoClient * @run main/othervm -Djdk.http.auth.proxying.disabledSchemes= * -Djdk.http.auth.tunneling.disabledSchemes= diff --git a/test/jdk/java/net/httpclient/DigestEchoClientSSL.java b/test/jdk/java/net/httpclient/DigestEchoClientSSL.java index 4803492c1ce..9a7f5acb88a 100644 --- a/test/jdk/java/net/httpclient/DigestEchoClientSSL.java +++ b/test/jdk/java/net/httpclient/DigestEchoClientSSL.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2023, 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 @@ -26,16 +26,10 @@ * @bug 8087112 * @summary this test verifies that a client may provides authorization * headers directly when connecting with a server over SSL. - * @library /test/lib http2/server + * @library /test/lib /test/jdk/java/net/httpclient/lib * @build jdk.test.lib.net.SimpleSSLContext DigestEchoServer * DigestEchoClient ReferenceTracker DigestEchoClientSSL - * @modules java.net.http/jdk.internal.net.http.common - * java.net.http/jdk.internal.net.http.frame - * java.net.http/jdk.internal.net.http.hpack - * java.logging - * java.base/sun.net.www.http - * java.base/sun.net.www - * java.base/sun.net + * jdk.httpclient.test.lib.common.HttpServerAdapters * @run main/othervm/timeout=300 * DigestEchoClientSSL SSL * @run main/othervm/timeout=300 diff --git a/test/jdk/java/net/httpclient/DigestEchoServer.java b/test/jdk/java/net/httpclient/DigestEchoServer.java index 92b96bea51c..7d79d334bb1 100644 --- a/test/jdk/java/net/httpclient/DigestEchoServer.java +++ b/test/jdk/java/net/httpclient/DigestEchoServer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2023, 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 @@ -69,6 +69,8 @@ import java.util.stream.Stream; import javax.net.ssl.SSLContext; import sun.net.www.HeaderParser; import java.net.http.HttpClient.Version; +import jdk.httpclient.test.lib.common.HttpServerAdapters; +import jdk.httpclient.test.lib.http2.Http2TestServer; /** * A simple HTTP server that supports Basic or Digest authentication. diff --git a/test/jdk/java/net/httpclient/EncodedCharsInURI.java b/test/jdk/java/net/httpclient/EncodedCharsInURI.java index 6d7a42e8532..efacbb3ea76 100644 --- a/test/jdk/java/net/httpclient/EncodedCharsInURI.java +++ b/test/jdk/java/net/httpclient/EncodedCharsInURI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2023, 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 @@ -26,12 +26,9 @@ * @bug 8199683 * @summary Tests that escaped characters in URI are correctly * handled (not re-escaped and not unescaped) - * @library /test/lib http2/server - * @build jdk.test.lib.net.SimpleSSLContext HttpServerAdapters EncodedCharsInURI - * @modules java.base/sun.net.www.http - * java.net.http/jdk.internal.net.http.common - * java.net.http/jdk.internal.net.http.frame - * java.net.http/jdk.internal.net.http.hpack + * @library /test/lib /test/jdk/java/net/httpclient/lib + * @build jdk.httpclient.test.lib.common.HttpServerAdapters jdk.test.lib.net.SimpleSSLContext + * EncodedCharsInURI * @run testng/othervm * -Djdk.tls.acknowledgeCloseNotify=true * -Djdk.internal.httpclient.debug=true @@ -76,6 +73,8 @@ import java.util.concurrent.ConcurrentMap; import java.util.concurrent.Executor; import java.util.concurrent.Executors; import java.util.concurrent.atomic.AtomicLong; +import jdk.httpclient.test.lib.common.HttpServerAdapters; +import jdk.httpclient.test.lib.http2.Http2TestServer; import static java.lang.String.format; import static java.lang.System.in; diff --git a/test/jdk/java/net/httpclient/EscapedOctetsInURI.java b/test/jdk/java/net/httpclient/EscapedOctetsInURI.java index 9e44f6aac97..00061c1edf0 100644 --- a/test/jdk/java/net/httpclient/EscapedOctetsInURI.java +++ b/test/jdk/java/net/httpclient/EscapedOctetsInURI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2023, 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 @@ -25,15 +25,8 @@ * @test * @summary Preserve URI component escaped octets when converting to HTTP headers * @bug 8198716 - * @modules java.base/sun.net.www.http - * java.net.http/jdk.internal.net.http.common - * java.net.http/jdk.internal.net.http.frame - * java.net.http/jdk.internal.net.http.hpack - * java.logging - * jdk.httpserver - * @library /test/lib http2/server - * @build Http2TestServer - * @build jdk.test.lib.net.SimpleSSLContext + * @library /test/lib /test/jdk/java/net/httpclient/lib + * @build jdk.httpclient.test.lib.http2.Http2TestServer jdk.test.lib.net.SimpleSSLContext * @run testng/othervm * -Djdk.httpclient.HttpClient.log=reqeusts,headers * EscapedOctetsInURI @@ -58,6 +51,9 @@ import java.net.http.HttpResponse.BodyHandlers; import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import jdk.httpclient.test.lib.http2.Http2TestServer; +import jdk.httpclient.test.lib.http2.Http2TestExchange; +import jdk.httpclient.test.lib.http2.Http2Handler; import jdk.test.lib.net.SimpleSSLContext; import org.testng.annotations.AfterTest; import org.testng.annotations.BeforeTest; diff --git a/test/jdk/java/net/httpclient/ExecutorShutdown.java b/test/jdk/java/net/httpclient/ExecutorShutdown.java index 1c168c22aa7..ff375247d1a 100644 --- a/test/jdk/java/net/httpclient/ExecutorShutdown.java +++ b/test/jdk/java/net/httpclient/ExecutorShutdown.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2023, 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 @@ -26,15 +26,9 @@ * @bug 8277969 * @summary Test for edge case where the executor is not accepting * new tasks while the client is still running - * @modules java.base/sun.net.www.http - * java.net.http/jdk.internal.net.http.common - * java.net.http/jdk.internal.net.http.frame - * java.net.http/jdk.internal.net.http.hpack - * java.logging - * jdk.httpserver - * @library /test/lib http2/server - * @build Http2TestServer - * @build jdk.test.lib.net.SimpleSSLContext ReferenceTracker + * @library /test/lib /test/jdk/java/net/httpclient/lib + * @build jdk.httpclient.test.lib.http2.Http2TestServer jdk.test.lib.net.SimpleSSLContext + * ReferenceTracker * @run testng/othervm * -Djdk.internal.httpclient.debug=true * -Djdk.httpclient.HttpClient.log=trace,headers,requests @@ -66,6 +60,8 @@ import java.util.concurrent.Executors; import java.util.concurrent.RejectedExecutionException; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicLong; +import jdk.httpclient.test.lib.common.HttpServerAdapters; +import jdk.httpclient.test.lib.http2.Http2TestServer; import javax.net.ssl.SSLContext; import javax.net.ssl.SSLHandshakeException; diff --git a/test/jdk/java/net/httpclient/ExpectContinueTest.java b/test/jdk/java/net/httpclient/ExpectContinueTest.java index 7e5a46039fb..2d86e9ff786 100644 --- a/test/jdk/java/net/httpclient/ExpectContinueTest.java +++ b/test/jdk/java/net/httpclient/ExpectContinueTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2023, 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,13 +29,8 @@ * a response code of 417 Expectation Failed, that the client does not hang * indefinitely and closes the connection. * @bug 8286171 - * @modules java.base/sun.net.www.http - * java.net.http/jdk.internal.net.http.common - * java.net.http/jdk.internal.net.http.frame - * java.net.http/jdk.internal.net.http.hpack - * jdk.httpserver - * @library /test/lib http2/server - * @compile HttpServerAdapters.java + * @library /test/lib /test/jdk/java/net/httpclient/lib + * @build jdk.httpclient.test.lib.common.HttpServerAdapters * @run testng/othervm ExpectContinueTest */ @@ -67,6 +62,8 @@ import java.net.http.HttpRequest; import java.net.http.HttpResponse; import java.util.StringTokenizer; import java.util.concurrent.CompletableFuture; +import jdk.httpclient.test.lib.common.HttpServerAdapters; +import jdk.httpclient.test.lib.http2.Http2TestServer; import static java.nio.charset.StandardCharsets.UTF_8; import static org.testng.Assert.assertEquals; diff --git a/test/jdk/java/net/httpclient/FilePublisher/FilePublisherPermsTest.java b/test/jdk/java/net/httpclient/FilePublisher/FilePublisherPermsTest.java index 62623c537de..ebbb7c68deb 100644 --- a/test/jdk/java/net/httpclient/FilePublisher/FilePublisherPermsTest.java +++ b/test/jdk/java/net/httpclient/FilePublisher/FilePublisherPermsTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2023, 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,14 +29,9 @@ * policy 1: no custom permission * policy 2: custom permission for test classes * policy 3: custom permission for test classes and httpclient - * @modules java.base/sun.net.www.http - * java.net.http/jdk.internal.net.http.common - * java.net.http/jdk.internal.net.http.frame - * java.net.http/jdk.internal.net.http.hpack - * jdk.httpserver - * @library /test/lib ../http2/server - * @compile ../HttpServerAdapters.java - * @build jdk.test.lib.net.SimpleSSLContext SecureZipFSProvider + * @library /test/lib /test/jdk/java/net/httpclient/lib + * @build jdk.httpclient.test.lib.common.HttpServerAdapters jdk.test.lib.net.SimpleSSLContext + * SecureZipFSProvider * @run testng/othervm/java.security.policy=FilePublisherPermsTest1.policy FilePublisherPermsTest * @run testng/othervm/java.security.policy=FilePublisherPermsTest2.policy FilePublisherPermsTest * @run testng/othervm/java.security.policy=FilePublisherPermsTest3.policy FilePublisherPermsTest @@ -71,6 +66,8 @@ import java.nio.file.Files; import java.nio.file.Path; import java.security.*; import java.util.Map; +import jdk.httpclient.test.lib.common.HttpServerAdapters; +import jdk.httpclient.test.lib.http2.Http2TestServer; import static java.lang.System.out; import static java.net.http.HttpClient.Builder.NO_PROXY; diff --git a/test/jdk/java/net/httpclient/FilePublisher/FilePublisherPermsTest1.policy b/test/jdk/java/net/httpclient/FilePublisher/FilePublisherPermsTest1.policy index a133d4e9247..47c704e0371 100644 --- a/test/jdk/java/net/httpclient/FilePublisher/FilePublisherPermsTest1.policy +++ b/test/jdk/java/net/httpclient/FilePublisher/FilePublisherPermsTest1.policy @@ -1,5 +1,5 @@ // -// Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. +// Copyright (c) 2020, 2023, 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 @@ -27,8 +27,8 @@ grant codeBase "file:${test.classes}/../../../../../test/lib/-" { permission java.io.FilePermission "${test.src}/../../../../../lib/jdk/test/lib/net/testkeys", "read"; }; -// for JTwork/classes/0/java/net/httpclient/http2/server/* -grant codeBase "file:${test.classes}/../../../../../java/net/httpclient/http2/server/*" { +// for jdk/httpclient/test/lib/* classes +grant codeBase "file:${test.classes}/../../../../../test/jdk/java/net/httpclient/lib/-" { permission java.lang.RuntimePermission "accessClassInPackage.jdk.internal.net.http.common"; permission java.lang.RuntimePermission "accessClassInPackage.jdk.internal.net.http.frame"; permission java.lang.RuntimePermission "accessClassInPackage.jdk.internal.net.http.hpack"; diff --git a/test/jdk/java/net/httpclient/FilePublisher/FilePublisherPermsTest2.policy b/test/jdk/java/net/httpclient/FilePublisher/FilePublisherPermsTest2.policy index fdde92b4ea5..89dbee70dab 100644 --- a/test/jdk/java/net/httpclient/FilePublisher/FilePublisherPermsTest2.policy +++ b/test/jdk/java/net/httpclient/FilePublisher/FilePublisherPermsTest2.policy @@ -1,5 +1,5 @@ // -// Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. +// Copyright (c) 2020, 2023, 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,8 +29,8 @@ grant codeBase "file:${test.classes}/../../../../../test/lib/-" { permission java.io.FilePermission "${test.src}/../../../../../lib/jdk/test/lib/net/testkeys", "read"; }; -// for JTwork/classes/0/java/net/httpclient/http2/server/* -grant codeBase "file:${test.classes}/../../../../../java/net/httpclient/http2/server/*" { +// for jdk/httpclient/test/lib/* classes +grant codeBase "file:${test.classes}/../../../../../test/jdk/java/net/httpclient/lib/-" { permission java.lang.RuntimePermission "accessClassInPackage.jdk.internal.net.http.common"; permission java.lang.RuntimePermission "accessClassInPackage.jdk.internal.net.http.frame"; permission java.lang.RuntimePermission "accessClassInPackage.jdk.internal.net.http.hpack"; diff --git a/test/jdk/java/net/httpclient/FilePublisher/FilePublisherPermsTest3.policy b/test/jdk/java/net/httpclient/FilePublisher/FilePublisherPermsTest3.policy index 4f7c4fee363..b692debac7e 100644 --- a/test/jdk/java/net/httpclient/FilePublisher/FilePublisherPermsTest3.policy +++ b/test/jdk/java/net/httpclient/FilePublisher/FilePublisherPermsTest3.policy @@ -1,5 +1,5 @@ // -// Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. +// Copyright (c) 2020, 2023, 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 @@ -34,8 +34,8 @@ grant codeBase "file:${test.classes}/../../../../../test/lib/-" { permission java.io.FilePermission "${test.src}/../../../../../lib/jdk/test/lib/net/testkeys", "read"; }; -// for JTwork/classes/0/java/net/httpclient/http2/server/* -grant codeBase "file:${test.classes}/../../../../../java/net/httpclient/http2/server/*" { +// for jdk/httpclient/test/lib/* classes +grant codeBase "file:${test.classes}/../../../../../test/jdk/java/net/httpclient/lib/-" { permission java.lang.RuntimePermission "accessClassInPackage.jdk.internal.net.http.common"; permission java.lang.RuntimePermission "accessClassInPackage.jdk.internal.net.http.frame"; permission java.lang.RuntimePermission "accessClassInPackage.jdk.internal.net.http.hpack"; diff --git a/test/jdk/java/net/httpclient/FilePublisher/FilePublisherTest.java b/test/jdk/java/net/httpclient/FilePublisher/FilePublisherTest.java index 9626502ae4d..06e26cb4853 100644 --- a/test/jdk/java/net/httpclient/FilePublisher/FilePublisherTest.java +++ b/test/jdk/java/net/httpclient/FilePublisher/FilePublisherTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2023, 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 @@ -26,14 +26,9 @@ * @bug 8235459 * @summary Confirm that HttpRequest.BodyPublishers#ofFile(Path) * assumes the default file system - * @modules java.base/sun.net.www.http - * java.net.http/jdk.internal.net.http.common - * java.net.http/jdk.internal.net.http.frame - * java.net.http/jdk.internal.net.http.hpack - * jdk.httpserver - * @library /test/lib ../http2/server - * @compile ../HttpServerAdapters.java - * @build jdk.test.lib.net.SimpleSSLContext + * @library /test/lib /test/jdk/java/net/httpclient/lib + * @build jdk.httpclient.test.lib.common.HttpServerAdapters + * jdk.test.lib.net.SimpleSSLContext * @run testng/othervm FilePublisherTest * @run testng/othervm/java.security.policy=FilePublisherTest.policy FilePublisherTest */ @@ -63,6 +58,8 @@ import java.nio.file.FileSystems; import java.nio.file.Files; import java.nio.file.Path; import java.util.Map; +import jdk.httpclient.test.lib.common.HttpServerAdapters; +import jdk.httpclient.test.lib.http2.Http2TestServer; import static java.lang.System.out; import static java.net.http.HttpClient.Builder.NO_PROXY; diff --git a/test/jdk/java/net/httpclient/FilePublisher/FilePublisherTest.policy b/test/jdk/java/net/httpclient/FilePublisher/FilePublisherTest.policy index 82f517858bf..6f190889d94 100644 --- a/test/jdk/java/net/httpclient/FilePublisher/FilePublisherTest.policy +++ b/test/jdk/java/net/httpclient/FilePublisher/FilePublisherTest.policy @@ -1,5 +1,5 @@ // -// Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. +// Copyright (c) 2020, 2023, 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 @@ -28,7 +28,7 @@ grant codeBase "file:${test.classes}/../../../../../test/lib/-" { }; // for JTwork/classes/0/java/net/httpclient/http2/server/* -grant codeBase "file:${test.classes}/../../../../../java/net/httpclient/http2/server/*" { +grant codeBase "file:${test.classes}/../../../../../test/jdk/java/net/httpclient/lib/-" { permission java.lang.RuntimePermission "accessClassInPackage.jdk.internal.net.http.common"; permission java.lang.RuntimePermission "accessClassInPackage.jdk.internal.net.http.frame"; permission java.lang.RuntimePermission "accessClassInPackage.jdk.internal.net.http.hpack"; diff --git a/test/jdk/java/net/httpclient/FlowAdapterPublisherTest.java b/test/jdk/java/net/httpclient/FlowAdapterPublisherTest.java index 73dea64edfd..1248ef9c71f 100644 --- a/test/jdk/java/net/httpclient/FlowAdapterPublisherTest.java +++ b/test/jdk/java/net/httpclient/FlowAdapterPublisherTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2023, 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 @@ -43,6 +43,10 @@ import com.sun.net.httpserver.HttpsServer; import java.net.http.HttpClient; import java.net.http.HttpRequest; import java.net.http.HttpResponse; +import jdk.httpclient.test.lib.common.HttpServerAdapters; +import jdk.httpclient.test.lib.http2.Http2TestServer; +import jdk.httpclient.test.lib.http2.Http2TestExchange; +import jdk.httpclient.test.lib.http2.Http2Handler; import jdk.test.lib.net.SimpleSSLContext; import org.testng.annotations.AfterTest; import org.testng.annotations.BeforeTest; @@ -61,15 +65,9 @@ import static org.testng.Assert.fail; /* * @test * @summary Basic tests for Flow adapter Publishers - * @modules java.base/sun.net.www.http - * java.net.http/jdk.internal.net.http.common - * java.net.http/jdk.internal.net.http.frame - * java.net.http/jdk.internal.net.http.hpack - * java.logging - * jdk.httpserver - * @library /test/lib http2/server - * @build Http2TestServer - * @build jdk.test.lib.net.SimpleSSLContext + * @library /test/lib /test/jdk/java/net/httpclient/lib + * @build jdk.httpclient.test.lib.http2.Http2TestServer + * jdk.test.lib.net.SimpleSSLContext * @run testng/othervm FlowAdapterPublisherTest */ diff --git a/test/jdk/java/net/httpclient/FlowAdapterSubscriberTest.java b/test/jdk/java/net/httpclient/FlowAdapterSubscriberTest.java index 8a2796c991f..11e0b8df547 100644 --- a/test/jdk/java/net/httpclient/FlowAdapterSubscriberTest.java +++ b/test/jdk/java/net/httpclient/FlowAdapterSubscriberTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2023, 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 @@ -48,6 +48,10 @@ import java.net.http.HttpRequest.BodyPublishers; import java.net.http.HttpResponse; import java.net.http.HttpResponse.BodyHandlers; import java.net.http.HttpResponse.BodySubscribers; +import jdk.httpclient.test.lib.common.HttpServerAdapters; +import jdk.httpclient.test.lib.http2.Http2TestServer; +import jdk.httpclient.test.lib.http2.Http2TestExchange; +import jdk.httpclient.test.lib.http2.Http2Handler; import jdk.test.lib.net.SimpleSSLContext; import org.testng.annotations.AfterTest; import org.testng.annotations.BeforeTest; @@ -62,15 +66,8 @@ import static org.testng.Assert.assertTrue; /* * @test * @summary Basic tests for Flow adapter Subscribers - * @modules java.base/sun.net.www.http - * java.net.http/jdk.internal.net.http.common - * java.net.http/jdk.internal.net.http.frame - * java.net.http/jdk.internal.net.http.hpack - * java.logging - * jdk.httpserver - * @library /test/lib http2/server - * @build Http2TestServer - * @build jdk.test.lib.net.SimpleSSLContext + * @library /test/lib /test/jdk/java/net/httpclient/lib + * @build jdk.httpclient.test.lib.http2.Http2TestServer jdk.test.lib.net.SimpleSSLContext * @run testng/othervm -Djdk.internal.httpclient.debug=true FlowAdapterSubscriberTest */ diff --git a/test/jdk/java/net/httpclient/ForbiddenHeadTest.java b/test/jdk/java/net/httpclient/ForbiddenHeadTest.java index 950676d74c8..c87e8dde3be 100644 --- a/test/jdk/java/net/httpclient/ForbiddenHeadTest.java +++ b/test/jdk/java/net/httpclient/ForbiddenHeadTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2023, 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 @@ -25,18 +25,9 @@ * @test * @summary checks that receiving 403 for a HEAD request after * 401/407 doesn't cause any unexpected behavior. - * @modules java.base/sun.net.www.http - * java.net.http/jdk.internal.net.http.common - * java.net.http/jdk.internal.net.http.frame - * java.net.http/jdk.internal.net.http.hpack - * java.logging - * jdk.httpserver - * java.base/sun.net.www.http - * java.base/sun.net.www - * java.base/sun.net - * @library /test/lib http2/server - * @build HttpServerAdapters DigestEchoServer Http2TestServer ForbiddenHeadTest - * @build jdk.test.lib.net.SimpleSSLContext + * @library /test/lib /test/jdk/java/net/httpclient/lib + * @build DigestEchoServer ForbiddenHeadTest jdk.httpclient.test.lib.common.HttpServerAdapters + * jdk.test.lib.net.SimpleSSLContext * @run testng/othervm * -Djdk.http.auth.tunneling.disabledSchemes * -Djdk.httpclient.HttpClient.log=headers,requests @@ -84,6 +75,8 @@ import java.util.concurrent.Executor; import java.util.concurrent.Executors; import java.util.concurrent.atomic.AtomicLong; import java.util.concurrent.atomic.AtomicReference; +import jdk.httpclient.test.lib.common.HttpServerAdapters; +import jdk.httpclient.test.lib.http2.Http2TestServer; import static java.lang.System.err; import static java.lang.System.out; diff --git a/test/jdk/java/net/httpclient/GZIPInputStreamTest.java b/test/jdk/java/net/httpclient/GZIPInputStreamTest.java index 1ff26a38dde..e581d76872b 100644 --- a/test/jdk/java/net/httpclient/GZIPInputStreamTest.java +++ b/test/jdk/java/net/httpclient/GZIPInputStreamTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2023, 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 @@ -25,12 +25,8 @@ * @test * @bug 8217264 * @summary Tests that you can map an InputStream to a GZIPInputStream - * @library /test/lib http2/server - * @build jdk.test.lib.net.SimpleSSLContext - * @modules java.base/sun.net.www.http - * java.net.http/jdk.internal.net.http.common - * java.net.http/jdk.internal.net.http.frame - * java.net.http/jdk.internal.net.http.hpack + * @library /test/lib /test/jdk/java/net/httpclient/lib + * @build jdk.test.lib.net.SimpleSSLContext jdk.httpclient.test.lib.common.HttpServerAdapters * @run testng/othervm GZIPInputStreamTest */ @@ -65,6 +61,8 @@ import java.util.function.Function; import java.util.function.Supplier; import java.util.zip.GZIPInputStream; import java.util.zip.GZIPOutputStream; +import jdk.httpclient.test.lib.common.HttpServerAdapters; +import jdk.httpclient.test.lib.http2.Http2TestServer; import static java.lang.System.out; import static java.nio.charset.StandardCharsets.UTF_8; diff --git a/test/jdk/java/net/httpclient/HeadTest.java b/test/jdk/java/net/httpclient/HeadTest.java index fe8af5545c3..0dd0ae2d223 100644 --- a/test/jdk/java/net/httpclient/HeadTest.java +++ b/test/jdk/java/net/httpclient/HeadTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2023, 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 @@ -25,15 +25,8 @@ * @test * @bug 8203433 8276559 * @summary (httpclient) Add tests for HEAD and 304 responses. - * @modules java.base/sun.net.www.http - * java.net.http/jdk.internal.net.http.common - * java.net.http/jdk.internal.net.http.frame - * java.net.http/jdk.internal.net.http.hpack - * java.logging - * jdk.httpserver - * @library /test/lib http2/server - * @build Http2TestServer - * @build jdk.test.lib.net.SimpleSSLContext + * @library /test/lib /test/jdk/java/net/httpclient/lib + * @build jdk.httpclient.test.lib.http2.Http2TestServer jdk.test.lib.net.SimpleSSLContext * @run testng/othervm * -Djdk.httpclient.HttpClient.log=trace,headers,requests * HeadTest @@ -59,6 +52,8 @@ import java.net.http.HttpClient.Redirect; import java.net.http.HttpRequest; import java.net.http.HttpResponse; import java.net.http.HttpResponse.BodyHandlers; +import jdk.httpclient.test.lib.common.HttpServerAdapters; +import jdk.httpclient.test.lib.http2.Http2TestServer; import static java.lang.System.out; import static org.testng.Assert.assertEquals; diff --git a/test/jdk/java/net/httpclient/HttpClientLocalAddrTest.java b/test/jdk/java/net/httpclient/HttpClientLocalAddrTest.java index f51b392ea00..399569cdcfd 100644 --- a/test/jdk/java/net/httpclient/HttpClientLocalAddrTest.java +++ b/test/jdk/java/net/httpclient/HttpClientLocalAddrTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2023, 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 @@ -47,21 +47,18 @@ import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.Future; import java.util.function.Predicate; +import jdk.httpclient.test.lib.common.HttpServerAdapters; +import jdk.httpclient.test.lib.http2.Http2TestServer; /* * @test * @summary Tests HttpClient usage when configured with a local address to bind * to, when sending requests * @bug 8209137 - * @modules jdk.httpserver - * java.net.http/jdk.internal.net.http.common - * java.net.http/jdk.internal.net.http.frame - * java.base/sun.net.www.http - * java.net.http/jdk.internal.net.http.hpack + * @library /test/lib /test/jdk/java/net/httpclient/lib * - * @library /test/lib http2/server - * - * @build jdk.test.lib.net.SimpleSSLContext jdk.test.lib.net.IPSupport HttpServerAdapters + * @build jdk.test.lib.net.SimpleSSLContext jdk.test.lib.net.IPSupport + * jdk.httpclient.test.lib.common.HttpServerAdapters * * @run testng/othervm * -Djdk.httpclient.HttpClient.log=frames,ssl,requests,responses,errors diff --git a/test/jdk/java/net/httpclient/HttpRedirectTest.java b/test/jdk/java/net/httpclient/HttpRedirectTest.java index 34ec95f7770..592c1338057 100644 --- a/test/jdk/java/net/httpclient/HttpRedirectTest.java +++ b/test/jdk/java/net/httpclient/HttpRedirectTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2023, 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 @@ -57,20 +57,16 @@ import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicLong; +import jdk.httpclient.test.lib.common.HttpServerAdapters; +import jdk.httpclient.test.lib.http2.Http2TestServer; /** * @test * @bug 8232625 * @summary This test verifies that the HttpClient works correctly when redirecting a post request. - * @library /test/lib http2/server - * @build jdk.test.lib.net.SimpleSSLContext HttpServerAdapters DigestEchoServer HttpRedirectTest - * @modules java.net.http/jdk.internal.net.http.common - * java.net.http/jdk.internal.net.http.frame - * java.net.http/jdk.internal.net.http.hpack - * java.logging - * java.base/sun.net.www.http - * java.base/sun.net.www - * java.base/sun.net + * @library /test/lib /test/jdk/java/net/httpclient/lib + * @build jdk.test.lib.net.SimpleSSLContext DigestEchoServer HttpRedirectTest + * jdk.httpclient.test.lib.common.HttpServerAdapters * @run testng/othervm -Dtest.requiresHost=true * -Djdk.httpclient.HttpClient.log=headers * -Djdk.internal.httpclient.debug=false diff --git a/test/jdk/java/net/httpclient/HttpSlowServerTest.java b/test/jdk/java/net/httpclient/HttpSlowServerTest.java index 298f3222933..e64b579c300 100644 --- a/test/jdk/java/net/httpclient/HttpSlowServerTest.java +++ b/test/jdk/java/net/httpclient/HttpSlowServerTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2023, 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 @@ -50,20 +50,16 @@ import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicLong; +import jdk.httpclient.test.lib.common.HttpServerAdapters; +import jdk.httpclient.test.lib.http2.Http2TestServer; /** * @test * @summary This test verifies that the HttpClient works correctly when connected to a * slow server. - * @library /test/lib http2/server - * @build jdk.test.lib.net.SimpleSSLContext HttpServerAdapters DigestEchoServer HttpSlowServerTest - * @modules java.net.http/jdk.internal.net.http.common - * java.net.http/jdk.internal.net.http.frame - * java.net.http/jdk.internal.net.http.hpack - * java.logging - * java.base/sun.net.www.http - * java.base/sun.net.www - * java.base/sun.net + * @library /test/lib /test/jdk/java/net/httpclient/lib + * @build jdk.httpclient.test.lib.common.HttpServerAdapters jdk.test.lib.net.SimpleSSLContext + * DigestEchoServer HttpSlowServerTest * @run main/othervm -Dtest.requiresHost=true * -Djdk.httpclient.HttpClient.log=headers * -Djdk.internal.httpclient.debug=false diff --git a/test/jdk/java/net/httpclient/HttpVersionsTest.java b/test/jdk/java/net/httpclient/HttpVersionsTest.java index f04c1d50ea0..00b0db1af4e 100644 --- a/test/jdk/java/net/httpclient/HttpVersionsTest.java +++ b/test/jdk/java/net/httpclient/HttpVersionsTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2023, 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 @@ -25,15 +25,9 @@ * @test * @summary Checks HTTP versions when interacting with an HTTP/2 server * @bug 8242044 - * @modules java.base/sun.net.www.http - * java.net.http/jdk.internal.net.http.common - * java.net.http/jdk.internal.net.http.frame - * java.net.http/jdk.internal.net.http.hpack - * java.logging - * @library /test/lib http2/server - * @build Http2TestServer - * @build jdk.test.lib.net.SimpleSSLContext - * @build jdk.test.lib.Platform + * @library /test/lib /test/jdk/java/net/httpclient/lib + * @build jdk.httpclient.test.lib.http2.Http2TestServer jdk.test.lib.net.SimpleSSLContext + * jdk.test.lib.Platform * @run testng/othervm HttpVersionsTest */ @@ -48,6 +42,10 @@ import java.net.http.HttpResponse; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import javax.net.ssl.SSLContext; +import jdk.httpclient.test.lib.common.HttpServerAdapters; +import jdk.httpclient.test.lib.http2.Http2TestServer; +import jdk.httpclient.test.lib.http2.Http2TestExchange; +import jdk.httpclient.test.lib.http2.Http2Handler; import jdk.test.lib.net.SimpleSSLContext; import org.testng.annotations.AfterTest; import org.testng.annotations.BeforeTest; diff --git a/test/jdk/java/net/httpclient/HttpsTunnelAuthTest.java b/test/jdk/java/net/httpclient/HttpsTunnelAuthTest.java index 933e0f75efe..f83118adea3 100644 --- a/test/jdk/java/net/httpclient/HttpsTunnelAuthTest.java +++ b/test/jdk/java/net/httpclient/HttpsTunnelAuthTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2023, 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 @@ -36,6 +36,8 @@ import java.util.List; import java.util.stream.Collectors; import java.util.stream.Stream; import javax.net.ssl.SSLContext; +import jdk.httpclient.test.lib.common.HttpServerAdapters; +import jdk.httpclient.test.lib.http2.Http2TestServer; import jdk.test.lib.net.SimpleSSLContext; import static java.lang.System.out; @@ -47,15 +49,9 @@ import static java.lang.System.out; * even when using an HTTPS tunnel. This test uses an authenticating * proxy (basic auth) serving an authenticated server (basic auth). * The test also helps verifying the fix for 8262027. - * @library /test/lib http2/server - * @build jdk.test.lib.net.SimpleSSLContext HttpServerAdapters ProxyServer HttpsTunnelAuthTest - * @modules java.net.http/jdk.internal.net.http.common - * java.net.http/jdk.internal.net.http.frame - * java.net.http/jdk.internal.net.http.hpack - * java.logging - * java.base/sun.net.www.http - * java.base/sun.net.www - * java.base/sun.net + * @library /test/lib /test/jdk/java/net/httpclient/lib + * @build jdk.httpclient.test.lib.common.HttpServerAdapters jdk.test.lib.net.SimpleSSLContext + * ProxyServer HttpsTunnelAuthTest * @run main/othervm -Djdk.httpclient.HttpClient.log=requests,headers,errors * -Djdk.http.auth.tunneling.disabledSchemes * -Djdk.httpclient.allowRestrictedHeaders=connection diff --git a/test/jdk/java/net/httpclient/HttpsTunnelTest.java b/test/jdk/java/net/httpclient/HttpsTunnelTest.java index 60db57d47a4..e3848fdad8b 100644 --- a/test/jdk/java/net/httpclient/HttpsTunnelTest.java +++ b/test/jdk/java/net/httpclient/HttpsTunnelTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2023, 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 @@ -38,6 +38,8 @@ import java.util.Arrays; import java.util.List; import java.util.stream.Collectors; import java.util.stream.Stream; +import jdk.httpclient.test.lib.common.HttpServerAdapters; +import jdk.httpclient.test.lib.http2.Http2TestServer; import static java.lang.String.format; import static java.lang.System.out; @@ -50,15 +52,9 @@ import static java.lang.System.out; * a new h2 connection to the new host. It also verifies that * the stack sends the appropriate "host" header to the proxy. * @bug 8196967 8222527 - * @library /test/lib http2/server - * @build jdk.test.lib.net.SimpleSSLContext HttpServerAdapters DigestEchoServer HttpsTunnelTest - * @modules java.net.http/jdk.internal.net.http.common - * java.net.http/jdk.internal.net.http.frame - * java.net.http/jdk.internal.net.http.hpack - * java.logging - * java.base/sun.net.www.http - * java.base/sun.net.www - * java.base/sun.net + * @library /test/lib /test/jdk/java/net/httpclient/lib + * @build jdk.httpclient.test.lib.common.HttpServerAdapters jdk.test.lib.net.SimpleSSLContext + * DigestEchoServer HttpsTunnelTest * @run main/othervm -Dtest.requiresHost=true * -Djdk.httpclient.HttpClient.log=headers * -Djdk.internal.httpclient.debug=true HttpsTunnelTest diff --git a/test/jdk/java/net/httpclient/ISO_8859_1_Test.java b/test/jdk/java/net/httpclient/ISO_8859_1_Test.java index 9be5269f5f1..bc9446114c4 100644 --- a/test/jdk/java/net/httpclient/ISO_8859_1_Test.java +++ b/test/jdk/java/net/httpclient/ISO_8859_1_Test.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2023, 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 @@ -24,13 +24,9 @@ /* * @test * @bug 8252374 - * @library /test/lib http2/server - * @build jdk.test.lib.net.SimpleSSLContext HttpServerAdapters - * ReferenceTracker AggregateRequestBodyTest - * @modules java.base/sun.net.www.http - * java.net.http/jdk.internal.net.http.common - * java.net.http/jdk.internal.net.http.frame - * java.net.http/jdk.internal.net.http.hpack + * @library /test/lib /test/jdk/java/net/httpclient/lib + * @build jdk.httpclient.test.lib.common.HttpServerAdapters jdk.test.lib.net.SimpleSSLContext + * ReferenceTracker * @run testng/othervm -Djdk.internal.httpclient.debug=true * -Djdk.httpclient.HttpClient.log=requests,responses,errors * ISO_8859_1_Test @@ -81,6 +77,9 @@ import java.util.stream.LongStream; import java.util.stream.Stream; import javax.net.ssl.SSLContext; +import jdk.httpclient.test.lib.common.HttpServerAdapters; +import jdk.httpclient.test.lib.http2.Http2TestServer; + import com.sun.net.httpserver.HttpServer; import com.sun.net.httpserver.HttpsConfigurator; import com.sun.net.httpserver.HttpsServer; diff --git a/test/jdk/java/net/httpclient/ImmutableFlowItems.java b/test/jdk/java/net/httpclient/ImmutableFlowItems.java index 9a22a34bfe0..d917d178538 100644 --- a/test/jdk/java/net/httpclient/ImmutableFlowItems.java +++ b/test/jdk/java/net/httpclient/ImmutableFlowItems.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2023, 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 @@ -25,12 +25,8 @@ * @test * @summary Tests response body subscribers's onNext's Lists are unmodifiable, * and that the buffers are read-only - * @library /test/lib http2/server - * @build jdk.test.lib.net.SimpleSSLContext - * @modules java.base/sun.net.www.http - * java.net.http/jdk.internal.net.http.common - * java.net.http/jdk.internal.net.http.frame - * java.net.http/jdk.internal.net.http.hpack + * @library /test/lib /test/jdk/java/net/httpclient/lib + * @build jdk.test.lib.net.SimpleSSLContext jdk.httpclient.test.lib.http2.Http2TestServer * @run testng/othervm ImmutableFlowItems */ @@ -57,6 +53,9 @@ import java.net.http.HttpResponse.BodyHandler; import java.net.http.HttpResponse.BodySubscriber; import java.net.http.HttpResponse.BodySubscribers; import javax.net.ssl.SSLContext; +import jdk.httpclient.test.lib.http2.Http2TestServer; +import jdk.httpclient.test.lib.http2.Http2TestExchange; +import jdk.httpclient.test.lib.http2.Http2Handler; import jdk.test.lib.net.SimpleSSLContext; import org.testng.annotations.AfterTest; import org.testng.annotations.BeforeTest; diff --git a/test/jdk/java/net/httpclient/InvalidInputStreamSubscriptionRequest.java b/test/jdk/java/net/httpclient/InvalidInputStreamSubscriptionRequest.java index 1a7791f336a..e4f4063dbf0 100644 --- a/test/jdk/java/net/httpclient/InvalidInputStreamSubscriptionRequest.java +++ b/test/jdk/java/net/httpclient/InvalidInputStreamSubscriptionRequest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2023, 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 @@ -26,12 +26,9 @@ * @summary Tests an asynchronous BodySubscriber that completes * immediately with an InputStream which issues bad * requests - * @library /test/lib http2/server + * @library /test/lib /test/jdk/java/net/httpclient/lib * @build jdk.test.lib.net.SimpleSSLContext ReferenceTracker - * @modules java.base/sun.net.www.http - * java.net.http/jdk.internal.net.http.common - * java.net.http/jdk.internal.net.http.frame - * java.net.http/jdk.internal.net.http.hpack + * jdk.httpclient.test.lib.common.HttpServerAdapters * @run testng/othervm InvalidInputStreamSubscriptionRequest */ @@ -73,6 +70,8 @@ import java.util.concurrent.Flow; import java.util.concurrent.Flow.Publisher; import java.util.concurrent.atomic.AtomicLong; import java.util.function.Supplier; +import jdk.httpclient.test.lib.common.HttpServerAdapters; +import jdk.httpclient.test.lib.http2.Http2TestServer; import static java.lang.System.out; import static java.nio.charset.StandardCharsets.UTF_8; diff --git a/test/jdk/java/net/httpclient/InvalidSubscriptionRequest.java b/test/jdk/java/net/httpclient/InvalidSubscriptionRequest.java index adcf169730c..fdd39e702ec 100644 --- a/test/jdk/java/net/httpclient/InvalidSubscriptionRequest.java +++ b/test/jdk/java/net/httpclient/InvalidSubscriptionRequest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2023, 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 @@ -27,12 +27,9 @@ * @summary Tests an asynchronous BodySubscriber that completes * immediately with a Publisher> whose * subscriber issues bad requests - * @library /test/lib http2/server + * @library /test/lib /test/jdk/java/net/httpclient/lib * @build jdk.test.lib.net.SimpleSSLContext ReferenceTracker - * @modules java.base/sun.net.www.http - * java.net.http/jdk.internal.net.http.common - * java.net.http/jdk.internal.net.http.frame - * java.net.http/jdk.internal.net.http.hpack + * jdk.httpclient.test.lib.common.HttpServerAdapters * @run testng/othervm InvalidSubscriptionRequest */ @@ -71,6 +68,9 @@ import java.util.concurrent.Flow; import java.util.concurrent.Flow.Publisher; import java.util.function.Supplier; +import jdk.httpclient.test.lib.common.HttpServerAdapters; +import jdk.httpclient.test.lib.http2.Http2TestServer; + import static java.lang.System.out; import static java.nio.charset.StandardCharsets.UTF_8; import static org.testng.Assert.assertEquals; diff --git a/test/jdk/java/net/httpclient/LargeHandshakeTest.java b/test/jdk/java/net/httpclient/LargeHandshakeTest.java index 2c798012efa..0bc9a46f8cd 100644 --- a/test/jdk/java/net/httpclient/LargeHandshakeTest.java +++ b/test/jdk/java/net/httpclient/LargeHandshakeTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2023, 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 @@ -60,6 +60,8 @@ import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicLong; +import jdk.httpclient.test.lib.common.HttpServerAdapters; +import jdk.httpclient.test.lib.http2.Http2TestServer; /** * @test @@ -75,15 +77,9 @@ import java.util.concurrent.atomic.AtomicLong; * as first argument, and copy paste the new values of the COMMAND and * BASE64_CERT constant printed by the test into the test. * Then restore the original at run line and test again. - * @library /test/lib http2/server - * @build jdk.test.lib.net.SimpleSSLContext HttpServerAdapters DigestEchoServer LargeHandshakeTest - * @modules java.net.http/jdk.internal.net.http.common - * java.net.http/jdk.internal.net.http.frame - * java.net.http/jdk.internal.net.http.hpack - * java.logging - * java.base/sun.net.www.http - * java.base/sun.net.www - * java.base/sun.net + * @library /test/lib /test/jdk/java/net/httpclient/lib + * @build jdk.httpclient.test.lib.common.HttpServerAdapters jdk.test.lib.net.SimpleSSLContext + * DigestEchoServer * @run main/othervm -Dtest.requiresHost=true * -Djdk.httpclient.HttpClient.log=headers * -Djdk.internal.httpclient.debug=true diff --git a/test/jdk/java/net/httpclient/LargeResponseTest.java b/test/jdk/java/net/httpclient/LargeResponseTest.java index 6dd7ca3479f..cafe061d913 100644 --- a/test/jdk/java/net/httpclient/LargeResponseTest.java +++ b/test/jdk/java/net/httpclient/LargeResponseTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2023, 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 @@ -50,6 +50,8 @@ import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicLong; +import jdk.httpclient.test.lib.common.HttpServerAdapters; +import jdk.httpclient.test.lib.http2.Http2TestServer; /** * @test @@ -57,15 +59,9 @@ import java.util.concurrent.atomic.AtomicLong; * @summary This test verifies that the HttpClient works correctly when the server * sends large amount of data. Note that this test will pass even without * the fix for JDK-8231449, which is unfortunate. - * @library /test/lib http2/server - * @build jdk.test.lib.net.SimpleSSLContext HttpServerAdapters DigestEchoServer LargeResponseTest - * @modules java.net.http/jdk.internal.net.http.common - * java.net.http/jdk.internal.net.http.frame - * java.net.http/jdk.internal.net.http.hpack - * java.logging - * java.base/sun.net.www.http - * java.base/sun.net.www - * java.base/sun.net + * @library /test/lib /test/jdk/java/net/httpclient/lib + * @build jdk.httpclient.test.lib.common.HttpServerAdapters + * jdk.test.lib.net.SimpleSSLContext DigestEchoServer * @run main/othervm -Dtest.requiresHost=true * -Djdk.httpclient.HttpClient.log=headers * -Djdk.internal.httpclient.debug=true diff --git a/test/jdk/java/net/httpclient/LineBodyHandlerTest.java b/test/jdk/java/net/httpclient/LineBodyHandlerTest.java index 10717a848bd..6ce010d5327 100644 --- a/test/jdk/java/net/httpclient/LineBodyHandlerTest.java +++ b/test/jdk/java/net/httpclient/LineBodyHandlerTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2023, 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 @@ -54,6 +54,8 @@ import java.util.function.Supplier; import java.util.stream.Collectors; import java.util.stream.Stream; import javax.net.ssl.SSLContext; +import jdk.httpclient.test.lib.common.HttpServerAdapters; +import jdk.httpclient.test.lib.http2.Http2TestServer; import com.sun.net.httpserver.HttpServer; import com.sun.net.httpserver.HttpsConfigurator; import com.sun.net.httpserver.HttpsServer; @@ -77,15 +79,9 @@ import static org.testng.Assert.assertTrue; * the BodyHandlers returned by BodyHandler::fromLineSubscriber * and BodyHandler::asLines * @bug 8256459 - * @modules java.base/sun.net.www.http - * java.net.http/jdk.internal.net.http.common - * java.net.http/jdk.internal.net.http.frame - * java.net.http/jdk.internal.net.http.hpack - * java.logging - * jdk.httpserver - * @library /test/lib http2/server - * @build Http2TestServer LineBodyHandlerTest HttpServerAdapters ReferenceTracker - * @build jdk.test.lib.net.SimpleSSLContext + * @library /test/lib /test/jdk/java/net/httpclient/lib + * @build ReferenceTracker jdk.httpclient.test.lib.http2.Http2TestServer + * jdk.test.lib.net.SimpleSSLContext * @run testng/othervm -XX:+UnlockDiagnosticVMOptions -XX:DiagnoseSyncOnValueBasedClasses=1 LineBodyHandlerTest */ diff --git a/test/jdk/java/net/httpclient/MappingResponseSubscriber.java b/test/jdk/java/net/httpclient/MappingResponseSubscriber.java index b7e6f67564e..8ae7b5d85dc 100644 --- a/test/jdk/java/net/httpclient/MappingResponseSubscriber.java +++ b/test/jdk/java/net/httpclient/MappingResponseSubscriber.java @@ -24,12 +24,8 @@ /* * @test * @summary Tests mapped response subscriber - * @library /test/lib http2/server - * @build jdk.test.lib.net.SimpleSSLContext - * @modules java.base/sun.net.www.http - * java.net.http/jdk.internal.net.http.common - * java.net.http/jdk.internal.net.http.frame - * java.net.http/jdk.internal.net.http.hpack + * @library /test/lib /test/jdk/java/net/httpclient/lib + * @build jdk.test.lib.net.SimpleSSLContext jdk.httpclient.test.lib.http2.Http2TestServer * @run testng/othervm * -Djdk.internal.httpclient.debug=true * MappingResponseSubscriber @@ -64,6 +60,9 @@ import java.util.function.Function; import javax.net.ssl.SSLContext; import jdk.internal.net.http.common.OperationTrackers.Tracker; +import jdk.httpclient.test.lib.http2.Http2TestServer; +import jdk.httpclient.test.lib.http2.Http2TestExchange; +import jdk.httpclient.test.lib.http2.Http2Handler; import jdk.test.lib.net.SimpleSSLContext; import org.testng.annotations.AfterTest; import org.testng.annotations.BeforeTest; diff --git a/test/jdk/java/net/httpclient/MaxStreams.java b/test/jdk/java/net/httpclient/MaxStreams.java index 191a3a2d697..0a4afd7bb7d 100644 --- a/test/jdk/java/net/httpclient/MaxStreams.java +++ b/test/jdk/java/net/httpclient/MaxStreams.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2023, 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 @@ -25,16 +25,8 @@ * @test * @bug 8196389 * @summary Should HttpClient support SETTINGS_MAX_CONCURRENT_STREAMS from the server - * - * @modules java.base/sun.net.www.http - * java.net.http/jdk.internal.net.http.common - * java.net.http/jdk.internal.net.http.frame - * java.net.http/jdk.internal.net.http.hpack - * java.logging - * jdk.httpserver - * @library /test/lib http2/server - * @build Http2TestServer - * @build jdk.test.lib.net.SimpleSSLContext + * @library /test/lib /test/jdk/java/net/httpclient/lib + * @build jdk.httpclient.test.lib.http2.Http2TestServer jdk.test.lib.net.SimpleSSLContext * @run testng/othervm -ea -esa MaxStreams */ @@ -60,6 +52,9 @@ import java.net.http.HttpRequest; import java.net.http.HttpResponse; import java.net.http.HttpResponse.BodyHandler; import java.net.http.HttpResponse.BodyHandlers; +import jdk.httpclient.test.lib.http2.Http2TestServer; +import jdk.httpclient.test.lib.http2.Http2TestExchange; +import jdk.httpclient.test.lib.http2.Http2Handler; import jdk.test.lib.net.SimpleSSLContext; import org.testng.annotations.AfterTest; import org.testng.annotations.BeforeTest; diff --git a/test/jdk/java/net/httpclient/NoBodyPartOne.java b/test/jdk/java/net/httpclient/NoBodyPartOne.java index 66aaa2fc0e0..1edd9c9655b 100644 --- a/test/jdk/java/net/httpclient/NoBodyPartOne.java +++ b/test/jdk/java/net/httpclient/NoBodyPartOne.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2023, 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 @@ -25,12 +25,8 @@ * @test * @bug 8161157 * @summary Test response body handlers/subscribers when there is no body - * @library /test/lib http2/server - * @build jdk.test.lib.net.SimpleSSLContext - * @modules java.base/sun.net.www.http - * java.net.http/jdk.internal.net.http.common - * java.net.http/jdk.internal.net.http.frame - * java.net.http/jdk.internal.net.http.hpack + * @library /test/lib /test/jdk/java/net/httpclient/lib + * @build jdk.test.lib.net.SimpleSSLContext jdk.httpclient.test.lib.http2.Http2TestServer * @run testng/othervm * -Djdk.internal.httpclient.debug=true * -Djdk.httpclient.HttpClient.log=all diff --git a/test/jdk/java/net/httpclient/NoBodyPartTwo.java b/test/jdk/java/net/httpclient/NoBodyPartTwo.java index ba4843e2901..67d7f2bcb88 100644 --- a/test/jdk/java/net/httpclient/NoBodyPartTwo.java +++ b/test/jdk/java/net/httpclient/NoBodyPartTwo.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2023, 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 @@ -25,12 +25,8 @@ * @test * @bug 8161157 * @summary Test response body handlers/subscribers when there is no body - * @library /test/lib http2/server - * @build jdk.test.lib.net.SimpleSSLContext - * @modules java.base/sun.net.www.http - * java.net.http/jdk.internal.net.http.common - * java.net.http/jdk.internal.net.http.frame - * java.net.http/jdk.internal.net.http.hpack + * @library /test/lib /test/jdk/java/net/httpclient/lib + * @build jdk.test.lib.net.SimpleSSLContext jdk.httpclient.test.lib.http2.Http2TestServer * @run testng/othervm * -Djdk.internal.httpclient.debug=true * -Djdk.httpclient.HttpClient.log=all diff --git a/test/jdk/java/net/httpclient/NonAsciiCharsInURI.java b/test/jdk/java/net/httpclient/NonAsciiCharsInURI.java index e3701a826f2..256d002b742 100644 --- a/test/jdk/java/net/httpclient/NonAsciiCharsInURI.java +++ b/test/jdk/java/net/httpclient/NonAsciiCharsInURI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2023, 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 @@ -26,15 +26,8 @@ * @summary Verify that non-US-ASCII chars are replaced with a sequence of * escaped octets that represent that char in the UTF-8 character set. * @bug 8201238 - * @modules java.base/sun.net.www.http - * java.net.http/jdk.internal.net.http.common - * java.net.http/jdk.internal.net.http.frame - * java.net.http/jdk.internal.net.http.hpack - * java.logging - * jdk.httpserver - * @library /test/lib http2/server - * @build Http2TestServer - * @build jdk.test.lib.net.SimpleSSLContext + * @library /test/lib /test/jdk/java/net/httpclient/lib + * @build jdk.httpclient.test.lib.http2.Http2TestServer jdk.test.lib.net.SimpleSSLContext * @compile -encoding utf-8 NonAsciiCharsInURI.java * @run testng/othervm * -Djdk.httpclient.HttpClient.log=reqeusts,headers @@ -58,6 +51,8 @@ import java.net.http.HttpResponse.BodyHandlers; import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import jdk.httpclient.test.lib.common.HttpServerAdapters; +import jdk.httpclient.test.lib.http2.Http2TestServer; import jdk.test.lib.net.SimpleSSLContext; import org.testng.annotations.AfterTest; import org.testng.annotations.BeforeTest; diff --git a/test/jdk/java/net/httpclient/PathSubscriber/BodyHandlerOfFileDownloadTest.java b/test/jdk/java/net/httpclient/PathSubscriber/BodyHandlerOfFileDownloadTest.java index f95beec3ddc..4092457ab54 100644 --- a/test/jdk/java/net/httpclient/PathSubscriber/BodyHandlerOfFileDownloadTest.java +++ b/test/jdk/java/net/httpclient/PathSubscriber/BodyHandlerOfFileDownloadTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2023, 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 @@ -26,18 +26,17 @@ * @bug 8237470 * @summary Confirm HttpResponse.BodySubscribers#ofFileDownload(Path) * works only with the default file system - * @modules java.base/sun.net.www.http - * java.net.http/jdk.internal.net.http.common - * java.net.http/jdk.internal.net.http.frame - * java.net.http/jdk.internal.net.http.hpack - * jdk.httpserver - * @library /test/lib ../http2/server - * @build Http2TestServer Http2TestServerConnection Http2TestExchange - * Http2Handler OutgoingPushPromise Queue - * @build jdk.test.lib.net.SimpleSSLContext - * @build jdk.test.lib.Platform - * @build jdk.test.lib.util.FileUtils - * @compile ../HttpServerAdapters.java + * @library /test/lib /test/jdk/java/net/httpclient/lib + * @build jdk.httpclient.test.lib.common.HttpServerAdapters + * jdk.httpclient.test.lib.http2.Http2TestServer + * jdk.httpclient.test.lib.http2.Http2TestServerConnection + * jdk.httpclient.test.lib.http2.Http2TestExchange + * jdk.httpclient.test.lib.http2.Http2Handler + * jdk.httpclient.test.lib.http2.OutgoingPushPromise + * jdk.httpclient.test.lib.http2.Queue + * jdk.test.lib.net.SimpleSSLContext + * jdk.test.lib.Platform + * jdk.test.lib.util.FileUtils * @run testng/othervm BodyHandlerOfFileDownloadTest * @run testng/othervm/java.security.policy=ofFileDownload.policy BodyHandlerOfFileDownloadTest */ @@ -69,7 +68,13 @@ import java.nio.file.FileSystems; import java.nio.file.Files; import java.nio.file.Path; import java.util.Map; - +import jdk.httpclient.test.lib.common.HttpServerAdapters; +import jdk.httpclient.test.lib.http2.Http2TestServer; +import jdk.httpclient.test.lib.http2.Http2TestServerConnection; +import jdk.httpclient.test.lib.http2.Http2TestExchange; +import jdk.httpclient.test.lib.http2.Http2Handler; +import jdk.httpclient.test.lib.http2.OutgoingPushPromise; +import jdk.httpclient.test.lib.http2.Queue; import static java.lang.System.out; import static java.net.http.HttpClient.Builder.NO_PROXY; import static java.nio.file.StandardOpenOption.CREATE; diff --git a/test/jdk/java/net/httpclient/PathSubscriber/BodyHandlerOfFileTest.java b/test/jdk/java/net/httpclient/PathSubscriber/BodyHandlerOfFileTest.java index 3535df14c7f..bac6738669f 100644 --- a/test/jdk/java/net/httpclient/PathSubscriber/BodyHandlerOfFileTest.java +++ b/test/jdk/java/net/httpclient/PathSubscriber/BodyHandlerOfFileTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2023, 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 @@ -27,18 +27,16 @@ * @summary Confirm HttpResponse.BodyHandlers#ofFile(Path) * works with default and non-default file systems * when SecurityManager is enabled - * @modules java.base/sun.net.www.http - * java.net.http/jdk.internal.net.http.common - * java.net.http/jdk.internal.net.http.frame - * java.net.http/jdk.internal.net.http.hpack - * jdk.httpserver - * @library /test/lib ../http2/server - * @build Http2TestServer Http2TestServerConnection Http2TestExchange - * Http2Handler OutgoingPushPromise Queue - * @build jdk.test.lib.net.SimpleSSLContext - * @build jdk.test.lib.Platform - * @build jdk.test.lib.util.FileUtils - * @compile ../HttpServerAdapters.java + * @library /test/lib /test/jdk/java/net/httpclient/lib + * @build jdk.httpclient.test.lib.common.HttpServerAdapters + * jdk.httpclient.test.lib.http2.Http2TestServer + * jdk.httpclient.test.lib.http2.Http2TestServerConnection + * jdk.httpclient.test.lib.http2.Http2TestExchange + * jdk.httpclient.test.lib.http2.Http2Handler + * jdk.httpclient.test.lib.http2.OutgoingPushPromise + * jdk.httpclient.test.lib.http2.Queue + * jdk.test.lib.net.SimpleSSLContext + * jdk.test.lib.Platform jdk.test.lib.util.FileUtils * @run testng/othervm BodyHandlerOfFileTest * @run testng/othervm/java.security.policy=ofFile.policy BodyHandlerOfFileTest */ @@ -67,7 +65,13 @@ import java.net.http.HttpResponse; import java.nio.charset.StandardCharsets; import java.nio.file.*; import java.util.Map; - +import jdk.httpclient.test.lib.common.HttpServerAdapters; +import jdk.httpclient.test.lib.http2.Http2TestServer; +import jdk.httpclient.test.lib.http2.Http2TestServerConnection; +import jdk.httpclient.test.lib.http2.Http2TestExchange; +import jdk.httpclient.test.lib.http2.Http2Handler; +import jdk.httpclient.test.lib.http2.OutgoingPushPromise; +import jdk.httpclient.test.lib.http2.Queue; import static java.lang.System.out; import static java.net.http.HttpClient.Builder.NO_PROXY; import static org.testng.Assert.assertEquals; diff --git a/test/jdk/java/net/httpclient/PathSubscriber/BodySubscriberOfFileTest.java b/test/jdk/java/net/httpclient/PathSubscriber/BodySubscriberOfFileTest.java index 7f361b8cf52..4b3537b65e6 100644 --- a/test/jdk/java/net/httpclient/PathSubscriber/BodySubscriberOfFileTest.java +++ b/test/jdk/java/net/httpclient/PathSubscriber/BodySubscriberOfFileTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2023, 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 @@ -27,18 +27,15 @@ * @summary Confirm HttpResponse.BodySubscribers#ofFile(Path) * works with default and non-default file systems * when SecurityManager is enabled - * @modules java.base/sun.net.www.http - * java.net.http/jdk.internal.net.http.common - * java.net.http/jdk.internal.net.http.frame - * java.net.http/jdk.internal.net.http.hpack - * jdk.httpserver - * @library /test/lib ../http2/server - * @build Http2TestServer Http2TestServerConnection Http2TestExchange - * Http2Handler OutgoingPushPromise Queue - * @build jdk.test.lib.net.SimpleSSLContext - * @build jdk.test.lib.Platform - * @build jdk.test.lib.util.FileUtils - * @compile ../HttpServerAdapters.java + * @library /test/lib /test/jdk/java/net/httpclient/lib + * @build jdk.httpclient.test.lib.common.HttpServerAdapters + * jdk.httpclient.test.lib.http2.Http2TestServer + * jdk.httpclient.test.lib.http2.Http2TestServerConnection + * jdk.httpclient.test.lib.http2.Http2TestExchange + * jdk.httpclient.test.lib.http2.Http2Handler + * jdk.httpclient.test.lib.http2.OutgoingPushPromise + * jdk.httpclient.test.lib.http2.Queue jdk.test.lib.net.SimpleSSLContext + * jdk.test.lib.Platform jdk.test.lib.util.FileUtils * @run testng/othervm BodySubscriberOfFileTest * @run testng/othervm/java.security.policy=ofFile.policy BodySubscriberOfFileTest */ @@ -75,7 +72,13 @@ import java.security.PrivilegedAction; import java.util.Map; import java.util.concurrent.Flow; import java.util.stream.IntStream; - +import jdk.httpclient.test.lib.common.HttpServerAdapters; +import jdk.httpclient.test.lib.http2.Http2TestServer; +import jdk.httpclient.test.lib.http2.Http2TestServerConnection; +import jdk.httpclient.test.lib.http2.Http2TestExchange; +import jdk.httpclient.test.lib.http2.Http2Handler; +import jdk.httpclient.test.lib.http2.OutgoingPushPromise; +import jdk.httpclient.test.lib.http2.Queue; import static java.lang.System.out; import static java.net.http.HttpClient.Builder.NO_PROXY; import static org.testng.Assert.assertEquals; diff --git a/test/jdk/java/net/httpclient/PathSubscriber/ofFile.policy b/test/jdk/java/net/httpclient/PathSubscriber/ofFile.policy index c5df09ae865..e1091636760 100644 --- a/test/jdk/java/net/httpclient/PathSubscriber/ofFile.policy +++ b/test/jdk/java/net/httpclient/PathSubscriber/ofFile.policy @@ -1,5 +1,5 @@ // -// Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. +// Copyright (c) 2020, 2023, 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 @@ -38,8 +38,8 @@ grant codeBase "file:${test.classes}/../../../../../test/lib/-" { permission java.io.FilePermission "${user.dir}${/}defaultDir", "delete"; }; -// for java/net/httpclient/http2/server/* -grant codeBase "file:${test.classes}/../../../../../java/net/httpclient/http2/server/*" { +// for jdk/httpclient/test/lib/* classes +grant codeBase "file:${test.classes}/../../../../../test/jdk/java/net/httpclient/lib/-" { permission java.lang.RuntimePermission "accessClassInPackage.jdk.internal.net.http.common"; permission java.lang.RuntimePermission "accessClassInPackage.jdk.internal.net.http.frame"; permission java.lang.RuntimePermission "accessClassInPackage.jdk.internal.net.http.hpack"; diff --git a/test/jdk/java/net/httpclient/PathSubscriber/ofFileDownload.policy b/test/jdk/java/net/httpclient/PathSubscriber/ofFileDownload.policy index a9dc8816241..46daeb00453 100644 --- a/test/jdk/java/net/httpclient/PathSubscriber/ofFileDownload.policy +++ b/test/jdk/java/net/httpclient/PathSubscriber/ofFileDownload.policy @@ -1,5 +1,5 @@ // -// Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. +// Copyright (c) 2020, 2023, 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 @@ -38,8 +38,8 @@ grant codeBase "file:${test.classes}/../../../../../test/lib/-" { permission java.io.FilePermission "${user.dir}${/}defaultDir/*", "read,delete"; }; -// for java/net/httpclient/http2/server/* -grant codeBase "file:${test.classes}/../../../../../java/net/httpclient/http2/server/*" { +// for jdk/httpclient/test/lib/* classes +grant codeBase "file:${test.classes}/../../../../../test/jdk/java/net/httpclient/lib/-" { permission java.lang.RuntimePermission "accessClassInPackage.jdk.internal.net.http.common"; permission java.lang.RuntimePermission "accessClassInPackage.jdk.internal.net.http.frame"; permission java.lang.RuntimePermission "accessClassInPackage.jdk.internal.net.http.hpack"; diff --git a/test/jdk/java/net/httpclient/ProxyAuthDisabledSchemes.java b/test/jdk/java/net/httpclient/ProxyAuthDisabledSchemes.java index 4de6a295a96..5776e240ba8 100644 --- a/test/jdk/java/net/httpclient/ProxyAuthDisabledSchemes.java +++ b/test/jdk/java/net/httpclient/ProxyAuthDisabledSchemes.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2023, 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 @@ -28,16 +28,10 @@ * it verifies that the client honor the jdk.http.auth.*.disabledSchemes * net properties. * @bug 8087112 - * @library /test/lib http2/server + * @library /test/lib /test/jdk/java/net/httpclient/lib * @build jdk.test.lib.net.SimpleSSLContext DigestEchoServer DigestEchoClient * ReferenceTracker ProxyAuthDisabledSchemes - * @modules java.net.http/jdk.internal.net.http.common - * java.net.http/jdk.internal.net.http.frame - * java.net.http/jdk.internal.net.http.hpack - * java.logging - * java.base/sun.net.www.http - * java.base/sun.net.www - * java.base/sun.net + * jdk.httpclient.test.lib.common.HttpServerAdapters * @run main/othervm -Djdk.http.auth.proxying.disabledSchemes=Basic,Digest * -Djdk.http.auth.tunneling.disabledSchemes=Digest,Basic * ProxyAuthDisabledSchemes diff --git a/test/jdk/java/net/httpclient/ProxyAuthDisabledSchemesSSL.java b/test/jdk/java/net/httpclient/ProxyAuthDisabledSchemesSSL.java index e9bb6f8d98f..f0eb63f2a40 100644 --- a/test/jdk/java/net/httpclient/ProxyAuthDisabledSchemesSSL.java +++ b/test/jdk/java/net/httpclient/ProxyAuthDisabledSchemesSSL.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2023, 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 @@ -28,16 +28,10 @@ * headers directly when connecting with a server over SSL, and * it verifies that the client honor the jdk.http.auth.*.disabledSchemes * net properties. - * @library /test/lib http2/server + * @library /test/lib /test/jdk/java/net/httpclient/lib * @build jdk.test.lib.net.SimpleSSLContext DigestEchoServer DigestEchoClient * ReferenceTracker ProxyAuthDisabledSchemesSSL - * @modules java.net.http/jdk.internal.net.http.common - * java.net.http/jdk.internal.net.http.frame - * java.net.http/jdk.internal.net.http.hpack - * java.logging - * java.base/sun.net.www.http - * java.base/sun.net.www - * java.base/sun.net + * jdk.httpclient.test.lib.common.HttpServerAdapters * @run main/othervm/timeout=300 * -Djdk.http.auth.proxying.disabledSchemes=Basic,Digest * -Djdk.http.auth.tunneling.disabledSchemes=Digest,Basic diff --git a/test/jdk/java/net/httpclient/ProxySelectorTest.java b/test/jdk/java/net/httpclient/ProxySelectorTest.java index 7b4a3c8ed43..54cfab7fbef 100644 --- a/test/jdk/java/net/httpclient/ProxySelectorTest.java +++ b/test/jdk/java/net/httpclient/ProxySelectorTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2023, 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 @@ -26,18 +26,9 @@ * @bug 8244205 * @summary checks that a different proxy returned for * the same host:port is taken into account - * @modules java.base/sun.net.www.http - * java.net.http/jdk.internal.net.http.common - * java.net.http/jdk.internal.net.http.frame - * java.net.http/jdk.internal.net.http.hpack - * java.logging - * jdk.httpserver - * java.base/sun.net.www.http - * java.base/sun.net.www - * java.base/sun.net - * @library /test/lib http2/server - * @build HttpServerAdapters DigestEchoServer Http2TestServer ProxySelectorTest - * @build jdk.test.lib.net.SimpleSSLContext + * @library /test/lib /test/jdk/java/net/httpclient/lib + * @build DigestEchoServer ProxySelectorTest jdk.httpclient.test.lib.http2.Http2TestServer + * jdk.test.lib.net.SimpleSSLContext * @run testng/othervm * -Djdk.http.auth.tunneling.disabledSchemes * -Djdk.httpclient.HttpClient.log=headers,requests @@ -83,6 +74,8 @@ import java.util.concurrent.Executors; import java.util.concurrent.atomic.AtomicLong; import java.util.concurrent.atomic.AtomicReference; import java.util.stream.Collectors; +import jdk.httpclient.test.lib.common.HttpServerAdapters; +import jdk.httpclient.test.lib.http2.Http2TestServer; import static java.lang.System.err; import static java.lang.System.out; diff --git a/test/jdk/java/net/httpclient/RedirectMethodChange.java b/test/jdk/java/net/httpclient/RedirectMethodChange.java index c5d4aef8676..a1cef63bf0b 100644 --- a/test/jdk/java/net/httpclient/RedirectMethodChange.java +++ b/test/jdk/java/net/httpclient/RedirectMethodChange.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2023, 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 @@ -24,14 +24,8 @@ /* * @test * @summary Method change during redirection - * @modules java.base/sun.net.www.http - * java.net.http/jdk.internal.net.http.common - * java.net.http/jdk.internal.net.http.frame - * java.net.http/jdk.internal.net.http.hpack - * jdk.httpserver - * @library /test/lib http2/server - * @build Http2TestServer - * @build jdk.test.lib.net.SimpleSSLContext + * @library /test/lib /test/jdk/java/net/httpclient/lib + * @build jdk.httpclient.test.lib.http2.Http2TestServer jdk.test.lib.net.SimpleSSLContext * @run testng/othervm RedirectMethodChange */ @@ -50,6 +44,8 @@ import java.net.http.HttpResponse.BodyHandlers; import com.sun.net.httpserver.HttpServer; import com.sun.net.httpserver.HttpsConfigurator; import com.sun.net.httpserver.HttpsServer; +import jdk.httpclient.test.lib.common.HttpServerAdapters; +import jdk.httpclient.test.lib.http2.Http2TestServer; import jdk.test.lib.net.SimpleSSLContext; import org.testng.annotations.AfterTest; import org.testng.annotations.BeforeTest; diff --git a/test/jdk/java/net/httpclient/RedirectWithCookie.java b/test/jdk/java/net/httpclient/RedirectWithCookie.java index 14d971b9165..b25f4e17670 100644 --- a/test/jdk/java/net/httpclient/RedirectWithCookie.java +++ b/test/jdk/java/net/httpclient/RedirectWithCookie.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2023, 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 @@ -24,15 +24,8 @@ /* * @test * @summary Test for cookie handling when redirecting - * @modules java.base/sun.net.www.http - * java.net.http/jdk.internal.net.http.common - * java.net.http/jdk.internal.net.http.frame - * java.net.http/jdk.internal.net.http.hpack - * java.logging - * jdk.httpserver - * @library /test/lib http2/server - * @build Http2TestServer - * @build jdk.test.lib.net.SimpleSSLContext + * @library /test/lib /test/jdk/java/net/httpclient/lib + * @build jdk.httpclient.test.lib.http2.Http2TestServer jdk.test.lib.net.SimpleSSLContext * @run testng/othervm * -Djdk.httpclient.HttpClient.log=trace,headers,requests * RedirectWithCookie @@ -55,6 +48,8 @@ import java.net.http.HttpResponse; import java.net.http.HttpResponse.BodyHandlers; import java.util.List; import javax.net.ssl.SSLContext; +import jdk.httpclient.test.lib.common.HttpServerAdapters; +import jdk.httpclient.test.lib.http2.Http2TestServer; import jdk.test.lib.net.SimpleSSLContext; import org.testng.annotations.AfterTest; import org.testng.annotations.BeforeTest; diff --git a/test/jdk/java/net/httpclient/Response1xxTest.java b/test/jdk/java/net/httpclient/Response1xxTest.java index b53c01943bf..dc8682236b0 100644 --- a/test/jdk/java/net/httpclient/Response1xxTest.java +++ b/test/jdk/java/net/httpclient/Response1xxTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2023, 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 @@ -37,7 +37,8 @@ import java.nio.charset.StandardCharsets; import java.time.Duration; import javax.net.ssl.SSLContext; - +import jdk.httpclient.test.lib.common.HttpServerAdapters; +import jdk.httpclient.test.lib.http2.Http2TestServer; import jdk.test.lib.net.SimpleSSLContext; import jdk.test.lib.net.URIBuilder; import org.testng.Assert; @@ -49,14 +50,9 @@ import org.testng.annotations.Test; * @test * @bug 8292044 * @summary Tests behaviour of HttpClient when server responds with 102 or 103 status codes - * @modules java.base/sun.net.www.http - * java.net.http/jdk.internal.net.http.common - * java.net.http/jdk.internal.net.http.frame - * java.net.http/jdk.internal.net.http.hpack - * java.logging - * jdk.httpserver - * @library /test/lib http2/server - * @build Http2TestServer HttpServerAdapters jdk.test.lib.net.SimpleSSLContext + * @library /test/lib /test/jdk/java/net/httpclient/lib + * @build jdk.test.lib.net.SimpleSSLContext jdk.httpclient.test.lib.common.HttpServerAdapters + * jdk.httpclient.test.lib.http2.Http2TestServer * @run testng/othervm -Djdk.internal.httpclient.debug=true * * -Djdk.httpclient.HttpClient.log=headers,requests,responses,errors Response1xxTest */ diff --git a/test/jdk/java/net/httpclient/Response204V2Test.java b/test/jdk/java/net/httpclient/Response204V2Test.java index 7711ba382ed..c72f1135a04 100644 --- a/test/jdk/java/net/httpclient/Response204V2Test.java +++ b/test/jdk/java/net/httpclient/Response204V2Test.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2023, 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 @@ -24,13 +24,9 @@ /* * @test * @bug 8238270 - * @library /test/lib http2/server - * @build jdk.test.lib.net.SimpleSSLContext HttpServerAdapters - * ReferenceTracker Response204V2Test - * @modules java.base/sun.net.www.http - * java.net.http/jdk.internal.net.http.common - * java.net.http/jdk.internal.net.http.frame - * java.net.http/jdk.internal.net.http.hpack + * @library /test/lib /test/jdk/java/net/httpclient/lib + * @build jdk.test.lib.net.SimpleSSLContext + * ReferenceTracker jdk.httpclient.test.lib.common.HttpServerAdapters * @run testng/othervm -Djdk.internal.httpclient.debug=true * -Djdk.httpclient.HttpClient.log=requests,responses,errors * Response204V2Test @@ -57,6 +53,8 @@ import java.util.concurrent.Executors; import java.util.concurrent.atomic.AtomicLong; import java.util.concurrent.atomic.AtomicReference; import java.util.stream.Collectors; +import jdk.httpclient.test.lib.common.HttpServerAdapters; +import jdk.httpclient.test.lib.http2.Http2TestServer; import jdk.test.lib.net.SimpleSSLContext; import org.testng.ITestContext; diff --git a/test/jdk/java/net/httpclient/ResponsePublisher.java b/test/jdk/java/net/httpclient/ResponsePublisher.java index 862b6c18043..97fa025ec1c 100644 --- a/test/jdk/java/net/httpclient/ResponsePublisher.java +++ b/test/jdk/java/net/httpclient/ResponsePublisher.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2023, 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 @@ -26,12 +26,8 @@ * @bug 8201186 * @summary Tests an asynchronous BodySubscriber that completes * immediately with a Publisher> - * @library /test/lib http2/server - * @build jdk.test.lib.net.SimpleSSLContext - * @modules java.base/sun.net.www.http - * java.net.http/jdk.internal.net.http.common - * java.net.http/jdk.internal.net.http.frame - * java.net.http/jdk.internal.net.http.hpack + * @library /test/lib /test/jdk/java/net/httpclient/lib + * @build jdk.test.lib.net.SimpleSSLContext jdk.httpclient.test.lib.common.HttpServerAdapters * @run testng/othervm ResponsePublisher */ @@ -73,6 +69,8 @@ import java.util.concurrent.Flow; import java.util.concurrent.Flow.Publisher; import java.util.concurrent.atomic.AtomicReference; import java.util.function.Supplier; +import jdk.httpclient.test.lib.common.HttpServerAdapters; +import jdk.httpclient.test.lib.http2.Http2TestServer; import static java.lang.System.out; import static java.nio.charset.StandardCharsets.UTF_8; diff --git a/test/jdk/java/net/httpclient/RetryWithCookie.java b/test/jdk/java/net/httpclient/RetryWithCookie.java index 9e7442412b7..57e5752a77e 100644 --- a/test/jdk/java/net/httpclient/RetryWithCookie.java +++ b/test/jdk/java/net/httpclient/RetryWithCookie.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2023, 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 @@ -25,15 +25,10 @@ * @test * @bug 8199943 * @summary Test for cookie handling when retrying after close - * @modules java.base/sun.net.www.http - * java.net.http/jdk.internal.net.http.common - * java.net.http/jdk.internal.net.http.frame - * java.net.http/jdk.internal.net.http.hpack - * java.logging - * jdk.httpserver - * @library /test/lib http2/server - * @build Http2TestServer - * @build jdk.test.lib.net.SimpleSSLContext ReferenceTracker + * @library /test/lib /test/jdk/java/net/httpclient/lib + * @build jdk.httpclient.test.lib.common.HttpServerAdapters + * jdk.httpclient.test.lib.http2.Http2TestServer jdk.test.lib.net.SimpleSSLContext + * ReferenceTracker * @run testng/othervm * -Djdk.httpclient.HttpClient.log=trace,headers,requests * RetryWithCookie @@ -67,6 +62,8 @@ import java.util.List; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.atomic.AtomicLong; +import jdk.httpclient.test.lib.common.HttpServerAdapters; +import jdk.httpclient.test.lib.http2.Http2TestServer; import static java.lang.System.out; import static java.net.http.HttpClient.Builder.NO_PROXY; diff --git a/test/jdk/java/net/httpclient/ServerCloseTest.java b/test/jdk/java/net/httpclient/ServerCloseTest.java index ac169fae68b..10fb8ca94d1 100644 --- a/test/jdk/java/net/httpclient/ServerCloseTest.java +++ b/test/jdk/java/net/httpclient/ServerCloseTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2023, 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 @@ -25,12 +25,9 @@ * @test * @summary Tests that our client deals correctly with servers that * close the connection right after sending the last byte. - * @library /test/lib http2/server - * @build jdk.test.lib.net.SimpleSSLContext HttpServerAdapters EncodedCharsInURI - * @modules java.base/sun.net.www.http - * java.net.http/jdk.internal.net.http.common - * java.net.http/jdk.internal.net.http.frame - * java.net.http/jdk.internal.net.http.hpack + * @library /test/lib /test/jdk/java/net/httpclient/lib + * @build jdk.test.lib.net.SimpleSSLContext + * jdk.httpclient.test.lib.common.HttpServerAdapters * @run testng/othervm -Djdk.tls.acknowledgeCloseNotify=true ServerCloseTest */ //* -Djdk.internal.httpclient.debug=true @@ -72,6 +69,8 @@ import java.util.concurrent.ConcurrentMap; import java.util.concurrent.Executor; import java.util.concurrent.Executors; import java.util.concurrent.atomic.AtomicLong; +import jdk.httpclient.test.lib.common.HttpServerAdapters; +import jdk.httpclient.test.lib.http2.Http2TestServer; import static java.lang.System.out; import static java.nio.charset.StandardCharsets.UTF_8; diff --git a/test/jdk/java/net/httpclient/SpecialHeadersTest.java b/test/jdk/java/net/httpclient/SpecialHeadersTest.java index 3ed4c4b035a..d5a51d355fe 100644 --- a/test/jdk/java/net/httpclient/SpecialHeadersTest.java +++ b/test/jdk/java/net/httpclient/SpecialHeadersTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2023, 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 @@ -26,15 +26,10 @@ * @summary Verify that some special headers - such as User-Agent * can be specified by the caller. * @bug 8203771 8218546 8297200 - * @modules java.base/sun.net.www.http - * java.net.http/jdk.internal.net.http.common - * java.net.http/jdk.internal.net.http.frame - * java.net.http/jdk.internal.net.http.hpack - * java.logging - * jdk.httpserver - * @library /test/lib http2/server - * @build Http2TestServer HttpServerAdapters SpecialHeadersTest - * @build jdk.test.lib.net.SimpleSSLContext + * @library /test/lib /test/jdk/java/net/httpclient/lib + * @build jdk.httpclient.test.lib.common.HttpServerAdapters + * jdk.httpclient.test.lib.http2.Http2TestServer + * jdk.test.lib.net.SimpleSSLContext * @run testng/othervm * -Djdk.httpclient.HttpClient.log=requests,headers,errors * SpecialHeadersTest @@ -88,6 +83,8 @@ import java.util.concurrent.atomic.AtomicLong; import java.util.concurrent.atomic.AtomicReference; import java.util.function.Function; import java.util.stream.Collectors; +import jdk.httpclient.test.lib.common.HttpServerAdapters; +import jdk.httpclient.test.lib.http2.Http2TestServer; import static java.lang.System.err; import static java.lang.System.out; diff --git a/test/jdk/java/net/httpclient/StreamCloseTest.java b/test/jdk/java/net/httpclient/StreamCloseTest.java index d42fb0bb05c..c207539a396 100644 --- a/test/jdk/java/net/httpclient/StreamCloseTest.java +++ b/test/jdk/java/net/httpclient/StreamCloseTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2023, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2021, NTT DATA. * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -26,14 +26,9 @@ /* * @test * @bug 8257736 - * @modules java.net.http - * java.base/sun.net.www.http - * java.net.http/jdk.internal.net.http.common - * java.net.http/jdk.internal.net.http.frame - * java.net.http/jdk.internal.net.http.hpack - * @library http2/server - * @build Http2TestServer Http2TestExchange - * @compile HttpServerAdapters.java + * @library /test/jdk/java/net/httpclient/lib + * @build jdk.httpclient.test.lib.common.HttpServerAdapters + * jdk.httpclient.test.lib.http2.Http2TestServer * @run testng/othervm StreamCloseTest */ @@ -50,6 +45,8 @@ import java.net.http.HttpResponse.BodyHandlers; import java.net.InetAddress; import java.net.InetSocketAddress; import java.net.URI; +import jdk.httpclient.test.lib.common.HttpServerAdapters; +import jdk.httpclient.test.lib.http2.Http2TestServer; import org.testng.annotations.AfterTest; import org.testng.annotations.BeforeTest; diff --git a/test/jdk/java/net/httpclient/StreamingBody.java b/test/jdk/java/net/httpclient/StreamingBody.java index 9572d14a81c..ea7e63faaa9 100644 --- a/test/jdk/java/net/httpclient/StreamingBody.java +++ b/test/jdk/java/net/httpclient/StreamingBody.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2023, 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 @@ -25,15 +25,8 @@ * @test * @summary Exercise a streaming subscriber ( InputStream ) without holding a * strong (or any ) reference to the client. - * @modules java.base/sun.net.www.http - * java.net.http/jdk.internal.net.http.common - * java.net.http/jdk.internal.net.http.frame - * java.net.http/jdk.internal.net.http.hpack - * java.logging - * jdk.httpserver - * @library /test/lib http2/server - * @build Http2TestServer - * @build jdk.test.lib.net.SimpleSSLContext + * @library /test/lib /test/jdk/java/net/httpclient/lib + * @build jdk.httpclient.test.lib.common.HttpServerAdapters jdk.test.lib.net.SimpleSSLContext * @run testng/othervm * -Djdk.httpclient.HttpClient.log=trace,headers,requests * StreamingBody @@ -53,6 +46,8 @@ import java.net.http.HttpRequest; import java.net.http.HttpResponse; import java.net.http.HttpResponse.BodyHandlers; import javax.net.ssl.SSLContext; +import jdk.httpclient.test.lib.common.HttpServerAdapters; +import jdk.httpclient.test.lib.http2.Http2TestServer; import jdk.test.lib.net.SimpleSSLContext; import org.testng.annotations.AfterTest; import org.testng.annotations.BeforeTest; diff --git a/test/jdk/java/net/httpclient/TEST.properties b/test/jdk/java/net/httpclient/TEST.properties index d790cb63498..b4ca833b5e5 100644 --- a/test/jdk/java/net/httpclient/TEST.properties +++ b/test/jdk/java/net/httpclient/TEST.properties @@ -1,2 +1,9 @@ -modules = java.net.http +modules=java.base/sun.net.www.http \ + java.base/sun.net.www \ + java.base/sun.net \ + java.net.http/jdk.internal.net.http.common \ + java.net.http/jdk.internal.net.http.frame \ + java.net.http/jdk.internal.net.http.hpack \ + java.logging \ + jdk.httpserver maxOutputSize = 2500000 diff --git a/test/jdk/java/net/httpclient/ThrowingPublishersCustomAfterCancel.java b/test/jdk/java/net/httpclient/ThrowingPublishersCustomAfterCancel.java index 318b4622b50..796c0b8df02 100644 --- a/test/jdk/java/net/httpclient/ThrowingPublishersCustomAfterCancel.java +++ b/test/jdk/java/net/httpclient/ThrowingPublishersCustomAfterCancel.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2023, 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 @@ -25,13 +25,10 @@ * @test * @summary Tests what happens when request publishers * throw unexpected exceptions. - * @library /test/lib http2/server - * @build jdk.test.lib.net.SimpleSSLContext HttpServerAdapters + * @library /test/lib /test/jdk/java/net/httpclient/lib + * @build jdk.test.lib.net.SimpleSSLContext * ReferenceTracker AbstractThrowingPublishers ThrowingPublishersCustomAfterCancel - * @modules java.base/sun.net.www.http - * java.net.http/jdk.internal.net.http.common - * java.net.http/jdk.internal.net.http.frame - * java.net.http/jdk.internal.net.http.hpack + * jdk.httpclient.test.lib.common.HttpServerAdapters * @run testng/othervm -Djdk.internal.httpclient.debug=true * -Djdk.httpclient.enableAllMethodRetry=true * ThrowingPublishersCustomAfterCancel diff --git a/test/jdk/java/net/httpclient/ThrowingPublishersCustomBeforeCancel.java b/test/jdk/java/net/httpclient/ThrowingPublishersCustomBeforeCancel.java index aaf05ee2a55..06343d222b8 100644 --- a/test/jdk/java/net/httpclient/ThrowingPublishersCustomBeforeCancel.java +++ b/test/jdk/java/net/httpclient/ThrowingPublishersCustomBeforeCancel.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2023, 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 @@ -25,13 +25,10 @@ * @test * @summary Tests what happens when request publishers * throw unexpected exceptions. - * @library /test/lib http2/server - * @build jdk.test.lib.net.SimpleSSLContext HttpServerAdapters + * @library /test/lib /test/jdk/java/net/httpclient/lib + * @build jdk.test.lib.net.SimpleSSLContext * ReferenceTracker AbstractThrowingPublishers ThrowingPublishersCustomBeforeCancel - * @modules java.base/sun.net.www.http - * java.net.http/jdk.internal.net.http.common - * java.net.http/jdk.internal.net.http.frame - * java.net.http/jdk.internal.net.http.hpack + * jdk.httpclient.test.lib.common.HttpServerAdapters * @run testng/othervm -Djdk.internal.httpclient.debug=true * -Djdk.httpclient.enableAllMethodRetry=true * ThrowingPublishersCustomBeforeCancel diff --git a/test/jdk/java/net/httpclient/ThrowingPublishersIOAfterCancel.java b/test/jdk/java/net/httpclient/ThrowingPublishersIOAfterCancel.java index 4af4827bdd3..7ed649b2546 100644 --- a/test/jdk/java/net/httpclient/ThrowingPublishersIOAfterCancel.java +++ b/test/jdk/java/net/httpclient/ThrowingPublishersIOAfterCancel.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2023, 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 @@ -25,13 +25,10 @@ * @test * @summary Tests what happens when request publishers * throw unexpected exceptions. - * @library /test/lib http2/server - * @build jdk.test.lib.net.SimpleSSLContext HttpServerAdapters + * @library /test/lib /test/jdk/java/net/httpclient/lib + * @build jdk.test.lib.net.SimpleSSLContext * ReferenceTracker AbstractThrowingPublishers ThrowingPublishersIOAfterCancel - * @modules java.base/sun.net.www.http - * java.net.http/jdk.internal.net.http.common - * java.net.http/jdk.internal.net.http.frame - * java.net.http/jdk.internal.net.http.hpack + * jdk.httpclient.test.lib.common.HttpServerAdapters * @run testng/othervm -Djdk.internal.httpclient.debug=true * -Djdk.httpclient.enableAllMethodRetry=true * ThrowingPublishersIOAfterCancel diff --git a/test/jdk/java/net/httpclient/ThrowingPublishersIOBeforeCancel.java b/test/jdk/java/net/httpclient/ThrowingPublishersIOBeforeCancel.java index 63c36072509..3be2eb061cc 100644 --- a/test/jdk/java/net/httpclient/ThrowingPublishersIOBeforeCancel.java +++ b/test/jdk/java/net/httpclient/ThrowingPublishersIOBeforeCancel.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2023, 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 @@ -25,13 +25,10 @@ * @test * @summary Tests what happens when request publishers * throw unexpected exceptions. - * @library /test/lib http2/server - * @build jdk.test.lib.net.SimpleSSLContext HttpServerAdapters + * @library /test/lib /test/jdk/java/net/httpclient/lib + * @build jdk.test.lib.net.SimpleSSLContext * ReferenceTracker AbstractThrowingPublishers ThrowingPublishersIOBeforeCancel - * @modules java.base/sun.net.www.http - * java.net.http/jdk.internal.net.http.common - * java.net.http/jdk.internal.net.http.frame - * java.net.http/jdk.internal.net.http.hpack + * jdk.httpclient.test.lib.common.HttpServerAdapters * @run testng/othervm -Djdk.internal.httpclient.debug=true * -Djdk.httpclient.enableAllMethodRetry=true * ThrowingPublishersIOBeforeCancel diff --git a/test/jdk/java/net/httpclient/ThrowingPublishersInNextRequest.java b/test/jdk/java/net/httpclient/ThrowingPublishersInNextRequest.java index 7ffc09da042..eb07b359fc9 100644 --- a/test/jdk/java/net/httpclient/ThrowingPublishersInNextRequest.java +++ b/test/jdk/java/net/httpclient/ThrowingPublishersInNextRequest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2023, 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 @@ -25,13 +25,10 @@ * @test * @summary Tests what happens when request publishers * throw unexpected exceptions. - * @library /test/lib http2/server - * @build jdk.test.lib.net.SimpleSSLContext HttpServerAdapters + * @library /test/lib /test/jdk/java/net/httpclient/lib + * @build jdk.test.lib.net.SimpleSSLContext * ReferenceTracker AbstractThrowingPublishers ThrowingPublishersInNextRequest - * @modules java.base/sun.net.www.http - * java.net.http/jdk.internal.net.http.common - * java.net.http/jdk.internal.net.http.frame - * java.net.http/jdk.internal.net.http.hpack + * jdk.httpclient.test.lib.common.HttpServerAdapters * @run testng/othervm -Djdk.internal.httpclient.debug=true * -Djdk.httpclient.enableAllMethodRetry=true * ThrowingPublishersInNextRequest diff --git a/test/jdk/java/net/httpclient/ThrowingPublishersInRequest.java b/test/jdk/java/net/httpclient/ThrowingPublishersInRequest.java index 60e0e2aa147..ef05e4e0da6 100644 --- a/test/jdk/java/net/httpclient/ThrowingPublishersInRequest.java +++ b/test/jdk/java/net/httpclient/ThrowingPublishersInRequest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2023, 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 @@ -25,13 +25,10 @@ * @test * @summary Tests what happens when request publishers * throw unexpected exceptions. - * @library /test/lib http2/server - * @build jdk.test.lib.net.SimpleSSLContext HttpServerAdapters + * @library /test/lib /test/jdk/java/net/httpclient/lib + * @build jdk.test.lib.net.SimpleSSLContext * ReferenceTracker AbstractThrowingPublishers ThrowingPublishersInRequest - * @modules java.base/sun.net.www.http - * java.net.http/jdk.internal.net.http.common - * java.net.http/jdk.internal.net.http.frame - * java.net.http/jdk.internal.net.http.hpack + * jdk.httpclient.test.lib.common.HttpServerAdapters * @run testng/othervm -Djdk.internal.httpclient.debug=true * -Djdk.httpclient.enableAllMethodRetry=true * ThrowingPublishersInRequest diff --git a/test/jdk/java/net/httpclient/ThrowingPublishersInSubscribe.java b/test/jdk/java/net/httpclient/ThrowingPublishersInSubscribe.java index 5b1dd9d36ff..f14c5167024 100644 --- a/test/jdk/java/net/httpclient/ThrowingPublishersInSubscribe.java +++ b/test/jdk/java/net/httpclient/ThrowingPublishersInSubscribe.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2023, 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 @@ -25,13 +25,10 @@ * @test * @summary Tests what happens when request publishers * throw unexpected exceptions. - * @library /test/lib http2/server - * @build jdk.test.lib.net.SimpleSSLContext HttpServerAdapters + * @library /test/lib /test/jdk/java/net/httpclient/lib + * @build jdk.test.lib.net.SimpleSSLContext * ReferenceTracker AbstractThrowingPublishers ThrowingPublishersInSubscribe - * @modules java.base/sun.net.www.http - * java.net.http/jdk.internal.net.http.common - * java.net.http/jdk.internal.net.http.frame - * java.net.http/jdk.internal.net.http.hpack + * jdk.httpclient.test.lib.common.HttpServerAdapters * @run testng/othervm -Djdk.internal.httpclient.debug=true * -Djdk.httpclient.enableAllMethodRetry=true * ThrowingPublishersInSubscribe diff --git a/test/jdk/java/net/httpclient/ThrowingPublishersSanity.java b/test/jdk/java/net/httpclient/ThrowingPublishersSanity.java index 48f6fc913d3..30549083310 100644 --- a/test/jdk/java/net/httpclient/ThrowingPublishersSanity.java +++ b/test/jdk/java/net/httpclient/ThrowingPublishersSanity.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2023, 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 @@ -25,13 +25,10 @@ * @test * @summary Tests what happens when request publishers * throw unexpected exceptions. - * @library /test/lib http2/server - * @build jdk.test.lib.net.SimpleSSLContext HttpServerAdapters + * @library /test/lib /test/jdk/java/net/httpclient/lib + * @build jdk.test.lib.net.SimpleSSLContext * ReferenceTracker AbstractThrowingPublishers ThrowingPublishersSanity - * @modules java.base/sun.net.www.http - * java.net.http/jdk.internal.net.http.common - * java.net.http/jdk.internal.net.http.frame - * java.net.http/jdk.internal.net.http.hpack + * jdk.httpclient.test.lib.common.HttpServerAdapters * @run testng/othervm -Djdk.internal.httpclient.debug=true * -Djdk.httpclient.enableAllMethodRetry=true * ThrowingPublishersSanity diff --git a/test/jdk/java/net/httpclient/ThrowingPushPromisesAsInputStreamCustom.java b/test/jdk/java/net/httpclient/ThrowingPushPromisesAsInputStreamCustom.java index 95671d6a3ff..0b66a8e913e 100644 --- a/test/jdk/java/net/httpclient/ThrowingPushPromisesAsInputStreamCustom.java +++ b/test/jdk/java/net/httpclient/ThrowingPushPromisesAsInputStreamCustom.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2023, 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 @@ -26,13 +26,10 @@ * @bug 8229822 * @summary Tests what happens when push promise handlers and their * response body handlers and subscribers throw unexpected exceptions. - * @library /test/lib http2/server - * @build jdk.test.lib.net.SimpleSSLContext HttpServerAdapters - * ReferenceTracker AbstractThrowingPushPromises ThrowingPushPromisesAsInputStreamCustom - * @modules java.base/sun.net.www.http - * java.net.http/jdk.internal.net.http.common - * java.net.http/jdk.internal.net.http.frame - * java.net.http/jdk.internal.net.http.hpack + * @library /test/lib /test/jdk/java/net/httpclient/lib + * @build jdk.test.lib.net.SimpleSSLContext + * ReferenceTracker AbstractThrowingPushPromises ThrowingPushPromisesAsInputStreamCustom + * jdk.httpclient.test.lib.common.HttpServerAdapters * @run testng/othervm -Djdk.internal.httpclient.debug=true ThrowingPushPromisesAsInputStreamCustom */ diff --git a/test/jdk/java/net/httpclient/ThrowingPushPromisesAsInputStreamIO.java b/test/jdk/java/net/httpclient/ThrowingPushPromisesAsInputStreamIO.java index 7f22bdf4961..89cf1162bc3 100644 --- a/test/jdk/java/net/httpclient/ThrowingPushPromisesAsInputStreamIO.java +++ b/test/jdk/java/net/httpclient/ThrowingPushPromisesAsInputStreamIO.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2023, 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 @@ -26,13 +26,10 @@ * @bug 8229822 * @summary Tests what happens when push promise handlers and their * response body handlers and subscribers throw unexpected exceptions. - * @library /test/lib http2/server - * @build jdk.test.lib.net.SimpleSSLContext HttpServerAdapters - * ReferenceTracker AbstractThrowingPushPromises ThrowingPushPromisesAsInputStreamIO - * @modules java.base/sun.net.www.http - * java.net.http/jdk.internal.net.http.common - * java.net.http/jdk.internal.net.http.frame - * java.net.http/jdk.internal.net.http.hpack + * @library /test/lib /test/jdk/java/net/httpclient/lib + * @build jdk.test.lib.net.SimpleSSLContext + * ReferenceTracker AbstractThrowingPushPromises ThrowingPushPromisesAsInputStreamIO + * jdk.httpclient.test.lib.common.HttpServerAdapters * @run testng/othervm -Djdk.internal.httpclient.debug=true ThrowingPushPromisesAsInputStreamIO */ diff --git a/test/jdk/java/net/httpclient/ThrowingPushPromisesAsLinesCustom.java b/test/jdk/java/net/httpclient/ThrowingPushPromisesAsLinesCustom.java index e17a72a21dc..d1fb7d34258 100644 --- a/test/jdk/java/net/httpclient/ThrowingPushPromisesAsLinesCustom.java +++ b/test/jdk/java/net/httpclient/ThrowingPushPromisesAsLinesCustom.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2023, 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 @@ -26,13 +26,10 @@ * @bug 8229822 * @summary Tests what happens when push promise handlers and their * response body handlers and subscribers throw unexpected exceptions. - * @library /test/lib http2/server - * @build jdk.test.lib.net.SimpleSSLContext HttpServerAdapters - * ReferenceTracker AbstractThrowingPushPromises ThrowingPushPromisesAsLinesCustom - * @modules java.base/sun.net.www.http - * java.net.http/jdk.internal.net.http.common - * java.net.http/jdk.internal.net.http.frame - * java.net.http/jdk.internal.net.http.hpack + * @library /test/lib /test/jdk/java/net/httpclient/lib + * @build jdk.test.lib.net.SimpleSSLContext + * ReferenceTracker AbstractThrowingPushPromises ThrowingPushPromisesAsLinesCustom + * jdk.httpclient.test.lib.common.HttpServerAdapters * @run testng/othervm -Djdk.internal.httpclient.debug=true ThrowingPushPromisesAsLinesCustom */ diff --git a/test/jdk/java/net/httpclient/ThrowingPushPromisesAsLinesIO.java b/test/jdk/java/net/httpclient/ThrowingPushPromisesAsLinesIO.java index 678a58530c1..88afaf3dbd5 100644 --- a/test/jdk/java/net/httpclient/ThrowingPushPromisesAsLinesIO.java +++ b/test/jdk/java/net/httpclient/ThrowingPushPromisesAsLinesIO.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2023, 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 @@ -26,13 +26,10 @@ * @bug 8229822 * @summary Tests what happens when push promise handlers and their * response body handlers and subscribers throw unexpected exceptions. - * @library /test/lib http2/server - * @build jdk.test.lib.net.SimpleSSLContext HttpServerAdapters - * ReferenceTracker AbstractThrowingPushPromises ThrowingPushPromisesAsLinesIO - * @modules java.base/sun.net.www.http - * java.net.http/jdk.internal.net.http.common - * java.net.http/jdk.internal.net.http.frame - * java.net.http/jdk.internal.net.http.hpack + * @library /test/lib /test/jdk/java/net/httpclient/lib + * @build jdk.test.lib.net.SimpleSSLContext + * ReferenceTracker AbstractThrowingPushPromises ThrowingPushPromisesAsLinesIO + * jdk.httpclient.test.lib.common.HttpServerAdapters * @run testng/othervm -Djdk.internal.httpclient.debug=true ThrowingPushPromisesAsLinesIO */ diff --git a/test/jdk/java/net/httpclient/ThrowingPushPromisesAsStringCustom.java b/test/jdk/java/net/httpclient/ThrowingPushPromisesAsStringCustom.java index be94c2fa4ff..c40af0ab0b0 100644 --- a/test/jdk/java/net/httpclient/ThrowingPushPromisesAsStringCustom.java +++ b/test/jdk/java/net/httpclient/ThrowingPushPromisesAsStringCustom.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2023, 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 @@ -26,13 +26,10 @@ * @bug 8229822 * @summary Tests what happens when push promise handlers and their * response body handlers and subscribers throw unexpected exceptions. - * @library /test/lib http2/server - * @build jdk.test.lib.net.SimpleSSLContext HttpServerAdapters - * ReferenceTracker AbstractThrowingPushPromises ThrowingPushPromisesAsStringCustom - * @modules java.base/sun.net.www.http - * java.net.http/jdk.internal.net.http.common - * java.net.http/jdk.internal.net.http.frame - * java.net.http/jdk.internal.net.http.hpack + * @library /test/lib /test/jdk/java/net/httpclient/lib + * @build jdk.test.lib.net.SimpleSSLContext + * ReferenceTracker AbstractThrowingPushPromises ThrowingPushPromisesAsStringCustom + * jdk.httpclient.test.lib.common.HttpServerAdapters * @run testng/othervm -Djdk.internal.httpclient.debug=true ThrowingPushPromisesAsStringCustom */ diff --git a/test/jdk/java/net/httpclient/ThrowingPushPromisesAsStringIO.java b/test/jdk/java/net/httpclient/ThrowingPushPromisesAsStringIO.java index a7120964869..6485e82af8f 100644 --- a/test/jdk/java/net/httpclient/ThrowingPushPromisesAsStringIO.java +++ b/test/jdk/java/net/httpclient/ThrowingPushPromisesAsStringIO.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2023, 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 @@ -26,13 +26,10 @@ * @bug 8229822 * @summary Tests what happens when push promise handlers and their * response body handlers and subscribers throw unexpected exceptions. - * @library /test/lib http2/server - * @build jdk.test.lib.net.SimpleSSLContext HttpServerAdapters - * ReferenceTracker AbstractThrowingPushPromises ThrowingPushPromisesAsStringIO - * @modules java.base/sun.net.www.http - * java.net.http/jdk.internal.net.http.common - * java.net.http/jdk.internal.net.http.frame - * java.net.http/jdk.internal.net.http.hpack + * @library /test/lib /test/jdk/java/net/httpclient/lib + * @build jdk.test.lib.net.SimpleSSLContext + * ReferenceTracker AbstractThrowingPushPromises ThrowingPushPromisesAsStringIO + * jdk.httpclient.test.lib.common.HttpServerAdapters * @run testng/othervm -Djdk.internal.httpclient.debug=true ThrowingPushPromisesAsStringIO */ diff --git a/test/jdk/java/net/httpclient/ThrowingPushPromisesSanity.java b/test/jdk/java/net/httpclient/ThrowingPushPromisesSanity.java index d064c322599..7fdb6dcb19d 100644 --- a/test/jdk/java/net/httpclient/ThrowingPushPromisesSanity.java +++ b/test/jdk/java/net/httpclient/ThrowingPushPromisesSanity.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2023, 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 @@ -26,13 +26,10 @@ * @bug 8229822 * @summary Tests what happens when push promise handlers and their * response body handlers and subscribers throw unexpected exceptions. - * @library /test/lib http2/server - * @build jdk.test.lib.net.SimpleSSLContext HttpServerAdapters - * ReferenceTracker AbstractThrowingPushPromises ThrowingPushPromisesSanity - * @modules java.base/sun.net.www.http - * java.net.http/jdk.internal.net.http.common - * java.net.http/jdk.internal.net.http.frame - * java.net.http/jdk.internal.net.http.hpack + * @library /test/lib /test/jdk/java/net/httpclient/lib + * @build jdk.test.lib.net.SimpleSSLContext + * ReferenceTracker AbstractThrowingPushPromises ThrowingPushPromisesSanity + * jdk.httpclient.test.lib.common.HttpServerAdapters * @run testng/othervm -Djdk.internal.httpclient.debug=true ThrowingPushPromisesSanity */ diff --git a/test/jdk/java/net/httpclient/ThrowingSubscribersAsInputStream.java b/test/jdk/java/net/httpclient/ThrowingSubscribersAsInputStream.java index eb2636f3159..35ac1fd3f9c 100644 --- a/test/jdk/java/net/httpclient/ThrowingSubscribersAsInputStream.java +++ b/test/jdk/java/net/httpclient/ThrowingSubscribersAsInputStream.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2023, 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 @@ -25,13 +25,10 @@ * @test * @summary Tests what happens when response body handlers and subscribers * throw unexpected exceptions. - * @library /test/lib http2/server - * @build jdk.test.lib.net.SimpleSSLContext HttpServerAdapters - * ReferenceTracker ThrowingSubscribersAsInputStream AbstractThrowingSubscribers - * @modules java.base/sun.net.www.http - * java.net.http/jdk.internal.net.http.common - * java.net.http/jdk.internal.net.http.frame - * java.net.http/jdk.internal.net.http.hpack + * @library /test/lib /test/jdk/java/net/httpclient/lib + * @build jdk.test.lib.net.SimpleSSLContext + * ReferenceTracker ThrowingSubscribersAsInputStream AbstractThrowingSubscribers + * jdk.httpclient.test.lib.common.HttpServerAdapters * @run testng/othervm -Djdk.internal.httpclient.debug=true ThrowingSubscribersAsInputStream */ diff --git a/test/jdk/java/net/httpclient/ThrowingSubscribersAsInputStreamAsync.java b/test/jdk/java/net/httpclient/ThrowingSubscribersAsInputStreamAsync.java index 98baae29ec2..db25ebaca3e 100644 --- a/test/jdk/java/net/httpclient/ThrowingSubscribersAsInputStreamAsync.java +++ b/test/jdk/java/net/httpclient/ThrowingSubscribersAsInputStreamAsync.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2023, 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 @@ -25,13 +25,10 @@ * @test * @summary Tests what happens when response body handlers and subscribers * throw unexpected exceptions. - * @library /test/lib http2/server - * @build jdk.test.lib.net.SimpleSSLContext HttpServerAdapters - * ReferenceTracker ThrowingSubscribersAsInputStreamAsync AbstractThrowingSubscribers - * @modules java.base/sun.net.www.http - * java.net.http/jdk.internal.net.http.common - * java.net.http/jdk.internal.net.http.frame - * java.net.http/jdk.internal.net.http.hpack + * @library /test/lib /test/jdk/java/net/httpclient/lib + * @build jdk.test.lib.net.SimpleSSLContext + * ReferenceTracker ThrowingSubscribersAsInputStreamAsync AbstractThrowingSubscribers + * jdk.httpclient.test.lib.common.HttpServerAdapters * @run testng/othervm -Djdk.internal.httpclient.debug=true ThrowingSubscribersAsInputStreamAsync */ diff --git a/test/jdk/java/net/httpclient/ThrowingSubscribersAsLines.java b/test/jdk/java/net/httpclient/ThrowingSubscribersAsLines.java index eccdf54f398..f303ef12b54 100644 --- a/test/jdk/java/net/httpclient/ThrowingSubscribersAsLines.java +++ b/test/jdk/java/net/httpclient/ThrowingSubscribersAsLines.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2023, 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 @@ -25,13 +25,10 @@ * @test * @summary Tests what happens when response body handlers and subscribers * throw unexpected exceptions. - * @library /test/lib http2/server - * @build jdk.test.lib.net.SimpleSSLContext HttpServerAdapters - * ReferenceTracker ThrowingSubscribersAsLines AbstractThrowingSubscribers - * @modules java.base/sun.net.www.http - * java.net.http/jdk.internal.net.http.common - * java.net.http/jdk.internal.net.http.frame - * java.net.http/jdk.internal.net.http.hpack + * @library /test/lib /test/jdk/java/net/httpclient/lib + * @build jdk.test.lib.net.SimpleSSLContext + * ReferenceTracker ThrowingSubscribersAsLines AbstractThrowingSubscribers + * jdk.httpclient.test.lib.common.HttpServerAdapters * @run testng/othervm -Djdk.internal.httpclient.debug=true ThrowingSubscribersAsLines */ diff --git a/test/jdk/java/net/httpclient/ThrowingSubscribersAsLinesAsync.java b/test/jdk/java/net/httpclient/ThrowingSubscribersAsLinesAsync.java index ba3583244b6..2e1fc942a73 100644 --- a/test/jdk/java/net/httpclient/ThrowingSubscribersAsLinesAsync.java +++ b/test/jdk/java/net/httpclient/ThrowingSubscribersAsLinesAsync.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2023, 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 @@ -25,13 +25,10 @@ * @test * @summary Tests what happens when response body handlers and subscribers * throw unexpected exceptions. - * @library /test/lib http2/server - * @build jdk.test.lib.net.SimpleSSLContext HttpServerAdapters - * ReferenceTracker ThrowingSubscribersAsLinesAsync AbstractThrowingSubscribers - * @modules java.base/sun.net.www.http - * java.net.http/jdk.internal.net.http.common - * java.net.http/jdk.internal.net.http.frame - * java.net.http/jdk.internal.net.http.hpack + * @library /test/lib /test/jdk/java/net/httpclient/lib + * @build jdk.test.lib.net.SimpleSSLContext + * ReferenceTracker ThrowingSubscribersAsLinesAsync AbstractThrowingSubscribers + * jdk.httpclient.test.lib.common.HttpServerAdapters * @run testng/othervm -Djdk.internal.httpclient.debug=true ThrowingSubscribersAsLinesAsync */ diff --git a/test/jdk/java/net/httpclient/ThrowingSubscribersAsString.java b/test/jdk/java/net/httpclient/ThrowingSubscribersAsString.java index 43ec0756842..56e444f09c2 100644 --- a/test/jdk/java/net/httpclient/ThrowingSubscribersAsString.java +++ b/test/jdk/java/net/httpclient/ThrowingSubscribersAsString.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2023, 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 @@ -25,13 +25,10 @@ * @test * @summary Tests what happens when response body handlers and subscribers * throw unexpected exceptions. - * @library /test/lib http2/server - * @build jdk.test.lib.net.SimpleSSLContext HttpServerAdapters - * ReferenceTracker ThrowingSubscribersAsString AbstractThrowingSubscribers - * @modules java.base/sun.net.www.http - * java.net.http/jdk.internal.net.http.common - * java.net.http/jdk.internal.net.http.frame - * java.net.http/jdk.internal.net.http.hpack + * @library /test/lib /test/jdk/java/net/httpclient/lib + * @build jdk.test.lib.net.SimpleSSLContext + * ReferenceTracker ThrowingSubscribersAsString AbstractThrowingSubscribers + * jdk.httpclient.test.lib.common.HttpServerAdapters * @run testng/othervm -Djdk.internal.httpclient.debug=true ThrowingSubscribersAsString */ diff --git a/test/jdk/java/net/httpclient/ThrowingSubscribersAsStringAsync.java b/test/jdk/java/net/httpclient/ThrowingSubscribersAsStringAsync.java index 9620bf20f52..563fe39bd69 100644 --- a/test/jdk/java/net/httpclient/ThrowingSubscribersAsStringAsync.java +++ b/test/jdk/java/net/httpclient/ThrowingSubscribersAsStringAsync.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2023, 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 @@ -25,13 +25,10 @@ * @test * @summary Tests what happens when response body handlers and subscribers * throw unexpected exceptions. - * @library /test/lib http2/server - * @build jdk.test.lib.net.SimpleSSLContext HttpServerAdapters - * ReferenceTracker ThrowingSubscribersAsStringAsync AbstractThrowingSubscribers - * @modules java.base/sun.net.www.http - * java.net.http/jdk.internal.net.http.common - * java.net.http/jdk.internal.net.http.frame - * java.net.http/jdk.internal.net.http.hpack + * @library /test/lib /test/jdk/java/net/httpclient/lib + * @build jdk.test.lib.net.SimpleSSLContext + * ReferenceTracker ThrowingSubscribersAsStringAsync AbstractThrowingSubscribers + * jdk.httpclient.test.lib.common.HttpServerAdapters * @run testng/othervm -Djdk.internal.httpclient.debug=true ThrowingSubscribersAsStringAsync */ diff --git a/test/jdk/java/net/httpclient/ThrowingSubscribersSanity.java b/test/jdk/java/net/httpclient/ThrowingSubscribersSanity.java index 7e4d600f0fc..c480d55e147 100644 --- a/test/jdk/java/net/httpclient/ThrowingSubscribersSanity.java +++ b/test/jdk/java/net/httpclient/ThrowingSubscribersSanity.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2023, 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 @@ -25,13 +25,10 @@ * @test * @summary Tests what happens when response body handlers and subscribers * throw unexpected exceptions. - * @library /test/lib http2/server - * @build jdk.test.lib.net.SimpleSSLContext HttpServerAdapters - * ReferenceTracker ThrowingSubscribersSanity AbstractThrowingSubscribers - * @modules java.base/sun.net.www.http - * java.net.http/jdk.internal.net.http.common - * java.net.http/jdk.internal.net.http.frame - * java.net.http/jdk.internal.net.http.hpack + * @library /test/lib /test/jdk/java/net/httpclient/lib + * @build jdk.test.lib.net.SimpleSSLContext + * ReferenceTracker ThrowingSubscribersSanity AbstractThrowingSubscribers + * jdk.httpclient.test.lib.common.HttpServerAdapters * @run testng/othervm -Djdk.internal.httpclient.debug=true ThrowingSubscribersSanity */ diff --git a/test/jdk/java/net/httpclient/TlsContextTest.java b/test/jdk/java/net/httpclient/TlsContextTest.java index ccccadcc175..707a2e2d7c7 100644 --- a/test/jdk/java/net/httpclient/TlsContextTest.java +++ b/test/jdk/java/net/httpclient/TlsContextTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2023, 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 @@ -31,6 +31,8 @@ import java.net.http.HttpResponse; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import javax.net.ssl.SSLContext; +import jdk.httpclient.test.lib.common.HttpServerAdapters; +import jdk.httpclient.test.lib.http2.Http2TestServer; import jdk.test.lib.net.SimpleSSLContext; import org.testng.annotations.AfterTest; import org.testng.annotations.BeforeTest; @@ -48,15 +50,9 @@ import jdk.test.lib.security.SecurityUtils; * @test * @bug 8239594 * @summary This test verifies that the TLS version handshake respects ssl context - * @library /test/lib http2/server - * @build jdk.test.lib.net.SimpleSSLContext HttpServerAdapters TlsContextTest - * @modules java.net.http/jdk.internal.net.http.common - * java.net.http/jdk.internal.net.http.frame - * java.net.http/jdk.internal.net.http.hpack - * java.logging - * java.base/sun.net.www.http - * java.base/sun.net.www - * java.base/sun.net + * @library /test/lib /test/jdk/java/net/httpclient/lib + * @build jdk.test.lib.net.SimpleSSLContext TlsContextTest + * jdk.httpclient.test.lib.common.HttpServerAdapters * @run testng/othervm -Dtest.requiresHost=true * -Djdk.httpclient.HttpClient.log=headers * -Djdk.internal.httpclient.disableHostnameVerification diff --git a/test/jdk/java/net/httpclient/UnauthorizedTest.java b/test/jdk/java/net/httpclient/UnauthorizedTest.java index 7f183620de2..2622cecd17b 100644 --- a/test/jdk/java/net/httpclient/UnauthorizedTest.java +++ b/test/jdk/java/net/httpclient/UnauthorizedTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2023, 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,15 +29,8 @@ * header only in the case where an authenticator is configured * for the client. If no authenticator is configured the client * should simply let the caller deal with the unauthorized response. - * @modules java.base/sun.net.www.http - * java.net.http/jdk.internal.net.http.common - * java.net.http/jdk.internal.net.http.frame - * java.net.http/jdk.internal.net.http.hpack - * java.logging - * jdk.httpserver - * @library /test/lib http2/server - * @build Http2TestServer - * @build jdk.test.lib.net.SimpleSSLContext + * @library /test/lib /test/jdk/java/net/httpclient/lib + * @build jdk.httpclient.test.lib.common.HttpServerAdapters jdk.test.lib.net.SimpleSSLContext * @run testng/othervm * -Djdk.httpclient.HttpClient.log=headers * UnauthorizedTest @@ -66,6 +59,8 @@ import java.net.http.HttpResponse; import java.net.http.HttpResponse.BodyHandlers; import java.util.concurrent.ExecutionException; import java.util.concurrent.atomic.AtomicLong; +import jdk.httpclient.test.lib.common.HttpServerAdapters; +import jdk.httpclient.test.lib.http2.Http2TestServer; import static java.lang.System.out; import static java.nio.charset.StandardCharsets.UTF_8; diff --git a/test/jdk/java/net/httpclient/UserCookieTest.java b/test/jdk/java/net/httpclient/UserCookieTest.java index 9c1c6cc139f..1b9aa48a0eb 100644 --- a/test/jdk/java/net/httpclient/UserCookieTest.java +++ b/test/jdk/java/net/httpclient/UserCookieTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2023, 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 @@ -26,15 +26,8 @@ * @bug 8276774 * @summary Test that user-supplied cookies are appended to * server-cookies for HTTP/2 vs HTTP/1.1 - * @modules java.base/sun.net.www.http - * java.net.http/jdk.internal.net.http.common - * java.net.http/jdk.internal.net.http.frame - * java.net.http/jdk.internal.net.http.hpack - * java.logging - * jdk.httpserver - * @library /test/lib http2/server - * @build Http2TestServer - * @build jdk.test.lib.net.SimpleSSLContext + * @library /test/lib /test/jdk/java/net/httpclient/lib + * @build jdk.httpclient.test.lib.common.HttpServerAdapters jdk.test.lib.net.SimpleSSLContext * @run testng/othervm * -Djdk.tls.acknowledgeCloseNotify=true * -Djdk.httpclient.HttpClient.log=trace,headers,requests @@ -72,6 +65,8 @@ import java.util.stream.Collectors; import java.util.stream.Stream; import javax.net.ServerSocketFactory; import javax.net.ssl.SSLContext; +import jdk.httpclient.test.lib.common.HttpServerAdapters; +import jdk.httpclient.test.lib.http2.Http2TestServer; import com.sun.net.httpserver.HttpServer; import com.sun.net.httpserver.HttpsConfigurator; diff --git a/test/jdk/java/net/httpclient/dependent.policy b/test/jdk/java/net/httpclient/dependent.policy index 2396a118b20..dcfdec00edc 100644 --- a/test/jdk/java/net/httpclient/dependent.policy +++ b/test/jdk/java/net/httpclient/dependent.policy @@ -1,5 +1,5 @@ // -// Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. +// Copyright (c) 2018, 2023, 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 @@ -27,8 +27,8 @@ grant codeBase "file:${test.classes}/../../../../test/lib/-" { permission java.io.FilePermission "${test.src}/../../../../lib/jdk/test/lib/net/testkeys", "read"; }; -// for JTwork//classes/0/java/net/httpclient/http2/server/* -grant codeBase "file:${test.classes}/../../../../java/net/httpclient/http2/server/*" { +// for jdk/httpclient/test/lib/* classes +grant codeBase "file:${test.classes}/../../../../test/jdk/java/net/httpclient/lib/-" { permission java.lang.RuntimePermission "accessClassInPackage.jdk.internal.net.http.common"; permission java.lang.RuntimePermission "accessClassInPackage.jdk.internal.net.http.frame"; permission java.lang.RuntimePermission "accessClassInPackage.jdk.internal.net.http.hpack"; diff --git a/test/jdk/java/net/httpclient/http2/BadHeadersTest.java b/test/jdk/java/net/httpclient/http2/BadHeadersTest.java index 2e4765fdf1b..0179317d6e5 100644 --- a/test/jdk/java/net/httpclient/http2/BadHeadersTest.java +++ b/test/jdk/java/net/httpclient/http2/BadHeadersTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2023, 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 @@ -23,13 +23,8 @@ /* * @test - * @modules java.base/sun.net.www.http - * java.net.http/jdk.internal.net.http.common - * java.net.http/jdk.internal.net.http.frame - * java.net.http/jdk.internal.net.http.hpack - * @library /test/lib server - * @build Http2TestServer - * @build jdk.test.lib.net.SimpleSSLContext + * @library /test/lib /test/jdk/java/net/httpclient/lib + * @build jdk.httpclient.test.lib.http2.Http2TestServer jdk.test.lib.net.SimpleSSLContext * @run testng/othervm -Djdk.internal.httpclient.debug=true BadHeadersTest */ @@ -61,6 +56,12 @@ import java.util.List; import java.util.Map.Entry; import java.util.concurrent.ExecutionException; import java.util.function.BiFunction; +import jdk.httpclient.test.lib.http2.Http2TestServer; +import jdk.httpclient.test.lib.http2.Http2TestExchange; +import jdk.httpclient.test.lib.http2.Http2TestExchangeImpl; +import jdk.httpclient.test.lib.http2.Http2Handler; +import jdk.httpclient.test.lib.http2.BodyOutputStream; +import jdk.httpclient.test.lib.http2.Http2TestServerConnection; import static java.util.List.of; import static java.util.Map.entry; import static org.testng.Assert.assertTrue; @@ -302,11 +303,12 @@ public class BadHeadersTest { if (responseLength < 0) { headerFrames.get(headerFrames.size() -1).setFlag(HeadersFrame.END_STREAM); - os.closeInternal(); + os.markClosed(); } - for (Http2Frame f : headerFrames) - conn.outputQ.put(f); + for (Http2Frame f : headerFrames) { + conn.addToOutputQ(f); + } os.goodToGo(); System.err.println("Sent response headers " + rCode); diff --git a/test/jdk/java/net/httpclient/http2/BasicTest.java b/test/jdk/java/net/httpclient/http2/BasicTest.java index 00e4d80c12d..39cad481749 100644 --- a/test/jdk/java/net/httpclient/http2/BasicTest.java +++ b/test/jdk/java/net/httpclient/http2/BasicTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2023, 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 @@ -24,12 +24,9 @@ /* * @test * @bug 8087112 - * @library /test/lib server - * @build jdk.test.lib.net.SimpleSSLContext - * @modules java.base/sun.net.www.http - * java.net.http/jdk.internal.net.http.common - * java.net.http/jdk.internal.net.http.frame - * java.net.http/jdk.internal.net.http.hpack + * @library /test/lib /test/jdk/java/net/httpclient/lib + * @build jdk.test.lib.net.SimpleSSLContext jdk.httpclient.test.lib.common.TestUtil + * jdk.httpclient.test.lib.http2.Http2TestServer * @run testng/othervm -Djdk.httpclient.HttpClient.log=ssl,requests,responses,errors BasicTest */ @@ -47,6 +44,11 @@ import java.util.concurrent.*; import java.util.Collections; import java.util.LinkedList; import java.util.List; +import jdk.httpclient.test.lib.common.TestUtil; +import jdk.httpclient.test.lib.http2.Http2TestServer; +import jdk.httpclient.test.lib.http2.Http2TestExchange; +import jdk.httpclient.test.lib.http2.Http2Handler; +import jdk.httpclient.test.lib.http2.Http2EchoHandler; import jdk.test.lib.net.SimpleSSLContext; import org.testng.annotations.Test; import static java.net.http.HttpClient.Version.HTTP_2; diff --git a/test/jdk/java/net/httpclient/http2/ContinuationFrameTest.java b/test/jdk/java/net/httpclient/http2/ContinuationFrameTest.java index 0ca77044296..04ce8f4f4a4 100644 --- a/test/jdk/java/net/httpclient/http2/ContinuationFrameTest.java +++ b/test/jdk/java/net/httpclient/http2/ContinuationFrameTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2023, 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 @@ -24,14 +24,9 @@ /* * @test * @summary Test for CONTINUATION frame handling - * @modules java.base/sun.net.www.http - * java.net.http/jdk.internal.net.http.common - * java.net.http/jdk.internal.net.http.frame - * java.net.http/jdk.internal.net.http.hpack - * @library /test/lib server + * @library /test/lib /test/jdk/java/net/httpclient/lib + * @build jdk.httpclient.test.lib.http2.Http2TestServer jdk.test.lib.net.SimpleSSLContext * @compile ../ReferenceTracker.java - * @build Http2TestServer - * @build jdk.test.lib.net.SimpleSSLContext * @run testng/othervm ContinuationFrameTest */ @@ -56,6 +51,13 @@ import jdk.internal.net.http.frame.ContinuationFrame; import jdk.internal.net.http.frame.HeaderFrame; import jdk.internal.net.http.frame.HeadersFrame; import jdk.internal.net.http.frame.Http2Frame; +import jdk.httpclient.test.lib.http2.Http2TestServer; +import jdk.httpclient.test.lib.http2.Http2TestExchange; +import jdk.httpclient.test.lib.http2.Http2TestExchangeImpl; +import jdk.httpclient.test.lib.http2.Http2Handler; +import jdk.httpclient.test.lib.http2.BodyOutputStream; +import jdk.httpclient.test.lib.http2.Http2TestServerConnection; + import jdk.test.lib.net.SimpleSSLContext; import org.testng.annotations.AfterTest; import org.testng.annotations.BeforeTest; @@ -297,10 +299,11 @@ public class ContinuationFrameTest { assert headerFrames.size() > 0; // there must always be at least 1 if(headerFrames.get(0).getFlag(HeaderFrame.END_STREAM)) - os.closeInternal(); + os.markClosed(); - for (Http2Frame f : headerFrames) - conn.outputQ.put(f); + for (Http2Frame f : headerFrames) { + conn.addToOutputQ(f); + } os.goodToGo(); System.err.println("Sent response headers " + rCode); diff --git a/test/jdk/java/net/httpclient/http2/ErrorTest.java b/test/jdk/java/net/httpclient/http2/ErrorTest.java index 54143e91bbc..061fd5cd350 100644 --- a/test/jdk/java/net/httpclient/http2/ErrorTest.java +++ b/test/jdk/java/net/httpclient/http2/ErrorTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2023, 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 @@ -24,8 +24,8 @@ /* * @test * @bug 8157105 - * @library /test/lib server - * @build jdk.test.lib.net.SimpleSSLContext + * @library /test/lib /test/jdk/java/net/httpclient/lib + * @build jdk.test.lib.net.SimpleSSLContext jdk.httpclient.test.lib.http2.Http2TestServer * @modules java.base/sun.net.www.http * java.net.http/jdk.internal.net.http.common * java.net.http/jdk.internal.net.http.frame @@ -46,6 +46,10 @@ import javax.net.ssl.SSLContext; import javax.net.ssl.SSLParameters; import java.util.concurrent.Executors; import java.util.concurrent.ExecutorService; +import jdk.httpclient.test.lib.http2.Http2TestServer; +import jdk.httpclient.test.lib.http2.Http2TestExchange; +import jdk.httpclient.test.lib.http2.Http2EchoHandler; + import jdk.test.lib.net.SimpleSSLContext; import static java.net.http.HttpClient.Version.HTTP_2; diff --git a/test/jdk/java/net/httpclient/http2/FixedThreadPoolTest.java b/test/jdk/java/net/httpclient/http2/FixedThreadPoolTest.java index 1db21bf7805..cef7bf7df65 100644 --- a/test/jdk/java/net/httpclient/http2/FixedThreadPoolTest.java +++ b/test/jdk/java/net/httpclient/http2/FixedThreadPoolTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2023, 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 @@ -24,12 +24,9 @@ /* * @test * @bug 8087112 8177935 - * @library /test/lib server - * @build jdk.test.lib.net.SimpleSSLContext - * @modules java.base/sun.net.www.http - * java.net.http/jdk.internal.net.http.common - * java.net.http/jdk.internal.net.http.frame - * java.net.http/jdk.internal.net.http.hpack + * @library /test/lib /test/jdk/java/net/httpclient/lib + * @build jdk.test.lib.net.SimpleSSLContext jdk.httpclient.test.lib.common.TestUtil + * jdk.httpclient.test.lib.http2.Http2TestServer * @run testng/othervm -Djdk.httpclient.HttpClient.log=ssl,requests,responses,errors FixedThreadPoolTest */ @@ -40,6 +37,10 @@ import java.net.http.HttpResponse.BodyHandlers; import javax.net.ssl.*; import java.nio.file.*; import java.util.concurrent.*; +import jdk.httpclient.test.lib.common.TestUtil; +import jdk.httpclient.test.lib.http2.Http2TestServer; +import jdk.httpclient.test.lib.http2.Http2TestExchange; +import jdk.httpclient.test.lib.http2.Http2EchoHandler; import jdk.test.lib.net.SimpleSSLContext; import static java.net.http.HttpClient.Version.HTTP_2; import org.testng.annotations.Test; diff --git a/test/jdk/java/net/httpclient/http2/IdleConnectionTimeoutTest.java b/test/jdk/java/net/httpclient/http2/IdleConnectionTimeoutTest.java index 760ee43feac..d0008b9884c 100644 --- a/test/jdk/java/net/httpclient/http2/IdleConnectionTimeoutTest.java +++ b/test/jdk/java/net/httpclient/http2/IdleConnectionTimeoutTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2023, 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 @@ -27,11 +27,8 @@ * @summary Tests that when the idleConnectionTimeoutEvent is configured in HTTP/2, * an HTTP/2 connection will close within the specified interval if there * are no active streams on the connection. - * @library /test/lib server - * @modules java.base/sun.net.www.http - * java.net.http/jdk.internal.net.http.common - * java.net.http/jdk.internal.net.http.frame - * java.net.http/jdk.internal.net.http.hpack + * @library /test/lib /test/jdk/java/net/httpclient/lib + * @build jdk.httpclient.test.lib.http2.Http2TestServer * * @run testng/othervm -Djdk.httpclient.HttpClient.log=errors -Djdk.httpclient.keepalive.timeout=1 * IdleConnectionTimeoutTest @@ -65,6 +62,9 @@ import java.net.http.HttpClient; import java.net.http.HttpRequest; import java.net.http.HttpResponse; import java.util.concurrent.CompletableFuture; +import jdk.httpclient.test.lib.http2.Http2TestServer; +import jdk.httpclient.test.lib.http2.Http2TestExchange; +import jdk.httpclient.test.lib.http2.Http2Handler; import static java.nio.charset.StandardCharsets.UTF_8; import static java.net.http.HttpClient.Version.HTTP_2; diff --git a/test/jdk/java/net/httpclient/http2/ImplicitPushCancel.java b/test/jdk/java/net/httpclient/http2/ImplicitPushCancel.java index 69d9123203d..4d9ce835cdd 100644 --- a/test/jdk/java/net/httpclient/http2/ImplicitPushCancel.java +++ b/test/jdk/java/net/httpclient/http2/ImplicitPushCancel.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2023, 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 @@ -23,12 +23,8 @@ /* * @test - * @library /test/lib server - * @build jdk.test.lib.net.SimpleSSLContext - * @modules java.base/sun.net.www.http - * java.net.http/jdk.internal.net.http.common - * java.net.http/jdk.internal.net.http.frame - * java.net.http/jdk.internal.net.http.hpack + * @library /test/lib /test/jdk/java/net/httpclient/lib + * @build jdk.test.lib.net.SimpleSSLContext jdk.httpclient.test.lib.http2.Http2TestServer * @run testng/othervm * -Djdk.internal.httpclient.debug=true * -Djdk.httpclient.HttpClient.log=errors,requests,responses,trace @@ -52,6 +48,9 @@ import java.util.Objects; import java.util.concurrent.CompletableFuture; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; +import jdk.httpclient.test.lib.http2.Http2TestServer; +import jdk.httpclient.test.lib.http2.Http2TestExchange; +import jdk.httpclient.test.lib.http2.Http2Handler; import org.testng.annotations.AfterTest; import org.testng.annotations.BeforeTest; import org.testng.annotations.Test; diff --git a/test/jdk/java/net/httpclient/http2/NoBodyTest.java b/test/jdk/java/net/httpclient/http2/NoBodyTest.java index 95629d79d16..2dc7508f5ee 100644 --- a/test/jdk/java/net/httpclient/http2/NoBodyTest.java +++ b/test/jdk/java/net/httpclient/http2/NoBodyTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2023, 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 @@ -24,12 +24,8 @@ /* * @test * @bug 8087112 - * @library /test/lib server - * @build jdk.test.lib.net.SimpleSSLContext - * @modules java.base/sun.net.www.http - * java.net.http/jdk.internal.net.http.common - * java.net.http/jdk.internal.net.http.frame - * java.net.http/jdk.internal.net.http.hpack + * @library /test/lib /test/jdk/java/net/httpclient/lib + * @build jdk.test.lib.net.SimpleSSLContext jdk.httpclient.test.lib.http2.Http2TestServer * @run testng/othervm -Djdk.httpclient.HttpClient.log=ssl,requests,responses,errors NoBodyTest */ @@ -45,6 +41,9 @@ import java.net.http.HttpRequest.BodyPublishers; import java.net.http.HttpResponse; import java.net.http.HttpResponse.BodyHandlers; import java.util.concurrent.*; +import jdk.httpclient.test.lib.http2.Http2TestServer; +import jdk.httpclient.test.lib.http2.Http2TestExchange; +import jdk.httpclient.test.lib.http2.Http2Handler; import jdk.test.lib.net.SimpleSSLContext; import org.testng.annotations.Test; import static java.net.http.HttpClient.Version.HTTP_2; diff --git a/test/jdk/java/net/httpclient/http2/ProxyTest2.java b/test/jdk/java/net/httpclient/http2/ProxyTest2.java index 41ab317d4c9..32f7bd6b708 100644 --- a/test/jdk/java/net/httpclient/http2/ProxyTest2.java +++ b/test/jdk/java/net/httpclient/http2/ProxyTest2.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2023, 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 @@ -52,6 +52,9 @@ import javax.net.ssl.SSLSession; import java.net.http.HttpClient; import java.net.http.HttpRequest; import java.net.http.HttpResponse; +import jdk.httpclient.test.lib.http2.Http2TestServer; +import jdk.httpclient.test.lib.http2.Http2TestExchange; +import jdk.httpclient.test.lib.http2.Http2Handler; import jdk.test.lib.net.SimpleSSLContext; import java.util.concurrent.*; @@ -60,13 +63,8 @@ import java.util.concurrent.*; * @bug 8181422 * @summary Verifies that you can access an HTTP/2 server over HTTPS by * tunnelling through an HTTP/1.1 proxy. - * @modules java.net.http - * @library /test/lib server - * @modules java.base/sun.net.www.http - * java.net.http/jdk.internal.net.http.common - * java.net.http/jdk.internal.net.http.frame - * java.net.http/jdk.internal.net.http.hpack - * @build jdk.test.lib.net.SimpleSSLContext ProxyTest2 + * @library /test/lib /test/jdk/java/net/httpclient/lib + * @build jdk.test.lib.net.SimpleSSLContext jdk.httpclient.test.lib.http2.Http2TestServer * @run main/othervm ProxyTest2 * @author danielfuchs */ diff --git a/test/jdk/java/net/httpclient/http2/PushPromiseContinuation.java b/test/jdk/java/net/httpclient/http2/PushPromiseContinuation.java index bc8627a2bcc..a2eb054d809 100644 --- a/test/jdk/java/net/httpclient/http2/PushPromiseContinuation.java +++ b/test/jdk/java/net/httpclient/http2/PushPromiseContinuation.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2023, 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 @@ -27,12 +27,10 @@ * @summary Tests that the HttpClient can correctly receive a Push Promise * Frame with the END_HEADERS flag unset followed by one or more * Continuation Frames. - * @library /test/lib server - * @build jdk.test.lib.net.SimpleSSLContext - * @modules java.base/sun.net.www.http - * java.net.http/jdk.internal.net.http.common - * java.net.http/jdk.internal.net.http.frame - * java.net.http/jdk.internal.net.http.hpack + * @library /test/lib /test/jdk/java/net/httpclient/lib + * @build jdk.test.lib.net.SimpleSSLContext jdk.httpclient.test.lib.http2.Http2TestServer + * jdk.httpclient.test.lib.http2.BodyOutputStream + * jdk.httpclient.test.lib.http2.OutgoingPushPromise * @run testng/othervm PushPromiseContinuation */ @@ -65,6 +63,13 @@ import java.util.concurrent.CompletionException; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; import java.util.function.BiPredicate; +import jdk.httpclient.test.lib.http2.Http2TestServer; +import jdk.httpclient.test.lib.http2.Http2TestExchange; +import jdk.httpclient.test.lib.http2.Http2TestExchangeImpl; +import jdk.httpclient.test.lib.http2.Http2Handler; +import jdk.httpclient.test.lib.http2.BodyOutputStream; +import jdk.httpclient.test.lib.http2.OutgoingPushPromise; +import jdk.httpclient.test.lib.http2.Http2TestServerConnection; import static java.nio.charset.StandardCharsets.UTF_8; import static org.testng.Assert.*; @@ -235,7 +240,7 @@ public class PushPromiseContinuation { // Indicates to the client that a continuation should be expected pp.setFlag(0x0); try { - conn.outputQ.put(pp); + conn.addToOutputQ(pp); // writeLoop will spin up thread to read the InputStream } catch (IOException ex) { System.err.println("TestServer: pushPromise exception: " + ex); @@ -312,7 +317,7 @@ public class PushPromiseContinuation { try { // Schedule push promise and continuation for sending - conn.outputQ.put(pp); + conn.addToOutputQ(pp); System.err.println("Server: Scheduled a Push Promise to Send"); } catch (IOException ex) { System.err.println("Server: pushPromise exception: " + ex); diff --git a/test/jdk/java/net/httpclient/http2/RedirectTest.java b/test/jdk/java/net/httpclient/http2/RedirectTest.java index b51c4df42ea..2d7701c5e37 100644 --- a/test/jdk/java/net/httpclient/http2/RedirectTest.java +++ b/test/jdk/java/net/httpclient/http2/RedirectTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2023, 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 @@ -24,12 +24,10 @@ /* * @test * @bug 8156514 - * @library /test/lib server - * @build jdk.test.lib.net.SimpleSSLContext - * @modules java.base/sun.net.www.http - * java.net.http/jdk.internal.net.http.common - * java.net.http/jdk.internal.net.http.frame - * java.net.http/jdk.internal.net.http.hpack + * @library /test/lib /test/jdk/java/net/httpclient/lib + * @build jdk.test.lib.net.SimpleSSLContext jdk.httpclient.test.lib.http2.Http2TestServer + * jdk.httpclient.test.lib.http2.Http2EchoHandler + * jdk.httpclient.test.lib.http2.Http2RedirectHandler * @run testng/othervm * -Djdk.httpclient.HttpClient.log=frames,ssl,requests,responses,errors * -Djdk.internal.httpclient.debug=true @@ -47,6 +45,11 @@ import java.util.concurrent.*; import java.util.function.*; import java.util.Arrays; import java.util.Iterator; +import jdk.httpclient.test.lib.http2.Http2TestServer; +import jdk.httpclient.test.lib.http2.Http2TestExchange; +import jdk.httpclient.test.lib.http2.Http2Handler; +import jdk.httpclient.test.lib.http2.Http2EchoHandler; +import jdk.httpclient.test.lib.http2.Http2RedirectHandler; import org.testng.annotations.Test; import static java.net.http.HttpClient.Version.HTTP_2; diff --git a/test/jdk/java/net/httpclient/http2/ServerPush.java b/test/jdk/java/net/httpclient/http2/ServerPush.java index 5652dae79c5..60958dce696 100644 --- a/test/jdk/java/net/httpclient/http2/ServerPush.java +++ b/test/jdk/java/net/httpclient/http2/ServerPush.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2023, 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 @@ -24,12 +24,9 @@ /* * @test * @bug 8087112 8159814 - * @library /test/lib server - * @build jdk.test.lib.net.SimpleSSLContext - * @modules java.base/sun.net.www.http - * java.net.http/jdk.internal.net.http.common - * java.net.http/jdk.internal.net.http.frame - * java.net.http/jdk.internal.net.http.hpack + * @library /test/lib /test/jdk/java/net/httpclient/lib + * @build jdk.test.lib.net.SimpleSSLContext jdk.httpclient.test.lib.http2.Http2TestServer + * jdk.httpclient.test.lib.common.TestUtil jdk.httpclient.test.lib.http2.PushHandler * @run testng/othervm * -Djdk.httpclient.HttpClient.log=errors,requests,responses * ServerPush @@ -47,6 +44,11 @@ import java.net.http.HttpResponse.PushPromiseHandler; import java.util.*; import java.util.concurrent.*; import java.util.function.Consumer; +import jdk.httpclient.test.lib.common.TestUtil; +import jdk.httpclient.test.lib.http2.Http2TestServer; +import jdk.httpclient.test.lib.http2.Http2TestExchange; +import jdk.httpclient.test.lib.http2.Http2Handler; +import jdk.httpclient.test.lib.http2.PushHandler; import org.testng.annotations.AfterTest; import org.testng.annotations.BeforeTest; import org.testng.annotations.Test; diff --git a/test/jdk/java/net/httpclient/http2/ServerPushWithDiffTypes.java b/test/jdk/java/net/httpclient/http2/ServerPushWithDiffTypes.java index 8b5426d70d6..3e12a20c15e 100644 --- a/test/jdk/java/net/httpclient/http2/ServerPushWithDiffTypes.java +++ b/test/jdk/java/net/httpclient/http2/ServerPushWithDiffTypes.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2023, 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 @@ -23,12 +23,8 @@ /* * @test - * @library /test/lib server - * @build jdk.test.lib.net.SimpleSSLContext - * @modules java.base/sun.net.www.http - * java.net.http/jdk.internal.net.http.common - * java.net.http/jdk.internal.net.http.frame - * java.net.http/jdk.internal.net.http.hpack + * @library /test/lib /test/jdk/java/net/httpclient/lib + * @build jdk.test.lib.net.SimpleSSLContext jdk.httpclient.test.lib.http2.Http2TestServer * @run testng/othervm * -Djdk.internal.httpclient.debug=true * -Djdk.httpclient.HttpClient.log=errors,requests,responses @@ -47,6 +43,9 @@ import java.net.http.HttpResponse.BodySubscribers; import java.util.*; import java.util.concurrent.*; import java.util.function.BiPredicate; +import jdk.httpclient.test.lib.http2.Http2TestServer; +import jdk.httpclient.test.lib.http2.Http2TestExchange; +import jdk.httpclient.test.lib.http2.Http2Handler; import org.testng.annotations.Test; import static java.nio.charset.StandardCharsets.UTF_8; diff --git a/test/jdk/java/net/httpclient/http2/TLSConnection.java b/test/jdk/java/net/httpclient/http2/TLSConnection.java index 933ca784cb9..fd9cff38371 100644 --- a/test/jdk/java/net/httpclient/http2/TLSConnection.java +++ b/test/jdk/java/net/httpclient/http2/TLSConnection.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2023, 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 @@ -35,16 +35,16 @@ import java.net.http.HttpResponse.BodyHandlers; import javax.net.ssl.SSLContext; import javax.net.ssl.SSLParameters; import javax.net.ssl.SSLSession; +import jdk.httpclient.test.lib.http2.Http2TestServer; +import jdk.httpclient.test.lib.http2.Http2TestExchange; +import jdk.httpclient.test.lib.http2.Http2Handler; /* * @test * @bug 8150769 8157107 - * @library server + * @library /test/jdk/java/net/httpclient/lib + * @build jdk.httpclient.test.lib.http2.Http2TestServer * @summary Checks that SSL parameters can be set for HTTP/2 connection - * @modules java.base/sun.net.www.http - * java.net.http/jdk.internal.net.http.common - * java.net.http/jdk.internal.net.http.frame - * java.net.http/jdk.internal.net.http.hpack * @run main/othervm * -Djdk.internal.httpclient.debug=true * -Djdk.httpclient.HttpClient.log=all diff --git a/test/jdk/java/net/httpclient/http2/UserInfoTest.java b/test/jdk/java/net/httpclient/http2/UserInfoTest.java index 90131e7c20e..7dafda0c1f8 100644 --- a/test/jdk/java/net/httpclient/http2/UserInfoTest.java +++ b/test/jdk/java/net/httpclient/http2/UserInfoTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2023, 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 @@ -34,6 +34,10 @@ import java.net.URI; import java.net.http.HttpClient; import java.net.http.HttpRequest; import java.net.http.HttpResponse; +import jdk.httpclient.test.lib.http2.Http2TestServer; +import jdk.httpclient.test.lib.http2.Http2TestExchange; +import jdk.httpclient.test.lib.http2.Http2Handler; + import static org.junit.jupiter.api.Assertions.assertEquals; @@ -41,11 +45,8 @@ import static org.junit.jupiter.api.Assertions.assertEquals; /** * @test * @bug 8292876 - * @library /test/lib server - * @modules java.base/sun.net.www.http - * java.net.http/jdk.internal.net.http.common - * java.net.http/jdk.internal.net.http.frame - * java.net.http/jdk.internal.net.http.hpack + * @library /test/lib /test/jdk/java/net/httpclient/lib + * @build jdk.httpclient.test.lib.http2.Http2TestServer jdk.test.lib.net.SimpleSSLContext * @run junit UserInfoTest */ diff --git a/test/jdk/java/net/httpclient/httpclient-localaddr-security.policy b/test/jdk/java/net/httpclient/httpclient-localaddr-security.policy index 031f37dfac1..58ad31c98c3 100644 --- a/test/jdk/java/net/httpclient/httpclient-localaddr-security.policy +++ b/test/jdk/java/net/httpclient/httpclient-localaddr-security.policy @@ -1,5 +1,5 @@ // -// Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. +// Copyright (c) 2022, 2023, 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 @@ -30,8 +30,8 @@ grant codeBase "file:${test.classes}/../../../../test/lib/-" { permission java.util.PropertyPermission "java.net.preferIPv6Addresses", "read"; }; -// for JTwork//classes/0/java/net/httpclient/http2/server/* -grant codeBase "file:${test.classes}/../../../../java/net/httpclient/http2/server/*" { +// for classes in JTwork//classes/0/test/jdk/java/net/httpclient/lib/ +grant codeBase "file:${test.classes}/../../../../test/jdk/java/net/httpclient/lib/-" { permission java.lang.RuntimePermission "accessClassInPackage.jdk.internal.net.http.common"; permission java.lang.RuntimePermission "accessClassInPackage.jdk.internal.net.http.frame"; permission java.lang.RuntimePermission "accessClassInPackage.jdk.internal.net.http.hpack"; diff --git a/test/jdk/java/net/httpclient/http2/server/ExceptionallyCloseable.java b/test/jdk/java/net/httpclient/lib/jdk/httpclient/test/lib/common/ExceptionallyCloseable.java similarity index 95% rename from test/jdk/java/net/httpclient/http2/server/ExceptionallyCloseable.java rename to test/jdk/java/net/httpclient/lib/jdk/httpclient/test/lib/common/ExceptionallyCloseable.java index 338af80c59e..f0727d80136 100644 --- a/test/jdk/java/net/httpclient/http2/server/ExceptionallyCloseable.java +++ b/test/jdk/java/net/httpclient/lib/jdk/httpclient/test/lib/common/ExceptionallyCloseable.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2023, 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 @@ -21,6 +21,8 @@ * questions. */ +package jdk.httpclient.test.lib.common; + import java.io.Closeable; import java.io.IOException; diff --git a/test/jdk/java/net/httpclient/HttpServerAdapters.java b/test/jdk/java/net/httpclient/lib/jdk/httpclient/test/lib/common/HttpServerAdapters.java similarity index 99% rename from test/jdk/java/net/httpclient/HttpServerAdapters.java rename to test/jdk/java/net/httpclient/lib/jdk/httpclient/test/lib/common/HttpServerAdapters.java index 66d5e2b72a9..ac58fda71e1 100644 --- a/test/jdk/java/net/httpclient/HttpServerAdapters.java +++ b/test/jdk/java/net/httpclient/lib/jdk/httpclient/test/lib/common/HttpServerAdapters.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2023, 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 @@ -20,6 +20,7 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ +package jdk.httpclient.test.lib.common; import com.sun.net.httpserver.Filter; import com.sun.net.httpserver.Headers; @@ -27,6 +28,9 @@ import com.sun.net.httpserver.HttpContext; import com.sun.net.httpserver.HttpExchange; import com.sun.net.httpserver.HttpHandler; import com.sun.net.httpserver.HttpServer; +import jdk.httpclient.test.lib.http2.Http2Handler; +import jdk.httpclient.test.lib.http2.Http2TestExchange; +import jdk.httpclient.test.lib.http2.Http2TestServer; import jdk.internal.net.http.common.HttpHeadersBuilder; import java.net.InetAddress; diff --git a/test/jdk/java/net/httpclient/http2/server/TestUtil.java b/test/jdk/java/net/httpclient/lib/jdk/httpclient/test/lib/common/TestUtil.java similarity index 96% rename from test/jdk/java/net/httpclient/http2/server/TestUtil.java rename to test/jdk/java/net/httpclient/lib/jdk/httpclient/test/lib/common/TestUtil.java index db03c218bc2..2b2dacff57b 100644 --- a/test/jdk/java/net/httpclient/http2/server/TestUtil.java +++ b/test/jdk/java/net/httpclient/lib/jdk/httpclient/test/lib/common/TestUtil.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2023, 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 @@ -21,6 +21,8 @@ * questions. */ +package jdk.httpclient.test.lib.common; + import java.io.*; import java.nio.file.*; import java.util.Arrays; diff --git a/test/jdk/java/net/httpclient/http2/server/BodyInputStream.java b/test/jdk/java/net/httpclient/lib/jdk/httpclient/test/lib/http2/BodyInputStream.java similarity index 97% rename from test/jdk/java/net/httpclient/http2/server/BodyInputStream.java rename to test/jdk/java/net/httpclient/lib/jdk/httpclient/test/lib/http2/BodyInputStream.java index 4ffca293ded..71372d5e95f 100644 --- a/test/jdk/java/net/httpclient/http2/server/BodyInputStream.java +++ b/test/jdk/java/net/httpclient/lib/jdk/httpclient/test/lib/http2/BodyInputStream.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2023, 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 @@ -21,6 +21,8 @@ * questions. */ +package jdk.httpclient.test.lib.http2; + import java.io.*; import java.nio.ByteBuffer; import java.util.List; diff --git a/test/jdk/java/net/httpclient/http2/server/BodyOutputStream.java b/test/jdk/java/net/httpclient/lib/jdk/httpclient/test/lib/http2/BodyOutputStream.java similarity index 94% rename from test/jdk/java/net/httpclient/http2/server/BodyOutputStream.java rename to test/jdk/java/net/httpclient/lib/jdk/httpclient/test/lib/http2/BodyOutputStream.java index 008d9bdffc1..d043f81390e 100644 --- a/test/jdk/java/net/httpclient/http2/server/BodyOutputStream.java +++ b/test/jdk/java/net/httpclient/lib/jdk/httpclient/test/lib/http2/BodyOutputStream.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2023, 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 @@ -21,6 +21,8 @@ * questions. */ +package jdk.httpclient.test.lib.http2; + import java.io.*; import java.nio.ByteBuffer; @@ -31,7 +33,7 @@ import jdk.internal.net.http.frame.DataFrame; * reader thread. */ @SuppressWarnings({"rawtypes","unchecked"}) -class BodyOutputStream extends OutputStream { +public class BodyOutputStream extends OutputStream { final static byte[] EMPTY_BARRAY = new byte[0]; final int streamid; @@ -72,7 +74,7 @@ class BodyOutputStream extends OutputStream { } } - void goodToGo() { + public void goodToGo() { goodToGo = true; } @@ -116,7 +118,7 @@ class BodyOutputStream extends OutputStream { write(one, 0, 1); } - void closeInternal() { + public void markClosed() { closed = true; } diff --git a/test/jdk/java/net/httpclient/http2/server/EchoHandler.java b/test/jdk/java/net/httpclient/lib/jdk/httpclient/test/lib/http2/EchoHandler.java similarity index 96% rename from test/jdk/java/net/httpclient/http2/server/EchoHandler.java rename to test/jdk/java/net/httpclient/lib/jdk/httpclient/test/lib/http2/EchoHandler.java index 58cc22943d6..24ac59d96dc 100644 --- a/test/jdk/java/net/httpclient/http2/server/EchoHandler.java +++ b/test/jdk/java/net/httpclient/lib/jdk/httpclient/test/lib/http2/EchoHandler.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2023, 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 @@ -21,6 +21,8 @@ * questions. */ +package jdk.httpclient.test.lib.http2; + import java.io.*; import java.nio.file.Files; import java.nio.file.Path; diff --git a/test/jdk/java/net/httpclient/http2/server/Http2EchoHandler.java b/test/jdk/java/net/httpclient/lib/jdk/httpclient/test/lib/http2/Http2EchoHandler.java similarity index 97% rename from test/jdk/java/net/httpclient/http2/server/Http2EchoHandler.java rename to test/jdk/java/net/httpclient/lib/jdk/httpclient/test/lib/http2/Http2EchoHandler.java index c7b9a21c5cb..7b13724ac51 100644 --- a/test/jdk/java/net/httpclient/http2/server/Http2EchoHandler.java +++ b/test/jdk/java/net/httpclient/lib/jdk/httpclient/test/lib/http2/Http2EchoHandler.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2023, 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 @@ -20,6 +20,7 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ +package jdk.httpclient.test.lib.http2; import java.io.*; import java.net.http.HttpHeaders; diff --git a/test/jdk/java/net/httpclient/http2/server/Http2Handler.java b/test/jdk/java/net/httpclient/lib/jdk/httpclient/test/lib/http2/Http2Handler.java similarity index 93% rename from test/jdk/java/net/httpclient/http2/server/Http2Handler.java rename to test/jdk/java/net/httpclient/lib/jdk/httpclient/test/lib/http2/Http2Handler.java index 03af49e8b07..8871f0c2cd5 100644 --- a/test/jdk/java/net/httpclient/http2/server/Http2Handler.java +++ b/test/jdk/java/net/httpclient/lib/jdk/httpclient/test/lib/http2/Http2Handler.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2023, 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 @@ -21,6 +21,7 @@ * questions. */ +package jdk.httpclient.test.lib.http2; import java.io.IOException; diff --git a/test/jdk/java/net/httpclient/http2/server/Http2RedirectHandler.java b/test/jdk/java/net/httpclient/lib/jdk/httpclient/test/lib/http2/Http2RedirectHandler.java similarity index 95% rename from test/jdk/java/net/httpclient/http2/server/Http2RedirectHandler.java rename to test/jdk/java/net/httpclient/lib/jdk/httpclient/test/lib/http2/Http2RedirectHandler.java index 97ea94b7b91..69e4344aff2 100644 --- a/test/jdk/java/net/httpclient/http2/server/Http2RedirectHandler.java +++ b/test/jdk/java/net/httpclient/lib/jdk/httpclient/test/lib/http2/Http2RedirectHandler.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2023, 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 @@ -21,6 +21,8 @@ * questions. */ +package jdk.httpclient.test.lib.http2; + import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; diff --git a/test/jdk/java/net/httpclient/http2/server/Http2TestExchange.java b/test/jdk/java/net/httpclient/lib/jdk/httpclient/test/lib/http2/Http2TestExchange.java similarity index 95% rename from test/jdk/java/net/httpclient/http2/server/Http2TestExchange.java rename to test/jdk/java/net/httpclient/lib/jdk/httpclient/test/lib/http2/Http2TestExchange.java index 30aad46b178..208a8d54e08 100644 --- a/test/jdk/java/net/httpclient/http2/server/Http2TestExchange.java +++ b/test/jdk/java/net/httpclient/lib/jdk/httpclient/test/lib/http2/Http2TestExchange.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2023, 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 @@ -21,6 +21,8 @@ * questions. */ +package jdk.httpclient.test.lib.http2; + import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; diff --git a/test/jdk/java/net/httpclient/http2/server/Http2TestExchangeImpl.java b/test/jdk/java/net/httpclient/lib/jdk/httpclient/test/lib/http2/Http2TestExchangeImpl.java similarity index 93% rename from test/jdk/java/net/httpclient/http2/server/Http2TestExchangeImpl.java rename to test/jdk/java/net/httpclient/lib/jdk/httpclient/test/lib/http2/Http2TestExchangeImpl.java index 38e22d3bc47..8f7c154e656 100644 --- a/test/jdk/java/net/httpclient/http2/server/Http2TestExchangeImpl.java +++ b/test/jdk/java/net/httpclient/lib/jdk/httpclient/test/lib/http2/Http2TestExchangeImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2023, 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 @@ -21,6 +21,8 @@ * questions. */ +package jdk.httpclient.test.lib.http2; + import jdk.internal.net.http.common.HttpHeadersBuilder; import jdk.internal.net.http.frame.HeaderFrame; import jdk.internal.net.http.frame.HeadersFrame; @@ -40,21 +42,21 @@ public class Http2TestExchangeImpl implements Http2TestExchange { static final String HEAD = "HEAD"; final HttpHeaders reqheaders; - final HttpHeadersBuilder rspheadersBuilder; + protected final HttpHeadersBuilder rspheadersBuilder; final URI uri; final String method; final InputStream is; - final BodyOutputStream os; + protected final BodyOutputStream os; final SSLSession sslSession; - final int streamid; + protected final int streamid; final boolean pushAllowed; - final Http2TestServerConnection conn; + protected final Http2TestServerConnection conn; final Http2TestServer server; int responseCode = -1; - long responseLength; + protected long responseLength; - Http2TestExchangeImpl(int streamid, + public Http2TestExchangeImpl(int streamid, String method, HttpHeaders reqheaders, HttpHeadersBuilder rspheadersBuilder, @@ -147,7 +149,7 @@ public class Http2TestExchangeImpl implements Http2TestExchange { if (responseLength < 0 || rCode == 204) { response.setFlag(HeadersFrame.END_STREAM); - os.closeInternal(); + os.markClosed(); } conn.outputQ.put(response); os.goodToGo(); diff --git a/test/jdk/java/net/httpclient/http2/server/Http2TestExchangeSupplier.java b/test/jdk/java/net/httpclient/lib/jdk/httpclient/test/lib/http2/Http2TestExchangeSupplier.java similarity index 95% rename from test/jdk/java/net/httpclient/http2/server/Http2TestExchangeSupplier.java rename to test/jdk/java/net/httpclient/lib/jdk/httpclient/test/lib/http2/Http2TestExchangeSupplier.java index 7f96a86bc0a..c423632e565 100644 --- a/test/jdk/java/net/httpclient/http2/server/Http2TestExchangeSupplier.java +++ b/test/jdk/java/net/httpclient/lib/jdk/httpclient/test/lib/http2/Http2TestExchangeSupplier.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2023, 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 @@ -21,6 +21,8 @@ * questions. */ +package jdk.httpclient.test.lib.http2; + import javax.net.ssl.SSLSession; import java.io.InputStream; import java.net.URI; diff --git a/test/jdk/java/net/httpclient/http2/server/Http2TestServer.java b/test/jdk/java/net/httpclient/lib/jdk/httpclient/test/lib/http2/Http2TestServer.java similarity index 99% rename from test/jdk/java/net/httpclient/http2/server/Http2TestServer.java rename to test/jdk/java/net/httpclient/lib/jdk/httpclient/test/lib/http2/Http2TestServer.java index c6e7de07dff..e13ceaef875 100644 --- a/test/jdk/java/net/httpclient/http2/server/Http2TestServer.java +++ b/test/jdk/java/net/httpclient/lib/jdk/httpclient/test/lib/http2/Http2TestServer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2023, 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 @@ -21,6 +21,8 @@ * questions. */ +package jdk.httpclient.test.lib.http2; + import java.io.IOException; import java.net.*; import java.util.*; diff --git a/test/jdk/java/net/httpclient/http2/server/Http2TestServerConnection.java b/test/jdk/java/net/httpclient/lib/jdk/httpclient/test/lib/http2/Http2TestServerConnection.java similarity index 99% rename from test/jdk/java/net/httpclient/http2/server/Http2TestServerConnection.java rename to test/jdk/java/net/httpclient/lib/jdk/httpclient/test/lib/http2/Http2TestServerConnection.java index dfac6d34587..62059baa632 100644 --- a/test/jdk/java/net/httpclient/http2/server/Http2TestServerConnection.java +++ b/test/jdk/java/net/httpclient/lib/jdk/httpclient/test/lib/http2/Http2TestServerConnection.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2023, 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 @@ -21,6 +21,8 @@ * questions. */ +package jdk.httpclient.test.lib.http2; + import jdk.internal.net.http.common.HttpHeadersBuilder; import jdk.internal.net.http.frame.DataFrame; import jdk.internal.net.http.frame.ErrorFrame; @@ -275,6 +277,10 @@ public class Http2TestServerConnection { } } + public void addToOutputQ(final Http2Frame frame) throws IOException { + outputQ.put(frame); + } + private static boolean compareIPAddrs(InetAddress addr1, String host) { try { InetAddress addr2 = InetAddress.getByName(host); @@ -800,7 +806,7 @@ public class Http2TestServerConnection { q.orderlyClose(); BodyOutputStream oq = outStreams.get(stream); if (oq != null) - oq.closeInternal(); + oq.markClosed(); } else if (pushStreams.contains(stream)) { // we could interrupt the pushStream's output // but the continuation, even after a reset @@ -845,7 +851,7 @@ public class Http2TestServerConnection { } /** Encodes an group of headers, without any ordering guarantees. */ - List encodeHeaders(HttpHeaders headers) { + public List encodeHeaders(HttpHeaders headers) { List buffers = new LinkedList<>(); ByteBuffer buf = getBuffer(); @@ -871,7 +877,7 @@ public class Http2TestServerConnection { } /** Encodes an ordered list of headers. */ - List encodeHeadersOrdered(List> headers) { + public List encodeHeadersOrdered(List> headers) { List buffers = new LinkedList<>(); ByteBuffer buf = getBuffer(); diff --git a/test/jdk/java/net/httpclient/http2/server/NoBodyHandler.java b/test/jdk/java/net/httpclient/lib/jdk/httpclient/test/lib/http2/NoBodyHandler.java similarity index 94% rename from test/jdk/java/net/httpclient/http2/server/NoBodyHandler.java rename to test/jdk/java/net/httpclient/lib/jdk/httpclient/test/lib/http2/NoBodyHandler.java index 7a28ed5d9e8..791d22bbf0d 100644 --- a/test/jdk/java/net/httpclient/http2/server/NoBodyHandler.java +++ b/test/jdk/java/net/httpclient/lib/jdk/httpclient/test/lib/http2/NoBodyHandler.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2023, 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 @@ -21,6 +21,8 @@ * questions. */ +package jdk.httpclient.test.lib.http2; + import java.io.*; import static java.lang.System.out; diff --git a/test/jdk/java/net/httpclient/http2/server/OutgoingPushPromise.java b/test/jdk/java/net/httpclient/lib/jdk/httpclient/test/lib/http2/OutgoingPushPromise.java similarity index 93% rename from test/jdk/java/net/httpclient/http2/server/OutgoingPushPromise.java rename to test/jdk/java/net/httpclient/lib/jdk/httpclient/test/lib/http2/OutgoingPushPromise.java index cd4fca0a817..908a901133a 100644 --- a/test/jdk/java/net/httpclient/http2/server/OutgoingPushPromise.java +++ b/test/jdk/java/net/httpclient/lib/jdk/httpclient/test/lib/http2/OutgoingPushPromise.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2023, 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 @@ -21,6 +21,8 @@ * questions. */ +package jdk.httpclient.test.lib.http2; + import java.io.InputStream; import java.net.URI; import java.net.http.HttpHeaders; @@ -31,7 +33,7 @@ import jdk.internal.net.http.frame.Http2Frame; // will be converted to a PushPromiseFrame in the writeLoop // a thread is then created to produce the DataFrames from the InputStream -class OutgoingPushPromise extends Http2Frame { +public class OutgoingPushPromise extends Http2Frame { final HttpHeaders headers; final URI uri; final InputStream is; diff --git a/test/jdk/java/net/httpclient/http2/server/PushHandler.java b/test/jdk/java/net/httpclient/lib/jdk/httpclient/test/lib/http2/PushHandler.java similarity index 96% rename from test/jdk/java/net/httpclient/http2/server/PushHandler.java rename to test/jdk/java/net/httpclient/lib/jdk/httpclient/test/lib/http2/PushHandler.java index 07864fd0c77..2e014135445 100644 --- a/test/jdk/java/net/httpclient/http2/server/PushHandler.java +++ b/test/jdk/java/net/httpclient/lib/jdk/httpclient/test/lib/http2/PushHandler.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2023, 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 @@ -21,6 +21,8 @@ * questions. */ +package jdk.httpclient.test.lib.http2; + import java.io.*; import java.net.*; import java.net.http.HttpHeaders; diff --git a/test/jdk/java/net/httpclient/http2/server/Queue.java b/test/jdk/java/net/httpclient/lib/jdk/httpclient/test/lib/http2/Queue.java similarity index 96% rename from test/jdk/java/net/httpclient/http2/server/Queue.java rename to test/jdk/java/net/httpclient/lib/jdk/httpclient/test/lib/http2/Queue.java index 66b931b4b7c..358d6c509f6 100644 --- a/test/jdk/java/net/httpclient/http2/server/Queue.java +++ b/test/jdk/java/net/httpclient/lib/jdk/httpclient/test/lib/http2/Queue.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2023, 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 @@ -21,11 +21,15 @@ * questions. */ +package jdk.httpclient.test.lib.http2; + import java.io.IOException; import java.util.LinkedList; import java.util.Objects; import java.util.stream.Stream; +import jdk.httpclient.test.lib.common.ExceptionallyCloseable; + // Each stream has one of these for input. Each Http2Connection has one // for output. Can be used blocking or asynchronously.