From 09559fde1552b05712a3ce950031bbca51caab9c Mon Sep 17 00:00:00 2001 From: Jorge Bescos Gascon Date: Mon, 17 Jun 2024 10:59:37 +0200 Subject: [PATCH 1/2] Remove monitor in TyrusSession Signed-off-by: Jorge Bescos Gascon --- .../glassfish/tyrus/core/TyrusSession.java | 56 +++++++++++++++---- 1 file changed, 44 insertions(+), 12 deletions(-) diff --git a/core/src/main/java/org/glassfish/tyrus/core/TyrusSession.java b/core/src/main/java/org/glassfish/tyrus/core/TyrusSession.java index 5cc4eb27..17c72c1f 100755 --- a/core/src/main/java/org/glassfish/tyrus/core/TyrusSession.java +++ b/core/src/main/java/org/glassfish/tyrus/core/TyrusSession.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2022 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2024 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 @@ -36,6 +36,7 @@ import java.util.concurrent.ScheduledFuture; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicReference; +import java.util.concurrent.locks.ReentrantLock; import java.util.logging.Level; import java.util.logging.Logger; @@ -77,7 +78,7 @@ public class TyrusSession implements DistributedSession { private final Map pathParameters; private final Principal userPrincipal; private final Map> requestParameterMap; - private final Object idleTimeoutLock = new Object(); + private final ReentrantLock idleTimeoutLock = new ReentrantLock(); private final String id; private final String connectionId; private final Map userProperties; @@ -94,6 +95,7 @@ public class TyrusSession implements DistributedSession { private final Map distributedPropertyMap; private final Map distributedUserProperties; + private final ReentrantLock handlerManagerLock = new ReentrantLock(); private volatile long maxIdleTimeout = 0; private volatile ScheduledFuture idleTimeoutFuture = null; @@ -333,8 +335,11 @@ public WebSocketContainer getContainer() { @Override public void addMessageHandler(MessageHandler handler) { checkConnectionState(State.CLOSED); - synchronized (handlerManager) { + handlerManagerLock.lock(); + try { handlerManager.addMessageHandler(handler); + } finally { + handlerManagerLock.unlock(); } } @@ -357,8 +362,11 @@ public void addMessageHandler(MessageHandler handler) { @Override public void addMessageHandler(Class clazz, MessageHandler.Whole handler) { checkConnectionState(State.CLOSED); - synchronized (handlerManager) { + handlerManagerLock.lock(); + try { handlerManager.addMessageHandler(clazz, handler); + } finally { + handlerManagerLock.unlock(); } } @@ -381,23 +389,32 @@ public void addMessageHandler(Class clazz, MessageHandler.Whole handle @Override public void addMessageHandler(Class clazz, MessageHandler.Partial handler) { checkConnectionState(State.CLOSED); - synchronized (handlerManager) { + handlerManagerLock.lock(); + try { handlerManager.addMessageHandler(clazz, handler); + } finally { + handlerManagerLock.unlock(); } } @Override public Set getMessageHandlers() { - synchronized (handlerManager) { + handlerManagerLock.lock(); + try { return handlerManager.getMessageHandlers(); + } finally { + handlerManagerLock.unlock(); } } @Override public void removeMessageHandler(MessageHandler handler) { checkConnectionState(State.CLOSED); - synchronized (handlerManager) { + handlerManagerLock.lock(); + try { handlerManager.removeMessageHandler(handler); + } finally { + handlerManagerLock.unlock(); } } @@ -513,27 +530,36 @@ public void setHeartbeatInterval(long heartbeatInterval) { } void restartIdleTimeoutExecutor() { - synchronized (idleTimeoutLock) { + idleTimeoutLock.lock(); + try { cancelIdleTimeoutExecutor(); idleTimeoutFuture = service.schedule(new IdleTimeoutCommand(), this.getMaxIdleTimeout(), TimeUnit.MILLISECONDS); + } finally { + idleTimeoutLock.unlock(); } } private void cancelIdleTimeoutExecutor() { if (this.maxIdleTimeout < 1) { - synchronized (idleTimeoutLock) { + idleTimeoutLock.lock(); + try { if (idleTimeoutFuture != null) { idleTimeoutFuture.cancel(true); } return; + } finally { + idleTimeoutLock.unlock(); } } - synchronized (idleTimeoutLock) { + idleTimeoutLock.lock(); + try { if (idleTimeoutFuture != null) { idleTimeoutFuture.cancel(false); } + } finally { + idleTimeoutLock.unlock(); } } @@ -567,8 +593,11 @@ void notifyMessageHandlers(Object message, List> available } List, MessageHandler>> orderedMessageHandlers; - synchronized (handlerManager) { + handlerManagerLock.lock(); + try { orderedMessageHandlers = handlerManager.getOrderedWholeMessageHandlers(); + } finally { + handlerManagerLock.unlock(); } for (CoderWrapper decoder : availableDecoders) { @@ -602,8 +631,11 @@ void notifyMessageHandlers(Object message, List> available MessageHandler.Whole getMessageHandler(Class c) { List, MessageHandler>> orderedMessageHandlers; - synchronized (handlerManager) { + handlerManagerLock.lock(); + try { orderedMessageHandlers = handlerManager.getOrderedWholeMessageHandlers(); + } finally { + handlerManagerLock.unlock(); } for (Map.Entry, MessageHandler> entry : orderedMessageHandlers) { From 6cef534924c8ff5578952b97b230769c3c779983 Mon Sep 17 00:00:00 2001 From: jansupol Date: Wed, 19 Jun 2024 10:52:03 +0200 Subject: [PATCH 2/2] Support JDK 8 with EE 9 Tyrus Signed-off-by: jansupol --- .gitignore | 1 + .../resources/archetype-resources/pom.xml | 2 +- .../main/{java => java11}/module-info.java | 0 .../main/{java => java11}/module-info.java | 0 .../main/{java => java11}/module-info.java | 0 .../main/{java => java11}/module-info.java | 0 .../main/{java => java11}/module-info.java | 0 .../main/{java => java11}/module-info.java | 0 .../main/{java => java11}/module-info.java | 0 .../servlet/TyrusHttpUpgradeHandler.java | 20 +- .../main/{java => java11}/module-info.java | 0 .../main/{java => java11}/module-info.java | 0 etc/jenkins/Jenkinsfile_ci_build | 4 +- .../main/{java => java11}/module-info.java | 0 .../main/{java => java11}/module-info.java | 0 .../main/{java => java11}/module-info.java | 0 .../main/{java => java11}/module-info.java | 0 pom.xml | 203 +++++++++++++++++- .../main/{java => java11}/module-info.java | 0 .../main/{java => java11}/module-info.java | 0 tests/containers/pom.xml | 10 +- tests/containers/servlet/pom.xml | 12 ++ .../test/{java => java11}/module-info.java | 0 .../test/{java => java11}/module-info.java | 0 .../test/{java => java11}/module-info.java | 0 .../test/artifacts/MultiReleaseTest.java | 128 +++++++++++ tests/servlet/embedded-glassfish-test/pom.xml | 5 +- tests/servlet/pom.xml | 12 +- .../main/{java => java11}/module-info.java | 0 29 files changed, 378 insertions(+), 19 deletions(-) rename client/src/main/{java => java11}/module-info.java (100%) rename containers/glassfish/cdi/src/main/{java => java11}/module-info.java (100%) rename containers/glassfish/ejb/src/main/{java => java11}/module-info.java (100%) rename containers/grizzly-client/src/main/{java => java11}/module-info.java (100%) rename containers/grizzly-server/src/main/{java => java11}/module-info.java (100%) rename containers/inmemory/src/main/{java => java11}/module-info.java (100%) rename containers/jdk-client/src/main/{java => java11}/module-info.java (100%) rename containers/servlet/src/main/{java => java11}/module-info.java (100%) rename core/src/main/{java => java11}/module-info.java (100%) rename ext/client-cli/src/main/{java => java11}/module-info.java (100%) rename ext/client-java8/src/main/{java => java11}/module-info.java (100%) rename ext/extension-deflate/src/main/{java => java11}/module-info.java (100%) rename ext/monitoring-jmx/src/main/{java => java11}/module-info.java (100%) rename server/src/main/{java => java11}/module-info.java (100%) rename spi/src/main/{java => java11}/module-info.java (100%) rename tests/e2e/application-config/src/test/{java => java11}/module-info.java (100%) rename tests/e2e/jdk8/src/test/{java => java11}/module-info.java (100%) rename tests/e2e/standard-config/src/test/{java => java11}/module-info.java (100%) create mode 100644 tests/release-test/src/test/java/org/glassfish/tyrus/test/artifacts/MultiReleaseTest.java rename tests/tools/src/main/{java => java11}/module-info.java (100%) diff --git a/.gitignore b/.gitignore index 9f7d5b94..b1d45c98 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ # maven noise target/ +target11 target-*/ # gradle noise diff --git a/archetypes/echo/src/main/resources/archetype-resources/pom.xml b/archetypes/echo/src/main/resources/archetype-resources/pom.xml index 54f54e8d..062818a7 100644 --- a/archetypes/echo/src/main/resources/archetype-resources/pom.xml +++ b/archetypes/echo/src/main/resources/archetype-resources/pom.xml @@ -65,7 +65,7 @@ 1.8 ${project.version} UTF-8 - 3.11.0 + 3.13.0 3.4.0 diff --git a/client/src/main/java/module-info.java b/client/src/main/java11/module-info.java similarity index 100% rename from client/src/main/java/module-info.java rename to client/src/main/java11/module-info.java diff --git a/containers/glassfish/cdi/src/main/java/module-info.java b/containers/glassfish/cdi/src/main/java11/module-info.java similarity index 100% rename from containers/glassfish/cdi/src/main/java/module-info.java rename to containers/glassfish/cdi/src/main/java11/module-info.java diff --git a/containers/glassfish/ejb/src/main/java/module-info.java b/containers/glassfish/ejb/src/main/java11/module-info.java similarity index 100% rename from containers/glassfish/ejb/src/main/java/module-info.java rename to containers/glassfish/ejb/src/main/java11/module-info.java diff --git a/containers/grizzly-client/src/main/java/module-info.java b/containers/grizzly-client/src/main/java11/module-info.java similarity index 100% rename from containers/grizzly-client/src/main/java/module-info.java rename to containers/grizzly-client/src/main/java11/module-info.java diff --git a/containers/grizzly-server/src/main/java/module-info.java b/containers/grizzly-server/src/main/java11/module-info.java similarity index 100% rename from containers/grizzly-server/src/main/java/module-info.java rename to containers/grizzly-server/src/main/java11/module-info.java diff --git a/containers/inmemory/src/main/java/module-info.java b/containers/inmemory/src/main/java11/module-info.java similarity index 100% rename from containers/inmemory/src/main/java/module-info.java rename to containers/inmemory/src/main/java11/module-info.java diff --git a/containers/jdk-client/src/main/java/module-info.java b/containers/jdk-client/src/main/java11/module-info.java similarity index 100% rename from containers/jdk-client/src/main/java/module-info.java rename to containers/jdk-client/src/main/java11/module-info.java diff --git a/containers/servlet/src/main/java/org/glassfish/tyrus/servlet/TyrusHttpUpgradeHandler.java b/containers/servlet/src/main/java/org/glassfish/tyrus/servlet/TyrusHttpUpgradeHandler.java index e60ae924..ae30b4c5 100644 --- a/containers/servlet/src/main/java/org/glassfish/tyrus/servlet/TyrusHttpUpgradeHandler.java +++ b/containers/servlet/src/main/java/org/glassfish/tyrus/servlet/TyrusHttpUpgradeHandler.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2022 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2024 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 @@ -46,6 +46,14 @@ */ public class TyrusHttpUpgradeHandler implements HttpUpgradeHandler, ReadListener { + /** + *

+ * The size to precede OutOfMemory Exception and potentially DDoS attacks when buffering incoming WebSocket frames. + *

+ *

+ * The default value is 4194315 bytes, which correspond to 4M plus few bytes to frame headers. + *

+ */ public static final String FRAME_BUFFER_SIZE = "org.glassfish.tyrus.servlet.incoming-buffer-size"; private final CountDownLatch connectionLatch = new CountDownLatch(1); @@ -98,6 +106,12 @@ public void close(CloseReason reason) { connectionLatch.countDown(); } + /** + * Sets the required information before {@link #init(WebConnection)} is invoked. + * @param upgradeInfo The WebSocket UpgradeInfo. + * @param writer The Tyrus SPI Writer. + * @param authenticated Whether the authentication has been used. + */ public void preInit(WebSocketEngine.UpgradeInfo upgradeInfo, Writer writer, boolean authenticated) { this.upgradeInfo = upgradeInfo; this.writer = writer; @@ -249,6 +263,10 @@ public String toString() { return sb.toString(); } + /** + * Override the default {@link #FRAME_BUFFER_SIZE}. + * @param incomingBufferSize The new incoming frame buffer size value. + */ public void setIncomingBufferSize(int incomingBufferSize) { this.incomingBufferSize = incomingBufferSize; } diff --git a/containers/servlet/src/main/java/module-info.java b/containers/servlet/src/main/java11/module-info.java similarity index 100% rename from containers/servlet/src/main/java/module-info.java rename to containers/servlet/src/main/java11/module-info.java diff --git a/core/src/main/java/module-info.java b/core/src/main/java11/module-info.java similarity index 100% rename from core/src/main/java/module-info.java rename to core/src/main/java11/module-info.java diff --git a/etc/jenkins/Jenkinsfile_ci_build b/etc/jenkins/Jenkinsfile_ci_build index bc1fd896..27c197e8 100644 --- a/etc/jenkins/Jenkinsfile_ci_build +++ b/etc/jenkins/Jenkinsfile_ci_build @@ -8,12 +8,12 @@ pipeline { stages { stage('Jersey build') { parallel { - stage('JDK 11 ') { + stage('JDK 8 ') { agent { label 'centos-7' } tools { - jdk 'openjdk-jdk11-latest' + jdk 'oracle-jdk8-latest' maven 'apache-maven-latest' } steps { diff --git a/ext/client-cli/src/main/java/module-info.java b/ext/client-cli/src/main/java11/module-info.java similarity index 100% rename from ext/client-cli/src/main/java/module-info.java rename to ext/client-cli/src/main/java11/module-info.java diff --git a/ext/client-java8/src/main/java/module-info.java b/ext/client-java8/src/main/java11/module-info.java similarity index 100% rename from ext/client-java8/src/main/java/module-info.java rename to ext/client-java8/src/main/java11/module-info.java diff --git a/ext/extension-deflate/src/main/java/module-info.java b/ext/extension-deflate/src/main/java11/module-info.java similarity index 100% rename from ext/extension-deflate/src/main/java/module-info.java rename to ext/extension-deflate/src/main/java11/module-info.java diff --git a/ext/monitoring-jmx/src/main/java/module-info.java b/ext/monitoring-jmx/src/main/java11/module-info.java similarity index 100% rename from ext/monitoring-jmx/src/main/java/module-info.java rename to ext/monitoring-jmx/src/main/java11/module-info.java diff --git a/pom.xml b/pom.xml index 6deb6035..593e89a1 100644 --- a/pom.xml +++ b/pom.xml @@ -117,12 +117,17 @@ 1.0.5 5.0.0 2.6.7 + 6.2.5 + 1.8 + ${project.basedir}/target11/classes + ${project.basedir}/src/main/java11 - 3.11.0 - 3.6.2 + 3.13.0 + 3.7.0 3.2.1 3.4.0 + 2.8.0 jakarta.websocket org.glassfish @@ -171,7 +176,7 @@ maven-assembly-plugin - 3.6.0 + 3.7.1 maven-source-plugin @@ -179,7 +184,7 @@ maven-compiler-plugin - 3.11.0 + ${maven.compiler.plugin} maven-release-plugin @@ -314,11 +319,14 @@ Tyrus ${project.version} API Documentation Tyrus ${project.version} API - https://projects.eclipse.org/projects/ee4j.tyrus + https://eclipse-ee4j.github.io/tyrus-project.github.io/apidocs/latest20x/ *.core.l10n.*:*.internal.*:org.glassfish.tyrus.core.wsadl.model + + **/module-info.java + @@ -378,8 +386,8 @@ org.apache.maven.plugins maven-compiler-plugin - 11 - 11 + ${java.version} + ${java.version} UTF-8 @@ -592,6 +600,185 @@ + + + sbom + + + !skipSBOM + + + + + + org.cyclonedx + cyclonedx-maven-plugin + ${cyclonedx.mvn.plugin.version} + true + + + package + + makeAggregateBom + + + + framework + true + + + + + + + + + + jdk11+ + + [11,) + src/main/java11/module-info.java + + + + + org.codehaus.mojo + build-helper-maven-plugin + + + add.java11 + generate-sources + + add-source + + + + src/main/java11 + + + + + + + maven-compiler-plugin + + 11 + 11 + UTF-8 + + + + maven-antrun-plugin + + + test + + + + + + + + + + run + + + + + + + + + clean11 + + + + maven-clean-plugin + + + + ${java11.build.outputDirectory} + + + + + + + + + copyJDK11FilesToMultiReleaseJar + + + + target11/classes/module-info.class + + + + + + org.apache.maven.plugins + maven-resources-plugin + true + + + copy-module-info-source + prepare-package + + copy-resources + + + ${project.build.directory}/generated-sources/rsrc-gen/META-INF/versions/11/ + + + ${java11.sourceDirectory}/ + + + + + + copy-module-info-class + prepare-package + + copy-resources + + + ${project.build.outputDirectory}/META-INF/versions/11 + + + ${java11.build.outputDirectory} + + + + + + + + org.apache.felix + maven-bundle-plugin + 5.1.4 + true + + + <_versionpolicy>[$(version;==;$(@)),$(version;+;$(@))) + <_nodefaultversion>false + {maven-resources},${project.build.directory}/legal + true + + + + + osgi-bundle + package + + bundle + + + + + + + @@ -767,7 +954,7 @@ org.glassfish.main.extras glassfish-embedded-all - 6.2.1 + ${glassfish.container.version} jakarta.xml.bind diff --git a/server/src/main/java/module-info.java b/server/src/main/java11/module-info.java similarity index 100% rename from server/src/main/java/module-info.java rename to server/src/main/java11/module-info.java diff --git a/spi/src/main/java/module-info.java b/spi/src/main/java11/module-info.java similarity index 100% rename from spi/src/main/java/module-info.java rename to spi/src/main/java11/module-info.java diff --git a/tests/containers/pom.xml b/tests/containers/pom.xml index 6e8a59e8..d78f032b 100644 --- a/tests/containers/pom.xml +++ b/tests/containers/pom.xml @@ -36,6 +36,14 @@ jdk-client - servlet + + + JDK11+ + [11,) + + servlet + + + diff --git a/tests/containers/servlet/pom.xml b/tests/containers/servlet/pom.xml index ab3aa4f0..b3ea006e 100644 --- a/tests/containers/servlet/pom.xml +++ b/tests/containers/servlet/pom.xml @@ -47,4 +47,16 @@ test + + + + maven-compiler-plugin + + 11 + 11 + UTF-8 + + + + diff --git a/tests/e2e/application-config/src/test/java/module-info.java b/tests/e2e/application-config/src/test/java11/module-info.java similarity index 100% rename from tests/e2e/application-config/src/test/java/module-info.java rename to tests/e2e/application-config/src/test/java11/module-info.java diff --git a/tests/e2e/jdk8/src/test/java/module-info.java b/tests/e2e/jdk8/src/test/java11/module-info.java similarity index 100% rename from tests/e2e/jdk8/src/test/java/module-info.java rename to tests/e2e/jdk8/src/test/java11/module-info.java diff --git a/tests/e2e/standard-config/src/test/java/module-info.java b/tests/e2e/standard-config/src/test/java11/module-info.java similarity index 100% rename from tests/e2e/standard-config/src/test/java/module-info.java rename to tests/e2e/standard-config/src/test/java11/module-info.java diff --git a/tests/release-test/src/test/java/org/glassfish/tyrus/test/artifacts/MultiReleaseTest.java b/tests/release-test/src/test/java/org/glassfish/tyrus/test/artifacts/MultiReleaseTest.java new file mode 100644 index 00000000..0586f1bc --- /dev/null +++ b/tests/release-test/src/test/java/org/glassfish/tyrus/test/artifacts/MultiReleaseTest.java @@ -0,0 +1,128 @@ +/* + * Copyright (c) 2024 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 + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package org.glassfish.tyrus.test.artifacts; + +import org.apache.maven.model.Dependency; +import org.codehaus.plexus.util.xml.pull.XmlPullParserException; +import org.junit.Assert; +import org.junit.Test; + +import java.io.File; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import java.util.Properties; +import java.util.jar.JarEntry; +import java.util.jar.JarFile; +import java.util.stream.Collectors; +import java.util.stream.Stream; +import java.util.zip.ZipEntry; + +public class MultiReleaseTest { + private static final String s = ""; + private static final File localRepository = MavenUtil.getLocalMavenRepository(); + private static final Properties properties = MavenUtil.getMavenProperties(); + + @Test + public void testIsJdkMultiRelease() throws IOException, XmlPullParserException { + TestResult result = testJdkVersions("11", jdk11multiRelease(properties)); + //Assertions.assertTrue(result.result(), "Some error occurred, see previous messages"); + Assert.assertTrue("Some error occurred, see previous messages", result.result()); + } + + private static TestResult testJdkVersions(String version, DependencyPair... dependencies) + throws XmlPullParserException, IOException { + final TestResult result = new TestResult(); + if (dependencies == null || dependencies.length == 0) { + System.out.append("No dependencies found for jdk ").println(version); + return result; + } + + Stream deps = MavenUtil.streamTyrusJars(); + List files = MavenUtil.keepTyrusJars(deps, dependencies) + .map(dependency -> MavenUtil.getArtifactJar(localRepository, dependency, properties)) + .collect(Collectors.toList()); + + //Assertions.assertEquals(dependencies.length, files.size(), "Some jdk " + version + " dependencies not found"); + if (dependencies.length != files.size()) { + System.out.println("Expected:"); + for (DependencyPair pair : dependencies) { + System.out.println(pair); + } + System.out.println("Resolved:"); + for (File file : files) { + System.out.println(file.getName()); + } + Assert.assertEquals("Some jdk " + version + " dependencies not found", dependencies.length, files.size()); + } + + for (File jar : files) { + JarFile jarFile = new JarFile(jar); + if (!jarFile.isMultiRelease()) { + result.exception().append("Not a multirelease jar ").append(jar.getName()).println("!"); + } + ZipEntry versions = jarFile.getEntry("META-INF/versions/" + version); + System.out.append("Accessing META-INF/versions/").append(version).append(" of ").println(jar.getName()); + if (versions == null) { + result.exception().append("No classes for JDK ").append(version).append(" for ").println(jar.getName()); + } + result.ok().append("Classes for JDK ").append(version).append(" found for ").println(jar.getName()); + + Optional file = jarFile.stream() + .filter(entry -> !entry.isDirectory()) + .filter(entry -> !entry.getName().contains("versions")) + .filter(entry -> entry.getName().endsWith(".class")) + .findAny(); + JarEntry jarEntry = file.get(); + result.append(ClassVersionChecker.checkClassVersion(jarFile, jarEntry, properties)); + } + + // Verify that number of multirelease jars matches the expected dependencies + StringBuilder multi = new StringBuilder(); + int multiCnt = 0; + List allFiles = MavenUtil.streamTyrusJars() + .map(dependency -> MavenUtil.getArtifactJar(localRepository, dependency, properties)) + .collect(Collectors.toList()); + for (File jar : files) { + JarFile jarFile = new JarFile(jar); + if (jarFile.isMultiRelease()) { + multiCnt++; + multi.append("Multirelease jar ").append(jar.getName()).append('\n'); + } + } + if (files.size() == multiCnt) { + result.ok().println("There is expected number of multirelease jars"); + } else { + result.exception().println("There is unexpected number of multirelease jars:"); + result.exception().append(multi).println(""); + } + + return result; + } + + private static DependencyPair[] jdk11multiRelease(Properties properties) throws XmlPullParserException, IOException { + String tyrusVersion = MavenUtil.getTyrusVersion(properties); + if (tyrusVersion.startsWith("2.0")) { + return MavenUtil.streamTyrusJars() + .map(d -> new DependencyPair(d.getGroupId(), d.getArtifactId())) + .collect(Collectors.toList()) + .toArray(new DependencyPair[0]); + } + return new DependencyPair[]{}; + } + +} diff --git a/tests/servlet/embedded-glassfish-test/pom.xml b/tests/servlet/embedded-glassfish-test/pom.xml index dbe676ae..6cb34263 100644 --- a/tests/servlet/embedded-glassfish-test/pom.xml +++ b/tests/servlet/embedded-glassfish-test/pom.xml @@ -31,7 +31,7 @@ Tyrus Servlet Tests on Glassfish - 6.2.1 + 6.2.5 5.7.2 @@ -279,10 +279,9 @@ - org.apache.maven.plugins maven-compiler-plugin - 11 + 11 diff --git a/tests/servlet/pom.xml b/tests/servlet/pom.xml index e6743bd2..a06adc14 100755 --- a/tests/servlet/pom.xml +++ b/tests/servlet/pom.xml @@ -34,7 +34,6 @@ async autobahn-server basic - embedded-glassfish-test dynamic-deploy noappconfig oneappconfig @@ -48,6 +47,13 @@ debug - - + + + JDK11+ + [11,18) + + embedded-glassfish-test + + + diff --git a/tests/tools/src/main/java/module-info.java b/tests/tools/src/main/java11/module-info.java similarity index 100% rename from tests/tools/src/main/java/module-info.java rename to tests/tools/src/main/java11/module-info.java