Skip to content

Commit

Permalink
Runs on JDK 24
Browse files Browse the repository at this point in the history
Signed-off-by: jansupol <[email protected]>
  • Loading branch information
jansupol committed Dec 13, 2024
1 parent 47e37bd commit b4053df
Show file tree
Hide file tree
Showing 13 changed files with 90 additions and 67 deletions.
26 changes: 3 additions & 23 deletions core-common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -173,29 +173,6 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<executions>
<execution>
<id>default-test</id>
<configuration>
<excludes>
<exclude>**/ByteBufferInputStreamTest.java</exclude>
</excludes>
</configuration>
</execution>
<execution>
<id>tests-with-additional-permissions</id>
<phase>test</phase>
<goals>
<goal>test</goal>
</goals>
<configuration>
<argLine>-Djava.security.policy=${project.build.directory}/test-classes/surefire-jdk17.policy</argLine>
<includes>
<include>**/ByteBufferInputStreamTest.java</include>
</includes>
</configuration>
</execution>
</executions>
<configuration>
<!-- Execute test classes in parallel - 1 thread per CPU core. -->
<parallel>classesAndMethods</parallel>
Expand Down Expand Up @@ -848,6 +825,9 @@

<profile>
<id>securityOff</id>
<activation>
<jdk>[24,)</jdk>
</activation>
<properties>
<surefire.security.argline />
</properties>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019, 2022 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2019, 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
Expand Down Expand Up @@ -30,11 +30,14 @@

public class ExternalPropertiesConfigurationFactoryTest {

private static boolean isSecurityManager;

/**
* Predefine some properties to be read from config
*/
@BeforeAll
public static void setUp() {
isSecurityManager = System.getSecurityManager() != null;
System.setProperty(CommonProperties.ALLOW_SYSTEM_PROPERTIES_PROVIDER, Boolean.TRUE.toString());

System.setProperty("jersey.config.server.provider.scanning.recursive", "PASSED");
Expand All @@ -53,7 +56,11 @@ public static void tearDown() {
public void readSystemPropertiesTest() {
final Object result =
readExternalPropertiesMap().get("jersey.config.server.provider.scanning.recursive");
Assertions.assertNull(result);
if (isSecurityManager) {
Assertions.assertNull(result);
} else {
Assertions.assertEquals("PASSED", result);
}
Assertions.assertEquals(Boolean.TRUE,
getConfig().isProperty(CommonProperties.JSON_PROCESSING_FEATURE_DISABLE));
Assertions.assertEquals(Boolean.TRUE,
Expand Down Expand Up @@ -81,8 +88,11 @@ public void mergePropertiesTest() {
inputProperties.put("org.jersey.microprofile.config.added", "ADDED");
getConfig().mergeProperties(inputProperties);
final Object result = readExternalPropertiesMap().get("jersey.config.server.provider.scanning.recursive");
Assertions.assertNull(result);
Assertions.assertNull(readExternalPropertiesMap().get("org.jersey.microprofile.config.added"));
final Object resultAdded = readExternalPropertiesMap().get("org.jersey.microprofile.config.added");
if (isSecurityManager) {
Assertions.assertNull(result);
Assertions.assertNull(resultAdded);
}
}

}
20 changes: 0 additions & 20 deletions core-common/src/test/resources/surefire-jdk17.policy

This file was deleted.

7 changes: 6 additions & 1 deletion core-common/src/test/resources/surefire.policy
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, 2021 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 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
Expand Down Expand Up @@ -62,3 +62,8 @@ grant {
permission java.lang.RuntimePermission "manageProcess";
permission java.lang.RuntimePermission "accessClassInPackage.jdk.internal.misc";
};

// JDK 17 and later permissions
grant {
permission java.lang.RuntimePermission "setContextClassLoader";
};
3 changes: 3 additions & 0 deletions core-server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,9 @@
</profile>
<profile>
<id>securityOff</id>
<activation>
<jdk>[24,)</jdk>
</activation>
<properties>
<surefire.security.argline />
</properties>
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -40,6 +40,8 @@
import static org.junit.jupiter.api.Assertions.assertEquals;

public class ParamConverterDateTest extends AbstractTest {
private final String format = "EEE MMM dd HH:mm:ss Z yyyy";
private final SimpleDateFormat formatter = new SimpleDateFormat(format, new Locale("US"));

@Path("/")
public static class DateResource {
Expand All @@ -55,7 +57,7 @@ public String doGet(@QueryParam("d") final Date d) {
public void testDateResource() throws ExecutionException, InterruptedException {
initiateWebApplication(getBinder(), ParamConverterDateTest.DateResource.class);
final ContainerResponse responseContext = getResponseContext(UriBuilder.fromPath("/")
.queryParam("d", new Date()).build().toString());
.queryParam("d", formatter.format(new Date())).build().toString());

assertEquals(200, responseContext.getStatus());
}
Expand All @@ -80,8 +82,6 @@ public T fromString(final String value) {
);
}
try {
final String format = "EEE MMM dd HH:mm:ss Z yyyy";
final SimpleDateFormat formatter = new SimpleDateFormat(format, new Locale("US"));
return rawType.cast(formatter.parse(value));
} catch (final ParseException ex) {
throw new ExtractorException(ex);
Expand Down
6 changes: 4 additions & 2 deletions examples/groovy/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
<plugin>
<groupId>org.codehaus.gmavenplus</groupId>
<artifactId>gmavenplus-plugin</artifactId>
<version>3.0.0</version>
<version>4.0.1</version>
<executions>
<execution>
<id>1</id>
Expand All @@ -99,10 +99,12 @@
<goal>removeTestStubs</goal>
<goal>groovydoc</goal>
</goals>
<configuration>
<targetBytecode>11</targetBytecode>
</configuration>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
Expand Down
21 changes: 13 additions & 8 deletions examples/osgi-helloworld-webapp/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,20 @@
<name>jersey-examples-osgi-helloworld-webapp</name>
<packaging>pom</packaging>

<modules>
<module>war-bundle</module>
<module>functional-test</module>
<module>lib-bundle</module>
<module>additional-bundle</module>
<module>alternate-version-bundle</module>
</modules>

<profiles>
<profile>
<id>securityOn</id>
<activation>
<jdk>[1.8,24)</jdk>
</activation>
<modules>
<module>war-bundle</module>
<module>functional-test</module>
<module>lib-bundle</module>
<module>additional-bundle</module>
<module>alternate-version-bundle</module>
</modules>
</profile>
<profile>
<id>pre-release</id>
<build>
Expand Down
12 changes: 11 additions & 1 deletion examples/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@
<!--<module>feed-combiner-java8-webapp</module>-->
<module>freemarker-webapp</module>
<!--<module>flight-mgmt-webapp</module>-->
<module>groovy</module>
<module>helloworld</module>
<module>helloworld-benchmark</module>
<module>helloworld-cdi2-se</module>
Expand Down Expand Up @@ -281,5 +280,16 @@
</resource>
</resources>
</build>
<profiles>
<profile>
<id>GROOVY-EXAMPLE</id>
<activation>
<jdk>[11,)</jdk>
</activation>
<modules>
<module>groovy</module>
</modules>
</profile>
</profiles>

</project>
13 changes: 12 additions & 1 deletion incubator/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
<module>cdi-inject-weld</module>
<module>declarative-linking</module>
<module>gae-integration</module>
<module>html-json</module>
<module>injectless-client</module>
<module>kryo</module>
<module>open-tracing</module>
Expand All @@ -53,4 +52,16 @@
<scope>test</scope>
</dependency>
</dependencies>

<profiles>
<profile>
<id>HTML-JSON-FOR-PRE-JDK24</id>
<activation>
<jdk>[1.8, 24)</jdk>
</activation>
<modules>
<module>html-json</module>
</modules>
</profile>
</profiles>
</project>
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2183,7 +2183,7 @@
<resources.mvn.plugin.version>3.3.1</resources.mvn.plugin.version>
<shade.mvn.plugin.version>3.6.0</shade.mvn.plugin.version>
<source.mvn.plugin.version>3.3.1</source.mvn.plugin.version>
<surefire.mvn.plugin.version>3.3.1</surefire.mvn.plugin.version>
<surefire.mvn.plugin.version>3.5.2</surefire.mvn.plugin.version>
<war.mvn.plugin.version>3.4.0</war.mvn.plugin.version>
<wiremock.mvn.plugin.version>2.11.0</wiremock.mvn.plugin.version>
<xml.mvn.plugin.version>1.1.0</xml.mvn.plugin.version>
Expand All @@ -2209,7 +2209,7 @@
<findbugs.glassfish.version>1.7</findbugs.glassfish.version>
<freemarker.version>2.3.33</freemarker.version>
<gae.version>2.0.29</gae.version>
<groovy.version>4.0.22</groovy.version>
<groovy.version>5.0.0-alpha-11</groovy.version>
<gson.version>2.11.0</gson.version>
<guava.version>33.3.0-jre</guava.version>
<hamcrest.version>3.0</hamcrest.version>
Expand Down
9 changes: 9 additions & 0 deletions tests/integration/microprofile/rest-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,15 @@
</plugins>
</build>
</profile>
<profile>
<id>securityOff</id>
<activation>
<jdk>[24,)</jdk>
</activation>
<properties>
<surefire.security.argline />
</properties>
</profile>
</profiles>

<properties>
Expand Down
10 changes: 9 additions & 1 deletion tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
<module>e2e-testng</module>
<module>e2e-tls</module>
<module>integration</module>
<module>jmockit</module>
<module>mem-leaks</module>
<module>osgi</module>
<module>stress</module>
Expand Down Expand Up @@ -117,5 +116,14 @@
<module>release-test</module>
</modules>
</profile>
<profile>
<id>JMOCKIT-MODULE-FOR-PRE-JDK24</id>
<activation>
<jdk>[1.8,24)</jdk>
</activation>
<modules>
<module>jmockit</module>
</modules>
</profile>
</profiles>
</project>

0 comments on commit b4053df

Please sign in to comment.