diff --git a/build.gradle b/build.gradle index d80700f3dc..17e5aa8150 100644 --- a/build.gradle +++ b/build.gradle @@ -63,11 +63,11 @@ buildscript { } plugins { - id 'nebula.ospackage' version "8.3.0" + id "com.netflix.nebula.ospackage-base" version "11.5.0" id 'java-library' - id "io.freefair.lombok" version "6.4.0" + id "io.freefair.lombok" version "8.4" id 'jacoco' - id 'com.diffplug.spotless' version '6.19.0' + id 'com.diffplug.spotless' version '6.22.0' } // import versions defined in https://github.com/opensearch-project/OpenSearch/blob/main/buildSrc/src/main/java/org/opensearch/gradle/OpenSearchJavaPlugin.java#L94 @@ -155,8 +155,8 @@ jacoco { } jacocoTestReport { reports { - xml.enabled false - csv.enabled false + xml.required = false + csv.required = false } afterEvaluate { classDirectories.setFrom(files(classDirectories.files.collect { diff --git a/common/build.gradle b/common/build.gradle index ed4b0304f6..09c89ed83a 100644 --- a/common/build.gradle +++ b/common/build.gradle @@ -25,7 +25,7 @@ plugins { id 'java-library' id "io.freefair.lombok" - id 'com.diffplug.spotless' version '6.19.0' + id 'com.diffplug.spotless' version '6.22.0' } repositories { @@ -47,9 +47,9 @@ dependencies { testImplementation group: 'org.assertj', name: 'assertj-core', version: '3.9.1' testImplementation group: 'com.google.guava', name: 'guava', version: '32.0.1-jre' testImplementation group: 'org.hamcrest', name: 'hamcrest-library', version: '2.1' - testImplementation('org.junit.jupiter:junit-jupiter:5.6.2') - testImplementation group: 'org.mockito', name: 'mockito-core', version: '3.12.4' - testImplementation group: 'org.mockito', name: 'mockito-junit-jupiter', version: '3.12.4' + testImplementation('org.junit.jupiter:junit-jupiter:5.9.3') + testImplementation group: 'org.mockito', name: 'mockito-core', version: '5.7.0' + testImplementation group: 'org.mockito', name: 'mockito-junit-jupiter', version: '5.7.0' testImplementation group: 'com.squareup.okhttp3', name: 'mockwebserver', version: '4.12.0' } diff --git a/core/build.gradle b/core/build.gradle index 675e73ba32..9fa1808b2e 100644 --- a/core/build.gradle +++ b/core/build.gradle @@ -28,7 +28,7 @@ plugins { id 'jacoco' id 'info.solidsoft.pitest' version '1.9.0' id 'java-test-fixtures' - id 'com.diffplug.spotless' version '6.19.0' + id 'com.diffplug.spotless' version '6.22.0' } @@ -56,11 +56,10 @@ dependencies { api group: 'com.google.code.gson', name: 'gson', version: '2.8.9' api project(':common') - testImplementation('org.junit.jupiter:junit-jupiter:5.6.2') + testImplementation('org.junit.jupiter:junit-jupiter:5.9.3') testImplementation group: 'org.hamcrest', name: 'hamcrest-library', version: '2.1' - testImplementation group: 'org.mockito', name: 'mockito-core', version: '3.12.4' - testImplementation group: 'org.mockito', name: 'mockito-inline', version: '3.12.4' - testImplementation group: 'org.mockito', name: 'mockito-junit-jupiter', version: '3.12.4' + testImplementation group: 'org.mockito', name: 'mockito-core', version: '5.7.0' + testImplementation group: 'org.mockito', name: 'mockito-junit-jupiter', version: '5.7.0' } spotless { @@ -91,8 +90,8 @@ test { jacocoTestReport { reports { - html.enabled true - xml.enabled true + html.required = true + xml.required = true } afterEvaluate { classDirectories.setFrom(files(classDirectories.files.collect { diff --git a/core/src/test/java/org/opensearch/sql/planner/logical/LogicalPlanNodeVisitorTest.java b/core/src/test/java/org/opensearch/sql/planner/logical/LogicalPlanNodeVisitorTest.java index 74aab31a30..f212749f48 100644 --- a/core/src/test/java/org/opensearch/sql/planner/logical/LogicalPlanNodeVisitorTest.java +++ b/core/src/test/java/org/opensearch/sql/planner/logical/LogicalPlanNodeVisitorTest.java @@ -53,7 +53,7 @@ class LogicalPlanNodeVisitorTest { static Table table; @BeforeAll - private static void initMocks() { + public static void initMocks() { expression = mock(Expression.class); ref = mock(ReferenceExpression.class); aggregator = mock(Aggregator.class); diff --git a/core/src/test/java/org/opensearch/sql/planner/physical/datasource/DataSourceTableScanTest.java b/core/src/test/java/org/opensearch/sql/planner/physical/datasource/DataSourceTableScanTest.java index 0c9449e824..5c7182a752 100644 --- a/core/src/test/java/org/opensearch/sql/planner/physical/datasource/DataSourceTableScanTest.java +++ b/core/src/test/java/org/opensearch/sql/planner/physical/datasource/DataSourceTableScanTest.java @@ -43,7 +43,7 @@ public class DataSourceTableScanTest { private DataSourceTableScan dataSourceTableScan; @BeforeEach - private void setUp() { + public void setUp() { dataSourceTableScan = new DataSourceTableScan(dataSourceService); } diff --git a/datasources/build.gradle b/datasources/build.gradle index c1a0b94b5c..9bd233e1f9 100644 --- a/datasources/build.gradle +++ b/datasources/build.gradle @@ -26,12 +26,12 @@ dependencies { implementation group: 'commons-validator', name: 'commons-validator', version: '1.7' testImplementation group: 'junit', name: 'junit', version: '4.13.2' - testImplementation('org.junit.jupiter:junit-jupiter:5.6.2') - testImplementation group: 'net.bytebuddy', name: 'byte-buddy-agent', version: '1.12.13' + testImplementation('org.junit.jupiter:junit-jupiter:5.9.3') + testImplementation group: 'net.bytebuddy', name: 'byte-buddy-agent', version: '1.14.9' testImplementation group: 'org.hamcrest', name: 'hamcrest-library', version: '2.1' - testImplementation group: 'org.mockito', name: 'mockito-core', version: '5.2.0' - testImplementation group: 'org.mockito', name: 'mockito-junit-jupiter', version: '5.2.0' - testImplementation 'org.junit.jupiter:junit-jupiter:5.6.2' + testImplementation group: 'org.mockito', name: 'mockito-core', version: '5.7.0' + testImplementation group: 'org.mockito', name: 'mockito-junit-jupiter', version: '5.7.0' + testImplementation 'org.junit.jupiter:junit-jupiter:5.9.3' } test { @@ -44,8 +44,8 @@ test { jacocoTestReport { reports { - html.enabled true - xml.enabled true + html.required = true + xml.required = true } afterEvaluate { classDirectories.setFrom(files(classDirectories.files.collect { diff --git a/doctest/build.gradle b/doctest/build.gradle index 5cab1060e2..ec5a26b52b 100644 --- a/doctest/build.gradle +++ b/doctest/build.gradle @@ -9,7 +9,7 @@ plugins { id 'base' id 'com.wiredforcode.spawn' id "de.undercouch.download" version "5.3.0" - id 'com.diffplug.spotless' version '6.19.0' + id 'com.diffplug.spotless' version '6.22.0' } apply plugin: 'opensearch.testclusters' @@ -24,7 +24,7 @@ task cloneSqlCli(type: Exec) { commandLine 'git', 'clone', 'https://github.com/opensearch-project/sql-cli.git' } -task bootstrap(type: Exec, dependsOn: ['cloneSqlCli']) { +task bootstrap(type: Exec, dependsOn: ['cloneSqlCli', 'spotlessJava']) { inputs.file "$projectDir/bootstrap.sh" outputs.dir "$projectDir/.venv" diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 943f0cbfa7..7f93135c49 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 637f7a08ed..a1f138116b 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -2,7 +2,8 @@ # SPDX-License-Identifier: Apache-2.0 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip networkTimeout=10000 zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists +distributionSha256Sum=3e1af3ae886920c3ac87f7a91f816c0c7c436f276a6eefdb3da152100fef72ae diff --git a/gradlew b/gradlew index d558e37897..1aa94a4269 100755 --- a/gradlew +++ b/gradlew @@ -1,14 +1,5 @@ -#!/usr/bin/env sh -# -# Copyright OpenSearch Contributors -# SPDX-License-Identifier: Apache-2.0 -# -# The OpenSearch Contributors require contributions made to -# this file be licensed under the Apache-2.0 license or a -# compatible open source license. -# -# Modifications Copyright OpenSearch Contributors. See -# GitHub history for details. +#!/bin/sh + # # Copyright © 2015-2021 the original authors. # @@ -92,10 +83,8 @@ done # This is normally unused # shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum @@ -142,10 +131,13 @@ location of your Java installation." fi else JAVACMD=java - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the location of your Java installation." + fi fi # Increase the maximum file descriptors if we can. @@ -153,7 +145,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then case $MAX_FD in #( max*) # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC3045 + # shellcheck disable=SC2039,SC3045 MAX_FD=$( ulimit -H -n ) || warn "Could not query maximum file descriptor limit" esac @@ -161,7 +153,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then '' | soft) :;; #( *) # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC3045 + # shellcheck disable=SC2039,SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac @@ -206,11 +198,15 @@ if "$cygwin" || "$msys" ; then done fi -# Collect all arguments for the java command; -# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of -# shell script including quotes and variable substitutions, so put them in -# double quotes to make sure that they get re-expanded; and -# * put everything else in single quotes, so that it's not re-expanded. + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. set -- \ "-Dorg.gradle.appname=$APP_BASE_NAME" \ diff --git a/gradlew.bat b/gradlew.bat index 9012d8024a..6689b85bee 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -1,14 +1,4 @@ @rem -@rem Copyright OpenSearch Contributors -@rem SPDX-License-Identifier: Apache-2.0 -@rem -@rem The OpenSearch Contributors require contributions made to -@rem this file be licensed under the Apache-2.0 license or a -@rem compatible open source license. -@rem -@rem Modifications Copyright OpenSearch Contributors. See -@rem GitHub history for details. -@rem @rem Copyright 2015 the original author or authors. @rem @rem Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/integ-test/build.gradle b/integ-test/build.gradle index 726b1057d5..63eb876682 100644 --- a/integ-test/build.gradle +++ b/integ-test/build.gradle @@ -25,6 +25,8 @@ import org.opensearch.gradle.test.RestIntegTestTask import org.opensearch.gradle.testclusters.StandaloneRestIntegTestTask import org.opensearch.gradle.testclusters.OpenSearchCluster +import org.gradle.api.internal.tasks.testing.filter.DefaultTestFilter +import org.gradle.api.internal.tasks.testing.junitplatform.JUnitPlatformTestFramework import groovy.xml.XmlParser import java.nio.file.Paths @@ -33,7 +35,7 @@ import java.util.stream.Collectors plugins { id "de.undercouch.download" version "5.3.0" - id 'com.diffplug.spotless' version '6.19.0' + id 'com.diffplug.spotless' version '6.22.0' } apply plugin: 'opensearch.build' @@ -179,8 +181,9 @@ dependencies { implementation group: 'org.apache.logging.log4j', name: 'log4j-core', version:"${versions.log4j}" testImplementation project(':opensearch-sql-plugin') testImplementation project(':legacy') - testImplementation('org.junit.jupiter:junit-jupiter-api:5.6.2') - testRuntimeOnly('org.junit.jupiter:junit-jupiter-engine:5.6.2') + testImplementation('org.junit.jupiter:junit-jupiter-api:5.9.3') + testRuntimeOnly('org.junit.jupiter:junit-jupiter-engine:5.9.3') + testRuntimeOnly('org.junit.platform:junit-platform-launcher:1.9.3') testImplementation group: 'com.h2database', name: 'h2', version: '2.2.220' testImplementation group: 'org.xerial', name: 'sqlite-jdbc', version: '3.41.2.2' diff --git a/legacy/build.gradle b/legacy/build.gradle index ca20476610..6ffce2a91d 100644 --- a/legacy/build.gradle +++ b/legacy/build.gradle @@ -26,7 +26,7 @@ plugins { id 'java' id 'io.freefair.lombok' id 'antlr' - id 'com.diffplug.spotless' version '6.19.0' + id 'com.diffplug.spotless' version '6.22.0' } generateGrammarSource { @@ -123,7 +123,7 @@ dependencies { compileOnly group: 'javax.servlet', name: 'servlet-api', version:'2.5' testImplementation group: 'org.hamcrest', name: 'hamcrest-core', version:'2.2' - testImplementation group: 'org.mockito', name: 'mockito-inline', version:'3.12.4' + testImplementation group: 'org.mockito', name: 'mockito-core', version: '5.7.0' testImplementation group: 'junit', name: 'junit', version: '4.13.2' } diff --git a/legacy/src/test/java/org/opensearch/sql/legacy/unittest/JSONRequestTest.java b/legacy/src/test/java/org/opensearch/sql/legacy/unittest/JSONRequestTest.java index fc08e7c516..e90d721f23 100644 --- a/legacy/src/test/java/org/opensearch/sql/legacy/unittest/JSONRequestTest.java +++ b/legacy/src/test/java/org/opensearch/sql/legacy/unittest/JSONRequestTest.java @@ -8,8 +8,8 @@ import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.equalTo; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.anyInt; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyInt; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; diff --git a/legacy/src/test/java/org/opensearch/sql/legacy/unittest/LocalClusterStateTest.java b/legacy/src/test/java/org/opensearch/sql/legacy/unittest/LocalClusterStateTest.java index 6c38af05af..6ea45ed6c8 100644 --- a/legacy/src/test/java/org/opensearch/sql/legacy/unittest/LocalClusterStateTest.java +++ b/legacy/src/test/java/org/opensearch/sql/legacy/unittest/LocalClusterStateTest.java @@ -6,8 +6,8 @@ package org.opensearch.sql.legacy.unittest; import static org.junit.Assert.assertEquals; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.eq; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.doAnswer; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.times; diff --git a/legacy/src/test/java/org/opensearch/sql/legacy/unittest/OpenSearchClientTest.java b/legacy/src/test/java/org/opensearch/sql/legacy/unittest/OpenSearchClientTest.java index 2dd5cc16ac..fec029a638 100644 --- a/legacy/src/test/java/org/opensearch/sql/legacy/unittest/OpenSearchClientTest.java +++ b/legacy/src/test/java/org/opensearch/sql/legacy/unittest/OpenSearchClientTest.java @@ -5,7 +5,7 @@ package org.opensearch.sql.legacy.unittest; -import static org.mockito.Matchers.any; +import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; diff --git a/legacy/src/test/java/org/opensearch/sql/legacy/unittest/SqlRequestFactoryTest.java b/legacy/src/test/java/org/opensearch/sql/legacy/unittest/SqlRequestFactoryTest.java index 63fcd98524..9911f265f1 100644 --- a/legacy/src/test/java/org/opensearch/sql/legacy/unittest/SqlRequestFactoryTest.java +++ b/legacy/src/test/java/org/opensearch/sql/legacy/unittest/SqlRequestFactoryTest.java @@ -15,7 +15,7 @@ import org.junit.runner.RunWith; import org.mockito.Mock; import org.mockito.Mockito; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; import org.opensearch.core.common.bytes.BytesArray; import org.opensearch.rest.RestRequest; import org.opensearch.sql.legacy.esdomain.LocalClusterState; diff --git a/legacy/src/test/java/org/opensearch/sql/legacy/unittest/executor/join/ElasticUtilsTest.java b/legacy/src/test/java/org/opensearch/sql/legacy/unittest/executor/join/ElasticUtilsTest.java index 34c9b941d5..a642b03267 100644 --- a/legacy/src/test/java/org/opensearch/sql/legacy/unittest/executor/join/ElasticUtilsTest.java +++ b/legacy/src/test/java/org/opensearch/sql/legacy/unittest/executor/join/ElasticUtilsTest.java @@ -13,7 +13,7 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; import org.opensearch.search.SearchHit; import org.opensearch.search.SearchHits; import org.opensearch.sql.legacy.executor.join.ElasticUtils; diff --git a/legacy/src/test/java/org/opensearch/sql/legacy/unittest/expression/core/BinaryExpressionTest.java b/legacy/src/test/java/org/opensearch/sql/legacy/unittest/expression/core/BinaryExpressionTest.java index 37a0666ad3..acc0e9c60e 100644 --- a/legacy/src/test/java/org/opensearch/sql/legacy/unittest/expression/core/BinaryExpressionTest.java +++ b/legacy/src/test/java/org/opensearch/sql/legacy/unittest/expression/core/BinaryExpressionTest.java @@ -15,7 +15,7 @@ import org.junit.Test; import org.junit.rules.ExpectedException; import org.junit.runner.RunWith; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; import org.opensearch.sql.legacy.expression.core.operator.ScalarOperation; @RunWith(MockitoJUnitRunner.class) diff --git a/legacy/src/test/java/org/opensearch/sql/legacy/unittest/expression/core/UnaryExpressionTest.java b/legacy/src/test/java/org/opensearch/sql/legacy/unittest/expression/core/UnaryExpressionTest.java index c8582ecb05..e030e1c6cf 100644 --- a/legacy/src/test/java/org/opensearch/sql/legacy/unittest/expression/core/UnaryExpressionTest.java +++ b/legacy/src/test/java/org/opensearch/sql/legacy/unittest/expression/core/UnaryExpressionTest.java @@ -14,7 +14,7 @@ import org.junit.Test; import org.junit.rules.ExpectedException; import org.junit.runner.RunWith; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; import org.opensearch.sql.legacy.expression.core.operator.ScalarOperation; @RunWith(MockitoJUnitRunner.class) diff --git a/legacy/src/test/java/org/opensearch/sql/legacy/unittest/expression/model/ExprValueUtilsTest.java b/legacy/src/test/java/org/opensearch/sql/legacy/unittest/expression/model/ExprValueUtilsTest.java index d84543956d..15fd72a522 100644 --- a/legacy/src/test/java/org/opensearch/sql/legacy/unittest/expression/model/ExprValueUtilsTest.java +++ b/legacy/src/test/java/org/opensearch/sql/legacy/unittest/expression/model/ExprValueUtilsTest.java @@ -12,7 +12,7 @@ import org.junit.Test; import org.junit.rules.ExpectedException; import org.junit.runner.RunWith; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; import org.opensearch.sql.legacy.expression.model.ExprValueFactory; import org.opensearch.sql.legacy.expression.model.ExprValueUtils; diff --git a/legacy/src/test/java/org/opensearch/sql/legacy/unittest/metrics/RollingCounterTest.java b/legacy/src/test/java/org/opensearch/sql/legacy/unittest/metrics/RollingCounterTest.java index 0ad333a6e2..62fca52eaf 100644 --- a/legacy/src/test/java/org/opensearch/sql/legacy/unittest/metrics/RollingCounterTest.java +++ b/legacy/src/test/java/org/opensearch/sql/legacy/unittest/metrics/RollingCounterTest.java @@ -14,7 +14,7 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; import org.opensearch.sql.legacy.metrics.RollingCounter; @RunWith(MockitoJUnitRunner.class) diff --git a/legacy/src/test/java/org/opensearch/sql/legacy/unittest/planner/BindingTupleQueryPlannerExecuteTest.java b/legacy/src/test/java/org/opensearch/sql/legacy/unittest/planner/BindingTupleQueryPlannerExecuteTest.java index 1260b551fb..5cb0bcf124 100644 --- a/legacy/src/test/java/org/opensearch/sql/legacy/unittest/planner/BindingTupleQueryPlannerExecuteTest.java +++ b/legacy/src/test/java/org/opensearch/sql/legacy/unittest/planner/BindingTupleQueryPlannerExecuteTest.java @@ -7,7 +7,7 @@ import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.mockito.Matchers.any; +import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doAnswer; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; @@ -20,7 +20,7 @@ import org.mockito.Mock; import org.mockito.MockitoAnnotations; import org.mockito.invocation.InvocationOnMock; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; import org.mockito.stubbing.Answer; import org.opensearch.action.search.SearchResponse; import org.opensearch.client.Client; diff --git a/legacy/src/test/java/org/opensearch/sql/legacy/unittest/planner/QueryPlannerTest.java b/legacy/src/test/java/org/opensearch/sql/legacy/unittest/planner/QueryPlannerTest.java index 4cda101ae4..521b225893 100644 --- a/legacy/src/test/java/org/opensearch/sql/legacy/unittest/planner/QueryPlannerTest.java +++ b/legacy/src/test/java/org/opensearch/sql/legacy/unittest/planner/QueryPlannerTest.java @@ -6,7 +6,7 @@ package org.opensearch.sql.legacy.unittest.planner; import static java.util.Collections.emptyList; -import static org.mockito.Matchers.any; +import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doAnswer; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.mock; diff --git a/legacy/src/test/java/org/opensearch/sql/legacy/unittest/planner/converter/SQLAggregationParserTest.java b/legacy/src/test/java/org/opensearch/sql/legacy/unittest/planner/converter/SQLAggregationParserTest.java index 855ed9e346..d6911ac2fc 100644 --- a/legacy/src/test/java/org/opensearch/sql/legacy/unittest/planner/converter/SQLAggregationParserTest.java +++ b/legacy/src/test/java/org/opensearch/sql/legacy/unittest/planner/converter/SQLAggregationParserTest.java @@ -26,7 +26,7 @@ import org.junit.Test; import org.junit.rules.ExpectedException; import org.junit.runner.RunWith; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; import org.opensearch.sql.legacy.domain.ColumnTypeProvider; import org.opensearch.sql.legacy.expression.core.Expression; import org.opensearch.sql.legacy.expression.core.ExpressionFactory; diff --git a/legacy/src/test/java/org/opensearch/sql/legacy/unittest/planner/converter/SQLToOperatorConverterTest.java b/legacy/src/test/java/org/opensearch/sql/legacy/unittest/planner/converter/SQLToOperatorConverterTest.java index 578fb9bcff..b9e48b27e4 100644 --- a/legacy/src/test/java/org/opensearch/sql/legacy/unittest/planner/converter/SQLToOperatorConverterTest.java +++ b/legacy/src/test/java/org/opensearch/sql/legacy/unittest/planner/converter/SQLToOperatorConverterTest.java @@ -14,7 +14,7 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; import org.opensearch.client.Client; import org.opensearch.sql.legacy.domain.ColumnTypeProvider; import org.opensearch.sql.legacy.expression.domain.BindingTuple; diff --git a/legacy/src/test/java/org/opensearch/sql/legacy/unittest/planner/physical/SearchAggregationResponseHelperTest.java b/legacy/src/test/java/org/opensearch/sql/legacy/unittest/planner/physical/SearchAggregationResponseHelperTest.java index cca5f745ee..5863f566ef 100644 --- a/legacy/src/test/java/org/opensearch/sql/legacy/unittest/planner/physical/SearchAggregationResponseHelperTest.java +++ b/legacy/src/test/java/org/opensearch/sql/legacy/unittest/planner/physical/SearchAggregationResponseHelperTest.java @@ -20,7 +20,7 @@ import org.hamcrest.Matcher; import org.junit.Test; import org.junit.runner.RunWith; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; import org.opensearch.sql.legacy.expression.domain.BindingTuple; import org.opensearch.sql.legacy.query.planner.physical.node.scroll.BindingTupleRow; import org.opensearch.sql.legacy.query.planner.physical.node.scroll.SearchAggregationResponseHelper; diff --git a/legacy/src/test/java/org/opensearch/sql/legacy/unittest/query/DefaultQueryActionTest.java b/legacy/src/test/java/org/opensearch/sql/legacy/unittest/query/DefaultQueryActionTest.java index 11e14e9b48..755d604a65 100644 --- a/legacy/src/test/java/org/opensearch/sql/legacy/unittest/query/DefaultQueryActionTest.java +++ b/legacy/src/test/java/org/opensearch/sql/legacy/unittest/query/DefaultQueryActionTest.java @@ -6,8 +6,8 @@ package org.opensearch.sql.legacy.unittest.query; import static org.hamcrest.Matchers.equalTo; -import static org.mockito.Matchers.anyString; -import static org.mockito.Matchers.eq; +import static org.mockito.ArgumentMatchers.anyString; +import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.any; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.mock; diff --git a/legacy/src/test/java/org/opensearch/sql/legacy/unittest/rewriter/RewriteRuleExecutorTest.java b/legacy/src/test/java/org/opensearch/sql/legacy/unittest/rewriter/RewriteRuleExecutorTest.java index 9c13e1fc71..badddd53a5 100644 --- a/legacy/src/test/java/org/opensearch/sql/legacy/unittest/rewriter/RewriteRuleExecutorTest.java +++ b/legacy/src/test/java/org/opensearch/sql/legacy/unittest/rewriter/RewriteRuleExecutorTest.java @@ -16,7 +16,7 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; import org.opensearch.sql.legacy.rewriter.RewriteRule; import org.opensearch.sql.legacy.rewriter.RewriteRuleExecutor; diff --git a/legacy/src/test/java/org/opensearch/sql/legacy/unittest/rewriter/parent/SQLExprParentSetterRuleTest.java b/legacy/src/test/java/org/opensearch/sql/legacy/unittest/rewriter/parent/SQLExprParentSetterRuleTest.java index 0fdf16e40e..460b045ca0 100644 --- a/legacy/src/test/java/org/opensearch/sql/legacy/unittest/rewriter/parent/SQLExprParentSetterRuleTest.java +++ b/legacy/src/test/java/org/opensearch/sql/legacy/unittest/rewriter/parent/SQLExprParentSetterRuleTest.java @@ -11,7 +11,7 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; import org.opensearch.sql.legacy.rewriter.parent.SQLExprParentSetterRule; @RunWith(MockitoJUnitRunner.class) diff --git a/legacy/src/test/java/org/opensearch/sql/legacy/util/MultipleIndexClusterUtils.java b/legacy/src/test/java/org/opensearch/sql/legacy/util/MultipleIndexClusterUtils.java index 58234d73b7..13a4ae3a6b 100644 --- a/legacy/src/test/java/org/opensearch/sql/legacy/util/MultipleIndexClusterUtils.java +++ b/legacy/src/test/java/org/opensearch/sql/legacy/util/MultipleIndexClusterUtils.java @@ -5,8 +5,8 @@ package org.opensearch.sql.legacy.util; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.eq; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; import static org.opensearch.sql.legacy.util.CheckScriptContents.createParser; diff --git a/opensearch/build.gradle b/opensearch/build.gradle index c9087bca49..c47806b6bb 100644 --- a/opensearch/build.gradle +++ b/opensearch/build.gradle @@ -27,7 +27,7 @@ plugins { id "io.freefair.lombok" id 'jacoco' id 'info.solidsoft.pitest' version '1.9.0' - id 'com.diffplug.spotless' version '6.19.0' + id 'com.diffplug.spotless' version '6.22.0' } dependencies { @@ -41,10 +41,14 @@ dependencies { compileOnly group: 'org.opensearch.client', name: 'opensearch-rest-high-level-client', version: "${opensearch_version}" implementation group: 'org.opensearch', name:'opensearch-ml-client', version: "${opensearch_build}" - testImplementation('org.junit.jupiter:junit-jupiter:5.6.2') + testImplementation('org.junit.jupiter:junit-jupiter-api:5.9.3') + testImplementation('org.junit.jupiter:junit-jupiter-params:5.9.3') + testRuntimeOnly('org.junit.jupiter:junit-jupiter-engine:5.9.3') + testRuntimeOnly('org.junit.platform:junit-platform-launcher:1.9.3') + testImplementation group: 'org.hamcrest', name: 'hamcrest-library', version: '2.1' - testImplementation group: 'org.mockito', name: 'mockito-core', version: '3.12.4' - testImplementation group: 'org.mockito', name: 'mockito-junit-jupiter', version: '3.12.4' + testImplementation group: 'org.mockito', name: 'mockito-core', version: '5.7.0' + testImplementation group: 'org.mockito', name: 'mockito-junit-jupiter', version: '5.7.0' testImplementation group: 'org.opensearch.client', name: 'opensearch-rest-high-level-client', version: "${opensearch_version}" testImplementation group: 'org.opensearch.test', name: 'framework', version: "${opensearch_version}" } @@ -86,8 +90,8 @@ test { jacocoTestReport { reports { - html.enabled true - xml.enabled true + html.required = true + xml.required = true } afterEvaluate { classDirectories.setFrom(files(classDirectories.files.collect { diff --git a/plugin/build.gradle b/plugin/build.gradle index efbe829af1..49cb52721d 100644 --- a/plugin/build.gradle +++ b/plugin/build.gradle @@ -27,7 +27,7 @@ plugins { id "io.freefair.lombok" id 'jacoco' id 'opensearch.opensearchplugin' - id 'com.diffplug.spotless' version '6.19.0' + id 'com.diffplug.spotless' version '6.22.0' } apply plugin: 'opensearch.pluginzip' @@ -150,11 +150,11 @@ dependencies { api project(':datasources') api project(':spark') - testImplementation group: 'net.bytebuddy', name: 'byte-buddy-agent', version: '1.12.13' + testImplementation group: 'net.bytebuddy', name: 'byte-buddy-agent', version: '1.14.9' testImplementation group: 'org.hamcrest', name: 'hamcrest-library', version: '2.1' testImplementation group: 'org.mockito', name: 'mockito-core', version: "${versions.mockito}" testImplementation group: 'org.mockito', name: 'mockito-junit-jupiter', version: "${versions.mockito}" - testImplementation 'org.junit.jupiter:junit-jupiter:5.6.2' + testImplementation 'org.junit.jupiter:junit-jupiter:5.9.3' } test { @@ -203,7 +203,7 @@ testingConventions.enabled = false thirdPartyAudit.enabled = false -apply plugin: 'nebula.ospackage' +apply plugin: 'com.netflix.nebula.ospackage' validateNebulaPom.enabled = false // This is afterEvaluate because the bundlePlugin ZIP task is updated afterEvaluate and changes the ZIP name to match the plugin name @@ -245,9 +245,9 @@ afterEvaluate { task renameRpm(type: Copy) { from("$buildDir/distributions") into("$buildDir/distributions") - include archiveName - rename archiveName, "${packageName}-${version}.rpm" - doLast { delete file("$buildDir/distributions/$archiveName") } + include "$archiveFileName" + rename "$archiveFileName", "${packageName}-${version}.rpm" + doLast { delete file("$buildDir/distributions/$archiveFileName") } } } @@ -258,9 +258,9 @@ afterEvaluate { task renameDeb(type: Copy) { from("$buildDir/distributions") into("$buildDir/distributions") - include archiveName - rename archiveName, "${packageName}-${version}.deb" - doLast { delete file("$buildDir/distributions/$archiveName") } + include "$archiveFileName" + rename "$archiveFileName", "${packageName}-${version}.deb" + doLast { delete file("$buildDir/distributions/$archiveFileName") } } } } diff --git a/ppl/build.gradle b/ppl/build.gradle index 75281e9160..d58882d5e8 100644 --- a/ppl/build.gradle +++ b/ppl/build.gradle @@ -27,7 +27,7 @@ plugins { id "io.freefair.lombok" id 'jacoco' id 'antlr' - id 'com.diffplug.spotless' version '6.19.0' + id 'com.diffplug.spotless' version '6.22.0' } generateGrammarSource { @@ -57,7 +57,7 @@ dependencies { testImplementation group: 'junit', name: 'junit', version: '4.13.2' testImplementation group: 'org.hamcrest', name: 'hamcrest-library', version: '2.1' - testImplementation group: 'org.mockito', name: 'mockito-core', version: '3.12.4' + testImplementation group: 'org.mockito', name: 'mockito-core', version: '5.7.0' testImplementation(testFixtures(project(":core"))) } @@ -88,8 +88,8 @@ test { jacocoTestReport { reports { - html.enabled true - xml.enabled true + html.required = true + xml.required = true } afterEvaluate { classDirectories.setFrom(files(classDirectories.files.collect { diff --git a/prometheus/build.gradle b/prometheus/build.gradle index d2f4ea9171..7a3b3f7af6 100644 --- a/prometheus/build.gradle +++ b/prometheus/build.gradle @@ -24,10 +24,10 @@ dependencies { implementation group: 'com.fasterxml.jackson.dataformat', name: 'jackson-dataformat-cbor', version: "${versions.jackson}" implementation group: 'org.json', name: 'json', version: '20231013' - testImplementation('org.junit.jupiter:junit-jupiter:5.6.2') + testImplementation('org.junit.jupiter:junit-jupiter:5.9.3') testImplementation group: 'org.hamcrest', name: 'hamcrest-library', version: '2.1' - testImplementation group: 'org.mockito', name: 'mockito-core', version: '3.12.4' - testImplementation group: 'org.mockito', name: 'mockito-junit-jupiter', version: '3.12.4' + testImplementation group: 'org.mockito', name: 'mockito-core', version: '5.7.0' + testImplementation group: 'org.mockito', name: 'mockito-junit-jupiter', version: '5.7.0' testImplementation group: 'com.squareup.okhttp3', name: 'mockwebserver', version: '4.12.0' } @@ -45,8 +45,8 @@ configurations.all { jacocoTestReport { reports { - html.enabled true - xml.enabled true + html.required = true + xml.required = true } afterEvaluate { classDirectories.setFrom(files(classDirectories.files.collect { diff --git a/protocol/build.gradle b/protocol/build.gradle index 212f746b1d..5bbff68e51 100644 --- a/protocol/build.gradle +++ b/protocol/build.gradle @@ -26,7 +26,7 @@ plugins { id 'java' id "io.freefair.lombok" id 'jacoco' - id 'com.diffplug.spotless' version '6.19.0' + id 'com.diffplug.spotless' version '6.22.0' } dependencies { @@ -38,10 +38,10 @@ dependencies { implementation project(':core') implementation project(':opensearch') - testImplementation('org.junit.jupiter:junit-jupiter:5.6.2') + testImplementation('org.junit.jupiter:junit-jupiter:5.9.3') testImplementation group: 'org.hamcrest', name: 'hamcrest-library', version: '2.1' - testImplementation group: 'org.mockito', name: 'mockito-core', version: '3.12.4' - testImplementation group: 'org.mockito', name: 'mockito-junit-jupiter', version: '3.12.4' + testImplementation group: 'org.mockito', name: 'mockito-core', version: '5.7.0' + testImplementation group: 'org.mockito', name: 'mockito-junit-jupiter', version: '5.7.0' } configurations.all { @@ -60,8 +60,8 @@ test { jacocoTestReport { reports { - html.enabled true - xml.enabled true + html.required = true + xml.required = true } afterEvaluate { classDirectories.setFrom(files(classDirectories.files.collect { diff --git a/spark/build.gradle b/spark/build.gradle index bed355b9d2..9ebd18d1f9 100644 --- a/spark/build.gradle +++ b/spark/build.gradle @@ -53,11 +53,11 @@ dependencies { api group: 'com.amazonaws', name: 'aws-java-sdk-emrserverless', version: '1.12.545' implementation group: 'commons-io', name: 'commons-io', version: '2.8.0' - testImplementation(platform("org.junit:junit-bom:5.6.2")) + testImplementation(platform("org.junit:junit-bom:5.9.3")) - testImplementation('org.junit.jupiter:junit-jupiter') - testImplementation group: 'org.mockito', name: 'mockito-core', version: '5.2.0' - testImplementation group: 'org.mockito', name: 'mockito-junit-jupiter', version: '5.2.0' + testCompileOnly('org.junit.jupiter:junit-jupiter') + testImplementation group: 'org.mockito', name: 'mockito-core', version: '5.7.0' + testImplementation group: 'org.mockito', name: 'mockito-junit-jupiter', version: '5.7.0' testCompileOnly('junit:junit:4.13.1') { exclude group: 'org.hamcrest', module: 'hamcrest-core' @@ -65,6 +65,9 @@ dependencies { testRuntimeOnly("org.junit.vintage:junit-vintage-engine") { exclude group: 'org.hamcrest', module: 'hamcrest-core' } + testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine") { + exclude group: 'org.hamcrest', module: 'hamcrest-core' + } testRuntimeOnly("org.junit.platform:junit-platform-launcher") { because 'allows tests to run from IDEs that bundle older version of launcher' } @@ -96,8 +99,8 @@ jacocoTestReport { dependsOn test, junit4 executionData test, junit4 reports { - html.enabled true - xml.enabled true + html.required = true + xml.required = true } afterEvaluate { classDirectories.setFrom(files(classDirectories.files.collect { diff --git a/sql/build.gradle b/sql/build.gradle index c9b46d38f1..d40b3dcb7e 100644 --- a/sql/build.gradle +++ b/sql/build.gradle @@ -27,7 +27,7 @@ plugins { id "io.freefair.lombok" id 'jacoco' id 'antlr' - id 'com.diffplug.spotless' version '6.19.0' + id 'com.diffplug.spotless' version '6.22.0' } generateGrammarSource { @@ -52,10 +52,10 @@ dependencies { implementation project(':core') api project(':protocol') - testImplementation('org.junit.jupiter:junit-jupiter:5.6.2') + testImplementation('org.junit.jupiter:junit-jupiter:5.9.3') testImplementation group: 'org.hamcrest', name: 'hamcrest-library', version: '2.1' - testImplementation group: 'org.mockito', name: 'mockito-core', version: '3.12.4' - testImplementation group: 'org.mockito', name: 'mockito-junit-jupiter', version: '3.12.4' + testImplementation group: 'org.mockito', name: 'mockito-core', version: '5.7.0' + testImplementation group: 'org.mockito', name: 'mockito-junit-jupiter', version: '5.7.0' testImplementation(testFixtures(project(":core"))) } @@ -87,8 +87,8 @@ test { jacocoTestReport { reports { - html.enabled true - xml.enabled true + html.required = true + xml.required = true } afterEvaluate { classDirectories.setFrom(files(classDirectories.files.collect {