diff --git a/benchmarks/src/main/java/org/opensearch/benchmark/time/NanoTimeVsCurrentTimeMillisBenchmark.java b/benchmarks/src/main/java/org/opensearch/benchmark/time/NanoTimeVsCurrentTimeMillisBenchmark.java index 4e4662a8f0427..4c87734255b8a 100644 --- a/benchmarks/src/main/java/org/opensearch/benchmark/time/NanoTimeVsCurrentTimeMillisBenchmark.java +++ b/benchmarks/src/main/java/org/opensearch/benchmark/time/NanoTimeVsCurrentTimeMillisBenchmark.java @@ -8,7 +8,15 @@ package org.opensearch.benchmark.time; -import org.openjdk.jmh.annotations.*; +import org.openjdk.jmh.annotations.Fork; +import org.openjdk.jmh.annotations.Warmup; +import org.openjdk.jmh.annotations.Measurement; +import org.openjdk.jmh.annotations.BenchmarkMode; +import org.openjdk.jmh.annotations.OutputTimeUnit; +import org.openjdk.jmh.annotations.Mode; +import org.openjdk.jmh.annotations.State; +import org.openjdk.jmh.annotations.Scope; +import org.openjdk.jmh.annotations.Benchmark; import java.util.concurrent.TimeUnit; diff --git a/build.gradle b/build.gradle index f56b375883b70..ceb9ce395c3c7 100644 --- a/build.gradle +++ b/build.gradle @@ -320,7 +320,7 @@ allprojects { task.reproducibleFileOrder = true if (task instanceof SymbolicLinkPreservingTar) { // Replace file timestamps with latest Git revision date (if available) - task.lastModifiedTimestamp = gitRevisionDate + task.lastModifiedTimestamp = gitRevisionDate } } @@ -359,7 +359,8 @@ allprojects { project.javadoc.dependsOn "${upstreamProject.path}:javadoc" String externalLinkName = upstreamProject.archivesBaseName String artifactPath = dep.group.replaceAll('\\.', '/') + '/' + externalLinkName.replaceAll('\\.', '/') + '/' + dep.version - project.javadoc.options.linksOffline artifactsHost + "/javadoc/" + artifactPath, "${upstreamProject.buildDir}/docs/javadoc/" + String projectRelativePath = project.relativePath(upstreamProject.buildDir) + project.javadoc.options.linksOffline artifactsHost + "/javadoc/" + artifactPath, "${projectRelativePath}/docs/javadoc/" } } boolean hasShadow = project.plugins.hasPlugin(ShadowPlugin) diff --git a/codecov.yml b/codecov.yml new file mode 100644 index 0000000000000..7c38e4e63325b --- /dev/null +++ b/codecov.yml @@ -0,0 +1,12 @@ +codecov: + require_ci_to_pass: yes + +coverage: + precision: 2 + round: down + range: "70...100" + status: + project: + default: + target: 70% # the required coverage value + threshold: 1% # the leniency in hitting the target diff --git a/distribution/packages/build.gradle b/distribution/packages/build.gradle index cd0cf6b9db64d..df3049d7684c4 100644 --- a/distribution/packages/build.gradle +++ b/distribution/packages/build.gradle @@ -392,7 +392,7 @@ tasks.register('buildRpm', Rpm) { } tasks.register('buildNoJdkRpm', Rpm) { - configure(commonRpmConfig(true, 'x64')) + configure(commonRpmConfig(false, 'x64')) } Closure dpkgExists = { it -> new File('/bin/dpkg-deb').exists() || new File('/usr/bin/dpkg-deb').exists() || new File('/usr/local/bin/dpkg-deb').exists() } diff --git a/gradle/formatting.gradle b/gradle/formatting.gradle index 19adea33b23b3..7cd8c35b5fef7 100644 --- a/gradle/formatting.gradle +++ b/gradle/formatting.gradle @@ -69,6 +69,13 @@ allprojects { eclipse().configFile rootProject.file('buildSrc/formatterConfig.xml') trimTrailingWhitespace() + custom 'Refuse wildcard imports', { + // Wildcard imports can't be resolved; fail the build + if (it =~ /\s+import .*\*;/) { + throw new AssertionError("Do not use wildcard imports. 'spotlessApply' cannot resolve this issue.") + } + } + // See DEVELOPER_GUIDE.md for details of when to enable this. if (System.getProperty('spotless.paddedcell') != null) { paddedCell() diff --git a/gradle/missing-javadoc.gradle b/gradle/missing-javadoc.gradle index d927bc8a2d09a..6b3dacd3e905a 100644 --- a/gradle/missing-javadoc.gradle +++ b/gradle/missing-javadoc.gradle @@ -70,7 +70,7 @@ allprojects { classpath = sourceSets.main.compileClasspath srcDirSet = sourceSets.main.java - outputDir = project.javadoc.destinationDir + outputDir = file("${project.buildDir}/tmp/missingJavadoc/") } } } @@ -183,6 +183,7 @@ configure(project(":server")) { } } +@CacheableTask class MissingJavadocTask extends DefaultTask { @InputFiles @SkipWhenEmpty @@ -227,7 +228,8 @@ class MissingJavadocTask extends DefaultTask { @Input def executable - @Input + @InputFiles + @PathSensitive(PathSensitivity.RELATIVE) def taskResources /** Utility method to recursively collect all tasks with same name like this one that we depend on */ diff --git a/modules/lang-painless/src/main/java/org/opensearch/painless/antlr/PainlessLexer.java b/modules/lang-painless/src/main/java/org/opensearch/painless/antlr/PainlessLexer.java index 60c6f9763bd95..f17a51d4c28f6 100644 --- a/modules/lang-painless/src/main/java/org/opensearch/painless/antlr/PainlessLexer.java +++ b/modules/lang-painless/src/main/java/org/opensearch/painless/antlr/PainlessLexer.java @@ -35,10 +35,16 @@ import org.antlr.v4.runtime.Lexer; import org.antlr.v4.runtime.CharStream; -import org.antlr.v4.runtime.*; -import org.antlr.v4.runtime.atn.*; +import org.antlr.v4.runtime.RuntimeMetaData; +import org.antlr.v4.runtime.Vocabulary; +import org.antlr.v4.runtime.VocabularyImpl; +import org.antlr.v4.runtime.RuleContext; +import org.antlr.v4.runtime.atn.ATN; +import org.antlr.v4.runtime.atn.ATNDeserializer; +import org.antlr.v4.runtime.atn.LexerATNSimulator; +import org.antlr.v4.runtime.atn.PredictionContextCache; + import org.antlr.v4.runtime.dfa.DFA; -import org.antlr.v4.runtime.misc.*; @SuppressWarnings({ "all", "warnings", "unchecked", "unused", "cast" }) abstract class PainlessLexer extends Lexer { diff --git a/modules/lang-painless/src/main/java/org/opensearch/painless/antlr/PainlessParser.java b/modules/lang-painless/src/main/java/org/opensearch/painless/antlr/PainlessParser.java index 03cf58f336d10..1a083750aa36b 100644 --- a/modules/lang-painless/src/main/java/org/opensearch/painless/antlr/PainlessParser.java +++ b/modules/lang-painless/src/main/java/org/opensearch/painless/antlr/PainlessParser.java @@ -32,11 +32,25 @@ */ package org.opensearch.painless.antlr; -import org.antlr.v4.runtime.atn.*; import org.antlr.v4.runtime.dfa.DFA; -import org.antlr.v4.runtime.*; -import org.antlr.v4.runtime.misc.*; -import org.antlr.v4.runtime.tree.*; +import org.antlr.v4.runtime.atn.PredictionContextCache; +import org.antlr.v4.runtime.atn.ParserATNSimulator; +import org.antlr.v4.runtime.atn.ATN; +import org.antlr.v4.runtime.atn.ATNDeserializer; +import org.antlr.v4.runtime.dfa.DFA; +import org.antlr.v4.runtime.Parser; +import org.antlr.v4.runtime.RuntimeMetaData; +import org.antlr.v4.runtime.Vocabulary; +import org.antlr.v4.runtime.VocabularyImpl; +import org.antlr.v4.runtime.RecognitionException; +import org.antlr.v4.runtime.TokenStream; +import org.antlr.v4.runtime.ParserRuleContext; +import org.antlr.v4.runtime.Token; +import org.antlr.v4.runtime.NoViableAltException; +import org.antlr.v4.runtime.FailedPredicateException; +import org.antlr.v4.runtime.RuleContext; +import org.antlr.v4.runtime.tree.TerminalNode; +import org.antlr.v4.runtime.tree.ParseTreeVisitor; import java.util.List; @SuppressWarnings({ "all", "warnings", "unchecked", "unused", "cast" }) diff --git a/server/src/internalClusterTest/java/org/opensearch/search/profile/query/QueryProfilerIT.java b/server/src/internalClusterTest/java/org/opensearch/search/profile/query/QueryProfilerIT.java index a74f359f2542e..8601e2b6d6be9 100644 --- a/server/src/internalClusterTest/java/org/opensearch/search/profile/query/QueryProfilerIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/search/profile/query/QueryProfilerIT.java @@ -34,7 +34,11 @@ import org.apache.lucene.tests.util.English; import org.opensearch.action.index.IndexRequestBuilder; -import org.opensearch.action.search.*; +import org.opensearch.action.search.SearchResponse; +import org.opensearch.action.search.MultiSearchResponse; +import org.opensearch.action.search.SearchType; +import org.opensearch.action.search.SearchRequestBuilder; +import org.opensearch.action.search.ShardSearchFailure; import org.opensearch.common.settings.Settings; import org.opensearch.index.query.QueryBuilder; import org.opensearch.index.query.QueryBuilders; @@ -44,7 +48,11 @@ import org.opensearch.search.sort.SortOrder; import org.opensearch.test.OpenSearchIntegTestCase; -import java.util.*; +import java.util.List; +import java.util.Arrays; +import java.util.Map; +import java.util.HashSet; +import java.util.Set; import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.greaterThan; diff --git a/server/src/main/java/org/opensearch/action/search/CreatePitController.java b/server/src/main/java/org/opensearch/action/search/CreatePitController.java index ba71eaefa5c7a..d59268b087e80 100644 --- a/server/src/main/java/org/opensearch/action/search/CreatePitController.java +++ b/server/src/main/java/org/opensearch/action/search/CreatePitController.java @@ -19,6 +19,7 @@ import org.opensearch.cluster.node.DiscoveryNode; import org.opensearch.cluster.service.ClusterService; import org.opensearch.common.Strings; +import org.opensearch.common.inject.Inject; import org.opensearch.common.io.stream.NamedWriteableRegistry; import org.opensearch.common.settings.Setting; import org.opensearch.common.unit.TimeValue; @@ -53,41 +54,38 @@ public class CreatePitController { private final ClusterService clusterService; private final TransportSearchAction transportSearchAction; private final NamedWriteableRegistry namedWriteableRegistry; - private final Task task; - private final ActionListener listener; - private final CreatePitRequest request; private final PitService pitService; private static final Logger logger = LogManager.getLogger(CreatePitController.class); public static final Setting PIT_INIT_KEEP_ALIVE = Setting.positiveTimeSetting( - "pit.init.keep_alive", + "point_in_time.init.keep_alive", timeValueSeconds(30), Setting.Property.NodeScope ); + @Inject public CreatePitController( - CreatePitRequest request, SearchTransportService searchTransportService, ClusterService clusterService, TransportSearchAction transportSearchAction, NamedWriteableRegistry namedWriteableRegistry, - Task task, - ActionListener listener, PitService pitService ) { this.searchTransportService = searchTransportService; this.clusterService = clusterService; this.transportSearchAction = transportSearchAction; this.namedWriteableRegistry = namedWriteableRegistry; - this.task = task; - this.listener = listener; - this.request = request; this.pitService = pitService; } /** * This method creates PIT reader context */ - public void executeCreatePit(StepListener createPitListener, ActionListener updatePitIdListener) { + public void executeCreatePit( + CreatePitRequest request, + Task task, + StepListener createPitListener, + ActionListener updatePitIdListener + ) { SearchRequest searchRequest = new SearchRequest(request.getIndices()); searchRequest.preference(request.getPreference()); searchRequest.routing(request.getRouting()); @@ -235,7 +233,11 @@ private StepListener> getConnectionLoo .filter(ctx -> Strings.isEmpty(ctx.getClusterAlias()) == false) .map(SearchContextIdForNode::getClusterAlias) .collect(Collectors.toSet()); - return SearchUtils.getConnectionLookupListener(searchTransportService.getRemoteClusterService(), state, clusters); + return (StepListener>) SearchUtils.getConnectionLookupListener( + searchTransportService.getRemoteClusterService(), + state, + clusters + ); } private ActionListener getGroupedListener( diff --git a/server/src/main/java/org/opensearch/action/search/SearchContextIdForNode.java b/server/src/main/java/org/opensearch/action/search/SearchContextIdForNode.java index 7f218a3b1a17e..df655c39f845d 100644 --- a/server/src/main/java/org/opensearch/action/search/SearchContextIdForNode.java +++ b/server/src/main/java/org/opensearch/action/search/SearchContextIdForNode.java @@ -45,12 +45,12 @@ * * @opensearch.internal */ -public final class SearchContextIdForNode implements Writeable { +final class SearchContextIdForNode implements Writeable { private final String node; private final ShardSearchContextId searchContextId; private final String clusterAlias; - public SearchContextIdForNode(@Nullable String clusterAlias, String node, ShardSearchContextId searchContextId) { + SearchContextIdForNode(@Nullable String clusterAlias, String node, ShardSearchContextId searchContextId) { this.node = node; this.clusterAlias = clusterAlias; this.searchContextId = searchContextId; diff --git a/server/src/main/java/org/opensearch/action/search/SearchUtils.java b/server/src/main/java/org/opensearch/action/search/SearchUtils.java index 148d1645568b1..96fcda0d491c9 100644 --- a/server/src/main/java/org/opensearch/action/search/SearchUtils.java +++ b/server/src/main/java/org/opensearch/action/search/SearchUtils.java @@ -8,6 +8,7 @@ package org.opensearch.action.search; +import org.opensearch.action.ActionListener; import org.opensearch.action.StepListener; import org.opensearch.cluster.ClusterState; import org.opensearch.cluster.node.DiscoveryNode; @@ -26,7 +27,7 @@ public SearchUtils() {} /** * Get connection lookup listener for list of clusters passed */ - public static StepListener> getConnectionLookupListener( + public static ActionListener> getConnectionLookupListener( RemoteClusterService remoteClusterService, ClusterState state, Set clusters diff --git a/server/src/main/java/org/opensearch/action/search/TransportCreatePitAction.java b/server/src/main/java/org/opensearch/action/search/TransportCreatePitAction.java index aff1f3c728845..a393e0e36a092 100644 --- a/server/src/main/java/org/opensearch/action/search/TransportCreatePitAction.java +++ b/server/src/main/java/org/opensearch/action/search/TransportCreatePitAction.java @@ -41,6 +41,7 @@ public class TransportCreatePitAction extends HandledTransportAction new CreatePitRequest(in)); this.transportService = transportService; @@ -58,6 +61,7 @@ public TransportCreatePitAction( this.clusterService = clusterService; this.transportSearchAction = transportSearchAction; this.namedWriteableRegistry = namedWriteableRegistry; + this.createPitController = createPitController; this.pitService = pitService; } @@ -83,7 +87,7 @@ protected void doExecute(Task task, CreatePitRequest request, ActionListener MAX_PIT_KEEPALIVE_SETTING = Setting.positiveTimeSetting( - "pit.max_keep_alive", + "point_in_time.max_keep_alive", timeValueHours(24), Property.NodeScope, Property.Dynamic diff --git a/server/src/main/java/org/opensearch/search/internal/PitReaderContext.java b/server/src/main/java/org/opensearch/search/internal/PitReaderContext.java index 43ca7e0ebd823..1b2400bdadfa1 100644 --- a/server/src/main/java/org/opensearch/search/internal/PitReaderContext.java +++ b/server/src/main/java/org/opensearch/search/internal/PitReaderContext.java @@ -55,7 +55,7 @@ public Releasable updatePitIdAndKeepAlive(long keepAliveInMillis, String pitId, setPitId(pitId); setCreationTime(createTime); return Releasables.releaseOnce(() -> { - getLastAccessTime().updateAndGet(curr -> Math.max(curr, nowInMillis())); + updateLastAccessTime(); getRefCounted().decRef(); }); } diff --git a/server/src/main/java/org/opensearch/search/internal/ReaderContext.java b/server/src/main/java/org/opensearch/search/internal/ReaderContext.java index 3f4d816480eb9..fe644e44f297f 100644 --- a/server/src/main/java/org/opensearch/search/internal/ReaderContext.java +++ b/server/src/main/java/org/opensearch/search/internal/ReaderContext.java @@ -109,8 +109,8 @@ protected AbstractRefCounted getRefCounted() { return refCounted; } - protected AtomicLong getLastAccessTime() { - return lastAccessTime; + protected void updateLastAccessTime() { + this.lastAccessTime.updateAndGet(curr -> Math.max(curr, nowInMillis())); } protected long nowInMillis() { diff --git a/server/src/test/java/org/opensearch/action/search/CreatePitControllerTests.java b/server/src/test/java/org/opensearch/action/search/CreatePitControllerTests.java index 530edb90eff19..2c65d6ffcc813 100644 --- a/server/src/test/java/org/opensearch/action/search/CreatePitControllerTests.java +++ b/server/src/test/java/org/opensearch/action/search/CreatePitControllerTests.java @@ -221,13 +221,10 @@ public Transport.Connection getConnection(String clusterAlias, DiscoveryNode nod PitService pitService = new PitService(clusterServiceMock, searchTransportService); CreatePitController controller = new CreatePitController( - request, searchTransportService, clusterServiceMock, transportSearchAction, namedWriteableRegistry, - task, - createPitListener, pitService ); @@ -244,7 +241,7 @@ public void onFailure(Exception e) { }, latch); StepListener createListener = new StepListener<>(); - controller.executeCreatePit(createListener, updatelistener); + controller.executeCreatePit(request, task, createListener, updatelistener); createListener.onResponse(searchResponse); latch.await(); assertEquals(3, updateNodesInvoked.size()); @@ -313,13 +310,10 @@ public void sendFreePITContexts( request.setIndices(new String[] { "index" }); PitService pitService = new PitService(clusterServiceMock, searchTransportService); CreatePitController controller = new CreatePitController( - request, searchTransportService, clusterServiceMock, transportSearchAction, namedWriteableRegistry, - task, - createPitListener, pitService ); @@ -337,7 +331,7 @@ public void onFailure(Exception e) { StepListener createListener = new StepListener<>(); - controller.executeCreatePit(createListener, updatelistener); + controller.executeCreatePit(request, task, createListener, updatelistener); createListener.onFailure(new Exception("Exception occurred in phase 1")); latch.await(); assertEquals(0, updateNodesInvoked.size()); @@ -414,13 +408,10 @@ public Transport.Connection getConnection(String clusterAlias, DiscoveryNode nod request.setIndices(new String[] { "index" }); PitService pitService = new PitService(clusterServiceMock, searchTransportService); CreatePitController controller = new CreatePitController( - request, searchTransportService, clusterServiceMock, transportSearchAction, namedWriteableRegistry, - task, - createPitListener, pitService ); @@ -439,7 +430,7 @@ public void onFailure(Exception e) { }, latch); StepListener createListener = new StepListener<>(); - controller.executeCreatePit(createListener, updatelistener); + controller.executeCreatePit(request, task, createListener, updatelistener); createListener.onResponse(searchResponse); latch.await(); assertEquals(3, updateNodesInvoked.size()); @@ -505,13 +496,10 @@ public Transport.Connection getConnection(String clusterAlias, DiscoveryNode nod request.setIndices(new String[] { "index" }); PitService pitService = new PitService(clusterServiceMock, searchTransportService); CreatePitController controller = new CreatePitController( - request, searchTransportService, clusterServiceMock, transportSearchAction, namedWriteableRegistry, - task, - createPitListener, pitService ); @@ -530,7 +518,7 @@ public void onFailure(Exception e) { }, latch); StepListener createListener = new StepListener<>(); - controller.executeCreatePit(createListener, updatelistener); + controller.executeCreatePit(request, task, createListener, updatelistener); createListener.onResponse(searchResponse); latch.await(); assertEquals(3, updateNodesInvoked.size()); diff --git a/server/src/test/java/org/opensearch/index/store/RemoteDirectoryTests.java b/server/src/test/java/org/opensearch/index/store/RemoteDirectoryTests.java index 76d4d50022042..2ded77d2cecfd 100644 --- a/server/src/test/java/org/opensearch/index/store/RemoteDirectoryTests.java +++ b/server/src/test/java/org/opensearch/index/store/RemoteDirectoryTests.java @@ -26,7 +26,10 @@ import java.util.stream.Collectors; import java.util.stream.Stream; -import static org.mockito.Mockito.*; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.doThrow; public class RemoteDirectoryTests extends OpenSearchTestCase { private BlobContainer blobContainer; diff --git a/server/src/test/java/org/opensearch/index/store/RemoteIndexInputTests.java b/server/src/test/java/org/opensearch/index/store/RemoteIndexInputTests.java index e7fe2f9798453..273d3c7e37c56 100644 --- a/server/src/test/java/org/opensearch/index/store/RemoteIndexInputTests.java +++ b/server/src/test/java/org/opensearch/index/store/RemoteIndexInputTests.java @@ -14,7 +14,14 @@ import java.io.IOException; import java.io.InputStream; -import static org.mockito.Mockito.*; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.when; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.any; +import static org.mockito.Mockito.anyInt; +import static org.mockito.Mockito.eq; +import static org.mockito.Mockito.doThrow; public class RemoteIndexInputTests extends OpenSearchTestCase { diff --git a/server/src/test/java/org/opensearch/index/store/RemoteIndexOutputTests.java b/server/src/test/java/org/opensearch/index/store/RemoteIndexOutputTests.java index 64975f2ac4892..e7eb3231bf87d 100644 --- a/server/src/test/java/org/opensearch/index/store/RemoteIndexOutputTests.java +++ b/server/src/test/java/org/opensearch/index/store/RemoteIndexOutputTests.java @@ -18,7 +18,9 @@ import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.*; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.doThrow; public class RemoteIndexOutputTests extends OpenSearchTestCase { private static final String FILENAME = "segment_1"; diff --git a/server/src/test/java/org/opensearch/index/translog/listener/TranslogListenerTests.java b/server/src/test/java/org/opensearch/index/translog/listener/TranslogListenerTests.java index 062801fc43d2f..1f28e32a6dbec 100644 --- a/server/src/test/java/org/opensearch/index/translog/listener/TranslogListenerTests.java +++ b/server/src/test/java/org/opensearch/index/translog/listener/TranslogListenerTests.java @@ -13,7 +13,11 @@ import org.opensearch.test.OpenSearchTestCase; import java.lang.reflect.Proxy; -import java.util.*; +import java.util.List; +import java.util.Collections; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.LinkedList; import java.util.concurrent.atomic.AtomicInteger; public class TranslogListenerTests extends OpenSearchTestCase { diff --git a/server/src/test/java/org/opensearch/indices/ShardLimitValidatorTests.java b/server/src/test/java/org/opensearch/indices/ShardLimitValidatorTests.java index a61ca13df0215..60c467e3864e9 100644 --- a/server/src/test/java/org/opensearch/indices/ShardLimitValidatorTests.java +++ b/server/src/test/java/org/opensearch/indices/ShardLimitValidatorTests.java @@ -53,7 +53,9 @@ import java.util.stream.Collectors; import static java.util.Collections.emptyMap; -import static org.opensearch.cluster.metadata.IndexMetadata.*; +import static org.opensearch.cluster.metadata.IndexMetadata.SETTING_VERSION_CREATED; +import static org.opensearch.cluster.metadata.IndexMetadata.SETTING_NUMBER_OF_SHARDS; +import static org.opensearch.cluster.metadata.IndexMetadata.SETTING_NUMBER_OF_REPLICAS; import static org.opensearch.cluster.metadata.MetadataIndexStateServiceTests.addClosedIndex; import static org.opensearch.cluster.metadata.MetadataIndexStateServiceTests.addOpenedIndex; import static org.opensearch.cluster.shards.ShardCounts.forDataNodeCount; diff --git a/server/src/test/java/org/opensearch/indices/replication/SegmentFileTransferHandlerTests.java b/server/src/test/java/org/opensearch/indices/replication/SegmentFileTransferHandlerTests.java index 5fd8bc1e74625..e13b4ed31fc39 100644 --- a/server/src/test/java/org/opensearch/indices/replication/SegmentFileTransferHandlerTests.java +++ b/server/src/test/java/org/opensearch/indices/replication/SegmentFileTransferHandlerTests.java @@ -31,7 +31,17 @@ import static java.util.Collections.emptyMap; import static java.util.Collections.emptySet; -import static org.mockito.Mockito.*; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.any; +import static org.mockito.Mockito.anyBoolean; +import static org.mockito.Mockito.anyLong; +import static org.mockito.Mockito.anyString; +import static org.mockito.Mockito.anyInt; +import static org.mockito.Mockito.verifyNoInteractions; +import static org.mockito.Mockito.doNothing; public class SegmentFileTransferHandlerTests extends IndexShardTestCase { diff --git a/server/src/test/java/org/opensearch/indices/replication/SegmentReplicationSourceServiceTests.java b/server/src/test/java/org/opensearch/indices/replication/SegmentReplicationSourceServiceTests.java index 8d2ca9ff63f3d..4bfdd81d50a1e 100644 --- a/server/src/test/java/org/opensearch/indices/replication/SegmentReplicationSourceServiceTests.java +++ b/server/src/test/java/org/opensearch/indices/replication/SegmentReplicationSourceServiceTests.java @@ -33,7 +33,8 @@ import java.util.Collections; import java.util.concurrent.TimeUnit; -import static org.mockito.Mockito.*; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; public class SegmentReplicationSourceServiceTests extends OpenSearchTestCase { diff --git a/server/src/test/java/org/opensearch/indices/replication/SegmentReplicationTargetServiceTests.java b/server/src/test/java/org/opensearch/indices/replication/SegmentReplicationTargetServiceTests.java index 33734fe85def5..ef67bd665dedf 100644 --- a/server/src/test/java/org/opensearch/indices/replication/SegmentReplicationTargetServiceTests.java +++ b/server/src/test/java/org/opensearch/indices/replication/SegmentReplicationTargetServiceTests.java @@ -25,7 +25,13 @@ import java.io.IOException; import static org.mockito.ArgumentMatchers.any; -import static org.mockito.Mockito.*; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; +import static org.mockito.Mockito.doAnswer; +import static org.mockito.Mockito.doNothing; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.spy; public class SegmentReplicationTargetServiceTests extends IndexShardTestCase { diff --git a/server/src/test/java/org/opensearch/indices/replication/checkpoint/PublishCheckpointActionTests.java b/server/src/test/java/org/opensearch/indices/replication/checkpoint/PublishCheckpointActionTests.java index 77cc1d744f0dc..23fad53dd1201 100644 --- a/server/src/test/java/org/opensearch/indices/replication/checkpoint/PublishCheckpointActionTests.java +++ b/server/src/test/java/org/opensearch/indices/replication/checkpoint/PublishCheckpointActionTests.java @@ -33,7 +33,10 @@ import java.util.concurrent.atomic.AtomicBoolean; import static org.hamcrest.Matchers.sameInstance; -import static org.mockito.Mockito.*; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.times; import static org.opensearch.test.ClusterServiceUtils.createClusterService; public class PublishCheckpointActionTests extends OpenSearchTestCase { diff --git a/server/src/test/java/org/opensearch/search/CreatePitMultiNodeTests.java b/server/src/test/java/org/opensearch/search/CreatePitMultiNodeTests.java index 29c66a9b0f51c..7eb7a62348c5f 100644 --- a/server/src/test/java/org/opensearch/search/CreatePitMultiNodeTests.java +++ b/server/src/test/java/org/opensearch/search/CreatePitMultiNodeTests.java @@ -141,7 +141,7 @@ public void testPitInvalidDefaultKeepAlive() { () -> client().admin() .cluster() .prepareUpdateSettings() - .setPersistentSettings(Settings.builder().put("pit.max_keep_alive", "1m").put("search.default_keep_alive", "2m")) + .setPersistentSettings(Settings.builder().put("point_in_time.max_keep_alive", "1m").put("search.default_keep_alive", "2m")) .get() ); assertThat(exc.getMessage(), containsString("was (2m > 1m)")); @@ -149,7 +149,7 @@ public void testPitInvalidDefaultKeepAlive() { client().admin() .cluster() .prepareUpdateSettings() - .setPersistentSettings(Settings.builder().put("search.default_keep_alive", "5m").put("pit.max_keep_alive", "5m")) + .setPersistentSettings(Settings.builder().put("search.default_keep_alive", "5m").put("point_in_time.max_keep_alive", "5m")) .get() ); assertAcked( @@ -163,7 +163,7 @@ public void testPitInvalidDefaultKeepAlive() { client().admin() .cluster() .prepareUpdateSettings() - .setPersistentSettings(Settings.builder().put("pit.max_keep_alive", "2m")) + .setPersistentSettings(Settings.builder().put("point_in_time.max_keep_alive", "2m")) .get() ); exc = expectThrows( @@ -187,7 +187,7 @@ public void testPitInvalidDefaultKeepAlive() { () -> client().admin() .cluster() .prepareUpdateSettings() - .setPersistentSettings(Settings.builder().put("pit.max_keep_alive", "30s")) + .setPersistentSettings(Settings.builder().put("point_in_time.max_keep_alive", "30s")) .get() ); assertThat(exc.getMessage(), containsString("was (1m > 30s)")); diff --git a/server/src/test/java/org/opensearch/search/SearchServiceTests.java b/server/src/test/java/org/opensearch/search/SearchServiceTests.java index ecc28470b0eb2..423921643449b 100644 --- a/server/src/test/java/org/opensearch/search/SearchServiceTests.java +++ b/server/src/test/java/org/opensearch/search/SearchServiceTests.java @@ -40,17 +40,7 @@ import org.opensearch.action.ActionListener; import org.opensearch.action.OriginalIndices; import org.opensearch.action.index.IndexResponse; -import org.opensearch.action.search.ClearScrollRequest; -import org.opensearch.action.search.DeletePitResponse; -import org.opensearch.action.search.PitSearchContextIdForNode; -import org.opensearch.action.search.SearchContextIdForNode; -import org.opensearch.action.search.SearchPhaseExecutionException; -import org.opensearch.action.search.SearchRequest; -import org.opensearch.action.search.SearchResponse; -import org.opensearch.action.search.SearchShardTask; -import org.opensearch.action.search.SearchType; -import org.opensearch.action.search.UpdatePitContextRequest; -import org.opensearch.action.search.UpdatePitContextResponse; +import org.opensearch.action.search.*; import org.opensearch.action.support.IndicesOptions; import org.opensearch.action.support.PlainActionFuture; import org.opensearch.action.support.WriteRequest; diff --git a/settings.gradle b/settings.gradle index 14b591ea622f3..65dc6a13100e2 100644 --- a/settings.gradle +++ b/settings.gradle @@ -10,7 +10,7 @@ */ plugins { - id "com.gradle.enterprise" version "3.10.2" + id "com.gradle.enterprise" version "3.10.3" } buildCache {