Skip to content

Commit

Permalink
Migrate to JDK 11 (#88)
Browse files Browse the repository at this point in the history
- Changes source level to 11
- Starts using simplifications enabled by newer JVM
- Fixes many typos
- Updates dependencies
- Updates workflows
- Updates readmes
- Sets JDK version for Sonatype Lift

Resolves #87
{major}

Signed-off-by: Esta Nagy <[email protected]>
  • Loading branch information
nagyesta authored May 18, 2022
1 parent 5f1fdab commit b63bdde
Show file tree
Hide file tree
Showing 69 changed files with 134 additions and 104 deletions.
4 changes: 2 additions & 2 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,7 @@ ij_typescript_ternary_operation_wrap = off
ij_typescript_union_types_wrap = on_every_item
ij_typescript_use_chained_calls_group_indents = false
ij_typescript_use_double_quotes = true
ij_typescript_use_explicit_js_extension = global
ij_typescript_use_explicit_js_extension = auto
ij_typescript_use_path_mapping = always
ij_typescript_use_public_modifier = false
ij_typescript_use_semicolon_after_statement = true
Expand Down Expand Up @@ -742,7 +742,7 @@ ij_javascript_ternary_operation_wrap = off
ij_javascript_union_types_wrap = on_every_item
ij_javascript_use_chained_calls_group_indents = false
ij_javascript_use_double_quotes = true
ij_javascript_use_explicit_js_extension = global
ij_javascript_use_explicit_js_extension = auto
ij_javascript_use_path_mapping = always
ij_javascript_use_public_modifier = false
ij_javascript_use_semicolon_after_statement = true
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,11 @@ jobs:
uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 # tag=v2.4.0
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@e6e38bacfdf1a337459f332974bb2327a31aaf4b # tag=v1.0.4
- name: Set up JDK 8
- name: Set up JDK 11
uses: actions/setup-java@f0bb91606209742fe3ea40199be2f3ef195ecabf # tag=v2.5.0
with:
distribution: temurin
java-version: 8
java-version: 11
- name: Initialize CodeQL
uses: github/codeql-action/init@d39d5d5c9707b926d517b1b292905ef4c03aa777 # tag=v1.1.2
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/gradle-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ jobs:
- uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 # tag=v2.4.0
with:
fetch-depth: 0
- name: Set up JDK 8
- name: Set up JDK 11
uses: actions/setup-java@f0bb91606209742fe3ea40199be2f3ef195ecabf # tag=v2.5.0
with:
distribution: temurin
java-version: 8
java-version: 11
- uses: actions/cache@937d24475381cd9c75ae6db12cb4e79714b926ed # tag=v2.1.7
with:
path: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/gradle-oss-index-scan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ jobs:
uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 # tag=v2.4.0
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@e6e38bacfdf1a337459f332974bb2327a31aaf4b # tag=v1.0.4
- name: Set up JDK 8
- name: Set up JDK 11
uses: actions/setup-java@f0bb91606209742fe3ea40199be2f3ef195ecabf # tag=v2.5.0
with:
distribution: temurin
java-version: 8
java-version: 11
- name: Check dependencies with Gradle
run: ./gradlew ossIndexAudit -PossIndexUsername=${{ secrets.OSS_INDEX_USER }} -PossIndexPassword=${{ secrets.OSS_INDEX_PASSWORD }}
4 changes: 2 additions & 2 deletions .github/workflows/gradle-test-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ jobs:
- uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 # tag=v2.4.0
with:
fetch-depth: 0
- name: Set up JDK 8
- name: Set up JDK 11
uses: actions/setup-java@f0bb91606209742fe3ea40199be2f3ef195ecabf # tag=v2.5.0
with:
distribution: temurin
java-version: 8
java-version: 11
- uses: actions/cache@937d24475381cd9c75ae6db12cb4e79714b926ed # tag=v2.1.7
with:
path: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ jobs:
- uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 # tag=v2.4.0
with:
fetch-depth: 0
- name: Set up JDK 8
- name: Set up JDK 11
uses: actions/setup-java@f0bb91606209742fe3ea40199be2f3ef195ecabf # tag=v2.5.0
with:
distribution: temurin
java-version: 8
java-version: 11
- uses: actions/cache@937d24475381cd9c75ae6db12cb4e79714b926ed # tag=v2.1.7
with:
path: |
Expand Down
1 change: 1 addition & 0 deletions .lift.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ disableTools = ["errorprone"]
# customTools = <list of user-provided tools conforming to a tool API>
# allow = <list of users whose pull requests can trigger analysis>
# jdkVersion = <jdk version>
jdkVersion = "11"

# summaryComments = <true or false (defaults to false)
summaryComments = false
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
![Abort-Mission](.github/assets/Abort-Mission-logo_export_transparent_640.png)

[![GitHub license](https://img.shields.io/github/license/nagyesta/abort-mission?color=informational)](https://raw.githubusercontent.com/nagyesta/abort-mission/main/LICENSE)
[![Java version](https://img.shields.io/badge/Java%20version-8-yellow?logo=java)](https://img.shields.io/badge/Java%20version-8-yellow?logo=java)
[![Java version](https://img.shields.io/badge/Java%20version-11-yellow?logo=java)](https://img.shields.io/badge/Java%20version-11-yellow?logo=java)
[![latest-release](https://img.shields.io/github/v/tag/nagyesta/abort-mission?color=blue&logo=git&label=releases&sort=semver)](https://github.com/nagyesta/abort-mission/releases)
[![Maven Central](https://img.shields.io/maven-central/v/com.github.nagyesta.abort-mission/abort.mission-control?logo=apache-maven)](https://search.maven.org/search?q=com.github.nagyesta.abort-mission)
[![JavaCI](https://img.shields.io/github/workflow/status/nagyesta/abort-mission/JavaCI?logo=github)](https://img.shields.io/github/workflow/status/nagyesta/abort-mission/JavaCI?logo=github)
Expand Down
2 changes: 1 addition & 1 deletion boosters/booster-cucumber-jvm/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
![Abort-Mission](../../.github/assets/Abort-Mission-logo_export_transparent_640.png)

[![GitHub license](https://img.shields.io/github/license/nagyesta/abort-mission?color=informational)](https://raw.githubusercontent.com/nagyesta/abort-mission/main/LICENSE)
[![Java version](https://img.shields.io/badge/Java%20version-8-yellow?logo=java)](https://img.shields.io/badge/Java%20version-8-yellow?logo=java)
[![Java version](https://img.shields.io/badge/Java%20version-11-yellow?logo=java)](https://img.shields.io/badge/Java%20version-11-yellow?logo=java)
[![latest-release](https://img.shields.io/github/v/tag/nagyesta/abort-mission?color=blue&logo=git&label=releases&sort=semver)](https://github.com/nagyesta/abort-mission/releases)
[![JavaCI](https://img.shields.io/github/workflow/status/nagyesta/abort-mission/JavaCI?logo=github)](https://img.shields.io/github/workflow/status/nagyesta/abort-mission/JavaCI?logo=github)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public class CucumberLaunchSequenceTemplate extends AbstractMissionLaunchSequenc
private final Function<Scenario, Set<MissionHealthCheckEvaluator>> scenarioBasedEvaluatorLookup;

/**
* Constructor defining how the template can lookup the evaluators or abort the mission.
* Constructor defining how the template can look up the evaluators or abort the mission.
*
* @param abortSequence The {@link Runnable} which aborts the tests (usually by throwing an exception)
* @param scenarioBasedEvaluatorLookup The {@link Function} that will be used for evaluator lookup.
Expand Down
2 changes: 1 addition & 1 deletion boosters/booster-junit-jupiter/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
![Abort-Mission](../../.github/assets/Abort-Mission-logo_export_transparent_640.png)

[![GitHub license](https://img.shields.io/github/license/nagyesta/abort-mission?color=informational)](https://raw.githubusercontent.com/nagyesta/abort-mission/main/LICENSE)
[![Java version](https://img.shields.io/badge/Java%20version-8-yellow?logo=java)](https://img.shields.io/badge/Java%20version-8-yellow?logo=java)
[![Java version](https://img.shields.io/badge/Java%20version-11-yellow?logo=java)](https://img.shields.io/badge/Java%20version-11-yellow?logo=java)
[![latest-release](https://img.shields.io/github/v/tag/nagyesta/abort-mission?color=blue&logo=git&label=releases&sort=semver)](https://github.com/nagyesta/abort-mission/releases)
[![JavaCI](https://img.shields.io/github/workflow/status/nagyesta/abort-mission/JavaCI?logo=github)](https://img.shields.io/github/workflow/status/nagyesta/abort-mission/JavaCI?logo=github)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public void preDestroyTestInstance(final ExtensionContext context) throws Except
public void testFailed(final ExtensionContext context, final Throwable throwable) {
final Optional<StageTimeStopwatch> stopwatch = optionalStopwatch(context, MISSION_START_PREFIX + Thread.currentThread().getName());
final Optional<Throwable> rootCause = Optional.of(throwable);
if (!stopwatch.isPresent()) {
if (stopwatch.isEmpty()) {
findClassContext(context).ifPresent(classContext -> {
//this is very challenging to test in this way, but can happen for sure
final Optional<StageTimeStopwatch> countdownStopwatch =
Expand Down Expand Up @@ -121,8 +121,7 @@ private Optional<ExtensionContext> findClassContext(final ExtensionContext conte
return Optional.empty();
}
//fall back either when recursion turned up empty or when we have no parent
return parent.map(recursion -> Optional.of(findClassContext(recursion).orElse(context)))
.orElseGet(() -> Optional.of(context));
return parent.map(recursion -> findClassContext(recursion).orElse(context)).or(() -> Optional.of(context));
}

private void markCountdownSuccessful(final ExtensionContext classContext) {
Expand All @@ -139,7 +138,7 @@ private void markCountdownSuccessful(final ExtensionContext classContext) {
launchSequenceTemplate.countdownSuccess(testClass, stopwatch);
putOptionalStopwatch(classContext, Optional.empty(), COUNTDOWN_START_PREFIX + Thread.currentThread().getName());
});
if (!classContext.getTestClass().isPresent()) {
if (classContext.getTestClass().isEmpty()) {
LOGGER.warn("Test class is not found in store. Reporting is most probably incomplete.");
}
final boolean failed = classContext.getExecutionException()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public void testAssumption() throws NoSuchMethodException {
@Test
@Tag("integration")
@SuppressWarnings("checkstyle:MagicNumber")
public void testParallelAssumption() throws NoSuchMethodException {
public void testParallelAssumption() {
EngineTestKit
.engine("junit-jupiter")
.selectors(selectClass(ParallelStaticFireTestWithSideBoostersPerClassTest.class),
Expand Down
2 changes: 1 addition & 1 deletion boosters/booster-junit4/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
![Abort-Mission](../../.github/assets/Abort-Mission-logo_export_transparent_640.png)

[![GitHub license](https://img.shields.io/github/license/nagyesta/abort-mission?color=informational)](https://raw.githubusercontent.com/nagyesta/abort-mission/main/LICENSE)
[![Java version](https://img.shields.io/badge/Java%20version-8-yellow?logo=java)](https://img.shields.io/badge/Java%20version-8-yellow?logo=java)
[![Java version](https://img.shields.io/badge/Java%20version-11-yellow?logo=java)](https://img.shields.io/badge/Java%20version-11-yellow?logo=java)
[![latest-release](https://img.shields.io/github/v/tag/nagyesta/abort-mission?color=blue&logo=git&label=releases&sort=semver)](https://github.com/nagyesta/abort-mission/releases)
[![JavaCI](https://img.shields.io/github/workflow/status/nagyesta/abort-mission/JavaCI?logo=github)](https://img.shields.io/github/workflow/status/nagyesta/abort-mission/JavaCI?logo=github)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ private void wrapMethodCall(final Statement base, final Method requiredMethod) t

private Method findRequiredMethod(final Description description) {
final Optional<Method> method = findMethodByDescription(description);
if (!method.isPresent()) {
if (method.isEmpty()) {
throw new IllegalArgumentException("Method not found.");
}
return method.get();
Expand All @@ -100,7 +100,7 @@ private Method findRequiredMethod(final Description description) {
private Optional<Method> findMethodByDescription(final Description description) {
return Optional.ofNullable(description)
.map(Description::getMethodName)
.map(name -> name.replaceFirst("\\[[0-9]+]", ""))
.map(name -> name.replaceFirst("\\[\\d+]", ""))
.flatMap(name -> Arrays.stream(testClass.getMethods()).filter(m -> name.equals(m.getName())).findFirst());
}

Expand Down
2 changes: 1 addition & 1 deletion boosters/booster-testng/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
![Abort-Mission](../../.github/assets/Abort-Mission-logo_export_transparent_640.png)

[![GitHub license](https://img.shields.io/github/license/nagyesta/abort-mission?color=informational)](https://raw.githubusercontent.com/nagyesta/abort-mission/main/LICENSE)
[![Java version](https://img.shields.io/badge/Java%20version-8-yellow?logo=java)](https://img.shields.io/badge/Java%20version-8-yellow?logo=java)
[![Java version](https://img.shields.io/badge/Java%20version-11-yellow?logo=java)](https://img.shields.io/badge/Java%20version-11-yellow?logo=java)
[![latest-release](https://img.shields.io/github/v/tag/nagyesta/abort-mission?color=blue&logo=git&label=releases&sort=semver)](https://github.com/nagyesta/abort-mission/releases)
[![JavaCI](https://img.shields.io/github/workflow/status/nagyesta/abort-mission/JavaCI?logo=github)](https://img.shields.io/github/workflow/status/nagyesta/abort-mission/JavaCI?logo=github)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@
import org.testng.annotations.Listeners;
import org.testng.annotations.Test;

import java.util.List;
import java.util.Map;
import java.util.function.Consumer;
import java.util.stream.Collectors;

import static com.github.nagyesta.abortmission.testkit.vanilla.FuelTankTestAssets.*;

Expand All @@ -30,8 +32,11 @@ protected Map<String, Consumer<AbortMissionCommandOps>> defineOutline() {
}

@DataProvider(name = "fuelTankLoadAmountProvider")
private static Object[] fuelTankLoadAmountProvider() {
return fuelTankTestInputProvider().boxed().toArray();
private static Object[][] fuelTankLoadAmountProvider() {
return fuelTankTestInputProvider().boxed()
.map(List::of)
.map(List::toArray)
.collect(Collectors.toList()).toArray(new Object[(int) fuelTankTestInputProvider().count()][1]);
}

@Test(dataProvider = "fuelTankLoadAmountProvider")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@
import org.testng.annotations.Test;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.function.Consumer;
import java.util.stream.Collectors;

import static com.github.nagyesta.abortmission.core.MissionControl.matcher;
import static com.github.nagyesta.abortmission.core.MissionControl.percentageBasedEvaluator;
Expand All @@ -25,8 +27,11 @@
public class ParachuteTestContext {

@DataProvider(name = "parachuteIndexProvider")
private static Object[] parachuteIndexProvider() {
return parachuteDropTestInputProvider().boxed().toArray();
private static Object[][] parachuteIndexProvider() {
return parachuteDropTestInputProvider().boxed()
.map(List::of)
.map(List::toArray)
.collect(Collectors.toList()).toArray(new Object[(int) parachuteDropTestInputProvider().count()][1]);
}

@Test(dataProvider = "parachuteIndexProvider")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@
import org.testng.annotations.Listeners;
import org.testng.annotations.Test;

import java.util.List;
import java.util.Random;
import java.util.concurrent.CopyOnWriteArraySet;
import java.util.stream.Collectors;

import static com.github.nagyesta.abortmission.testkit.spring.StaticFireTestAssets.PARALLEL;
import static com.github.nagyesta.abortmission.testkit.spring.StaticFireTestAssets.SIDE_BOOSTER;
Expand All @@ -35,8 +37,12 @@ public class ParallelStaticFireTestWithSideBoosters extends AbstractTestNGSpring
private Booster centerCore;

@DataProvider(name = "attemptIndexProvider")
private static Object[] attemptIndexProvider() {
return StaticFireTestAssets.staticFireTestParallelInputProvider().boxed().toArray();
private static Object[][] attemptIndexProvider() {
return StaticFireTestAssets.staticFireTestParallelInputProvider().boxed()
.map(List::of)
.map(List::toArray)
.collect(Collectors.toList())
.toArray(new Object[(int) StaticFireTestAssets.staticFireTestParallelInputProvider().count()][1]);
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public void testAssumption() throws NoSuchMethodException {

@Test(groups = "integration")
@SuppressWarnings("checkstyle:MagicNumber")
public void testParallelAssumption() throws NoSuchMethodException {
public void testParallelAssumption() {
final TestNG engine = new TestNG();
engine.setOutputDirectory(System.getProperty("java.io.tmpdir") + "/abort-mission/" + this.getClass().getSimpleName());
engine.setTestClasses(new Class[] {ParallelStaticFireTestWithSideBoosters.class});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
import org.testng.annotations.Listeners;
import org.testng.annotations.Test;

import java.util.List;
import java.util.stream.Collectors;

import static com.github.nagyesta.abortmission.testkit.spring.StaticFireTestAssets.*;
import static org.testng.Assert.assertTrue;

Expand All @@ -28,8 +31,12 @@ public class StaticFireTestWithSideBoosters extends AbstractTestNGSpringContextT
private Booster sideBooster;

@DataProvider(name = "attemptIndexProvider")
private static Object[] attemptIndexProvider() {
return StaticFireTestAssets.staticFireTestInputProvider().boxed().toArray();
private static Object[][] attemptIndexProvider() {
return StaticFireTestAssets.staticFireTestInputProvider().boxed()
.map(List::of)
.map(List::toArray)
.collect(Collectors.toList())
.toArray(new Object[(int) StaticFireTestAssets.staticFireTestInputProvider().count()][1]);
}

@Test(dataProvider = "attemptIndexProvider")
Expand Down
2 changes: 1 addition & 1 deletion boosters/testkit/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
![Abort-Mission](../../.github/assets/Abort-Mission-logo_export_transparent_640.png)

[![GitHub license](https://img.shields.io/github/license/nagyesta/abort-mission?color=informational)](https://raw.githubusercontent.com/nagyesta/abort-mission/main/LICENSE)
[![Java version](https://img.shields.io/badge/Java%20version-8-yellow?logo=java)](https://img.shields.io/badge/Java%20version-8-yellow?logo=java)
[![Java version](https://img.shields.io/badge/Java%20version-11-yellow?logo=java)](https://img.shields.io/badge/Java%20version-11-yellow?logo=java)
[![latest-release](https://img.shields.io/github/v/tag/nagyesta/abort-mission?color=blue&logo=git&label=releases&sort=semver)](https://github.com/nagyesta/abort-mission/releases)
[![JavaCI](https://img.shields.io/github/workflow/status/nagyesta/abort-mission/JavaCI?logo=github)](https://img.shields.io/github/workflow/status/nagyesta/abort-mission/JavaCI?logo=github)

Expand Down
7 changes: 6 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,14 @@ configure(subprojects.findAll({
apply plugin: 'maven-publish'
apply plugin: 'signing'
apply plugin: 'org.sonatype.gradle.plugins.scan'
//noinspection SpellCheckingInspection
apply plugin: 'org.owasp.dependencycheck'

versioner.apply()

version = rootProject.version
//noinspection GroovyUnusedAssignment
sourceCompatibility = '8'
sourceCompatibility = '11'
repositories {
mavenCentral()
}
Expand Down Expand Up @@ -100,11 +101,13 @@ configure(subprojects.findAll({
rule {
limit {
counter = 'LINE'
//noinspection SpellCheckingInspection
value = 'COVEREDRATIO'
minimum = 0.8
}
limit {
counter = 'BRANCH'
//noinspection SpellCheckingInspection
value = 'COVEREDRATIO'
minimum = 0.8
}
Expand All @@ -117,11 +120,13 @@ configure(subprojects.findAll({
element = 'CLASS'
limit {
counter = 'LINE'
//noinspection SpellCheckingInspection
value = 'COVEREDRATIO'
minimum = 0.5
}
limit {
counter = 'BRANCH'
//noinspection SpellCheckingInspection
value = 'COVEREDRATIO'
minimum = 0.5
}
Expand Down
Loading

0 comments on commit b63bdde

Please sign in to comment.