From dcf7acfacc871680a10e47752a2b4a175b5094f4 Mon Sep 17 00:00:00 2001 From: Ashish Agrawal Date: Tue, 5 Apr 2022 15:49:42 -0700 Subject: [PATCH] Remove JDK 14 and Add JDK 17 (#383) Signed-off-by: Ashish Agrawal --- .github/workflows/bwc-test-workflow.yml | 6 +++--- .github/workflows/multi-node-test-workflow.yml | 2 +- .github/workflows/security-test-workflow.yml | 6 +++--- .github/workflows/test-workflow.yml | 2 +- .../alerting/model/BucketLevelTriggerRunResult.kt | 2 +- .../alerting/resthandler/RestGetAlertsAction.kt | 2 +- .../alerting/resthandler/RestGetDestinationsAction.kt | 2 +- .../alerting/resthandler/RestGetMonitorAction.kt | 2 +- .../alerting/resthandler/RestIndexDestinationAction.kt | 2 +- .../alerting/transport/TransportIndexDestinationAction.kt | 2 +- .../transport/TransportIndexEmailAccountAction.kt | 2 +- .../alerting/transport/TransportIndexEmailGroupAction.kt | 2 +- .../alerting/transport/TransportIndexMonitorAction.kt | 2 +- .../kotlin/org/opensearch/alerting/MonitorRunnerIT.kt | 8 ++++---- build.gradle | 2 +- 15 files changed, 22 insertions(+), 22 deletions(-) diff --git a/.github/workflows/bwc-test-workflow.yml b/.github/workflows/bwc-test-workflow.yml index 423fd22ab..66174c697 100644 --- a/.github/workflows/bwc-test-workflow.yml +++ b/.github/workflows/bwc-test-workflow.yml @@ -12,7 +12,7 @@ jobs: build: strategy: matrix: - java: [ 14 ] + java: [ 11 ] # Job name name: Build and test Alerting # This job runs on Linux @@ -27,10 +27,10 @@ jobs: - name: Checkout Branch uses: actions/checkout@v2 # This step uses the setup-java Github action: https://github.com/actions/setup-java - - name: Set Up JDK 14 + - name: Set Up JDK 11 uses: actions/setup-java@v1 with: - java-version: 14 + java-version: 11 - name: Run Alerting Backwards Compatibility Tests run: | echo "Running backwards compatibility tests..." diff --git a/.github/workflows/multi-node-test-workflow.yml b/.github/workflows/multi-node-test-workflow.yml index 683b992f1..b6377ed5d 100644 --- a/.github/workflows/multi-node-test-workflow.yml +++ b/.github/workflows/multi-node-test-workflow.yml @@ -12,7 +12,7 @@ jobs: build: strategy: matrix: - java: [ 11 ] + java: [ 11, 17 ] # Job name name: Build and test Alerting # This job runs on Linux diff --git a/.github/workflows/security-test-workflow.yml b/.github/workflows/security-test-workflow.yml index edb230122..7cb66242c 100644 --- a/.github/workflows/security-test-workflow.yml +++ b/.github/workflows/security-test-workflow.yml @@ -12,7 +12,7 @@ jobs: build: strategy: matrix: - java: [ 11 ] + java: [ 11, 17 ] # Job name name: Build and test Alerting # This job runs on Linux @@ -27,10 +27,10 @@ jobs: - name: Checkout Branch uses: actions/checkout@v2 # This step uses the setup-java Github action: https://github.com/actions/setup-java - - name: Set Up JDK 11 + - name: Set Up JDK ${{ matrix.java }} uses: actions/setup-java@v1 with: - java-version: 11 + java-version: ${{ matrix.java }} - name: Build Alerting # Only assembling since the full build is governed by other workflows run: ./gradlew assemble diff --git a/.github/workflows/test-workflow.yml b/.github/workflows/test-workflow.yml index 012c1534a..c83a25fd5 100644 --- a/.github/workflows/test-workflow.yml +++ b/.github/workflows/test-workflow.yml @@ -12,7 +12,7 @@ jobs: build: strategy: matrix: - java: [11, 14] + java: [11, 17] # Job name name: Build Alerting with JDK ${{ matrix.java }} # This job runs on Linux diff --git a/alerting/src/main/kotlin/org/opensearch/alerting/model/BucketLevelTriggerRunResult.kt b/alerting/src/main/kotlin/org/opensearch/alerting/model/BucketLevelTriggerRunResult.kt index 79d48e8b2..63131d835 100644 --- a/alerting/src/main/kotlin/org/opensearch/alerting/model/BucketLevelTriggerRunResult.kt +++ b/alerting/src/main/kotlin/org/opensearch/alerting/model/BucketLevelTriggerRunResult.kt @@ -38,7 +38,7 @@ data class BucketLevelTriggerRunResult( override fun writeTo(out: StreamOutput) { super.writeTo(out) out.writeMap(aggregationResultBuckets, StreamOutput::writeString) { - valueOut: StreamOutput, aggResultBucket: AggregationResultBucket -> + valueOut: StreamOutput, aggResultBucket: AggregationResultBucket -> aggResultBucket.writeTo(valueOut) } out.writeMap(actionResultsMap as Map) diff --git a/alerting/src/main/kotlin/org/opensearch/alerting/resthandler/RestGetAlertsAction.kt b/alerting/src/main/kotlin/org/opensearch/alerting/resthandler/RestGetAlertsAction.kt index a2063494b..a189c3f52 100644 --- a/alerting/src/main/kotlin/org/opensearch/alerting/resthandler/RestGetAlertsAction.kt +++ b/alerting/src/main/kotlin/org/opensearch/alerting/resthandler/RestGetAlertsAction.kt @@ -68,7 +68,7 @@ class RestGetAlertsAction : BaseRestHandler() { val getAlertsRequest = GetAlertsRequest(table, severityLevel, alertState, monitorId) return RestChannelConsumer { - channel -> + channel -> client.execute(GetAlertsAction.INSTANCE, getAlertsRequest, RestToXContentListener(channel)) } } diff --git a/alerting/src/main/kotlin/org/opensearch/alerting/resthandler/RestGetDestinationsAction.kt b/alerting/src/main/kotlin/org/opensearch/alerting/resthandler/RestGetDestinationsAction.kt index d0f02ce80..d6ee82f71 100644 --- a/alerting/src/main/kotlin/org/opensearch/alerting/resthandler/RestGetDestinationsAction.kt +++ b/alerting/src/main/kotlin/org/opensearch/alerting/resthandler/RestGetDestinationsAction.kt @@ -89,7 +89,7 @@ class RestGetDestinationsAction : BaseRestHandler() { destinationType ) return RestChannelConsumer { - channel -> + channel -> client.execute(GetDestinationsAction.INSTANCE, getDestinationsRequest, RestToXContentListener(channel)) } } diff --git a/alerting/src/main/kotlin/org/opensearch/alerting/resthandler/RestGetMonitorAction.kt b/alerting/src/main/kotlin/org/opensearch/alerting/resthandler/RestGetMonitorAction.kt index 3046a8736..4d9bac033 100644 --- a/alerting/src/main/kotlin/org/opensearch/alerting/resthandler/RestGetMonitorAction.kt +++ b/alerting/src/main/kotlin/org/opensearch/alerting/resthandler/RestGetMonitorAction.kt @@ -68,7 +68,7 @@ class RestGetMonitorAction : BaseRestHandler() { } val getMonitorRequest = GetMonitorRequest(monitorId, RestActions.parseVersion(request), request.method(), srcContext) return RestChannelConsumer { - channel -> + channel -> client.execute(GetMonitorAction.INSTANCE, getMonitorRequest, RestToXContentListener(channel)) } } diff --git a/alerting/src/main/kotlin/org/opensearch/alerting/resthandler/RestIndexDestinationAction.kt b/alerting/src/main/kotlin/org/opensearch/alerting/resthandler/RestIndexDestinationAction.kt index 6a790cb98..a3934353a 100644 --- a/alerting/src/main/kotlin/org/opensearch/alerting/resthandler/RestIndexDestinationAction.kt +++ b/alerting/src/main/kotlin/org/opensearch/alerting/resthandler/RestIndexDestinationAction.kt @@ -86,7 +86,7 @@ class RestIndexDestinationAction : BaseRestHandler() { } val indexDestinationRequest = IndexDestinationRequest(id, seqNo, primaryTerm, refreshPolicy, request.method(), destination) return RestChannelConsumer { - channel -> + channel -> client.execute( IndexDestinationAction.INSTANCE, indexDestinationRequest, indexDestinationResponse(channel, request.method()) diff --git a/alerting/src/main/kotlin/org/opensearch/alerting/transport/TransportIndexDestinationAction.kt b/alerting/src/main/kotlin/org/opensearch/alerting/transport/TransportIndexDestinationAction.kt index 8a5d4daef..a41c8c179 100644 --- a/alerting/src/main/kotlin/org/opensearch/alerting/transport/TransportIndexDestinationAction.kt +++ b/alerting/src/main/kotlin/org/opensearch/alerting/transport/TransportIndexDestinationAction.kt @@ -306,7 +306,7 @@ class TransportIndexDestinationAction @Inject constructor( var failureReasons = StringBuilder() if (response.shardInfo.failed > 0) { response.shardInfo.failures.forEach { - entry -> + entry -> failureReasons.append(entry.reason()) } return failureReasons.toString() diff --git a/alerting/src/main/kotlin/org/opensearch/alerting/transport/TransportIndexEmailAccountAction.kt b/alerting/src/main/kotlin/org/opensearch/alerting/transport/TransportIndexEmailAccountAction.kt index c1349e3a9..9f68e2584 100644 --- a/alerting/src/main/kotlin/org/opensearch/alerting/transport/TransportIndexEmailAccountAction.kt +++ b/alerting/src/main/kotlin/org/opensearch/alerting/transport/TransportIndexEmailAccountAction.kt @@ -300,7 +300,7 @@ class TransportIndexEmailAccountAction @Inject constructor( val failureReasons = StringBuilder() if (response.shardInfo.failed > 0) { response.shardInfo.failures.forEach { - entry -> + entry -> failureReasons.append(entry.reason()) } diff --git a/alerting/src/main/kotlin/org/opensearch/alerting/transport/TransportIndexEmailGroupAction.kt b/alerting/src/main/kotlin/org/opensearch/alerting/transport/TransportIndexEmailGroupAction.kt index a89e2cab6..5c2d541ed 100644 --- a/alerting/src/main/kotlin/org/opensearch/alerting/transport/TransportIndexEmailGroupAction.kt +++ b/alerting/src/main/kotlin/org/opensearch/alerting/transport/TransportIndexEmailGroupAction.kt @@ -232,7 +232,7 @@ class TransportIndexEmailGroupAction @Inject constructor( val failureReasons = StringBuilder() if (response.shardInfo.failed > 0) { response.shardInfo.failures.forEach { - entry -> + entry -> failureReasons.append(entry.reason()) } diff --git a/alerting/src/main/kotlin/org/opensearch/alerting/transport/TransportIndexMonitorAction.kt b/alerting/src/main/kotlin/org/opensearch/alerting/transport/TransportIndexMonitorAction.kt index e4f04770d..50fde1514 100644 --- a/alerting/src/main/kotlin/org/opensearch/alerting/transport/TransportIndexMonitorAction.kt +++ b/alerting/src/main/kotlin/org/opensearch/alerting/transport/TransportIndexMonitorAction.kt @@ -477,7 +477,7 @@ class TransportIndexMonitorAction @Inject constructor( val failureReasons = StringBuilder() if (response.shardInfo.failed > 0) { response.shardInfo.failures.forEach { - entry -> + entry -> failureReasons.append(entry.reason()) } return failureReasons.toString() diff --git a/alerting/src/test/kotlin/org/opensearch/alerting/MonitorRunnerIT.kt b/alerting/src/test/kotlin/org/opensearch/alerting/MonitorRunnerIT.kt index dc505ae41..34fb65871 100644 --- a/alerting/src/test/kotlin/org/opensearch/alerting/MonitorRunnerIT.kt +++ b/alerting/src/test/kotlin/org/opensearch/alerting/MonitorRunnerIT.kt @@ -1007,7 +1007,7 @@ class MonitorRunnerIT : AlertingRestTestCase() { val output = entityAsMap(response) @Suppress("UNCHECKED_CAST") (output["trigger_results"] as HashMap).forEach { - _, v -> + _, v -> assertTrue((v as HashMap)["triggered"] as Boolean) } assertEquals(monitor.name, output["monitor_name"]) @@ -1037,7 +1037,7 @@ class MonitorRunnerIT : AlertingRestTestCase() { val output = entityAsMap(response) @Suppress("UNCHECKED_CAST") (output["trigger_results"] as HashMap).forEach { - _, v -> + _, v -> assertTrue((v as HashMap)["triggered"] as Boolean) } assertEquals(monitor.name, output["monitor_name"]) @@ -1064,7 +1064,7 @@ class MonitorRunnerIT : AlertingRestTestCase() { val output = entityAsMap(response) @Suppress("UNCHECKED_CAST") (output["trigger_results"] as HashMap).forEach { - _, v -> + _, v -> assertTrue((v as HashMap)["triggered"] as Boolean) } @Suppress("UNCHECKED_CAST") @@ -1093,7 +1093,7 @@ class MonitorRunnerIT : AlertingRestTestCase() { val output = entityAsMap(response) @Suppress("UNCHECKED_CAST") (output["trigger_results"] as HashMap).forEach { - _, v -> + _, v -> assertFalse((v as HashMap)["triggered"] as Boolean) } @Suppress("UNCHECKED_CAST") diff --git a/build.gradle b/build.gradle index 781ae4573..581cc01b5 100644 --- a/build.gradle +++ b/build.gradle @@ -49,7 +49,7 @@ configurations { } dependencies { - add("ktlint", "com.pinterest:ktlint:0.41.0") { + add("ktlint", "com.pinterest:ktlint:0.45.1") { attributes { attribute(Bundling.BUNDLING_ATTRIBUTE, objects.named(Bundling, Bundling.EXTERNAL)) }