Skip to content

Commit

Permalink
Merge pull request ehcache#3213 from chrisdennis/java-21-fixes
Browse files Browse the repository at this point in the history
Java 21 Test Compatibility
  • Loading branch information
chrisdennis authored Feb 16, 2024
2 parents 1c82778 + 3fdcdb6 commit 59dacc8
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 10 deletions.
11 changes: 5 additions & 6 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,23 +46,22 @@ jobs:

- template: build-templates/gradle-common.yml@templates
parameters:
vmImage: 'windows-latest'
jdkVersion: '1.8'
jobName: 'WindowsJava8'
options: '-PtestVM=java21Home'
jobName: 'LinuxJava21'
gradleTasks: 'check -x dependencyCheckAggregate'

- template: build-templates/gradle-common.yml@templates
parameters:
vmImage: 'windows-latest'
jdkVersion: '1.8'
options: '-PtestVM=java11Home'
jobName: 'WindowsJava11'
jobName: 'WindowsJava8'
gradleTasks: 'check -x dependencyCheckAggregate'

- template: build-templates/gradle-common.yml@templates
parameters:
vmImage: 'windows-latest'
jdkVersion: '1.8'
options: '-PtestVM=java17Home'
jobName: 'WindowsJava17'
options: '-PtestVM=java21Home'
jobName: 'WindowsJava21'
gradleTasks: 'check -x dependencyCheckAggregate'
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public void apply(Project project) {
project.getPlugins().apply(JacocoPlugin.class);

project.getExtensions().configure(JacocoPluginExtension.class, jacoco -> {
jacoco.setToolVersion("0.8.8");
jacoco.setToolVersion("0.8.11");
});

project.getTasks().withType(JacocoReport.class).configureEach(jacocoReport -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public class LazyValueHolderTest {
@Test
public void testGetValueDecodeOnlyOnce() throws Exception {
Date date = mock(Date.class);
ByteBuffer buffer = mock(ByteBuffer.class);
ByteBuffer buffer = ByteBuffer.allocate(0);
doReturn(date).when(serializer).read(buffer);

LazyValueHolder<Date> valueHolder = new LazyValueHolder<>(buffer, serializer);
Expand All @@ -56,7 +56,7 @@ public void testGetValueDecodeOnlyOnce() throws Exception {
@Test
public void testEncodeEncodesOnlyOnce() throws Exception {
Date date = mock(Date.class);
ByteBuffer buffer = mock(ByteBuffer.class);
ByteBuffer buffer = ByteBuffer.allocate(0);
doReturn(buffer).when(serializer).serialize(date);

LazyValueHolder<Date> valueHolder = new LazyValueHolder<>(date);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public class SerializingCopierTest {
public void testCopy() throws Exception {
Serializer<String> serializer = uncheckedGenericMock(Serializer.class);
String in = new String("foo");
ByteBuffer buff = mock(ByteBuffer.class);
ByteBuffer buff = ByteBuffer.allocate(0);
when(serializer.serialize(in)).thenReturn(buff);
when(serializer.read(buff)).thenReturn(new String("foo"));

Expand Down
5 changes: 5 additions & 0 deletions ehcache-xml/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,11 @@ tasks.register('lowerBoundTest', Test) {
classpath -= configurations.testRuntimeClasspath
//add the classpath we want
classpath += configurations.lowerBoundTestRuntimeClasspath

if (testJava.javaVersion.isJava9Compatible()) {
// Older JAXB versions do reflection on java.lang.ClassLoader
jvmArgs += '--add-opens=java.base/java.lang=ALL-UNNAMED'
}
}

tasks.register('jakartaTest', Test) {
Expand Down

0 comments on commit 59dacc8

Please sign in to comment.