diff --git a/connectors/jdk-connector/src/main/java/org/glassfish/jersey/jdk/connector/internal/TransferEncodingParser.java b/connectors/jdk-connector/src/main/java/org/glassfish/jersey/jdk/connector/internal/TransferEncodingParser.java index 64fb9c706c..0a3ede0a0a 100644 --- a/connectors/jdk-connector/src/main/java/org/glassfish/jersey/jdk/connector/internal/TransferEncodingParser.java +++ b/connectors/jdk-connector/src/main/java/org/glassfish/jersey/jdk/connector/internal/TransferEncodingParser.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2019 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2022 Oracle and/or its affiliates. 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 @@ -218,7 +218,8 @@ private boolean parseHttpChunkLength(final ByteBuffer input) throws ParseExcepti while (offset < limit) { final byte b = input.get(offset); - if (isSpaceOrTab(b) || /*trailing spaces are not allowed by the spec, but some server put it there*/ + if (isSpaceOrTab(b) + || /*trailing spaces are not allowed by the spec, but some server put it there*/ b == HttpParserUtils.CR || b == HttpParserUtils.SEMI_COLON) { headerParsingState.checkpoint = offset; } else if (b == HttpParserUtils.LF) { diff --git a/core-client/src/test/java/org/glassfish/jersey/client/JerseyCompletionStageRxInvokerTest.java b/core-client/src/test/java/org/glassfish/jersey/client/JerseyCompletionStageRxInvokerTest.java index 50879fceb8..53c9c28003 100644 --- a/core-client/src/test/java/org/glassfish/jersey/client/JerseyCompletionStageRxInvokerTest.java +++ b/core-client/src/test/java/org/glassfish/jersey/client/JerseyCompletionStageRxInvokerTest.java @@ -111,7 +111,7 @@ public void testNotFoundReadEntityViaClass() throws Throwable { @Test public void testNotFoundReadEntityViaGenericType() throws Throwable { - Assertions.assertThrows(NotFoundException.class, () ->{ + Assertions.assertThrows(NotFoundException.class, () -> { try { client.target("http://jersey.java.net") .request() diff --git a/docs/src/main/docbook/migration.xml b/docs/src/main/docbook/migration.xml index 8986154fa9..5ff6870096 100644 --- a/docs/src/main/docbook/migration.xml +++ b/docs/src/main/docbook/migration.xml @@ -28,6 +28,19 @@ xml:id="migration"> Migration Guide +
+ Migrating from Jersey 2.37 to 2.38 +
+ Breaking Changes + + Versions 2.38 introduces non-compatible change for dependency of Open Tracing. As soon as Open Tracing + breaks compatibility between the 0.30.0 and the 0.33.0 versions in its API, and Jersey updates Open Tracing + to the 0.33.0 version in the 2.38, for everyone who uses Open Tracing framework it is required to upgrade + their dependencies to the 0.33.0 version of the Open Tracing respectively. + +
+
+
Migrating from Jersey 2.29 to 2.29.1 and 2.30+
diff --git a/examples/extended-wadl-webapp/pom.xml b/examples/extended-wadl-webapp/pom.xml index e44a4ee769..83efeaa2ca 100644 --- a/examples/extended-wadl-webapp/pom.xml +++ b/examples/extended-wadl-webapp/pom.xml @@ -238,7 +238,7 @@ org.apache.maven.surefire surefire-junit47 - ${surefire.version} + ${surefire.mvn.plugin.version} diff --git a/examples/groovy/pom.xml b/examples/groovy/pom.xml index 3009cbaa58..79c3069207 100644 --- a/examples/groovy/pom.xml +++ b/examples/groovy/pom.xml @@ -28,7 +28,7 @@ org.apache.groovy groovy-all pom - 4.0.4 + ${groovy.version} org.glassfish.jersey.test-framework.providers diff --git a/examples/open-tracing/src/main/java/org/glassfish/jersey/examples/opentracing/App.java b/examples/open-tracing/src/main/java/org/glassfish/jersey/examples/opentracing/App.java index 1de9406b81..7382ab2526 100644 --- a/examples/open-tracing/src/main/java/org/glassfish/jersey/examples/opentracing/App.java +++ b/examples/open-tracing/src/main/java/org/glassfish/jersey/examples/opentracing/App.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2019 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2022 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Distribution License v. 1.0, which is available at @@ -113,7 +113,7 @@ static class ReqFilterA implements ContainerRequestFilter { public void filter(ContainerRequestContext requestContext) throws IOException { Span span = OpenTracingUtils .getRequestSpan(requestContext) - .orElse(GlobalTracer.get().buildSpan("ad-hoc-span-reqA").startManual()); + .orElse(GlobalTracer.get().buildSpan("ad-hoc-span-reqA").start()); span.log("ReqFilterA.filter() invoked"); } } @@ -128,7 +128,7 @@ static class ReqFilterB implements ContainerRequestFilter { public void filter(ContainerRequestContext requestContext) throws IOException { Span span = OpenTracingUtils .getRequestSpan(requestContext) - .orElse(GlobalTracer.get().buildSpan("ad-hoc-span-reqB").startManual()); + .orElse(GlobalTracer.get().buildSpan("ad-hoc-span-reqB").start()); span.log("ReqFilterB.filter() invoked"); } } @@ -141,7 +141,7 @@ static class RespFilterA implements ContainerResponseFilter { public void filter(ContainerRequestContext requestContext, ContainerResponseContext responseContext) throws IOException { Span span = OpenTracingUtils .getRequestSpan(requestContext) - .orElse(GlobalTracer.get().buildSpan("ad-hoc-span-respA").startManual()); + .orElse(GlobalTracer.get().buildSpan("ad-hoc-span-respA").start()); span.log("RespFilterA.filter() invoked"); } } @@ -154,7 +154,7 @@ static class RespFilterB implements ContainerResponseFilter { public void filter(ContainerRequestContext requestContext, ContainerResponseContext responseContext) throws IOException { Span span = OpenTracingUtils .getRequestSpan(requestContext) - .orElse(GlobalTracer.get().buildSpan("ad-hoc-span-respB").startManual()); + .orElse(GlobalTracer.get().buildSpan("ad-hoc-span-respB").start()); span.log("RespFilterB.filter() invoked"); } } diff --git a/examples/osgi-helloworld-webapp/functional-test/pom.xml b/examples/osgi-helloworld-webapp/functional-test/pom.xml index 038517f0b5..04fefdab29 100644 --- a/examples/osgi-helloworld-webapp/functional-test/pom.xml +++ b/examples/osgi-helloworld-webapp/functional-test/pom.xml @@ -80,15 +80,6 @@ javassist test - - - - org.slf4j - slf4j-log4j12 - 1.6.4 - test - - org.osgi diff --git a/examples/osgi-helloworld-webapp/war-bundle/pom.xml b/examples/osgi-helloworld-webapp/war-bundle/pom.xml index 1fade78206..22fcaf93c4 100644 --- a/examples/osgi-helloworld-webapp/war-bundle/pom.xml +++ b/examples/osgi-helloworld-webapp/war-bundle/pom.xml @@ -57,7 +57,7 @@ javax.servlet servlet-api - 2.5 + ${servlet2.version} provided diff --git a/ext/microprofile/mp-rest-client/pom.xml b/ext/microprofile/mp-rest-client/pom.xml index 730b9465c8..6d2071b325 100644 --- a/ext/microprofile/mp-rest-client/pom.xml +++ b/ext/microprofile/mp-rest-client/pom.xml @@ -32,12 +32,12 @@ org.eclipse.microprofile.rest.client microprofile-rest-client-api - 2.0 + ${microprofile.rest.client.version} org.eclipse.microprofile.config microprofile-config-api - 1.4 + ${microprofile.config.version} org.glassfish.jersey.core @@ -87,7 +87,7 @@ org.reactivestreams reactive-streams - 1.0.3 + ${reactive.streams.version} org.glassfish.jersey.media diff --git a/ext/rx/rx-client-rxjava2/pom.xml b/ext/rx/rx-client-rxjava2/pom.xml index 40c9d51aee..8aec72d1d7 100644 --- a/ext/rx/rx-client-rxjava2/pom.xml +++ b/ext/rx/rx-client-rxjava2/pom.xml @@ -42,11 +42,17 @@ io.reactivex.rxjava2 rxjava ${rxjava2.version} + + + org.reactivestreams + reactive-streams + + org.reactivestreams reactive-streams - 1.0.0 + ${reactive.streams.version} diff --git a/incubator/open-tracing/src/main/java/org/glassfish/jersey/opentracing/OpenTracingApplicationEventListener.java b/incubator/open-tracing/src/main/java/org/glassfish/jersey/opentracing/OpenTracingApplicationEventListener.java index ae8d6ae3af..8129f91c51 100644 --- a/incubator/open-tracing/src/main/java/org/glassfish/jersey/opentracing/OpenTracingApplicationEventListener.java +++ b/incubator/open-tracing/src/main/java/org/glassfish/jersey/opentracing/OpenTracingApplicationEventListener.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2019 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2022 Oracle and/or its affiliates. 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 @@ -25,6 +25,7 @@ import javax.ws.rs.container.ContainerRequestFilter; import javax.ws.rs.container.ContainerResponseFilter; +import io.opentracing.propagation.TextMapAdapter; import org.glassfish.jersey.server.ContainerRequest; import org.glassfish.jersey.server.ContainerResponse; import org.glassfish.jersey.server.monitoring.ApplicationEvent; @@ -36,7 +37,6 @@ import io.opentracing.SpanContext; import io.opentracing.Tracer; import io.opentracing.propagation.Format; -import io.opentracing.propagation.TextMapExtractAdapter; import io.opentracing.tag.Tags; import io.opentracing.util.GlobalTracer; @@ -84,7 +84,7 @@ private Span handleRequestStart(ContainerRequest request) { (entry) -> OpenTracingUtils.formatList(entry.getValue()))); final SpanContext extractedContext = - globalTracer.extract(Format.Builtin.HTTP_HEADERS, new TextMapExtractAdapter(mappedHeaders)); + globalTracer.extract(Format.Builtin.HTTP_HEADERS, new TextMapAdapter(mappedHeaders)); Tracer.SpanBuilder spanBuilder = globalTracer .buildSpan(OpenTracingFeature.DEFAULT_REQUEST_SPAN_NAME) @@ -99,7 +99,7 @@ private Span handleRequestStart(ContainerRequest request) { spanBuilder = spanBuilder.asChildOf(extractedContext); } - final Span span = spanBuilder.startManual(); + final Span span = spanBuilder.start(); request.setProperty(OpenTracingFeature.SPAN_CONTEXT_PROPERTY, span); span.log(LocalizationMessages.OPENTRACING_LOG_REQUEST_STARTED()); return span; @@ -157,7 +157,7 @@ public void onEvent(RequestEvent event) { resourceSpan = globalTracer.buildSpan(OpenTracingFeature.DEFAULT_RESOURCE_SPAN_NAME) .asChildOf(requestSpan) - .startManual(); + .start(); event.getContainerRequest().setProperty(OpenTracingFeature.SPAN_CONTEXT_PROPERTY, resourceSpan); break; diff --git a/incubator/open-tracing/src/main/java/org/glassfish/jersey/opentracing/OpenTracingClientRequestFilter.java b/incubator/open-tracing/src/main/java/org/glassfish/jersey/opentracing/OpenTracingClientRequestFilter.java index 766984a57a..758412c971 100644 --- a/incubator/open-tracing/src/main/java/org/glassfish/jersey/opentracing/OpenTracingClientRequestFilter.java +++ b/incubator/open-tracing/src/main/java/org/glassfish/jersey/opentracing/OpenTracingClientRequestFilter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2019 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2022 Oracle and/or its affiliates. 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 @@ -29,7 +29,7 @@ import io.opentracing.SpanContext; import io.opentracing.Tracer; import io.opentracing.propagation.Format; -import io.opentracing.propagation.TextMapInjectAdapter; +import io.opentracing.propagation.TextMapAdapter; import io.opentracing.tag.Tags; import io.opentracing.util.GlobalTracer; @@ -65,11 +65,11 @@ public void filter(ClientRequestContext requestContext) throws IOException { if (property != null && property instanceof SpanContext) { spanBuilder = spanBuilder.asChildOf((SpanContext) property); } - Span span = spanBuilder.startManual(); + Span span = spanBuilder.start(); requestContext.setProperty(OpenTracingFeature.SPAN_CONTEXT_PROPERTY, span); Map addedHeaders = new HashMap<>(); - GlobalTracer.get().inject(span.context(), Format.Builtin.HTTP_HEADERS, new TextMapInjectAdapter(addedHeaders)); + GlobalTracer.get().inject(span.context(), Format.Builtin.HTTP_HEADERS, new TextMapAdapter(addedHeaders)); addedHeaders.forEach((key, value) -> requestContext.getHeaders().add(key, value)); } } diff --git a/incubator/open-tracing/src/main/java/org/glassfish/jersey/opentracing/OpenTracingUtils.java b/incubator/open-tracing/src/main/java/org/glassfish/jersey/opentracing/OpenTracingUtils.java index f8ded2cf5c..3b715eb0fe 100644 --- a/incubator/open-tracing/src/main/java/org/glassfish/jersey/opentracing/OpenTracingUtils.java +++ b/incubator/open-tracing/src/main/java/org/glassfish/jersey/opentracing/OpenTracingUtils.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2019 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2022 Oracle and/or its affiliates. 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 @@ -89,7 +89,7 @@ public static Span getRequestChildSpan(final ContainerRequestContext context, fi spanBuilder = spanBuilder.asChildOf((Span) spanProperty); } } - return spanBuilder.startManual(); + return spanBuilder.start(); } /** diff --git a/pom.xml b/pom.xml index bf6aca5760..d98b4c8cfa 100644 --- a/pom.xml +++ b/pom.xml @@ -236,7 +236,7 @@ org.apache.maven.plugins maven-enforcer-plugin - 3.1.0 + ${enforcer.mvn.plugin.version} enforce-versions @@ -257,7 +257,7 @@ org.codehaus.mojo build-helper-maven-plugin - 3.0.0 + ${buildhelper.mvn.plugin.version} generate-sources @@ -282,7 +282,7 @@ com.sun.istack istack-commons-maven-plugin - 3.0.8 + ${istack.mvn.plugin.version} generate-sources @@ -310,7 +310,7 @@ org.apache.maven.plugins maven-compiler-plugin - 3.8.0 + ${compiler.mvn.plugin.version} true ${java.version} @@ -330,17 +330,17 @@ org.apache.maven.plugins maven-jar-plugin - 3.2.0 + ${jar.mvn.plugin.version} org.apache.maven.plugins maven-install-plugin - 2.5.2 + ${install.mvn.plugin.version} org.apache.maven.plugins maven-resources-plugin - 2.6 + ${resources.mvn.plugin.version} true @@ -412,7 +412,7 @@ org.apache.maven.plugins maven-surefire-plugin - ${surefire.version} + ${surefire.mvn.plugin.version} false @@ -434,14 +434,14 @@ org.apache.maven.surefire surefire-logger-api - ${surefire.version} + ${surefire.mvn.plugin.version} true org.apache.maven.surefire surefire-api - ${surefire.version} + ${surefire.mvn.plugin.version} true @@ -449,20 +449,20 @@ org.apache.maven.plugins maven-assembly-plugin - 2.4 + ${assembly.mvn.plugin.version} - gnu + posix org.apache.maven.plugins maven-dependency-plugin - 3.3.0 + ${dependency.mvn.plugin.version} org.apache.maven.plugins maven-javadoc-plugin - 3.2.0 + ${javadoc.mvn.plugin.version} Jersey ${jersey.version} API Documentation Jersey ${jersey.version} API @@ -501,7 +501,7 @@ org.apache.maven.plugins maven-source-plugin - 3.0.1 + ${source.mvn.plugin.version} attach-sources @@ -515,7 +515,7 @@ org.apache.maven.plugins maven-deploy-plugin - 2.8.1 + ${deploy.mvn.plugin.version} 10 @@ -541,12 +541,12 @@ org.apache.maven.plugins maven-site-plugin - 3.7.1 + ${site.mvn.plugin.version} org.codehaus.mojo exec-maven-plugin - 1.2.1 + ${exec.mvn.plugin.version} @@ -558,7 +558,7 @@ org.apache.maven.plugins maven-jxr-plugin - 2.3 + ${jxr.mvn.plugin.version} @@ -595,7 +595,7 @@ org.codehaus.mojo findbugs-maven-plugin - ${findbugs.version} + ${findbugs.mvn.plugin.version} ${findbugs.skip} ${findbugs.threshold} @@ -623,7 +623,7 @@ org.apache.maven.plugins maven-failsafe-plugin - 3.0.0-M3 + ${failsafe.mvn.plugin.version} false @@ -643,7 +643,7 @@ org.apache.maven.plugins maven-war-plugin - 3.3.1 + ${war.mvn.plugin.version} false @@ -651,12 +651,12 @@ org.apache.maven.plugins maven-ear-plugin - 2.8 + ${ear.mvn.plugin.version} org.glassfish.embedded maven-embedded-glassfish-plugin - 3.1.2.2 + ${gfembedded.mvn.plugin.version} org.glassfish.copyright @@ -682,7 +682,7 @@ org.apache.felix maven-bundle-plugin - 3.5.0 + ${felix.mvn.plugin.version} true @@ -704,7 +704,7 @@ org.codehaus.mojo xml-maven-plugin - 1.0 + ${xml.mvn.plugin.version} com.sun.tools.xjc.maven2 @@ -714,7 +714,7 @@ org.codehaus.mojo buildnumber-maven-plugin - 1.1 + ${buildnumber.mvn.plugin.version} @@ -732,31 +732,10 @@ jetty-maven-plugin ${jetty.version} - - org.glassfish.build - gfnexus-maven-plugin - 0.16 - - - - - org.glassfish.jersey:project:${project.version}:pom - com.sun.jersey - - - - glassfish-integration - JERSEY-${project.version} - - org.apache.maven.plugins maven-shade-plugin - 2.4.3 + ${shade.mvn.plugin.version} shade-archive @@ -787,24 +766,24 @@ org.apache.maven.plugins maven-antrun-plugin - 3.0.0 + ${antrun.mvn.plugin.version} org.apache.ant ant - 1.10.11 + 1.10.12 org.fortasoft gradle-maven-plugin - 1.0.5 + 1.0.8 com.github.wvengen proguard-maven-plugin - 2.0.8 + ${proguard.mvn.plugin.version} net.sf.proguard @@ -875,6 +854,12 @@ 1.8 + + 9.3 + 3.0.9 + 3.4.2.Final + 7.5 + @@ -1412,7 +1397,7 @@ org.codehaus.mojo findbugs-maven-plugin - ${findbugs.version} + ${findbugs.mvn.plugin.version} @@ -1870,11 +1855,6 @@ - - org.jboss.logging - jboss-logging - ${jboss.logging.version} - com.fasterxml classmate @@ -1943,7 +1923,7 @@ commons-logging commons-logging - 1.2 + ${commons.logging.version} @@ -2023,21 +2003,16 @@ - org.junit.jupiter - junit-jupiter + org.junit + junit-bom ${junit5.version} - test - - - org.junit.jupiter - junit-jupiter-engine - ${junit5.version} - test + pom + import org.testng testng - 6.9.13.6 + ${testng.version} test @@ -2069,21 +2044,21 @@ org.apache.felix org.apache.felix.framework - 7.0.0 + ${felix.framework.version} test org.apache.felix org.apache.felix.eventadmin - 1.5.0 + ${felix.eventadmin.version} test org.apache.felix org.apache.felix.framework.security - 2.6.1 + ${felix.framework.security.version} test @@ -2121,7 +2096,7 @@ - 2.4 + 3.2.1 false Low @@ -2138,6 +2113,7 @@ UTF-8 -Dmaven.test.skip=false clean install + false false @@ -2146,64 +2122,101 @@ ${failsafe.coverage.argline} + + 3.1.0 + 3.4.2 + 3.1.0 + 3.1.0 + 3.3.0 + 3.0.0 + 3.1.2 + 10.3.2 + 3.9.0 + 3.3.0 + 3.0.0-M2 + 3.2.0 + 3.0.0-M7 + 5.1.8 + 3.0.5 + 5.1 + 3.0.1 + 4.1.1 + 3.2.2 + 3.4.0 + 3.2.0 + 1.2.4 + 2.6.0 + 3.3.0 + 3.3.0 + 3.9.1 + 3.2.1 + 3.0.0-M7 + 3.3.2 + 2.9.0 + 1.0.2 + ${project.version} + 1.5.0.Final + 2.1.0.Final 9.4 2.3.6 2.11.0 3.3.2 - 3.1.0 - 8.28 - 3.3 - 1.3.3 + 1.2 + 1.5.1 + 1.6.4 + 2.8.3 + 7.0.5 1.7 - 3.0.4 - 2.3.27-incubating - 1.9.59 + 2.3.31 + 1.9.98 + 4.0.6 + 2.9.0 31.1-jre 2.2 - 1.0.3 + 1.4.9 2.9.0 4.5.13 - 5.1.2 + 5.1.3 2.13.3 1.9.13 - 3.25.0-GA - 3.3.0.Final + 3.29.0-GA 1.19.3 ${jersey1.version} 1.3.7 - 1.10.2 + 1.35 1.49 + 4.13.2 5.9.1 1.9.1 - 4.13.2 - 4.0.1 + 4.0.2 3.12.4 - 0.8.17 - 4.1.75.Final - 1.6.7 - 0.30.0 + 0.9.10 + 4.1.79.Final + 0.33.0 6.0.0 1.10.0 5.0.0 4.13.4 0.7.4 - 1.2.4 - 1.2.5 - 2.0.4 + 1.0.4 + 1.3.8 + 2.2.21 6.0.1 - false 2.0.3 - 4.3.20.RELEASE - 5.3.18 - 3.0.0-M7 - 6.2.0.Final - 2.2.14.Final - 3.1.7.SP1 + 1.3.11 + 4.3.30.RELEASE + 5.3.22 + 7.6.1 + 6.9.13.6 + 6.2.4.Final + + 3.1.9.Final + 2.27.2 2.12.2 @@ -2245,13 +2258,13 @@ 1.2.7 1.3.3 2.0.1 - 1.9.13 + 2.0 + 1.9.15 2.7.10 1.6.1 2.5 - 3.0.1 + 3.1.0 4.0.4 1.0.11 - 2.9.0 diff --git a/test-framework/maven/custom-enforcer-rules/pom.xml b/test-framework/maven/custom-enforcer-rules/pom.xml index e42e347fd8..0db2f36472 100644 --- a/test-framework/maven/custom-enforcer-rules/pom.xml +++ b/test-framework/maven/custom-enforcer-rules/pom.xml @@ -34,7 +34,7 @@ org.apache.maven.plugins maven-enforcer-plugin - 3.1.0 + ${enforcer.mvn.plugin.version} junit diff --git a/tests/e2e-client/pom.xml b/tests/e2e-client/pom.xml index 106955c002..878072b5d4 100644 --- a/tests/e2e-client/pom.xml +++ b/tests/e2e-client/pom.xml @@ -195,6 +195,12 @@ ${junit-platform-suite.version} test + + + commons-io + commons-io + ${commons.io.version} + diff --git a/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/ChunkedInputStreamClosedPrematurelyTest.java b/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/ChunkedInputStreamClosedPrematurelyTest.java index 0e15ff07aa..2f8344bffa 100644 --- a/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/ChunkedInputStreamClosedPrematurelyTest.java +++ b/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/ChunkedInputStreamClosedPrematurelyTest.java @@ -22,6 +22,7 @@ import java.net.HttpURLConnection; import java.net.URL; import java.util.Arrays; +import java.util.concurrent.CompletableFuture; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; import java.util.concurrent.ExecutionException; @@ -57,8 +58,6 @@ import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; -import com.google.common.util.concurrent.SettableFuture; - /** * Reproducer for JERSEY-2705. Client side entity InputStream exception * in chunked mode should not lead to the same behavior on the server side, @@ -80,7 +79,7 @@ public class ChunkedInputStreamClosedPrematurelyTest extends JerseyTest { @SuppressWarnings({"ThrowableResultOfMethodCallIgnored", "JavaDoc"}) public static class TestResource { - private static final ConcurrentMap> REQUEST_MAP = new ConcurrentHashMap<>(); + private static final ConcurrentMap> REQUEST_MAP = new ConcurrentHashMap<>(); @QueryParam(REQ_ID_PARAM_NAME) private String reqId; @@ -100,7 +99,7 @@ public String post(InputStream is) { thrown = ex; } - if (!getFutureFor(reqId).set(thrown)) { + if (!getFutureFor(reqId).complete(thrown)) { LOGGER.log(Level.WARNING, "Unable to set stream processing exception into the settable future instance for request id " + reqId, thrown); @@ -113,7 +112,7 @@ public String post(InputStream is) { @GET public Boolean getRequestWasMade() { // add a new future for the request if not there yet to avoid race conditions with POST processing - final SettableFuture esf = getFutureFor(reqId); + final CompletableFuture esf = getFutureFor(reqId); try { // wait for up to three second for a request to be made; // there is always a value, if set... @@ -126,7 +125,7 @@ public Boolean getRequestWasMade() { @Path("/requestCausedException") @GET public Boolean getRequestCausedException() { - final SettableFuture esf = getFutureFor(reqId); + final CompletableFuture esf = getFutureFor(reqId); try { return esf.get(3, TimeUnit.SECONDS) != NO_EXCEPTION; } catch (InterruptedException | ExecutionException | TimeoutException e) { @@ -134,9 +133,9 @@ public Boolean getRequestCausedException() { } } - private SettableFuture getFutureFor(String key) { - final SettableFuture esf = SettableFuture.create(); - final SettableFuture oldEsf = REQUEST_MAP.putIfAbsent(key, esf); + private CompletableFuture getFutureFor(String key) { + final CompletableFuture esf = new CompletableFuture(); + final CompletableFuture oldEsf = REQUEST_MAP.putIfAbsent(key, esf); return (oldEsf != null) ? oldEsf : esf; } } diff --git a/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/connector/ssl/AbstractConnectorServerTest.java b/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/connector/ssl/AbstractConnectorServerTest.java index 512e9fc428..bdbb980dbd 100644 --- a/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/connector/ssl/AbstractConnectorServerTest.java +++ b/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/connector/ssl/AbstractConnectorServerTest.java @@ -34,7 +34,7 @@ import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; -import com.google.common.io.ByteStreams; +import org.apache.commons.io.IOUtils; /** * SSL connector hostname verification tests. @@ -92,9 +92,9 @@ protected SSLContext getSslContext() throws IOException { final InputStream trustStore = SslConnectorConfigurationTest.class.getResourceAsStream(clientTrustStore()); final InputStream keyStore = SslConnectorConfigurationTest.class.getResourceAsStream(CLIENT_KEY_STORE); return SslConfigurator.newInstance() - .trustStoreBytes(ByteStreams.toByteArray(trustStore)) + .trustStoreBytes(IOUtils.toByteArray(trustStore)) .trustStorePassword("asdfgh") - .keyStoreBytes(ByteStreams.toByteArray(keyStore)) + .keyStoreBytes(IOUtils.toByteArray(keyStore)) .keyPassword("asdfgh") .createSSLContext(); } diff --git a/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/connector/ssl/Server.java b/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/connector/ssl/Server.java index 45c289ee34..a7fe69893e 100644 --- a/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/connector/ssl/Server.java +++ b/tests/e2e-client/src/test/java/org/glassfish/jersey/tests/e2e/client/connector/ssl/Server.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2019 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2022 Oracle and/or its affiliates. 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 @@ -23,6 +23,7 @@ import javax.ws.rs.core.UriBuilder; +import org.apache.commons.io.IOUtils; import org.glassfish.jersey.logging.LoggingFeature; import org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpServerFactory; import org.glassfish.jersey.server.ResourceConfig; @@ -31,8 +32,6 @@ import org.glassfish.grizzly.ssl.SSLContextConfigurator; import org.glassfish.grizzly.ssl.SSLEngineConfigurator; -import com.google.common.io.ByteStreams; - /** * A simple SSL-secured HTTP server for testing purposes. * @@ -87,9 +86,9 @@ public static Server start(String keystore) throws IOException { SSLContextConfigurator sslContext = new SSLContextConfigurator(); // set up security context - sslContext.setKeyStoreBytes(ByteStreams.toByteArray(keyStore)); // contains server key pair + sslContext.setKeyStoreBytes(IOUtils.toByteArray(keyStore)); // contains server key pair sslContext.setKeyStorePass("asdfgh"); - sslContext.setTrustStoreBytes(ByteStreams.toByteArray(trustStore)); // contains client certificate + sslContext.setTrustStoreBytes(IOUtils.toByteArray(trustStore)); // contains client certificate sslContext.setTrustStorePass("asdfgh"); ResourceConfig rc = new ResourceConfig(); diff --git a/tests/e2e-server/src/test/java/org/glassfish/jersey/tests/e2e/server/wadl/WadlBeanParamTest.java b/tests/e2e-server/src/test/java/org/glassfish/jersey/tests/e2e/server/wadl/WadlBeanParamTest.java index e06cbdb19b..91abb90a93 100644 --- a/tests/e2e-server/src/test/java/org/glassfish/jersey/tests/e2e/server/wadl/WadlBeanParamTest.java +++ b/tests/e2e-server/src/test/java/org/glassfish/jersey/tests/e2e/server/wadl/WadlBeanParamTest.java @@ -22,6 +22,7 @@ import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; +import java.util.Collections; import javax.ws.rs.BeanParam; import javax.ws.rs.CookieParam; @@ -61,8 +62,6 @@ import org.w3c.dom.Document; import org.w3c.dom.Node; -import com.google.common.collect.ImmutableMap; - /** * Tests whether WADL for a {@link BeanParam} annotated resource method parameter is generated properly. *

@@ -138,7 +137,7 @@ private void testBeanParamConstructorInitializedBean(String resource) throws Exc nodeAsString( xp.evaluate("//wadl:resource[@path='" + resource + "']/wadl:resource", d, XPathConstants.NODE)) - ).withNamespaceContext(ImmutableMap.of("wadl", "http://wadl.dev.java.net/2009/02")) + ).withNamespaceContext(Collections.singletonMap("wadl", "http://wadl.dev.java.net/2009/02")) /** * For nodes, the comparison is based on matching {@code name} attributes while ignoring * their order. For any other nodes, strict comparison (including ordering) is made. diff --git a/tests/e2e-server/src/test/java/org/glassfish/jersey/tests/e2e/server/wadl/WadlResourceTest.java b/tests/e2e-server/src/test/java/org/glassfish/jersey/tests/e2e/server/wadl/WadlResourceTest.java index b89476899a..0eddec69c3 100644 --- a/tests/e2e-server/src/test/java/org/glassfish/jersey/tests/e2e/server/wadl/WadlResourceTest.java +++ b/tests/e2e-server/src/test/java/org/glassfish/jersey/tests/e2e/server/wadl/WadlResourceTest.java @@ -27,6 +27,7 @@ import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import java.net.URI; +import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -110,8 +111,6 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertTrue; -import com.google.common.collect.ImmutableMap; - import com.sun.research.ws.wadl.Method; import com.sun.research.ws.wadl.Param; import com.sun.research.ws.wadl.Request; @@ -1276,7 +1275,7 @@ public void testWadlIsSameForAnnotatedAndNot() throws Exception { nodeAsString( xp.evaluate("//wadl:resource[@path='not-annotated']/wadl:resource", document, XPathConstants.NODE)) - ).withNamespaceContext(ImmutableMap.of("wadl", "http://wadl.dev.java.net/2009/02")).build(); + ).withNamespaceContext(Collections.singletonMap("wadl", "http://wadl.dev.java.net/2009/02")).build(); Assertions.assertFalse(diff.hasDifferences()); } diff --git a/tests/e2e-testng/pom.xml b/tests/e2e-testng/pom.xml index 6ac62b0ede..e688fa8c4d 100644 --- a/tests/e2e-testng/pom.xml +++ b/tests/e2e-testng/pom.xml @@ -51,7 +51,7 @@ org.apache.maven.surefire surefire-testng - ${surefire.version} + ${surefire.mvn.plugin.version} diff --git a/tests/integration/cdi-integration/gf-cdi-inject/src/test/java/org/glassfish/jersey/tests/cdi/gf/GFTest.java b/tests/integration/cdi-integration/gf-cdi-inject/src/test/java/org/glassfish/jersey/tests/cdi/gf/GFTest.java index 078cf64a75..8a21ba1b2b 100644 --- a/tests/integration/cdi-integration/gf-cdi-inject/src/test/java/org/glassfish/jersey/tests/cdi/gf/GFTest.java +++ b/tests/integration/cdi-integration/gf-cdi-inject/src/test/java/org/glassfish/jersey/tests/cdi/gf/GFTest.java @@ -39,7 +39,7 @@ public static WebArchive createDeployment() throws IOException { ); } - private static WebArchive createDeployment(String archiveName, Class...classes) { + private static WebArchive createDeployment(String archiveName, Class... classes) { WebArchive archive = ShrinkWrap.create(WebArchive.class, archiveName + ".war"); archive.addClasses(classes); return archive; diff --git a/tests/integration/jersey-2176/src/main/java/org/glassfish/jersey/tests/integration/jersey2176/TraceResponseWrapper.java b/tests/integration/jersey-2176/src/main/java/org/glassfish/jersey/tests/integration/jersey2176/TraceResponseWrapper.java index 6a7b84fe57..39a7b0e6c9 100644 --- a/tests/integration/jersey-2176/src/main/java/org/glassfish/jersey/tests/integration/jersey2176/TraceResponseWrapper.java +++ b/tests/integration/jersey-2176/src/main/java/org/glassfish/jersey/tests/integration/jersey2176/TraceResponseWrapper.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2019 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2022 Oracle and/or its affiliates. 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 @@ -17,6 +17,7 @@ package org.glassfish.jersey.tests.integration.jersey2176; import javax.servlet.ServletOutputStream; +import javax.servlet.WriteListener; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponseWrapper; import java.io.ByteArrayOutputStream; @@ -44,6 +45,16 @@ public PrintWriter getWriter() throws IOException { @Override public ServletOutputStream getOutputStream() throws IOException { return new ServletOutputStream() { + @Override + public boolean isReady() { + return true; + } + + @Override + public void setWriteListener(WriteListener writeListener) { + + } + @Override public void write(final int b) throws IOException { localStream.write(b); diff --git a/tests/integration/jetty-response-close/pom.xml b/tests/integration/jetty-response-close/pom.xml index 5ab2bb1816..89feaef2b3 100644 --- a/tests/integration/jetty-response-close/pom.xml +++ b/tests/integration/jetty-response-close/pom.xml @@ -57,6 +57,7 @@ -Djava.security.manager -Djava.security.policy=${project.build.directory}/test-classes/surefire.policy + 3.0.0-M5 diff --git a/tests/integration/microprofile/rest-client/pom.xml b/tests/integration/microprofile/rest-client/pom.xml index ba499b6ff3..b838ca090f 100644 --- a/tests/integration/microprofile/rest-client/pom.xml +++ b/tests/integration/microprofile/rest-client/pom.xml @@ -40,6 +40,12 @@ jakarta.enterprise jakarta.enterprise.cdi-api + + jakarta.xml.bind + jakarta.xml.bind-api + + org.jboss.weld.se weld-se-core @@ -48,7 +54,7 @@ io.smallrye smallrye-config - 1.3.6 + ${smallrye.config.version} test @@ -60,7 +66,7 @@ org.eclipse.microprofile.rest.client microprofile-rest-client-tck - 2.0 + ${microprofile.rest.client.version} test @@ -71,30 +77,37 @@ org.testng testng + ${testng6.version} + test + + + junit + junit + ${junit4.version} test com.github.tomakehurst wiremock - 2.21.0 + ${wiremock.version} test org.jboss.arquillian.testng arquillian-testng-container - 1.4.1.Final + ${arquillian.version} test org.jboss.arquillian.container arquillian-container-test-spi - 1.4.1.Final + ${arquillian.version} test org.jboss.arquillian.container arquillian-weld-embedded - 2.1.0.Final + ${arquillian.weld.version} test @@ -155,12 +168,12 @@ org.apache.maven.surefire surefire-junit-platform - ${surefire.version} + ${surefire.mvn.plugin.version} org.apache.maven.surefire surefire-testng - ${surefire.version} + ${surefire.mvn.plugin.version} @@ -173,7 +186,7 @@ uk.co.deliverymind wiremock-maven-plugin - 2.11.0 + ${wiremock.mvn.plugin.version} test-compile diff --git a/tests/integration/property-check/pom.xml b/tests/integration/property-check/pom.xml index a03d3d29ca..374174924a 100644 --- a/tests/integration/property-check/pom.xml +++ b/tests/integration/property-check/pom.xml @@ -108,7 +108,7 @@ - + jdk19+ diff --git a/tests/integration/property-check/src/test/java/org/glassfish/jersey/internal/config/SystemPropertiesConfigurationModelTest.java b/tests/integration/property-check/src/test/java/org/glassfish/jersey/internal/config/SystemPropertiesConfigurationModelTest.java index 2a072801b2..ddb8e08e1b 100644 --- a/tests/integration/property-check/src/test/java/org/glassfish/jersey/internal/config/SystemPropertiesConfigurationModelTest.java +++ b/tests/integration/property-check/src/test/java/org/glassfish/jersey/internal/config/SystemPropertiesConfigurationModelTest.java @@ -137,7 +137,7 @@ private List> getClassesWithPredicate(String packageRoot, Predicatetrue, Predicate::and)); + steam = steam.filter(Arrays.stream(predicates).reduce(x -> true, Predicate::and)); return steam.collect(Collectors.toList()); } diff --git a/tests/integration/reactive-streams/sse/pom.xml b/tests/integration/reactive-streams/sse/pom.xml index a5808423db..27b19faca7 100644 --- a/tests/integration/reactive-streams/sse/pom.xml +++ b/tests/integration/reactive-streams/sse/pom.xml @@ -36,7 +36,7 @@ org.reactivestreams reactive-streams-tck - 1.0.3 + ${reactive.streams.version} test @@ -93,7 +93,7 @@ org.apache.maven.surefire surefire-testng - 3.0.0-M3 + ${surefire.mvn.plugin.version} diff --git a/tests/jmockit/pom.xml b/tests/jmockit/pom.xml index 26baf2ae7e..88594afab8 100644 --- a/tests/jmockit/pom.xml +++ b/tests/jmockit/pom.xml @@ -94,7 +94,7 @@ org.apache.maven.surefire surefire-junit47 - ${surefire.version} + ${surefire.mvn.plugin.version} diff --git a/tests/osgi/functional/pom.xml b/tests/osgi/functional/pom.xml index ffbb2b30fd..0747dbfffd 100644 --- a/tests/osgi/functional/pom.xml +++ b/tests/osgi/functional/pom.xml @@ -80,7 +80,7 @@ org.apache.maven.surefire surefire-junit47 - ${surefire.version} + ${surefire.mvn.plugin.version} @@ -291,11 +291,6 @@ hibernate-validator test - - org.jboss.logging - jboss-logging - test - com.fasterxml classmate @@ -396,13 +391,6 @@ test - - - org.slf4j - slf4j-log4j12 - 1.6.4 - test - diff --git a/tests/performance/test-cases/pom.xml b/tests/performance/test-cases/pom.xml index 762090cf88..2c52bb60e0 100644 --- a/tests/performance/test-cases/pom.xml +++ b/tests/performance/test-cases/pom.xml @@ -75,7 +75,7 @@ package - attached + single