forked from apache/kafka
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
KAFKA-13273: Add support for Java 17 (apache#11296)
Java 17 is at release candidate stage and it will be a LTS release once it's out (previous LTS release was Java 11). Details: * Replace Java 16 with Java 17 in Jenkins and Readme. * Replace `--illegal-access=permit` (which was removed from Java 17) with `--add-opens` for the packages we require internal access to. Filed KAFKA-13275 for updating the tests not to require `--add-opens` (where possible). * Update `release.py` to use JDK8. and JDK 17 (instead of JDK 8 and JDK 15). * Removed all but one Streams test from `testsToExclude`. The Connect test exclusion list remains the same. * Add notable change to upgrade.html * Upgrade to Gradle 7.2 as it's required for proper Java 17 support. * Upgrade mockito to 3.12.4 for better Java 17 support. * Adjusted `KafkaRaftClientTest` and `QuorumStateTest` not to require private access to `jdk.internal.util.random`. Reviewers: Manikumar Reddy <[email protected]>, Chia-Ping Tsai <[email protected]>
- Loading branch information
Showing
12 changed files
with
125 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionSha256Sum=9bb8bc05f562f2d42bdf1ba8db62f6b6fa1c3bf6c392228802cc7cb0578fe7e0 | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.1.1-all.zip | ||
distributionSha256Sum=a8da5b02437a60819cad23e10fc7e9cf32bcb57029d9cb277e26eeff76ce014b | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-all.zip | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
raft/src/test/java/org/apache/kafka/raft/MockableRandom.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.apache.kafka.raft; | ||
|
||
import java.util.OptionalInt; | ||
import java.util.Random; | ||
import java.util.function.IntFunction; | ||
|
||
/** | ||
* A Random instance that makes it easy to modify the behavior of certain methods for test purposes. | ||
*/ | ||
class MockableRandom extends Random { | ||
|
||
private IntFunction<OptionalInt> nextIntFunction = __ -> OptionalInt.empty(); | ||
|
||
public MockableRandom(long seed) { | ||
super(seed); | ||
} | ||
|
||
public void mockNextInt(int expectedBound, int returnValue) { | ||
this.nextIntFunction = b -> { | ||
if (b == expectedBound) | ||
return OptionalInt.of(returnValue); | ||
else | ||
return OptionalInt.empty(); | ||
}; | ||
} | ||
|
||
public void mockNextInt(int returnValue) { | ||
this.nextIntFunction = __ -> OptionalInt.of(returnValue); | ||
} | ||
|
||
@Override | ||
public int nextInt(int bound) { | ||
return nextIntFunction.apply(bound).orElse(super.nextInt(bound)); | ||
} | ||
} |
Oops, something went wrong.