Skip to content

Commit

Permalink
Fix jakartaee#736 remove JAR that provided http/2 support for Java 8
Browse files Browse the repository at this point in the history
  • Loading branch information
markt-asf committed Jan 14, 2022
1 parent 61ee311 commit 6a1a344
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 101 deletions.
7 changes: 4 additions & 3 deletions install/jakartaee/bin/ts.jte
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#
# Copyright (c) 2006, 2021 Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2006, 2022 Oracle and/or its affiliates and others.
# All rights reserved.
#
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License v. 2.0, which is available at
Expand Down Expand Up @@ -1072,10 +1073,10 @@ ts.run.classpath.ri=${javaee.classes.ri}${pathsep}${ts.home}/lib/tsharness.jar${

ts.run.classpath=${pathsep}${javaee.classes}${pathsep}${ts.home}/lib/tsharness.jar${pathsep}${ts.home}/lib/cts.jar${pathsep}${ts.home}/lib/glassfishporting.jar${pathsep}${jdbc.db.classes}

ts.harness.classpath=${ts.home}/lib/jaxb-api.jar${pathsep}${ts.home}/lib/jaxb-core.jar${pathsep}${ts.home}/lib/jaxb-impl.jar${pathsep}${ts.home}/lib/jaxb-xjc.jar${pathsep}${ts.home}/lib/tsharness.jar${pathsep}${ts.home}/lib/cts.jar${pathsep}${ts.home}/lib/glassfishporting.jar${pathsep}${ts.home}/lib/sigtest.jar${pathsep}${ts.run.classpath}${pathsep}${ts.home}/lib/javatest.jar${pathsep}${ts.home}/lib/jdom-1.1.3.jar${pathsep}${ant.home}/lib/ant.jar${pathsep}${ri.modules}/admin-cli.jar${pathsep}${ts.home}/lib/http.jar
ts.harness.classpath=${ts.home}/lib/jaxb-api.jar${pathsep}${ts.home}/lib/jaxb-core.jar${pathsep}${ts.home}/lib/jaxb-impl.jar${pathsep}${ts.home}/lib/jaxb-xjc.jar${pathsep}${ts.home}/lib/tsharness.jar${pathsep}${ts.home}/lib/cts.jar${pathsep}${ts.home}/lib/glassfishporting.jar${pathsep}${ts.home}/lib/sigtest.jar${pathsep}${ts.run.classpath}${pathsep}${ts.home}/lib/javatest.jar${pathsep}${ts.home}/lib/jdom-1.1.3.jar${pathsep}${ant.home}/lib/ant.jar${pathsep}${ri.modules}/admin-cli.jar

#classpath used for building CTS tests only (DO NOT MODIFY)
ts.classpath=${ts.home}/lib/commons-lang3-3.3.2.jar${pathsep}${javaee.home.ri}/javadb/lib/derby.jar${pathsep}${ts.home}/lib/tsharness.jar${pathsep}${ts.home}/lib/cts.jar${pathsep}${ts.home}/lib/glassfishporting.jar${pathsep}${ts.home}/lib/sigtest.jar${pathsep}${ts.run.classpath}${pathsep}${ts.run.classpath.ri}${pathsep}${ts.home}/lib/javatest.jar${pathsep}${ts.home}/lib/jdom-1.1.3.jar${pathsep}${ant.home}/lib/ant.jar${pathsep}${ts.home}/lib/commons-httpclient-3.1.jar${pathsep}${ts.home}/lib/commons-logging-1.1.3.jar${pathsep}${ts.home}/lib/htmlunit-2.15.jar${pathsep}${ts.home}/lib/htmlunit-core-js-2.15.jar${pathsep}${ts.home}/lib/unboundid-ldapsdk.jar${pathsep}${ts.home}/lib/commons-codec-1.9.jar${pathsep}${ts.home}/lib/xml-apis-1.4.01.jar${pathsep}${ts.home}/lib/http.jar:${ts.home}/lib/jaxb-api.jar
ts.classpath=${ts.home}/lib/commons-lang3-3.3.2.jar${pathsep}${javaee.home.ri}/javadb/lib/derby.jar${pathsep}${ts.home}/lib/tsharness.jar${pathsep}${ts.home}/lib/cts.jar${pathsep}${ts.home}/lib/glassfishporting.jar${pathsep}${ts.home}/lib/sigtest.jar${pathsep}${ts.run.classpath}${pathsep}${ts.run.classpath.ri}${pathsep}${ts.home}/lib/javatest.jar${pathsep}${ts.home}/lib/jdom-1.1.3.jar${pathsep}${ant.home}/lib/ant.jar${pathsep}${ts.home}/lib/commons-httpclient-3.1.jar${pathsep}${ts.home}/lib/commons-logging-1.1.3.jar${pathsep}${ts.home}/lib/htmlunit-2.15.jar${pathsep}${ts.home}/lib/htmlunit-core-js-2.15.jar${pathsep}${ts.home}/lib/unboundid-ldapsdk.jar${pathsep}${ts.home}/lib/commons-codec-1.9.jar${pathsep}${ts.home}/lib/xml-apis-1.4.01.jar${pathsep}${ts.home}/lib/jaxb-api.jar
#classpath used for building cts.jar (DO NOT MODIFY)
ts.lib.classpath=${javaee.home.ri}/javadb/lib/derby.jar${pathsep}${ts.harness.classpath}

Expand Down
6 changes: 3 additions & 3 deletions install/servlet/bin/ts.jte
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2009, 2021 Oracle and/or its affiliates and others.
# Copyright (c) 2009, 2022 Oracle and/or its affiliates and others.
# All rights reserved.
#
# This program and the accompanying materials are made available under the
Expand Down Expand Up @@ -136,11 +136,11 @@ alt.schema.dir=${ts.home}/lib/schemas
# @ts.classpath -- Classes used to build the Servlet TCK tests
# @servlet.classes -- Servlet API classes, default value using Servlet RI
##########################################################################
local.classes=${ts.home}/classes${pathsep}${servlet.classes}${pathsep}${ts.home}/lib/commons-httpclient-3.1.jar${pathsep}${ts.home}/lib/commons-logging-1.1.3.jar${pathsep}${ts.home}/lib/commons-codec-1.9.jar${pathsep}${ts.home}/lib/sigtest.jar${pathsep}${ts.home}/lib/javatest.jar${pathsep}${ts.home}/lib/tsharness.jar${pathsep}${ts.home}/lib/servlettck.jar${pathsep}${ts.home}/lib/http.jar
local.classes=${ts.home}/classes${pathsep}${servlet.classes}${pathsep}${ts.home}/lib/commons-httpclient-3.1.jar${pathsep}${ts.home}/lib/commons-logging-1.1.3.jar${pathsep}${ts.home}/lib/commons-codec-1.9.jar${pathsep}${ts.home}/lib/sigtest.jar${pathsep}${ts.home}/lib/javatest.jar${pathsep}${ts.home}/lib/tsharness.jar${pathsep}${ts.home}/lib/servlettck.jar$

ts.classpath=${local.classes}${pathsep}${ts.harness.classpath}

ts.harness.classpath=${ts.home}/lib/jaxb-xjc.jar${pathsep}${ts.home}/lib/tsharness.jar${pathsep}${ts.home}/lib/servlettck.jar${pathsep}${ts.home}/lib/javatest.jar${pathsep}${ant.home}/lib/ant.jar${pathsep}${ts.home}/lib/http.jar${pathsep}${servlet.classes}${pathsep}${ts.home}/lib/jaxb-impl.jar${pathsep}${ts.home}/lib/jaxb-api.jar
ts.harness.classpath=${ts.home}/lib/jaxb-xjc.jar${pathsep}${ts.home}/lib/tsharness.jar${pathsep}${ts.home}/lib/servlettck.jar${pathsep}${ts.home}/lib/javatest.jar${pathsep}${ant.home}/lib/ant.jar${pathsep}${servlet.classes}${pathsep}${ts.home}/lib/jaxb-impl.jar${pathsep}${ts.home}/lib/jaxb-api.jar

servlet.classes=${web.home}/modules/jakarta.servlet-api.jar${pathsep}${web.home}/modules/jakarta.annotation-api.jar

Expand Down
Binary file removed lib/http.jar
Binary file not shown.
59 changes: 33 additions & 26 deletions src/com/sun/ts/tests/servlet/spec/serverpush/Client.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2019 Oracle and/or its affiliates and others.
* Copyright (c) 2017, 2022 Oracle and/or its affiliates and others.
* All rights reserved.
*
* This program and the accompanying materials are made available under the
Expand All @@ -22,10 +22,6 @@
import com.sun.ts.lib.porting.TSURL;
import com.sun.ts.lib.util.TestUtil;
import com.sun.ts.lib.util.WebUtil;
import jdk.incubator.http.HttpClient;
import jdk.incubator.http.HttpRequest;
import jdk.incubator.http.HttpResponse;
import jdk.incubator.http.MultiMapResult;
import org.apache.commons.codec.binary.Base64;

import java.net.Authenticator;
Expand All @@ -35,6 +31,9 @@
import java.net.HttpCookie;
import java.net.InetAddress;
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
Expand All @@ -44,7 +43,10 @@
import java.util.Properties;
import java.util.StringTokenizer;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.Executors;
import java.util.function.Function;

public class Client extends EETest {
private static final String CONTEXT_ROOT = "/servlet_spec_serverpush_web";
Expand Down Expand Up @@ -488,7 +490,7 @@ private List<HttpResponse<String>> sendRequest(Map<String, String> headers,
if (auth != null)
builder.authenticator(auth);
if (cm != null)
builder.cookieManager(cm);
builder.cookieHandler(cm);

HttpClient client = builder.version(HttpClient.Version.HTTP_2)
.followRedirects(HttpClient.Redirect.ALWAYS)
Expand All @@ -507,26 +509,31 @@ private List<HttpResponse<String>> sendRequest(Map<String, String> headers,

HttpRequest request = requestBuilder.GET().build();

CompletableFuture<MultiMapResult<String>> sendAsync = client
.sendAsync(request, HttpResponse.MultiProcessor.asMap((req) -> {
Optional<HttpResponse.BodyHandler<String>> optional = Optional
.of(HttpResponse.BodyHandler.asString());
String msg = " - " + req.uri();
logMsg(msg);
return optional;
}));

Map<HttpRequest, CompletableFuture<HttpResponse<String>>> multiMapResult = sendAsync
.join();

if (multiMapResult != null) {
for (HttpRequest key : multiMapResult.keySet()) {
CompletableFuture<HttpResponse<String>> completableFuture = multiMapResult
.get(key);
HttpResponse<String> response = completableFuture.get();
printResponse(response);
responses.add(response);
}
ConcurrentMap<HttpRequest, CompletableFuture<HttpResponse<String>>> promisesMap =
new ConcurrentHashMap<>();

Function<HttpRequest, HttpResponse.BodyHandler<String>> promiseHandler =
(HttpRequest req) -> {
String msg = " - " + req.uri();
logMsg(msg);
return HttpResponse.BodyHandlers.ofString();
};

CompletableFuture<HttpResponse<String>> sendAsync = client.sendAsync(
request, HttpResponse.BodyHandlers.ofString(),
HttpResponse.PushPromiseHandler.of(promiseHandler, promisesMap));

// Original response
HttpResponse<String> response = sendAsync.join();
printResponse(response);
responses.add(response);

// Pushed responses
for (HttpRequest key : promisesMap.keySet()) {
CompletableFuture<HttpResponse<String>> completableFuture = promisesMap.get(key);
response = completableFuture.get();
printResponse(response);
responses.add(response);
}
} catch (Exception e) {
throw new Fault("Test fail", e);
Expand Down
69 changes: 0 additions & 69 deletions src/com/sun/ts/tests/servlet/spec/serverpush/README.md

This file was deleted.

0 comments on commit 6a1a344

Please sign in to comment.