diff --git a/ambry-api/src/test/java/com/github/ambry/account/AccountContainerTest.java b/ambry-api/src/test/java/com/github/ambry/account/AccountContainerTest.java index 0fafdfe8d7..dd9a272b33 100644 --- a/ambry-api/src/test/java/com/github/ambry/account/AccountContainerTest.java +++ b/ambry-api/src/test/java/com/github/ambry/account/AccountContainerTest.java @@ -20,7 +20,6 @@ import com.github.ambry.quota.QuotaResourceType; import com.github.ambry.utils.TestUtils; import com.github.ambry.utils.Utils; -import com.sun.org.apache.xpath.internal.operations.Bool; import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; diff --git a/ambry-store/src/test/java/com/github/ambry/store/BlobStoreTest.java b/ambry-store/src/test/java/com/github/ambry/store/BlobStoreTest.java index 229b1b222a..cf9b140a0a 100644 --- a/ambry-store/src/test/java/com/github/ambry/store/BlobStoreTest.java +++ b/ambry-store/src/test/java/com/github/ambry/store/BlobStoreTest.java @@ -86,7 +86,6 @@ import org.junit.runner.RunWith; import org.junit.runners.Parameterized; import org.mockito.Mockito; -import sun.nio.ch.FileChannelImpl; import static com.github.ambry.clustermap.ClusterMapUtils.*; import static com.github.ambry.clustermap.ReplicaState.*; @@ -2977,7 +2976,7 @@ public void testTestStorageAvailability() throws Exception { // general FileDescriptor getFileDescriptorFromFileChannel(FileChannel fileChannel) throws Exception { - Field field = FileChannelImpl.class.getDeclaredField("fd"); + Field field = fileChannel.getClass().getDeclaredField("fd"); field.setAccessible(true); return (FileDescriptor) field.get(fileChannel); } diff --git a/build.gradle b/build.gradle index ea929a848c..c4756eeb5b 100644 --- a/build.gradle +++ b/build.gradle @@ -48,14 +48,21 @@ subprojects { apply from: "$rootDir/gradle/java-publishing.gradle" } - sourceCompatibility = 1.8 - targetCompatibility = 1.8 + sourceCompatibility = 11 + targetCompatibility = 11 if (JavaVersion.current().java9Compatible) { - // Our consumers still run on java 8, so this flag ensures that our builds are backwards compatible at runtime - // with java 8 platform APIs. + // Configure for Java 11 compileJava { - options.compilerArgs.addAll(['--release', '8']) + options.release = 11 + options.compilerArgs += [ + '--add-exports=java.base/sun.nio.ch=ALL-UNNAMED', + '--add-exports=java.base/jdk.internal.ref=ALL-UNNAMED', + '--add-opens=java.base/java.lang=ALL-UNNAMED', + '--add-opens=java.base/java.nio=ALL-UNNAMED', + '--add-opens=java.base/sun.nio.ch=ALL-UNNAMED', + '--add-opens=java.base/java.util=ALL-UNNAMED' + ] } } @@ -122,16 +129,9 @@ subprojects { exceptionFormat = 'full' events "PASSED", "SKIPPED", "FAILED" } - // Plugin for retrying flaky tests. Reference: https://github.com/gradle/test-retry-gradle-plugin retry { - // The maximum number of times to retry an individual test maxRetries = 3 - // The maximum number of test failures that are allowed (per module) before retrying is disabled. The count applies to - // each round of test execution. For example, if maxFailures is 5 and 4 tests initially fail and then 3 - // again on retry, this will not be considered too many failures and retrying will continue (if maxRetries {@literal >} 1). - // If 5 or more tests were to fail initially then no retry would be attempted. maxFailures = 10 - // Whether tests that initially fail and then pass on retry should fail the task. failOnPassedAfterRetry = false } maxHeapSize = "6g" @@ -141,11 +141,23 @@ subprojects { systemProperty 'io.netty.allocator.normalCacheSize', '0' systemProperty 'io.netty.allocator.maxCachedBufferCapacity', '0' - // make sure Powermockito would be happy + // Configure JVM args for Java 11 compatibility if (JavaVersion.current().java9Compatible) { - jvmArgs '--add-exports=java.xml/jdk.xml.internal=ALL-UNNAMED' + jvmArgs = [ + '--add-exports=java.xml/jdk.xml.internal=ALL-UNNAMED', + '--add-opens=java.base/java.lang=ALL-UNNAMED', + '--add-opens=java.base/java.io=ALL-UNNAMED', + '--add-opens=java.base/java.util=ALL-UNNAMED', + '--add-opens=java.base/java.util.concurrent=ALL-UNNAMED', + '--add-opens=java.base/java.nio=ALL-UNNAMED', + '--add-opens=java.base/sun.nio.ch=ALL-UNNAMED', + '--add-opens=java.base/java.net=ALL-UNNAMED', + '--add-opens=java.base/java.math=ALL-UNNAMED', + '--add-opens=java.base/java.text=ALL-UNNAMED', + '--add-opens=java.management/sun.management=ALL-UNNAMED', + '--add-opens=java.desktop/java.awt.font=ALL-UNNAMED' + ] } - } task intTest(type: Test) { @@ -158,20 +170,31 @@ subprojects { events 'started', 'failed', 'passed', 'skipped' showStandardStreams = false } - // Allow for retrying flaky integration tests. retry { - // The maximum number of times to retry an individual test maxRetries = 3 - // The maximum number of test failures that are allowed (per module) before retrying is disabled. The count applies to - // each round of test execution. For example, if maxFailures is 5 and 4 tests initially fail and then 3 - // again on retry, this will not be considered too many failures and retrying will continue (if maxRetries {@literal >} 1). - // If 5 or more tests were to fail initially then no retry would be attempted. maxFailures = 10 - // Whether tests that initially fail and then pass on retry should fail the task. failOnPassedAfterRetry = false } maxHeapSize = "6g" systemProperty 'io.netty.leakDetection.level', 'paranoid' + + // Configure JVM args for Java 11 compatibility + if (JavaVersion.current().java9Compatible) { + jvmArgs = [ + '--add-exports=java.xml/jdk.xml.internal=ALL-UNNAMED', + '--add-opens=java.base/java.lang=ALL-UNNAMED', + '--add-opens=java.base/java.io=ALL-UNNAMED', + '--add-opens=java.base/java.util=ALL-UNNAMED', + '--add-opens=java.base/java.util.concurrent=ALL-UNNAMED', + '--add-opens=java.base/java.nio=ALL-UNNAMED', + '--add-opens=java.base/sun.nio.ch=ALL-UNNAMED', + '--add-opens=java.base/java.net=ALL-UNNAMED', + '--add-opens=java.base/java.math=ALL-UNNAMED', + '--add-opens=java.base/java.text=ALL-UNNAMED', + '--add-opens=java.management/sun.management=ALL-UNNAMED', + '--add-opens=java.desktop/java.awt.font=ALL-UNNAMED' + ] + } } task allTest { diff --git a/gradle/dependency-versions.gradle b/gradle/dependency-versions.gradle index b3fd4bf982..c6ae8b42da 100644 --- a/gradle/dependency-versions.gradle +++ b/gradle/dependency-versions.gradle @@ -9,31 +9,32 @@ // CONDITIONS OF ANY KIND, either express or implied. ext { azureSdkBom = "1.2.17" - junitVersion = "4.12" - slf4jVersion = "1.7.35" - joptSimpleVersion = "4.9" - log4jVersion = "2.17.1" - jsonVersion = "20170516" - metricsVersion = "4.1.2" - commonsVersion = "1.9" - bouncycastleVersion = "1.64" + junitVersion = "4.13.2" + slf4jVersion = "1.7.36" + joptSimpleVersion = "5.0.4" + log4jVersion = "2.20.0" + jsonVersion = "20231013" + metricsVersion = "4.2.19" + commonsVersion = "1.16.0" + bouncycastleVersion = "1.70" javaxVersion = "3.0.1" - nettyVersion = "4.1.79.Final" + nettyVersion = "4.1.100.Final" nettyTcNativeBoringSSLStatic_linux_x86_64 = "2.0.61.Final:linux-x86_64" nettyTcNativeBoringSSLStatic_osx_aarch_64 = "2.0.61.Final:osx-aarch_64" helixVersion = "1.1.0" - jacksonVersion = "2.13.5" + jacksonVersion = "2.15.3" jaydioVersion = "0.1" - azureMsal4jVersion="1.7.1" - azureMsalClientCredentialVersion="1.0.0" - conscryptVersion = "2.2.1" - jimFsVersion = "1.1" - mysqlConnectorVersion = "8.0.21" - hikariVersion = "3.4.5" + azureMsal4jVersion = "1.13.10" + azureMsalClientCredentialVersion = "1.0.0" + conscryptVersion = "2.5.2" + jimFsVersion = "1.2" + mysqlConnectorVersion = "8.0.33" + hikariVersion = "5.0.1" lz4Version = "1.8.0" - zstdVersion = "1.5.2-3" - mockitoVersion = "2.+" - powermockVersion = "2.+" - caffeineVersion = "2.9.3" + zstdVersion = "1.5.5-4" + mockitoVersion = "5.7.0" + powermockVersion = "2.0.9" + caffeineVersion = "3.1.8" hadoopCommonVersion = "3.3.6" + commonsLangVersion = "3.13.0" }