diff --git a/build.gradle b/build.gradle index f293bb00b..3ec0d4bc7 100644 --- a/build.gradle +++ b/build.gradle @@ -14,22 +14,29 @@ */ import java.util.concurrent.Callable -import org.elasticsearch.gradle.test.RestIntegTestTask +import org.opensearch.gradle.test.RestIntegTestTask buildscript { ext { - es_group = "org.elasticsearch" - es_version = '7.10.2' + opensearch_group = "org.opensearch" + opensearch_version = '7.10.3' } repositories { mavenCentral() maven { url "https://plugins.gradle.org/m2/" } + maven { + url = 's3://search-vemsarat/' + credentials(AwsCredentials) { + accessKey = System.env.AWS_ACCESS_KEY_ID ?: findProperty('aws_access_key_id') + secretKey = System.env.AWS_SECRET_ACCESS_KEY_ID ?: findProperty('aws_secret_access_key') + } + } jcenter() } dependencies { - classpath "${es_group}.gradle:build-tools:${es_version}" + classpath "${opensearch_group}.gradle:build-tools:${opensearch_version}-SNAPSHOT" } } @@ -43,11 +50,18 @@ plugins { repositories { mavenCentral() maven { url "https://plugins.gradle.org/m2/" } + maven { + url = 's3://search-vemsarat/' + credentials(AwsCredentials) { + accessKey = System.env.AWS_ACCESS_KEY_ID ?: findProperty('aws_access_key_id') + secretKey = System.env.AWS_SECRET_ACCESS_KEY_ID ?: findProperty('aws_secret_access_key') + } + } jcenter() } ext { - opendistroVersion = '1.13.0' + opendistroVersion = '1.15.0' isSnapshot = "true" == System.getProperty("build.snapshot", "true") } @@ -55,8 +69,8 @@ version = "${opendistroVersion}.0" apply plugin: 'java' apply plugin: 'idea' -apply plugin: 'elasticsearch.esplugin' -apply plugin: 'elasticsearch.testclusters' +apply plugin: 'opensearch.opensearchplugin' +apply plugin: 'opensearch.testclusters' apply plugin: 'base' apply plugin: 'jacoco' apply plugin: 'eclipse' @@ -75,7 +89,7 @@ ext { noticeFile = rootProject.file('NOTICE.txt') } -esplugin { +opensearchplugin { name 'opendistro-anomaly-detection' description 'Amazon opendistro elasticsearch anomaly detector plugin' classname 'com.amazon.opendistroforelasticsearch.ad.AnomalyDetectorPlugin' @@ -133,8 +147,8 @@ loggerUsageCheck.enabled = false // See package README.md for details on using these tasks. def _numNodes = findProperty('numNodes') as Integer ?: 1 -def es_tmp_dir = rootProject.file('build/private/es_tmp').absoluteFile -es_tmp_dir.mkdirs() +def opensearch_tmp_dir = rootProject.file('build/private/opensearch_tmp').absoluteFile +opensearch_tmp_dir.mkdirs() test { include '**/*Tests.class' @@ -151,7 +165,7 @@ tasks.named("check").configure { dependsOn(integTest) } integTest { dependsOn "bundlePlugin" systemProperty 'tests.security.manager', 'false' - systemProperty 'java.io.tmpdir', es_tmp_dir.absolutePath + systemProperty 'java.io.tmpdir', opensearch_tmp_dir.absolutePath systemProperty "https", System.getProperty("https") systemProperty "user", System.getProperty("user") @@ -200,7 +214,7 @@ testClusters.integTest { // When running integration tests it doesn't forward the --debug-jvm to the cluster anymore // i.e. we have to use a custom property to flag when we want to debug elasticsearch JVM // since we also support multi node integration tests we increase debugPort per node - if (System.getProperty("es.debug") != null) { + if (System.getProperty("opensearch.debug") != null) { def debugPort = 5005 nodes.forEach { node -> node.jvmArgs("-agentlib:jdwp=transport=dt_socket,server=n,suspend=y,address=*:${debugPort}") @@ -225,7 +239,7 @@ testClusters.integTest { // the opendistro-job-scheduler plugin, which is causing build failures. From the stack trace, this looks like a bug. // // Exception in thread "main" java.lang.IllegalArgumentException: Missing plugin [opendistro-job-scheduler], dependency of [opendistro-anomaly-detection] - // at org.elasticsearch.plugins.PluginsService.addSortedBundle(PluginsService.java:452) + // at org.opensearch.plugins.PluginsService.addSortedBundle(PluginsService.java:452) // // One explanation is that ES build script sort plugins according to the natural ordering of their names. // opendistro-anomaly-detection comes before opendistro-job-scheduler. @@ -265,8 +279,8 @@ task release(type: Copy, group: 'build') { from(zipTree(project.tasks.bundlePlugin.outputs.files.getSingleFile())) into "build/plugins/opendistro-anomaly-detection" includeEmptyDirs = false - // ES versions < 6.3 have a top-level elasticsearch directory inside the plugin zip which we need to remove - eachFile { it.path = it.path - "elasticsearch/" } + // ES versions < 6.3 have a top-level opensearch directory inside the plugin zip which we need to remove + eachFile { it.path = it.path - "opensearch/" } } List jacocoExclusions = [ @@ -351,9 +365,9 @@ checkstyle { } dependencies { - compile "org.elasticsearch:elasticsearch:${es_version}" - compileOnly "org.elasticsearch.plugin:elasticsearch-scripting-painless-spi:${versions.elasticsearch}" - compileOnly "com.amazon.opendistroforelasticsearch:opendistro-job-scheduler-spi:${opendistroVersion}.0" + compile "org.opensearch:opensearch:${opensearch_version}-SNAPSHOT" + compileOnly "org.opensearch.plugin:opensearch-scripting-painless-spi:${versions.opensearch}" + compileOnly "com.amazon.opendistroforelasticsearch:opendistro-job-scheduler-spi:${opendistroVersion}.0-SNAPSHOT" compile "com.amazon.opendistroforelasticsearch:common-utils:${opendistroVersion}.0" compile group: 'com.google.guava', name: 'guava', version:'29.0-jre' compile group: 'org.apache.commons', name: 'commons-math3', version: '3.6.1' @@ -363,7 +377,7 @@ dependencies { compile group: 'commons-lang', name: 'commons-lang', version: '2.6' compile 'software.amazon.randomcutforest:randomcutforest-core:1.0' compile 'software.amazon.randomcutforest:randomcutforest-serialization-json:1.0' - compile "org.elasticsearch.client:elasticsearch-rest-client:${es_version}" + compile "org.opensearch.client:opensearch-rest-client:${opensearch_version}-SNAPSHOT" compile "org.jacoco:org.jacoco.agent:0.8.5" compile ("org.jacoco:org.jacoco.ant:0.8.5") { @@ -399,9 +413,9 @@ afterEvaluate { release = isSnapshot ? "0.1" : '1' version = "${project.version}" - "-SNAPSHOT" - into '/usr/share/elasticsearch/plugins' + into '/usr/share/opensearch/plugins' from(zipTree(bundlePlugin.archivePath)) { - into esplugin.name + into opensearchplugin.name } user 'root' @@ -409,7 +423,7 @@ afterEvaluate { fileMode 0644 dirMode 0755 - requires('elasticsearch-oss', versions.elasticsearch, EQUAL) + requires('opensearch-oss', versions.opensearch, EQUAL) packager = 'Amazon' vendor = 'Amazon' os = 'LINUX' diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/AnomalyDetectorJobRunner.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/AnomalyDetectorJobRunner.java index 859596031..1e15e708f 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/AnomalyDetectorJobRunner.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/AnomalyDetectorJobRunner.java @@ -17,9 +17,9 @@ import static com.amazon.opendistroforelasticsearch.ad.AnomalyDetectorPlugin.AD_THREAD_POOL_NAME; import static com.amazon.opendistroforelasticsearch.ad.util.RestHandlerUtils.XCONTENT_WITH_TYPE; -import static org.elasticsearch.action.DocWriteResponse.Result.CREATED; -import static org.elasticsearch.action.DocWriteResponse.Result.UPDATED; -import static org.elasticsearch.common.xcontent.XContentParserUtils.ensureExpectedToken; +import static org.opensearch.action.DocWriteResponse.Result.CREATED; +import static org.opensearch.action.DocWriteResponse.Result.UPDATED; +import static org.opensearch.common.xcontent.XContentParserUtils.ensureExpectedToken; import java.io.IOException; import java.time.Instant; @@ -30,20 +30,20 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import org.elasticsearch.action.ActionListener; -import org.elasticsearch.action.get.GetRequest; -import org.elasticsearch.action.get.GetResponse; -import org.elasticsearch.action.index.IndexRequest; -import org.elasticsearch.action.index.IndexResponse; -import org.elasticsearch.action.support.WriteRequest; -import org.elasticsearch.client.Client; -import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.common.xcontent.LoggingDeprecationHandler; -import org.elasticsearch.common.xcontent.NamedXContentRegistry; -import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentParser; -import org.elasticsearch.common.xcontent.XContentType; -import org.elasticsearch.threadpool.ThreadPool; +import org.opensearch.action.ActionListener; +import org.opensearch.action.get.GetRequest; +import org.opensearch.action.get.GetResponse; +import org.opensearch.action.index.IndexRequest; +import org.opensearch.action.index.IndexResponse; +import org.opensearch.action.support.WriteRequest; +import org.opensearch.client.Client; +import org.opensearch.common.settings.Settings; +import org.opensearch.common.xcontent.LoggingDeprecationHandler; +import org.opensearch.common.xcontent.NamedXContentRegistry; +import org.opensearch.common.xcontent.XContentBuilder; +import org.opensearch.common.xcontent.XContentParser; +import org.opensearch.common.xcontent.XContentType; +import org.opensearch.threadpool.ThreadPool; import com.amazon.opendistroforelasticsearch.ad.common.exception.AnomalyDetectionException; import com.amazon.opendistroforelasticsearch.ad.common.exception.EndRunException; diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/AnomalyDetectorPlugin.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/AnomalyDetectorPlugin.java index e0563e1fa..6d7b6cd17 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/AnomalyDetectorPlugin.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/AnomalyDetectorPlugin.java @@ -30,38 +30,38 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import org.elasticsearch.SpecialPermission; -import org.elasticsearch.action.ActionRequest; -import org.elasticsearch.action.ActionResponse; -import org.elasticsearch.client.Client; -import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver; -import org.elasticsearch.cluster.node.DiscoveryNodes; -import org.elasticsearch.cluster.service.ClusterService; -import org.elasticsearch.common.io.stream.NamedWriteableRegistry; -import org.elasticsearch.common.settings.ClusterSettings; -import org.elasticsearch.common.settings.IndexScopedSettings; -import org.elasticsearch.common.settings.Setting; -import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.common.settings.SettingsFilter; -import org.elasticsearch.common.unit.TimeValue; -import org.elasticsearch.common.util.concurrent.EsExecutors; -import org.elasticsearch.common.xcontent.NamedXContentRegistry; -import org.elasticsearch.common.xcontent.XContentParser; -import org.elasticsearch.common.xcontent.XContentParserUtils; -import org.elasticsearch.env.Environment; -import org.elasticsearch.env.NodeEnvironment; -import org.elasticsearch.monitor.jvm.JvmService; -import org.elasticsearch.plugins.ActionPlugin; -import org.elasticsearch.plugins.Plugin; -import org.elasticsearch.plugins.ScriptPlugin; -import org.elasticsearch.repositories.RepositoriesService; -import org.elasticsearch.rest.RestController; -import org.elasticsearch.rest.RestHandler; -import org.elasticsearch.script.ScriptService; -import org.elasticsearch.threadpool.ExecutorBuilder; -import org.elasticsearch.threadpool.ScalingExecutorBuilder; -import org.elasticsearch.threadpool.ThreadPool; -import org.elasticsearch.watcher.ResourceWatcherService; +import org.opensearch.SpecialPermission; +import org.opensearch.action.ActionRequest; +import org.opensearch.action.ActionResponse; +import org.opensearch.client.Client; +import org.opensearch.cluster.metadata.IndexNameExpressionResolver; +import org.opensearch.cluster.node.DiscoveryNodes; +import org.opensearch.cluster.service.ClusterService; +import org.opensearch.common.io.stream.NamedWriteableRegistry; +import org.opensearch.common.settings.ClusterSettings; +import org.opensearch.common.settings.IndexScopedSettings; +import org.opensearch.common.settings.Setting; +import org.opensearch.common.settings.Settings; +import org.opensearch.common.settings.SettingsFilter; +import org.opensearch.common.unit.TimeValue; +import org.opensearch.common.util.concurrent.OpenSearchExecutors; +import org.opensearch.common.xcontent.NamedXContentRegistry; +import org.opensearch.common.xcontent.XContentParser; +import org.opensearch.common.xcontent.XContentParserUtils; +import org.opensearch.env.Environment; +import org.opensearch.env.NodeEnvironment; +import org.opensearch.monitor.jvm.JvmService; +import org.opensearch.plugins.ActionPlugin; +import org.opensearch.plugins.Plugin; +import org.opensearch.plugins.ScriptPlugin; +import org.opensearch.repositories.RepositoriesService; +import org.opensearch.rest.RestController; +import org.opensearch.rest.RestHandler; +import org.opensearch.script.ScriptService; +import org.opensearch.threadpool.ExecutorBuilder; +import org.opensearch.threadpool.ScalingExecutorBuilder; +import org.opensearch.threadpool.ThreadPool; +import org.opensearch.watcher.ResourceWatcherService; import com.amazon.opendistroforelasticsearch.ad.breaker.ADCircuitBreakerService; import com.amazon.opendistroforelasticsearch.ad.caching.CacheProvider; @@ -604,14 +604,14 @@ public List> getExecutorBuilders(Settings settings) { new ScalingExecutorBuilder( AD_THREAD_POOL_NAME, 1, - Math.max(1, EsExecutors.allocatedProcessors(settings) / 4), + Math.max(1, OpenSearchExecutors.allocatedProcessors(settings) / 4), TimeValue.timeValueMinutes(10), AD_THREAD_POOL_PREFIX + AD_THREAD_POOL_NAME ), new ScalingExecutorBuilder( AD_BATCH_TASK_THREAD_POOL_NAME, 1, - Math.max(1, EsExecutors.allocatedProcessors(settings) / 8), + Math.max(1, OpenSearchExecutors.allocatedProcessors(settings) / 8), TimeValue.timeValueMinutes(10), AD_THREAD_POOL_PREFIX + AD_BATCH_TASK_THREAD_POOL_NAME ) diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/AnomalyDetectorProfileRunner.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/AnomalyDetectorProfileRunner.java index 1ae4ba977..7b1927955 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/AnomalyDetectorProfileRunner.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/AnomalyDetectorProfileRunner.java @@ -17,7 +17,7 @@ import static com.amazon.opendistroforelasticsearch.ad.model.AnomalyDetector.ANOMALY_DETECTORS_INDEX; import static com.amazon.opendistroforelasticsearch.ad.model.AnomalyDetectorJob.ANOMALY_DETECTOR_JOB_INDEX; -import static org.elasticsearch.common.xcontent.XContentParserUtils.ensureExpectedToken; +import static org.opensearch.common.xcontent.XContentParserUtils.ensureExpectedToken; import java.io.IOException; import java.security.InvalidParameterException; @@ -29,27 +29,27 @@ import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.core.util.Throwables; import org.apache.logging.log4j.message.ParameterizedMessage; -import org.elasticsearch.action.ActionListener; -import org.elasticsearch.action.get.GetRequest; -import org.elasticsearch.action.get.GetResponse; -import org.elasticsearch.action.search.SearchRequest; -import org.elasticsearch.action.search.SearchResponse; -import org.elasticsearch.client.Client; -import org.elasticsearch.cluster.node.DiscoveryNode; -import org.elasticsearch.common.xcontent.LoggingDeprecationHandler; -import org.elasticsearch.common.xcontent.NamedXContentRegistry; -import org.elasticsearch.common.xcontent.XContentParseException; -import org.elasticsearch.common.xcontent.XContentParser; -import org.elasticsearch.common.xcontent.XContentType; -import org.elasticsearch.index.IndexNotFoundException; -import org.elasticsearch.index.query.BoolQueryBuilder; -import org.elasticsearch.index.query.QueryBuilders; -import org.elasticsearch.search.SearchHits; -import org.elasticsearch.search.aggregations.Aggregation; -import org.elasticsearch.search.aggregations.metrics.CardinalityAggregationBuilder; -import org.elasticsearch.search.aggregations.metrics.InternalCardinality; -import org.elasticsearch.search.builder.SearchSourceBuilder; -import org.elasticsearch.transport.TransportService; +import org.opensearch.action.ActionListener; +import org.opensearch.action.get.GetRequest; +import org.opensearch.action.get.GetResponse; +import org.opensearch.action.search.SearchRequest; +import org.opensearch.action.search.SearchResponse; +import org.opensearch.client.Client; +import org.opensearch.cluster.node.DiscoveryNode; +import org.opensearch.common.xcontent.LoggingDeprecationHandler; +import org.opensearch.common.xcontent.NamedXContentRegistry; +import org.opensearch.common.xcontent.XContentParseException; +import org.opensearch.common.xcontent.XContentParser; +import org.opensearch.common.xcontent.XContentType; +import org.opensearch.index.IndexNotFoundException; +import org.opensearch.index.query.BoolQueryBuilder; +import org.opensearch.index.query.QueryBuilders; +import org.opensearch.search.SearchHits; +import org.opensearch.search.aggregations.Aggregation; +import org.opensearch.search.aggregations.metrics.CardinalityAggregationBuilder; +import org.opensearch.search.aggregations.metrics.InternalCardinality; +import org.opensearch.search.builder.SearchSourceBuilder; +import org.opensearch.transport.TransportService; import com.amazon.opendistroforelasticsearch.ad.common.exception.ResourceNotFoundException; import com.amazon.opendistroforelasticsearch.ad.constant.CommonErrorMessages; diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/AnomalyDetectorRunner.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/AnomalyDetectorRunner.java index 4d4029351..62f7e4fb1 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/AnomalyDetectorRunner.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/AnomalyDetectorRunner.java @@ -27,7 +27,7 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import org.elasticsearch.action.ActionListener; +import org.opensearch.action.ActionListener; import com.amazon.opendistroforelasticsearch.ad.constant.CommonValue; import com.amazon.opendistroforelasticsearch.ad.feature.FeatureManager; diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/EntityProfileRunner.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/EntityProfileRunner.java index fb51ad471..dbf7c4cf2 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/EntityProfileRunner.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/EntityProfileRunner.java @@ -18,7 +18,7 @@ import static com.amazon.opendistroforelasticsearch.ad.model.AnomalyDetector.ANOMALY_DETECTORS_INDEX; import static com.amazon.opendistroforelasticsearch.ad.model.AnomalyDetectorJob.ANOMALY_DETECTOR_JOB_INDEX; import static com.amazon.opendistroforelasticsearch.ad.settings.AnomalyDetectorSettings.CATEGORY_FIELD_LIMIT; -import static org.elasticsearch.common.xcontent.XContentParserUtils.ensureExpectedToken; +import static org.opensearch.common.xcontent.XContentParserUtils.ensureExpectedToken; import java.security.InvalidParameterException; import java.util.List; @@ -28,21 +28,21 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.apache.lucene.search.join.ScoreMode; -import org.elasticsearch.action.ActionListener; -import org.elasticsearch.action.get.GetRequest; -import org.elasticsearch.action.search.SearchRequest; -import org.elasticsearch.client.Client; -import org.elasticsearch.common.xcontent.LoggingDeprecationHandler; -import org.elasticsearch.common.xcontent.NamedXContentRegistry; -import org.elasticsearch.common.xcontent.XContentParser; -import org.elasticsearch.common.xcontent.XContentType; -import org.elasticsearch.index.IndexNotFoundException; -import org.elasticsearch.index.query.BoolQueryBuilder; -import org.elasticsearch.index.query.NestedQueryBuilder; -import org.elasticsearch.index.query.QueryBuilders; -import org.elasticsearch.index.query.TermQueryBuilder; -import org.elasticsearch.search.aggregations.AggregationBuilders; -import org.elasticsearch.search.builder.SearchSourceBuilder; +import org.opensearch.action.ActionListener; +import org.opensearch.action.get.GetRequest; +import org.opensearch.action.search.SearchRequest; +import org.opensearch.client.Client; +import org.opensearch.common.xcontent.LoggingDeprecationHandler; +import org.opensearch.common.xcontent.NamedXContentRegistry; +import org.opensearch.common.xcontent.XContentParser; +import org.opensearch.common.xcontent.XContentType; +import org.opensearch.index.IndexNotFoundException; +import org.opensearch.index.query.BoolQueryBuilder; +import org.opensearch.index.query.NestedQueryBuilder; +import org.opensearch.index.query.QueryBuilders; +import org.opensearch.index.query.TermQueryBuilder; +import org.opensearch.search.aggregations.AggregationBuilders; +import org.opensearch.search.builder.SearchSourceBuilder; import com.amazon.opendistroforelasticsearch.ad.constant.CommonErrorMessages; import com.amazon.opendistroforelasticsearch.ad.constant.CommonName; diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/MemoryTracker.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/MemoryTracker.java index 275d591be..5932189aa 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/MemoryTracker.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/MemoryTracker.java @@ -23,8 +23,8 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import org.elasticsearch.cluster.service.ClusterService; -import org.elasticsearch.monitor.jvm.JvmService; +import org.opensearch.cluster.service.ClusterService; +import org.opensearch.monitor.jvm.JvmService; import com.amazon.opendistroforelasticsearch.ad.common.exception.LimitExceededException; import com.amazon.opendistroforelasticsearch.ad.model.AnomalyDetector; diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/NodeStateManager.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/NodeStateManager.java index 6f870d5e8..4f4b1dc0f 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/NodeStateManager.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/NodeStateManager.java @@ -15,7 +15,7 @@ package com.amazon.opendistroforelasticsearch.ad; -import static org.elasticsearch.common.xcontent.XContentParserUtils.ensureExpectedToken; +import static org.opensearch.common.xcontent.XContentParserUtils.ensureExpectedToken; import java.time.Clock; import java.time.Duration; @@ -26,16 +26,16 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import org.elasticsearch.action.ActionListener; -import org.elasticsearch.action.get.GetRequest; -import org.elasticsearch.action.get.GetResponse; -import org.elasticsearch.client.Client; -import org.elasticsearch.common.lease.Releasable; -import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.common.xcontent.LoggingDeprecationHandler; -import org.elasticsearch.common.xcontent.NamedXContentRegistry; -import org.elasticsearch.common.xcontent.XContentParser; -import org.elasticsearch.common.xcontent.XContentType; +import org.opensearch.action.ActionListener; +import org.opensearch.action.get.GetRequest; +import org.opensearch.action.get.GetResponse; +import org.opensearch.client.Client; +import org.opensearch.common.lease.Releasable; +import org.opensearch.common.settings.Settings; +import org.opensearch.common.xcontent.LoggingDeprecationHandler; +import org.opensearch.common.xcontent.NamedXContentRegistry; +import org.opensearch.common.xcontent.XContentParser; +import org.opensearch.common.xcontent.XContentType; import com.amazon.opendistroforelasticsearch.ad.common.exception.AnomalyDetectionException; import com.amazon.opendistroforelasticsearch.ad.common.exception.EndRunException; diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/breaker/ADCircuitBreakerService.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/breaker/ADCircuitBreakerService.java index 89bdb22cb..3405f7255 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/breaker/ADCircuitBreakerService.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/breaker/ADCircuitBreakerService.java @@ -20,7 +20,7 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import org.elasticsearch.monitor.jvm.JvmService; +import org.opensearch.monitor.jvm.JvmService; import com.amazon.opendistroforelasticsearch.ad.settings.EnabledSetting; diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/breaker/MemoryCircuitBreaker.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/breaker/MemoryCircuitBreaker.java index 1ebec5934..6efdde183 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/breaker/MemoryCircuitBreaker.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/breaker/MemoryCircuitBreaker.java @@ -15,7 +15,7 @@ package com.amazon.opendistroforelasticsearch.ad.breaker; -import org.elasticsearch.monitor.jvm.JvmService; +import org.opensearch.monitor.jvm.JvmService; /** * A circuit breaker for memory usage. diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/caching/CacheProvider.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/caching/CacheProvider.java index be0f181a6..c7239b611 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/caching/CacheProvider.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/caching/CacheProvider.java @@ -15,7 +15,7 @@ package com.amazon.opendistroforelasticsearch.ad.caching; -import org.elasticsearch.common.inject.Provider; +import org.opensearch.common.inject.Provider; /** * A wrapper to call concrete implementation of caching. Used in transport diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/caching/PriorityCache.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/caching/PriorityCache.java index 368352df8..5b4bdd0ba 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/caching/PriorityCache.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/caching/PriorityCache.java @@ -40,14 +40,14 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.core.util.Throwables; -import org.elasticsearch.ElasticsearchException; -import org.elasticsearch.action.ActionListener; -import org.elasticsearch.action.support.TransportActions; -import org.elasticsearch.cluster.service.ClusterService; -import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.common.unit.TimeValue; -import org.elasticsearch.index.IndexNotFoundException; -import org.elasticsearch.threadpool.ThreadPool; +import org.opensearch.OpenSearchException; +import org.opensearch.action.ActionListener; +import org.opensearch.action.support.TransportActions; +import org.opensearch.cluster.service.ClusterService; +import org.opensearch.common.settings.Settings; +import org.opensearch.common.unit.TimeValue; +import org.opensearch.index.IndexNotFoundException; +import org.opensearch.threadpool.ThreadPool; import com.amazon.opendistroforelasticsearch.ad.AnomalyDetectorPlugin; import com.amazon.opendistroforelasticsearch.ad.MemoryTracker; @@ -299,7 +299,7 @@ private void addSample(ModelState stateToPromote, double[] datapoin private void maybeRestoreOrTrainModel(String modelId, String entityName, ModelState state) { EntityModel entityModel = state.getModel(); - // rate limit in case of EsRejectedExecutionException from get threadpool whose queue capacity is 1k + // rate limit in case of OpenSearchRejectedExecutionException from get threadpool whose queue capacity is 1k if (entityModel != null && (entityModel.getRcf() == null || entityModel.getThreshold() == null) && cooldownStart.plus(Duration.ofMinutes(coolDownMinutes)).isBefore(clock.instant())) { @@ -477,7 +477,7 @@ public void maintenance() { }); } catch (Exception e) { // will be thrown to ES's transport broadcast handler - throw new ElasticsearchException("Fail to maintain cache", e); + throw new OpenSearchException("Fail to maintain cache", e); } } diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/cluster/ADClusterEventListener.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/cluster/ADClusterEventListener.java index 18f063848..bb60da2d0 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/cluster/ADClusterEventListener.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/cluster/ADClusterEventListener.java @@ -21,13 +21,13 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import org.elasticsearch.cluster.ClusterChangedEvent; -import org.elasticsearch.cluster.ClusterStateListener; -import org.elasticsearch.cluster.node.DiscoveryNode; -import org.elasticsearch.cluster.node.DiscoveryNodes.Delta; -import org.elasticsearch.cluster.service.ClusterService; -import org.elasticsearch.common.inject.Inject; -import org.elasticsearch.gateway.GatewayService; +import org.opensearch.cluster.ClusterChangedEvent; +import org.opensearch.cluster.ClusterStateListener; +import org.opensearch.cluster.node.DiscoveryNode; +import org.opensearch.cluster.node.DiscoveryNodes.Delta; +import org.opensearch.cluster.service.ClusterService; +import org.opensearch.common.inject.Inject; +import org.opensearch.gateway.GatewayService; import com.amazon.opendistroforelasticsearch.ad.ml.ModelManager; import com.amazon.opendistroforelasticsearch.ad.util.DiscoveryNodeFilterer; @@ -123,7 +123,7 @@ public void clusterChanged(ClusterChangedEvent event) { } } } catch (Exception ex) { - // One possible exception is ElasticsearchTimeoutException thrown when we fail + // One possible exception is OpenSearchTimeoutException thrown when we fail // to put checkpoint when ModelManager stops model. LOG.error("Cluster state change handler has issue(s)", ex); } finally { diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/cluster/DailyCron.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/cluster/DailyCron.java index 646c6a0fe..b59d70be4 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/cluster/DailyCron.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/cluster/DailyCron.java @@ -20,12 +20,12 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import org.elasticsearch.action.ActionListener; -import org.elasticsearch.action.support.IndicesOptions; -import org.elasticsearch.index.IndexNotFoundException; -import org.elasticsearch.index.query.QueryBuilders; -import org.elasticsearch.index.reindex.DeleteByQueryAction; -import org.elasticsearch.index.reindex.DeleteByQueryRequest; +import org.opensearch.action.ActionListener; +import org.opensearch.action.support.IndicesOptions; +import org.opensearch.index.IndexNotFoundException; +import org.opensearch.index.query.QueryBuilders; +import org.opensearch.index.reindex.DeleteByQueryAction; +import org.opensearch.index.reindex.DeleteByQueryRequest; import com.amazon.opendistroforelasticsearch.ad.constant.CommonName; import com.amazon.opendistroforelasticsearch.ad.ml.CheckpointDao; diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/cluster/HashRing.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/cluster/HashRing.java index 6cccb3b1f..35ba99c2f 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/cluster/HashRing.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/cluster/HashRing.java @@ -26,10 +26,10 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import org.elasticsearch.cluster.node.DiscoveryNode; -import org.elasticsearch.cluster.routing.Murmur3HashFunction; -import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.common.unit.TimeValue; +import org.opensearch.cluster.node.DiscoveryNode; +import org.opensearch.cluster.routing.Murmur3HashFunction; +import org.opensearch.common.settings.Settings; +import org.opensearch.common.unit.TimeValue; import com.amazon.opendistroforelasticsearch.ad.util.DiscoveryNodeFilterer; diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/cluster/HourlyCron.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/cluster/HourlyCron.java index eb958fdf1..db5980722 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/cluster/HourlyCron.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/cluster/HourlyCron.java @@ -17,10 +17,10 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import org.elasticsearch.action.ActionListener; -import org.elasticsearch.action.FailedNodeException; -import org.elasticsearch.client.Client; -import org.elasticsearch.cluster.node.DiscoveryNode; +import org.opensearch.action.ActionListener; +import org.opensearch.action.FailedNodeException; +import org.opensearch.client.Client; +import org.opensearch.cluster.node.DiscoveryNode; import com.amazon.opendistroforelasticsearch.ad.transport.CronAction; import com.amazon.opendistroforelasticsearch.ad.transport.CronRequest; diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/cluster/MasterEventListener.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/cluster/MasterEventListener.java index 0b4a89516..966c6a5d9 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/cluster/MasterEventListener.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/cluster/MasterEventListener.java @@ -17,13 +17,13 @@ import java.time.Clock; -import org.elasticsearch.client.Client; -import org.elasticsearch.cluster.LocalNodeMasterListener; -import org.elasticsearch.cluster.service.ClusterService; -import org.elasticsearch.common.component.LifecycleListener; -import org.elasticsearch.common.unit.TimeValue; -import org.elasticsearch.threadpool.Scheduler.Cancellable; -import org.elasticsearch.threadpool.ThreadPool; +import org.opensearch.client.Client; +import org.opensearch.cluster.LocalNodeMasterListener; +import org.opensearch.cluster.service.ClusterService; +import org.opensearch.common.component.LifecycleListener; +import org.opensearch.common.unit.TimeValue; +import org.opensearch.threadpool.Scheduler.Cancellable; +import org.opensearch.threadpool.ThreadPool; import com.amazon.opendistroforelasticsearch.ad.cluster.diskcleanup.IndexCleanup; import com.amazon.opendistroforelasticsearch.ad.cluster.diskcleanup.ModelCheckpointIndexRetention; diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/cluster/diskcleanup/IndexCleanup.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/cluster/diskcleanup/IndexCleanup.java index 7044f4599..17f024e17 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/cluster/diskcleanup/IndexCleanup.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/cluster/diskcleanup/IndexCleanup.java @@ -20,19 +20,19 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import org.elasticsearch.action.ActionListener; -import org.elasticsearch.action.admin.indices.stats.CommonStats; -import org.elasticsearch.action.admin.indices.stats.IndicesStatsRequest; -import org.elasticsearch.action.admin.indices.stats.IndicesStatsResponse; -import org.elasticsearch.action.admin.indices.stats.ShardStats; -import org.elasticsearch.action.support.IndicesOptions; -import org.elasticsearch.client.Client; -import org.elasticsearch.cluster.service.ClusterService; -import org.elasticsearch.common.util.concurrent.ThreadContext; -import org.elasticsearch.index.query.QueryBuilder; -import org.elasticsearch.index.reindex.DeleteByQueryAction; -import org.elasticsearch.index.reindex.DeleteByQueryRequest; -import org.elasticsearch.index.store.StoreStats; +import org.opensearch.action.ActionListener; +import org.opensearch.action.admin.indices.stats.CommonStats; +import org.opensearch.action.admin.indices.stats.IndicesStatsRequest; +import org.opensearch.action.admin.indices.stats.IndicesStatsResponse; +import org.opensearch.action.admin.indices.stats.ShardStats; +import org.opensearch.action.support.IndicesOptions; +import org.opensearch.client.Client; +import org.opensearch.cluster.service.ClusterService; +import org.opensearch.common.util.concurrent.ThreadContext; +import org.opensearch.index.query.QueryBuilder; +import org.opensearch.index.reindex.DeleteByQueryAction; +import org.opensearch.index.reindex.DeleteByQueryRequest; +import org.opensearch.index.store.StoreStats; import com.amazon.opendistroforelasticsearch.ad.util.ClientUtil; diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/cluster/diskcleanup/ModelCheckpointIndexRetention.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/cluster/diskcleanup/ModelCheckpointIndexRetention.java index 8db2ab824..f708d635a 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/cluster/diskcleanup/ModelCheckpointIndexRetention.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/cluster/diskcleanup/ModelCheckpointIndexRetention.java @@ -20,8 +20,8 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import org.elasticsearch.action.ActionListener; -import org.elasticsearch.index.query.QueryBuilders; +import org.opensearch.action.ActionListener; +import org.opensearch.index.query.QueryBuilders; import com.amazon.opendistroforelasticsearch.ad.constant.CommonName; import com.amazon.opendistroforelasticsearch.ad.ml.CheckpointDao; diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/feature/FeatureManager.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/feature/FeatureManager.java index e92fcbae2..06b3f84e2 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/feature/FeatureManager.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/feature/FeatureManager.java @@ -42,9 +42,9 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import org.elasticsearch.action.ActionListener; -import org.elasticsearch.action.support.ThreadedActionListener; -import org.elasticsearch.threadpool.ThreadPool; +import org.opensearch.action.ActionListener; +import org.opensearch.action.support.ThreadedActionListener; +import org.opensearch.threadpool.ThreadPool; import com.amazon.opendistroforelasticsearch.ad.CleanState; import com.amazon.opendistroforelasticsearch.ad.common.exception.EndRunException; diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/feature/SearchFeatureDao.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/feature/SearchFeatureDao.java index c823da3f1..ad30cfb7e 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/feature/SearchFeatureDao.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/feature/SearchFeatureDao.java @@ -39,35 +39,35 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import org.elasticsearch.action.ActionListener; -import org.elasticsearch.action.search.SearchRequest; -import org.elasticsearch.action.search.SearchResponse; -import org.elasticsearch.action.support.ThreadedActionListener; -import org.elasticsearch.client.Client; -import org.elasticsearch.cluster.service.ClusterService; -import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.common.xcontent.NamedXContentRegistry; -import org.elasticsearch.index.query.BoolQueryBuilder; -import org.elasticsearch.index.query.QueryBuilders; -import org.elasticsearch.index.query.RangeQueryBuilder; -import org.elasticsearch.index.query.TermQueryBuilder; -import org.elasticsearch.search.aggregations.Aggregation; -import org.elasticsearch.search.aggregations.AggregationBuilders; -import org.elasticsearch.search.aggregations.Aggregations; -import org.elasticsearch.search.aggregations.AggregatorFactories; -import org.elasticsearch.search.aggregations.bucket.MultiBucketsAggregation; -import org.elasticsearch.search.aggregations.bucket.composite.InternalComposite; -import org.elasticsearch.search.aggregations.bucket.range.InternalDateRange; -import org.elasticsearch.search.aggregations.bucket.range.InternalDateRange.Bucket; -import org.elasticsearch.search.aggregations.bucket.terms.Terms; -import org.elasticsearch.search.aggregations.bucket.terms.TermsAggregationBuilder; -import org.elasticsearch.search.aggregations.metrics.InternalTDigestPercentiles; -import org.elasticsearch.search.aggregations.metrics.Max; -import org.elasticsearch.search.aggregations.metrics.Min; -import org.elasticsearch.search.aggregations.metrics.NumericMetricsAggregation.SingleValue; -import org.elasticsearch.search.aggregations.metrics.Percentile; -import org.elasticsearch.search.builder.SearchSourceBuilder; -import org.elasticsearch.threadpool.ThreadPool; +import org.opensearch.action.ActionListener; +import org.opensearch.action.search.SearchRequest; +import org.opensearch.action.search.SearchResponse; +import org.opensearch.action.support.ThreadedActionListener; +import org.opensearch.client.Client; +import org.opensearch.cluster.service.ClusterService; +import org.opensearch.common.settings.Settings; +import org.opensearch.common.xcontent.NamedXContentRegistry; +import org.opensearch.index.query.BoolQueryBuilder; +import org.opensearch.index.query.QueryBuilders; +import org.opensearch.index.query.RangeQueryBuilder; +import org.opensearch.index.query.TermQueryBuilder; +import org.opensearch.search.aggregations.Aggregation; +import org.opensearch.search.aggregations.AggregationBuilders; +import org.opensearch.search.aggregations.Aggregations; +import org.opensearch.search.aggregations.AggregatorFactories; +import org.opensearch.search.aggregations.bucket.MultiBucketsAggregation; +import org.opensearch.search.aggregations.bucket.composite.InternalComposite; +import org.opensearch.search.aggregations.bucket.range.InternalDateRange; +import org.opensearch.search.aggregations.bucket.range.InternalDateRange.Bucket; +import org.opensearch.search.aggregations.bucket.terms.Terms; +import org.opensearch.search.aggregations.bucket.terms.TermsAggregationBuilder; +import org.opensearch.search.aggregations.metrics.InternalTDigestPercentiles; +import org.opensearch.search.aggregations.metrics.Max; +import org.opensearch.search.aggregations.metrics.Min; +import org.opensearch.search.aggregations.metrics.NumericMetricsAggregation.SingleValue; +import org.opensearch.search.aggregations.metrics.Percentile; +import org.opensearch.search.builder.SearchSourceBuilder; +import org.opensearch.threadpool.ThreadPool; import com.amazon.opendistroforelasticsearch.ad.AnomalyDetectorPlugin; import com.amazon.opendistroforelasticsearch.ad.common.exception.EndRunException; @@ -788,7 +788,7 @@ public void getColdStartSamplesForPeriods( /** * Get features by entities. An entity is one combination of particular * categorical fields’ value. A categorical field in this setting refers to - * an Elasticsearch field of type keyword or ip. Specifically, an entity + * an OpenSearch field of type keyword or ip. Specifically, an entity * can be the IP address 182.3.4.5. * @param detector Accessor to the detector object * @param startMilli Start of time range to query diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/indices/AnomalyDetectionIndices.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/indices/AnomalyDetectionIndices.java index 9bf641acd..58eb462bf 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/indices/AnomalyDetectionIndices.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/indices/AnomalyDetectionIndices.java @@ -40,34 +40,34 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.message.ParameterizedMessage; -import org.elasticsearch.action.ActionListener; -import org.elasticsearch.action.admin.cluster.state.ClusterStateRequest; -import org.elasticsearch.action.admin.indices.alias.Alias; -import org.elasticsearch.action.admin.indices.alias.get.GetAliasesRequest; -import org.elasticsearch.action.admin.indices.create.CreateIndexRequest; -import org.elasticsearch.action.admin.indices.create.CreateIndexResponse; -import org.elasticsearch.action.admin.indices.delete.DeleteIndexRequest; -import org.elasticsearch.action.admin.indices.mapping.put.PutMappingRequest; -import org.elasticsearch.action.admin.indices.rollover.RolloverRequest; -import org.elasticsearch.action.support.GroupedActionListener; -import org.elasticsearch.action.support.IndicesOptions; -import org.elasticsearch.client.AdminClient; -import org.elasticsearch.client.Client; -import org.elasticsearch.cluster.LocalNodeMasterListener; -import org.elasticsearch.cluster.metadata.AliasMetadata; -import org.elasticsearch.cluster.metadata.IndexMetadata; -import org.elasticsearch.cluster.service.ClusterService; -import org.elasticsearch.common.Strings; -import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.common.unit.TimeValue; -import org.elasticsearch.common.xcontent.LoggingDeprecationHandler; -import org.elasticsearch.common.xcontent.NamedXContentRegistry; -import org.elasticsearch.common.xcontent.XContentParser; -import org.elasticsearch.common.xcontent.XContentParser.Token; -import org.elasticsearch.common.xcontent.XContentType; -import org.elasticsearch.index.IndexNotFoundException; -import org.elasticsearch.threadpool.Scheduler; -import org.elasticsearch.threadpool.ThreadPool; +import org.opensearch.action.ActionListener; +import org.opensearch.action.admin.cluster.state.ClusterStateRequest; +import org.opensearch.action.admin.indices.alias.Alias; +import org.opensearch.action.admin.indices.alias.get.GetAliasesRequest; +import org.opensearch.action.admin.indices.create.CreateIndexRequest; +import org.opensearch.action.admin.indices.create.CreateIndexResponse; +import org.opensearch.action.admin.indices.delete.DeleteIndexRequest; +import org.opensearch.action.admin.indices.mapping.put.PutMappingRequest; +import org.opensearch.action.admin.indices.rollover.RolloverRequest; +import org.opensearch.action.support.GroupedActionListener; +import org.opensearch.action.support.IndicesOptions; +import org.opensearch.client.AdminClient; +import org.opensearch.client.Client; +import org.opensearch.cluster.LocalNodeMasterListener; +import org.opensearch.cluster.metadata.AliasMetadata; +import org.opensearch.cluster.metadata.IndexMetadata; +import org.opensearch.cluster.service.ClusterService; +import org.opensearch.common.Strings; +import org.opensearch.common.settings.Settings; +import org.opensearch.common.unit.TimeValue; +import org.opensearch.common.xcontent.LoggingDeprecationHandler; +import org.opensearch.common.xcontent.NamedXContentRegistry; +import org.opensearch.common.xcontent.XContentParser; +import org.opensearch.common.xcontent.XContentParser.Token; +import org.opensearch.common.xcontent.XContentType; +import org.opensearch.index.IndexNotFoundException; +import org.opensearch.threadpool.Scheduler; +import org.opensearch.threadpool.ThreadPool; import com.amazon.opendistroforelasticsearch.ad.common.exception.EndRunException; import com.amazon.opendistroforelasticsearch.ad.constant.CommonName; diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/ml/CheckpointDao.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/ml/CheckpointDao.java index 3c656864e..49fce4fb3 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/ml/CheckpointDao.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/ml/CheckpointDao.java @@ -37,28 +37,28 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.message.ParameterizedMessage; -import org.elasticsearch.ExceptionsHelper; -import org.elasticsearch.ResourceAlreadyExistsException; -import org.elasticsearch.action.ActionListener; -import org.elasticsearch.action.DocWriteRequest; -import org.elasticsearch.action.bulk.BulkAction; -import org.elasticsearch.action.bulk.BulkItemResponse; -import org.elasticsearch.action.bulk.BulkRequest; -import org.elasticsearch.action.bulk.BulkResponse; -import org.elasticsearch.action.delete.DeleteRequest; -import org.elasticsearch.action.delete.DeleteResponse; -import org.elasticsearch.action.get.GetRequest; -import org.elasticsearch.action.get.GetResponse; -import org.elasticsearch.action.index.IndexRequest; -import org.elasticsearch.action.index.IndexResponse; -import org.elasticsearch.action.support.IndicesOptions; -import org.elasticsearch.client.Client; -import org.elasticsearch.index.IndexNotFoundException; -import org.elasticsearch.index.query.MatchQueryBuilder; -import org.elasticsearch.index.reindex.BulkByScrollResponse; -import org.elasticsearch.index.reindex.DeleteByQueryAction; -import org.elasticsearch.index.reindex.DeleteByQueryRequest; -import org.elasticsearch.index.reindex.ScrollableHitSource; +import org.opensearch.ExceptionsHelper; +import org.opensearch.ResourceAlreadyExistsException; +import org.opensearch.action.ActionListener; +import org.opensearch.action.DocWriteRequest; +import org.opensearch.action.bulk.BulkAction; +import org.opensearch.action.bulk.BulkItemResponse; +import org.opensearch.action.bulk.BulkRequest; +import org.opensearch.action.bulk.BulkResponse; +import org.opensearch.action.delete.DeleteRequest; +import org.opensearch.action.delete.DeleteResponse; +import org.opensearch.action.get.GetRequest; +import org.opensearch.action.get.GetResponse; +import org.opensearch.action.index.IndexRequest; +import org.opensearch.action.index.IndexResponse; +import org.opensearch.action.support.IndicesOptions; +import org.opensearch.client.Client; +import org.opensearch.index.IndexNotFoundException; +import org.opensearch.index.query.MatchQueryBuilder; +import org.opensearch.index.reindex.BulkByScrollResponse; +import org.opensearch.index.reindex.DeleteByQueryAction; +import org.opensearch.index.reindex.DeleteByQueryRequest; +import org.opensearch.index.reindex.ScrollableHitSource; import com.amazon.opendistroforelasticsearch.ad.constant.CommonName; import com.amazon.opendistroforelasticsearch.ad.indices.ADIndex; diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/ml/EntityColdStarter.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/ml/EntityColdStarter.java index 28bb8ff13..b7a903da3 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/ml/EntityColdStarter.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/ml/EntityColdStarter.java @@ -38,11 +38,11 @@ import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.core.util.Throwables; import org.apache.logging.log4j.message.ParameterizedMessage; -import org.elasticsearch.action.ActionListener; -import org.elasticsearch.action.support.ThreadedActionListener; -import org.elasticsearch.common.lease.Releasable; -import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.threadpool.ThreadPool; +import org.opensearch.action.ActionListener; +import org.opensearch.action.support.ThreadedActionListener; +import org.opensearch.common.lease.Releasable; +import org.opensearch.common.settings.Settings; +import org.opensearch.threadpool.ThreadPool; import com.amazon.opendistroforelasticsearch.ad.AnomalyDetectorPlugin; import com.amazon.opendistroforelasticsearch.ad.NodeStateManager; diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/ml/ModelManager.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/ml/ModelManager.java index 9a699e982..42d8ad130 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/ml/ModelManager.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/ml/ModelManager.java @@ -41,7 +41,7 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import org.elasticsearch.action.ActionListener; +import org.opensearch.action.ActionListener; import com.amazon.opendistroforelasticsearch.ad.DetectorModelSize; import com.amazon.opendistroforelasticsearch.ad.MemoryTracker; diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/model/ADTask.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/model/ADTask.java index fa7fa32fb..198ca8c5b 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/model/ADTask.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/model/ADTask.java @@ -15,17 +15,17 @@ package com.amazon.opendistroforelasticsearch.ad.model; -import static org.elasticsearch.common.xcontent.XContentParserUtils.ensureExpectedToken; +import static org.opensearch.common.xcontent.XContentParserUtils.ensureExpectedToken; import java.io.IOException; import java.time.Instant; -import org.elasticsearch.common.io.stream.StreamInput; -import org.elasticsearch.common.io.stream.StreamOutput; -import org.elasticsearch.common.io.stream.Writeable; -import org.elasticsearch.common.xcontent.ToXContentObject; -import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentParser; +import org.opensearch.common.io.stream.StreamInput; +import org.opensearch.common.io.stream.StreamOutput; +import org.opensearch.common.io.stream.Writeable; +import org.opensearch.common.xcontent.ToXContentObject; +import org.opensearch.common.xcontent.XContentBuilder; +import org.opensearch.common.xcontent.XContentParser; import com.amazon.opendistroforelasticsearch.ad.annotation.Generated; import com.amazon.opendistroforelasticsearch.ad.util.ParseUtils; diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/model/ADTaskProfile.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/model/ADTaskProfile.java index 6505e5f41..5e1657a60 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/model/ADTaskProfile.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/model/ADTaskProfile.java @@ -15,16 +15,16 @@ package com.amazon.opendistroforelasticsearch.ad.model; -import static org.elasticsearch.common.xcontent.XContentParserUtils.ensureExpectedToken; +import static org.opensearch.common.xcontent.XContentParserUtils.ensureExpectedToken; import java.io.IOException; -import org.elasticsearch.common.io.stream.StreamInput; -import org.elasticsearch.common.io.stream.StreamOutput; -import org.elasticsearch.common.io.stream.Writeable; -import org.elasticsearch.common.xcontent.ToXContentObject; -import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentParser; +import org.opensearch.common.io.stream.StreamInput; +import org.opensearch.common.io.stream.StreamOutput; +import org.opensearch.common.io.stream.Writeable; +import org.opensearch.common.xcontent.ToXContentObject; +import org.opensearch.common.xcontent.XContentBuilder; +import org.opensearch.common.xcontent.XContentParser; import com.amazon.opendistroforelasticsearch.ad.annotation.Generated; import com.google.common.base.Objects; diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/model/AnomalyDetector.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/model/AnomalyDetector.java index 581a5dcc0..94f7970ae 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/model/AnomalyDetector.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/model/AnomalyDetector.java @@ -18,8 +18,8 @@ import static com.amazon.opendistroforelasticsearch.ad.settings.AnomalyDetectorSettings.CATEGORY_FIELD_LIMIT; import static com.amazon.opendistroforelasticsearch.ad.settings.AnomalyDetectorSettings.DEFAULT_MULTI_ENTITY_SHINGLE; import static com.amazon.opendistroforelasticsearch.ad.settings.AnomalyDetectorSettings.DEFAULT_SHINGLE_SIZE; -import static org.elasticsearch.common.xcontent.XContentParserUtils.ensureExpectedToken; -import static org.elasticsearch.index.query.AbstractQueryBuilder.parseInnerQueryBuilder; +import static org.opensearch.common.xcontent.XContentParserUtils.ensureExpectedToken; +import static org.opensearch.index.query.AbstractQueryBuilder.parseInnerQueryBuilder; import java.io.IOException; import java.time.Duration; @@ -31,18 +31,18 @@ import java.util.stream.Collectors; import org.apache.logging.log4j.util.Strings; -import org.elasticsearch.common.ParseField; -import org.elasticsearch.common.io.stream.StreamInput; -import org.elasticsearch.common.io.stream.StreamOutput; -import org.elasticsearch.common.io.stream.Writeable; -import org.elasticsearch.common.unit.TimeValue; -import org.elasticsearch.common.xcontent.NamedXContentRegistry; -import org.elasticsearch.common.xcontent.ToXContent; -import org.elasticsearch.common.xcontent.ToXContentObject; -import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentParser; -import org.elasticsearch.index.query.QueryBuilder; -import org.elasticsearch.index.query.QueryBuilders; +import org.opensearch.common.ParseField; +import org.opensearch.common.io.stream.StreamInput; +import org.opensearch.common.io.stream.StreamOutput; +import org.opensearch.common.io.stream.Writeable; +import org.opensearch.common.unit.TimeValue; +import org.opensearch.common.xcontent.NamedXContentRegistry; +import org.opensearch.common.xcontent.ToXContent; +import org.opensearch.common.xcontent.ToXContentObject; +import org.opensearch.common.xcontent.XContentBuilder; +import org.opensearch.common.xcontent.XContentParser; +import org.opensearch.index.query.QueryBuilder; +import org.opensearch.index.query.QueryBuilders; import com.amazon.opendistroforelasticsearch.ad.annotation.Generated; import com.amazon.opendistroforelasticsearch.ad.constant.CommonErrorMessages; diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/model/AnomalyDetectorExecutionInput.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/model/AnomalyDetectorExecutionInput.java index cbff4ae98..c54775027 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/model/AnomalyDetectorExecutionInput.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/model/AnomalyDetectorExecutionInput.java @@ -15,14 +15,14 @@ package com.amazon.opendistroforelasticsearch.ad.model; -import static org.elasticsearch.common.xcontent.XContentParserUtils.ensureExpectedToken; +import static org.opensearch.common.xcontent.XContentParserUtils.ensureExpectedToken; import java.io.IOException; import java.time.Instant; -import org.elasticsearch.common.xcontent.ToXContentObject; -import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentParser; +import org.opensearch.common.xcontent.ToXContentObject; +import org.opensearch.common.xcontent.XContentBuilder; +import org.opensearch.common.xcontent.XContentParser; import com.amazon.opendistroforelasticsearch.ad.annotation.Generated; import com.amazon.opendistroforelasticsearch.ad.util.ParseUtils; diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/model/AnomalyDetectorJob.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/model/AnomalyDetectorJob.java index 89efd6c0c..fa1c676da 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/model/AnomalyDetectorJob.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/model/AnomalyDetectorJob.java @@ -16,19 +16,19 @@ package com.amazon.opendistroforelasticsearch.ad.model; import static com.amazon.opendistroforelasticsearch.ad.settings.AnomalyDetectorSettings.DEFAULT_AD_JOB_LOC_DURATION_SECONDS; -import static org.elasticsearch.common.xcontent.XContentParserUtils.ensureExpectedToken; +import static org.opensearch.common.xcontent.XContentParserUtils.ensureExpectedToken; import java.io.IOException; import java.time.Instant; -import org.elasticsearch.common.ParseField; -import org.elasticsearch.common.io.stream.StreamInput; -import org.elasticsearch.common.io.stream.StreamOutput; -import org.elasticsearch.common.io.stream.Writeable; -import org.elasticsearch.common.xcontent.NamedXContentRegistry; -import org.elasticsearch.common.xcontent.ToXContentObject; -import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentParser; +import org.opensearch.common.ParseField; +import org.opensearch.common.io.stream.StreamInput; +import org.opensearch.common.io.stream.StreamOutput; +import org.opensearch.common.io.stream.Writeable; +import org.opensearch.common.xcontent.NamedXContentRegistry; +import org.opensearch.common.xcontent.ToXContentObject; +import org.opensearch.common.xcontent.XContentBuilder; +import org.opensearch.common.xcontent.XContentParser; import com.amazon.opendistroforelasticsearch.ad.util.ParseUtils; import com.amazon.opendistroforelasticsearch.commons.authuser.User; diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/model/AnomalyResult.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/model/AnomalyResult.java index e459b335d..2360e59a9 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/model/AnomalyResult.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/model/AnomalyResult.java @@ -15,7 +15,7 @@ package com.amazon.opendistroforelasticsearch.ad.model; -import static org.elasticsearch.common.xcontent.XContentParserUtils.ensureExpectedToken; +import static org.opensearch.common.xcontent.XContentParserUtils.ensureExpectedToken; import java.io.IOException; import java.time.Instant; @@ -23,14 +23,14 @@ import java.util.List; import org.apache.commons.lang.builder.ToStringBuilder; -import org.elasticsearch.common.ParseField; -import org.elasticsearch.common.io.stream.StreamInput; -import org.elasticsearch.common.io.stream.StreamOutput; -import org.elasticsearch.common.io.stream.Writeable; -import org.elasticsearch.common.xcontent.NamedXContentRegistry; -import org.elasticsearch.common.xcontent.ToXContentObject; -import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentParser; +import org.opensearch.common.ParseField; +import org.opensearch.common.io.stream.StreamInput; +import org.opensearch.common.io.stream.StreamOutput; +import org.opensearch.common.io.stream.Writeable; +import org.opensearch.common.xcontent.NamedXContentRegistry; +import org.opensearch.common.xcontent.ToXContentObject; +import org.opensearch.common.xcontent.XContentBuilder; +import org.opensearch.common.xcontent.XContentParser; import com.amazon.opendistroforelasticsearch.ad.annotation.Generated; import com.amazon.opendistroforelasticsearch.ad.constant.CommonName; diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/model/DetectionDateRange.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/model/DetectionDateRange.java index 1eb382d67..53f96f566 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/model/DetectionDateRange.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/model/DetectionDateRange.java @@ -15,18 +15,18 @@ package com.amazon.opendistroforelasticsearch.ad.model; -import static org.elasticsearch.common.xcontent.XContentParserUtils.ensureExpectedToken; +import static org.opensearch.common.xcontent.XContentParserUtils.ensureExpectedToken; import java.io.IOException; import java.time.Instant; import org.apache.commons.lang.builder.ToStringBuilder; -import org.elasticsearch.common.io.stream.StreamInput; -import org.elasticsearch.common.io.stream.StreamOutput; -import org.elasticsearch.common.io.stream.Writeable; -import org.elasticsearch.common.xcontent.ToXContentObject; -import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentParser; +import org.opensearch.common.io.stream.StreamInput; +import org.opensearch.common.io.stream.StreamOutput; +import org.opensearch.common.io.stream.Writeable; +import org.opensearch.common.xcontent.ToXContentObject; +import org.opensearch.common.xcontent.XContentBuilder; +import org.opensearch.common.xcontent.XContentParser; import com.amazon.opendistroforelasticsearch.ad.annotation.Generated; import com.amazon.opendistroforelasticsearch.ad.util.ParseUtils; diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/model/DetectorInternalState.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/model/DetectorInternalState.java index c0e0abda3..94f4463cb 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/model/DetectorInternalState.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/model/DetectorInternalState.java @@ -15,16 +15,16 @@ package com.amazon.opendistroforelasticsearch.ad.model; -import static org.elasticsearch.common.xcontent.XContentParserUtils.ensureExpectedToken; +import static org.opensearch.common.xcontent.XContentParserUtils.ensureExpectedToken; import java.io.IOException; import java.time.Instant; -import org.elasticsearch.common.ParseField; -import org.elasticsearch.common.xcontent.NamedXContentRegistry; -import org.elasticsearch.common.xcontent.ToXContentObject; -import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentParser; +import org.opensearch.common.ParseField; +import org.opensearch.common.xcontent.NamedXContentRegistry; +import org.opensearch.common.xcontent.ToXContentObject; +import org.opensearch.common.xcontent.XContentBuilder; +import org.opensearch.common.xcontent.XContentParser; import com.amazon.opendistroforelasticsearch.ad.annotation.Generated; import com.amazon.opendistroforelasticsearch.ad.util.ParseUtils; diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/model/DetectorProfile.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/model/DetectorProfile.java index e473577ff..52e62b5a2 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/model/DetectorProfile.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/model/DetectorProfile.java @@ -20,12 +20,12 @@ import org.apache.commons.lang.builder.EqualsBuilder; import org.apache.commons.lang.builder.HashCodeBuilder; import org.apache.commons.lang.builder.ToStringBuilder; -import org.elasticsearch.common.io.stream.StreamInput; -import org.elasticsearch.common.io.stream.StreamOutput; -import org.elasticsearch.common.io.stream.Writeable; -import org.elasticsearch.common.xcontent.ToXContent; -import org.elasticsearch.common.xcontent.ToXContentObject; -import org.elasticsearch.common.xcontent.XContentBuilder; +import org.opensearch.common.io.stream.StreamInput; +import org.opensearch.common.io.stream.StreamOutput; +import org.opensearch.common.io.stream.Writeable; +import org.opensearch.common.xcontent.ToXContent; +import org.opensearch.common.xcontent.ToXContentObject; +import org.opensearch.common.xcontent.XContentBuilder; import com.amazon.opendistroforelasticsearch.ad.constant.CommonName; diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/model/Entity.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/model/Entity.java index f637c5d61..f1cbe4aa6 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/model/Entity.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/model/Entity.java @@ -15,16 +15,16 @@ package com.amazon.opendistroforelasticsearch.ad.model; -import static org.elasticsearch.common.xcontent.XContentParserUtils.ensureExpectedToken; +import static org.opensearch.common.xcontent.XContentParserUtils.ensureExpectedToken; import java.io.IOException; -import org.elasticsearch.common.io.stream.StreamInput; -import org.elasticsearch.common.io.stream.StreamOutput; -import org.elasticsearch.common.io.stream.Writeable; -import org.elasticsearch.common.xcontent.ToXContentObject; -import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentParser; +import org.opensearch.common.io.stream.StreamInput; +import org.opensearch.common.io.stream.StreamOutput; +import org.opensearch.common.io.stream.Writeable; +import org.opensearch.common.xcontent.ToXContentObject; +import org.opensearch.common.xcontent.XContentBuilder; +import org.opensearch.common.xcontent.XContentParser; import com.amazon.opendistroforelasticsearch.ad.annotation.Generated; import com.google.common.base.Objects; diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/model/EntityProfile.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/model/EntityProfile.java index ae30f506b..2f43d1534 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/model/EntityProfile.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/model/EntityProfile.java @@ -21,11 +21,11 @@ import org.apache.commons.lang.builder.EqualsBuilder; import org.apache.commons.lang.builder.HashCodeBuilder; import org.apache.commons.lang.builder.ToStringBuilder; -import org.elasticsearch.common.io.stream.StreamInput; -import org.elasticsearch.common.io.stream.StreamOutput; -import org.elasticsearch.common.io.stream.Writeable; -import org.elasticsearch.common.xcontent.ToXContent; -import org.elasticsearch.common.xcontent.XContentBuilder; +import org.opensearch.common.io.stream.StreamInput; +import org.opensearch.common.io.stream.StreamOutput; +import org.opensearch.common.io.stream.Writeable; +import org.opensearch.common.xcontent.ToXContent; +import org.opensearch.common.xcontent.XContentBuilder; import com.amazon.opendistroforelasticsearch.ad.constant.CommonName; diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/model/Feature.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/model/Feature.java index 4c8603345..9c0c58ea0 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/model/Feature.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/model/Feature.java @@ -15,19 +15,19 @@ package com.amazon.opendistroforelasticsearch.ad.model; -import static org.elasticsearch.common.xcontent.XContentParserUtils.ensureExpectedToken; +import static org.opensearch.common.xcontent.XContentParserUtils.ensureExpectedToken; import java.io.IOException; import org.apache.logging.log4j.util.Strings; -import org.elasticsearch.common.UUIDs; -import org.elasticsearch.common.io.stream.StreamInput; -import org.elasticsearch.common.io.stream.StreamOutput; -import org.elasticsearch.common.io.stream.Writeable; -import org.elasticsearch.common.xcontent.ToXContentObject; -import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentParser; -import org.elasticsearch.search.aggregations.AggregationBuilder; +import org.opensearch.common.UUIDs; +import org.opensearch.common.io.stream.StreamInput; +import org.opensearch.common.io.stream.StreamOutput; +import org.opensearch.common.io.stream.Writeable; +import org.opensearch.common.xcontent.ToXContentObject; +import org.opensearch.common.xcontent.XContentBuilder; +import org.opensearch.common.xcontent.XContentParser; +import org.opensearch.search.aggregations.AggregationBuilder; import com.amazon.opendistroforelasticsearch.ad.annotation.Generated; import com.amazon.opendistroforelasticsearch.ad.util.ParseUtils; diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/model/FeatureData.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/model/FeatureData.java index 8d073ee34..d565a8035 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/model/FeatureData.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/model/FeatureData.java @@ -15,16 +15,16 @@ package com.amazon.opendistroforelasticsearch.ad.model; -import static org.elasticsearch.common.xcontent.XContentParserUtils.ensureExpectedToken; +import static org.opensearch.common.xcontent.XContentParserUtils.ensureExpectedToken; import java.io.IOException; -import org.elasticsearch.common.io.stream.StreamInput; -import org.elasticsearch.common.io.stream.StreamOutput; -import org.elasticsearch.common.io.stream.Writeable; -import org.elasticsearch.common.xcontent.ToXContentObject; -import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentParser; +import org.opensearch.common.io.stream.StreamInput; +import org.opensearch.common.io.stream.StreamOutput; +import org.opensearch.common.io.stream.Writeable; +import org.opensearch.common.xcontent.ToXContentObject; +import org.opensearch.common.xcontent.XContentBuilder; +import org.opensearch.common.xcontent.XContentParser; import com.amazon.opendistroforelasticsearch.ad.annotation.Generated; import com.google.common.base.Objects; diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/model/InitProgressProfile.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/model/InitProgressProfile.java index 2047439fb..fb715f0d3 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/model/InitProgressProfile.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/model/InitProgressProfile.java @@ -35,11 +35,11 @@ import org.apache.commons.lang.builder.EqualsBuilder; import org.apache.commons.lang.builder.HashCodeBuilder; import org.apache.commons.lang.builder.ToStringBuilder; -import org.elasticsearch.common.io.stream.StreamInput; -import org.elasticsearch.common.io.stream.StreamOutput; -import org.elasticsearch.common.io.stream.Writeable; -import org.elasticsearch.common.xcontent.ToXContent; -import org.elasticsearch.common.xcontent.XContentBuilder; +import org.opensearch.common.io.stream.StreamInput; +import org.opensearch.common.io.stream.StreamOutput; +import org.opensearch.common.io.stream.Writeable; +import org.opensearch.common.xcontent.ToXContent; +import org.opensearch.common.xcontent.XContentBuilder; /** * Profile output for detector initialization progress. When the new detector is created, it is possible that diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/model/IntervalTimeConfiguration.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/model/IntervalTimeConfiguration.java index 8416fe90d..92d0a59f9 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/model/IntervalTimeConfiguration.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/model/IntervalTimeConfiguration.java @@ -21,9 +21,9 @@ import java.util.Locale; import java.util.Set; -import org.elasticsearch.common.io.stream.StreamInput; -import org.elasticsearch.common.io.stream.StreamOutput; -import org.elasticsearch.common.xcontent.XContentBuilder; +import org.opensearch.common.io.stream.StreamInput; +import org.opensearch.common.io.stream.StreamOutput; +import org.opensearch.common.xcontent.XContentBuilder; import com.amazon.opendistroforelasticsearch.ad.annotation.Generated; import com.google.common.base.Objects; diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/model/ModelProfile.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/model/ModelProfile.java index 62853221b..2e54c28e5 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/model/ModelProfile.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/model/ModelProfile.java @@ -35,11 +35,11 @@ import org.apache.commons.lang.builder.EqualsBuilder; import org.apache.commons.lang.builder.HashCodeBuilder; import org.apache.commons.lang.builder.ToStringBuilder; -import org.elasticsearch.common.io.stream.StreamInput; -import org.elasticsearch.common.io.stream.StreamOutput; -import org.elasticsearch.common.io.stream.Writeable; -import org.elasticsearch.common.xcontent.ToXContent; -import org.elasticsearch.common.xcontent.XContentBuilder; +import org.opensearch.common.io.stream.StreamInput; +import org.opensearch.common.io.stream.StreamOutput; +import org.opensearch.common.io.stream.Writeable; +import org.opensearch.common.xcontent.ToXContent; +import org.opensearch.common.xcontent.XContentBuilder; public class ModelProfile implements Writeable, ToXContent { // field name in toXContent diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/model/TimeConfiguration.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/model/TimeConfiguration.java index 7461a8178..5a74da4ff 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/model/TimeConfiguration.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/model/TimeConfiguration.java @@ -15,15 +15,15 @@ package com.amazon.opendistroforelasticsearch.ad.model; -import static org.elasticsearch.common.xcontent.XContentParserUtils.ensureExpectedToken; +import static org.opensearch.common.xcontent.XContentParserUtils.ensureExpectedToken; import java.io.IOException; import java.time.temporal.ChronoUnit; import java.util.Locale; -import org.elasticsearch.common.io.stream.Writeable; -import org.elasticsearch.common.xcontent.ToXContentObject; -import org.elasticsearch.common.xcontent.XContentParser; +import org.opensearch.common.io.stream.Writeable; +import org.opensearch.common.xcontent.ToXContentObject; +import org.opensearch.common.xcontent.XContentParser; /** * TimeConfiguration represents the time configuration for a job which runs regularly. diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/rest/AbstractSearchAction.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/rest/AbstractSearchAction.java index 1b8f06189..332b2613a 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/rest/AbstractSearchAction.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/rest/AbstractSearchAction.java @@ -16,34 +16,34 @@ package com.amazon.opendistroforelasticsearch.ad.rest; import static com.amazon.opendistroforelasticsearch.ad.util.RestHandlerUtils.getSourceContext; -import static org.elasticsearch.common.xcontent.ToXContent.EMPTY_PARAMS; -import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder; -import static org.elasticsearch.common.xcontent.XContentParserUtils.ensureExpectedToken; +import static org.opensearch.common.xcontent.ToXContent.EMPTY_PARAMS; +import static org.opensearch.common.xcontent.XContentFactory.jsonBuilder; +import static org.opensearch.common.xcontent.XContentParserUtils.ensureExpectedToken; import java.io.IOException; import java.util.List; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import org.elasticsearch.action.ActionType; -import org.elasticsearch.action.search.SearchRequest; -import org.elasticsearch.action.search.SearchResponse; -import org.elasticsearch.client.node.NodeClient; -import org.elasticsearch.common.bytes.BytesReference; -import org.elasticsearch.common.xcontent.LoggingDeprecationHandler; -import org.elasticsearch.common.xcontent.ToXContentObject; -import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentParser; -import org.elasticsearch.common.xcontent.XContentType; -import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.BytesRestResponse; -import org.elasticsearch.rest.RestChannel; -import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestResponse; -import org.elasticsearch.rest.RestStatus; -import org.elasticsearch.rest.action.RestResponseListener; -import org.elasticsearch.search.SearchHit; -import org.elasticsearch.search.builder.SearchSourceBuilder; +import org.opensearch.action.ActionType; +import org.opensearch.action.search.SearchRequest; +import org.opensearch.action.search.SearchResponse; +import org.opensearch.client.node.NodeClient; +import org.opensearch.common.bytes.BytesReference; +import org.opensearch.common.xcontent.LoggingDeprecationHandler; +import org.opensearch.common.xcontent.ToXContentObject; +import org.opensearch.common.xcontent.XContentBuilder; +import org.opensearch.common.xcontent.XContentParser; +import org.opensearch.common.xcontent.XContentType; +import org.opensearch.rest.BaseRestHandler; +import org.opensearch.rest.BytesRestResponse; +import org.opensearch.rest.RestChannel; +import org.opensearch.rest.RestRequest; +import org.opensearch.rest.RestResponse; +import org.opensearch.rest.RestStatus; +import org.opensearch.rest.action.RestResponseListener; +import org.opensearch.search.SearchHit; +import org.opensearch.search.builder.SearchSourceBuilder; import com.amazon.opendistroforelasticsearch.ad.constant.CommonErrorMessages; import com.amazon.opendistroforelasticsearch.ad.model.AnomalyDetector; diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/rest/RestAnomalyDetectorJobAction.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/rest/RestAnomalyDetectorJobAction.java index 262c68037..4ff5b6a9e 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/rest/RestAnomalyDetectorJobAction.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/rest/RestAnomalyDetectorJobAction.java @@ -26,14 +26,14 @@ import java.util.List; import java.util.Locale; -import org.elasticsearch.client.node.NodeClient; -import org.elasticsearch.cluster.service.ClusterService; -import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.common.unit.TimeValue; -import org.elasticsearch.index.seqno.SequenceNumbers; -import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.action.RestToXContentListener; +import org.opensearch.client.node.NodeClient; +import org.opensearch.cluster.service.ClusterService; +import org.opensearch.common.settings.Settings; +import org.opensearch.common.unit.TimeValue; +import org.opensearch.index.seqno.SequenceNumbers; +import org.opensearch.rest.BaseRestHandler; +import org.opensearch.rest.RestRequest; +import org.opensearch.rest.action.RestToXContentListener; import com.amazon.opendistroforelasticsearch.ad.AnomalyDetectorPlugin; import com.amazon.opendistroforelasticsearch.ad.constant.CommonErrorMessages; diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/rest/RestDeleteAnomalyDetectorAction.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/rest/RestDeleteAnomalyDetectorAction.java index 8ebc175ab..e268e81d0 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/rest/RestDeleteAnomalyDetectorAction.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/rest/RestDeleteAnomalyDetectorAction.java @@ -23,10 +23,10 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import org.elasticsearch.client.node.NodeClient; -import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.action.RestToXContentListener; +import org.opensearch.client.node.NodeClient; +import org.opensearch.rest.BaseRestHandler; +import org.opensearch.rest.RestRequest; +import org.opensearch.rest.action.RestToXContentListener; import com.amazon.opendistroforelasticsearch.ad.AnomalyDetectorPlugin; import com.amazon.opendistroforelasticsearch.ad.constant.CommonErrorMessages; diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/rest/RestExecuteAnomalyDetectorAction.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/rest/RestExecuteAnomalyDetectorAction.java index f72a72261..932ff1aa2 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/rest/RestExecuteAnomalyDetectorAction.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/rest/RestExecuteAnomalyDetectorAction.java @@ -18,7 +18,7 @@ import static com.amazon.opendistroforelasticsearch.ad.settings.AnomalyDetectorSettings.REQUEST_TIMEOUT; import static com.amazon.opendistroforelasticsearch.ad.util.RestHandlerUtils.DETECTOR_ID; import static com.amazon.opendistroforelasticsearch.ad.util.RestHandlerUtils.RUN; -import static org.elasticsearch.common.xcontent.XContentParserUtils.ensureExpectedToken; +import static org.opensearch.common.xcontent.XContentParserUtils.ensureExpectedToken; import java.io.IOException; import java.util.List; @@ -27,16 +27,16 @@ import org.apache.commons.lang.StringUtils; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import org.elasticsearch.client.node.NodeClient; -import org.elasticsearch.cluster.service.ClusterService; -import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.common.unit.TimeValue; -import org.elasticsearch.common.xcontent.XContentParser; -import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.BytesRestResponse; -import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestStatus; -import org.elasticsearch.rest.action.RestToXContentListener; +import org.opensearch.client.node.NodeClient; +import org.opensearch.cluster.service.ClusterService; +import org.opensearch.common.settings.Settings; +import org.opensearch.common.unit.TimeValue; +import org.opensearch.common.xcontent.XContentParser; +import org.opensearch.rest.BaseRestHandler; +import org.opensearch.rest.BytesRestResponse; +import org.opensearch.rest.RestRequest; +import org.opensearch.rest.RestStatus; +import org.opensearch.rest.action.RestToXContentListener; import com.amazon.opendistroforelasticsearch.ad.AnomalyDetectorPlugin; import com.amazon.opendistroforelasticsearch.ad.constant.CommonErrorMessages; diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/rest/RestGetAnomalyDetectorAction.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/rest/RestGetAnomalyDetectorAction.java index f051970c7..194219df8 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/rest/RestGetAnomalyDetectorAction.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/rest/RestGetAnomalyDetectorAction.java @@ -26,11 +26,11 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import org.elasticsearch.client.node.NodeClient; -import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.action.RestActions; -import org.elasticsearch.rest.action.RestToXContentListener; +import org.opensearch.client.node.NodeClient; +import org.opensearch.rest.BaseRestHandler; +import org.opensearch.rest.RestRequest; +import org.opensearch.rest.action.RestActions; +import org.opensearch.rest.action.RestToXContentListener; import com.amazon.opendistroforelasticsearch.ad.AnomalyDetectorPlugin; import com.amazon.opendistroforelasticsearch.ad.constant.CommonErrorMessages; diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/rest/RestIndexAnomalyDetectorAction.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/rest/RestIndexAnomalyDetectorAction.java index 5eb7895f5..fc1081208 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/rest/RestIndexAnomalyDetectorAction.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/rest/RestIndexAnomalyDetectorAction.java @@ -25,7 +25,7 @@ import static com.amazon.opendistroforelasticsearch.ad.util.RestHandlerUtils.IF_PRIMARY_TERM; import static com.amazon.opendistroforelasticsearch.ad.util.RestHandlerUtils.IF_SEQ_NO; import static com.amazon.opendistroforelasticsearch.ad.util.RestHandlerUtils.REFRESH; -import static org.elasticsearch.common.xcontent.XContentParserUtils.ensureExpectedToken; +import static org.opensearch.common.xcontent.XContentParserUtils.ensureExpectedToken; import java.io.IOException; import java.util.List; @@ -33,21 +33,21 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import org.elasticsearch.action.support.WriteRequest; -import org.elasticsearch.client.node.NodeClient; -import org.elasticsearch.cluster.service.ClusterService; -import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.common.unit.TimeValue; -import org.elasticsearch.common.xcontent.ToXContent; -import org.elasticsearch.common.xcontent.XContentParser; -import org.elasticsearch.index.seqno.SequenceNumbers; -import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.BytesRestResponse; -import org.elasticsearch.rest.RestChannel; -import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestResponse; -import org.elasticsearch.rest.RestStatus; -import org.elasticsearch.rest.action.RestResponseListener; +import org.opensearch.action.support.WriteRequest; +import org.opensearch.client.node.NodeClient; +import org.opensearch.cluster.service.ClusterService; +import org.opensearch.common.settings.Settings; +import org.opensearch.common.unit.TimeValue; +import org.opensearch.common.xcontent.ToXContent; +import org.opensearch.common.xcontent.XContentParser; +import org.opensearch.index.seqno.SequenceNumbers; +import org.opensearch.rest.BaseRestHandler; +import org.opensearch.rest.BytesRestResponse; +import org.opensearch.rest.RestChannel; +import org.opensearch.rest.RestRequest; +import org.opensearch.rest.RestResponse; +import org.opensearch.rest.RestStatus; +import org.opensearch.rest.action.RestResponseListener; import com.amazon.opendistroforelasticsearch.ad.AnomalyDetectorPlugin; import com.amazon.opendistroforelasticsearch.ad.constant.CommonErrorMessages; diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/rest/RestPreviewAnomalyDetectorAction.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/rest/RestPreviewAnomalyDetectorAction.java index b958ec7b4..77df3bb04 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/rest/RestPreviewAnomalyDetectorAction.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/rest/RestPreviewAnomalyDetectorAction.java @@ -16,7 +16,7 @@ package com.amazon.opendistroforelasticsearch.ad.rest; import static com.amazon.opendistroforelasticsearch.ad.util.RestHandlerUtils.PREVIEW; -import static org.elasticsearch.common.xcontent.XContentParserUtils.ensureExpectedToken; +import static org.opensearch.common.xcontent.XContentParserUtils.ensureExpectedToken; import java.io.IOException; import java.util.List; @@ -25,13 +25,13 @@ import org.apache.commons.lang.StringUtils; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import org.elasticsearch.common.xcontent.XContentParser; -import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.BytesRestResponse; -import org.elasticsearch.rest.RestHandler; -import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestStatus; -import org.elasticsearch.rest.action.RestToXContentListener; +import org.opensearch.common.xcontent.XContentParser; +import org.opensearch.rest.BaseRestHandler; +import org.opensearch.rest.BytesRestResponse; +import org.opensearch.rest.RestHandler; +import org.opensearch.rest.RestRequest; +import org.opensearch.rest.RestStatus; +import org.opensearch.rest.action.RestToXContentListener; import com.amazon.opendistroforelasticsearch.ad.AnomalyDetectorPlugin; import com.amazon.opendistroforelasticsearch.ad.constant.CommonErrorMessages; @@ -56,7 +56,7 @@ public String getName() { } @Override - protected RestChannelConsumer prepareRequest(RestRequest request, org.elasticsearch.client.node.NodeClient client) throws IOException { + protected RestChannelConsumer prepareRequest(RestRequest request, org.opensearch.client.node.NodeClient client) throws IOException { if (!EnabledSetting.isADPluginEnabled()) { throw new IllegalStateException(CommonErrorMessages.DISABLED_ERR_MSG); } diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/rest/RestSearchAnomalyDetectorInfoAction.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/rest/RestSearchAnomalyDetectorInfoAction.java index 228efe513..4470cd48c 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/rest/RestSearchAnomalyDetectorInfoAction.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/rest/RestSearchAnomalyDetectorInfoAction.java @@ -24,10 +24,10 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestHandler; -import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.action.RestToXContentListener; +import org.opensearch.rest.BaseRestHandler; +import org.opensearch.rest.RestHandler; +import org.opensearch.rest.RestRequest; +import org.opensearch.rest.action.RestToXContentListener; import com.amazon.opendistroforelasticsearch.ad.AnomalyDetectorPlugin; import com.amazon.opendistroforelasticsearch.ad.constant.CommonErrorMessages; @@ -50,7 +50,7 @@ public String getName() { } @Override - protected RestChannelConsumer prepareRequest(RestRequest request, org.elasticsearch.client.node.NodeClient client) throws IOException { + protected RestChannelConsumer prepareRequest(RestRequest request, org.opensearch.client.node.NodeClient client) throws IOException { if (!EnabledSetting.isADPluginEnabled()) { throw new IllegalStateException(CommonErrorMessages.DISABLED_ERR_MSG); } diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/rest/RestStatsAnomalyDetectorAction.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/rest/RestStatsAnomalyDetectorAction.java index 5956f07da..03baae2c1 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/rest/RestStatsAnomalyDetectorAction.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/rest/RestStatsAnomalyDetectorAction.java @@ -23,13 +23,13 @@ import java.util.Set; import java.util.TreeSet; -import org.elasticsearch.client.node.NodeClient; -import org.elasticsearch.cluster.node.DiscoveryNode; -import org.elasticsearch.cluster.service.ClusterService; -import org.elasticsearch.common.Strings; -import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.action.RestToXContentListener; +import org.opensearch.client.node.NodeClient; +import org.opensearch.cluster.node.DiscoveryNode; +import org.opensearch.cluster.service.ClusterService; +import org.opensearch.common.Strings; +import org.opensearch.rest.BaseRestHandler; +import org.opensearch.rest.RestRequest; +import org.opensearch.rest.action.RestToXContentListener; import com.amazon.opendistroforelasticsearch.ad.constant.CommonErrorMessages; import com.amazon.opendistroforelasticsearch.ad.settings.EnabledSetting; diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/rest/handler/AnomalyDetectorActionHandler.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/rest/handler/AnomalyDetectorActionHandler.java index 3989b6af4..41afc86a8 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/rest/handler/AnomalyDetectorActionHandler.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/rest/handler/AnomalyDetectorActionHandler.java @@ -16,21 +16,21 @@ package com.amazon.opendistroforelasticsearch.ad.rest.handler; import static com.amazon.opendistroforelasticsearch.ad.model.AnomalyDetectorJob.ANOMALY_DETECTOR_JOB_INDEX; -import static org.elasticsearch.common.xcontent.XContentParserUtils.ensureExpectedToken; +import static org.opensearch.common.xcontent.XContentParserUtils.ensureExpectedToken; import java.io.IOException; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import org.elasticsearch.ElasticsearchStatusException; -import org.elasticsearch.action.ActionListener; -import org.elasticsearch.action.get.GetRequest; -import org.elasticsearch.action.get.GetResponse; -import org.elasticsearch.client.Client; -import org.elasticsearch.cluster.service.ClusterService; -import org.elasticsearch.common.xcontent.NamedXContentRegistry; -import org.elasticsearch.common.xcontent.XContentParser; -import org.elasticsearch.rest.RestStatus; +import org.opensearch.OpenSearchStatusException; +import org.opensearch.action.ActionListener; +import org.opensearch.action.get.GetRequest; +import org.opensearch.action.get.GetResponse; +import org.opensearch.client.Client; +import org.opensearch.cluster.service.ClusterService; +import org.opensearch.common.xcontent.NamedXContentRegistry; +import org.opensearch.common.xcontent.XContentParser; +import org.opensearch.rest.RestStatus; import com.amazon.opendistroforelasticsearch.ad.model.AnomalyDetectorJob; import com.amazon.opendistroforelasticsearch.ad.util.RestHandlerUtils; @@ -94,13 +94,13 @@ private void onGetAdJobResponseForWrite( ensureExpectedToken(XContentParser.Token.START_OBJECT, parser.nextToken(), parser); AnomalyDetectorJob adJob = AnomalyDetectorJob.parse(parser); if (adJob.isEnabled()) { - listener.onFailure(new ElasticsearchStatusException("Detector job is running: " + adJobId, RestStatus.BAD_REQUEST)); + listener.onFailure(new OpenSearchStatusException("Detector job is running: " + adJobId, RestStatus.BAD_REQUEST)); return; } } catch (IOException e) { String message = "Failed to parse anomaly detector job " + adJobId; logger.error(message, e); - listener.onFailure(new ElasticsearchStatusException(message, RestStatus.BAD_REQUEST)); + listener.onFailure(new OpenSearchStatusException(message, RestStatus.BAD_REQUEST)); } } } diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/rest/handler/IndexAnomalyDetectorActionHandler.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/rest/handler/IndexAnomalyDetectorActionHandler.java index a7028e956..075f1de30 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/rest/handler/IndexAnomalyDetectorActionHandler.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/rest/handler/IndexAnomalyDetectorActionHandler.java @@ -17,7 +17,7 @@ import static com.amazon.opendistroforelasticsearch.ad.model.AnomalyDetector.ANOMALY_DETECTORS_INDEX; import static com.amazon.opendistroforelasticsearch.ad.util.RestHandlerUtils.XCONTENT_WITH_TYPE; -import static org.elasticsearch.common.xcontent.XContentParserUtils.ensureExpectedToken; +import static org.opensearch.common.xcontent.XContentParserUtils.ensureExpectedToken; import java.io.IOException; import java.time.Instant; @@ -30,35 +30,35 @@ import org.apache.commons.lang.StringUtils; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import org.elasticsearch.ElasticsearchStatusException; -import org.elasticsearch.action.ActionListener; -import org.elasticsearch.action.admin.indices.create.CreateIndexResponse; -import org.elasticsearch.action.admin.indices.mapping.get.GetFieldMappingsAction; -import org.elasticsearch.action.admin.indices.mapping.get.GetFieldMappingsRequest; -import org.elasticsearch.action.admin.indices.mapping.get.GetFieldMappingsResponse; -import org.elasticsearch.action.admin.indices.mapping.get.GetFieldMappingsResponse.FieldMappingMetadata; -import org.elasticsearch.action.get.GetRequest; -import org.elasticsearch.action.get.GetResponse; -import org.elasticsearch.action.index.IndexRequest; -import org.elasticsearch.action.index.IndexResponse; -import org.elasticsearch.action.search.SearchRequest; -import org.elasticsearch.action.search.SearchResponse; -import org.elasticsearch.action.support.IndicesOptions; -import org.elasticsearch.action.support.WriteRequest; -import org.elasticsearch.action.support.replication.ReplicationResponse; -import org.elasticsearch.client.Client; -import org.elasticsearch.cluster.service.ClusterService; -import org.elasticsearch.common.unit.TimeValue; -import org.elasticsearch.common.xcontent.NamedXContentRegistry; -import org.elasticsearch.common.xcontent.XContentFactory; -import org.elasticsearch.common.xcontent.XContentParser; -import org.elasticsearch.index.query.BoolQueryBuilder; -import org.elasticsearch.index.query.QueryBuilder; -import org.elasticsearch.index.query.QueryBuilders; -import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestStatus; -import org.elasticsearch.search.builder.SearchSourceBuilder; -import org.elasticsearch.transport.TransportService; +import org.opensearch.OpenSearchStatusException; +import org.opensearch.action.ActionListener; +import org.opensearch.action.admin.indices.create.CreateIndexResponse; +import org.opensearch.action.admin.indices.mapping.get.GetFieldMappingsAction; +import org.opensearch.action.admin.indices.mapping.get.GetFieldMappingsRequest; +import org.opensearch.action.admin.indices.mapping.get.GetFieldMappingsResponse; +import org.opensearch.action.admin.indices.mapping.get.GetFieldMappingsResponse.FieldMappingMetadata; +import org.opensearch.action.get.GetRequest; +import org.opensearch.action.get.GetResponse; +import org.opensearch.action.index.IndexRequest; +import org.opensearch.action.index.IndexResponse; +import org.opensearch.action.search.SearchRequest; +import org.opensearch.action.search.SearchResponse; +import org.opensearch.action.support.IndicesOptions; +import org.opensearch.action.support.WriteRequest; +import org.opensearch.action.support.replication.ReplicationResponse; +import org.opensearch.client.Client; +import org.opensearch.cluster.service.ClusterService; +import org.opensearch.common.unit.TimeValue; +import org.opensearch.common.xcontent.NamedXContentRegistry; +import org.opensearch.common.xcontent.XContentFactory; +import org.opensearch.common.xcontent.XContentParser; +import org.opensearch.index.query.BoolQueryBuilder; +import org.opensearch.index.query.QueryBuilder; +import org.opensearch.index.query.QueryBuilders; +import org.opensearch.rest.RestRequest; +import org.opensearch.rest.RestStatus; +import org.opensearch.search.builder.SearchSourceBuilder; +import org.opensearch.transport.TransportService; import com.amazon.opendistroforelasticsearch.ad.constant.CommonName; import com.amazon.opendistroforelasticsearch.ad.indices.AnomalyDetectionIndices; @@ -196,7 +196,7 @@ private void prepareAnomalyDetectorIndexing() { logger.info("prepareAnomalyDetectorIndexing called after creating indices"); String error = RestHandlerUtils.validateAnomalyDetector(anomalyDetector, maxAnomalyFeatures); if (StringUtils.isNotBlank(error)) { - listener.onFailure(new ElasticsearchStatusException(error, RestStatus.BAD_REQUEST)); + listener.onFailure(new OpenSearchStatusException(error, RestStatus.BAD_REQUEST)); return; } if (method == RestRequest.Method.PUT) { @@ -217,8 +217,7 @@ private void updateAnomalyDetector(String detectorId) { private void onGetAnomalyDetectorResponse(GetResponse response) { if (!response.isExists()) { - listener - .onFailure(new ElasticsearchStatusException("AnomalyDetector is not found with id: " + detectorId, RestStatus.NOT_FOUND)); + listener.onFailure(new OpenSearchStatusException("AnomalyDetector is not found with id: " + detectorId, RestStatus.NOT_FOUND)); return; } try (XContentParser parser = RestHandlerUtils.createXContentParserFromRegistry(xContentRegistry, response.getSourceAsBytesRef())) { @@ -229,7 +228,7 @@ private void onGetAnomalyDetectorResponse(GetResponse response) { if (existingDetector.isRealTimeDetector() != anomalyDetector.isRealTimeDetector()) { listener .onFailure( - new ElasticsearchStatusException( + new OpenSearchStatusException( "Can't change detector type between realtime and historical detector", RestStatus.BAD_REQUEST ) @@ -243,7 +242,7 @@ private void onGetAnomalyDetectorResponse(GetResponse response) { adTaskManager.getLatestADTask(detectorId, (adTask) -> { if (adTask.isPresent() && !adTaskManager.isADTaskEnded(adTask.get())) { // can't update detector if there is AD task running - listener.onFailure(new ElasticsearchStatusException("Detector is running", RestStatus.INTERNAL_SERVER_ERROR)); + listener.onFailure(new OpenSearchStatusException("Detector is running", RestStatus.INTERNAL_SERVER_ERROR)); } else { // TODO: change to validateDetector method when we support HC historical detector searchAdInputIndices(detectorId); @@ -253,7 +252,7 @@ private void onGetAnomalyDetectorResponse(GetResponse response) { } catch (IOException e) { String message = "Failed to parse anomaly detector " + detectorId; logger.error(message, e); - listener.onFailure(new ElasticsearchStatusException(message, RestStatus.INTERNAL_SERVER_ERROR)); + listener.onFailure(new OpenSearchStatusException(message, RestStatus.INTERNAL_SERVER_ERROR)); } } @@ -354,10 +353,10 @@ private void validateCategoricalField(String detectorId) { ActionListener mappingsListener = ActionListener.wrap(getMappingsResponse -> { // example getMappingsResponse: // GetFieldMappingsResponse{mappings={server-metrics={_doc={service=FieldMappingMetadata{fullName='service', - // source=org.elasticsearch.common.bytes.BytesArray@7ba87dbd}}}}} + // source=org.opensearch.common.bytes.BytesArray@7ba87dbd}}}}} // for nested field, it would be // GetFieldMappingsResponse{mappings={server-metrics={_doc={host_nest.host2=FieldMappingMetadata{fullName='host_nest.host2', - // source=org.elasticsearch.common.bytes.BytesArray@8fb4de08}}}}} + // source=org.opensearch.common.bytes.BytesArray@8fb4de08}}}}} boolean foundField = false; Map>> mappingsByIndex = getMappingsResponse.mappings(); @@ -366,7 +365,7 @@ private void validateCategoricalField(String detectorId) { for (Map.Entry field2Metadata : mappingsByField.entrySet()) { // example output: // host_nest.host2=FieldMappingMetadata{fullName='host_nest.host2', - // source=org.elasticsearch.common.bytes.BytesArray@8fb4de08} + // source=org.opensearch.common.bytes.BytesArray@8fb4de08} FieldMappingMetadata fieldMetadata = field2Metadata.getValue(); if (fieldMetadata != null) { @@ -507,7 +506,7 @@ private void indexAnomalyDetector(String detectorId) throws IOException { public void onResponse(IndexResponse indexResponse) { String errorMsg = checkShardsFailure(indexResponse); if (errorMsg != null) { - listener.onFailure(new ElasticsearchStatusException(errorMsg, indexResponse.status())); + listener.onFailure(new OpenSearchStatusException(errorMsg, indexResponse.status())); return; } listener @@ -546,7 +545,7 @@ private void onCreateMappingsResponse(CreateIndexResponse response) throws IOExc logger.warn("Created {} with mappings call not acknowledged.", ANOMALY_DETECTORS_INDEX); listener .onFailure( - new ElasticsearchStatusException( + new OpenSearchStatusException( "Created " + ANOMALY_DETECTORS_INDEX + "with mappings call not acknowledged.", RestStatus.INTERNAL_SERVER_ERROR ) diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/rest/handler/IndexAnomalyDetectorJobActionHandler.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/rest/handler/IndexAnomalyDetectorJobActionHandler.java index a9e321064..78cf7562c 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/rest/handler/IndexAnomalyDetectorJobActionHandler.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/rest/handler/IndexAnomalyDetectorJobActionHandler.java @@ -17,9 +17,9 @@ import static com.amazon.opendistroforelasticsearch.ad.model.AnomalyDetector.ANOMALY_DETECTORS_INDEX; import static com.amazon.opendistroforelasticsearch.ad.util.ExceptionUtil.getShardsFailure; -import static org.elasticsearch.action.DocWriteResponse.Result.CREATED; -import static org.elasticsearch.action.DocWriteResponse.Result.UPDATED; -import static org.elasticsearch.common.xcontent.XContentParserUtils.ensureExpectedToken; +import static org.opensearch.action.DocWriteResponse.Result.CREATED; +import static org.opensearch.action.DocWriteResponse.Result.UPDATED; +import static org.opensearch.common.xcontent.XContentParserUtils.ensureExpectedToken; import java.io.IOException; import java.time.Duration; @@ -27,19 +27,19 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import org.elasticsearch.ElasticsearchStatusException; -import org.elasticsearch.action.ActionListener; -import org.elasticsearch.action.get.GetRequest; -import org.elasticsearch.action.get.GetResponse; -import org.elasticsearch.action.index.IndexRequest; -import org.elasticsearch.action.index.IndexResponse; -import org.elasticsearch.action.support.WriteRequest; -import org.elasticsearch.client.Client; -import org.elasticsearch.common.unit.TimeValue; -import org.elasticsearch.common.xcontent.NamedXContentRegistry; -import org.elasticsearch.common.xcontent.XContentFactory; -import org.elasticsearch.common.xcontent.XContentParser; -import org.elasticsearch.rest.RestStatus; +import org.opensearch.OpenSearchStatusException; +import org.opensearch.action.ActionListener; +import org.opensearch.action.get.GetRequest; +import org.opensearch.action.get.GetResponse; +import org.opensearch.action.index.IndexRequest; +import org.opensearch.action.index.IndexResponse; +import org.opensearch.action.support.WriteRequest; +import org.opensearch.client.Client; +import org.opensearch.common.unit.TimeValue; +import org.opensearch.common.xcontent.NamedXContentRegistry; +import org.opensearch.common.xcontent.XContentFactory; +import org.opensearch.common.xcontent.XContentParser; +import org.opensearch.rest.RestStatus; import com.amazon.opendistroforelasticsearch.ad.indices.AnomalyDetectionIndices; import com.amazon.opendistroforelasticsearch.ad.model.AnomalyDetector; @@ -117,7 +117,7 @@ public void startAnomalyDetectorJob(AnomalyDetector detector) { logger.warn("Created {} with mappings call not acknowledged.", ANOMALY_DETECTORS_INDEX); listener .onFailure( - new ElasticsearchStatusException( + new OpenSearchStatusException( "Created " + ANOMALY_DETECTORS_INDEX + " with mappings call not acknowledged.", RestStatus.INTERNAL_SERVER_ERROR ) @@ -151,7 +151,7 @@ private void createJob(AnomalyDetector detector) { } catch (Exception e) { String message = "Failed to parse anomaly detector job " + detectorId; logger.error(message, e); - listener.onFailure(new ElasticsearchStatusException(message, RestStatus.INTERNAL_SERVER_ERROR)); + listener.onFailure(new OpenSearchStatusException(message, RestStatus.INTERNAL_SERVER_ERROR)); } } @@ -174,9 +174,7 @@ private void onGetAnomalyDetectorJobForWrite(GetResponse response, AnomalyDetect AnomalyDetectorJob currentAdJob = AnomalyDetectorJob.parse(parser); if (currentAdJob.isEnabled()) { listener - .onFailure( - new ElasticsearchStatusException("Anomaly detector job is already running: " + detectorId, RestStatus.OK) - ); + .onFailure(new OpenSearchStatusException("Anomaly detector job is already running: " + detectorId, RestStatus.OK)); return; } else { AnomalyDetectorJob newJob = new AnomalyDetectorJob( @@ -195,7 +193,7 @@ private void onGetAnomalyDetectorJobForWrite(GetResponse response, AnomalyDetect } catch (IOException e) { String message = "Failed to parse anomaly detector job " + job.getName(); logger.error(message, e); - listener.onFailure(new ElasticsearchStatusException(message, RestStatus.INTERNAL_SERVER_ERROR)); + listener.onFailure(new OpenSearchStatusException(message, RestStatus.INTERNAL_SERVER_ERROR)); } } else { indexAnomalyDetectorJob(job, null); @@ -221,7 +219,7 @@ private void indexAnomalyDetectorJob(AnomalyDetectorJob job, AnomalyDetectorFunc private void onIndexAnomalyDetectorJobResponse(IndexResponse response, AnomalyDetectorFunction function) throws IOException { if (response == null || (response.getResult() != CREATED && response.getResult() != UPDATED)) { String errorMsg = getShardsFailure(response); - listener.onFailure(new ElasticsearchStatusException(errorMsg, response.status())); + listener.onFailure(new OpenSearchStatusException(errorMsg, response.status())); return; } if (function != null) { @@ -259,7 +257,7 @@ public void stopAnomalyDetectorJob(String detectorId) { if (!job.isEnabled()) { listener .onFailure( - new ElasticsearchStatusException("Anomaly detector job is already stopped: " + detectorId, RestStatus.OK) + new OpenSearchStatusException("Anomaly detector job is already stopped: " + detectorId, RestStatus.OK) ); return; } else { @@ -287,11 +285,10 @@ public void stopAnomalyDetectorJob(String detectorId) { } catch (IOException e) { String message = "Failed to parse anomaly detector job " + detectorId; logger.error(message, e); - listener.onFailure(new ElasticsearchStatusException(message, RestStatus.INTERNAL_SERVER_ERROR)); + listener.onFailure(new OpenSearchStatusException(message, RestStatus.INTERNAL_SERVER_ERROR)); } } else { - listener - .onFailure(new ElasticsearchStatusException("Anomaly detector job not exist: " + detectorId, RestStatus.BAD_REQUEST)); + listener.onFailure(new OpenSearchStatusException("Anomaly detector job not exist: " + detectorId, RestStatus.BAD_REQUEST)); } }, exception -> listener.onFailure(exception))); } @@ -312,7 +309,7 @@ public void onResponse(StopDetectorResponse stopDetectorResponse) { listener.onResponse(anomalyDetectorJobResponse); } else { logger.error("Failed to delete AD model for detector {}", detectorId); - listener.onFailure(new ElasticsearchStatusException("Failed to delete AD model", RestStatus.INTERNAL_SERVER_ERROR)); + listener.onFailure(new OpenSearchStatusException("Failed to delete AD model", RestStatus.INTERNAL_SERVER_ERROR)); } } @@ -320,9 +317,7 @@ public void onResponse(StopDetectorResponse stopDetectorResponse) { public void onFailure(Exception e) { logger.error("Failed to delete AD model for detector " + detectorId, e); listener - .onFailure( - new ElasticsearchStatusException("Failed to execute stop detector action", RestStatus.INTERNAL_SERVER_ERROR) - ); + .onFailure(new OpenSearchStatusException("Failed to execute stop detector action", RestStatus.INTERNAL_SERVER_ERROR)); } }; } diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/settings/AnomalyDetectorSettings.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/settings/AnomalyDetectorSettings.java index ea30e5f61..9545628eb 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/settings/AnomalyDetectorSettings.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/settings/AnomalyDetectorSettings.java @@ -17,8 +17,8 @@ import java.time.Duration; -import org.elasticsearch.common.settings.Setting; -import org.elasticsearch.common.unit.TimeValue; +import org.opensearch.common.settings.Setting; +import org.opensearch.common.unit.TimeValue; /** * AD plugin settings. diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/settings/EnabledSetting.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/settings/EnabledSetting.java index 0d56a5b07..028067d04 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/settings/EnabledSetting.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/settings/EnabledSetting.java @@ -16,8 +16,8 @@ package com.amazon.opendistroforelasticsearch.ad.settings; import static java.util.Collections.unmodifiableMap; -import static org.elasticsearch.common.settings.Setting.Property.Dynamic; -import static org.elasticsearch.common.settings.Setting.Property.NodeScope; +import static org.opensearch.common.settings.Setting.Property.Dynamic; +import static org.opensearch.common.settings.Setting.Property.NodeScope; import java.util.ArrayList; import java.util.HashMap; @@ -27,9 +27,9 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import org.elasticsearch.cluster.service.ClusterService; -import org.elasticsearch.common.settings.Setting; -import org.elasticsearch.common.settings.Settings; +import org.opensearch.cluster.service.ClusterService; +import org.opensearch.common.settings.Setting; +import org.opensearch.common.settings.Settings; public class EnabledSetting { diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/stats/ADStatsResponse.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/stats/ADStatsResponse.java index 223342368..137f9c19b 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/stats/ADStatsResponse.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/stats/ADStatsResponse.java @@ -21,11 +21,11 @@ import org.apache.commons.lang.builder.EqualsBuilder; import org.apache.commons.lang.builder.HashCodeBuilder; import org.apache.commons.lang.builder.ToStringBuilder; -import org.elasticsearch.common.io.stream.StreamInput; -import org.elasticsearch.common.io.stream.StreamOutput; -import org.elasticsearch.common.xcontent.ToXContent; -import org.elasticsearch.common.xcontent.ToXContentObject; -import org.elasticsearch.common.xcontent.XContentBuilder; +import org.opensearch.common.io.stream.StreamInput; +import org.opensearch.common.io.stream.StreamOutput; +import org.opensearch.common.xcontent.ToXContent; +import org.opensearch.common.xcontent.ToXContentObject; +import org.opensearch.common.xcontent.XContentBuilder; import com.amazon.opendistroforelasticsearch.ad.model.Mergeable; import com.amazon.opendistroforelasticsearch.ad.transport.ADStatsNodesResponse; diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/task/ADBatchTaskRunner.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/task/ADBatchTaskRunner.java index be6d8ef36..3dee47d16 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/task/ADBatchTaskRunner.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/task/ADBatchTaskRunner.java @@ -45,22 +45,22 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import org.elasticsearch.action.ActionListener; -import org.elasticsearch.action.ActionListenerResponseHandler; -import org.elasticsearch.action.search.SearchRequest; -import org.elasticsearch.action.support.ThreadedActionListener; -import org.elasticsearch.client.Client; -import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver; -import org.elasticsearch.cluster.node.DiscoveryNode; -import org.elasticsearch.cluster.service.ClusterService; -import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.search.aggregations.AggregationBuilders; -import org.elasticsearch.search.aggregations.metrics.InternalMax; -import org.elasticsearch.search.aggregations.metrics.InternalMin; -import org.elasticsearch.search.builder.SearchSourceBuilder; -import org.elasticsearch.threadpool.ThreadPool; -import org.elasticsearch.transport.TransportRequestOptions; -import org.elasticsearch.transport.TransportService; +import org.opensearch.action.ActionListener; +import org.opensearch.action.ActionListenerResponseHandler; +import org.opensearch.action.search.SearchRequest; +import org.opensearch.action.support.ThreadedActionListener; +import org.opensearch.client.Client; +import org.opensearch.cluster.metadata.IndexNameExpressionResolver; +import org.opensearch.cluster.node.DiscoveryNode; +import org.opensearch.cluster.service.ClusterService; +import org.opensearch.common.settings.Settings; +import org.opensearch.search.aggregations.AggregationBuilders; +import org.opensearch.search.aggregations.metrics.InternalMax; +import org.opensearch.search.aggregations.metrics.InternalMin; +import org.opensearch.search.builder.SearchSourceBuilder; +import org.opensearch.threadpool.ThreadPool; +import org.opensearch.transport.TransportRequestOptions; +import org.opensearch.transport.TransportService; import com.amazon.opendistroforelasticsearch.ad.breaker.ADCircuitBreakerService; import com.amazon.opendistroforelasticsearch.ad.common.exception.ADTaskCancelledException; diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/task/ADTaskCacheManager.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/task/ADTaskCacheManager.java index 7b0ca5115..dd20508cd 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/task/ADTaskCacheManager.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/task/ADTaskCacheManager.java @@ -34,9 +34,9 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import org.elasticsearch.cluster.service.ClusterService; -import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.common.util.set.Sets; +import org.opensearch.cluster.service.ClusterService; +import org.opensearch.common.settings.Settings; +import org.opensearch.common.util.set.Sets; import com.amazon.opendistroforelasticsearch.ad.MemoryTracker; import com.amazon.opendistroforelasticsearch.ad.common.exception.DuplicateTaskException; diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/task/ADTaskManager.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/task/ADTaskManager.java index 90a74fa7c..07b251cfd 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/task/ADTaskManager.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/task/ADTaskManager.java @@ -29,8 +29,8 @@ import static com.amazon.opendistroforelasticsearch.ad.settings.AnomalyDetectorSettings.REQUEST_TIMEOUT; import static com.amazon.opendistroforelasticsearch.ad.util.ExceptionUtil.getErrorMessage; import static com.amazon.opendistroforelasticsearch.ad.util.ExceptionUtil.getShardsFailure; -import static org.elasticsearch.action.DocWriteResponse.Result.CREATED; -import static org.elasticsearch.common.xcontent.XContentParserUtils.ensureExpectedToken; +import static org.opensearch.action.DocWriteResponse.Result.CREATED; +import static org.opensearch.common.xcontent.XContentParserUtils.ensureExpectedToken; import java.time.Instant; import java.time.temporal.ChronoUnit; @@ -45,45 +45,45 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import org.elasticsearch.ElasticsearchStatusException; -import org.elasticsearch.ExceptionsHelper; -import org.elasticsearch.ResourceAlreadyExistsException; -import org.elasticsearch.action.ActionListener; -import org.elasticsearch.action.ActionListenerResponseHandler; -import org.elasticsearch.action.bulk.BulkItemResponse; -import org.elasticsearch.action.delete.DeleteRequest; -import org.elasticsearch.action.delete.DeleteResponse; -import org.elasticsearch.action.get.GetRequest; -import org.elasticsearch.action.index.IndexRequest; -import org.elasticsearch.action.index.IndexResponse; -import org.elasticsearch.action.search.SearchRequest; -import org.elasticsearch.action.support.WriteRequest; -import org.elasticsearch.action.update.UpdateRequest; -import org.elasticsearch.action.update.UpdateResponse; -import org.elasticsearch.client.Client; -import org.elasticsearch.cluster.node.DiscoveryNode; -import org.elasticsearch.cluster.service.ClusterService; -import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.common.unit.TimeValue; -import org.elasticsearch.common.xcontent.NamedXContentRegistry; -import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentFactory; -import org.elasticsearch.common.xcontent.XContentParser; -import org.elasticsearch.index.IndexNotFoundException; -import org.elasticsearch.index.query.BoolQueryBuilder; -import org.elasticsearch.index.query.RangeQueryBuilder; -import org.elasticsearch.index.query.TermQueryBuilder; -import org.elasticsearch.index.reindex.DeleteByQueryAction; -import org.elasticsearch.index.reindex.DeleteByQueryRequest; -import org.elasticsearch.index.reindex.UpdateByQueryAction; -import org.elasticsearch.index.reindex.UpdateByQueryRequest; -import org.elasticsearch.rest.RestStatus; -import org.elasticsearch.script.Script; -import org.elasticsearch.search.SearchHit; -import org.elasticsearch.search.builder.SearchSourceBuilder; -import org.elasticsearch.search.sort.SortOrder; -import org.elasticsearch.transport.TransportRequestOptions; -import org.elasticsearch.transport.TransportService; +import org.opensearch.ExceptionsHelper; +import org.opensearch.OpenSearchStatusException; +import org.opensearch.ResourceAlreadyExistsException; +import org.opensearch.action.ActionListener; +import org.opensearch.action.ActionListenerResponseHandler; +import org.opensearch.action.bulk.BulkItemResponse; +import org.opensearch.action.delete.DeleteRequest; +import org.opensearch.action.delete.DeleteResponse; +import org.opensearch.action.get.GetRequest; +import org.opensearch.action.index.IndexRequest; +import org.opensearch.action.index.IndexResponse; +import org.opensearch.action.search.SearchRequest; +import org.opensearch.action.support.WriteRequest; +import org.opensearch.action.update.UpdateRequest; +import org.opensearch.action.update.UpdateResponse; +import org.opensearch.client.Client; +import org.opensearch.cluster.node.DiscoveryNode; +import org.opensearch.cluster.service.ClusterService; +import org.opensearch.common.settings.Settings; +import org.opensearch.common.unit.TimeValue; +import org.opensearch.common.xcontent.NamedXContentRegistry; +import org.opensearch.common.xcontent.XContentBuilder; +import org.opensearch.common.xcontent.XContentFactory; +import org.opensearch.common.xcontent.XContentParser; +import org.opensearch.index.IndexNotFoundException; +import org.opensearch.index.query.BoolQueryBuilder; +import org.opensearch.index.query.RangeQueryBuilder; +import org.opensearch.index.query.TermQueryBuilder; +import org.opensearch.index.reindex.DeleteByQueryAction; +import org.opensearch.index.reindex.DeleteByQueryRequest; +import org.opensearch.index.reindex.UpdateByQueryAction; +import org.opensearch.index.reindex.UpdateByQueryRequest; +import org.opensearch.rest.RestStatus; +import org.opensearch.script.Script; +import org.opensearch.search.SearchHit; +import org.opensearch.search.builder.SearchSourceBuilder; +import org.opensearch.search.sort.SortOrder; +import org.opensearch.transport.TransportRequestOptions; +import org.opensearch.transport.TransportService; import com.amazon.opendistroforelasticsearch.ad.cluster.HashRing; import com.amazon.opendistroforelasticsearch.ad.common.exception.ADTaskCancelledException; @@ -192,8 +192,7 @@ public void startDetector( Optional owningNode = hashRing.getOwningNode(detector.getDetectorId()); if (!owningNode.isPresent()) { logger.debug("Can't find eligible node to run as AD task's coordinating node"); - listener - .onFailure(new ElasticsearchStatusException("No eligible node to run detector", RestStatus.INTERNAL_SERVER_ERROR)); + listener.onFailure(new OpenSearchStatusException("No eligible node to run detector", RestStatus.INTERNAL_SERVER_ERROR)); return; } forwardToCoordinatingNode(detector, user, ADTaskAction.START, transportService, owningNode.get(), listener); @@ -286,7 +285,7 @@ public void getDetector( GetRequest getRequest = new GetRequest(AnomalyDetector.ANOMALY_DETECTORS_INDEX).id(detectorId); client.get(getRequest, ActionListener.wrap(response -> { if (!response.isExists()) { - listener.onFailure(new ElasticsearchStatusException("AnomalyDetector is not found", RestStatus.NOT_FOUND)); + listener.onFailure(new OpenSearchStatusException("AnomalyDetector is not found", RestStatus.NOT_FOUND)); return; } try ( @@ -305,7 +304,7 @@ public void getDetector( } catch (Exception e) { String message = "Failed to start anomaly detector " + detectorId; logger.error(message, e); - listener.onFailure(new ElasticsearchStatusException(message, RestStatus.INTERNAL_SERVER_ERROR)); + listener.onFailure(new OpenSearchStatusException(message, RestStatus.INTERNAL_SERVER_ERROR)); } }, exception -> listener.onFailure(exception))); } @@ -372,7 +371,7 @@ public void getLatestADTask( } catch (Exception e) { String message = "Failed to parse AD task for detector " + detectorId; logger.error(message, e); - listener.onFailure(new ElasticsearchStatusException(message, RestStatus.INTERNAL_SERVER_ERROR)); + listener.onFailure(new OpenSearchStatusException(message, RestStatus.INTERNAL_SERVER_ERROR)); } }, e -> { if (e instanceof IndexNotFoundException) { @@ -599,7 +598,7 @@ private boolean validateDetector(AnomalyDetector detector, ActionListener { if (ExceptionsHelper.unwrapCause(e) instanceof ResourceAlreadyExistsException) { @@ -737,14 +736,14 @@ private void onIndexADTaskResponse( ) { if (response == null || response.getResult() != CREATED) { String errorMsg = getShardsFailure(response); - listener.onFailure(new ElasticsearchStatusException(errorMsg, response.status())); + listener.onFailure(new OpenSearchStatusException(errorMsg, response.status())); return; } adTask.setTaskId(response.getId()); ActionListener delegatedListener = ActionListener.wrap(r -> { listener.onResponse(r); }, e -> { handleADTaskException(adTask, e); if (e instanceof DuplicateTaskException) { - listener.onFailure(new ElasticsearchStatusException(DETECTOR_IS_RUNNING, RestStatus.BAD_REQUEST)); + listener.onFailure(new OpenSearchStatusException(DETECTOR_IS_RUNNING, RestStatus.BAD_REQUEST)); } else { listener.onFailure(e); adTaskCacheManager.removeDetector(adTask.getDetectorId()); diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ADBatchAnomalyResultAction.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ADBatchAnomalyResultAction.java index 22d264454..c1e28c46e 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ADBatchAnomalyResultAction.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ADBatchAnomalyResultAction.java @@ -17,7 +17,7 @@ import static com.amazon.opendistroforelasticsearch.ad.constant.CommonName.AD_TASK; -import org.elasticsearch.action.ActionType; +import org.opensearch.action.ActionType; import com.amazon.opendistroforelasticsearch.ad.constant.CommonValue; diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ADBatchAnomalyResultRequest.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ADBatchAnomalyResultRequest.java index 4d8e07a37..f3307c186 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ADBatchAnomalyResultRequest.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ADBatchAnomalyResultRequest.java @@ -15,15 +15,15 @@ package com.amazon.opendistroforelasticsearch.ad.transport; -import static org.elasticsearch.action.ValidateActions.addValidationError; +import static org.opensearch.action.ValidateActions.addValidationError; import java.io.IOException; -import org.elasticsearch.action.ActionRequest; -import org.elasticsearch.action.ActionRequestValidationException; -import org.elasticsearch.common.Strings; -import org.elasticsearch.common.io.stream.StreamInput; -import org.elasticsearch.common.io.stream.StreamOutput; +import org.opensearch.action.ActionRequest; +import org.opensearch.action.ActionRequestValidationException; +import org.opensearch.common.Strings; +import org.opensearch.common.io.stream.StreamInput; +import org.opensearch.common.io.stream.StreamOutput; import com.amazon.opendistroforelasticsearch.ad.model.ADTask; import com.amazon.opendistroforelasticsearch.ad.model.AnomalyDetector; diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ADBatchAnomalyResultResponse.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ADBatchAnomalyResultResponse.java index f3281dceb..45f92016c 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ADBatchAnomalyResultResponse.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ADBatchAnomalyResultResponse.java @@ -17,9 +17,9 @@ import java.io.IOException; -import org.elasticsearch.action.ActionResponse; -import org.elasticsearch.common.io.stream.StreamInput; -import org.elasticsearch.common.io.stream.StreamOutput; +import org.opensearch.action.ActionResponse; +import org.opensearch.common.io.stream.StreamInput; +import org.opensearch.common.io.stream.StreamOutput; public class ADBatchAnomalyResultResponse extends ActionResponse { public String nodeId; diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ADBatchAnomalyResultTransportAction.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ADBatchAnomalyResultTransportAction.java index 231b34a37..01c442949 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ADBatchAnomalyResultTransportAction.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ADBatchAnomalyResultTransportAction.java @@ -15,12 +15,12 @@ package com.amazon.opendistroforelasticsearch.ad.transport; -import org.elasticsearch.action.ActionListener; -import org.elasticsearch.action.support.ActionFilters; -import org.elasticsearch.action.support.HandledTransportAction; -import org.elasticsearch.common.inject.Inject; -import org.elasticsearch.tasks.Task; -import org.elasticsearch.transport.TransportService; +import org.opensearch.action.ActionListener; +import org.opensearch.action.support.ActionFilters; +import org.opensearch.action.support.HandledTransportAction; +import org.opensearch.common.inject.Inject; +import org.opensearch.tasks.Task; +import org.opensearch.transport.TransportService; import com.amazon.opendistroforelasticsearch.ad.task.ADBatchTaskRunner; diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ADBatchTaskRemoteExecutionAction.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ADBatchTaskRemoteExecutionAction.java index ae6ee4a67..f68afecd9 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ADBatchTaskRemoteExecutionAction.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ADBatchTaskRemoteExecutionAction.java @@ -17,7 +17,7 @@ import static com.amazon.opendistroforelasticsearch.ad.constant.CommonName.AD_TASK_REMOTE; -import org.elasticsearch.action.ActionType; +import org.opensearch.action.ActionType; import com.amazon.opendistroforelasticsearch.ad.constant.CommonValue; diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ADBatchTaskRemoteExecutionTransportAction.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ADBatchTaskRemoteExecutionTransportAction.java index f743e73a3..efe89f0c3 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ADBatchTaskRemoteExecutionTransportAction.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ADBatchTaskRemoteExecutionTransportAction.java @@ -15,12 +15,12 @@ package com.amazon.opendistroforelasticsearch.ad.transport; -import org.elasticsearch.action.ActionListener; -import org.elasticsearch.action.support.ActionFilters; -import org.elasticsearch.action.support.HandledTransportAction; -import org.elasticsearch.common.inject.Inject; -import org.elasticsearch.tasks.Task; -import org.elasticsearch.transport.TransportService; +import org.opensearch.action.ActionListener; +import org.opensearch.action.support.ActionFilters; +import org.opensearch.action.support.HandledTransportAction; +import org.opensearch.common.inject.Inject; +import org.opensearch.tasks.Task; +import org.opensearch.transport.TransportService; import com.amazon.opendistroforelasticsearch.ad.task.ADBatchTaskRunner; diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ADCancelTaskAction.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ADCancelTaskAction.java index 572ae1db4..4767cfd01 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ADCancelTaskAction.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ADCancelTaskAction.java @@ -17,7 +17,7 @@ import static com.amazon.opendistroforelasticsearch.ad.constant.CommonName.CANCEL_TASK; -import org.elasticsearch.action.ActionType; +import org.opensearch.action.ActionType; import com.amazon.opendistroforelasticsearch.ad.constant.CommonValue; diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ADCancelTaskNodeRequest.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ADCancelTaskNodeRequest.java index 41e2f7e7e..09eef4078 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ADCancelTaskNodeRequest.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ADCancelTaskNodeRequest.java @@ -17,9 +17,9 @@ import java.io.IOException; -import org.elasticsearch.action.support.nodes.BaseNodeRequest; -import org.elasticsearch.common.io.stream.StreamInput; -import org.elasticsearch.common.io.stream.StreamOutput; +import org.opensearch.action.support.nodes.BaseNodeRequest; +import org.opensearch.common.io.stream.StreamInput; +import org.opensearch.common.io.stream.StreamOutput; public class ADCancelTaskNodeRequest extends BaseNodeRequest { private String detectorId; diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ADCancelTaskNodeResponse.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ADCancelTaskNodeResponse.java index c72cdbff7..9448a5bdd 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ADCancelTaskNodeResponse.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ADCancelTaskNodeResponse.java @@ -17,10 +17,10 @@ import java.io.IOException; -import org.elasticsearch.action.support.nodes.BaseNodeResponse; -import org.elasticsearch.cluster.node.DiscoveryNode; -import org.elasticsearch.common.io.stream.StreamInput; -import org.elasticsearch.common.io.stream.StreamOutput; +import org.opensearch.action.support.nodes.BaseNodeResponse; +import org.opensearch.cluster.node.DiscoveryNode; +import org.opensearch.common.io.stream.StreamInput; +import org.opensearch.common.io.stream.StreamOutput; import com.amazon.opendistroforelasticsearch.ad.task.ADTaskCancellationState; diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ADCancelTaskRequest.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ADCancelTaskRequest.java index 7b4940830..74228bd8f 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ADCancelTaskRequest.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ADCancelTaskRequest.java @@ -15,16 +15,16 @@ package com.amazon.opendistroforelasticsearch.ad.transport; -import static org.elasticsearch.action.ValidateActions.addValidationError; +import static org.opensearch.action.ValidateActions.addValidationError; import java.io.IOException; -import org.elasticsearch.action.ActionRequestValidationException; -import org.elasticsearch.action.support.nodes.BaseNodesRequest; -import org.elasticsearch.cluster.node.DiscoveryNode; -import org.elasticsearch.common.Strings; -import org.elasticsearch.common.io.stream.StreamInput; -import org.elasticsearch.common.io.stream.StreamOutput; +import org.opensearch.action.ActionRequestValidationException; +import org.opensearch.action.support.nodes.BaseNodesRequest; +import org.opensearch.cluster.node.DiscoveryNode; +import org.opensearch.common.Strings; +import org.opensearch.common.io.stream.StreamInput; +import org.opensearch.common.io.stream.StreamOutput; import com.amazon.opendistroforelasticsearch.ad.constant.CommonErrorMessages; diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ADCancelTaskResponse.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ADCancelTaskResponse.java index c54b370b8..dd3e268a4 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ADCancelTaskResponse.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ADCancelTaskResponse.java @@ -18,11 +18,11 @@ import java.io.IOException; import java.util.List; -import org.elasticsearch.action.FailedNodeException; -import org.elasticsearch.action.support.nodes.BaseNodesResponse; -import org.elasticsearch.cluster.ClusterName; -import org.elasticsearch.common.io.stream.StreamInput; -import org.elasticsearch.common.io.stream.StreamOutput; +import org.opensearch.action.FailedNodeException; +import org.opensearch.action.support.nodes.BaseNodesResponse; +import org.opensearch.cluster.ClusterName; +import org.opensearch.common.io.stream.StreamInput; +import org.opensearch.common.io.stream.StreamOutput; public class ADCancelTaskResponse extends BaseNodesResponse { diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ADCancelTaskTransportAction.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ADCancelTaskTransportAction.java index dbc118534..84e3b5df6 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ADCancelTaskTransportAction.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ADCancelTaskTransportAction.java @@ -20,15 +20,15 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import org.elasticsearch.action.FailedNodeException; -import org.elasticsearch.action.support.ActionFilters; -import org.elasticsearch.action.support.nodes.TransportNodesAction; -import org.elasticsearch.client.Client; -import org.elasticsearch.cluster.service.ClusterService; -import org.elasticsearch.common.inject.Inject; -import org.elasticsearch.common.io.stream.StreamInput; -import org.elasticsearch.threadpool.ThreadPool; -import org.elasticsearch.transport.TransportService; +import org.opensearch.action.FailedNodeException; +import org.opensearch.action.support.ActionFilters; +import org.opensearch.action.support.nodes.TransportNodesAction; +import org.opensearch.client.Client; +import org.opensearch.cluster.service.ClusterService; +import org.opensearch.common.inject.Inject; +import org.opensearch.common.io.stream.StreamInput; +import org.opensearch.threadpool.ThreadPool; +import org.opensearch.transport.TransportService; import com.amazon.opendistroforelasticsearch.ad.task.ADTaskCancellationState; import com.amazon.opendistroforelasticsearch.ad.task.ADTaskManager; diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ADResultBulkAction.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ADResultBulkAction.java index fe68d80b2..acf42bfc0 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ADResultBulkAction.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ADResultBulkAction.java @@ -15,10 +15,10 @@ package com.amazon.opendistroforelasticsearch.ad.transport; -import org.elasticsearch.action.ActionType; -import org.elasticsearch.action.bulk.BulkResponse; -import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.transport.TransportRequestOptions; +import org.opensearch.action.ActionType; +import org.opensearch.action.bulk.BulkResponse; +import org.opensearch.common.settings.Settings; +import org.opensearch.transport.TransportRequestOptions; import com.amazon.opendistroforelasticsearch.ad.constant.CommonValue; diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ADResultBulkRequest.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ADResultBulkRequest.java index e0be09db7..e3671470b 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ADResultBulkRequest.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ADResultBulkRequest.java @@ -19,12 +19,12 @@ import java.util.ArrayList; import java.util.List; -import org.elasticsearch.action.ActionRequest; -import org.elasticsearch.action.ActionRequestValidationException; -import org.elasticsearch.action.ValidateActions; -import org.elasticsearch.common.io.stream.StreamInput; -import org.elasticsearch.common.io.stream.StreamOutput; -import org.elasticsearch.common.io.stream.Writeable; +import org.opensearch.action.ActionRequest; +import org.opensearch.action.ActionRequestValidationException; +import org.opensearch.action.ValidateActions; +import org.opensearch.common.io.stream.StreamInput; +import org.opensearch.common.io.stream.StreamOutput; +import org.opensearch.common.io.stream.Writeable; import com.amazon.opendistroforelasticsearch.ad.model.AnomalyResult; diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ADResultBulkTransportAction.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ADResultBulkTransportAction.java index a072b6a69..d1657925e 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ADResultBulkTransportAction.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ADResultBulkTransportAction.java @@ -16,8 +16,8 @@ package com.amazon.opendistroforelasticsearch.ad.transport; import static com.amazon.opendistroforelasticsearch.ad.settings.AnomalyDetectorSettings.INDEX_PRESSURE_SOFT_LIMIT; -import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder; -import static org.elasticsearch.index.IndexingPressure.MAX_INDEXING_BYTES; +import static org.opensearch.common.xcontent.XContentFactory.jsonBuilder; +import static org.opensearch.index.IndexingPressure.MAX_INDEXING_BYTES; import java.io.IOException; import java.util.Locale; @@ -25,22 +25,22 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import org.elasticsearch.action.ActionListener; -import org.elasticsearch.action.bulk.BulkAction; -import org.elasticsearch.action.bulk.BulkRequest; -import org.elasticsearch.action.bulk.BulkResponse; -import org.elasticsearch.action.index.IndexRequest; -import org.elasticsearch.action.support.ActionFilters; -import org.elasticsearch.action.support.HandledTransportAction; -import org.elasticsearch.client.Client; -import org.elasticsearch.cluster.service.ClusterService; -import org.elasticsearch.common.inject.Inject; -import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.index.IndexingPressure; -import org.elasticsearch.tasks.Task; -import org.elasticsearch.threadpool.ThreadPool; -import org.elasticsearch.transport.TransportService; +import org.opensearch.action.ActionListener; +import org.opensearch.action.bulk.BulkAction; +import org.opensearch.action.bulk.BulkRequest; +import org.opensearch.action.bulk.BulkResponse; +import org.opensearch.action.index.IndexRequest; +import org.opensearch.action.support.ActionFilters; +import org.opensearch.action.support.HandledTransportAction; +import org.opensearch.client.Client; +import org.opensearch.cluster.service.ClusterService; +import org.opensearch.common.inject.Inject; +import org.opensearch.common.settings.Settings; +import org.opensearch.common.xcontent.XContentBuilder; +import org.opensearch.index.IndexingPressure; +import org.opensearch.tasks.Task; +import org.opensearch.threadpool.ThreadPool; +import org.opensearch.transport.TransportService; import com.amazon.opendistroforelasticsearch.ad.constant.CommonName; import com.amazon.opendistroforelasticsearch.ad.model.AnomalyResult; diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ADStatsNodeRequest.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ADStatsNodeRequest.java index 6a7a7d679..cfc7cb594 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ADStatsNodeRequest.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ADStatsNodeRequest.java @@ -17,9 +17,9 @@ import java.io.IOException; -import org.elasticsearch.action.support.nodes.BaseNodeRequest; -import org.elasticsearch.common.io.stream.StreamInput; -import org.elasticsearch.common.io.stream.StreamOutput; +import org.opensearch.action.support.nodes.BaseNodeRequest; +import org.opensearch.common.io.stream.StreamInput; +import org.opensearch.common.io.stream.StreamOutput; /** * ADStatsNodeRequest to get a nodes stat diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ADStatsNodeResponse.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ADStatsNodeResponse.java index 10bbb57ed..95e48e512 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ADStatsNodeResponse.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ADStatsNodeResponse.java @@ -18,12 +18,12 @@ import java.io.IOException; import java.util.Map; -import org.elasticsearch.action.support.nodes.BaseNodeResponse; -import org.elasticsearch.cluster.node.DiscoveryNode; -import org.elasticsearch.common.io.stream.StreamInput; -import org.elasticsearch.common.io.stream.StreamOutput; -import org.elasticsearch.common.xcontent.ToXContentFragment; -import org.elasticsearch.common.xcontent.XContentBuilder; +import org.opensearch.action.support.nodes.BaseNodeResponse; +import org.opensearch.cluster.node.DiscoveryNode; +import org.opensearch.common.io.stream.StreamInput; +import org.opensearch.common.io.stream.StreamOutput; +import org.opensearch.common.xcontent.ToXContentFragment; +import org.opensearch.common.xcontent.XContentBuilder; /** * ADStatsNodeResponse diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ADStatsNodesAction.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ADStatsNodesAction.java index 62db39efa..73dcc21c3 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ADStatsNodesAction.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ADStatsNodesAction.java @@ -15,7 +15,7 @@ package com.amazon.opendistroforelasticsearch.ad.transport; -import org.elasticsearch.action.ActionType; +import org.opensearch.action.ActionType; import com.amazon.opendistroforelasticsearch.ad.constant.CommonValue; diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ADStatsNodesResponse.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ADStatsNodesResponse.java index de4e523aa..346359184 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ADStatsNodesResponse.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ADStatsNodesResponse.java @@ -18,14 +18,14 @@ import java.io.IOException; import java.util.List; -import org.elasticsearch.action.FailedNodeException; -import org.elasticsearch.action.support.nodes.BaseNodesResponse; -import org.elasticsearch.cluster.ClusterName; -import org.elasticsearch.cluster.node.DiscoveryNode; -import org.elasticsearch.common.io.stream.StreamInput; -import org.elasticsearch.common.io.stream.StreamOutput; -import org.elasticsearch.common.xcontent.ToXContentObject; -import org.elasticsearch.common.xcontent.XContentBuilder; +import org.opensearch.action.FailedNodeException; +import org.opensearch.action.support.nodes.BaseNodesResponse; +import org.opensearch.cluster.ClusterName; +import org.opensearch.cluster.node.DiscoveryNode; +import org.opensearch.common.io.stream.StreamInput; +import org.opensearch.common.io.stream.StreamOutput; +import org.opensearch.common.xcontent.ToXContentObject; +import org.opensearch.common.xcontent.XContentBuilder; /** * ADStatsNodesResponse consists of the aggregated responses from the nodes diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ADStatsNodesTransportAction.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ADStatsNodesTransportAction.java index 5abd61838..04cbf0715 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ADStatsNodesTransportAction.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ADStatsNodesTransportAction.java @@ -21,15 +21,15 @@ import java.util.Map; import java.util.Set; -import org.elasticsearch.action.FailedNodeException; -import org.elasticsearch.action.support.ActionFilters; -import org.elasticsearch.action.support.nodes.TransportNodesAction; -import org.elasticsearch.cluster.service.ClusterService; -import org.elasticsearch.common.inject.Inject; -import org.elasticsearch.common.io.stream.StreamInput; -import org.elasticsearch.monitor.jvm.JvmService; -import org.elasticsearch.threadpool.ThreadPool; -import org.elasticsearch.transport.TransportService; +import org.opensearch.action.FailedNodeException; +import org.opensearch.action.support.ActionFilters; +import org.opensearch.action.support.nodes.TransportNodesAction; +import org.opensearch.cluster.service.ClusterService; +import org.opensearch.common.inject.Inject; +import org.opensearch.common.io.stream.StreamInput; +import org.opensearch.monitor.jvm.JvmService; +import org.opensearch.threadpool.ThreadPool; +import org.opensearch.transport.TransportService; import com.amazon.opendistroforelasticsearch.ad.stats.ADStats; import com.amazon.opendistroforelasticsearch.ad.stats.InternalStatNames; diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ADStatsRequest.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ADStatsRequest.java index 5db717d06..88d4e79da 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ADStatsRequest.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ADStatsRequest.java @@ -19,10 +19,10 @@ import java.util.HashSet; import java.util.Set; -import org.elasticsearch.action.support.nodes.BaseNodesRequest; -import org.elasticsearch.cluster.node.DiscoveryNode; -import org.elasticsearch.common.io.stream.StreamInput; -import org.elasticsearch.common.io.stream.StreamOutput; +import org.opensearch.action.support.nodes.BaseNodesRequest; +import org.opensearch.cluster.node.DiscoveryNode; +import org.opensearch.common.io.stream.StreamInput; +import org.opensearch.common.io.stream.StreamOutput; /** * ADStatsRequest implements a request to obtain stats about the AD plugin diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ADTaskProfileAction.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ADTaskProfileAction.java index 9cc49bfe2..8830855ec 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ADTaskProfileAction.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ADTaskProfileAction.java @@ -17,7 +17,7 @@ import static com.amazon.opendistroforelasticsearch.ad.constant.CommonName.AD_TASK; -import org.elasticsearch.action.ActionType; +import org.opensearch.action.ActionType; import com.amazon.opendistroforelasticsearch.ad.constant.CommonValue; diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ADTaskProfileNodeRequest.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ADTaskProfileNodeRequest.java index e74fc70a6..bc696a756 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ADTaskProfileNodeRequest.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ADTaskProfileNodeRequest.java @@ -17,9 +17,9 @@ import java.io.IOException; -import org.elasticsearch.action.support.nodes.BaseNodeRequest; -import org.elasticsearch.common.io.stream.StreamInput; -import org.elasticsearch.common.io.stream.StreamOutput; +import org.opensearch.action.support.nodes.BaseNodeRequest; +import org.opensearch.common.io.stream.StreamInput; +import org.opensearch.common.io.stream.StreamOutput; public class ADTaskProfileNodeRequest extends BaseNodeRequest { private String detectorId; diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ADTaskProfileNodeResponse.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ADTaskProfileNodeResponse.java index b22d1d752..64f2c49ce 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ADTaskProfileNodeResponse.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ADTaskProfileNodeResponse.java @@ -17,10 +17,10 @@ import java.io.IOException; -import org.elasticsearch.action.support.nodes.BaseNodeResponse; -import org.elasticsearch.cluster.node.DiscoveryNode; -import org.elasticsearch.common.io.stream.StreamInput; -import org.elasticsearch.common.io.stream.StreamOutput; +import org.opensearch.action.support.nodes.BaseNodeResponse; +import org.opensearch.cluster.node.DiscoveryNode; +import org.opensearch.common.io.stream.StreamInput; +import org.opensearch.common.io.stream.StreamOutput; import com.amazon.opendistroforelasticsearch.ad.model.ADTaskProfile; diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ADTaskProfileRequest.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ADTaskProfileRequest.java index ea19b57a4..800c4d28b 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ADTaskProfileRequest.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ADTaskProfileRequest.java @@ -15,16 +15,16 @@ package com.amazon.opendistroforelasticsearch.ad.transport; -import static org.elasticsearch.action.ValidateActions.addValidationError; +import static org.opensearch.action.ValidateActions.addValidationError; import java.io.IOException; -import org.elasticsearch.action.ActionRequestValidationException; -import org.elasticsearch.action.support.nodes.BaseNodesRequest; -import org.elasticsearch.cluster.node.DiscoveryNode; -import org.elasticsearch.common.Strings; -import org.elasticsearch.common.io.stream.StreamInput; -import org.elasticsearch.common.io.stream.StreamOutput; +import org.opensearch.action.ActionRequestValidationException; +import org.opensearch.action.support.nodes.BaseNodesRequest; +import org.opensearch.cluster.node.DiscoveryNode; +import org.opensearch.common.Strings; +import org.opensearch.common.io.stream.StreamInput; +import org.opensearch.common.io.stream.StreamOutput; import com.amazon.opendistroforelasticsearch.ad.constant.CommonErrorMessages; diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ADTaskProfileResponse.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ADTaskProfileResponse.java index 6180f1dfe..987caacc7 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ADTaskProfileResponse.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ADTaskProfileResponse.java @@ -18,11 +18,11 @@ import java.io.IOException; import java.util.List; -import org.elasticsearch.action.FailedNodeException; -import org.elasticsearch.action.support.nodes.BaseNodesResponse; -import org.elasticsearch.cluster.ClusterName; -import org.elasticsearch.common.io.stream.StreamInput; -import org.elasticsearch.common.io.stream.StreamOutput; +import org.opensearch.action.FailedNodeException; +import org.opensearch.action.support.nodes.BaseNodesResponse; +import org.opensearch.cluster.ClusterName; +import org.opensearch.common.io.stream.StreamInput; +import org.opensearch.common.io.stream.StreamOutput; public class ADTaskProfileResponse extends BaseNodesResponse { diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ADTaskProfileTransportAction.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ADTaskProfileTransportAction.java index d5c64f991..b62ba2e62 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ADTaskProfileTransportAction.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ADTaskProfileTransportAction.java @@ -18,14 +18,14 @@ import java.io.IOException; import java.util.List; -import org.elasticsearch.action.FailedNodeException; -import org.elasticsearch.action.support.ActionFilters; -import org.elasticsearch.action.support.nodes.TransportNodesAction; -import org.elasticsearch.cluster.service.ClusterService; -import org.elasticsearch.common.inject.Inject; -import org.elasticsearch.common.io.stream.StreamInput; -import org.elasticsearch.threadpool.ThreadPool; -import org.elasticsearch.transport.TransportService; +import org.opensearch.action.FailedNodeException; +import org.opensearch.action.support.ActionFilters; +import org.opensearch.action.support.nodes.TransportNodesAction; +import org.opensearch.cluster.service.ClusterService; +import org.opensearch.common.inject.Inject; +import org.opensearch.common.io.stream.StreamInput; +import org.opensearch.threadpool.ThreadPool; +import org.opensearch.transport.TransportService; import com.amazon.opendistroforelasticsearch.ad.model.ADTaskProfile; import com.amazon.opendistroforelasticsearch.ad.task.ADTaskManager; diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/AnomalyDetectorJobAction.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/AnomalyDetectorJobAction.java index 092948fb9..e38eba038 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/AnomalyDetectorJobAction.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/AnomalyDetectorJobAction.java @@ -15,7 +15,7 @@ package com.amazon.opendistroforelasticsearch.ad.transport; -import org.elasticsearch.action.ActionType; +import org.opensearch.action.ActionType; import com.amazon.opendistroforelasticsearch.ad.constant.CommonValue; diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/AnomalyDetectorJobRequest.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/AnomalyDetectorJobRequest.java index 586a538ed..c24f497d0 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/AnomalyDetectorJobRequest.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/AnomalyDetectorJobRequest.java @@ -17,10 +17,10 @@ import java.io.IOException; -import org.elasticsearch.action.ActionRequest; -import org.elasticsearch.action.ActionRequestValidationException; -import org.elasticsearch.common.io.stream.StreamInput; -import org.elasticsearch.common.io.stream.StreamOutput; +import org.opensearch.action.ActionRequest; +import org.opensearch.action.ActionRequestValidationException; +import org.opensearch.common.io.stream.StreamInput; +import org.opensearch.common.io.stream.StreamOutput; public class AnomalyDetectorJobRequest extends ActionRequest { diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/AnomalyDetectorJobResponse.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/AnomalyDetectorJobResponse.java index 99a4a73aa..f0a8f8373 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/AnomalyDetectorJobResponse.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/AnomalyDetectorJobResponse.java @@ -17,12 +17,12 @@ import java.io.IOException; -import org.elasticsearch.action.ActionResponse; -import org.elasticsearch.common.io.stream.StreamInput; -import org.elasticsearch.common.io.stream.StreamOutput; -import org.elasticsearch.common.xcontent.ToXContentObject; -import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.rest.RestStatus; +import org.opensearch.action.ActionResponse; +import org.opensearch.common.io.stream.StreamInput; +import org.opensearch.common.io.stream.StreamOutput; +import org.opensearch.common.xcontent.ToXContentObject; +import org.opensearch.common.xcontent.XContentBuilder; +import org.opensearch.rest.RestStatus; import com.amazon.opendistroforelasticsearch.ad.util.RestHandlerUtils; diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/AnomalyDetectorJobTransportAction.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/AnomalyDetectorJobTransportAction.java index beae687da..be494ead5 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/AnomalyDetectorJobTransportAction.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/AnomalyDetectorJobTransportAction.java @@ -22,18 +22,18 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import org.elasticsearch.action.ActionListener; -import org.elasticsearch.action.support.ActionFilters; -import org.elasticsearch.action.support.HandledTransportAction; -import org.elasticsearch.client.Client; -import org.elasticsearch.cluster.service.ClusterService; -import org.elasticsearch.common.inject.Inject; -import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.common.unit.TimeValue; -import org.elasticsearch.common.util.concurrent.ThreadContext; -import org.elasticsearch.common.xcontent.NamedXContentRegistry; -import org.elasticsearch.tasks.Task; -import org.elasticsearch.transport.TransportService; +import org.opensearch.action.ActionListener; +import org.opensearch.action.support.ActionFilters; +import org.opensearch.action.support.HandledTransportAction; +import org.opensearch.client.Client; +import org.opensearch.cluster.service.ClusterService; +import org.opensearch.common.inject.Inject; +import org.opensearch.common.settings.Settings; +import org.opensearch.common.unit.TimeValue; +import org.opensearch.common.util.concurrent.ThreadContext; +import org.opensearch.common.xcontent.NamedXContentRegistry; +import org.opensearch.tasks.Task; +import org.opensearch.transport.TransportService; import com.amazon.opendistroforelasticsearch.ad.indices.AnomalyDetectionIndices; import com.amazon.opendistroforelasticsearch.ad.rest.handler.IndexAnomalyDetectorJobActionHandler; diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/AnomalyResultAction.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/AnomalyResultAction.java index 160edf1a9..1bf1054ef 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/AnomalyResultAction.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/AnomalyResultAction.java @@ -15,7 +15,7 @@ package com.amazon.opendistroforelasticsearch.ad.transport; -import org.elasticsearch.action.ActionType; +import org.opensearch.action.ActionType; import com.amazon.opendistroforelasticsearch.ad.constant.CommonValue; diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/AnomalyResultRequest.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/AnomalyResultRequest.java index 131f8ee09..6f5255915 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/AnomalyResultRequest.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/AnomalyResultRequest.java @@ -15,22 +15,22 @@ package com.amazon.opendistroforelasticsearch.ad.transport; -import static org.elasticsearch.action.ValidateActions.addValidationError; +import static org.opensearch.action.ValidateActions.addValidationError; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.Locale; -import org.elasticsearch.action.ActionRequest; -import org.elasticsearch.action.ActionRequestValidationException; -import org.elasticsearch.common.Strings; -import org.elasticsearch.common.io.stream.InputStreamStreamInput; -import org.elasticsearch.common.io.stream.OutputStreamStreamOutput; -import org.elasticsearch.common.io.stream.StreamInput; -import org.elasticsearch.common.io.stream.StreamOutput; -import org.elasticsearch.common.xcontent.ToXContentObject; -import org.elasticsearch.common.xcontent.XContentBuilder; +import org.opensearch.action.ActionRequest; +import org.opensearch.action.ActionRequestValidationException; +import org.opensearch.common.Strings; +import org.opensearch.common.io.stream.InputStreamStreamInput; +import org.opensearch.common.io.stream.OutputStreamStreamOutput; +import org.opensearch.common.io.stream.StreamInput; +import org.opensearch.common.io.stream.StreamOutput; +import org.opensearch.common.xcontent.ToXContentObject; +import org.opensearch.common.xcontent.XContentBuilder; import com.amazon.opendistroforelasticsearch.ad.constant.CommonErrorMessages; import com.amazon.opendistroforelasticsearch.ad.constant.CommonMessageAttributes; diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/AnomalyResultResponse.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/AnomalyResultResponse.java index 374f34f60..15bb05293 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/AnomalyResultResponse.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/AnomalyResultResponse.java @@ -21,13 +21,13 @@ import java.util.ArrayList; import java.util.List; -import org.elasticsearch.action.ActionResponse; -import org.elasticsearch.common.io.stream.InputStreamStreamInput; -import org.elasticsearch.common.io.stream.OutputStreamStreamOutput; -import org.elasticsearch.common.io.stream.StreamInput; -import org.elasticsearch.common.io.stream.StreamOutput; -import org.elasticsearch.common.xcontent.ToXContentObject; -import org.elasticsearch.common.xcontent.XContentBuilder; +import org.opensearch.action.ActionResponse; +import org.opensearch.common.io.stream.InputStreamStreamInput; +import org.opensearch.common.io.stream.OutputStreamStreamOutput; +import org.opensearch.common.io.stream.StreamInput; +import org.opensearch.common.io.stream.StreamOutput; +import org.opensearch.common.xcontent.ToXContentObject; +import org.opensearch.common.xcontent.XContentBuilder; import com.amazon.opendistroforelasticsearch.ad.model.FeatureData; diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/AnomalyResultTransportAction.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/AnomalyResultTransportAction.java index 026de74b7..1596562a0 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/AnomalyResultTransportAction.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/AnomalyResultTransportAction.java @@ -33,41 +33,41 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.message.ParameterizedMessage; -import org.elasticsearch.ElasticsearchException; -import org.elasticsearch.ElasticsearchTimeoutException; -import org.elasticsearch.ExceptionsHelper; -import org.elasticsearch.action.ActionListener; -import org.elasticsearch.action.ActionListenerResponseHandler; -import org.elasticsearch.action.ActionRequest; -import org.elasticsearch.action.search.SearchPhaseExecutionException; -import org.elasticsearch.action.search.ShardSearchFailure; -import org.elasticsearch.action.support.ActionFilters; -import org.elasticsearch.action.support.HandledTransportAction; -import org.elasticsearch.action.support.IndicesOptions; -import org.elasticsearch.action.support.ThreadedActionListener; -import org.elasticsearch.action.support.master.AcknowledgedResponse; -import org.elasticsearch.client.Client; -import org.elasticsearch.cluster.ClusterState; -import org.elasticsearch.cluster.block.ClusterBlockLevel; -import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver; -import org.elasticsearch.cluster.node.DiscoveryNode; -import org.elasticsearch.cluster.node.DiscoveryNodes; -import org.elasticsearch.cluster.service.ClusterService; -import org.elasticsearch.common.inject.Inject; -import org.elasticsearch.common.lease.Releasable; -import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.common.util.concurrent.ThreadContext; -import org.elasticsearch.index.IndexNotFoundException; -import org.elasticsearch.node.NodeClosedException; -import org.elasticsearch.rest.RestStatus; -import org.elasticsearch.tasks.Task; -import org.elasticsearch.threadpool.ThreadPool; -import org.elasticsearch.transport.ActionNotFoundTransportException; -import org.elasticsearch.transport.ConnectTransportException; -import org.elasticsearch.transport.NodeNotConnectedException; -import org.elasticsearch.transport.ReceiveTimeoutTransportException; -import org.elasticsearch.transport.TransportRequestOptions; -import org.elasticsearch.transport.TransportService; +import org.opensearch.ExceptionsHelper; +import org.opensearch.OpenSearchException; +import org.opensearch.OpenSearchTimeoutException; +import org.opensearch.action.ActionListener; +import org.opensearch.action.ActionListenerResponseHandler; +import org.opensearch.action.ActionRequest; +import org.opensearch.action.search.SearchPhaseExecutionException; +import org.opensearch.action.search.ShardSearchFailure; +import org.opensearch.action.support.ActionFilters; +import org.opensearch.action.support.HandledTransportAction; +import org.opensearch.action.support.IndicesOptions; +import org.opensearch.action.support.ThreadedActionListener; +import org.opensearch.action.support.master.AcknowledgedResponse; +import org.opensearch.client.Client; +import org.opensearch.cluster.ClusterState; +import org.opensearch.cluster.block.ClusterBlockLevel; +import org.opensearch.cluster.metadata.IndexNameExpressionResolver; +import org.opensearch.cluster.node.DiscoveryNode; +import org.opensearch.cluster.node.DiscoveryNodes; +import org.opensearch.cluster.service.ClusterService; +import org.opensearch.common.inject.Inject; +import org.opensearch.common.lease.Releasable; +import org.opensearch.common.settings.Settings; +import org.opensearch.common.util.concurrent.ThreadContext; +import org.opensearch.index.IndexNotFoundException; +import org.opensearch.node.NodeClosedException; +import org.opensearch.rest.RestStatus; +import org.opensearch.tasks.Task; +import org.opensearch.threadpool.ThreadPool; +import org.opensearch.transport.ActionNotFoundTransportException; +import org.opensearch.transport.ConnectTransportException; +import org.opensearch.transport.NodeNotConnectedException; +import org.opensearch.transport.ReceiveTimeoutTransportException; +import org.opensearch.transport.TransportRequestOptions; +import org.opensearch.transport.TransportService; import com.amazon.opendistroforelasticsearch.ad.AnomalyDetectorPlugin; import com.amazon.opendistroforelasticsearch.ad.NodeStateManager; @@ -107,8 +107,7 @@ public class AnomalyResultTransportAction extends HandledTransportAction failure, AnomalyDetector detector) @@ -587,8 +586,8 @@ private void findException(Throwable cause, String adID, AtomicReference { - if (exception instanceof ElasticsearchTimeoutException) { + if (exception instanceof OpenSearchTimeoutException) { stateManager .setLastColdStartException( detectorId, diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/BackPressureRouting.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/BackPressureRouting.java index 3846fab34..c8df55f1d 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/BackPressureRouting.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/BackPressureRouting.java @@ -23,8 +23,8 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.common.unit.TimeValue; +import org.opensearch.common.settings.Settings; +import org.opensearch.common.unit.TimeValue; /** * Data structure to keep track of a node's unresponsive history: a node does not reply for a diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/CronAction.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/CronAction.java index c639e5d04..b1c2920a7 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/CronAction.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/CronAction.java @@ -15,7 +15,7 @@ package com.amazon.opendistroforelasticsearch.ad.transport; -import org.elasticsearch.action.ActionType; +import org.opensearch.action.ActionType; import com.amazon.opendistroforelasticsearch.ad.constant.CommonValue; diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/CronNodeRequest.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/CronNodeRequest.java index eab379ceb..e33fef45d 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/CronNodeRequest.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/CronNodeRequest.java @@ -17,8 +17,8 @@ import java.io.IOException; -import org.elasticsearch.action.support.nodes.BaseNodeRequest; -import org.elasticsearch.common.io.stream.StreamInput; +import org.opensearch.action.support.nodes.BaseNodeRequest; +import org.opensearch.common.io.stream.StreamInput; /** * Delete model represents the request to an individual node diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/CronNodeResponse.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/CronNodeResponse.java index ceb532d42..488926c03 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/CronNodeResponse.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/CronNodeResponse.java @@ -17,11 +17,11 @@ import java.io.IOException; -import org.elasticsearch.action.support.nodes.BaseNodeResponse; -import org.elasticsearch.cluster.node.DiscoveryNode; -import org.elasticsearch.common.io.stream.StreamInput; -import org.elasticsearch.common.xcontent.ToXContentObject; -import org.elasticsearch.common.xcontent.XContentBuilder; +import org.opensearch.action.support.nodes.BaseNodeResponse; +import org.opensearch.cluster.node.DiscoveryNode; +import org.opensearch.common.io.stream.StreamInput; +import org.opensearch.common.xcontent.ToXContentObject; +import org.opensearch.common.xcontent.XContentBuilder; public class CronNodeResponse extends BaseNodeResponse implements ToXContentObject { static String NODE_ID = "node_id"; diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/CronRequest.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/CronRequest.java index 53473eb5a..149ba25e9 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/CronRequest.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/CronRequest.java @@ -17,9 +17,9 @@ import java.io.IOException; -import org.elasticsearch.action.support.nodes.BaseNodesRequest; -import org.elasticsearch.cluster.node.DiscoveryNode; -import org.elasticsearch.common.io.stream.StreamInput; +import org.opensearch.action.support.nodes.BaseNodesRequest; +import org.opensearch.cluster.node.DiscoveryNode; +import org.opensearch.common.io.stream.StreamInput; /** * Request should be sent from the handler logic of transport delete detector API diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/CronResponse.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/CronResponse.java index 26b64b512..6649ba8a5 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/CronResponse.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/CronResponse.java @@ -18,13 +18,13 @@ import java.io.IOException; import java.util.List; -import org.elasticsearch.action.FailedNodeException; -import org.elasticsearch.action.support.nodes.BaseNodesResponse; -import org.elasticsearch.cluster.ClusterName; -import org.elasticsearch.common.io.stream.StreamInput; -import org.elasticsearch.common.io.stream.StreamOutput; -import org.elasticsearch.common.xcontent.ToXContentFragment; -import org.elasticsearch.common.xcontent.XContentBuilder; +import org.opensearch.action.FailedNodeException; +import org.opensearch.action.support.nodes.BaseNodesResponse; +import org.opensearch.cluster.ClusterName; +import org.opensearch.common.io.stream.StreamInput; +import org.opensearch.common.io.stream.StreamOutput; +import org.opensearch.common.xcontent.ToXContentFragment; +import org.opensearch.common.xcontent.XContentBuilder; public class CronResponse extends BaseNodesResponse implements ToXContentFragment { static String NODES_JSON_KEY = "nodes"; diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/CronTransportAction.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/CronTransportAction.java index c185c07ac..ea42da9a7 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/CronTransportAction.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/CronTransportAction.java @@ -18,14 +18,14 @@ import java.io.IOException; import java.util.List; -import org.elasticsearch.action.FailedNodeException; -import org.elasticsearch.action.support.ActionFilters; -import org.elasticsearch.action.support.nodes.TransportNodesAction; -import org.elasticsearch.cluster.service.ClusterService; -import org.elasticsearch.common.inject.Inject; -import org.elasticsearch.common.io.stream.StreamInput; -import org.elasticsearch.threadpool.ThreadPool; -import org.elasticsearch.transport.TransportService; +import org.opensearch.action.FailedNodeException; +import org.opensearch.action.support.ActionFilters; +import org.opensearch.action.support.nodes.TransportNodesAction; +import org.opensearch.cluster.service.ClusterService; +import org.opensearch.common.inject.Inject; +import org.opensearch.common.io.stream.StreamInput; +import org.opensearch.threadpool.ThreadPool; +import org.opensearch.transport.TransportService; import com.amazon.opendistroforelasticsearch.ad.NodeStateManager; import com.amazon.opendistroforelasticsearch.ad.caching.CacheProvider; diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/DeleteAnomalyDetectorAction.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/DeleteAnomalyDetectorAction.java index f83d8c0eb..93aee7e8b 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/DeleteAnomalyDetectorAction.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/DeleteAnomalyDetectorAction.java @@ -15,8 +15,8 @@ package com.amazon.opendistroforelasticsearch.ad.transport; -import org.elasticsearch.action.ActionType; -import org.elasticsearch.action.delete.DeleteResponse; +import org.opensearch.action.ActionType; +import org.opensearch.action.delete.DeleteResponse; import com.amazon.opendistroforelasticsearch.ad.constant.CommonValue; diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/DeleteAnomalyDetectorRequest.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/DeleteAnomalyDetectorRequest.java index 2c16ea2f8..a1fa3b5f3 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/DeleteAnomalyDetectorRequest.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/DeleteAnomalyDetectorRequest.java @@ -15,15 +15,15 @@ package com.amazon.opendistroforelasticsearch.ad.transport; -import static org.elasticsearch.action.ValidateActions.addValidationError; +import static org.opensearch.action.ValidateActions.addValidationError; import java.io.IOException; -import org.elasticsearch.action.ActionRequest; -import org.elasticsearch.action.ActionRequestValidationException; -import org.elasticsearch.common.Strings; -import org.elasticsearch.common.io.stream.StreamInput; -import org.elasticsearch.common.io.stream.StreamOutput; +import org.opensearch.action.ActionRequest; +import org.opensearch.action.ActionRequestValidationException; +import org.opensearch.common.Strings; +import org.opensearch.common.io.stream.StreamInput; +import org.opensearch.common.io.stream.StreamOutput; import com.amazon.opendistroforelasticsearch.ad.constant.CommonErrorMessages; diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/DeleteAnomalyDetectorTransportAction.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/DeleteAnomalyDetectorTransportAction.java index e780b11f3..7b63e5558 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/DeleteAnomalyDetectorTransportAction.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/DeleteAnomalyDetectorTransportAction.java @@ -19,33 +19,33 @@ import static com.amazon.opendistroforelasticsearch.ad.settings.AnomalyDetectorSettings.FILTER_BY_BACKEND_ROLES; import static com.amazon.opendistroforelasticsearch.ad.util.ParseUtils.getUserContext; import static com.amazon.opendistroforelasticsearch.ad.util.ParseUtils.resolveUserAndExecute; -import static org.elasticsearch.common.xcontent.XContentParserUtils.ensureExpectedToken; +import static org.opensearch.common.xcontent.XContentParserUtils.ensureExpectedToken; import java.io.IOException; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import org.elasticsearch.ElasticsearchStatusException; -import org.elasticsearch.action.ActionListener; -import org.elasticsearch.action.DocWriteResponse; -import org.elasticsearch.action.delete.DeleteRequest; -import org.elasticsearch.action.delete.DeleteResponse; -import org.elasticsearch.action.get.GetRequest; -import org.elasticsearch.action.get.GetResponse; -import org.elasticsearch.action.support.ActionFilters; -import org.elasticsearch.action.support.HandledTransportAction; -import org.elasticsearch.action.support.WriteRequest; -import org.elasticsearch.client.Client; -import org.elasticsearch.cluster.service.ClusterService; -import org.elasticsearch.common.inject.Inject; -import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.common.util.concurrent.ThreadContext; -import org.elasticsearch.common.xcontent.NamedXContentRegistry; -import org.elasticsearch.common.xcontent.XContentParser; -import org.elasticsearch.index.IndexNotFoundException; -import org.elasticsearch.rest.RestStatus; -import org.elasticsearch.tasks.Task; -import org.elasticsearch.transport.TransportService; +import org.opensearch.OpenSearchStatusException; +import org.opensearch.action.ActionListener; +import org.opensearch.action.DocWriteResponse; +import org.opensearch.action.delete.DeleteRequest; +import org.opensearch.action.delete.DeleteResponse; +import org.opensearch.action.get.GetRequest; +import org.opensearch.action.get.GetResponse; +import org.opensearch.action.support.ActionFilters; +import org.opensearch.action.support.HandledTransportAction; +import org.opensearch.action.support.WriteRequest; +import org.opensearch.client.Client; +import org.opensearch.cluster.service.ClusterService; +import org.opensearch.common.inject.Inject; +import org.opensearch.common.settings.Settings; +import org.opensearch.common.util.concurrent.ThreadContext; +import org.opensearch.common.xcontent.NamedXContentRegistry; +import org.opensearch.common.xcontent.XContentParser; +import org.opensearch.index.IndexNotFoundException; +import org.opensearch.rest.RestStatus; +import org.opensearch.tasks.Task; +import org.opensearch.transport.TransportService; import com.amazon.opendistroforelasticsearch.ad.constant.CommonName; import com.amazon.opendistroforelasticsearch.ad.model.AnomalyDetector; @@ -106,8 +106,7 @@ protected void doExecute(Task task, DeleteAnomalyDetectorRequest request, Action // historical detector detector -> adTaskManager.getLatestADTask(detectorId, adTask -> { if (adTask.isPresent() && !adTaskManager.isADTaskEnded(adTask.get())) { - listener - .onFailure(new ElasticsearchStatusException("Detector is running", RestStatus.INTERNAL_SERVER_ERROR)); + listener.onFailure(new OpenSearchStatusException("Detector is running", RestStatus.INTERNAL_SERVER_ERROR)); } else { adTaskManager.deleteADTasks(detectorId, () -> deleteDetectorStateDoc(detectorId, listener), listener); } @@ -134,7 +133,7 @@ private void deleteAnomalyDetectorJobDoc(String detectorId, ActionListener { if (exception instanceof IndexNotFoundException) { @@ -212,7 +211,7 @@ private void onGetAdJobResponseForWrite(GetResponse response, ActionListener implements ToXContentFragment { static String NODES_JSON_KEY = "nodes"; diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/DeleteModelTransportAction.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/DeleteModelTransportAction.java index 4f50cbc05..51d9d6df8 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/DeleteModelTransportAction.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/DeleteModelTransportAction.java @@ -20,14 +20,14 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import org.elasticsearch.action.FailedNodeException; -import org.elasticsearch.action.support.ActionFilters; -import org.elasticsearch.action.support.nodes.TransportNodesAction; -import org.elasticsearch.cluster.service.ClusterService; -import org.elasticsearch.common.inject.Inject; -import org.elasticsearch.common.io.stream.StreamInput; -import org.elasticsearch.threadpool.ThreadPool; -import org.elasticsearch.transport.TransportService; +import org.opensearch.action.FailedNodeException; +import org.opensearch.action.support.ActionFilters; +import org.opensearch.action.support.nodes.TransportNodesAction; +import org.opensearch.cluster.service.ClusterService; +import org.opensearch.common.inject.Inject; +import org.opensearch.common.io.stream.StreamInput; +import org.opensearch.threadpool.ThreadPool; +import org.opensearch.transport.TransportService; import com.amazon.opendistroforelasticsearch.ad.NodeStateManager; import com.amazon.opendistroforelasticsearch.ad.caching.CacheProvider; diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/EntityProfileAction.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/EntityProfileAction.java index e6063f5f8..6c2d5ddf3 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/EntityProfileAction.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/EntityProfileAction.java @@ -15,7 +15,7 @@ package com.amazon.opendistroforelasticsearch.ad.transport; -import org.elasticsearch.action.ActionType; +import org.opensearch.action.ActionType; import com.amazon.opendistroforelasticsearch.ad.constant.CommonValue; diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/EntityProfileRequest.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/EntityProfileRequest.java index 70be6fa44..67215baaa 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/EntityProfileRequest.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/EntityProfileRequest.java @@ -15,19 +15,19 @@ package com.amazon.opendistroforelasticsearch.ad.transport; -import static org.elasticsearch.action.ValidateActions.addValidationError; +import static org.opensearch.action.ValidateActions.addValidationError; import java.io.IOException; import java.util.HashSet; import java.util.Set; -import org.elasticsearch.action.ActionRequest; -import org.elasticsearch.action.ActionRequestValidationException; -import org.elasticsearch.common.Strings; -import org.elasticsearch.common.io.stream.StreamInput; -import org.elasticsearch.common.io.stream.StreamOutput; -import org.elasticsearch.common.xcontent.ToXContentObject; -import org.elasticsearch.common.xcontent.XContentBuilder; +import org.opensearch.action.ActionRequest; +import org.opensearch.action.ActionRequestValidationException; +import org.opensearch.common.Strings; +import org.opensearch.common.io.stream.StreamInput; +import org.opensearch.common.io.stream.StreamOutput; +import org.opensearch.common.xcontent.ToXContentObject; +import org.opensearch.common.xcontent.XContentBuilder; import com.amazon.opendistroforelasticsearch.ad.constant.CommonErrorMessages; import com.amazon.opendistroforelasticsearch.ad.constant.CommonMessageAttributes; diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/EntityProfileResponse.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/EntityProfileResponse.java index 598f71341..a5fd8b445 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/EntityProfileResponse.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/EntityProfileResponse.java @@ -21,11 +21,11 @@ import org.apache.commons.lang.builder.EqualsBuilder; import org.apache.commons.lang.builder.HashCodeBuilder; import org.apache.commons.lang.builder.ToStringBuilder; -import org.elasticsearch.action.ActionResponse; -import org.elasticsearch.common.io.stream.StreamInput; -import org.elasticsearch.common.io.stream.StreamOutput; -import org.elasticsearch.common.xcontent.ToXContentObject; -import org.elasticsearch.common.xcontent.XContentBuilder; +import org.opensearch.action.ActionResponse; +import org.opensearch.common.io.stream.StreamInput; +import org.opensearch.common.io.stream.StreamOutput; +import org.opensearch.common.xcontent.ToXContentObject; +import org.opensearch.common.xcontent.XContentBuilder; import com.amazon.opendistroforelasticsearch.ad.constant.CommonName; import com.amazon.opendistroforelasticsearch.ad.model.ModelProfile; diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/EntityProfileTransportAction.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/EntityProfileTransportAction.java index f4ce72235..64c4f7bfc 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/EntityProfileTransportAction.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/EntityProfileTransportAction.java @@ -22,20 +22,20 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import org.elasticsearch.action.ActionListener; -import org.elasticsearch.action.support.ActionFilters; -import org.elasticsearch.action.support.HandledTransportAction; -import org.elasticsearch.cluster.node.DiscoveryNode; -import org.elasticsearch.cluster.service.ClusterService; -import org.elasticsearch.common.inject.Inject; -import org.elasticsearch.common.io.stream.StreamInput; -import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.tasks.Task; -import org.elasticsearch.threadpool.ThreadPool; -import org.elasticsearch.transport.TransportException; -import org.elasticsearch.transport.TransportRequestOptions; -import org.elasticsearch.transport.TransportResponseHandler; -import org.elasticsearch.transport.TransportService; +import org.opensearch.action.ActionListener; +import org.opensearch.action.support.ActionFilters; +import org.opensearch.action.support.HandledTransportAction; +import org.opensearch.cluster.node.DiscoveryNode; +import org.opensearch.cluster.service.ClusterService; +import org.opensearch.common.inject.Inject; +import org.opensearch.common.io.stream.StreamInput; +import org.opensearch.common.settings.Settings; +import org.opensearch.tasks.Task; +import org.opensearch.threadpool.ThreadPool; +import org.opensearch.transport.TransportException; +import org.opensearch.transport.TransportRequestOptions; +import org.opensearch.transport.TransportResponseHandler; +import org.opensearch.transport.TransportService; import com.amazon.opendistroforelasticsearch.ad.caching.CacheProvider; import com.amazon.opendistroforelasticsearch.ad.caching.EntityCache; diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/EntityResultAction.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/EntityResultAction.java index 21d219b08..624e8ff58 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/EntityResultAction.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/EntityResultAction.java @@ -15,8 +15,8 @@ package com.amazon.opendistroforelasticsearch.ad.transport; -import org.elasticsearch.action.ActionType; -import org.elasticsearch.action.support.master.AcknowledgedResponse; +import org.opensearch.action.ActionType; +import org.opensearch.action.support.master.AcknowledgedResponse; import com.amazon.opendistroforelasticsearch.ad.constant.CommonValue; diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/EntityResultRequest.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/EntityResultRequest.java index 1057a1905..d6de366b7 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/EntityResultRequest.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/EntityResultRequest.java @@ -15,19 +15,19 @@ package com.amazon.opendistroforelasticsearch.ad.transport; -import static org.elasticsearch.action.ValidateActions.addValidationError; +import static org.opensearch.action.ValidateActions.addValidationError; import java.io.IOException; import java.util.Locale; import java.util.Map; -import org.elasticsearch.action.ActionRequest; -import org.elasticsearch.action.ActionRequestValidationException; -import org.elasticsearch.common.Strings; -import org.elasticsearch.common.io.stream.StreamInput; -import org.elasticsearch.common.io.stream.StreamOutput; -import org.elasticsearch.common.xcontent.ToXContentObject; -import org.elasticsearch.common.xcontent.XContentBuilder; +import org.opensearch.action.ActionRequest; +import org.opensearch.action.ActionRequestValidationException; +import org.opensearch.common.Strings; +import org.opensearch.common.io.stream.StreamInput; +import org.opensearch.common.io.stream.StreamOutput; +import org.opensearch.common.xcontent.ToXContentObject; +import org.opensearch.common.xcontent.XContentBuilder; import com.amazon.opendistroforelasticsearch.ad.constant.CommonErrorMessages; import com.amazon.opendistroforelasticsearch.ad.constant.CommonMessageAttributes; diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/EntityResultTransportAction.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/EntityResultTransportAction.java index 139e8af00..584e8ed7f 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/EntityResultTransportAction.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/EntityResultTransportAction.java @@ -27,14 +27,14 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.message.ParameterizedMessage; -import org.elasticsearch.action.ActionListener; -import org.elasticsearch.action.support.ActionFilters; -import org.elasticsearch.action.support.HandledTransportAction; -import org.elasticsearch.action.support.master.AcknowledgedResponse; -import org.elasticsearch.common.inject.Inject; -import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.tasks.Task; -import org.elasticsearch.transport.TransportService; +import org.opensearch.action.ActionListener; +import org.opensearch.action.support.ActionFilters; +import org.opensearch.action.support.HandledTransportAction; +import org.opensearch.action.support.master.AcknowledgedResponse; +import org.opensearch.common.inject.Inject; +import org.opensearch.common.settings.Settings; +import org.opensearch.tasks.Task; +import org.opensearch.transport.TransportService; import com.amazon.opendistroforelasticsearch.ad.NodeStateManager; import com.amazon.opendistroforelasticsearch.ad.breaker.ADCircuitBreakerService; @@ -182,7 +182,7 @@ private ActionListener> onGetDetector( ThresholdingResult result = manager.getAnomalyResultForEntity(detectorId, datapoint, entityName, entityModel, modelId); // result.getRcfScore() = 0 means the model is not initialized // result.getGrade() = 0 means it is not an anomaly - // So many EsRejectedExecutionException if we write no matter what + // So many OpenSearchRejectedExecutionException if we write no matter what if (result.getRcfScore() > 0 && (!onlySaveAnomalies || result.getGrade() > 0)) { currentBulkRequest .add( diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ForwardADTaskAction.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ForwardADTaskAction.java index 46adeda9e..75c79d4cb 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ForwardADTaskAction.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ForwardADTaskAction.java @@ -17,7 +17,7 @@ import static com.amazon.opendistroforelasticsearch.ad.constant.CommonName.AD_TASK; -import org.elasticsearch.action.ActionType; +import org.opensearch.action.ActionType; import com.amazon.opendistroforelasticsearch.ad.constant.CommonValue; diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ForwardADTaskRequest.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ForwardADTaskRequest.java index 105351c67..ee54b3c6a 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ForwardADTaskRequest.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ForwardADTaskRequest.java @@ -15,14 +15,14 @@ package com.amazon.opendistroforelasticsearch.ad.transport; -import static org.elasticsearch.action.ValidateActions.addValidationError; +import static org.opensearch.action.ValidateActions.addValidationError; import java.io.IOException; -import org.elasticsearch.action.ActionRequest; -import org.elasticsearch.action.ActionRequestValidationException; -import org.elasticsearch.common.io.stream.StreamInput; -import org.elasticsearch.common.io.stream.StreamOutput; +import org.opensearch.action.ActionRequest; +import org.opensearch.action.ActionRequestValidationException; +import org.opensearch.common.io.stream.StreamInput; +import org.opensearch.common.io.stream.StreamOutput; import com.amazon.opendistroforelasticsearch.ad.constant.CommonErrorMessages; import com.amazon.opendistroforelasticsearch.ad.model.ADTaskAction; diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ForwardADTaskTransportAction.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ForwardADTaskTransportAction.java index bbb83bea8..67771a569 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ForwardADTaskTransportAction.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ForwardADTaskTransportAction.java @@ -15,14 +15,14 @@ package com.amazon.opendistroforelasticsearch.ad.transport; -import org.elasticsearch.ElasticsearchStatusException; -import org.elasticsearch.action.ActionListener; -import org.elasticsearch.action.support.ActionFilters; -import org.elasticsearch.action.support.HandledTransportAction; -import org.elasticsearch.common.inject.Inject; -import org.elasticsearch.rest.RestStatus; -import org.elasticsearch.tasks.Task; -import org.elasticsearch.transport.TransportService; +import org.opensearch.OpenSearchStatusException; +import org.opensearch.action.ActionListener; +import org.opensearch.action.support.ActionFilters; +import org.opensearch.action.support.HandledTransportAction; +import org.opensearch.common.inject.Inject; +import org.opensearch.rest.RestStatus; +import org.opensearch.tasks.Task; +import org.opensearch.transport.TransportService; import com.amazon.opendistroforelasticsearch.ad.model.ADTaskAction; import com.amazon.opendistroforelasticsearch.ad.model.AnomalyDetector; @@ -54,7 +54,7 @@ protected void doExecute(Task task, ForwardADTaskRequest request, ActionListener listener.onResponse(new AnomalyDetectorJobResponse(detector.getDetectorId(), 0, 0, 0, RestStatus.OK)); break; default: - listener.onFailure(new ElasticsearchStatusException("Unsupported AD task action " + adTaskAction, RestStatus.BAD_REQUEST)); + listener.onFailure(new OpenSearchStatusException("Unsupported AD task action " + adTaskAction, RestStatus.BAD_REQUEST)); break; } diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/GetAnomalyDetectorAction.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/GetAnomalyDetectorAction.java index 0ab455985..498e9be57 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/GetAnomalyDetectorAction.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/GetAnomalyDetectorAction.java @@ -15,7 +15,7 @@ package com.amazon.opendistroforelasticsearch.ad.transport; -import org.elasticsearch.action.ActionType; +import org.opensearch.action.ActionType; import com.amazon.opendistroforelasticsearch.ad.constant.CommonValue; diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/GetAnomalyDetectorRequest.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/GetAnomalyDetectorRequest.java index b11f553fa..d0e4d7c97 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/GetAnomalyDetectorRequest.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/GetAnomalyDetectorRequest.java @@ -17,10 +17,10 @@ import java.io.IOException; -import org.elasticsearch.action.ActionRequest; -import org.elasticsearch.action.ActionRequestValidationException; -import org.elasticsearch.common.io.stream.StreamInput; -import org.elasticsearch.common.io.stream.StreamOutput; +import org.opensearch.action.ActionRequest; +import org.opensearch.action.ActionRequestValidationException; +import org.opensearch.common.io.stream.StreamInput; +import org.opensearch.common.io.stream.StreamOutput; public class GetAnomalyDetectorRequest extends ActionRequest { diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/GetAnomalyDetectorResponse.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/GetAnomalyDetectorResponse.java index 843b2f88a..8e60df053 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/GetAnomalyDetectorResponse.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/GetAnomalyDetectorResponse.java @@ -17,12 +17,12 @@ import java.io.IOException; -import org.elasticsearch.action.ActionResponse; -import org.elasticsearch.common.io.stream.StreamInput; -import org.elasticsearch.common.io.stream.StreamOutput; -import org.elasticsearch.common.xcontent.ToXContentObject; -import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.rest.RestStatus; +import org.opensearch.action.ActionResponse; +import org.opensearch.common.io.stream.StreamInput; +import org.opensearch.common.io.stream.StreamOutput; +import org.opensearch.common.xcontent.ToXContentObject; +import org.opensearch.common.xcontent.XContentBuilder; +import org.opensearch.rest.RestStatus; import com.amazon.opendistroforelasticsearch.ad.model.ADTask; import com.amazon.opendistroforelasticsearch.ad.model.AnomalyDetector; diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/GetAnomalyDetectorTransportAction.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/GetAnomalyDetectorTransportAction.java index 70a6c6d35..11ee8d344 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/GetAnomalyDetectorTransportAction.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/GetAnomalyDetectorTransportAction.java @@ -21,7 +21,7 @@ import static com.amazon.opendistroforelasticsearch.ad.util.ParseUtils.getUserContext; import static com.amazon.opendistroforelasticsearch.ad.util.ParseUtils.resolveUserAndExecute; import static com.amazon.opendistroforelasticsearch.ad.util.RestHandlerUtils.PROFILE; -import static org.elasticsearch.common.xcontent.XContentParserUtils.ensureExpectedToken; +import static org.opensearch.common.xcontent.XContentParserUtils.ensureExpectedToken; import java.util.Arrays; import java.util.EnumSet; @@ -33,25 +33,25 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import org.elasticsearch.ElasticsearchStatusException; -import org.elasticsearch.action.ActionListener; -import org.elasticsearch.action.get.MultiGetItemResponse; -import org.elasticsearch.action.get.MultiGetRequest; -import org.elasticsearch.action.get.MultiGetResponse; -import org.elasticsearch.action.support.ActionFilters; -import org.elasticsearch.action.support.HandledTransportAction; -import org.elasticsearch.client.Client; -import org.elasticsearch.cluster.service.ClusterService; -import org.elasticsearch.common.CheckedConsumer; -import org.elasticsearch.common.Strings; -import org.elasticsearch.common.inject.Inject; -import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.common.util.concurrent.ThreadContext; -import org.elasticsearch.common.xcontent.NamedXContentRegistry; -import org.elasticsearch.common.xcontent.XContentParser; -import org.elasticsearch.rest.RestStatus; -import org.elasticsearch.tasks.Task; -import org.elasticsearch.transport.TransportService; +import org.opensearch.OpenSearchStatusException; +import org.opensearch.action.ActionListener; +import org.opensearch.action.get.MultiGetItemResponse; +import org.opensearch.action.get.MultiGetRequest; +import org.opensearch.action.get.MultiGetResponse; +import org.opensearch.action.support.ActionFilters; +import org.opensearch.action.support.HandledTransportAction; +import org.opensearch.client.Client; +import org.opensearch.cluster.service.ClusterService; +import org.opensearch.common.CheckedConsumer; +import org.opensearch.common.Strings; +import org.opensearch.common.inject.Inject; +import org.opensearch.common.settings.Settings; +import org.opensearch.common.util.concurrent.ThreadContext; +import org.opensearch.common.xcontent.NamedXContentRegistry; +import org.opensearch.common.xcontent.XContentParser; +import org.opensearch.rest.RestStatus; +import org.opensearch.tasks.Task; +import org.opensearch.transport.TransportService; import com.amazon.opendistroforelasticsearch.ad.AnomalyDetectorProfileRunner; import com.amazon.opendistroforelasticsearch.ad.EntityProfileRunner; @@ -262,7 +262,7 @@ public void onResponse(MultiGetResponse multiGetResponse) { if (response.getResponse() == null || !response.getResponse().isExists()) { listener .onFailure( - new ElasticsearchStatusException("Can't find detector with id: " + detectorId, RestStatus.NOT_FOUND) + new OpenSearchStatusException("Can't find detector with id: " + detectorId, RestStatus.NOT_FOUND) ); return; } @@ -340,9 +340,9 @@ public void accept(DetectorProfile profile) throws Exception { }, exception -> { listener.onFailure(exception); }); } - private ElasticsearchStatusException buildInternalServerErrorResponse(Exception e, String errorMsg) { + private OpenSearchStatusException buildInternalServerErrorResponse(Exception e, String errorMsg) { LOG.error(errorMsg, e); - return new ElasticsearchStatusException(errorMsg, RestStatus.INTERNAL_SERVER_ERROR); + return new OpenSearchStatusException(errorMsg, RestStatus.INTERNAL_SERVER_ERROR); } /** diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/IndexAnomalyDetectorAction.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/IndexAnomalyDetectorAction.java index 4d34bc1e0..4ae41fe61 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/IndexAnomalyDetectorAction.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/IndexAnomalyDetectorAction.java @@ -15,7 +15,7 @@ package com.amazon.opendistroforelasticsearch.ad.transport; -import org.elasticsearch.action.ActionType; +import org.opensearch.action.ActionType; import com.amazon.opendistroforelasticsearch.ad.constant.CommonValue; diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/IndexAnomalyDetectorRequest.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/IndexAnomalyDetectorRequest.java index 6bbdc2933..fe2a3f638 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/IndexAnomalyDetectorRequest.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/IndexAnomalyDetectorRequest.java @@ -17,13 +17,13 @@ import java.io.IOException; -import org.elasticsearch.action.ActionRequest; -import org.elasticsearch.action.ActionRequestValidationException; -import org.elasticsearch.action.support.WriteRequest; -import org.elasticsearch.common.io.stream.StreamInput; -import org.elasticsearch.common.io.stream.StreamOutput; -import org.elasticsearch.common.unit.TimeValue; -import org.elasticsearch.rest.RestRequest; +import org.opensearch.action.ActionRequest; +import org.opensearch.action.ActionRequestValidationException; +import org.opensearch.action.support.WriteRequest; +import org.opensearch.common.io.stream.StreamInput; +import org.opensearch.common.io.stream.StreamOutput; +import org.opensearch.common.unit.TimeValue; +import org.opensearch.rest.RestRequest; import com.amazon.opendistroforelasticsearch.ad.model.AnomalyDetector; diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/IndexAnomalyDetectorResponse.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/IndexAnomalyDetectorResponse.java index 880c1eb6d..895aa2954 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/IndexAnomalyDetectorResponse.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/IndexAnomalyDetectorResponse.java @@ -17,12 +17,12 @@ import java.io.IOException; -import org.elasticsearch.action.ActionResponse; -import org.elasticsearch.common.io.stream.StreamInput; -import org.elasticsearch.common.io.stream.StreamOutput; -import org.elasticsearch.common.xcontent.ToXContentObject; -import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.rest.RestStatus; +import org.opensearch.action.ActionResponse; +import org.opensearch.common.io.stream.StreamInput; +import org.opensearch.common.io.stream.StreamOutput; +import org.opensearch.common.xcontent.ToXContentObject; +import org.opensearch.common.xcontent.XContentBuilder; +import org.opensearch.rest.RestStatus; import com.amazon.opendistroforelasticsearch.ad.model.AnomalyDetector; import com.amazon.opendistroforelasticsearch.ad.util.RestHandlerUtils; diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/IndexAnomalyDetectorTransportAction.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/IndexAnomalyDetectorTransportAction.java index 4b4c4cfcb..0c38160a1 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/IndexAnomalyDetectorTransportAction.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/IndexAnomalyDetectorTransportAction.java @@ -25,23 +25,23 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import org.elasticsearch.action.ActionListener; -import org.elasticsearch.action.search.SearchRequest; -import org.elasticsearch.action.support.ActionFilters; -import org.elasticsearch.action.support.HandledTransportAction; -import org.elasticsearch.action.support.WriteRequest; -import org.elasticsearch.client.Client; -import org.elasticsearch.cluster.service.ClusterService; -import org.elasticsearch.common.inject.Inject; -import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.common.unit.TimeValue; -import org.elasticsearch.common.util.concurrent.ThreadContext; -import org.elasticsearch.common.xcontent.NamedXContentRegistry; -import org.elasticsearch.index.query.QueryBuilders; -import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.search.builder.SearchSourceBuilder; -import org.elasticsearch.tasks.Task; -import org.elasticsearch.transport.TransportService; +import org.opensearch.action.ActionListener; +import org.opensearch.action.search.SearchRequest; +import org.opensearch.action.support.ActionFilters; +import org.opensearch.action.support.HandledTransportAction; +import org.opensearch.action.support.WriteRequest; +import org.opensearch.client.Client; +import org.opensearch.cluster.service.ClusterService; +import org.opensearch.common.inject.Inject; +import org.opensearch.common.settings.Settings; +import org.opensearch.common.unit.TimeValue; +import org.opensearch.common.util.concurrent.ThreadContext; +import org.opensearch.common.xcontent.NamedXContentRegistry; +import org.opensearch.index.query.QueryBuilders; +import org.opensearch.rest.RestRequest; +import org.opensearch.search.builder.SearchSourceBuilder; +import org.opensearch.tasks.Task; +import org.opensearch.transport.TransportService; import com.amazon.opendistroforelasticsearch.ad.indices.AnomalyDetectionIndices; import com.amazon.opendistroforelasticsearch.ad.model.AnomalyDetector; diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/PreviewAnomalyDetectorAction.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/PreviewAnomalyDetectorAction.java index 3dbaef57d..4cb877ef7 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/PreviewAnomalyDetectorAction.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/PreviewAnomalyDetectorAction.java @@ -15,7 +15,7 @@ package com.amazon.opendistroforelasticsearch.ad.transport; -import org.elasticsearch.action.ActionType; +import org.opensearch.action.ActionType; import com.amazon.opendistroforelasticsearch.ad.constant.CommonValue; diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/PreviewAnomalyDetectorRequest.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/PreviewAnomalyDetectorRequest.java index 1e813664e..88c97fb93 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/PreviewAnomalyDetectorRequest.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/PreviewAnomalyDetectorRequest.java @@ -18,10 +18,10 @@ import java.io.IOException; import java.time.Instant; -import org.elasticsearch.action.ActionRequest; -import org.elasticsearch.action.ActionRequestValidationException; -import org.elasticsearch.common.io.stream.StreamInput; -import org.elasticsearch.common.io.stream.StreamOutput; +import org.opensearch.action.ActionRequest; +import org.opensearch.action.ActionRequestValidationException; +import org.opensearch.common.io.stream.StreamInput; +import org.opensearch.common.io.stream.StreamOutput; import com.amazon.opendistroforelasticsearch.ad.model.AnomalyDetector; diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/PreviewAnomalyDetectorResponse.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/PreviewAnomalyDetectorResponse.java index 80daaf0f0..de977e745 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/PreviewAnomalyDetectorResponse.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/PreviewAnomalyDetectorResponse.java @@ -18,11 +18,11 @@ import java.io.IOException; import java.util.List; -import org.elasticsearch.action.ActionResponse; -import org.elasticsearch.common.io.stream.StreamInput; -import org.elasticsearch.common.io.stream.StreamOutput; -import org.elasticsearch.common.xcontent.ToXContentObject; -import org.elasticsearch.common.xcontent.XContentBuilder; +import org.opensearch.action.ActionResponse; +import org.opensearch.common.io.stream.StreamInput; +import org.opensearch.common.io.stream.StreamOutput; +import org.opensearch.common.xcontent.ToXContentObject; +import org.opensearch.common.xcontent.XContentBuilder; import com.amazon.opendistroforelasticsearch.ad.model.AnomalyDetector; import com.amazon.opendistroforelasticsearch.ad.model.AnomalyResult; diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/PreviewAnomalyDetectorTransportAction.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/PreviewAnomalyDetectorTransportAction.java index 1f24c16e3..4ea9d5e5b 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/PreviewAnomalyDetectorTransportAction.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/PreviewAnomalyDetectorTransportAction.java @@ -19,7 +19,7 @@ import static com.amazon.opendistroforelasticsearch.ad.settings.AnomalyDetectorSettings.MAX_ANOMALY_FEATURES; import static com.amazon.opendistroforelasticsearch.ad.util.ParseUtils.getUserContext; import static com.amazon.opendistroforelasticsearch.ad.util.ParseUtils.resolveUserAndExecute; -import static org.elasticsearch.common.xcontent.XContentParserUtils.ensureExpectedToken; +import static org.opensearch.common.xcontent.XContentParserUtils.ensureExpectedToken; import java.io.IOException; import java.time.Instant; @@ -28,23 +28,23 @@ import org.apache.commons.lang.StringUtils; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import org.elasticsearch.ElasticsearchException; -import org.elasticsearch.action.ActionListener; -import org.elasticsearch.action.get.GetRequest; -import org.elasticsearch.action.get.GetResponse; -import org.elasticsearch.action.support.ActionFilters; -import org.elasticsearch.action.support.HandledTransportAction; -import org.elasticsearch.client.Client; -import org.elasticsearch.cluster.service.ClusterService; -import org.elasticsearch.common.CheckedConsumer; -import org.elasticsearch.common.inject.Inject; -import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.common.util.concurrent.ThreadContext; -import org.elasticsearch.common.xcontent.NamedXContentRegistry; -import org.elasticsearch.common.xcontent.XContentParser; -import org.elasticsearch.rest.RestStatus; -import org.elasticsearch.tasks.Task; -import org.elasticsearch.transport.TransportService; +import org.opensearch.OpenSearchException; +import org.opensearch.action.ActionListener; +import org.opensearch.action.get.GetRequest; +import org.opensearch.action.get.GetResponse; +import org.opensearch.action.support.ActionFilters; +import org.opensearch.action.support.HandledTransportAction; +import org.opensearch.client.Client; +import org.opensearch.cluster.service.ClusterService; +import org.opensearch.common.CheckedConsumer; +import org.opensearch.common.inject.Inject; +import org.opensearch.common.settings.Settings; +import org.opensearch.common.util.concurrent.ThreadContext; +import org.opensearch.common.xcontent.NamedXContentRegistry; +import org.opensearch.common.xcontent.XContentParser; +import org.opensearch.rest.RestStatus; +import org.opensearch.tasks.Task; +import org.opensearch.transport.TransportService; import com.amazon.opendistroforelasticsearch.ad.AnomalyDetectorRunner; import com.amazon.opendistroforelasticsearch.ad.model.AnomalyDetector; @@ -114,7 +114,7 @@ void previewExecute(PreviewAnomalyDetectorRequest request, ActionListener anomalyResult) throws Exception { logger.error("Unexpected error running anomaly detector " + detector.getDetectorId(), exception); listener .onFailure( - new ElasticsearchException( + new OpenSearchException( "Unexpected error running anomaly detector " + detector.getDetectorId(), RestStatus.INTERNAL_SERVER_ERROR ) @@ -167,7 +167,7 @@ private void previewAnomalyDetector( GetRequest getRequest = new GetRequest(AnomalyDetector.ANOMALY_DETECTORS_INDEX).id(detectorId); client.get(getRequest, onGetAnomalyDetectorResponse(listener, startTime, endTime)); } else { - listener.onFailure(new ElasticsearchException("Wrong input, no detector id", RestStatus.BAD_REQUEST)); + listener.onFailure(new OpenSearchException("Wrong input, no detector id", RestStatus.BAD_REQUEST)); } } @@ -182,7 +182,7 @@ public void accept(GetResponse response) throws Exception { if (!response.isExists()) { listener .onFailure( - new ElasticsearchException("Can't find anomaly detector with id:" + response.getId(), RestStatus.NOT_FOUND) + new OpenSearchException("Can't find anomaly detector with id:" + response.getId(), RestStatus.NOT_FOUND) ); return; } @@ -199,6 +199,6 @@ public void accept(GetResponse response) throws Exception { listener.onFailure(e); } } - }, exception -> { listener.onFailure(new ElasticsearchException("Could not execute get query to find detector")); }); + }, exception -> { listener.onFailure(new OpenSearchException("Could not execute get query to find detector")); }); } } diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ProfileAction.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ProfileAction.java index 98bc62aae..e45643d97 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ProfileAction.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ProfileAction.java @@ -15,7 +15,7 @@ package com.amazon.opendistroforelasticsearch.ad.transport; -import org.elasticsearch.action.ActionType; +import org.opensearch.action.ActionType; import com.amazon.opendistroforelasticsearch.ad.constant.CommonValue; diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ProfileNodeRequest.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ProfileNodeRequest.java index 73738144b..38678ee67 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ProfileNodeRequest.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ProfileNodeRequest.java @@ -18,9 +18,9 @@ import java.io.IOException; import java.util.Set; -import org.elasticsearch.action.support.nodes.BaseNodeRequest; -import org.elasticsearch.common.io.stream.StreamInput; -import org.elasticsearch.common.io.stream.StreamOutput; +import org.opensearch.action.support.nodes.BaseNodeRequest; +import org.opensearch.common.io.stream.StreamInput; +import org.opensearch.common.io.stream.StreamOutput; import com.amazon.opendistroforelasticsearch.ad.model.DetectorProfileName; diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ProfileNodeResponse.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ProfileNodeResponse.java index 8fd41c068..fae0bc790 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ProfileNodeResponse.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ProfileNodeResponse.java @@ -18,12 +18,12 @@ import java.io.IOException; import java.util.Map; -import org.elasticsearch.action.support.nodes.BaseNodeResponse; -import org.elasticsearch.cluster.node.DiscoveryNode; -import org.elasticsearch.common.io.stream.StreamInput; -import org.elasticsearch.common.io.stream.StreamOutput; -import org.elasticsearch.common.xcontent.ToXContentFragment; -import org.elasticsearch.common.xcontent.XContentBuilder; +import org.opensearch.action.support.nodes.BaseNodeResponse; +import org.opensearch.cluster.node.DiscoveryNode; +import org.opensearch.common.io.stream.StreamInput; +import org.opensearch.common.io.stream.StreamOutput; +import org.opensearch.common.xcontent.ToXContentFragment; +import org.opensearch.common.xcontent.XContentBuilder; import com.amazon.opendistroforelasticsearch.ad.constant.CommonName; diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ProfileRequest.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ProfileRequest.java index 8f8ba24d2..ee731d89c 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ProfileRequest.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ProfileRequest.java @@ -19,10 +19,10 @@ import java.util.HashSet; import java.util.Set; -import org.elasticsearch.action.support.nodes.BaseNodesRequest; -import org.elasticsearch.cluster.node.DiscoveryNode; -import org.elasticsearch.common.io.stream.StreamInput; -import org.elasticsearch.common.io.stream.StreamOutput; +import org.opensearch.action.support.nodes.BaseNodesRequest; +import org.opensearch.cluster.node.DiscoveryNode; +import org.opensearch.common.io.stream.StreamInput; +import org.opensearch.common.io.stream.StreamOutput; import com.amazon.opendistroforelasticsearch.ad.model.DetectorProfileName; diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ProfileResponse.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ProfileResponse.java index fd7540c05..36c709c2a 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ProfileResponse.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ProfileResponse.java @@ -20,13 +20,13 @@ import java.util.List; import java.util.Map; -import org.elasticsearch.action.FailedNodeException; -import org.elasticsearch.action.support.nodes.BaseNodesResponse; -import org.elasticsearch.cluster.ClusterName; -import org.elasticsearch.common.io.stream.StreamInput; -import org.elasticsearch.common.io.stream.StreamOutput; -import org.elasticsearch.common.xcontent.ToXContentFragment; -import org.elasticsearch.common.xcontent.XContentBuilder; +import org.opensearch.action.FailedNodeException; +import org.opensearch.action.support.nodes.BaseNodesResponse; +import org.opensearch.cluster.ClusterName; +import org.opensearch.common.io.stream.StreamInput; +import org.opensearch.common.io.stream.StreamOutput; +import org.opensearch.common.xcontent.ToXContentFragment; +import org.opensearch.common.xcontent.XContentBuilder; import com.amazon.opendistroforelasticsearch.ad.constant.CommonName; import com.amazon.opendistroforelasticsearch.ad.model.ModelProfile; diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ProfileTransportAction.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ProfileTransportAction.java index 235aa372a..cb8683943 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ProfileTransportAction.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ProfileTransportAction.java @@ -20,14 +20,14 @@ import java.util.Map; import java.util.Set; -import org.elasticsearch.action.FailedNodeException; -import org.elasticsearch.action.support.ActionFilters; -import org.elasticsearch.action.support.nodes.TransportNodesAction; -import org.elasticsearch.cluster.service.ClusterService; -import org.elasticsearch.common.inject.Inject; -import org.elasticsearch.common.io.stream.StreamInput; -import org.elasticsearch.threadpool.ThreadPool; -import org.elasticsearch.transport.TransportService; +import org.opensearch.action.FailedNodeException; +import org.opensearch.action.support.ActionFilters; +import org.opensearch.action.support.nodes.TransportNodesAction; +import org.opensearch.cluster.service.ClusterService; +import org.opensearch.common.inject.Inject; +import org.opensearch.common.io.stream.StreamInput; +import org.opensearch.threadpool.ThreadPool; +import org.opensearch.transport.TransportService; import com.amazon.opendistroforelasticsearch.ad.caching.CacheProvider; import com.amazon.opendistroforelasticsearch.ad.feature.FeatureManager; diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/RCFPollingAction.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/RCFPollingAction.java index aacf0a1f8..1b17e7412 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/RCFPollingAction.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/RCFPollingAction.java @@ -15,7 +15,7 @@ package com.amazon.opendistroforelasticsearch.ad.transport; -import org.elasticsearch.action.ActionType; +import org.opensearch.action.ActionType; import com.amazon.opendistroforelasticsearch.ad.constant.CommonValue; diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/RCFPollingRequest.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/RCFPollingRequest.java index fb5e7ea67..fe4a2619c 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/RCFPollingRequest.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/RCFPollingRequest.java @@ -15,17 +15,17 @@ package com.amazon.opendistroforelasticsearch.ad.transport; -import static org.elasticsearch.action.ValidateActions.addValidationError; +import static org.opensearch.action.ValidateActions.addValidationError; import java.io.IOException; -import org.elasticsearch.action.ActionRequest; -import org.elasticsearch.action.ActionRequestValidationException; -import org.elasticsearch.common.Strings; -import org.elasticsearch.common.io.stream.StreamInput; -import org.elasticsearch.common.io.stream.StreamOutput; -import org.elasticsearch.common.xcontent.ToXContentObject; -import org.elasticsearch.common.xcontent.XContentBuilder; +import org.opensearch.action.ActionRequest; +import org.opensearch.action.ActionRequestValidationException; +import org.opensearch.common.Strings; +import org.opensearch.common.io.stream.StreamInput; +import org.opensearch.common.io.stream.StreamOutput; +import org.opensearch.common.xcontent.ToXContentObject; +import org.opensearch.common.xcontent.XContentBuilder; import com.amazon.opendistroforelasticsearch.ad.constant.CommonErrorMessages; import com.amazon.opendistroforelasticsearch.ad.constant.CommonMessageAttributes; diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/RCFPollingResponse.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/RCFPollingResponse.java index 52fbd0f7a..f3a17db41 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/RCFPollingResponse.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/RCFPollingResponse.java @@ -17,11 +17,11 @@ import java.io.IOException; -import org.elasticsearch.action.ActionResponse; -import org.elasticsearch.common.io.stream.StreamInput; -import org.elasticsearch.common.io.stream.StreamOutput; -import org.elasticsearch.common.xcontent.ToXContentObject; -import org.elasticsearch.common.xcontent.XContentBuilder; +import org.opensearch.action.ActionResponse; +import org.opensearch.common.io.stream.StreamInput; +import org.opensearch.common.io.stream.StreamOutput; +import org.opensearch.common.xcontent.ToXContentObject; +import org.opensearch.common.xcontent.XContentBuilder; public class RCFPollingResponse extends ActionResponse implements ToXContentObject { public static final String TOTAL_UPDATES_KEY = "totalUpdates"; diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/RCFPollingTransportAction.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/RCFPollingTransportAction.java index 1f52c2ea4..12d7cd4b5 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/RCFPollingTransportAction.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/RCFPollingTransportAction.java @@ -21,20 +21,20 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import org.elasticsearch.action.ActionListener; -import org.elasticsearch.action.support.ActionFilters; -import org.elasticsearch.action.support.HandledTransportAction; -import org.elasticsearch.cluster.node.DiscoveryNode; -import org.elasticsearch.cluster.service.ClusterService; -import org.elasticsearch.common.inject.Inject; -import org.elasticsearch.common.io.stream.StreamInput; -import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.tasks.Task; -import org.elasticsearch.threadpool.ThreadPool; -import org.elasticsearch.transport.TransportException; -import org.elasticsearch.transport.TransportRequestOptions; -import org.elasticsearch.transport.TransportResponseHandler; -import org.elasticsearch.transport.TransportService; +import org.opensearch.action.ActionListener; +import org.opensearch.action.support.ActionFilters; +import org.opensearch.action.support.HandledTransportAction; +import org.opensearch.cluster.node.DiscoveryNode; +import org.opensearch.cluster.service.ClusterService; +import org.opensearch.common.inject.Inject; +import org.opensearch.common.io.stream.StreamInput; +import org.opensearch.common.settings.Settings; +import org.opensearch.tasks.Task; +import org.opensearch.threadpool.ThreadPool; +import org.opensearch.transport.TransportException; +import org.opensearch.transport.TransportRequestOptions; +import org.opensearch.transport.TransportResponseHandler; +import org.opensearch.transport.TransportService; import com.amazon.opendistroforelasticsearch.ad.cluster.HashRing; import com.amazon.opendistroforelasticsearch.ad.common.exception.AnomalyDetectionException; diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/RCFResultAction.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/RCFResultAction.java index 9628d83de..150a7deaf 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/RCFResultAction.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/RCFResultAction.java @@ -15,7 +15,7 @@ package com.amazon.opendistroforelasticsearch.ad.transport; -import org.elasticsearch.action.ActionType; +import org.opensearch.action.ActionType; import com.amazon.opendistroforelasticsearch.ad.constant.CommonValue; diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/RCFResultRequest.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/RCFResultRequest.java index ce43e0a1a..60995c93b 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/RCFResultRequest.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/RCFResultRequest.java @@ -15,17 +15,17 @@ package com.amazon.opendistroforelasticsearch.ad.transport; -import static org.elasticsearch.action.ValidateActions.addValidationError; +import static org.opensearch.action.ValidateActions.addValidationError; import java.io.IOException; -import org.elasticsearch.action.ActionRequest; -import org.elasticsearch.action.ActionRequestValidationException; -import org.elasticsearch.common.Strings; -import org.elasticsearch.common.io.stream.StreamInput; -import org.elasticsearch.common.io.stream.StreamOutput; -import org.elasticsearch.common.xcontent.ToXContentObject; -import org.elasticsearch.common.xcontent.XContentBuilder; +import org.opensearch.action.ActionRequest; +import org.opensearch.action.ActionRequestValidationException; +import org.opensearch.common.Strings; +import org.opensearch.common.io.stream.StreamInput; +import org.opensearch.common.io.stream.StreamOutput; +import org.opensearch.common.xcontent.ToXContentObject; +import org.opensearch.common.xcontent.XContentBuilder; import com.amazon.opendistroforelasticsearch.ad.constant.CommonErrorMessages; import com.amazon.opendistroforelasticsearch.ad.constant.CommonMessageAttributes; diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/RCFResultResponse.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/RCFResultResponse.java index 74008c88f..a1a061e39 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/RCFResultResponse.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/RCFResultResponse.java @@ -17,11 +17,11 @@ import java.io.IOException; -import org.elasticsearch.action.ActionResponse; -import org.elasticsearch.common.io.stream.StreamInput; -import org.elasticsearch.common.io.stream.StreamOutput; -import org.elasticsearch.common.xcontent.ToXContentObject; -import org.elasticsearch.common.xcontent.XContentBuilder; +import org.opensearch.action.ActionResponse; +import org.opensearch.common.io.stream.StreamInput; +import org.opensearch.common.io.stream.StreamOutput; +import org.opensearch.common.xcontent.ToXContentObject; +import org.opensearch.common.xcontent.XContentBuilder; public class RCFResultResponse extends ActionResponse implements ToXContentObject { public static final String RCF_SCORE_JSON_KEY = "rcfScore"; diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/RCFResultTransportAction.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/RCFResultTransportAction.java index d46bdf73d..90318c6af 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/RCFResultTransportAction.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/RCFResultTransportAction.java @@ -17,12 +17,12 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import org.elasticsearch.action.ActionListener; -import org.elasticsearch.action.support.ActionFilters; -import org.elasticsearch.action.support.HandledTransportAction; -import org.elasticsearch.common.inject.Inject; -import org.elasticsearch.tasks.Task; -import org.elasticsearch.transport.TransportService; +import org.opensearch.action.ActionListener; +import org.opensearch.action.support.ActionFilters; +import org.opensearch.action.support.HandledTransportAction; +import org.opensearch.common.inject.Inject; +import org.opensearch.tasks.Task; +import org.opensearch.transport.TransportService; import com.amazon.opendistroforelasticsearch.ad.breaker.ADCircuitBreakerService; import com.amazon.opendistroforelasticsearch.ad.common.exception.LimitExceededException; diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/SearchADTasksAction.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/SearchADTasksAction.java index 8192353d7..7351699df 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/SearchADTasksAction.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/SearchADTasksAction.java @@ -15,8 +15,8 @@ package com.amazon.opendistroforelasticsearch.ad.transport; -import org.elasticsearch.action.ActionType; -import org.elasticsearch.action.search.SearchResponse; +import org.opensearch.action.ActionType; +import org.opensearch.action.search.SearchResponse; import com.amazon.opendistroforelasticsearch.ad.constant.CommonValue; diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/SearchADTasksTransportAction.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/SearchADTasksTransportAction.java index ac6a7705a..26dd3431b 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/SearchADTasksTransportAction.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/SearchADTasksTransportAction.java @@ -15,14 +15,14 @@ package com.amazon.opendistroforelasticsearch.ad.transport; -import org.elasticsearch.action.ActionListener; -import org.elasticsearch.action.search.SearchRequest; -import org.elasticsearch.action.search.SearchResponse; -import org.elasticsearch.action.support.ActionFilters; -import org.elasticsearch.action.support.HandledTransportAction; -import org.elasticsearch.common.inject.Inject; -import org.elasticsearch.tasks.Task; -import org.elasticsearch.transport.TransportService; +import org.opensearch.action.ActionListener; +import org.opensearch.action.search.SearchRequest; +import org.opensearch.action.search.SearchResponse; +import org.opensearch.action.support.ActionFilters; +import org.opensearch.action.support.HandledTransportAction; +import org.opensearch.common.inject.Inject; +import org.opensearch.tasks.Task; +import org.opensearch.transport.TransportService; import com.amazon.opendistroforelasticsearch.ad.transport.handler.ADSearchHandler; diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/SearchAnomalyDetectorAction.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/SearchAnomalyDetectorAction.java index 88fbbe6a7..31c5acf0a 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/SearchAnomalyDetectorAction.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/SearchAnomalyDetectorAction.java @@ -15,8 +15,8 @@ package com.amazon.opendistroforelasticsearch.ad.transport; -import org.elasticsearch.action.ActionType; -import org.elasticsearch.action.search.SearchResponse; +import org.opensearch.action.ActionType; +import org.opensearch.action.search.SearchResponse; import com.amazon.opendistroforelasticsearch.ad.constant.CommonValue; diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/SearchAnomalyDetectorInfoAction.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/SearchAnomalyDetectorInfoAction.java index 73a6db4f5..3b94ae391 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/SearchAnomalyDetectorInfoAction.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/SearchAnomalyDetectorInfoAction.java @@ -15,7 +15,7 @@ package com.amazon.opendistroforelasticsearch.ad.transport; -import org.elasticsearch.action.ActionType; +import org.opensearch.action.ActionType; import com.amazon.opendistroforelasticsearch.ad.constant.CommonValue; diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/SearchAnomalyDetectorInfoRequest.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/SearchAnomalyDetectorInfoRequest.java index 0f5ec8780..9006a5fa4 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/SearchAnomalyDetectorInfoRequest.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/SearchAnomalyDetectorInfoRequest.java @@ -17,10 +17,10 @@ import java.io.IOException; -import org.elasticsearch.action.ActionRequest; -import org.elasticsearch.action.ActionRequestValidationException; -import org.elasticsearch.common.io.stream.StreamInput; -import org.elasticsearch.common.io.stream.StreamOutput; +import org.opensearch.action.ActionRequest; +import org.opensearch.action.ActionRequestValidationException; +import org.opensearch.common.io.stream.StreamInput; +import org.opensearch.common.io.stream.StreamOutput; public class SearchAnomalyDetectorInfoRequest extends ActionRequest { diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/SearchAnomalyDetectorInfoResponse.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/SearchAnomalyDetectorInfoResponse.java index 67792a00c..a5473df7a 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/SearchAnomalyDetectorInfoResponse.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/SearchAnomalyDetectorInfoResponse.java @@ -17,11 +17,11 @@ import java.io.IOException; -import org.elasticsearch.action.ActionResponse; -import org.elasticsearch.common.io.stream.StreamInput; -import org.elasticsearch.common.io.stream.StreamOutput; -import org.elasticsearch.common.xcontent.ToXContentObject; -import org.elasticsearch.common.xcontent.XContentBuilder; +import org.opensearch.action.ActionResponse; +import org.opensearch.common.io.stream.StreamInput; +import org.opensearch.common.io.stream.StreamOutput; +import org.opensearch.common.xcontent.ToXContentObject; +import org.opensearch.common.xcontent.XContentBuilder; import com.amazon.opendistroforelasticsearch.ad.util.RestHandlerUtils; diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/SearchAnomalyDetectorInfoTransportAction.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/SearchAnomalyDetectorInfoTransportAction.java index 304acfbba..fc3183d89 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/SearchAnomalyDetectorInfoTransportAction.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/SearchAnomalyDetectorInfoTransportAction.java @@ -19,21 +19,21 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import org.elasticsearch.action.ActionListener; -import org.elasticsearch.action.search.SearchRequest; -import org.elasticsearch.action.search.SearchResponse; -import org.elasticsearch.action.support.ActionFilters; -import org.elasticsearch.action.support.HandledTransportAction; -import org.elasticsearch.client.Client; -import org.elasticsearch.cluster.service.ClusterService; -import org.elasticsearch.common.inject.Inject; -import org.elasticsearch.common.util.concurrent.ThreadContext; -import org.elasticsearch.index.IndexNotFoundException; -import org.elasticsearch.index.query.QueryBuilders; -import org.elasticsearch.index.query.TermsQueryBuilder; -import org.elasticsearch.search.builder.SearchSourceBuilder; -import org.elasticsearch.tasks.Task; -import org.elasticsearch.transport.TransportService; +import org.opensearch.action.ActionListener; +import org.opensearch.action.search.SearchRequest; +import org.opensearch.action.search.SearchResponse; +import org.opensearch.action.support.ActionFilters; +import org.opensearch.action.support.HandledTransportAction; +import org.opensearch.client.Client; +import org.opensearch.cluster.service.ClusterService; +import org.opensearch.common.inject.Inject; +import org.opensearch.common.util.concurrent.ThreadContext; +import org.opensearch.index.IndexNotFoundException; +import org.opensearch.index.query.QueryBuilders; +import org.opensearch.index.query.TermsQueryBuilder; +import org.opensearch.search.builder.SearchSourceBuilder; +import org.opensearch.tasks.Task; +import org.opensearch.transport.TransportService; import com.amazon.opendistroforelasticsearch.ad.util.RestHandlerUtils; diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/SearchAnomalyDetectorTransportAction.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/SearchAnomalyDetectorTransportAction.java index 1246ee753..636bead85 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/SearchAnomalyDetectorTransportAction.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/SearchAnomalyDetectorTransportAction.java @@ -15,14 +15,14 @@ package com.amazon.opendistroforelasticsearch.ad.transport; -import org.elasticsearch.action.ActionListener; -import org.elasticsearch.action.search.SearchRequest; -import org.elasticsearch.action.search.SearchResponse; -import org.elasticsearch.action.support.ActionFilters; -import org.elasticsearch.action.support.HandledTransportAction; -import org.elasticsearch.common.inject.Inject; -import org.elasticsearch.tasks.Task; -import org.elasticsearch.transport.TransportService; +import org.opensearch.action.ActionListener; +import org.opensearch.action.search.SearchRequest; +import org.opensearch.action.search.SearchResponse; +import org.opensearch.action.support.ActionFilters; +import org.opensearch.action.support.HandledTransportAction; +import org.opensearch.common.inject.Inject; +import org.opensearch.tasks.Task; +import org.opensearch.transport.TransportService; import com.amazon.opendistroforelasticsearch.ad.transport.handler.ADSearchHandler; diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/SearchAnomalyResultAction.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/SearchAnomalyResultAction.java index 6408bcbfd..d5c7d94b1 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/SearchAnomalyResultAction.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/SearchAnomalyResultAction.java @@ -15,8 +15,8 @@ package com.amazon.opendistroforelasticsearch.ad.transport; -import org.elasticsearch.action.ActionType; -import org.elasticsearch.action.search.SearchResponse; +import org.opensearch.action.ActionType; +import org.opensearch.action.search.SearchResponse; import com.amazon.opendistroforelasticsearch.ad.constant.CommonValue; diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/SearchAnomalyResultTransportAction.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/SearchAnomalyResultTransportAction.java index e625f5565..ebefe568b 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/SearchAnomalyResultTransportAction.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/SearchAnomalyResultTransportAction.java @@ -15,14 +15,14 @@ package com.amazon.opendistroforelasticsearch.ad.transport; -import org.elasticsearch.action.ActionListener; -import org.elasticsearch.action.search.SearchRequest; -import org.elasticsearch.action.search.SearchResponse; -import org.elasticsearch.action.support.ActionFilters; -import org.elasticsearch.action.support.HandledTransportAction; -import org.elasticsearch.common.inject.Inject; -import org.elasticsearch.tasks.Task; -import org.elasticsearch.transport.TransportService; +import org.opensearch.action.ActionListener; +import org.opensearch.action.search.SearchRequest; +import org.opensearch.action.search.SearchResponse; +import org.opensearch.action.support.ActionFilters; +import org.opensearch.action.support.HandledTransportAction; +import org.opensearch.common.inject.Inject; +import org.opensearch.tasks.Task; +import org.opensearch.transport.TransportService; import com.amazon.opendistroforelasticsearch.ad.transport.handler.ADSearchHandler; diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/StatsAnomalyDetectorAction.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/StatsAnomalyDetectorAction.java index 0aac6ec69..026dae0ea 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/StatsAnomalyDetectorAction.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/StatsAnomalyDetectorAction.java @@ -15,7 +15,7 @@ package com.amazon.opendistroforelasticsearch.ad.transport; -import org.elasticsearch.action.ActionType; +import org.opensearch.action.ActionType; import com.amazon.opendistroforelasticsearch.ad.constant.CommonValue; diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/StatsAnomalyDetectorResponse.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/StatsAnomalyDetectorResponse.java index b8514edca..5e3af2d2c 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/StatsAnomalyDetectorResponse.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/StatsAnomalyDetectorResponse.java @@ -17,11 +17,11 @@ import java.io.IOException; -import org.elasticsearch.action.ActionResponse; -import org.elasticsearch.common.io.stream.StreamInput; -import org.elasticsearch.common.io.stream.StreamOutput; -import org.elasticsearch.common.xcontent.ToXContentObject; -import org.elasticsearch.common.xcontent.XContentBuilder; +import org.opensearch.action.ActionResponse; +import org.opensearch.common.io.stream.StreamInput; +import org.opensearch.common.io.stream.StreamOutput; +import org.opensearch.common.xcontent.ToXContentObject; +import org.opensearch.common.xcontent.XContentBuilder; import com.amazon.opendistroforelasticsearch.ad.stats.ADStatsResponse; diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/StatsAnomalyDetectorTransportAction.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/StatsAnomalyDetectorTransportAction.java index 46d1eb3a3..ef3c83f92 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/StatsAnomalyDetectorTransportAction.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/StatsAnomalyDetectorTransportAction.java @@ -22,22 +22,22 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import org.elasticsearch.ElasticsearchStatusException; -import org.elasticsearch.action.ActionListener; -import org.elasticsearch.action.search.SearchRequest; -import org.elasticsearch.action.support.ActionFilters; -import org.elasticsearch.action.support.HandledTransportAction; -import org.elasticsearch.client.Client; -import org.elasticsearch.cluster.service.ClusterService; -import org.elasticsearch.common.inject.Inject; -import org.elasticsearch.common.util.concurrent.ThreadContext; -import org.elasticsearch.rest.RestStatus; -import org.elasticsearch.search.aggregations.AggregationBuilders; -import org.elasticsearch.search.aggregations.bucket.terms.StringTerms; -import org.elasticsearch.search.aggregations.bucket.terms.TermsAggregationBuilder; -import org.elasticsearch.search.builder.SearchSourceBuilder; -import org.elasticsearch.tasks.Task; -import org.elasticsearch.transport.TransportService; +import org.opensearch.OpenSearchStatusException; +import org.opensearch.action.ActionListener; +import org.opensearch.action.search.SearchRequest; +import org.opensearch.action.support.ActionFilters; +import org.opensearch.action.support.HandledTransportAction; +import org.opensearch.client.Client; +import org.opensearch.cluster.service.ClusterService; +import org.opensearch.common.inject.Inject; +import org.opensearch.common.util.concurrent.ThreadContext; +import org.opensearch.rest.RestStatus; +import org.opensearch.search.aggregations.AggregationBuilders; +import org.opensearch.search.aggregations.bucket.terms.StringTerms; +import org.opensearch.search.aggregations.bucket.terms.TermsAggregationBuilder; +import org.opensearch.search.builder.SearchSourceBuilder; +import org.opensearch.tasks.Task; +import org.opensearch.transport.TransportService; import com.amazon.opendistroforelasticsearch.ad.model.AnomalyDetector; import com.amazon.opendistroforelasticsearch.ad.model.AnomalyDetectorType; @@ -109,7 +109,7 @@ private ActionListener getRestStatsListener(ActionListener { listener.onResponse(new StatsAnomalyDetectorResponse(adStatsResponse)); }, - exception -> listener.onFailure(new ElasticsearchStatusException(exception.getMessage(), RestStatus.INTERNAL_SERVER_ERROR)) + exception -> listener.onFailure(new OpenSearchStatusException(exception.getMessage(), RestStatus.INTERNAL_SERVER_ERROR)) ); } diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/StopDetectorAction.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/StopDetectorAction.java index 518430591..50fdb054a 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/StopDetectorAction.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/StopDetectorAction.java @@ -15,7 +15,7 @@ package com.amazon.opendistroforelasticsearch.ad.transport; -import org.elasticsearch.action.ActionType; +import org.opensearch.action.ActionType; import com.amazon.opendistroforelasticsearch.ad.constant.CommonValue; diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/StopDetectorRequest.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/StopDetectorRequest.java index 1b0138415..35ed42142 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/StopDetectorRequest.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/StopDetectorRequest.java @@ -15,21 +15,21 @@ package com.amazon.opendistroforelasticsearch.ad.transport; -import static org.elasticsearch.action.ValidateActions.addValidationError; +import static org.opensearch.action.ValidateActions.addValidationError; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import org.elasticsearch.action.ActionRequest; -import org.elasticsearch.action.ActionRequestValidationException; -import org.elasticsearch.common.Strings; -import org.elasticsearch.common.io.stream.InputStreamStreamInput; -import org.elasticsearch.common.io.stream.OutputStreamStreamOutput; -import org.elasticsearch.common.io.stream.StreamInput; -import org.elasticsearch.common.io.stream.StreamOutput; -import org.elasticsearch.common.xcontent.ToXContentObject; -import org.elasticsearch.common.xcontent.XContentBuilder; +import org.opensearch.action.ActionRequest; +import org.opensearch.action.ActionRequestValidationException; +import org.opensearch.common.Strings; +import org.opensearch.common.io.stream.InputStreamStreamInput; +import org.opensearch.common.io.stream.OutputStreamStreamOutput; +import org.opensearch.common.io.stream.StreamInput; +import org.opensearch.common.io.stream.StreamOutput; +import org.opensearch.common.xcontent.ToXContentObject; +import org.opensearch.common.xcontent.XContentBuilder; import com.amazon.opendistroforelasticsearch.ad.constant.CommonErrorMessages; import com.amazon.opendistroforelasticsearch.ad.constant.CommonMessageAttributes; diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/StopDetectorResponse.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/StopDetectorResponse.java index 9aca7b9dd..b5d8d26ce 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/StopDetectorResponse.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/StopDetectorResponse.java @@ -19,13 +19,13 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; -import org.elasticsearch.action.ActionResponse; -import org.elasticsearch.common.io.stream.InputStreamStreamInput; -import org.elasticsearch.common.io.stream.OutputStreamStreamOutput; -import org.elasticsearch.common.io.stream.StreamInput; -import org.elasticsearch.common.io.stream.StreamOutput; -import org.elasticsearch.common.xcontent.ToXContentObject; -import org.elasticsearch.common.xcontent.XContentBuilder; +import org.opensearch.action.ActionResponse; +import org.opensearch.common.io.stream.InputStreamStreamInput; +import org.opensearch.common.io.stream.OutputStreamStreamOutput; +import org.opensearch.common.io.stream.StreamInput; +import org.opensearch.common.io.stream.StreamOutput; +import org.opensearch.common.xcontent.ToXContentObject; +import org.opensearch.common.xcontent.XContentBuilder; public class StopDetectorResponse extends ActionResponse implements ToXContentObject { public static final String SUCCESS_JSON_KEY = "success"; diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/StopDetectorTransportAction.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/StopDetectorTransportAction.java index 93786df73..84e5b736a 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/StopDetectorTransportAction.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/StopDetectorTransportAction.java @@ -18,17 +18,17 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.message.ParameterizedMessage; -import org.elasticsearch.ExceptionsHelper; -import org.elasticsearch.action.ActionListener; -import org.elasticsearch.action.ActionRequest; -import org.elasticsearch.action.FailedNodeException; -import org.elasticsearch.action.support.ActionFilters; -import org.elasticsearch.action.support.HandledTransportAction; -import org.elasticsearch.client.Client; -import org.elasticsearch.cluster.node.DiscoveryNode; -import org.elasticsearch.common.inject.Inject; -import org.elasticsearch.tasks.Task; -import org.elasticsearch.transport.TransportService; +import org.opensearch.ExceptionsHelper; +import org.opensearch.action.ActionListener; +import org.opensearch.action.ActionRequest; +import org.opensearch.action.FailedNodeException; +import org.opensearch.action.support.ActionFilters; +import org.opensearch.action.support.HandledTransportAction; +import org.opensearch.client.Client; +import org.opensearch.cluster.node.DiscoveryNode; +import org.opensearch.common.inject.Inject; +import org.opensearch.tasks.Task; +import org.opensearch.transport.TransportService; import com.amazon.opendistroforelasticsearch.ad.common.exception.InternalFailure; import com.amazon.opendistroforelasticsearch.ad.util.DiscoveryNodeFilterer; diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ThresholdResultAction.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ThresholdResultAction.java index d63fd4450..63c467f98 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ThresholdResultAction.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ThresholdResultAction.java @@ -15,7 +15,7 @@ package com.amazon.opendistroforelasticsearch.ad.transport; -import org.elasticsearch.action.ActionType; +import org.opensearch.action.ActionType; import com.amazon.opendistroforelasticsearch.ad.constant.CommonValue; diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ThresholdResultRequest.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ThresholdResultRequest.java index 2f06d5c19..7085dbf22 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ThresholdResultRequest.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ThresholdResultRequest.java @@ -15,17 +15,17 @@ package com.amazon.opendistroforelasticsearch.ad.transport; -import static org.elasticsearch.action.ValidateActions.addValidationError; +import static org.opensearch.action.ValidateActions.addValidationError; import java.io.IOException; -import org.elasticsearch.action.ActionRequest; -import org.elasticsearch.action.ActionRequestValidationException; -import org.elasticsearch.common.Strings; -import org.elasticsearch.common.io.stream.StreamInput; -import org.elasticsearch.common.io.stream.StreamOutput; -import org.elasticsearch.common.xcontent.ToXContentObject; -import org.elasticsearch.common.xcontent.XContentBuilder; +import org.opensearch.action.ActionRequest; +import org.opensearch.action.ActionRequestValidationException; +import org.opensearch.common.Strings; +import org.opensearch.common.io.stream.StreamInput; +import org.opensearch.common.io.stream.StreamOutput; +import org.opensearch.common.xcontent.ToXContentObject; +import org.opensearch.common.xcontent.XContentBuilder; import com.amazon.opendistroforelasticsearch.ad.constant.CommonErrorMessages; import com.amazon.opendistroforelasticsearch.ad.constant.CommonMessageAttributes; diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ThresholdResultResponse.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ThresholdResultResponse.java index b79bd339e..332b8fcb5 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ThresholdResultResponse.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ThresholdResultResponse.java @@ -17,11 +17,11 @@ import java.io.IOException; -import org.elasticsearch.action.ActionResponse; -import org.elasticsearch.common.io.stream.StreamInput; -import org.elasticsearch.common.io.stream.StreamOutput; -import org.elasticsearch.common.xcontent.ToXContentObject; -import org.elasticsearch.common.xcontent.XContentBuilder; +import org.opensearch.action.ActionResponse; +import org.opensearch.common.io.stream.StreamInput; +import org.opensearch.common.io.stream.StreamOutput; +import org.opensearch.common.xcontent.ToXContentObject; +import org.opensearch.common.xcontent.XContentBuilder; import com.amazon.opendistroforelasticsearch.ad.constant.CommonMessageAttributes; diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ThresholdResultTransportAction.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ThresholdResultTransportAction.java index f12ea1b2e..a60bf52c9 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ThresholdResultTransportAction.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/ThresholdResultTransportAction.java @@ -17,12 +17,12 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import org.elasticsearch.action.ActionListener; -import org.elasticsearch.action.support.ActionFilters; -import org.elasticsearch.action.support.HandledTransportAction; -import org.elasticsearch.common.inject.Inject; -import org.elasticsearch.tasks.Task; -import org.elasticsearch.transport.TransportService; +import org.opensearch.action.ActionListener; +import org.opensearch.action.support.ActionFilters; +import org.opensearch.action.support.HandledTransportAction; +import org.opensearch.common.inject.Inject; +import org.opensearch.tasks.Task; +import org.opensearch.transport.TransportService; import com.amazon.opendistroforelasticsearch.ad.ml.ModelManager; diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/handler/ADSearchHandler.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/handler/ADSearchHandler.java index 82b3f515d..6f93bbd12 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/handler/ADSearchHandler.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/handler/ADSearchHandler.java @@ -21,13 +21,13 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import org.elasticsearch.action.ActionListener; -import org.elasticsearch.action.search.SearchRequest; -import org.elasticsearch.action.search.SearchResponse; -import org.elasticsearch.client.Client; -import org.elasticsearch.cluster.service.ClusterService; -import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.common.util.concurrent.ThreadContext; +import org.opensearch.action.ActionListener; +import org.opensearch.action.search.SearchRequest; +import org.opensearch.action.search.SearchResponse; +import org.opensearch.client.Client; +import org.opensearch.cluster.service.ClusterService; +import org.opensearch.common.settings.Settings; +import org.opensearch.common.util.concurrent.ThreadContext; import com.amazon.opendistroforelasticsearch.ad.settings.AnomalyDetectorSettings; import com.amazon.opendistroforelasticsearch.commons.authuser.User; diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/handler/AnomalyIndexHandler.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/handler/AnomalyIndexHandler.java index 6e0d90df8..287171abf 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/handler/AnomalyIndexHandler.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/transport/handler/AnomalyIndexHandler.java @@ -15,7 +15,7 @@ package com.amazon.opendistroforelasticsearch.ad.transport.handler; -import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder; +import static org.opensearch.common.xcontent.XContentFactory.jsonBuilder; import java.util.Iterator; import java.util.Locale; @@ -24,22 +24,22 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import org.elasticsearch.ExceptionsHelper; -import org.elasticsearch.ResourceAlreadyExistsException; -import org.elasticsearch.action.ActionListener; -import org.elasticsearch.action.admin.indices.create.CreateIndexResponse; -import org.elasticsearch.action.bulk.BackoffPolicy; -import org.elasticsearch.action.index.IndexRequest; -import org.elasticsearch.action.index.IndexResponse; -import org.elasticsearch.client.Client; -import org.elasticsearch.cluster.block.ClusterBlockLevel; -import org.elasticsearch.cluster.service.ClusterService; -import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.common.unit.TimeValue; -import org.elasticsearch.common.util.concurrent.EsRejectedExecutionException; -import org.elasticsearch.common.xcontent.ToXContentObject; -import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.threadpool.ThreadPool; +import org.opensearch.ExceptionsHelper; +import org.opensearch.ResourceAlreadyExistsException; +import org.opensearch.action.ActionListener; +import org.opensearch.action.admin.indices.create.CreateIndexResponse; +import org.opensearch.action.bulk.BackoffPolicy; +import org.opensearch.action.index.IndexRequest; +import org.opensearch.action.index.IndexResponse; +import org.opensearch.client.Client; +import org.opensearch.cluster.block.ClusterBlockLevel; +import org.opensearch.cluster.service.ClusterService; +import org.opensearch.common.settings.Settings; +import org.opensearch.common.unit.TimeValue; +import org.opensearch.common.util.concurrent.OpenSearchRejectedExecutionException; +import org.opensearch.common.xcontent.ToXContentObject; +import org.opensearch.common.xcontent.XContentBuilder; +import org.opensearch.threadpool.ThreadPool; import com.amazon.opendistroforelasticsearch.ad.common.exception.AnomalyDetectionException; import com.amazon.opendistroforelasticsearch.ad.settings.AnomalyDetectorSettings; @@ -191,13 +191,13 @@ void saveIteration(IndexRequest indexRequest, String detectorId, Iterator ActionRequest * @param ActionResponse * @return the response - * @throws ElasticsearchTimeoutException when we cannot get response within time. + * @throws OpenSearchTimeoutException when we cannot get response within time. * @throws IllegalStateException when the waiting thread is interrupted */ public Optional timedRequest( @@ -105,7 +105,7 @@ public Optional ); if (!latch.await(requestTimeout.getSeconds(), TimeUnit.SECONDS)) { - throw new ElasticsearchTimeoutException("Cannot get response within time limit: " + request.toString()); + throw new OpenSearchTimeoutException("Cannot get response within time limit: " + request.toString()); } return Optional.ofNullable(respReference.get()); } catch (InterruptedException e1) { @@ -188,7 +188,7 @@ public Response * @param detector Anomaly Detector * @return the response * @throws InternalFailure when there is already a query running - * @throws ElasticsearchTimeoutException when we cannot get response within time. + * @throws OpenSearchTimeoutException when we cannot get response within time. * @throws IllegalStateException when the waiting thread is interrupted */ public Optional throttledTimedRequest( @@ -227,7 +227,7 @@ public Optional } if (!latch.await(requestTimeout.getSeconds(), TimeUnit.SECONDS)) { - throw new ElasticsearchTimeoutException("Cannot get response within time limit: " + request.toString()); + throw new OpenSearchTimeoutException("Cannot get response within time limit: " + request.toString()); } return Optional.ofNullable(respReference.get()); } catch (InterruptedException e1) { @@ -324,7 +324,7 @@ private void onListTaskResponse(ListTasksResponse listTasksResponse, String dete */ private void onCancelTaskResponse(CancelTasksResponse cancelTasksResponse, String detectorId, Logger LOG) { // todo: adding retry mechanism - List nodeFailures = cancelTasksResponse.getNodeFailures(); + List nodeFailures = cancelTasksResponse.getNodeFailures(); List taskFailures = cancelTasksResponse.getTaskFailures(); if (nodeFailures.isEmpty() && taskFailures.isEmpty()) { LOG.info("Cancelling query for detectorId: {} succeeds. Clear entry from Throttler", detectorId); diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/util/DiscoveryNodeFilterer.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/util/DiscoveryNodeFilterer.java index 894aa5237..b49ca5d39 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/util/DiscoveryNodeFilterer.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/util/DiscoveryNodeFilterer.java @@ -21,9 +21,9 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import org.elasticsearch.cluster.ClusterState; -import org.elasticsearch.cluster.node.DiscoveryNode; -import org.elasticsearch.cluster.service.ClusterService; +import org.opensearch.cluster.ClusterState; +import org.opensearch.cluster.node.DiscoveryNode; +import org.opensearch.cluster.service.ClusterService; import com.amazon.opendistroforelasticsearch.ad.constant.CommonName; diff --git a/src/main/java/com/amazon/opendistroforelasticsearch/ad/util/ExceptionUtil.java b/src/main/java/com/amazon/opendistroforelasticsearch/ad/util/ExceptionUtil.java index 25d81d048..e84845245 100644 --- a/src/main/java/com/amazon/opendistroforelasticsearch/ad/util/ExceptionUtil.java +++ b/src/main/java/com/amazon/opendistroforelasticsearch/ad/util/ExceptionUtil.java @@ -16,21 +16,21 @@ package com.amazon.opendistroforelasticsearch.ad.util; import org.apache.commons.lang.exception.ExceptionUtils; -import org.elasticsearch.ElasticsearchException; -import org.elasticsearch.action.index.IndexResponse; -import org.elasticsearch.action.support.replication.ReplicationResponse; -import org.elasticsearch.common.io.stream.NotSerializableExceptionWrapper; +import org.opensearch.OpenSearchException; +import org.opensearch.action.index.IndexResponse; +import org.opensearch.action.support.replication.ReplicationResponse; +import org.opensearch.common.io.stream.NotSerializableExceptionWrapper; import com.amazon.opendistroforelasticsearch.ad.common.exception.AnomalyDetectionException; import com.amazon.opendistroforelasticsearch.ad.common.exception.ResourceNotFoundException; public class ExceptionUtil { - public static final String RESOURCE_NOT_FOUND_EXCEPTION_NAME_UNDERSCORE = ElasticsearchException + public static final String RESOURCE_NOT_FOUND_EXCEPTION_NAME_UNDERSCORE = OpenSearchException .getExceptionName(new ResourceNotFoundException("", "")); /** * Elasticsearch restricts the kind of exceptions can be thrown over the wire - * (See ElasticsearchException.ElasticsearchExceptionHandle). Since we cannot + * (See OpenSearchException.OpenSearchExceptionHandle). Since we cannot * add our own exception like ResourceNotFoundException without modifying * Elasticsearch's code, we have to unwrap the remote transport exception and * check its root cause message. @@ -52,7 +52,7 @@ public static boolean isException(Throwable exception, Class exceptionCaptor; diff --git a/src/test/java/com/amazon/opendistroforelasticsearch/ad/AbstractADTest.java b/src/test/java/com/amazon/opendistroforelasticsearch/ad/AbstractADTest.java index f6fb1ad1c..7f579855b 100644 --- a/src/test/java/com/amazon/opendistroforelasticsearch/ad/AbstractADTest.java +++ b/src/test/java/com/amazon/opendistroforelasticsearch/ad/AbstractADTest.java @@ -39,26 +39,26 @@ import org.apache.logging.log4j.core.appender.AbstractAppender; import org.apache.logging.log4j.core.layout.PatternLayout; import org.apache.logging.log4j.util.StackLocatorUtil; -import org.elasticsearch.Version; -import org.elasticsearch.action.ActionResponse; -import org.elasticsearch.action.support.PlainActionFuture; -import org.elasticsearch.cluster.metadata.AliasMetadata; -import org.elasticsearch.cluster.metadata.IndexMetadata; -import org.elasticsearch.common.bytes.BytesReference; -import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.common.xcontent.NamedXContentRegistry; -import org.elasticsearch.http.HttpRequest; -import org.elasticsearch.http.HttpResponse; -import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestRequest.Method; -import org.elasticsearch.rest.RestStatus; -import org.elasticsearch.search.SearchModule; -import org.elasticsearch.test.ESTestCase; -import org.elasticsearch.threadpool.FixedExecutorBuilder; -import org.elasticsearch.threadpool.TestThreadPool; -import org.elasticsearch.threadpool.ThreadPool; -import org.elasticsearch.transport.TransportInterceptor; -import org.elasticsearch.transport.TransportService; +import org.opensearch.Version; +import org.opensearch.action.ActionResponse; +import org.opensearch.action.support.PlainActionFuture; +import org.opensearch.cluster.metadata.AliasMetadata; +import org.opensearch.cluster.metadata.IndexMetadata; +import org.opensearch.common.bytes.BytesReference; +import org.opensearch.common.settings.Settings; +import org.opensearch.common.xcontent.NamedXContentRegistry; +import org.opensearch.http.HttpRequest; +import org.opensearch.http.HttpResponse; +import org.opensearch.rest.RestRequest; +import org.opensearch.rest.RestRequest.Method; +import org.opensearch.rest.RestStatus; +import org.opensearch.search.SearchModule; +import org.opensearch.test.OpenSearchTestCase; +import org.opensearch.threadpool.FixedExecutorBuilder; +import org.opensearch.threadpool.TestThreadPool; +import org.opensearch.threadpool.ThreadPool; +import org.opensearch.transport.TransportInterceptor; +import org.opensearch.transport.TransportService; import test.com.amazon.opendistroforelasticsearch.ad.util.FakeNode; @@ -67,7 +67,7 @@ import com.amazon.opendistroforelasticsearch.ad.model.AnomalyResult; import com.amazon.opendistroforelasticsearch.ad.model.DetectorInternalState; -public class AbstractADTest extends ESTestCase { +public class AbstractADTest extends OpenSearchTestCase { protected static final Logger LOG = (Logger) LogManager.getLogger(AbstractADTest.class); diff --git a/src/test/java/com/amazon/opendistroforelasticsearch/ad/AbstractProfileRunnerTests.java b/src/test/java/com/amazon/opendistroforelasticsearch/ad/AbstractProfileRunnerTests.java index d00aaa632..fd81584a7 100644 --- a/src/test/java/com/amazon/opendistroforelasticsearch/ad/AbstractProfileRunnerTests.java +++ b/src/test/java/com/amazon/opendistroforelasticsearch/ad/AbstractProfileRunnerTests.java @@ -24,17 +24,17 @@ import java.util.HashSet; import java.util.Set; -import org.elasticsearch.Version; -import org.elasticsearch.action.get.GetResponse; -import org.elasticsearch.client.Client; -import org.elasticsearch.cluster.ClusterName; -import org.elasticsearch.cluster.ClusterState; -import org.elasticsearch.cluster.node.DiscoveryNode; -import org.elasticsearch.cluster.service.ClusterService; -import org.elasticsearch.common.transport.TransportAddress; -import org.elasticsearch.transport.TransportService; import org.junit.Before; import org.junit.BeforeClass; +import org.opensearch.Version; +import org.opensearch.action.get.GetResponse; +import org.opensearch.client.Client; +import org.opensearch.cluster.ClusterName; +import org.opensearch.cluster.ClusterState; +import org.opensearch.cluster.node.DiscoveryNode; +import org.opensearch.cluster.service.ClusterService; +import org.opensearch.common.transport.TransportAddress; +import org.opensearch.transport.TransportService; import com.amazon.opendistroforelasticsearch.ad.model.AnomalyDetector; import com.amazon.opendistroforelasticsearch.ad.model.DetectorProfileName; diff --git a/src/test/java/com/amazon/opendistroforelasticsearch/ad/AnomalyDetectorJobRunnerTests.java b/src/test/java/com/amazon/opendistroforelasticsearch/ad/AnomalyDetectorJobRunnerTests.java index 2ff7d81bc..533762248 100644 --- a/src/test/java/com/amazon/opendistroforelasticsearch/ad/AnomalyDetectorJobRunnerTests.java +++ b/src/test/java/com/amazon/opendistroforelasticsearch/ad/AnomalyDetectorJobRunnerTests.java @@ -15,7 +15,6 @@ package com.amazon.opendistroforelasticsearch.ad; -import static org.elasticsearch.index.seqno.SequenceNumbers.UNASSIGNED_SEQ_NO; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.Mockito.doAnswer; @@ -26,6 +25,7 @@ import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; +import static org.opensearch.index.seqno.SequenceNumbers.UNASSIGNED_SEQ_NO; import java.time.Instant; import java.time.temporal.ChronoUnit; @@ -34,26 +34,6 @@ import java.util.concurrent.ExecutorService; import java.util.concurrent.ThreadFactory; -import org.elasticsearch.action.ActionListener; -import org.elasticsearch.action.get.GetRequest; -import org.elasticsearch.action.get.GetResponse; -import org.elasticsearch.action.index.IndexRequest; -import org.elasticsearch.action.index.IndexResponse; -import org.elasticsearch.client.Client; -import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver; -import org.elasticsearch.cluster.service.ClusterService; -import org.elasticsearch.common.bytes.BytesReference; -import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.common.unit.TimeValue; -import org.elasticsearch.common.util.concurrent.EsExecutors; -import org.elasticsearch.common.util.concurrent.ThreadContext; -import org.elasticsearch.common.xcontent.NamedXContentRegistry; -import org.elasticsearch.common.xcontent.ToXContent; -import org.elasticsearch.index.Index; -import org.elasticsearch.index.get.GetResult; -import org.elasticsearch.index.mapper.MapperService; -import org.elasticsearch.index.shard.ShardId; -import org.elasticsearch.threadpool.ThreadPool; import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; @@ -63,6 +43,26 @@ import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.MockitoAnnotations; +import org.opensearch.action.ActionListener; +import org.opensearch.action.get.GetRequest; +import org.opensearch.action.get.GetResponse; +import org.opensearch.action.index.IndexRequest; +import org.opensearch.action.index.IndexResponse; +import org.opensearch.client.Client; +import org.opensearch.cluster.metadata.IndexNameExpressionResolver; +import org.opensearch.cluster.service.ClusterService; +import org.opensearch.common.bytes.BytesReference; +import org.opensearch.common.settings.Settings; +import org.opensearch.common.unit.TimeValue; +import org.opensearch.common.util.concurrent.OpenSearchExecutors; +import org.opensearch.common.util.concurrent.ThreadContext; +import org.opensearch.common.xcontent.NamedXContentRegistry; +import org.opensearch.common.xcontent.ToXContent; +import org.opensearch.index.Index; +import org.opensearch.index.get.GetResult; +import org.opensearch.index.mapper.MapperService; +import org.opensearch.index.shard.ShardId; +import org.opensearch.threadpool.ThreadPool; import com.amazon.opendistroforelasticsearch.ad.common.exception.EndRunException; import com.amazon.opendistroforelasticsearch.ad.indices.AnomalyDetectionIndices; @@ -133,9 +133,9 @@ public void setup() throws Exception { super.setUp(); super.setUpLog4jForJUnit(AnomalyDetectorJobRunner.class); MockitoAnnotations.initMocks(this); - ThreadFactory threadFactory = EsExecutors.daemonThreadFactory(EsExecutors.threadName("node1", "test-ad")); + ThreadFactory threadFactory = OpenSearchExecutors.daemonThreadFactory(OpenSearchExecutors.threadName("node1", "test-ad")); ThreadContext threadContext = new ThreadContext(Settings.EMPTY); - executorService = EsExecutors.newFixed("test-ad", 4, 100, threadFactory, threadContext); + executorService = OpenSearchExecutors.newFixed("test-ad", 4, 100, threadFactory, threadContext); Mockito.doReturn(executorService).when(mockedThreadPool).executor(anyString()); Mockito.doReturn(mockedThreadPool).when(client).threadPool(); Mockito.doReturn(threadContext).when(mockedThreadPool).getThreadContext(); diff --git a/src/test/java/com/amazon/opendistroforelasticsearch/ad/AnomalyDetectorProfileRunnerTests.java b/src/test/java/com/amazon/opendistroforelasticsearch/ad/AnomalyDetectorProfileRunnerTests.java index c73142053..682184e31 100644 --- a/src/test/java/com/amazon/opendistroforelasticsearch/ad/AnomalyDetectorProfileRunnerTests.java +++ b/src/test/java/com/amazon/opendistroforelasticsearch/ad/AnomalyDetectorProfileRunnerTests.java @@ -35,17 +35,17 @@ import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; -import org.elasticsearch.Version; -import org.elasticsearch.action.ActionListener; -import org.elasticsearch.action.FailedNodeException; -import org.elasticsearch.action.get.GetRequest; -import org.elasticsearch.action.get.GetResponse; -import org.elasticsearch.cluster.ClusterName; -import org.elasticsearch.cluster.node.DiscoveryNode; -import org.elasticsearch.common.io.stream.NotSerializableExceptionWrapper; -import org.elasticsearch.common.transport.TransportAddress; -import org.elasticsearch.index.IndexNotFoundException; -import org.elasticsearch.transport.RemoteTransportException; +import org.opensearch.Version; +import org.opensearch.action.ActionListener; +import org.opensearch.action.FailedNodeException; +import org.opensearch.action.get.GetRequest; +import org.opensearch.action.get.GetResponse; +import org.opensearch.cluster.ClusterName; +import org.opensearch.cluster.node.DiscoveryNode; +import org.opensearch.common.io.stream.NotSerializableExceptionWrapper; +import org.opensearch.common.transport.TransportAddress; +import org.opensearch.index.IndexNotFoundException; +import org.opensearch.transport.RemoteTransportException; import com.amazon.opendistroforelasticsearch.ad.common.exception.AnomalyDetectionException; import com.amazon.opendistroforelasticsearch.ad.common.exception.ResourceNotFoundException; diff --git a/src/test/java/com/amazon/opendistroforelasticsearch/ad/AnomalyDetectorRestTestCase.java b/src/test/java/com/amazon/opendistroforelasticsearch/ad/AnomalyDetectorRestTestCase.java index 5eb24d317..6bcc56b32 100644 --- a/src/test/java/com/amazon/opendistroforelasticsearch/ad/AnomalyDetectorRestTestCase.java +++ b/src/test/java/com/amazon/opendistroforelasticsearch/ad/AnomalyDetectorRestTestCase.java @@ -16,7 +16,7 @@ package com.amazon.opendistroforelasticsearch.ad; import static org.apache.http.entity.ContentType.APPLICATION_JSON; -import static org.elasticsearch.common.xcontent.json.JsonXContent.jsonXContent; +import static org.opensearch.common.xcontent.json.JsonXContent.jsonXContent; import java.io.IOException; import java.io.InputStream; @@ -27,22 +27,22 @@ import org.apache.http.HttpHeaders; import org.apache.http.entity.StringEntity; import org.apache.http.message.BasicHeader; -import org.elasticsearch.client.Request; -import org.elasticsearch.client.Response; -import org.elasticsearch.client.RestClient; -import org.elasticsearch.common.Strings; -import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.common.xcontent.LoggingDeprecationHandler; -import org.elasticsearch.common.xcontent.NamedXContentRegistry; -import org.elasticsearch.common.xcontent.ToXContent; -import org.elasticsearch.common.xcontent.ToXContentObject; -import org.elasticsearch.common.xcontent.XContent; -import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentFactory; -import org.elasticsearch.common.xcontent.XContentParser; -import org.elasticsearch.common.xcontent.XContentParserUtils; -import org.elasticsearch.common.xcontent.XContentType; -import org.elasticsearch.rest.RestStatus; +import org.opensearch.client.Request; +import org.opensearch.client.Response; +import org.opensearch.client.RestClient; +import org.opensearch.common.Strings; +import org.opensearch.common.settings.Settings; +import org.opensearch.common.xcontent.LoggingDeprecationHandler; +import org.opensearch.common.xcontent.NamedXContentRegistry; +import org.opensearch.common.xcontent.ToXContent; +import org.opensearch.common.xcontent.ToXContentObject; +import org.opensearch.common.xcontent.XContent; +import org.opensearch.common.xcontent.XContentBuilder; +import org.opensearch.common.xcontent.XContentFactory; +import org.opensearch.common.xcontent.XContentParser; +import org.opensearch.common.xcontent.XContentParserUtils; +import org.opensearch.common.xcontent.XContentType; +import org.opensearch.rest.RestStatus; import com.amazon.opendistroforelasticsearch.ad.model.ADTask; import com.amazon.opendistroforelasticsearch.ad.model.AnomalyDetector; diff --git a/src/test/java/com/amazon/opendistroforelasticsearch/ad/EntityProfileRunnerTests.java b/src/test/java/com/amazon/opendistroforelasticsearch/ad/EntityProfileRunnerTests.java index bf479f93d..972e8e530 100644 --- a/src/test/java/com/amazon/opendistroforelasticsearch/ad/EntityProfileRunnerTests.java +++ b/src/test/java/com/amazon/opendistroforelasticsearch/ad/EntityProfileRunnerTests.java @@ -31,20 +31,20 @@ import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; -import org.elasticsearch.action.ActionListener; -import org.elasticsearch.action.get.GetRequest; -import org.elasticsearch.action.get.GetResponse; -import org.elasticsearch.action.search.SearchRequest; -import org.elasticsearch.action.search.SearchResponse; -import org.elasticsearch.action.search.SearchResponseSections; -import org.elasticsearch.action.search.ShardSearchFailure; -import org.elasticsearch.client.Client; -import org.elasticsearch.index.IndexNotFoundException; -import org.elasticsearch.search.DocValueFormat; -import org.elasticsearch.search.SearchHit; -import org.elasticsearch.search.SearchHits; -import org.elasticsearch.search.aggregations.InternalAggregations; -import org.elasticsearch.search.aggregations.metrics.InternalMax; +import org.opensearch.action.ActionListener; +import org.opensearch.action.get.GetRequest; +import org.opensearch.action.get.GetResponse; +import org.opensearch.action.search.SearchRequest; +import org.opensearch.action.search.SearchResponse; +import org.opensearch.action.search.SearchResponseSections; +import org.opensearch.action.search.ShardSearchFailure; +import org.opensearch.client.Client; +import org.opensearch.index.IndexNotFoundException; +import org.opensearch.search.DocValueFormat; +import org.opensearch.search.SearchHit; +import org.opensearch.search.SearchHits; +import org.opensearch.search.aggregations.InternalAggregations; +import org.opensearch.search.aggregations.metrics.InternalMax; import com.amazon.opendistroforelasticsearch.ad.constant.CommonErrorMessages; import com.amazon.opendistroforelasticsearch.ad.constant.CommonName; diff --git a/src/test/java/com/amazon/opendistroforelasticsearch/ad/HistoricalDetectorIntegTestCase.java b/src/test/java/com/amazon/opendistroforelasticsearch/ad/HistoricalDetectorIntegTestCase.java index 5b4f23788..cb0eaa5bd 100644 --- a/src/test/java/com/amazon/opendistroforelasticsearch/ad/HistoricalDetectorIntegTestCase.java +++ b/src/test/java/com/amazon/opendistroforelasticsearch/ad/HistoricalDetectorIntegTestCase.java @@ -19,8 +19,8 @@ import static com.amazon.opendistroforelasticsearch.ad.model.ADTask.EXECUTION_START_TIME_FIELD; import static com.amazon.opendistroforelasticsearch.ad.model.ADTask.IS_LATEST_FIELD; import static com.amazon.opendistroforelasticsearch.ad.util.RestHandlerUtils.START_JOB; -import static org.elasticsearch.index.seqno.SequenceNumbers.UNASSIGNED_PRIMARY_TERM; -import static org.elasticsearch.index.seqno.SequenceNumbers.UNASSIGNED_SEQ_NO; +import static org.opensearch.index.seqno.SequenceNumbers.UNASSIGNED_PRIMARY_TERM; +import static org.opensearch.index.seqno.SequenceNumbers.UNASSIGNED_SEQ_NO; import java.io.IOException; import java.time.Instant; @@ -32,19 +32,19 @@ import java.util.List; import java.util.Map; -import org.elasticsearch.action.bulk.BulkResponse; -import org.elasticsearch.action.get.GetResponse; -import org.elasticsearch.action.search.SearchRequest; -import org.elasticsearch.action.search.SearchResponse; -import org.elasticsearch.index.query.BoolQueryBuilder; -import org.elasticsearch.index.query.TermQueryBuilder; -import org.elasticsearch.plugins.Plugin; -import org.elasticsearch.rest.RestStatus; -import org.elasticsearch.search.SearchHit; -import org.elasticsearch.search.aggregations.AggregationBuilder; -import org.elasticsearch.search.builder.SearchSourceBuilder; -import org.elasticsearch.search.sort.SortOrder; -import org.elasticsearch.test.transport.MockTransportService; +import org.opensearch.action.bulk.BulkResponse; +import org.opensearch.action.get.GetResponse; +import org.opensearch.action.search.SearchRequest; +import org.opensearch.action.search.SearchResponse; +import org.opensearch.index.query.BoolQueryBuilder; +import org.opensearch.index.query.TermQueryBuilder; +import org.opensearch.plugins.Plugin; +import org.opensearch.rest.RestStatus; +import org.opensearch.search.SearchHit; +import org.opensearch.search.aggregations.AggregationBuilder; +import org.opensearch.search.builder.SearchSourceBuilder; +import org.opensearch.search.sort.SortOrder; +import org.opensearch.test.transport.MockTransportService; import com.amazon.opendistroforelasticsearch.ad.constant.CommonName; import com.amazon.opendistroforelasticsearch.ad.mock.plugin.MockReindexPlugin; diff --git a/src/test/java/com/amazon/opendistroforelasticsearch/ad/HistoricalDetectorRestTestCase.java b/src/test/java/com/amazon/opendistroforelasticsearch/ad/HistoricalDetectorRestTestCase.java index c940f19c9..d08aafa02 100644 --- a/src/test/java/com/amazon/opendistroforelasticsearch/ad/HistoricalDetectorRestTestCase.java +++ b/src/test/java/com/amazon/opendistroforelasticsearch/ad/HistoricalDetectorRestTestCase.java @@ -28,13 +28,13 @@ import org.apache.http.HttpHeaders; import org.apache.http.message.BasicHeader; import org.apache.http.util.EntityUtils; -import org.elasticsearch.client.Response; -import org.elasticsearch.client.RestClient; -import org.elasticsearch.common.xcontent.ToXContentObject; -import org.elasticsearch.common.xcontent.XContentParser; -import org.elasticsearch.rest.RestStatus; -import org.elasticsearch.search.aggregations.AggregationBuilder; import org.junit.Before; +import org.opensearch.client.Response; +import org.opensearch.client.RestClient; +import org.opensearch.common.xcontent.ToXContentObject; +import org.opensearch.common.xcontent.XContentParser; +import org.opensearch.rest.RestStatus; +import org.opensearch.search.aggregations.AggregationBuilder; import com.amazon.opendistroforelasticsearch.ad.mock.model.MockSimpleLog; import com.amazon.opendistroforelasticsearch.ad.model.ADTaskProfile; diff --git a/src/test/java/com/amazon/opendistroforelasticsearch/ad/MemoryTrackerTests.java b/src/test/java/com/amazon/opendistroforelasticsearch/ad/MemoryTrackerTests.java index 4dcaf66b8..e5293f6d5 100644 --- a/src/test/java/com/amazon/opendistroforelasticsearch/ad/MemoryTrackerTests.java +++ b/src/test/java/com/amazon/opendistroforelasticsearch/ad/MemoryTrackerTests.java @@ -22,21 +22,21 @@ import java.util.Collections; import java.util.HashSet; -import org.elasticsearch.cluster.service.ClusterService; -import org.elasticsearch.common.settings.ClusterSettings; -import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.common.unit.ByteSizeValue; -import org.elasticsearch.monitor.jvm.JvmInfo; -import org.elasticsearch.monitor.jvm.JvmInfo.Mem; -import org.elasticsearch.monitor.jvm.JvmService; -import org.elasticsearch.test.ESTestCase; +import org.opensearch.cluster.service.ClusterService; +import org.opensearch.common.settings.ClusterSettings; +import org.opensearch.common.settings.Settings; +import org.opensearch.common.unit.ByteSizeValue; +import org.opensearch.monitor.jvm.JvmInfo; +import org.opensearch.monitor.jvm.JvmInfo.Mem; +import org.opensearch.monitor.jvm.JvmService; +import org.opensearch.test.OpenSearchTestCase; import com.amazon.opendistroforelasticsearch.ad.common.exception.LimitExceededException; import com.amazon.opendistroforelasticsearch.ad.model.AnomalyDetector; import com.amazon.opendistroforelasticsearch.ad.settings.AnomalyDetectorSettings; import com.amazon.randomcutforest.RandomCutForest; -public class MemoryTrackerTests extends ESTestCase { +public class MemoryTrackerTests extends OpenSearchTestCase { int rcfNumFeatures; int rcfSampleSize; diff --git a/src/test/java/com/amazon/opendistroforelasticsearch/ad/MultiEntityProfileRunnerTests.java b/src/test/java/com/amazon/opendistroforelasticsearch/ad/MultiEntityProfileRunnerTests.java index 4735abf6a..6bfb840f8 100644 --- a/src/test/java/com/amazon/opendistroforelasticsearch/ad/MultiEntityProfileRunnerTests.java +++ b/src/test/java/com/amazon/opendistroforelasticsearch/ad/MultiEntityProfileRunnerTests.java @@ -34,19 +34,19 @@ import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; -import org.elasticsearch.Version; -import org.elasticsearch.action.ActionListener; -import org.elasticsearch.action.FailedNodeException; -import org.elasticsearch.action.get.GetRequest; -import org.elasticsearch.action.get.GetResponse; -import org.elasticsearch.action.search.SearchRequest; -import org.elasticsearch.action.search.SearchResponse; -import org.elasticsearch.client.Client; -import org.elasticsearch.cluster.ClusterName; -import org.elasticsearch.cluster.node.DiscoveryNode; -import org.elasticsearch.common.transport.TransportAddress; -import org.elasticsearch.transport.TransportService; import org.junit.Before; +import org.opensearch.Version; +import org.opensearch.action.ActionListener; +import org.opensearch.action.FailedNodeException; +import org.opensearch.action.get.GetRequest; +import org.opensearch.action.get.GetResponse; +import org.opensearch.action.search.SearchRequest; +import org.opensearch.action.search.SearchResponse; +import org.opensearch.client.Client; +import org.opensearch.cluster.ClusterName; +import org.opensearch.cluster.node.DiscoveryNode; +import org.opensearch.common.transport.TransportAddress; +import org.opensearch.transport.TransportService; import com.amazon.opendistroforelasticsearch.ad.constant.CommonName; import com.amazon.opendistroforelasticsearch.ad.model.AnomalyDetector; diff --git a/src/test/java/com/amazon/opendistroforelasticsearch/ad/NodeStateManagerTests.java b/src/test/java/com/amazon/opendistroforelasticsearch/ad/NodeStateManagerTests.java index b9d93b3e5..d143de296 100644 --- a/src/test/java/com/amazon/opendistroforelasticsearch/ad/NodeStateManagerTests.java +++ b/src/test/java/com/amazon/opendistroforelasticsearch/ad/NodeStateManagerTests.java @@ -34,19 +34,19 @@ import java.util.concurrent.TimeUnit; import java.util.stream.IntStream; -import org.elasticsearch.action.ActionListener; -import org.elasticsearch.action.get.GetRequest; -import org.elasticsearch.action.get.GetResponse; -import org.elasticsearch.action.search.SearchRequest; -import org.elasticsearch.client.Client; -import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.common.unit.TimeValue; -import org.elasticsearch.common.xcontent.NamedXContentRegistry; -import org.elasticsearch.search.SearchModule; -import org.elasticsearch.test.ESTestCase; -import org.elasticsearch.threadpool.ThreadPool; import org.junit.After; import org.junit.Before; +import org.opensearch.action.ActionListener; +import org.opensearch.action.get.GetRequest; +import org.opensearch.action.get.GetResponse; +import org.opensearch.action.search.SearchRequest; +import org.opensearch.client.Client; +import org.opensearch.common.settings.Settings; +import org.opensearch.common.unit.TimeValue; +import org.opensearch.common.xcontent.NamedXContentRegistry; +import org.opensearch.search.SearchModule; +import org.opensearch.test.OpenSearchTestCase; +import org.opensearch.threadpool.ThreadPool; import com.amazon.opendistroforelasticsearch.ad.ml.ModelPartitioner; import com.amazon.opendistroforelasticsearch.ad.model.AnomalyDetector; @@ -54,7 +54,7 @@ import com.amazon.opendistroforelasticsearch.ad.util.Throttler; import com.google.common.collect.ImmutableMap; -public class NodeStateManagerTests extends ESTestCase { +public class NodeStateManagerTests extends OpenSearchTestCase { private NodeStateManager stateManager; private ModelPartitioner modelPartitioner; private Client client; diff --git a/src/test/java/com/amazon/opendistroforelasticsearch/ad/NodeStateTests.java b/src/test/java/com/amazon/opendistroforelasticsearch/ad/NodeStateTests.java index e29df63b4..88e8b8350 100644 --- a/src/test/java/com/amazon/opendistroforelasticsearch/ad/NodeStateTests.java +++ b/src/test/java/com/amazon/opendistroforelasticsearch/ad/NodeStateTests.java @@ -23,11 +23,11 @@ import java.time.Duration; import java.time.Instant; -import org.elasticsearch.test.ESTestCase; +import org.opensearch.test.OpenSearchTestCase; import com.amazon.opendistroforelasticsearch.ad.common.exception.AnomalyDetectionException; -public class NodeStateTests extends ESTestCase { +public class NodeStateTests extends OpenSearchTestCase { private NodeState state; private Clock clock; diff --git a/src/test/java/com/amazon/opendistroforelasticsearch/ad/ODFERestTestCase.java b/src/test/java/com/amazon/opendistroforelasticsearch/ad/ODFERestTestCase.java index e512d2858..55bfb92ed 100644 --- a/src/test/java/com/amazon/opendistroforelasticsearch/ad/ODFERestTestCase.java +++ b/src/test/java/com/amazon/opendistroforelasticsearch/ad/ODFERestTestCase.java @@ -41,27 +41,27 @@ import org.apache.http.impl.client.BasicCredentialsProvider; import org.apache.http.message.BasicHeader; import org.apache.http.ssl.SSLContextBuilder; -import org.elasticsearch.client.Request; -import org.elasticsearch.client.Response; -import org.elasticsearch.client.RestClient; -import org.elasticsearch.client.RestClientBuilder; -import org.elasticsearch.common.io.PathUtils; -import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.common.unit.TimeValue; -import org.elasticsearch.common.util.concurrent.ThreadContext; -import org.elasticsearch.common.xcontent.DeprecationHandler; -import org.elasticsearch.common.xcontent.NamedXContentRegistry; -import org.elasticsearch.common.xcontent.XContentParser; -import org.elasticsearch.common.xcontent.XContentType; -import org.elasticsearch.test.rest.ESRestTestCase; import org.junit.After; +import org.opensearch.client.Request; +import org.opensearch.client.Response; +import org.opensearch.client.RestClient; +import org.opensearch.client.RestClientBuilder; +import org.opensearch.common.io.PathUtils; +import org.opensearch.common.settings.Settings; +import org.opensearch.common.unit.TimeValue; +import org.opensearch.common.util.concurrent.ThreadContext; +import org.opensearch.common.xcontent.DeprecationHandler; +import org.opensearch.common.xcontent.NamedXContentRegistry; +import org.opensearch.common.xcontent.XContentParser; +import org.opensearch.common.xcontent.XContentType; +import org.opensearch.test.rest.OpenSearchRestTestCase; import com.amazon.opendistroforelasticsearch.commons.rest.SecureRestClientBuilder; /** * ODFE integration test base class to support both security disabled and enabled ODFE cluster. */ -public abstract class ODFERestTestCase extends ESRestTestCase { +public abstract class ODFERestTestCase extends OpenSearchRestTestCase { protected boolean isHttps() { boolean isHttps = Optional.ofNullable(System.getProperty("https")).map("true"::equalsIgnoreCase).orElse(false); diff --git a/src/test/java/com/amazon/opendistroforelasticsearch/ad/TestHelpers.java b/src/test/java/com/amazon/opendistroforelasticsearch/ad/TestHelpers.java index afc78505c..63d2ae0db 100644 --- a/src/test/java/com/amazon/opendistroforelasticsearch/ad/TestHelpers.java +++ b/src/test/java/com/amazon/opendistroforelasticsearch/ad/TestHelpers.java @@ -16,17 +16,17 @@ package com.amazon.opendistroforelasticsearch.ad; import static org.apache.http.entity.ContentType.APPLICATION_JSON; -import static org.elasticsearch.cluster.node.DiscoveryNodeRole.BUILT_IN_ROLES; -import static org.elasticsearch.common.xcontent.XContentParserUtils.ensureExpectedToken; -import static org.elasticsearch.index.query.AbstractQueryBuilder.parseInnerQueryBuilder; -import static org.elasticsearch.index.seqno.SequenceNumbers.UNASSIGNED_SEQ_NO; -import static org.elasticsearch.test.ESTestCase.buildNewFakeTransportAddress; -import static org.elasticsearch.test.ESTestCase.randomAlphaOfLength; -import static org.elasticsearch.test.ESTestCase.randomBoolean; -import static org.elasticsearch.test.ESTestCase.randomDouble; -import static org.elasticsearch.test.ESTestCase.randomInt; -import static org.elasticsearch.test.ESTestCase.randomIntBetween; -import static org.elasticsearch.test.ESTestCase.randomLong; +import static org.opensearch.cluster.node.DiscoveryNodeRole.BUILT_IN_ROLES; +import static org.opensearch.common.xcontent.XContentParserUtils.ensureExpectedToken; +import static org.opensearch.index.query.AbstractQueryBuilder.parseInnerQueryBuilder; +import static org.opensearch.index.seqno.SequenceNumbers.UNASSIGNED_SEQ_NO; +import static org.opensearch.test.OpenSearchTestCase.buildNewFakeTransportAddress; +import static org.opensearch.test.OpenSearchTestCase.randomAlphaOfLength; +import static org.opensearch.test.OpenSearchTestCase.randomBoolean; +import static org.opensearch.test.OpenSearchTestCase.randomDouble; +import static org.opensearch.test.OpenSearchTestCase.randomInt; +import static org.opensearch.test.OpenSearchTestCase.randomIntBetween; +import static org.opensearch.test.OpenSearchTestCase.randomLong; import static org.powermock.api.mockito.PowerMockito.mock; import static org.powermock.api.mockito.PowerMockito.when; @@ -55,67 +55,67 @@ import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.util.Strings; import org.apache.lucene.search.TotalHits; -import org.elasticsearch.Version; -import org.elasticsearch.action.ActionListener; -import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse; -import org.elasticsearch.action.admin.indices.create.CreateIndexRequest; -import org.elasticsearch.action.admin.indices.create.CreateIndexResponse; -import org.elasticsearch.action.admin.indices.mapping.get.GetFieldMappingsResponse.FieldMappingMetadata; -import org.elasticsearch.action.get.GetResponse; -import org.elasticsearch.action.search.SearchRequest; -import org.elasticsearch.action.search.SearchResponse; -import org.elasticsearch.action.search.ShardSearchFailure; -import org.elasticsearch.client.AdminClient; -import org.elasticsearch.client.Client; -import org.elasticsearch.client.Request; -import org.elasticsearch.client.RequestOptions; -import org.elasticsearch.client.Response; -import org.elasticsearch.client.RestClient; -import org.elasticsearch.client.WarningsHandler; -import org.elasticsearch.cluster.ClusterName; -import org.elasticsearch.cluster.ClusterState; -import org.elasticsearch.cluster.block.ClusterBlocks; -import org.elasticsearch.cluster.metadata.AliasMetadata; -import org.elasticsearch.cluster.metadata.IndexMetadata; -import org.elasticsearch.cluster.metadata.Metadata; -import org.elasticsearch.cluster.node.DiscoveryNode; -import org.elasticsearch.cluster.service.ClusterService; -import org.elasticsearch.common.CheckedConsumer; -import org.elasticsearch.common.Priority; -import org.elasticsearch.common.UUIDs; -import org.elasticsearch.common.bytes.BytesArray; -import org.elasticsearch.common.bytes.BytesReference; -import org.elasticsearch.common.settings.ClusterSettings; -import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.common.util.concurrent.ThreadContext; -import org.elasticsearch.common.xcontent.LoggingDeprecationHandler; -import org.elasticsearch.common.xcontent.NamedXContentRegistry; -import org.elasticsearch.common.xcontent.ToXContent; -import org.elasticsearch.common.xcontent.ToXContentObject; -import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentFactory; -import org.elasticsearch.common.xcontent.XContentHelper; -import org.elasticsearch.common.xcontent.XContentParser; -import org.elasticsearch.common.xcontent.XContentType; -import org.elasticsearch.index.get.GetResult; -import org.elasticsearch.index.mapper.MapperService; -import org.elasticsearch.index.query.BoolQueryBuilder; -import org.elasticsearch.index.query.MatchAllQueryBuilder; -import org.elasticsearch.index.query.QueryBuilder; -import org.elasticsearch.search.SearchHit; -import org.elasticsearch.search.SearchHits; -import org.elasticsearch.search.SearchModule; -import org.elasticsearch.search.aggregations.AggregationBuilder; -import org.elasticsearch.search.aggregations.AggregatorFactories; -import org.elasticsearch.search.aggregations.InternalAggregations; -import org.elasticsearch.search.builder.SearchSourceBuilder; -import org.elasticsearch.search.internal.InternalSearchResponse; -import org.elasticsearch.search.profile.SearchProfileShardResults; -import org.elasticsearch.search.suggest.Suggest; -import org.elasticsearch.test.ClusterServiceUtils; -import org.elasticsearch.test.ESTestCase; -import org.elasticsearch.test.rest.ESRestTestCase; -import org.elasticsearch.threadpool.ThreadPool; +import org.opensearch.Version; +import org.opensearch.action.ActionListener; +import org.opensearch.action.admin.cluster.health.ClusterHealthResponse; +import org.opensearch.action.admin.indices.create.CreateIndexRequest; +import org.opensearch.action.admin.indices.create.CreateIndexResponse; +import org.opensearch.action.admin.indices.mapping.get.GetFieldMappingsResponse.FieldMappingMetadata; +import org.opensearch.action.get.GetResponse; +import org.opensearch.action.search.SearchRequest; +import org.opensearch.action.search.SearchResponse; +import org.opensearch.action.search.ShardSearchFailure; +import org.opensearch.client.AdminClient; +import org.opensearch.client.Client; +import org.opensearch.client.Request; +import org.opensearch.client.RequestOptions; +import org.opensearch.client.Response; +import org.opensearch.client.RestClient; +import org.opensearch.client.WarningsHandler; +import org.opensearch.cluster.ClusterName; +import org.opensearch.cluster.ClusterState; +import org.opensearch.cluster.block.ClusterBlocks; +import org.opensearch.cluster.metadata.AliasMetadata; +import org.opensearch.cluster.metadata.IndexMetadata; +import org.opensearch.cluster.metadata.Metadata; +import org.opensearch.cluster.node.DiscoveryNode; +import org.opensearch.cluster.service.ClusterService; +import org.opensearch.common.CheckedConsumer; +import org.opensearch.common.Priority; +import org.opensearch.common.UUIDs; +import org.opensearch.common.bytes.BytesArray; +import org.opensearch.common.bytes.BytesReference; +import org.opensearch.common.settings.ClusterSettings; +import org.opensearch.common.settings.Settings; +import org.opensearch.common.util.concurrent.ThreadContext; +import org.opensearch.common.xcontent.LoggingDeprecationHandler; +import org.opensearch.common.xcontent.NamedXContentRegistry; +import org.opensearch.common.xcontent.ToXContent; +import org.opensearch.common.xcontent.ToXContentObject; +import org.opensearch.common.xcontent.XContentBuilder; +import org.opensearch.common.xcontent.XContentFactory; +import org.opensearch.common.xcontent.XContentHelper; +import org.opensearch.common.xcontent.XContentParser; +import org.opensearch.common.xcontent.XContentType; +import org.opensearch.index.get.GetResult; +import org.opensearch.index.mapper.MapperService; +import org.opensearch.index.query.BoolQueryBuilder; +import org.opensearch.index.query.MatchAllQueryBuilder; +import org.opensearch.index.query.QueryBuilder; +import org.opensearch.search.SearchHit; +import org.opensearch.search.SearchHits; +import org.opensearch.search.SearchModule; +import org.opensearch.search.aggregations.AggregationBuilder; +import org.opensearch.search.aggregations.AggregatorFactories; +import org.opensearch.search.aggregations.InternalAggregations; +import org.opensearch.search.builder.SearchSourceBuilder; +import org.opensearch.search.internal.InternalSearchResponse; +import org.opensearch.search.profile.SearchProfileShardResults; +import org.opensearch.search.suggest.Suggest; +import org.opensearch.test.ClusterServiceUtils; +import org.opensearch.test.OpenSearchTestCase; +import org.opensearch.test.rest.OpenSearchRestTestCase; +import org.opensearch.threadpool.ThreadPool; import com.amazon.opendistroforelasticsearch.ad.constant.CommonName; import com.amazon.opendistroforelasticsearch.ad.constant.CommonValue; @@ -264,7 +264,7 @@ public static AnomalyDetector randomAnomalyDetector( uiMetadata, lastUpdateTime, detectorType, - ESRestTestCase.randomLongBetween(1, 1000), + OpenSearchRestTestCase.randomLongBetween(1, 1000), dateRange, withUser ); @@ -323,7 +323,7 @@ public static AnomalyDetector randomDetector( features, randomQuery("{\"bool\":{\"filter\":[{\"exists\":{\"field\":\"value\"}}]}}"), new IntervalTimeConfiguration(detectionIntervalInMinutes, ChronoUnit.MINUTES), - new IntervalTimeConfiguration(ESRestTestCase.randomLongBetween(1, 5), ChronoUnit.MINUTES), + new IntervalTimeConfiguration(OpenSearchRestTestCase.randomLongBetween(1, 5), ChronoUnit.MINUTES), 8, null, randomInt(), @@ -489,13 +489,13 @@ public static Map randomUiMetadata() { } public static TimeConfiguration randomIntervalTimeConfiguration() { - return new IntervalTimeConfiguration(ESRestTestCase.randomLongBetween(1, 1000), ChronoUnit.MINUTES); + return new IntervalTimeConfiguration(OpenSearchRestTestCase.randomLongBetween(1, 1000), ChronoUnit.MINUTES); } public static IntervalSchedule randomIntervalSchedule() { return new IntervalSchedule( Instant.now().truncatedTo(ChronoUnit.SECONDS), - ESRestTestCase.randomIntBetween(1, 1000), + OpenSearchRestTestCase.randomIntBetween(1, 1000), ChronoUnit.MINUTES ); } @@ -685,7 +685,7 @@ public static void waitForIndexCreationToComplete(Client client, final String in public static ClusterService createClusterService(ThreadPool threadPool, ClusterSettings clusterSettings) { DiscoveryNode discoveryNode = new DiscoveryNode( "node", - ESTestCase.buildNewFakeTransportAddress(), + OpenSearchTestCase.buildNewFakeTransportAddress(), Collections.emptyMap(), BUILT_IN_ROLES, Version.CURRENT diff --git a/src/test/java/com/amazon/opendistroforelasticsearch/ad/breaker/ADCircuitBreakerServiceTests.java b/src/test/java/com/amazon/opendistroforelasticsearch/ad/breaker/ADCircuitBreakerServiceTests.java index b96e31586..621f98c53 100644 --- a/src/test/java/com/amazon/opendistroforelasticsearch/ad/breaker/ADCircuitBreakerServiceTests.java +++ b/src/test/java/com/amazon/opendistroforelasticsearch/ad/breaker/ADCircuitBreakerServiceTests.java @@ -22,13 +22,13 @@ import static org.hamcrest.Matchers.nullValue; import static org.mockito.Mockito.when; -import org.elasticsearch.monitor.jvm.JvmService; -import org.elasticsearch.monitor.jvm.JvmStats; import org.junit.Before; import org.junit.Test; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.MockitoAnnotations; +import org.opensearch.monitor.jvm.JvmService; +import org.opensearch.monitor.jvm.JvmStats; public class ADCircuitBreakerServiceTests { diff --git a/src/test/java/com/amazon/opendistroforelasticsearch/ad/breaker/MemoryCircuitBreakerTests.java b/src/test/java/com/amazon/opendistroforelasticsearch/ad/breaker/MemoryCircuitBreakerTests.java index 768110964..ff75bafb2 100644 --- a/src/test/java/com/amazon/opendistroforelasticsearch/ad/breaker/MemoryCircuitBreakerTests.java +++ b/src/test/java/com/amazon/opendistroforelasticsearch/ad/breaker/MemoryCircuitBreakerTests.java @@ -19,12 +19,12 @@ import static org.hamcrest.Matchers.equalTo; import static org.mockito.Mockito.when; -import org.elasticsearch.monitor.jvm.JvmService; -import org.elasticsearch.monitor.jvm.JvmStats; import org.junit.Before; import org.junit.Test; import org.mockito.Mock; import org.mockito.MockitoAnnotations; +import org.opensearch.monitor.jvm.JvmService; +import org.opensearch.monitor.jvm.JvmStats; public class MemoryCircuitBreakerTests { diff --git a/src/test/java/com/amazon/opendistroforelasticsearch/ad/caching/CacheBufferTests.java b/src/test/java/com/amazon/opendistroforelasticsearch/ad/caching/CacheBufferTests.java index c2653fadc..9d6823ef1 100644 --- a/src/test/java/com/amazon/opendistroforelasticsearch/ad/caching/CacheBufferTests.java +++ b/src/test/java/com/amazon/opendistroforelasticsearch/ad/caching/CacheBufferTests.java @@ -26,9 +26,9 @@ import java.util.List; import java.util.Map.Entry; -import org.elasticsearch.test.ESTestCase; import org.junit.Before; import org.mockito.ArgumentCaptor; +import org.opensearch.test.OpenSearchTestCase; import test.com.amazon.opendistroforelasticsearch.ad.util.MLUtil; @@ -36,7 +36,7 @@ import com.amazon.opendistroforelasticsearch.ad.ml.CheckpointDao; import com.amazon.opendistroforelasticsearch.ad.settings.AnomalyDetectorSettings; -public class CacheBufferTests extends ESTestCase { +public class CacheBufferTests extends OpenSearchTestCase { CacheBuffer cacheBuffer; CheckpointDao checkpointDao; MemoryTracker memoryTracker; diff --git a/src/test/java/com/amazon/opendistroforelasticsearch/ad/caching/PriorityCacheTests.java b/src/test/java/com/amazon/opendistroforelasticsearch/ad/caching/PriorityCacheTests.java index 1c58d3ec8..8c1d18205 100644 --- a/src/test/java/com/amazon/opendistroforelasticsearch/ad/caching/PriorityCacheTests.java +++ b/src/test/java/com/amazon/opendistroforelasticsearch/ad/caching/PriorityCacheTests.java @@ -42,18 +42,18 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import org.elasticsearch.ElasticsearchException; -import org.elasticsearch.action.ActionListener; -import org.elasticsearch.cluster.service.ClusterService; -import org.elasticsearch.common.settings.ClusterSettings; -import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.common.util.concurrent.EsRejectedExecutionException; -import org.elasticsearch.index.IndexNotFoundException; -import org.elasticsearch.test.ESTestCase; -import org.elasticsearch.threadpool.Scheduler.ScheduledCancellable; -import org.elasticsearch.threadpool.ThreadPool; import org.junit.Before; import org.mockito.ArgumentCaptor; +import org.opensearch.OpenSearchException; +import org.opensearch.action.ActionListener; +import org.opensearch.cluster.service.ClusterService; +import org.opensearch.common.settings.ClusterSettings; +import org.opensearch.common.settings.Settings; +import org.opensearch.common.util.concurrent.OpenSearchRejectedExecutionException; +import org.opensearch.index.IndexNotFoundException; +import org.opensearch.test.OpenSearchTestCase; +import org.opensearch.threadpool.Scheduler.ScheduledCancellable; +import org.opensearch.threadpool.ThreadPool; import com.amazon.opendistroforelasticsearch.ad.MemoryTracker; import com.amazon.opendistroforelasticsearch.ad.common.exception.LimitExceededException; @@ -65,7 +65,7 @@ import com.amazon.opendistroforelasticsearch.ad.model.AnomalyDetector; import com.amazon.opendistroforelasticsearch.ad.settings.AnomalyDetectorSettings; -public class PriorityCacheTests extends ESTestCase { +public class PriorityCacheTests extends OpenSearchTestCase { private static final Logger LOG = LogManager.getLogger(PriorityCacheTests.class); String modelId1, modelId2, modelId3, modelId4; @@ -335,7 +335,7 @@ public void testThrottledRestore() { Object[] args = invocation.getArguments(); ActionListener>> listener = (ActionListener>>) args[1]; - listener.onFailure(new EsRejectedExecutionException("", false)); + listener.onFailure(new OpenSearchRejectedExecutionException("", false)); return null; }).when(checkpoint).restoreModelCheckpoint(anyString(), any(ActionListener.class)); for (int i = 0; i < 3; i++) { @@ -468,7 +468,7 @@ class FailedCleanRunnable implements Runnable { public void run() { try { cacheProvider.maintenance(); - } catch (ElasticsearchException e) { + } catch (OpenSearchException e) { singalThreadToStart.countDown(); } } @@ -499,7 +499,7 @@ public void testFailedConcurrentMaintenance() throws InterruptedException { new Thread(new FailedCleanRunnable(scheduledThreadCountDown)).start(); cacheProvider.maintenance(); - } catch (ElasticsearchException e) { + } catch (OpenSearchException e) { scheduledThreadCountDown.countDown(); } diff --git a/src/test/java/com/amazon/opendistroforelasticsearch/ad/caching/PriorityTrackerTests.java b/src/test/java/com/amazon/opendistroforelasticsearch/ad/caching/PriorityTrackerTests.java index 6952d9b7b..2b68b699e 100644 --- a/src/test/java/com/amazon/opendistroforelasticsearch/ad/caching/PriorityTrackerTests.java +++ b/src/test/java/com/amazon/opendistroforelasticsearch/ad/caching/PriorityTrackerTests.java @@ -23,10 +23,10 @@ import java.time.temporal.ChronoUnit; import java.util.List; -import org.elasticsearch.test.ESTestCase; import org.junit.Before; +import org.opensearch.test.OpenSearchTestCase; -public class PriorityTrackerTests extends ESTestCase { +public class PriorityTrackerTests extends OpenSearchTestCase { Clock clock; PriorityTracker tracker; Instant now; diff --git a/src/test/java/com/amazon/opendistroforelasticsearch/ad/cluster/ADClusterEventListenerTests.java b/src/test/java/com/amazon/opendistroforelasticsearch/ad/cluster/ADClusterEventListenerTests.java index b99583560..5c6f8ef11 100644 --- a/src/test/java/com/amazon/opendistroforelasticsearch/ad/cluster/ADClusterEventListenerTests.java +++ b/src/test/java/com/amazon/opendistroforelasticsearch/ad/cluster/ADClusterEventListenerTests.java @@ -17,12 +17,12 @@ import static java.util.Collections.emptyMap; import static java.util.Collections.emptySet; -import static org.elasticsearch.cluster.node.DiscoveryNodeRole.BUILT_IN_ROLES; -import static org.elasticsearch.test.ClusterServiceUtils.createClusterService; import static org.mockito.Matchers.any; import static org.mockito.Mockito.doAnswer; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; +import static org.opensearch.cluster.node.DiscoveryNodeRole.BUILT_IN_ROLES; +import static org.opensearch.test.ClusterServiceUtils.createClusterService; import java.util.HashMap; import java.util.HashSet; @@ -30,19 +30,19 @@ import java.util.Set; import java.util.concurrent.CountDownLatch; -import org.elasticsearch.Version; -import org.elasticsearch.cluster.ClusterChangedEvent; -import org.elasticsearch.cluster.ClusterName; -import org.elasticsearch.cluster.ClusterState; -import org.elasticsearch.cluster.block.ClusterBlocks; -import org.elasticsearch.cluster.node.DiscoveryNode; -import org.elasticsearch.cluster.node.DiscoveryNodes; -import org.elasticsearch.cluster.service.ClusterService; -import org.elasticsearch.gateway.GatewayService; import org.junit.After; import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; +import org.opensearch.Version; +import org.opensearch.cluster.ClusterChangedEvent; +import org.opensearch.cluster.ClusterName; +import org.opensearch.cluster.ClusterState; +import org.opensearch.cluster.block.ClusterBlocks; +import org.opensearch.cluster.node.DiscoveryNode; +import org.opensearch.cluster.node.DiscoveryNodes; +import org.opensearch.cluster.service.ClusterService; +import org.opensearch.gateway.GatewayService; import com.amazon.opendistroforelasticsearch.ad.AbstractADTest; import com.amazon.opendistroforelasticsearch.ad.constant.CommonName; diff --git a/src/test/java/com/amazon/opendistroforelasticsearch/ad/cluster/DailyCronTests.java b/src/test/java/com/amazon/opendistroforelasticsearch/ad/cluster/DailyCronTests.java index 5343397dc..c85cf15de 100644 --- a/src/test/java/com/amazon/opendistroforelasticsearch/ad/cluster/DailyCronTests.java +++ b/src/test/java/com/amazon/opendistroforelasticsearch/ad/cluster/DailyCronTests.java @@ -25,11 +25,11 @@ import java.time.Duration; import java.util.Arrays; -import org.elasticsearch.ElasticsearchException; -import org.elasticsearch.action.ActionListener; -import org.elasticsearch.index.IndexNotFoundException; -import org.elasticsearch.index.reindex.BulkByScrollResponse; -import org.elasticsearch.index.reindex.DeleteByQueryAction; +import org.opensearch.OpenSearchException; +import org.opensearch.action.ActionListener; +import org.opensearch.index.IndexNotFoundException; +import org.opensearch.index.reindex.BulkByScrollResponse; +import org.opensearch.index.reindex.DeleteByQueryAction; import com.amazon.opendistroforelasticsearch.ad.AbstractADTest; import com.amazon.opendistroforelasticsearch.ad.util.ClientUtil; @@ -70,7 +70,7 @@ private void templateDailyCron(DailyCronTestExecutionMode mode) { if (mode == DailyCronTestExecutionMode.INDEX_NOT_EXIST) { listener.onFailure(new IndexNotFoundException("foo", "bar")); } else if (mode == DailyCronTestExecutionMode.FAIL) { - listener.onFailure(new ElasticsearchException("bar")); + listener.onFailure(new OpenSearchException("bar")); } else { BulkByScrollResponse deleteByQueryResponse = mock(BulkByScrollResponse.class); when(deleteByQueryResponse.getDeleted()).thenReturn(10L); diff --git a/src/test/java/com/amazon/opendistroforelasticsearch/ad/cluster/HashRingTests.java b/src/test/java/com/amazon/opendistroforelasticsearch/ad/cluster/HashRingTests.java index 5797d404f..6c838fb36 100644 --- a/src/test/java/com/amazon/opendistroforelasticsearch/ad/cluster/HashRingTests.java +++ b/src/test/java/com/amazon/opendistroforelasticsearch/ad/cluster/HashRingTests.java @@ -16,11 +16,11 @@ package com.amazon.opendistroforelasticsearch.ad.cluster; import static java.util.Collections.emptyMap; -import static org.elasticsearch.cluster.node.DiscoveryNodeRole.BUILT_IN_ROLES; -import static org.elasticsearch.test.ClusterServiceUtils.createClusterService; -import static org.elasticsearch.test.ClusterServiceUtils.setState; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; +import static org.opensearch.cluster.node.DiscoveryNodeRole.BUILT_IN_ROLES; +import static org.opensearch.test.ClusterServiceUtils.createClusterService; +import static org.opensearch.test.ClusterServiceUtils.setState; import java.time.Clock; import java.util.ArrayList; @@ -29,17 +29,17 @@ import java.util.Map; import java.util.Optional; -import org.elasticsearch.Version; -import org.elasticsearch.cluster.ClusterState; -import org.elasticsearch.cluster.node.DiscoveryNode; -import org.elasticsearch.cluster.node.DiscoveryNodes; -import org.elasticsearch.cluster.service.ClusterService; -import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.common.unit.TimeValue; import org.junit.After; import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; +import org.opensearch.Version; +import org.opensearch.cluster.ClusterState; +import org.opensearch.cluster.node.DiscoveryNode; +import org.opensearch.cluster.node.DiscoveryNodes; +import org.opensearch.cluster.service.ClusterService; +import org.opensearch.common.settings.Settings; +import org.opensearch.common.unit.TimeValue; import com.amazon.opendistroforelasticsearch.ad.AbstractADTest; import com.amazon.opendistroforelasticsearch.ad.constant.CommonName; diff --git a/src/test/java/com/amazon/opendistroforelasticsearch/ad/cluster/HourlyCronTests.java b/src/test/java/com/amazon/opendistroforelasticsearch/ad/cluster/HourlyCronTests.java index 60de33ad1..afc4c80ac 100644 --- a/src/test/java/com/amazon/opendistroforelasticsearch/ad/cluster/HourlyCronTests.java +++ b/src/test/java/com/amazon/opendistroforelasticsearch/ad/cluster/HourlyCronTests.java @@ -27,16 +27,16 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import org.elasticsearch.ElasticsearchException; -import org.elasticsearch.Version; -import org.elasticsearch.action.ActionListener; -import org.elasticsearch.action.FailedNodeException; -import org.elasticsearch.client.Client; -import org.elasticsearch.cluster.ClusterName; -import org.elasticsearch.cluster.ClusterState; -import org.elasticsearch.cluster.service.ClusterService; -import org.elasticsearch.common.io.stream.BytesStreamOutput; -import org.elasticsearch.common.io.stream.StreamInput; +import org.opensearch.OpenSearchException; +import org.opensearch.Version; +import org.opensearch.action.ActionListener; +import org.opensearch.action.FailedNodeException; +import org.opensearch.client.Client; +import org.opensearch.cluster.ClusterName; +import org.opensearch.cluster.ClusterState; +import org.opensearch.cluster.service.ClusterService; +import org.opensearch.common.io.stream.BytesStreamOutput; +import org.opensearch.common.io.stream.StreamInput; import test.com.amazon.opendistroforelasticsearch.ad.util.ClusterCreation; @@ -80,11 +80,11 @@ public void templateHourlyCron(HourlyCronTestExecutionMode mode) { new CronResponse( new ClusterName("test"), Collections.singletonList(new CronNodeResponse(state.nodes().getLocalNode())), - Collections.singletonList(new FailedNodeException("foo0", "blah", new ElasticsearchException("bar"))) + Collections.singletonList(new FailedNodeException("foo0", "blah", new OpenSearchException("bar"))) ) ); } else if (mode == HourlyCronTestExecutionMode.ALL_FAIL) { - listener.onFailure(new ElasticsearchException("bar")); + listener.onFailure(new OpenSearchException("bar")); } else { CronNodeResponse nodeResponse = new CronNodeResponse(state.nodes().getLocalNode()); BytesStreamOutput nodeResponseOut = new BytesStreamOutput(); diff --git a/src/test/java/com/amazon/opendistroforelasticsearch/ad/cluster/MasterEventListenerTests.java b/src/test/java/com/amazon/opendistroforelasticsearch/ad/cluster/MasterEventListenerTests.java index eb1f8dfbf..a5c8b24fd 100644 --- a/src/test/java/com/amazon/opendistroforelasticsearch/ad/cluster/MasterEventListenerTests.java +++ b/src/test/java/com/amazon/opendistroforelasticsearch/ad/cluster/MasterEventListenerTests.java @@ -27,13 +27,13 @@ import java.util.Arrays; import java.util.HashMap; -import org.elasticsearch.client.Client; -import org.elasticsearch.cluster.service.ClusterService; -import org.elasticsearch.common.component.LifecycleListener; -import org.elasticsearch.common.unit.TimeValue; -import org.elasticsearch.threadpool.Scheduler.Cancellable; -import org.elasticsearch.threadpool.ThreadPool; import org.junit.Before; +import org.opensearch.client.Client; +import org.opensearch.cluster.service.ClusterService; +import org.opensearch.common.component.LifecycleListener; +import org.opensearch.common.unit.TimeValue; +import org.opensearch.threadpool.Scheduler.Cancellable; +import org.opensearch.threadpool.ThreadPool; import com.amazon.opendistroforelasticsearch.ad.AbstractADTest; import com.amazon.opendistroforelasticsearch.ad.cluster.diskcleanup.ModelCheckpointIndexRetention; diff --git a/src/test/java/com/amazon/opendistroforelasticsearch/ad/cluster/diskcleanup/IndexCleanupTests.java b/src/test/java/com/amazon/opendistroforelasticsearch/ad/cluster/diskcleanup/IndexCleanupTests.java index 4853e5388..a01d0d68d 100644 --- a/src/test/java/com/amazon/opendistroforelasticsearch/ad/cluster/diskcleanup/IndexCleanupTests.java +++ b/src/test/java/com/amazon/opendistroforelasticsearch/ad/cluster/diskcleanup/IndexCleanupTests.java @@ -25,21 +25,21 @@ import org.apache.logging.log4j.Level; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.core.Logger; -import org.elasticsearch.action.ActionListener; -import org.elasticsearch.action.admin.indices.stats.CommonStats; -import org.elasticsearch.action.admin.indices.stats.IndicesStatsResponse; -import org.elasticsearch.action.admin.indices.stats.ShardStats; -import org.elasticsearch.client.Client; -import org.elasticsearch.client.IndicesAdminClient; -import org.elasticsearch.cluster.service.ClusterService; -import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.common.util.concurrent.ThreadContext; -import org.elasticsearch.index.reindex.DeleteByQueryAction; -import org.elasticsearch.index.store.StoreStats; import org.junit.Assert; import org.mockito.Answers; import org.mockito.Mock; import org.mockito.MockitoAnnotations; +import org.opensearch.action.ActionListener; +import org.opensearch.action.admin.indices.stats.CommonStats; +import org.opensearch.action.admin.indices.stats.IndicesStatsResponse; +import org.opensearch.action.admin.indices.stats.ShardStats; +import org.opensearch.client.Client; +import org.opensearch.client.IndicesAdminClient; +import org.opensearch.cluster.service.ClusterService; +import org.opensearch.common.settings.Settings; +import org.opensearch.common.util.concurrent.ThreadContext; +import org.opensearch.index.reindex.DeleteByQueryAction; +import org.opensearch.index.store.StoreStats; import com.amazon.opendistroforelasticsearch.ad.AbstractADTest; import com.amazon.opendistroforelasticsearch.ad.util.ClientUtil; diff --git a/src/test/java/com/amazon/opendistroforelasticsearch/ad/cluster/diskcleanup/ModelCheckpointIndexRetentionTests.java b/src/test/java/com/amazon/opendistroforelasticsearch/ad/cluster/diskcleanup/ModelCheckpointIndexRetentionTests.java index 24bd68480..5f9874250 100644 --- a/src/test/java/com/amazon/opendistroforelasticsearch/ad/cluster/diskcleanup/ModelCheckpointIndexRetentionTests.java +++ b/src/test/java/com/amazon/opendistroforelasticsearch/ad/cluster/diskcleanup/ModelCheckpointIndexRetentionTests.java @@ -25,12 +25,12 @@ import java.time.Clock; import java.time.Duration; -import org.elasticsearch.action.ActionListener; import org.junit.After; import org.junit.Before; import org.junit.Test; import org.mockito.Mock; import org.mockito.MockitoAnnotations; +import org.opensearch.action.ActionListener; import com.amazon.opendistroforelasticsearch.ad.AbstractADTest; import com.amazon.opendistroforelasticsearch.ad.constant.CommonName; diff --git a/src/test/java/com/amazon/opendistroforelasticsearch/ad/common/exception/ADTaskCancelledExceptionTests.java b/src/test/java/com/amazon/opendistroforelasticsearch/ad/common/exception/ADTaskCancelledExceptionTests.java index 77c8a924d..6edcf9bda 100644 --- a/src/test/java/com/amazon/opendistroforelasticsearch/ad/common/exception/ADTaskCancelledExceptionTests.java +++ b/src/test/java/com/amazon/opendistroforelasticsearch/ad/common/exception/ADTaskCancelledExceptionTests.java @@ -15,9 +15,9 @@ package com.amazon.opendistroforelasticsearch.ad.common.exception; -import org.elasticsearch.test.ESTestCase; +import org.opensearch.test.OpenSearchTestCase; -public class ADTaskCancelledExceptionTests extends ESTestCase { +public class ADTaskCancelledExceptionTests extends OpenSearchTestCase { public void testConstructor() { String message = randomAlphaOfLength(5); diff --git a/src/test/java/com/amazon/opendistroforelasticsearch/ad/e2e/DetectionResultEvalutationIT.java b/src/test/java/com/amazon/opendistroforelasticsearch/ad/e2e/DetectionResultEvalutationIT.java index c3a9b5755..f0f53af3f 100644 --- a/src/test/java/com/amazon/opendistroforelasticsearch/ad/e2e/DetectionResultEvalutationIT.java +++ b/src/test/java/com/amazon/opendistroforelasticsearch/ad/e2e/DetectionResultEvalutationIT.java @@ -33,10 +33,10 @@ import org.apache.http.HttpHeaders; import org.apache.http.message.BasicHeader; -import org.elasticsearch.client.Request; -import org.elasticsearch.client.RequestOptions; -import org.elasticsearch.client.RestClient; -import org.elasticsearch.client.WarningsHandler; +import org.opensearch.client.Request; +import org.opensearch.client.RequestOptions; +import org.opensearch.client.RestClient; +import org.opensearch.client.WarningsHandler; import com.amazon.opendistroforelasticsearch.ad.ODFERestTestCase; import com.amazon.opendistroforelasticsearch.ad.TestHelpers; diff --git a/src/test/java/com/amazon/opendistroforelasticsearch/ad/feature/FeatureManagerTests.java b/src/test/java/com/amazon/opendistroforelasticsearch/ad/feature/FeatureManagerTests.java index 7628be74a..a364bbbe1 100644 --- a/src/test/java/com/amazon/opendistroforelasticsearch/ad/feature/FeatureManagerTests.java +++ b/src/test/java/com/amazon/opendistroforelasticsearch/ad/feature/FeatureManagerTests.java @@ -56,14 +56,14 @@ import junitparams.JUnitParamsRunner; import junitparams.Parameters; -import org.elasticsearch.action.ActionListener; -import org.elasticsearch.threadpool.ThreadPool; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.ArgumentCaptor; import org.mockito.Mock; import org.mockito.MockitoAnnotations; +import org.opensearch.action.ActionListener; +import org.opensearch.threadpool.ThreadPool; import com.amazon.opendistroforelasticsearch.ad.AnomalyDetectorPlugin; import com.amazon.opendistroforelasticsearch.ad.common.exception.EndRunException; diff --git a/src/test/java/com/amazon/opendistroforelasticsearch/ad/feature/SearchFeatureDaoTests.java b/src/test/java/com/amazon/opendistroforelasticsearch/ad/feature/SearchFeatureDaoTests.java index eea2d25eb..33fa85228 100644 --- a/src/test/java/com/amazon/opendistroforelasticsearch/ad/feature/SearchFeatureDaoTests.java +++ b/src/test/java/com/amazon/opendistroforelasticsearch/ad/feature/SearchFeatureDaoTests.java @@ -60,53 +60,6 @@ import org.apache.logging.log4j.Logger; import org.apache.lucene.search.TotalHits; import org.apache.lucene.util.BytesRef; -import org.elasticsearch.action.ActionFuture; -import org.elasticsearch.action.ActionListener; -import org.elasticsearch.action.search.MultiSearchRequest; -import org.elasticsearch.action.search.MultiSearchResponse; -import org.elasticsearch.action.search.MultiSearchResponse.Item; -import org.elasticsearch.action.search.SearchRequest; -import org.elasticsearch.action.search.SearchResponse; -import org.elasticsearch.action.search.SearchResponseSections; -import org.elasticsearch.action.search.ShardSearchFailure; -import org.elasticsearch.client.Client; -import org.elasticsearch.cluster.service.ClusterService; -import org.elasticsearch.common.settings.ClusterSettings; -import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.common.time.DateFormatter; -import org.elasticsearch.common.xcontent.LoggingDeprecationHandler; -import org.elasticsearch.common.xcontent.NamedXContentRegistry; -import org.elasticsearch.common.xcontent.XContentType; -import org.elasticsearch.index.mapper.DateFieldMapper; -import org.elasticsearch.index.query.QueryBuilders; -import org.elasticsearch.script.ScriptService; -import org.elasticsearch.script.TemplateScript; -import org.elasticsearch.script.TemplateScript.Factory; -import org.elasticsearch.search.DocValueFormat; -import org.elasticsearch.search.SearchHit; -import org.elasticsearch.search.SearchHits; -import org.elasticsearch.search.aggregations.Aggregation; -import org.elasticsearch.search.aggregations.AggregationBuilder; -import org.elasticsearch.search.aggregations.AggregationBuilders; -import org.elasticsearch.search.aggregations.Aggregations; -import org.elasticsearch.search.aggregations.AggregatorFactories; -import org.elasticsearch.search.aggregations.BucketOrder; -import org.elasticsearch.search.aggregations.InternalAggregation; -import org.elasticsearch.search.aggregations.InternalAggregations; -import org.elasticsearch.search.aggregations.InternalOrder; -import org.elasticsearch.search.aggregations.bucket.MultiBucketsAggregation; -import org.elasticsearch.search.aggregations.bucket.terms.StringTerms; -import org.elasticsearch.search.aggregations.bucket.terms.TermsAggregationBuilder; -import org.elasticsearch.search.aggregations.metrics.InternalMax; -import org.elasticsearch.search.aggregations.metrics.InternalMin; -import org.elasticsearch.search.aggregations.metrics.InternalTDigestPercentiles; -import org.elasticsearch.search.aggregations.metrics.Max; -import org.elasticsearch.search.aggregations.metrics.MaxAggregationBuilder; -import org.elasticsearch.search.aggregations.metrics.MinAggregationBuilder; -import org.elasticsearch.search.aggregations.metrics.NumericMetricsAggregation; -import org.elasticsearch.search.aggregations.metrics.Percentile; -import org.elasticsearch.search.builder.SearchSourceBuilder; -import org.elasticsearch.threadpool.ThreadPool; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -114,6 +67,53 @@ import org.mockito.Matchers; import org.mockito.Mock; import org.mockito.MockitoAnnotations; +import org.opensearch.action.ActionFuture; +import org.opensearch.action.ActionListener; +import org.opensearch.action.search.MultiSearchRequest; +import org.opensearch.action.search.MultiSearchResponse; +import org.opensearch.action.search.MultiSearchResponse.Item; +import org.opensearch.action.search.SearchRequest; +import org.opensearch.action.search.SearchResponse; +import org.opensearch.action.search.SearchResponseSections; +import org.opensearch.action.search.ShardSearchFailure; +import org.opensearch.client.Client; +import org.opensearch.cluster.service.ClusterService; +import org.opensearch.common.settings.ClusterSettings; +import org.opensearch.common.settings.Settings; +import org.opensearch.common.time.DateFormatter; +import org.opensearch.common.xcontent.LoggingDeprecationHandler; +import org.opensearch.common.xcontent.NamedXContentRegistry; +import org.opensearch.common.xcontent.XContentType; +import org.opensearch.index.mapper.DateFieldMapper; +import org.opensearch.index.query.QueryBuilders; +import org.opensearch.script.ScriptService; +import org.opensearch.script.TemplateScript; +import org.opensearch.script.TemplateScript.Factory; +import org.opensearch.search.DocValueFormat; +import org.opensearch.search.SearchHit; +import org.opensearch.search.SearchHits; +import org.opensearch.search.aggregations.Aggregation; +import org.opensearch.search.aggregations.AggregationBuilder; +import org.opensearch.search.aggregations.AggregationBuilders; +import org.opensearch.search.aggregations.Aggregations; +import org.opensearch.search.aggregations.AggregatorFactories; +import org.opensearch.search.aggregations.BucketOrder; +import org.opensearch.search.aggregations.InternalAggregation; +import org.opensearch.search.aggregations.InternalAggregations; +import org.opensearch.search.aggregations.InternalOrder; +import org.opensearch.search.aggregations.bucket.MultiBucketsAggregation; +import org.opensearch.search.aggregations.bucket.terms.StringTerms; +import org.opensearch.search.aggregations.bucket.terms.TermsAggregationBuilder; +import org.opensearch.search.aggregations.metrics.InternalMax; +import org.opensearch.search.aggregations.metrics.InternalMin; +import org.opensearch.search.aggregations.metrics.InternalTDigestPercentiles; +import org.opensearch.search.aggregations.metrics.Max; +import org.opensearch.search.aggregations.metrics.MaxAggregationBuilder; +import org.opensearch.search.aggregations.metrics.MinAggregationBuilder; +import org.opensearch.search.aggregations.metrics.NumericMetricsAggregation; +import org.opensearch.search.aggregations.metrics.Percentile; +import org.opensearch.search.builder.SearchSourceBuilder; +import org.opensearch.threadpool.ThreadPool; import org.powermock.api.mockito.PowerMockito; import org.powermock.core.classloader.annotations.PowerMockIgnore; import org.powermock.core.classloader.annotations.PrepareForTest; diff --git a/src/test/java/com/amazon/opendistroforelasticsearch/ad/indices/AnomalyDetectionIndicesTests.java b/src/test/java/com/amazon/opendistroforelasticsearch/ad/indices/AnomalyDetectionIndicesTests.java index 3b5c4f205..71601d0c4 100644 --- a/src/test/java/com/amazon/opendistroforelasticsearch/ad/indices/AnomalyDetectionIndicesTests.java +++ b/src/test/java/com/amazon/opendistroforelasticsearch/ad/indices/AnomalyDetectionIndicesTests.java @@ -19,16 +19,16 @@ import java.util.Collection; import java.util.Collections; -import org.elasticsearch.action.index.IndexRequest; -import org.elasticsearch.action.index.IndexResponse; -import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.common.unit.TimeValue; -import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentFactory; -import org.elasticsearch.plugins.Plugin; -import org.elasticsearch.rest.RestStatus; -import org.elasticsearch.test.ESIntegTestCase; import org.junit.Before; +import org.opensearch.action.index.IndexRequest; +import org.opensearch.action.index.IndexResponse; +import org.opensearch.common.settings.Settings; +import org.opensearch.common.unit.TimeValue; +import org.opensearch.common.xcontent.XContentBuilder; +import org.opensearch.common.xcontent.XContentFactory; +import org.opensearch.plugins.Plugin; +import org.opensearch.rest.RestStatus; +import org.opensearch.test.OpenSearchIntegTestCase; import com.amazon.opendistroforelasticsearch.ad.AnomalyDetectorPlugin; import com.amazon.opendistroforelasticsearch.ad.TestHelpers; @@ -37,7 +37,7 @@ import com.amazon.opendistroforelasticsearch.ad.util.DiscoveryNodeFilterer; import com.amazon.opendistroforelasticsearch.ad.util.RestHandlerUtils; -public class AnomalyDetectionIndicesTests extends ESIntegTestCase { +public class AnomalyDetectionIndicesTests extends OpenSearchIntegTestCase { private AnomalyDetectionIndices indices; private Settings settings; diff --git a/src/test/java/com/amazon/opendistroforelasticsearch/ad/indices/InitAnomalyDetectionIndicesTests.java b/src/test/java/com/amazon/opendistroforelasticsearch/ad/indices/InitAnomalyDetectionIndicesTests.java index 8324286bd..8a41c8715 100644 --- a/src/test/java/com/amazon/opendistroforelasticsearch/ad/indices/InitAnomalyDetectionIndicesTests.java +++ b/src/test/java/com/amazon/opendistroforelasticsearch/ad/indices/InitAnomalyDetectionIndicesTests.java @@ -28,22 +28,22 @@ import java.util.Collections; import java.util.HashSet; -import org.elasticsearch.action.ActionListener; -import org.elasticsearch.action.admin.indices.alias.Alias; -import org.elasticsearch.action.admin.indices.create.CreateIndexRequest; -import org.elasticsearch.action.admin.indices.create.CreateIndexResponse; -import org.elasticsearch.client.AdminClient; -import org.elasticsearch.client.Client; -import org.elasticsearch.client.IndicesAdminClient; -import org.elasticsearch.cluster.ClusterName; -import org.elasticsearch.cluster.ClusterState; -import org.elasticsearch.cluster.metadata.Metadata; -import org.elasticsearch.cluster.routing.RoutingTable; -import org.elasticsearch.cluster.service.ClusterService; -import org.elasticsearch.common.settings.ClusterSettings; -import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.threadpool.ThreadPool; import org.mockito.ArgumentCaptor; +import org.opensearch.action.ActionListener; +import org.opensearch.action.admin.indices.alias.Alias; +import org.opensearch.action.admin.indices.create.CreateIndexRequest; +import org.opensearch.action.admin.indices.create.CreateIndexResponse; +import org.opensearch.client.AdminClient; +import org.opensearch.client.Client; +import org.opensearch.client.IndicesAdminClient; +import org.opensearch.cluster.ClusterName; +import org.opensearch.cluster.ClusterState; +import org.opensearch.cluster.metadata.Metadata; +import org.opensearch.cluster.routing.RoutingTable; +import org.opensearch.cluster.service.ClusterService; +import org.opensearch.common.settings.ClusterSettings; +import org.opensearch.common.settings.Settings; +import org.opensearch.threadpool.ThreadPool; import com.amazon.opendistroforelasticsearch.ad.AbstractADTest; import com.amazon.opendistroforelasticsearch.ad.constant.CommonName; diff --git a/src/test/java/com/amazon/opendistroforelasticsearch/ad/indices/RolloverTests.java b/src/test/java/com/amazon/opendistroforelasticsearch/ad/indices/RolloverTests.java index bf3a1a187..7cab6e4f3 100644 --- a/src/test/java/com/amazon/opendistroforelasticsearch/ad/indices/RolloverTests.java +++ b/src/test/java/com/amazon/opendistroforelasticsearch/ad/indices/RolloverTests.java @@ -29,25 +29,25 @@ import java.util.HashSet; import java.util.Map; -import org.elasticsearch.action.ActionListener; -import org.elasticsearch.action.admin.cluster.state.ClusterStateRequest; -import org.elasticsearch.action.admin.cluster.state.ClusterStateResponse; -import org.elasticsearch.action.admin.indices.create.CreateIndexRequest; -import org.elasticsearch.action.admin.indices.rollover.Condition; -import org.elasticsearch.action.admin.indices.rollover.MaxDocsCondition; -import org.elasticsearch.action.admin.indices.rollover.RolloverRequest; -import org.elasticsearch.action.admin.indices.rollover.RolloverResponse; -import org.elasticsearch.client.AdminClient; -import org.elasticsearch.client.Client; -import org.elasticsearch.client.ClusterAdminClient; -import org.elasticsearch.client.IndicesAdminClient; -import org.elasticsearch.cluster.ClusterName; -import org.elasticsearch.cluster.ClusterState; -import org.elasticsearch.cluster.metadata.Metadata; -import org.elasticsearch.cluster.service.ClusterService; -import org.elasticsearch.common.settings.ClusterSettings; -import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.threadpool.ThreadPool; +import org.opensearch.action.ActionListener; +import org.opensearch.action.admin.cluster.state.ClusterStateRequest; +import org.opensearch.action.admin.cluster.state.ClusterStateResponse; +import org.opensearch.action.admin.indices.create.CreateIndexRequest; +import org.opensearch.action.admin.indices.rollover.Condition; +import org.opensearch.action.admin.indices.rollover.MaxDocsCondition; +import org.opensearch.action.admin.indices.rollover.RolloverRequest; +import org.opensearch.action.admin.indices.rollover.RolloverResponse; +import org.opensearch.client.AdminClient; +import org.opensearch.client.Client; +import org.opensearch.client.ClusterAdminClient; +import org.opensearch.client.IndicesAdminClient; +import org.opensearch.cluster.ClusterName; +import org.opensearch.cluster.ClusterState; +import org.opensearch.cluster.metadata.Metadata; +import org.opensearch.cluster.service.ClusterService; +import org.opensearch.common.settings.ClusterSettings; +import org.opensearch.common.settings.Settings; +import org.opensearch.threadpool.ThreadPool; import com.amazon.opendistroforelasticsearch.ad.AbstractADTest; import com.amazon.opendistroforelasticsearch.ad.constant.CommonName; diff --git a/src/test/java/com/amazon/opendistroforelasticsearch/ad/ml/CheckpointDaoTests.java b/src/test/java/com/amazon/opendistroforelasticsearch/ad/ml/CheckpointDaoTests.java index d5e774163..0fe0ba862 100644 --- a/src/test/java/com/amazon/opendistroforelasticsearch/ad/ml/CheckpointDaoTests.java +++ b/src/test/java/com/amazon/opendistroforelasticsearch/ad/ml/CheckpointDaoTests.java @@ -49,25 +49,6 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import org.elasticsearch.ResourceAlreadyExistsException; -import org.elasticsearch.action.ActionListener; -import org.elasticsearch.action.DocWriteRequest; -import org.elasticsearch.action.DocWriteResponse; -import org.elasticsearch.action.admin.indices.create.CreateIndexResponse; -import org.elasticsearch.action.bulk.BulkAction; -import org.elasticsearch.action.bulk.BulkItemResponse; -import org.elasticsearch.action.bulk.BulkRequest; -import org.elasticsearch.action.bulk.BulkResponse; -import org.elasticsearch.action.delete.DeleteRequest; -import org.elasticsearch.action.delete.DeleteResponse; -import org.elasticsearch.action.get.GetRequest; -import org.elasticsearch.action.get.GetResponse; -import org.elasticsearch.action.index.IndexRequest; -import org.elasticsearch.action.index.IndexResponse; -import org.elasticsearch.action.update.UpdateResponse; -import org.elasticsearch.client.Client; -import org.elasticsearch.index.engine.VersionConflictEngineException; -import org.elasticsearch.index.shard.ShardId; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -76,6 +57,25 @@ import org.mockito.Matchers; import org.mockito.Mock; import org.mockito.MockitoAnnotations; +import org.opensearch.ResourceAlreadyExistsException; +import org.opensearch.action.ActionListener; +import org.opensearch.action.DocWriteRequest; +import org.opensearch.action.DocWriteResponse; +import org.opensearch.action.admin.indices.create.CreateIndexResponse; +import org.opensearch.action.bulk.BulkAction; +import org.opensearch.action.bulk.BulkItemResponse; +import org.opensearch.action.bulk.BulkRequest; +import org.opensearch.action.bulk.BulkResponse; +import org.opensearch.action.delete.DeleteRequest; +import org.opensearch.action.delete.DeleteResponse; +import org.opensearch.action.get.GetRequest; +import org.opensearch.action.get.GetResponse; +import org.opensearch.action.index.IndexRequest; +import org.opensearch.action.index.IndexResponse; +import org.opensearch.action.update.UpdateResponse; +import org.opensearch.client.Client; +import org.opensearch.index.engine.VersionConflictEngineException; +import org.opensearch.index.shard.ShardId; import org.powermock.api.mockito.PowerMockito; import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; diff --git a/src/test/java/com/amazon/opendistroforelasticsearch/ad/ml/CheckpointDeleteTests.java b/src/test/java/com/amazon/opendistroforelasticsearch/ad/ml/CheckpointDeleteTests.java index f1eaf4a61..760dea8f8 100644 --- a/src/test/java/com/amazon/opendistroforelasticsearch/ad/ml/CheckpointDeleteTests.java +++ b/src/test/java/com/amazon/opendistroforelasticsearch/ad/ml/CheckpointDeleteTests.java @@ -25,15 +25,15 @@ import java.util.Arrays; import java.util.Collections; -import org.elasticsearch.ElasticsearchException; -import org.elasticsearch.action.ActionListener; -import org.elasticsearch.client.Client; -import org.elasticsearch.index.IndexNotFoundException; -import org.elasticsearch.index.reindex.BulkByScrollResponse; -import org.elasticsearch.index.reindex.DeleteByQueryAction; -import org.elasticsearch.index.reindex.ScrollableHitSource; import org.junit.After; import org.junit.Before; +import org.opensearch.OpenSearchException; +import org.opensearch.action.ActionListener; +import org.opensearch.client.Client; +import org.opensearch.index.IndexNotFoundException; +import org.opensearch.index.reindex.BulkByScrollResponse; +import org.opensearch.index.reindex.DeleteByQueryAction; +import org.opensearch.index.reindex.ScrollableHitSource; import com.amazon.opendistroforelasticsearch.ad.AbstractADTest; import com.amazon.opendistroforelasticsearch.ad.constant.CommonName; @@ -119,13 +119,13 @@ public void delete_by_detector_id_template(DeleteExecutionMode mode) { if (mode == DeleteExecutionMode.INDEX_NOT_FOUND) { listener.onFailure(new IndexNotFoundException(CommonName.CHECKPOINT_INDEX_NAME)); } else if (mode == DeleteExecutionMode.FAILURE) { - listener.onFailure(new ElasticsearchException("")); + listener.onFailure(new OpenSearchException("")); } else { if (mode == DeleteExecutionMode.PARTIAL_FAILURE) { when(deleteByQueryResponse.getSearchFailures()) .thenReturn( Collections - .singletonList(new ScrollableHitSource.SearchFailure(new ElasticsearchException("foo"), "bar", 1, "blah")) + .singletonList(new ScrollableHitSource.SearchFailure(new OpenSearchException("foo"), "bar", 1, "blah")) ); } listener.onResponse(deleteByQueryResponse); diff --git a/src/test/java/com/amazon/opendistroforelasticsearch/ad/ml/EntityColdStarterTests.java b/src/test/java/com/amazon/opendistroforelasticsearch/ad/ml/EntityColdStarterTests.java index bb57b1a02..42acadc39 100644 --- a/src/test/java/com/amazon/opendistroforelasticsearch/ad/ml/EntityColdStarterTests.java +++ b/src/test/java/com/amazon/opendistroforelasticsearch/ad/ml/EntityColdStarterTests.java @@ -36,13 +36,13 @@ import java.util.Optional; import java.util.Queue; -import org.elasticsearch.action.ActionListener; -import org.elasticsearch.action.get.GetRequest; -import org.elasticsearch.action.get.GetResponse; -import org.elasticsearch.client.Client; -import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.common.util.concurrent.EsRejectedExecutionException; -import org.elasticsearch.threadpool.ThreadPool; +import org.opensearch.action.ActionListener; +import org.opensearch.action.get.GetRequest; +import org.opensearch.action.get.GetResponse; +import org.opensearch.client.Client; +import org.opensearch.common.settings.Settings; +import org.opensearch.common.util.concurrent.OpenSearchRejectedExecutionException; +import org.opensearch.threadpool.ThreadPool; import test.com.amazon.opendistroforelasticsearch.ad.util.MLUtil; @@ -366,7 +366,7 @@ public void testThrottledColdStart() { doAnswer(invocation -> { ActionListener, Optional>> listener = invocation.getArgument(2); - listener.onFailure(new EsRejectedExecutionException("")); + listener.onFailure(new OpenSearchRejectedExecutionException("")); return null; }).when(searchFeatureDao).getEntityMinMaxDataTime(any(), any(), any()); diff --git a/src/test/java/com/amazon/opendistroforelasticsearch/ad/ml/ModelManagerTests.java b/src/test/java/com/amazon/opendistroforelasticsearch/ad/ml/ModelManagerTests.java index 692f1d933..dddec5349 100644 --- a/src/test/java/com/amazon/opendistroforelasticsearch/ad/ml/ModelManagerTests.java +++ b/src/test/java/com/amazon/opendistroforelasticsearch/ad/ml/ModelManagerTests.java @@ -50,14 +50,6 @@ import junitparams.JUnitParamsRunner; import junitparams.Parameters; -import org.elasticsearch.action.ActionListener; -import org.elasticsearch.cluster.node.DiscoveryNode; -import org.elasticsearch.cluster.service.ClusterService; -import org.elasticsearch.common.collect.ImmutableOpenMap; -import org.elasticsearch.common.settings.ClusterSettings; -import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.monitor.jvm.JvmService; -import org.elasticsearch.threadpool.ThreadPool; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -65,6 +57,14 @@ import org.mockito.ArgumentCaptor; import org.mockito.Mock; import org.mockito.MockitoAnnotations; +import org.opensearch.action.ActionListener; +import org.opensearch.cluster.node.DiscoveryNode; +import org.opensearch.cluster.service.ClusterService; +import org.opensearch.common.collect.ImmutableOpenMap; +import org.opensearch.common.settings.ClusterSettings; +import org.opensearch.common.settings.Settings; +import org.opensearch.monitor.jvm.JvmService; +import org.opensearch.threadpool.ThreadPool; import org.powermock.api.mockito.PowerMockito; import org.powermock.core.classloader.annotations.PowerMockIgnore; import org.powermock.core.classloader.annotations.PrepareForTest; diff --git a/src/test/java/com/amazon/opendistroforelasticsearch/ad/mock/model/MockSimpleLog.java b/src/test/java/com/amazon/opendistroforelasticsearch/ad/mock/model/MockSimpleLog.java index a044c78de..6544c0851 100644 --- a/src/test/java/com/amazon/opendistroforelasticsearch/ad/mock/model/MockSimpleLog.java +++ b/src/test/java/com/amazon/opendistroforelasticsearch/ad/mock/model/MockSimpleLog.java @@ -18,10 +18,10 @@ import java.io.IOException; import java.time.Instant; -import org.elasticsearch.common.io.stream.StreamOutput; -import org.elasticsearch.common.io.stream.Writeable; -import org.elasticsearch.common.xcontent.ToXContentObject; -import org.elasticsearch.common.xcontent.XContentBuilder; +import org.opensearch.common.io.stream.StreamOutput; +import org.opensearch.common.io.stream.Writeable; +import org.opensearch.common.xcontent.ToXContentObject; +import org.opensearch.common.xcontent.XContentBuilder; public class MockSimpleLog implements ToXContentObject, Writeable { diff --git a/src/test/java/com/amazon/opendistroforelasticsearch/ad/mock/plugin/MockReindexPlugin.java b/src/test/java/com/amazon/opendistroforelasticsearch/ad/mock/plugin/MockReindexPlugin.java index 2715a88c6..8caad8655 100644 --- a/src/test/java/com/amazon/opendistroforelasticsearch/ad/mock/plugin/MockReindexPlugin.java +++ b/src/test/java/com/amazon/opendistroforelasticsearch/ad/mock/plugin/MockReindexPlugin.java @@ -20,32 +20,32 @@ import java.util.Iterator; import java.util.List; -import org.elasticsearch.action.ActionListener; -import org.elasticsearch.action.ActionRequest; -import org.elasticsearch.action.ActionResponse; -import org.elasticsearch.action.bulk.BulkAction; -import org.elasticsearch.action.bulk.BulkRequest; -import org.elasticsearch.action.bulk.BulkRequestBuilder; -import org.elasticsearch.action.delete.DeleteRequest; -import org.elasticsearch.action.search.SearchRequest; -import org.elasticsearch.action.support.ActionFilters; -import org.elasticsearch.action.support.HandledTransportAction; -import org.elasticsearch.action.support.WriteRequest; -import org.elasticsearch.client.Client; -import org.elasticsearch.common.inject.Inject; -import org.elasticsearch.common.unit.TimeValue; -import org.elasticsearch.common.xcontent.XContentParser; -import org.elasticsearch.index.reindex.BulkByScrollResponse; -import org.elasticsearch.index.reindex.BulkByScrollTask; -import org.elasticsearch.index.reindex.DeleteByQueryAction; -import org.elasticsearch.index.reindex.DeleteByQueryRequest; -import org.elasticsearch.index.reindex.UpdateByQueryAction; -import org.elasticsearch.index.reindex.UpdateByQueryRequest; -import org.elasticsearch.plugins.ActionPlugin; -import org.elasticsearch.plugins.Plugin; -import org.elasticsearch.search.SearchHit; -import org.elasticsearch.tasks.Task; -import org.elasticsearch.transport.TransportService; +import org.opensearch.action.ActionListener; +import org.opensearch.action.ActionRequest; +import org.opensearch.action.ActionResponse; +import org.opensearch.action.bulk.BulkAction; +import org.opensearch.action.bulk.BulkRequest; +import org.opensearch.action.bulk.BulkRequestBuilder; +import org.opensearch.action.delete.DeleteRequest; +import org.opensearch.action.search.SearchRequest; +import org.opensearch.action.support.ActionFilters; +import org.opensearch.action.support.HandledTransportAction; +import org.opensearch.action.support.WriteRequest; +import org.opensearch.client.Client; +import org.opensearch.common.inject.Inject; +import org.opensearch.common.unit.TimeValue; +import org.opensearch.common.xcontent.XContentParser; +import org.opensearch.index.reindex.BulkByScrollResponse; +import org.opensearch.index.reindex.BulkByScrollTask; +import org.opensearch.index.reindex.DeleteByQueryAction; +import org.opensearch.index.reindex.DeleteByQueryRequest; +import org.opensearch.index.reindex.UpdateByQueryAction; +import org.opensearch.index.reindex.UpdateByQueryRequest; +import org.opensearch.plugins.ActionPlugin; +import org.opensearch.plugins.Plugin; +import org.opensearch.search.SearchHit; +import org.opensearch.tasks.Task; +import org.opensearch.transport.TransportService; import com.amazon.opendistroforelasticsearch.ad.TestHelpers; import com.amazon.opendistroforelasticsearch.ad.constant.CommonName; diff --git a/src/test/java/com/amazon/opendistroforelasticsearch/ad/mock/transport/MockAnomalyDetectorJobAction.java b/src/test/java/com/amazon/opendistroforelasticsearch/ad/mock/transport/MockAnomalyDetectorJobAction.java index 8b0b7d475..228a6bf26 100644 --- a/src/test/java/com/amazon/opendistroforelasticsearch/ad/mock/transport/MockAnomalyDetectorJobAction.java +++ b/src/test/java/com/amazon/opendistroforelasticsearch/ad/mock/transport/MockAnomalyDetectorJobAction.java @@ -15,7 +15,7 @@ package com.amazon.opendistroforelasticsearch.ad.mock.transport; -import org.elasticsearch.action.ActionType; +import org.opensearch.action.ActionType; import com.amazon.opendistroforelasticsearch.ad.constant.CommonValue; import com.amazon.opendistroforelasticsearch.ad.transport.AnomalyDetectorJobResponse; diff --git a/src/test/java/com/amazon/opendistroforelasticsearch/ad/mock/transport/MockAnomalyDetectorJobTransportActionWithUser.java b/src/test/java/com/amazon/opendistroforelasticsearch/ad/mock/transport/MockAnomalyDetectorJobTransportActionWithUser.java index e4b86294c..da9a4ed61 100644 --- a/src/test/java/com/amazon/opendistroforelasticsearch/ad/mock/transport/MockAnomalyDetectorJobTransportActionWithUser.java +++ b/src/test/java/com/amazon/opendistroforelasticsearch/ad/mock/transport/MockAnomalyDetectorJobTransportActionWithUser.java @@ -21,18 +21,18 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import org.elasticsearch.action.ActionListener; -import org.elasticsearch.action.support.ActionFilters; -import org.elasticsearch.action.support.HandledTransportAction; -import org.elasticsearch.client.Client; -import org.elasticsearch.cluster.service.ClusterService; -import org.elasticsearch.common.inject.Inject; -import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.common.unit.TimeValue; -import org.elasticsearch.common.util.concurrent.ThreadContext; -import org.elasticsearch.common.xcontent.NamedXContentRegistry; -import org.elasticsearch.tasks.Task; -import org.elasticsearch.transport.TransportService; +import org.opensearch.action.ActionListener; +import org.opensearch.action.support.ActionFilters; +import org.opensearch.action.support.HandledTransportAction; +import org.opensearch.client.Client; +import org.opensearch.cluster.service.ClusterService; +import org.opensearch.common.inject.Inject; +import org.opensearch.common.settings.Settings; +import org.opensearch.common.unit.TimeValue; +import org.opensearch.common.util.concurrent.ThreadContext; +import org.opensearch.common.xcontent.NamedXContentRegistry; +import org.opensearch.tasks.Task; +import org.opensearch.transport.TransportService; import com.amazon.opendistroforelasticsearch.ad.indices.AnomalyDetectionIndices; import com.amazon.opendistroforelasticsearch.ad.rest.handler.IndexAnomalyDetectorJobActionHandler; diff --git a/src/test/java/com/amazon/opendistroforelasticsearch/ad/model/ADTaskTests.java b/src/test/java/com/amazon/opendistroforelasticsearch/ad/model/ADTaskTests.java index da36a107b..b025bbae9 100644 --- a/src/test/java/com/amazon/opendistroforelasticsearch/ad/model/ADTaskTests.java +++ b/src/test/java/com/amazon/opendistroforelasticsearch/ad/model/ADTaskTests.java @@ -20,18 +20,18 @@ import java.time.temporal.ChronoUnit; import java.util.Collection; -import org.elasticsearch.common.io.stream.BytesStreamOutput; -import org.elasticsearch.common.io.stream.NamedWriteableAwareStreamInput; -import org.elasticsearch.common.io.stream.NamedWriteableRegistry; -import org.elasticsearch.common.xcontent.ToXContent; -import org.elasticsearch.plugins.Plugin; -import org.elasticsearch.test.ESSingleNodeTestCase; -import org.elasticsearch.test.InternalSettingsPlugin; +import org.opensearch.common.io.stream.BytesStreamOutput; +import org.opensearch.common.io.stream.NamedWriteableAwareStreamInput; +import org.opensearch.common.io.stream.NamedWriteableRegistry; +import org.opensearch.common.xcontent.ToXContent; +import org.opensearch.plugins.Plugin; +import org.opensearch.test.InternalSettingsPlugin; +import org.opensearch.test.OpenSearchSingleNodeTestCase; import com.amazon.opendistroforelasticsearch.ad.AnomalyDetectorPlugin; import com.amazon.opendistroforelasticsearch.ad.TestHelpers; -public class ADTaskTests extends ESSingleNodeTestCase { +public class ADTaskTests extends OpenSearchSingleNodeTestCase { @Override protected Collection> getPlugins() { diff --git a/src/test/java/com/amazon/opendistroforelasticsearch/ad/model/AnomalyDetectorExecutionInputTests.java b/src/test/java/com/amazon/opendistroforelasticsearch/ad/model/AnomalyDetectorExecutionInputTests.java index 2c4917bf2..081003b93 100644 --- a/src/test/java/com/amazon/opendistroforelasticsearch/ad/model/AnomalyDetectorExecutionInputTests.java +++ b/src/test/java/com/amazon/opendistroforelasticsearch/ad/model/AnomalyDetectorExecutionInputTests.java @@ -20,12 +20,12 @@ import java.time.temporal.ChronoUnit; import java.util.Locale; -import org.elasticsearch.common.xcontent.ToXContent; -import org.elasticsearch.test.ESTestCase; +import org.opensearch.common.xcontent.ToXContent; +import org.opensearch.test.OpenSearchTestCase; import com.amazon.opendistroforelasticsearch.ad.TestHelpers; -public class AnomalyDetectorExecutionInputTests extends ESTestCase { +public class AnomalyDetectorExecutionInputTests extends OpenSearchTestCase { public void testParseAnomalyDetectorExecutionInput() throws IOException { AnomalyDetectorExecutionInput detectorExecutionInput = TestHelpers.randomAnomalyDetectorExecutionInput(); diff --git a/src/test/java/com/amazon/opendistroforelasticsearch/ad/model/AnomalyDetectorJobTests.java b/src/test/java/com/amazon/opendistroforelasticsearch/ad/model/AnomalyDetectorJobTests.java index ecf58ec82..8fafa8c74 100644 --- a/src/test/java/com/amazon/opendistroforelasticsearch/ad/model/AnomalyDetectorJobTests.java +++ b/src/test/java/com/amazon/opendistroforelasticsearch/ad/model/AnomalyDetectorJobTests.java @@ -18,12 +18,12 @@ import java.io.IOException; import java.util.Locale; -import org.elasticsearch.common.xcontent.ToXContent; -import org.elasticsearch.test.ESTestCase; +import org.opensearch.common.xcontent.ToXContent; +import org.opensearch.test.OpenSearchTestCase; import com.amazon.opendistroforelasticsearch.ad.TestHelpers; -public class AnomalyDetectorJobTests extends ESTestCase { +public class AnomalyDetectorJobTests extends OpenSearchTestCase { public void testParseAnomalyDetectorJob() throws IOException { AnomalyDetectorJob anomalyDetectorJob = TestHelpers.randomAnomalyDetectorJob(); diff --git a/src/test/java/com/amazon/opendistroforelasticsearch/ad/model/AnomalyDetectorSerializationTests.java b/src/test/java/com/amazon/opendistroforelasticsearch/ad/model/AnomalyDetectorSerializationTests.java index 4b442d80b..44c2816ac 100644 --- a/src/test/java/com/amazon/opendistroforelasticsearch/ad/model/AnomalyDetectorSerializationTests.java +++ b/src/test/java/com/amazon/opendistroforelasticsearch/ad/model/AnomalyDetectorSerializationTests.java @@ -19,19 +19,19 @@ import java.time.Instant; import java.util.Collection; -import org.elasticsearch.common.io.stream.BytesStreamOutput; -import org.elasticsearch.common.io.stream.NamedWriteableAwareStreamInput; -import org.elasticsearch.common.io.stream.NamedWriteableRegistry; -import org.elasticsearch.plugins.Plugin; -import org.elasticsearch.test.ESSingleNodeTestCase; -import org.elasticsearch.test.InternalSettingsPlugin; +import org.opensearch.common.io.stream.BytesStreamOutput; +import org.opensearch.common.io.stream.NamedWriteableAwareStreamInput; +import org.opensearch.common.io.stream.NamedWriteableRegistry; +import org.opensearch.plugins.Plugin; +import org.opensearch.test.InternalSettingsPlugin; +import org.opensearch.test.OpenSearchSingleNodeTestCase; import com.amazon.opendistroforelasticsearch.ad.AnomalyDetectorPlugin; import com.amazon.opendistroforelasticsearch.ad.TestHelpers; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; -public class AnomalyDetectorSerializationTests extends ESSingleNodeTestCase { +public class AnomalyDetectorSerializationTests extends OpenSearchSingleNodeTestCase { @Override protected Collection> getPlugins() { return pluginList(InternalSettingsPlugin.class, AnomalyDetectorPlugin.class); diff --git a/src/test/java/com/amazon/opendistroforelasticsearch/ad/model/AnomalyDetectorTests.java b/src/test/java/com/amazon/opendistroforelasticsearch/ad/model/AnomalyDetectorTests.java index 83890b6eb..6d06b2607 100644 --- a/src/test/java/com/amazon/opendistroforelasticsearch/ad/model/AnomalyDetectorTests.java +++ b/src/test/java/com/amazon/opendistroforelasticsearch/ad/model/AnomalyDetectorTests.java @@ -21,10 +21,10 @@ import java.util.Locale; import java.util.concurrent.TimeUnit; -import org.elasticsearch.common.ParsingException; -import org.elasticsearch.common.unit.TimeValue; -import org.elasticsearch.common.xcontent.ToXContent; -import org.elasticsearch.index.query.MatchAllQueryBuilder; +import org.opensearch.common.ParsingException; +import org.opensearch.common.unit.TimeValue; +import org.opensearch.common.xcontent.ToXContent; +import org.opensearch.index.query.MatchAllQueryBuilder; import com.amazon.opendistroforelasticsearch.ad.AbstractADTest; import com.amazon.opendistroforelasticsearch.ad.TestHelpers; diff --git a/src/test/java/com/amazon/opendistroforelasticsearch/ad/model/AnomalyResultTests.java b/src/test/java/com/amazon/opendistroforelasticsearch/ad/model/AnomalyResultTests.java index 7a0e36f34..e48144959 100644 --- a/src/test/java/com/amazon/opendistroforelasticsearch/ad/model/AnomalyResultTests.java +++ b/src/test/java/com/amazon/opendistroforelasticsearch/ad/model/AnomalyResultTests.java @@ -21,13 +21,13 @@ import java.util.Collection; import java.util.Locale; -import org.elasticsearch.common.io.stream.BytesStreamOutput; -import org.elasticsearch.common.io.stream.NamedWriteableAwareStreamInput; -import org.elasticsearch.common.io.stream.NamedWriteableRegistry; -import org.elasticsearch.common.xcontent.ToXContent; -import org.elasticsearch.plugins.Plugin; -import org.elasticsearch.test.ESSingleNodeTestCase; -import org.elasticsearch.test.InternalSettingsPlugin; +import org.opensearch.common.io.stream.BytesStreamOutput; +import org.opensearch.common.io.stream.NamedWriteableAwareStreamInput; +import org.opensearch.common.io.stream.NamedWriteableRegistry; +import org.opensearch.common.xcontent.ToXContent; +import org.opensearch.plugins.Plugin; +import org.opensearch.test.InternalSettingsPlugin; +import org.opensearch.test.OpenSearchSingleNodeTestCase; import com.amazon.opendistroforelasticsearch.ad.AnomalyDetectorPlugin; import com.amazon.opendistroforelasticsearch.ad.TestHelpers; @@ -35,7 +35,7 @@ import com.google.common.base.Objects; import com.google.common.collect.ImmutableList; -public class AnomalyResultTests extends ESSingleNodeTestCase { +public class AnomalyResultTests extends OpenSearchSingleNodeTestCase { @Override protected Collection> getPlugins() { diff --git a/src/test/java/com/amazon/opendistroforelasticsearch/ad/model/DetectionDateRangeTests.java b/src/test/java/com/amazon/opendistroforelasticsearch/ad/model/DetectionDateRangeTests.java index 34473fcb4..72c9ddff3 100644 --- a/src/test/java/com/amazon/opendistroforelasticsearch/ad/model/DetectionDateRangeTests.java +++ b/src/test/java/com/amazon/opendistroforelasticsearch/ad/model/DetectionDateRangeTests.java @@ -21,18 +21,18 @@ import java.util.Collection; import java.util.Locale; -import org.elasticsearch.common.io.stream.BytesStreamOutput; -import org.elasticsearch.common.io.stream.NamedWriteableAwareStreamInput; -import org.elasticsearch.common.io.stream.NamedWriteableRegistry; -import org.elasticsearch.common.xcontent.ToXContent; -import org.elasticsearch.plugins.Plugin; -import org.elasticsearch.test.ESSingleNodeTestCase; -import org.elasticsearch.test.InternalSettingsPlugin; +import org.opensearch.common.io.stream.BytesStreamOutput; +import org.opensearch.common.io.stream.NamedWriteableAwareStreamInput; +import org.opensearch.common.io.stream.NamedWriteableRegistry; +import org.opensearch.common.xcontent.ToXContent; +import org.opensearch.plugins.Plugin; +import org.opensearch.test.InternalSettingsPlugin; +import org.opensearch.test.OpenSearchSingleNodeTestCase; import com.amazon.opendistroforelasticsearch.ad.AnomalyDetectorPlugin; import com.amazon.opendistroforelasticsearch.ad.TestHelpers; -public class DetectionDateRangeTests extends ESSingleNodeTestCase { +public class DetectionDateRangeTests extends OpenSearchSingleNodeTestCase { @Override protected Collection> getPlugins() { diff --git a/src/test/java/com/amazon/opendistroforelasticsearch/ad/model/EntityAnomalyResultTests.java b/src/test/java/com/amazon/opendistroforelasticsearch/ad/model/EntityAnomalyResultTests.java index 589a637cd..cb4ed35cc 100644 --- a/src/test/java/com/amazon/opendistroforelasticsearch/ad/model/EntityAnomalyResultTests.java +++ b/src/test/java/com/amazon/opendistroforelasticsearch/ad/model/EntityAnomalyResultTests.java @@ -21,12 +21,12 @@ import java.util.ArrayList; import java.util.List; -import org.elasticsearch.test.ESTestCase; import org.junit.Test; +import org.opensearch.test.OpenSearchTestCase; import com.amazon.opendistroforelasticsearch.ad.stats.ADStatsResponse; -public class EntityAnomalyResultTests extends ESTestCase { +public class EntityAnomalyResultTests extends OpenSearchTestCase { @Test public void testGetAnomalyResults() { diff --git a/src/test/java/com/amazon/opendistroforelasticsearch/ad/model/EntityProfileTests.java b/src/test/java/com/amazon/opendistroforelasticsearch/ad/model/EntityProfileTests.java index 5e195f7b4..75487ab4e 100644 --- a/src/test/java/com/amazon/opendistroforelasticsearch/ad/model/EntityProfileTests.java +++ b/src/test/java/com/amazon/opendistroforelasticsearch/ad/model/EntityProfileTests.java @@ -15,13 +15,13 @@ package com.amazon.opendistroforelasticsearch.ad.model; -import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder; +import static org.opensearch.common.xcontent.XContentFactory.jsonBuilder; import java.io.IOException; -import org.elasticsearch.common.Strings; -import org.elasticsearch.common.xcontent.ToXContent; -import org.elasticsearch.common.xcontent.XContentBuilder; +import org.opensearch.common.Strings; +import org.opensearch.common.xcontent.ToXContent; +import org.opensearch.common.xcontent.XContentBuilder; import test.com.amazon.opendistroforelasticsearch.ad.util.JsonDeserializer; diff --git a/src/test/java/com/amazon/opendistroforelasticsearch/ad/model/FeatureDataTests.java b/src/test/java/com/amazon/opendistroforelasticsearch/ad/model/FeatureDataTests.java index 96f13468c..b994df8e7 100644 --- a/src/test/java/com/amazon/opendistroforelasticsearch/ad/model/FeatureDataTests.java +++ b/src/test/java/com/amazon/opendistroforelasticsearch/ad/model/FeatureDataTests.java @@ -18,12 +18,12 @@ import java.io.IOException; import java.util.Locale; -import org.elasticsearch.common.xcontent.ToXContent; -import org.elasticsearch.test.ESTestCase; +import org.opensearch.common.xcontent.ToXContent; +import org.opensearch.test.OpenSearchTestCase; import com.amazon.opendistroforelasticsearch.ad.TestHelpers; -public class FeatureDataTests extends ESTestCase { +public class FeatureDataTests extends OpenSearchTestCase { public void testParseAnomalyDetector() throws IOException { FeatureData featureData = TestHelpers.randomFeatureData(); diff --git a/src/test/java/com/amazon/opendistroforelasticsearch/ad/model/FeatureTests.java b/src/test/java/com/amazon/opendistroforelasticsearch/ad/model/FeatureTests.java index 41e71266c..973b43f63 100644 --- a/src/test/java/com/amazon/opendistroforelasticsearch/ad/model/FeatureTests.java +++ b/src/test/java/com/amazon/opendistroforelasticsearch/ad/model/FeatureTests.java @@ -18,12 +18,12 @@ import java.io.IOException; import java.util.Locale; -import org.elasticsearch.common.xcontent.ToXContent; -import org.elasticsearch.test.ESTestCase; +import org.opensearch.common.xcontent.ToXContent; +import org.opensearch.test.OpenSearchTestCase; import com.amazon.opendistroforelasticsearch.ad.TestHelpers; -public class FeatureTests extends ESTestCase { +public class FeatureTests extends OpenSearchTestCase { public void testParseFeature() throws IOException { Feature feature = TestHelpers.randomFeature(); diff --git a/src/test/java/com/amazon/opendistroforelasticsearch/ad/model/IntervalTimeConfigurationTests.java b/src/test/java/com/amazon/opendistroforelasticsearch/ad/model/IntervalTimeConfigurationTests.java index 2fd735f22..80cc8f371 100644 --- a/src/test/java/com/amazon/opendistroforelasticsearch/ad/model/IntervalTimeConfigurationTests.java +++ b/src/test/java/com/amazon/opendistroforelasticsearch/ad/model/IntervalTimeConfigurationTests.java @@ -20,12 +20,12 @@ import java.time.temporal.ChronoUnit; import java.util.Locale; -import org.elasticsearch.common.xcontent.ToXContent; -import org.elasticsearch.test.ESTestCase; +import org.opensearch.common.xcontent.ToXContent; +import org.opensearch.test.OpenSearchTestCase; import com.amazon.opendistroforelasticsearch.ad.TestHelpers; -public class IntervalTimeConfigurationTests extends ESTestCase { +public class IntervalTimeConfigurationTests extends OpenSearchTestCase { public void testParseIntervalSchedule() throws IOException { TimeConfiguration schedule = TestHelpers.randomIntervalTimeConfiguration(); diff --git a/src/test/java/com/amazon/opendistroforelasticsearch/ad/plugin/MockReindexPlugin.java b/src/test/java/com/amazon/opendistroforelasticsearch/ad/plugin/MockReindexPlugin.java index 03086b89e..9ed49efdf 100644 --- a/src/test/java/com/amazon/opendistroforelasticsearch/ad/plugin/MockReindexPlugin.java +++ b/src/test/java/com/amazon/opendistroforelasticsearch/ad/plugin/MockReindexPlugin.java @@ -23,30 +23,30 @@ import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicLong; -import org.elasticsearch.action.ActionListener; -import org.elasticsearch.action.ActionRequest; -import org.elasticsearch.action.ActionResponse; -import org.elasticsearch.action.delete.DeleteRequest; -import org.elasticsearch.action.delete.DeleteResponse; -import org.elasticsearch.action.search.SearchRequest; -import org.elasticsearch.action.support.ActionFilters; -import org.elasticsearch.action.support.HandledTransportAction; -import org.elasticsearch.action.support.WriteRequest; -import org.elasticsearch.client.Client; -import org.elasticsearch.common.inject.Inject; -import org.elasticsearch.common.unit.TimeValue; -import org.elasticsearch.common.xcontent.XContentParser; -import org.elasticsearch.index.reindex.BulkByScrollResponse; -import org.elasticsearch.index.reindex.BulkByScrollTask; -import org.elasticsearch.index.reindex.DeleteByQueryAction; -import org.elasticsearch.index.reindex.DeleteByQueryRequest; -import org.elasticsearch.index.reindex.UpdateByQueryAction; -import org.elasticsearch.index.reindex.UpdateByQueryRequest; -import org.elasticsearch.plugins.ActionPlugin; -import org.elasticsearch.plugins.Plugin; -import org.elasticsearch.search.SearchHit; -import org.elasticsearch.tasks.Task; -import org.elasticsearch.transport.TransportService; +import org.opensearch.action.ActionListener; +import org.opensearch.action.ActionRequest; +import org.opensearch.action.ActionResponse; +import org.opensearch.action.delete.DeleteRequest; +import org.opensearch.action.delete.DeleteResponse; +import org.opensearch.action.search.SearchRequest; +import org.opensearch.action.support.ActionFilters; +import org.opensearch.action.support.HandledTransportAction; +import org.opensearch.action.support.WriteRequest; +import org.opensearch.client.Client; +import org.opensearch.common.inject.Inject; +import org.opensearch.common.unit.TimeValue; +import org.opensearch.common.xcontent.XContentParser; +import org.opensearch.index.reindex.BulkByScrollResponse; +import org.opensearch.index.reindex.BulkByScrollTask; +import org.opensearch.index.reindex.DeleteByQueryAction; +import org.opensearch.index.reindex.DeleteByQueryRequest; +import org.opensearch.index.reindex.UpdateByQueryAction; +import org.opensearch.index.reindex.UpdateByQueryRequest; +import org.opensearch.plugins.ActionPlugin; +import org.opensearch.plugins.Plugin; +import org.opensearch.search.SearchHit; +import org.opensearch.tasks.Task; +import org.opensearch.transport.TransportService; import com.amazon.opendistroforelasticsearch.ad.TestHelpers; import com.amazon.opendistroforelasticsearch.ad.constant.CommonName; diff --git a/src/test/java/com/amazon/opendistroforelasticsearch/ad/rest/AnomalyDetectorRestApiIT.java b/src/test/java/com/amazon/opendistroforelasticsearch/ad/rest/AnomalyDetectorRestApiIT.java index 2b2772fa7..25f100248 100644 --- a/src/test/java/com/amazon/opendistroforelasticsearch/ad/rest/AnomalyDetectorRestApiIT.java +++ b/src/test/java/com/amazon/opendistroforelasticsearch/ad/rest/AnomalyDetectorRestApiIT.java @@ -23,14 +23,14 @@ import org.apache.http.entity.ContentType; import org.apache.http.nio.entity.NStringEntity; -import org.elasticsearch.client.Response; -import org.elasticsearch.client.ResponseException; -import org.elasticsearch.common.UUIDs; -import org.elasticsearch.common.xcontent.ToXContentObject; -import org.elasticsearch.index.query.QueryBuilders; -import org.elasticsearch.rest.RestStatus; -import org.elasticsearch.search.builder.SearchSourceBuilder; import org.junit.Assert; +import org.opensearch.client.Response; +import org.opensearch.client.ResponseException; +import org.opensearch.common.UUIDs; +import org.opensearch.common.xcontent.ToXContentObject; +import org.opensearch.index.query.QueryBuilders; +import org.opensearch.rest.RestStatus; +import org.opensearch.search.builder.SearchSourceBuilder; import com.amazon.opendistroforelasticsearch.ad.AnomalyDetectorPlugin; import com.amazon.opendistroforelasticsearch.ad.AnomalyDetectorRestTestCase; diff --git a/src/test/java/com/amazon/opendistroforelasticsearch/ad/rest/HistoricalDetectorRestApiIT.java b/src/test/java/com/amazon/opendistroforelasticsearch/ad/rest/HistoricalDetectorRestApiIT.java index b8244bda5..c185e7c3e 100644 --- a/src/test/java/com/amazon/opendistroforelasticsearch/ad/rest/HistoricalDetectorRestApiIT.java +++ b/src/test/java/com/amazon/opendistroforelasticsearch/ad/rest/HistoricalDetectorRestApiIT.java @@ -23,11 +23,11 @@ import java.util.Map; import org.apache.http.util.EntityUtils; -import org.elasticsearch.client.Response; -import org.elasticsearch.client.ResponseException; -import org.elasticsearch.common.xcontent.ToXContentObject; -import org.elasticsearch.rest.RestStatus; import org.junit.Before; +import org.opensearch.client.Response; +import org.opensearch.client.ResponseException; +import org.opensearch.common.xcontent.ToXContentObject; +import org.opensearch.rest.RestStatus; import com.amazon.opendistroforelasticsearch.ad.HistoricalDetectorRestTestCase; import com.amazon.opendistroforelasticsearch.ad.TestHelpers; diff --git a/src/test/java/com/amazon/opendistroforelasticsearch/ad/rest/SecureADRestIT.java b/src/test/java/com/amazon/opendistroforelasticsearch/ad/rest/SecureADRestIT.java index 0772d95eb..e50257f6b 100644 --- a/src/test/java/com/amazon/opendistroforelasticsearch/ad/rest/SecureADRestIT.java +++ b/src/test/java/com/amazon/opendistroforelasticsearch/ad/rest/SecureADRestIT.java @@ -21,12 +21,12 @@ import java.util.Arrays; import org.apache.http.HttpHost; -import org.elasticsearch.client.Response; -import org.elasticsearch.client.RestClient; -import org.elasticsearch.rest.RestStatus; import org.junit.After; import org.junit.Assert; import org.junit.Before; +import org.opensearch.client.Response; +import org.opensearch.client.RestClient; +import org.opensearch.rest.RestStatus; import com.amazon.opendistroforelasticsearch.ad.AnomalyDetectorRestTestCase; import com.amazon.opendistroforelasticsearch.ad.model.AnomalyDetector; diff --git a/src/test/java/com/amazon/opendistroforelasticsearch/ad/stats/ADStatTests.java b/src/test/java/com/amazon/opendistroforelasticsearch/ad/stats/ADStatTests.java index b19555838..db569da0a 100644 --- a/src/test/java/com/amazon/opendistroforelasticsearch/ad/stats/ADStatTests.java +++ b/src/test/java/com/amazon/opendistroforelasticsearch/ad/stats/ADStatTests.java @@ -17,13 +17,13 @@ import java.util.function.Supplier; -import org.elasticsearch.test.ESTestCase; import org.junit.Test; +import org.opensearch.test.OpenSearchTestCase; import com.amazon.opendistroforelasticsearch.ad.stats.suppliers.CounterSupplier; import com.amazon.opendistroforelasticsearch.ad.stats.suppliers.SettableSupplier; -public class ADStatTests extends ESTestCase { +public class ADStatTests extends OpenSearchTestCase { @Test public void testIsClusterLevel() { diff --git a/src/test/java/com/amazon/opendistroforelasticsearch/ad/stats/ADStatsResponseTests.java b/src/test/java/com/amazon/opendistroforelasticsearch/ad/stats/ADStatsResponseTests.java index 2150920f1..56f874a63 100644 --- a/src/test/java/com/amazon/opendistroforelasticsearch/ad/stats/ADStatsResponseTests.java +++ b/src/test/java/com/amazon/opendistroforelasticsearch/ad/stats/ADStatsResponseTests.java @@ -21,18 +21,18 @@ import java.util.List; import java.util.Map; -import org.elasticsearch.action.FailedNodeException; -import org.elasticsearch.cluster.ClusterName; -import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentFactory; -import org.elasticsearch.common.xcontent.XContentParser; -import org.elasticsearch.test.ESTestCase; import org.junit.Test; +import org.opensearch.action.FailedNodeException; +import org.opensearch.cluster.ClusterName; +import org.opensearch.common.xcontent.XContentBuilder; +import org.opensearch.common.xcontent.XContentFactory; +import org.opensearch.common.xcontent.XContentParser; +import org.opensearch.test.OpenSearchTestCase; import com.amazon.opendistroforelasticsearch.ad.transport.ADStatsNodeResponse; import com.amazon.opendistroforelasticsearch.ad.transport.ADStatsNodesResponse; -public class ADStatsResponseTests extends ESTestCase { +public class ADStatsResponseTests extends OpenSearchTestCase { @Test public void testGetAndSetClusterStats() { ADStatsResponse adStatsResponse = new ADStatsResponse(); diff --git a/src/test/java/com/amazon/opendistroforelasticsearch/ad/stats/ADStatsTests.java b/src/test/java/com/amazon/opendistroforelasticsearch/ad/stats/ADStatsTests.java index 3e17e9841..212b2e54e 100644 --- a/src/test/java/com/amazon/opendistroforelasticsearch/ad/stats/ADStatsTests.java +++ b/src/test/java/com/amazon/opendistroforelasticsearch/ad/stats/ADStatsTests.java @@ -28,11 +28,11 @@ import java.util.Map; import java.util.Set; -import org.elasticsearch.test.ESTestCase; import org.junit.Before; import org.junit.Test; import org.mockito.Mock; import org.mockito.MockitoAnnotations; +import org.opensearch.test.OpenSearchTestCase; import test.com.amazon.opendistroforelasticsearch.ad.util.MLUtil; @@ -48,7 +48,7 @@ import com.amazon.opendistroforelasticsearch.ad.util.IndexUtils; import com.amazon.randomcutforest.RandomCutForest; -public class ADStatsTests extends ESTestCase { +public class ADStatsTests extends OpenSearchTestCase { private Map> statsMap; private ADStats adStats; diff --git a/src/test/java/com/amazon/opendistroforelasticsearch/ad/stats/suppliers/CounterSupplierTests.java b/src/test/java/com/amazon/opendistroforelasticsearch/ad/stats/suppliers/CounterSupplierTests.java index c571fa7df..eb4c6f51d 100644 --- a/src/test/java/com/amazon/opendistroforelasticsearch/ad/stats/suppliers/CounterSupplierTests.java +++ b/src/test/java/com/amazon/opendistroforelasticsearch/ad/stats/suppliers/CounterSupplierTests.java @@ -15,10 +15,10 @@ package com.amazon.opendistroforelasticsearch.ad.stats.suppliers; -import org.elasticsearch.test.ESTestCase; import org.junit.Test; +import org.opensearch.test.OpenSearchTestCase; -public class CounterSupplierTests extends ESTestCase { +public class CounterSupplierTests extends OpenSearchTestCase { @Test public void testGetAndIncrement() { CounterSupplier counterSupplier = new CounterSupplier(); diff --git a/src/test/java/com/amazon/opendistroforelasticsearch/ad/stats/suppliers/IndexSupplierTests.java b/src/test/java/com/amazon/opendistroforelasticsearch/ad/stats/suppliers/IndexSupplierTests.java index 863dc943e..17b872330 100644 --- a/src/test/java/com/amazon/opendistroforelasticsearch/ad/stats/suppliers/IndexSupplierTests.java +++ b/src/test/java/com/amazon/opendistroforelasticsearch/ad/stats/suppliers/IndexSupplierTests.java @@ -18,13 +18,13 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -import org.elasticsearch.test.ESTestCase; import org.junit.Before; import org.junit.Test; +import org.opensearch.test.OpenSearchTestCase; import com.amazon.opendistroforelasticsearch.ad.util.IndexUtils; -public class IndexSupplierTests extends ESTestCase { +public class IndexSupplierTests extends OpenSearchTestCase { private IndexUtils indexUtils; private String indexStatus; private String indexName; diff --git a/src/test/java/com/amazon/opendistroforelasticsearch/ad/stats/suppliers/ModelsOnNodeSupplierTests.java b/src/test/java/com/amazon/opendistroforelasticsearch/ad/stats/suppliers/ModelsOnNodeSupplierTests.java index e21a8be61..fa4be7377 100644 --- a/src/test/java/com/amazon/opendistroforelasticsearch/ad/stats/suppliers/ModelsOnNodeSupplierTests.java +++ b/src/test/java/com/amazon/opendistroforelasticsearch/ad/stats/suppliers/ModelsOnNodeSupplierTests.java @@ -27,11 +27,11 @@ import java.util.stream.Collectors; import java.util.stream.Stream; -import org.elasticsearch.test.ESTestCase; import org.junit.Before; import org.junit.Test; import org.mockito.Mock; import org.mockito.MockitoAnnotations; +import org.opensearch.test.OpenSearchTestCase; import test.com.amazon.opendistroforelasticsearch.ad.util.MLUtil; @@ -43,7 +43,7 @@ import com.amazon.opendistroforelasticsearch.ad.ml.ModelState; import com.amazon.randomcutforest.RandomCutForest; -public class ModelsOnNodeSupplierTests extends ESTestCase { +public class ModelsOnNodeSupplierTests extends OpenSearchTestCase { private RandomCutForest rcf; private HybridThresholdingModel thresholdingModel; private List> expectedResults; diff --git a/src/test/java/com/amazon/opendistroforelasticsearch/ad/stats/suppliers/SettableSupplierTests.java b/src/test/java/com/amazon/opendistroforelasticsearch/ad/stats/suppliers/SettableSupplierTests.java index 05b902a87..afec3284c 100644 --- a/src/test/java/com/amazon/opendistroforelasticsearch/ad/stats/suppliers/SettableSupplierTests.java +++ b/src/test/java/com/amazon/opendistroforelasticsearch/ad/stats/suppliers/SettableSupplierTests.java @@ -15,10 +15,10 @@ package com.amazon.opendistroforelasticsearch.ad.stats.suppliers; -import org.elasticsearch.test.ESTestCase; import org.junit.Test; +import org.opensearch.test.OpenSearchTestCase; -public class SettableSupplierTests extends ESTestCase { +public class SettableSupplierTests extends OpenSearchTestCase { @Test public void testSetGet() { Long setCount = 15L; diff --git a/src/test/java/com/amazon/opendistroforelasticsearch/ad/task/ADTaskCacheManagerTests.java b/src/test/java/com/amazon/opendistroforelasticsearch/ad/task/ADTaskCacheManagerTests.java index fec2bbe0e..f94bfb2c0 100644 --- a/src/test/java/com/amazon/opendistroforelasticsearch/ad/task/ADTaskCacheManagerTests.java +++ b/src/test/java/com/amazon/opendistroforelasticsearch/ad/task/ADTaskCacheManagerTests.java @@ -32,12 +32,12 @@ import java.util.Collections; import java.util.HashSet; -import org.elasticsearch.cluster.service.ClusterService; -import org.elasticsearch.common.settings.ClusterSettings; -import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.test.ESTestCase; import org.junit.After; import org.junit.Before; +import org.opensearch.cluster.service.ClusterService; +import org.opensearch.common.settings.ClusterSettings; +import org.opensearch.common.settings.Settings; +import org.opensearch.test.OpenSearchTestCase; import com.amazon.opendistroforelasticsearch.ad.MemoryTracker; import com.amazon.opendistroforelasticsearch.ad.TestHelpers; @@ -47,7 +47,7 @@ import com.amazon.opendistroforelasticsearch.ad.model.ADTaskState; import com.amazon.opendistroforelasticsearch.ad.settings.AnomalyDetectorSettings; -public class ADTaskCacheManagerTests extends ESTestCase { +public class ADTaskCacheManagerTests extends OpenSearchTestCase { private MemoryTracker memoryTracker; private ADTaskCacheManager adTaskCacheManager; private ClusterService clusterService; diff --git a/src/test/java/com/amazon/opendistroforelasticsearch/ad/task/ADTaskManagerTests.java b/src/test/java/com/amazon/opendistroforelasticsearch/ad/task/ADTaskManagerTests.java index 5a7584c7f..5c2d9588b 100644 --- a/src/test/java/com/amazon/opendistroforelasticsearch/ad/task/ADTaskManagerTests.java +++ b/src/test/java/com/amazon/opendistroforelasticsearch/ad/task/ADTaskManagerTests.java @@ -34,16 +34,16 @@ import java.time.Instant; import java.time.temporal.ChronoUnit; -import org.elasticsearch.ResourceAlreadyExistsException; -import org.elasticsearch.action.ActionListener; -import org.elasticsearch.action.admin.indices.create.CreateIndexResponse; -import org.elasticsearch.client.Client; -import org.elasticsearch.cluster.service.ClusterService; -import org.elasticsearch.common.settings.ClusterSettings; -import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.common.unit.TimeValue; -import org.elasticsearch.common.xcontent.NamedXContentRegistry; -import org.elasticsearch.transport.TransportService; +import org.opensearch.ResourceAlreadyExistsException; +import org.opensearch.action.ActionListener; +import org.opensearch.action.admin.indices.create.CreateIndexResponse; +import org.opensearch.client.Client; +import org.opensearch.cluster.service.ClusterService; +import org.opensearch.common.settings.ClusterSettings; +import org.opensearch.common.settings.Settings; +import org.opensearch.common.unit.TimeValue; +import org.opensearch.common.xcontent.NamedXContentRegistry; +import org.opensearch.transport.TransportService; import com.amazon.opendistroforelasticsearch.ad.ADUnitTestCase; import com.amazon.opendistroforelasticsearch.ad.TestHelpers; diff --git a/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/ADBatchAnomalyResultTransportActionTests.java b/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/ADBatchAnomalyResultTransportActionTests.java index 585df8b9a..dfcfacaea 100644 --- a/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/ADBatchAnomalyResultTransportActionTests.java +++ b/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/ADBatchAnomalyResultTransportActionTests.java @@ -25,12 +25,12 @@ import java.time.temporal.ChronoUnit; import java.util.concurrent.TimeUnit; -import org.elasticsearch.action.ActionRequestValidationException; -import org.elasticsearch.action.get.GetResponse; -import org.elasticsearch.common.io.stream.NotSerializableExceptionWrapper; -import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.test.ESIntegTestCase; import org.junit.Before; +import org.opensearch.action.ActionRequestValidationException; +import org.opensearch.action.get.GetResponse; +import org.opensearch.common.io.stream.NotSerializableExceptionWrapper; +import org.opensearch.common.settings.Settings; +import org.opensearch.test.OpenSearchIntegTestCase; import com.amazon.opendistroforelasticsearch.ad.HistoricalDetectorIntegTestCase; import com.amazon.opendistroforelasticsearch.ad.TestHelpers; @@ -44,7 +44,7 @@ import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; -@ESIntegTestCase.ClusterScope(scope = ESIntegTestCase.Scope.TEST, numDataNodes = 2) +@OpenSearchIntegTestCase.ClusterScope(scope = OpenSearchIntegTestCase.Scope.TEST, numDataNodes = 2) public class ADBatchAnomalyResultTransportActionTests extends HistoricalDetectorIntegTestCase { private String testIndex; diff --git a/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/ADCancelTaskTests.java b/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/ADCancelTaskTests.java index 59d946b19..f53482a30 100644 --- a/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/ADCancelTaskTests.java +++ b/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/ADCancelTaskTests.java @@ -20,11 +20,11 @@ import java.io.IOException; import java.util.List; -import org.elasticsearch.action.ActionRequestValidationException; -import org.elasticsearch.cluster.ClusterName; -import org.elasticsearch.common.io.stream.BytesStreamOutput; -import org.elasticsearch.common.io.stream.NamedWriteableAwareStreamInput; -import org.elasticsearch.common.io.stream.StreamInput; +import org.opensearch.action.ActionRequestValidationException; +import org.opensearch.cluster.ClusterName; +import org.opensearch.common.io.stream.BytesStreamOutput; +import org.opensearch.common.io.stream.NamedWriteableAwareStreamInput; +import org.opensearch.common.io.stream.StreamInput; import com.amazon.opendistroforelasticsearch.ad.ADUnitTestCase; import com.amazon.opendistroforelasticsearch.ad.constant.CommonErrorMessages; diff --git a/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/ADResultBulkTransportActionTests.java b/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/ADResultBulkTransportActionTests.java index a1cec39d4..3b5074a6b 100644 --- a/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/ADResultBulkTransportActionTests.java +++ b/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/ADResultBulkTransportActionTests.java @@ -28,24 +28,24 @@ import java.util.Collections; import java.util.HashSet; -import org.elasticsearch.action.ActionListener; -import org.elasticsearch.action.ActionRequestValidationException; -import org.elasticsearch.action.bulk.BulkRequest; -import org.elasticsearch.action.bulk.BulkResponse; -import org.elasticsearch.action.support.ActionFilters; -import org.elasticsearch.action.support.PlainActionFuture; -import org.elasticsearch.client.Client; -import org.elasticsearch.cluster.service.ClusterService; -import org.elasticsearch.common.io.stream.BytesStreamOutput; -import org.elasticsearch.common.io.stream.StreamInput; -import org.elasticsearch.common.settings.ClusterSettings; -import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.index.IndexingPressure; -import org.elasticsearch.transport.TransportService; import org.junit.After; import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; +import org.opensearch.action.ActionListener; +import org.opensearch.action.ActionRequestValidationException; +import org.opensearch.action.bulk.BulkRequest; +import org.opensearch.action.bulk.BulkResponse; +import org.opensearch.action.support.ActionFilters; +import org.opensearch.action.support.PlainActionFuture; +import org.opensearch.client.Client; +import org.opensearch.cluster.service.ClusterService; +import org.opensearch.common.io.stream.BytesStreamOutput; +import org.opensearch.common.io.stream.StreamInput; +import org.opensearch.common.settings.ClusterSettings; +import org.opensearch.common.settings.Settings; +import org.opensearch.index.IndexingPressure; +import org.opensearch.transport.TransportService; import com.amazon.opendistroforelasticsearch.ad.AbstractADTest; import com.amazon.opendistroforelasticsearch.ad.TestHelpers; diff --git a/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/ADStatsIT.java b/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/ADStatsIT.java index a47f436bf..e1672d7c1 100644 --- a/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/ADStatsIT.java +++ b/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/ADStatsIT.java @@ -19,13 +19,13 @@ import java.util.Collections; import java.util.concurrent.ExecutionException; -import org.elasticsearch.plugins.Plugin; -import org.elasticsearch.test.ESIntegTestCase; +import org.opensearch.plugins.Plugin; +import org.opensearch.test.OpenSearchIntegTestCase; import com.amazon.opendistroforelasticsearch.ad.AnomalyDetectorPlugin; -@ESIntegTestCase.ClusterScope(transportClientRatio = 0.9) -public class ADStatsIT extends ESIntegTestCase { +@OpenSearchIntegTestCase.ClusterScope(transportClientRatio = 0.9) +public class ADStatsIT extends OpenSearchIntegTestCase { @Override protected Collection> nodePlugins() { diff --git a/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/ADStatsNodesTransportActionTests.java b/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/ADStatsNodesTransportActionTests.java index 21bc59af1..ef03c415a 100644 --- a/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/ADStatsNodesTransportActionTests.java +++ b/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/ADStatsNodesTransportActionTests.java @@ -25,17 +25,17 @@ import java.util.Map; import java.util.Set; -import org.elasticsearch.action.support.ActionFilters; -import org.elasticsearch.client.Client; -import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver; -import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.monitor.jvm.JvmService; -import org.elasticsearch.monitor.jvm.JvmStats; -import org.elasticsearch.test.ESIntegTestCase; -import org.elasticsearch.threadpool.ThreadPool; -import org.elasticsearch.transport.TransportService; import org.junit.Before; import org.junit.Test; +import org.opensearch.action.support.ActionFilters; +import org.opensearch.client.Client; +import org.opensearch.cluster.metadata.IndexNameExpressionResolver; +import org.opensearch.common.settings.Settings; +import org.opensearch.monitor.jvm.JvmService; +import org.opensearch.monitor.jvm.JvmStats; +import org.opensearch.test.OpenSearchIntegTestCase; +import org.opensearch.threadpool.ThreadPool; +import org.opensearch.transport.TransportService; import com.amazon.opendistroforelasticsearch.ad.caching.CacheProvider; import com.amazon.opendistroforelasticsearch.ad.caching.EntityCache; @@ -51,7 +51,7 @@ import com.amazon.opendistroforelasticsearch.ad.util.IndexUtils; import com.amazon.opendistroforelasticsearch.ad.util.Throttler; -public class ADStatsNodesTransportActionTests extends ESIntegTestCase { +public class ADStatsNodesTransportActionTests extends OpenSearchIntegTestCase { private ADStatsNodesTransportAction action; private ADStats adStats; diff --git a/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/ADStatsTests.java b/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/ADStatsTests.java index 87af960e0..aa9ae2721 100644 --- a/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/ADStatsTests.java +++ b/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/ADStatsTests.java @@ -17,7 +17,7 @@ import static java.util.Collections.emptyMap; import static java.util.Collections.emptySet; -import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder; +import static org.opensearch.common.xcontent.XContentFactory.jsonBuilder; import java.io.IOException; import java.util.Arrays; @@ -28,26 +28,26 @@ import java.util.Map; import java.util.stream.Collectors; -import org.elasticsearch.Version; -import org.elasticsearch.action.FailedNodeException; -import org.elasticsearch.cluster.ClusterName; -import org.elasticsearch.cluster.node.DiscoveryNode; -import org.elasticsearch.common.Strings; -import org.elasticsearch.common.io.stream.BytesStreamOutput; -import org.elasticsearch.common.io.stream.StreamInput; -import org.elasticsearch.common.transport.TransportAddress; -import org.elasticsearch.common.xcontent.ToXContent; -import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.test.ESTestCase; import org.junit.Before; import org.junit.Test; +import org.opensearch.Version; +import org.opensearch.action.FailedNodeException; +import org.opensearch.cluster.ClusterName; +import org.opensearch.cluster.node.DiscoveryNode; +import org.opensearch.common.Strings; +import org.opensearch.common.io.stream.BytesStreamOutput; +import org.opensearch.common.io.stream.StreamInput; +import org.opensearch.common.transport.TransportAddress; +import org.opensearch.common.xcontent.ToXContent; +import org.opensearch.common.xcontent.XContentBuilder; +import org.opensearch.test.OpenSearchTestCase; import test.com.amazon.opendistroforelasticsearch.ad.util.JsonDeserializer; import com.amazon.opendistroforelasticsearch.ad.common.exception.JsonPathNotFoundException; import com.amazon.opendistroforelasticsearch.ad.stats.StatNames; -public class ADStatsTests extends ESTestCase { +public class ADStatsTests extends OpenSearchTestCase { String node1, nodeName1, clusterName; Map clusterStats; DiscoveryNode discoveryNode1; diff --git a/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/ADTaskProfileTests.java b/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/ADTaskProfileTests.java index ca4cbb38f..b167fa9cf 100644 --- a/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/ADTaskProfileTests.java +++ b/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/ADTaskProfileTests.java @@ -21,17 +21,17 @@ import java.util.Collection; import java.util.List; -import org.elasticsearch.Version; -import org.elasticsearch.action.ActionRequestValidationException; -import org.elasticsearch.cluster.ClusterName; -import org.elasticsearch.cluster.node.DiscoveryNode; -import org.elasticsearch.common.UUIDs; -import org.elasticsearch.common.io.stream.BytesStreamOutput; -import org.elasticsearch.common.io.stream.NamedWriteableAwareStreamInput; -import org.elasticsearch.common.io.stream.NamedWriteableRegistry; -import org.elasticsearch.plugins.Plugin; -import org.elasticsearch.test.ESSingleNodeTestCase; -import org.elasticsearch.test.InternalSettingsPlugin; +import org.opensearch.Version; +import org.opensearch.action.ActionRequestValidationException; +import org.opensearch.cluster.ClusterName; +import org.opensearch.cluster.node.DiscoveryNode; +import org.opensearch.common.UUIDs; +import org.opensearch.common.io.stream.BytesStreamOutput; +import org.opensearch.common.io.stream.NamedWriteableAwareStreamInput; +import org.opensearch.common.io.stream.NamedWriteableRegistry; +import org.opensearch.plugins.Plugin; +import org.opensearch.test.InternalSettingsPlugin; +import org.opensearch.test.OpenSearchSingleNodeTestCase; import com.amazon.opendistroforelasticsearch.ad.AnomalyDetectorPlugin; import com.amazon.opendistroforelasticsearch.ad.TestHelpers; @@ -39,7 +39,7 @@ import com.amazon.opendistroforelasticsearch.ad.model.ADTaskProfile; import com.google.common.collect.ImmutableList; -public class ADTaskProfileTests extends ESSingleNodeTestCase { +public class ADTaskProfileTests extends OpenSearchSingleNodeTestCase { @Override protected Collection> getPlugins() { return pluginList(InternalSettingsPlugin.class, AnomalyDetectorPlugin.class); diff --git a/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/ADTaskProfileTransportActionTests.java b/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/ADTaskProfileTransportActionTests.java index 45acc6a19..237d1873d 100644 --- a/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/ADTaskProfileTransportActionTests.java +++ b/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/ADTaskProfileTransportActionTests.java @@ -21,8 +21,8 @@ import java.time.Instant; import java.time.temporal.ChronoUnit; -import org.elasticsearch.common.settings.Settings; import org.junit.Before; +import org.opensearch.common.settings.Settings; import com.amazon.opendistroforelasticsearch.ad.HistoricalDetectorIntegTestCase; diff --git a/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/AnomalyDetectorJobActionTests.java b/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/AnomalyDetectorJobActionTests.java index 6a261bb61..5780d8f71 100644 --- a/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/AnomalyDetectorJobActionTests.java +++ b/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/AnomalyDetectorJobActionTests.java @@ -23,30 +23,30 @@ import java.util.Collections; import java.util.HashSet; -import org.elasticsearch.action.ActionListener; -import org.elasticsearch.action.support.ActionFilters; -import org.elasticsearch.client.Client; -import org.elasticsearch.cluster.service.ClusterService; -import org.elasticsearch.common.io.stream.BytesStreamOutput; -import org.elasticsearch.common.io.stream.StreamInput; -import org.elasticsearch.common.settings.ClusterSettings; -import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.common.util.concurrent.ThreadContext; -import org.elasticsearch.rest.RestStatus; -import org.elasticsearch.tasks.Task; -import org.elasticsearch.test.ESIntegTestCase; -import org.elasticsearch.threadpool.ThreadPool; -import org.elasticsearch.transport.TransportService; import org.junit.Assert; import org.junit.Before; import org.junit.Test; +import org.opensearch.action.ActionListener; +import org.opensearch.action.support.ActionFilters; +import org.opensearch.client.Client; +import org.opensearch.cluster.service.ClusterService; +import org.opensearch.common.io.stream.BytesStreamOutput; +import org.opensearch.common.io.stream.StreamInput; +import org.opensearch.common.settings.ClusterSettings; +import org.opensearch.common.settings.Settings; +import org.opensearch.common.util.concurrent.ThreadContext; +import org.opensearch.rest.RestStatus; +import org.opensearch.tasks.Task; +import org.opensearch.test.OpenSearchIntegTestCase; +import org.opensearch.threadpool.ThreadPool; +import org.opensearch.transport.TransportService; import com.amazon.opendistroforelasticsearch.ad.indices.AnomalyDetectionIndices; import com.amazon.opendistroforelasticsearch.ad.settings.AnomalyDetectorSettings; import com.amazon.opendistroforelasticsearch.ad.task.ADTaskManager; import com.amazon.opendistroforelasticsearch.commons.ConfigConstants; -public class AnomalyDetectorJobActionTests extends ESIntegTestCase { +public class AnomalyDetectorJobActionTests extends OpenSearchIntegTestCase { private AnomalyDetectorJobTransportAction action; private Task task; private AnomalyDetectorJobRequest request; @@ -67,7 +67,7 @@ public void setUp() throws Exception { threadContext.putTransient(ConfigConstants.OPENDISTRO_SECURITY_USER_INFO_THREAD_CONTEXT, "alice|odfe,aes|engineering,operations"); when(clusterService.getClusterSettings()).thenReturn(clusterSettings); Client client = mock(Client.class); - org.elasticsearch.threadpool.ThreadPool mockThreadPool = mock(ThreadPool.class); + org.opensearch.threadpool.ThreadPool mockThreadPool = mock(ThreadPool.class); when(client.threadPool()).thenReturn(mockThreadPool); when(mockThreadPool.getThreadContext()).thenReturn(threadContext); diff --git a/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/AnomalyDetectorJobTransportActionTests.java b/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/AnomalyDetectorJobTransportActionTests.java index b5ba36814..47be8fc7f 100644 --- a/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/AnomalyDetectorJobTransportActionTests.java +++ b/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/AnomalyDetectorJobTransportActionTests.java @@ -22,8 +22,8 @@ import static com.amazon.opendistroforelasticsearch.ad.util.RestHandlerUtils.PROFILE; import static com.amazon.opendistroforelasticsearch.ad.util.RestHandlerUtils.START_JOB; import static com.amazon.opendistroforelasticsearch.ad.util.RestHandlerUtils.STOP_JOB; -import static org.elasticsearch.index.seqno.SequenceNumbers.UNASSIGNED_PRIMARY_TERM; -import static org.elasticsearch.index.seqno.SequenceNumbers.UNASSIGNED_SEQ_NO; +import static org.opensearch.index.seqno.SequenceNumbers.UNASSIGNED_PRIMARY_TERM; +import static org.opensearch.index.seqno.SequenceNumbers.UNASSIGNED_SEQ_NO; import java.io.IOException; import java.time.Instant; @@ -35,16 +35,16 @@ import java.util.concurrent.atomic.AtomicLong; import java.util.concurrent.atomic.AtomicReference; -import org.elasticsearch.ElasticsearchStatusException; -import org.elasticsearch.action.ActionListener; -import org.elasticsearch.action.get.GetResponse; -import org.elasticsearch.client.Client; -import org.elasticsearch.common.lucene.uid.Versions; -import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.index.IndexNotFoundException; -import org.elasticsearch.test.ESIntegTestCase; import org.junit.After; import org.junit.Before; +import org.opensearch.OpenSearchStatusException; +import org.opensearch.action.ActionListener; +import org.opensearch.action.get.GetResponse; +import org.opensearch.client.Client; +import org.opensearch.common.lucene.uid.Versions; +import org.opensearch.common.settings.Settings; +import org.opensearch.index.IndexNotFoundException; +import org.opensearch.test.OpenSearchIntegTestCase; import com.amazon.opendistroforelasticsearch.ad.HistoricalDetectorIntegTestCase; import com.amazon.opendistroforelasticsearch.ad.TestHelpers; @@ -61,7 +61,7 @@ import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; -@ESIntegTestCase.ClusterScope(scope = ESIntegTestCase.Scope.TEST, numDataNodes = 2) +@OpenSearchIntegTestCase.ClusterScope(scope = OpenSearchIntegTestCase.Scope.TEST, numDataNodes = 2) public class AnomalyDetectorJobTransportActionTests extends HistoricalDetectorIntegTestCase { private Instant startTime; private Instant endTime; @@ -103,8 +103,8 @@ public void testDetectorIndexNotFound() { public void testDetectorNotFound() { String detectorId = randomAlphaOfLength(5); AnomalyDetectorJobRequest request = startDetectorJobRequest(detectorId); - ElasticsearchStatusException exception = expectThrows( - ElasticsearchStatusException.class, + OpenSearchStatusException exception = expectThrows( + OpenSearchStatusException.class, () -> client().execute(AnomalyDetectorJobAction.INSTANCE, request).actionGet(10000) ); assertTrue(exception.getMessage().contains("AnomalyDetector is not found")); @@ -145,8 +145,8 @@ public void testRunMultipleTasksForHistoricalDetector() throws IOException, Inte AnomalyDetectorJobRequest request = startDetectorJobRequest(detectorId); AnomalyDetectorJobResponse response = client().execute(AnomalyDetectorJobAction.INSTANCE, request).actionGet(10000); assertNotNull(response.getId()); - ElasticsearchStatusException exception = expectThrows( - ElasticsearchStatusException.class, + OpenSearchStatusException exception = expectThrows( + OpenSearchStatusException.class, () -> client().execute(AnomalyDetectorJobAction.INSTANCE, request).actionGet(10000) ); assertTrue(exception.getMessage().contains(DETECTOR_IS_RUNNING)); @@ -274,8 +274,8 @@ public void testHistoricalDetectorWithoutEnabledFeature() throws IOException { private void testInvalidDetector(AnomalyDetector detector, String error) throws IOException { String detectorId = createDetector(detector); AnomalyDetectorJobRequest request = startDetectorJobRequest(detectorId); - ElasticsearchStatusException exception = expectThrows( - ElasticsearchStatusException.class, + OpenSearchStatusException exception = expectThrows( + OpenSearchStatusException.class, () -> client().execute(AnomalyDetectorJobAction.INSTANCE, request).actionGet(10000) ); assertEquals(error, exception.getMessage()); diff --git a/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/AnomalyResultTests.java b/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/AnomalyResultTests.java index 7090ea8e3..81d802b16 100644 --- a/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/AnomalyResultTests.java +++ b/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/AnomalyResultTests.java @@ -16,7 +16,6 @@ package com.amazon.opendistroforelasticsearch.ad.transport; import static com.amazon.opendistroforelasticsearch.ad.TestHelpers.createIndexBlockedState; -import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder; import static org.hamcrest.CoreMatchers.startsWith; import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.empty; @@ -39,6 +38,7 @@ import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; +import static org.opensearch.common.xcontent.XContentFactory.jsonBuilder; import java.io.IOException; import java.time.Clock; @@ -53,50 +53,50 @@ import java.util.concurrent.atomic.AtomicInteger; import java.util.function.Function; -import org.elasticsearch.ElasticsearchTimeoutException; -import org.elasticsearch.action.ActionListener; -import org.elasticsearch.action.ActionRequestValidationException; -import org.elasticsearch.action.get.GetRequest; -import org.elasticsearch.action.get.GetResponse; -import org.elasticsearch.action.index.IndexRequest; -import org.elasticsearch.action.index.IndexResponse; -import org.elasticsearch.action.support.ActionFilters; -import org.elasticsearch.action.support.PlainActionFuture; -import org.elasticsearch.client.Client; -import org.elasticsearch.cluster.ClusterName; -import org.elasticsearch.cluster.ClusterState; -import org.elasticsearch.cluster.block.ClusterBlocks; -import org.elasticsearch.cluster.metadata.IndexMetadata; -import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver; -import org.elasticsearch.cluster.node.DiscoveryNode; -import org.elasticsearch.cluster.service.ClusterService; -import org.elasticsearch.common.Strings; -import org.elasticsearch.common.io.stream.BytesStreamOutput; -import org.elasticsearch.common.io.stream.NotSerializableExceptionWrapper; -import org.elasticsearch.common.io.stream.StreamInput; -import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.common.util.concurrent.ThreadContext; -import org.elasticsearch.common.xcontent.ToXContent; -import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.index.Index; -import org.elasticsearch.index.IndexNotFoundException; -import org.elasticsearch.index.shard.ShardId; -import org.elasticsearch.threadpool.ThreadPool; -import org.elasticsearch.transport.NodeNotConnectedException; -import org.elasticsearch.transport.RemoteTransportException; -import org.elasticsearch.transport.Transport; -import org.elasticsearch.transport.TransportException; -import org.elasticsearch.transport.TransportInterceptor; -import org.elasticsearch.transport.TransportRequest; -import org.elasticsearch.transport.TransportRequestOptions; -import org.elasticsearch.transport.TransportResponse; -import org.elasticsearch.transport.TransportResponseHandler; -import org.elasticsearch.transport.TransportService; import org.junit.After; import org.junit.AfterClass; import org.junit.Assert; import org.junit.Before; import org.junit.BeforeClass; +import org.opensearch.OpenSearchTimeoutException; +import org.opensearch.action.ActionListener; +import org.opensearch.action.ActionRequestValidationException; +import org.opensearch.action.get.GetRequest; +import org.opensearch.action.get.GetResponse; +import org.opensearch.action.index.IndexRequest; +import org.opensearch.action.index.IndexResponse; +import org.opensearch.action.support.ActionFilters; +import org.opensearch.action.support.PlainActionFuture; +import org.opensearch.client.Client; +import org.opensearch.cluster.ClusterName; +import org.opensearch.cluster.ClusterState; +import org.opensearch.cluster.block.ClusterBlocks; +import org.opensearch.cluster.metadata.IndexMetadata; +import org.opensearch.cluster.metadata.IndexNameExpressionResolver; +import org.opensearch.cluster.node.DiscoveryNode; +import org.opensearch.cluster.service.ClusterService; +import org.opensearch.common.Strings; +import org.opensearch.common.io.stream.BytesStreamOutput; +import org.opensearch.common.io.stream.NotSerializableExceptionWrapper; +import org.opensearch.common.io.stream.StreamInput; +import org.opensearch.common.settings.Settings; +import org.opensearch.common.util.concurrent.ThreadContext; +import org.opensearch.common.xcontent.ToXContent; +import org.opensearch.common.xcontent.XContentBuilder; +import org.opensearch.index.Index; +import org.opensearch.index.IndexNotFoundException; +import org.opensearch.index.shard.ShardId; +import org.opensearch.threadpool.ThreadPool; +import org.opensearch.transport.NodeNotConnectedException; +import org.opensearch.transport.RemoteTransportException; +import org.opensearch.transport.Transport; +import org.opensearch.transport.TransportException; +import org.opensearch.transport.TransportInterceptor; +import org.opensearch.transport.TransportRequest; +import org.opensearch.transport.TransportRequestOptions; +import org.opensearch.transport.TransportResponse; +import org.opensearch.transport.TransportResponseHandler; +import org.opensearch.transport.TransportService; import test.com.amazon.opendistroforelasticsearch.ad.util.JsonDeserializer; @@ -1142,7 +1142,7 @@ public void testColdStartTimeoutPutCheckpoint() throws Exception { doAnswer(invocation -> { ActionListener> listener = invocation.getArgument(2); - listener.onFailure(new ElasticsearchTimeoutException("")); + listener.onFailure(new OpenSearchTimeoutException("")); return null; }).when(normalModelManager).trainModel(any(AnomalyDetector.class), any(double[][].class), any(ActionListener.class)); diff --git a/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/AnomalyResultTransportActionTests.java b/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/AnomalyResultTransportActionTests.java index 77bca8597..50763f600 100644 --- a/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/AnomalyResultTransportActionTests.java +++ b/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/AnomalyResultTransportActionTests.java @@ -23,11 +23,11 @@ import java.util.List; import java.util.Map; -import org.elasticsearch.action.get.GetResponse; -import org.elasticsearch.common.io.stream.NotSerializableExceptionWrapper; -import org.elasticsearch.search.aggregations.AggregationBuilder; -import org.elasticsearch.test.rest.ESRestTestCase; import org.junit.Before; +import org.opensearch.action.get.GetResponse; +import org.opensearch.common.io.stream.NotSerializableExceptionWrapper; +import org.opensearch.search.aggregations.AggregationBuilder; +import org.opensearch.test.rest.OpenSearchRestTestCase; import com.amazon.opendistroforelasticsearch.ad.ADIntegTestCase; import com.amazon.opendistroforelasticsearch.ad.TestHelpers; @@ -210,8 +210,8 @@ private AnomalyDetector randomDetector(List indices, List featu indices, features, randomQuery("{\"bool\":{\"filter\":[{\"exists\":{\"field\":\"value\"}}]}}"), - new IntervalTimeConfiguration(ESRestTestCase.randomLongBetween(1, 5), ChronoUnit.MINUTES), - new IntervalTimeConfiguration(ESRestTestCase.randomLongBetween(1, 5), ChronoUnit.MINUTES), + new IntervalTimeConfiguration(OpenSearchRestTestCase.randomLongBetween(1, 5), ChronoUnit.MINUTES), + new IntervalTimeConfiguration(OpenSearchRestTestCase.randomLongBetween(1, 5), ChronoUnit.MINUTES), 8, null, randomInt(), @@ -231,8 +231,8 @@ private AnomalyDetector randomHCDetector(List indices, List fea indices, features, randomQuery("{\"bool\":{\"filter\":[{\"exists\":{\"field\":\"value\"}}]}}"), - new IntervalTimeConfiguration(ESRestTestCase.randomLongBetween(1, 5), ChronoUnit.MINUTES), - new IntervalTimeConfiguration(ESRestTestCase.randomLongBetween(1, 5), ChronoUnit.MINUTES), + new IntervalTimeConfiguration(OpenSearchRestTestCase.randomLongBetween(1, 5), ChronoUnit.MINUTES), + new IntervalTimeConfiguration(OpenSearchRestTestCase.randomLongBetween(1, 5), ChronoUnit.MINUTES), 8, null, randomInt(), diff --git a/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/CronTransportActionTests.java b/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/CronTransportActionTests.java index 77690aae7..081a0138c 100644 --- a/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/CronTransportActionTests.java +++ b/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/CronTransportActionTests.java @@ -23,21 +23,21 @@ import java.util.Collections; import java.util.function.Function; -import org.elasticsearch.Version; -import org.elasticsearch.action.support.ActionFilters; -import org.elasticsearch.cluster.ClusterName; -import org.elasticsearch.cluster.node.DiscoveryNode; -import org.elasticsearch.cluster.service.ClusterService; -import org.elasticsearch.common.Strings; -import org.elasticsearch.common.io.stream.BytesStreamOutput; -import org.elasticsearch.common.io.stream.StreamInput; -import org.elasticsearch.common.xcontent.ToXContent; -import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentFactory; -import org.elasticsearch.threadpool.ThreadPool; -import org.elasticsearch.transport.TransportService; import org.junit.Assert; import org.junit.Before; +import org.opensearch.Version; +import org.opensearch.action.support.ActionFilters; +import org.opensearch.cluster.ClusterName; +import org.opensearch.cluster.node.DiscoveryNode; +import org.opensearch.cluster.service.ClusterService; +import org.opensearch.common.Strings; +import org.opensearch.common.io.stream.BytesStreamOutput; +import org.opensearch.common.io.stream.StreamInput; +import org.opensearch.common.xcontent.ToXContent; +import org.opensearch.common.xcontent.XContentBuilder; +import org.opensearch.common.xcontent.XContentFactory; +import org.opensearch.threadpool.ThreadPool; +import org.opensearch.transport.TransportService; import test.com.amazon.opendistroforelasticsearch.ad.util.JsonDeserializer; diff --git a/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/DeleteAnomalyDetectorActionTests.java b/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/DeleteAnomalyDetectorActionTests.java index df7a6d975..d646e687d 100644 --- a/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/DeleteAnomalyDetectorActionTests.java +++ b/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/DeleteAnomalyDetectorActionTests.java @@ -23,26 +23,26 @@ import java.util.Collections; import java.util.HashSet; -import org.elasticsearch.action.ActionListener; -import org.elasticsearch.action.ActionRequestValidationException; -import org.elasticsearch.action.delete.DeleteResponse; -import org.elasticsearch.action.support.ActionFilters; -import org.elasticsearch.cluster.service.ClusterService; -import org.elasticsearch.common.io.stream.BytesStreamOutput; -import org.elasticsearch.common.io.stream.StreamInput; -import org.elasticsearch.common.settings.ClusterSettings; -import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.tasks.Task; -import org.elasticsearch.test.ESIntegTestCase; -import org.elasticsearch.transport.TransportService; import org.junit.Assert; import org.junit.Before; import org.junit.Test; +import org.opensearch.action.ActionListener; +import org.opensearch.action.ActionRequestValidationException; +import org.opensearch.action.delete.DeleteResponse; +import org.opensearch.action.support.ActionFilters; +import org.opensearch.cluster.service.ClusterService; +import org.opensearch.common.io.stream.BytesStreamOutput; +import org.opensearch.common.io.stream.StreamInput; +import org.opensearch.common.settings.ClusterSettings; +import org.opensearch.common.settings.Settings; +import org.opensearch.tasks.Task; +import org.opensearch.test.OpenSearchIntegTestCase; +import org.opensearch.transport.TransportService; import com.amazon.opendistroforelasticsearch.ad.settings.AnomalyDetectorSettings; import com.amazon.opendistroforelasticsearch.ad.task.ADTaskManager; -public class DeleteAnomalyDetectorActionTests extends ESIntegTestCase { +public class DeleteAnomalyDetectorActionTests extends OpenSearchIntegTestCase { private DeleteAnomalyDetectorTransportAction action; private ActionListener response; private ADTaskManager adTaskManager; diff --git a/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/DeleteAnomalyDetectorTransportActionTests.java b/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/DeleteAnomalyDetectorTransportActionTests.java index bbeba9347..61ec42838 100644 --- a/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/DeleteAnomalyDetectorTransportActionTests.java +++ b/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/DeleteAnomalyDetectorTransportActionTests.java @@ -19,9 +19,9 @@ import java.time.Instant; import java.time.temporal.ChronoUnit; -import org.elasticsearch.action.delete.DeleteResponse; -import org.elasticsearch.test.ESIntegTestCase; import org.junit.Before; +import org.opensearch.action.delete.DeleteResponse; +import org.opensearch.test.OpenSearchIntegTestCase; import com.amazon.opendistroforelasticsearch.ad.HistoricalDetectorIntegTestCase; import com.amazon.opendistroforelasticsearch.ad.TestHelpers; @@ -29,7 +29,7 @@ import com.amazon.opendistroforelasticsearch.ad.model.Feature; import com.google.common.collect.ImmutableList; -@ESIntegTestCase.ClusterScope(scope = ESIntegTestCase.Scope.TEST, numDataNodes = 2) +@OpenSearchIntegTestCase.ClusterScope(scope = OpenSearchIntegTestCase.Scope.TEST, numDataNodes = 2) public class DeleteAnomalyDetectorTransportActionTests extends HistoricalDetectorIntegTestCase { private Instant startTime; private Instant endTime; diff --git a/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/DeleteIT.java b/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/DeleteIT.java index cb6d14db7..b9cd5e68c 100644 --- a/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/DeleteIT.java +++ b/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/DeleteIT.java @@ -19,15 +19,15 @@ import java.util.Collections; import java.util.concurrent.ExecutionException; -import org.elasticsearch.action.ActionFuture; -import org.elasticsearch.action.ActionRequestValidationException; -import org.elasticsearch.plugins.Plugin; -import org.elasticsearch.test.ESIntegTestCase; +import org.opensearch.action.ActionFuture; +import org.opensearch.action.ActionRequestValidationException; +import org.opensearch.plugins.Plugin; +import org.opensearch.test.OpenSearchIntegTestCase; import com.amazon.opendistroforelasticsearch.ad.AnomalyDetectorPlugin; -@ESIntegTestCase.ClusterScope(transportClientRatio = 0.9) -public class DeleteIT extends ESIntegTestCase { +@OpenSearchIntegTestCase.ClusterScope(transportClientRatio = 0.9) +public class DeleteIT extends OpenSearchIntegTestCase { @Override protected Collection> nodePlugins() { diff --git a/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/DeleteModelTransportActionTests.java b/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/DeleteModelTransportActionTests.java index 614925a8d..4f27f62f1 100644 --- a/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/DeleteModelTransportActionTests.java +++ b/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/DeleteModelTransportActionTests.java @@ -25,23 +25,23 @@ import java.util.Collections; import java.util.function.Function; -import org.elasticsearch.Version; -import org.elasticsearch.action.ActionRequestValidationException; -import org.elasticsearch.action.support.ActionFilters; -import org.elasticsearch.cluster.ClusterName; -import org.elasticsearch.cluster.node.DiscoveryNode; -import org.elasticsearch.cluster.service.ClusterService; -import org.elasticsearch.common.Strings; -import org.elasticsearch.common.io.stream.BytesStreamOutput; -import org.elasticsearch.common.io.stream.StreamInput; -import org.elasticsearch.common.xcontent.ToXContent; -import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentFactory; -import org.elasticsearch.threadpool.ThreadPool; -import org.elasticsearch.transport.TransportService; import org.hamcrest.Matchers; import org.junit.Assert; import org.junit.Before; +import org.opensearch.Version; +import org.opensearch.action.ActionRequestValidationException; +import org.opensearch.action.support.ActionFilters; +import org.opensearch.cluster.ClusterName; +import org.opensearch.cluster.node.DiscoveryNode; +import org.opensearch.cluster.service.ClusterService; +import org.opensearch.common.Strings; +import org.opensearch.common.io.stream.BytesStreamOutput; +import org.opensearch.common.io.stream.StreamInput; +import org.opensearch.common.xcontent.ToXContent; +import org.opensearch.common.xcontent.XContentBuilder; +import org.opensearch.common.xcontent.XContentFactory; +import org.opensearch.threadpool.ThreadPool; +import org.opensearch.transport.TransportService; import test.com.amazon.opendistroforelasticsearch.ad.util.JsonDeserializer; diff --git a/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/DeleteTests.java b/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/DeleteTests.java index 622526278..946895637 100644 --- a/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/DeleteTests.java +++ b/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/DeleteTests.java @@ -17,7 +17,6 @@ import static java.util.Collections.emptyMap; import static java.util.Collections.emptySet; -import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.hasItem; import static org.hamcrest.Matchers.is; @@ -27,6 +26,7 @@ import static org.mockito.Mockito.eq; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; +import static org.opensearch.common.xcontent.XContentFactory.jsonBuilder; import java.io.IOException; import java.util.ArrayList; @@ -34,32 +34,32 @@ import java.util.List; import java.util.function.Supplier; -import org.elasticsearch.ElasticsearchException; -import org.elasticsearch.Version; -import org.elasticsearch.action.ActionListener; -import org.elasticsearch.action.ActionRequestValidationException; -import org.elasticsearch.action.FailedNodeException; -import org.elasticsearch.action.support.ActionFilters; -import org.elasticsearch.action.support.PlainActionFuture; -import org.elasticsearch.action.support.master.AcknowledgedResponse; -import org.elasticsearch.client.Client; -import org.elasticsearch.cluster.ClusterName; -import org.elasticsearch.cluster.node.DiscoveryNode; -import org.elasticsearch.cluster.service.ClusterService; -import org.elasticsearch.common.Strings; -import org.elasticsearch.common.io.stream.BytesStreamOutput; -import org.elasticsearch.common.io.stream.StreamInput; -import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.common.transport.TransportAddress; -import org.elasticsearch.common.unit.TimeValue; -import org.elasticsearch.common.xcontent.ToXContent; -import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.index.reindex.BulkByScrollResponse; -import org.elasticsearch.tasks.Task; -import org.elasticsearch.threadpool.ThreadPool; -import org.elasticsearch.transport.TransportService; import org.hamcrest.Matchers; import org.junit.Before; +import org.opensearch.OpenSearchException; +import org.opensearch.Version; +import org.opensearch.action.ActionListener; +import org.opensearch.action.ActionRequestValidationException; +import org.opensearch.action.FailedNodeException; +import org.opensearch.action.support.ActionFilters; +import org.opensearch.action.support.PlainActionFuture; +import org.opensearch.action.support.master.AcknowledgedResponse; +import org.opensearch.client.Client; +import org.opensearch.cluster.ClusterName; +import org.opensearch.cluster.node.DiscoveryNode; +import org.opensearch.cluster.service.ClusterService; +import org.opensearch.common.Strings; +import org.opensearch.common.io.stream.BytesStreamOutput; +import org.opensearch.common.io.stream.StreamInput; +import org.opensearch.common.settings.Settings; +import org.opensearch.common.transport.TransportAddress; +import org.opensearch.common.unit.TimeValue; +import org.opensearch.common.xcontent.ToXContent; +import org.opensearch.common.xcontent.XContentBuilder; +import org.opensearch.index.reindex.BulkByScrollResponse; +import org.opensearch.tasks.Task; +import org.opensearch.threadpool.ThreadPool; +import org.opensearch.transport.TransportService; import test.com.amazon.opendistroforelasticsearch.ad.util.ClusterCreation; import test.com.amazon.opendistroforelasticsearch.ad.util.JsonDeserializer; @@ -119,7 +119,7 @@ public void setUp() throws Exception { deleteModelResponse.add(nodeResponse2); failures = new ArrayList<>(); - failures.add(new FailedNodeException("node3", "blah", new ElasticsearchException("foo"))); + failures.add(new FailedNodeException("node3", "blah", new OpenSearchException("foo"))); response = new DeleteModelResponse(new ClusterName("Cluster"), deleteModelResponse, failures); @@ -228,7 +228,7 @@ public void StopDetectorResponseTemplate(DetectorExecutionMode mode) throws Exce assertTrue(listener != null); if (mode == DetectorExecutionMode.DELETE_MODEL_FAILURE) { - listener.onFailure(new ElasticsearchException("")); + listener.onFailure(new OpenSearchException("")); } else { listener.onResponse(response); } diff --git a/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/EntityProfileTests.java b/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/EntityProfileTests.java index 478ba69fa..271575ee8 100644 --- a/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/EntityProfileTests.java +++ b/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/EntityProfileTests.java @@ -29,28 +29,28 @@ import java.util.Optional; import java.util.Set; -import org.elasticsearch.Version; -import org.elasticsearch.action.support.ActionFilters; -import org.elasticsearch.action.support.PlainActionFuture; -import org.elasticsearch.cluster.node.DiscoveryNode; -import org.elasticsearch.cluster.service.ClusterService; -import org.elasticsearch.common.io.stream.BytesStreamOutput; -import org.elasticsearch.common.io.stream.StreamInput; -import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.common.transport.TransportAddress; -import org.elasticsearch.common.xcontent.ToXContent; -import org.elasticsearch.tasks.Task; -import org.elasticsearch.transport.ConnectTransportException; -import org.elasticsearch.transport.Transport; -import org.elasticsearch.transport.TransportException; -import org.elasticsearch.transport.TransportInterceptor; -import org.elasticsearch.transport.TransportRequest; -import org.elasticsearch.transport.TransportRequestOptions; -import org.elasticsearch.transport.TransportResponse; -import org.elasticsearch.transport.TransportResponseHandler; -import org.elasticsearch.transport.TransportService; import org.junit.AfterClass; import org.junit.BeforeClass; +import org.opensearch.Version; +import org.opensearch.action.support.ActionFilters; +import org.opensearch.action.support.PlainActionFuture; +import org.opensearch.cluster.node.DiscoveryNode; +import org.opensearch.cluster.service.ClusterService; +import org.opensearch.common.io.stream.BytesStreamOutput; +import org.opensearch.common.io.stream.StreamInput; +import org.opensearch.common.settings.Settings; +import org.opensearch.common.transport.TransportAddress; +import org.opensearch.common.xcontent.ToXContent; +import org.opensearch.tasks.Task; +import org.opensearch.transport.ConnectTransportException; +import org.opensearch.transport.Transport; +import org.opensearch.transport.TransportException; +import org.opensearch.transport.TransportInterceptor; +import org.opensearch.transport.TransportRequest; +import org.opensearch.transport.TransportRequestOptions; +import org.opensearch.transport.TransportResponse; +import org.opensearch.transport.TransportResponseHandler; +import org.opensearch.transport.TransportService; import test.com.amazon.opendistroforelasticsearch.ad.util.FakeNode; import test.com.amazon.opendistroforelasticsearch.ad.util.JsonDeserializer; diff --git a/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/EntityResultTransportActionTests.java b/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/EntityResultTransportActionTests.java index cd0f1c733..c9129e117 100644 --- a/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/EntityResultTransportActionTests.java +++ b/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/EntityResultTransportActionTests.java @@ -15,7 +15,6 @@ package com.amazon.opendistroforelasticsearch.ad.transport; -import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.hasItem; import static org.hamcrest.Matchers.startsWith; @@ -28,6 +27,7 @@ import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; +import static org.opensearch.common.xcontent.XContentFactory.jsonBuilder; import java.io.IOException; import java.time.Clock; @@ -37,20 +37,20 @@ import java.util.Map; import java.util.Optional; -import org.elasticsearch.action.ActionListener; -import org.elasticsearch.action.ActionRequestValidationException; -import org.elasticsearch.action.support.ActionFilters; -import org.elasticsearch.action.support.PlainActionFuture; -import org.elasticsearch.action.support.master.AcknowledgedResponse; -import org.elasticsearch.common.Strings; -import org.elasticsearch.common.io.stream.BytesStreamOutput; -import org.elasticsearch.common.io.stream.StreamInput; -import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.common.unit.TimeValue; -import org.elasticsearch.common.xcontent.ToXContent; -import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.transport.TransportService; import org.junit.Before; +import org.opensearch.action.ActionListener; +import org.opensearch.action.ActionRequestValidationException; +import org.opensearch.action.support.ActionFilters; +import org.opensearch.action.support.PlainActionFuture; +import org.opensearch.action.support.master.AcknowledgedResponse; +import org.opensearch.common.Strings; +import org.opensearch.common.io.stream.BytesStreamOutput; +import org.opensearch.common.io.stream.StreamInput; +import org.opensearch.common.settings.Settings; +import org.opensearch.common.unit.TimeValue; +import org.opensearch.common.xcontent.ToXContent; +import org.opensearch.common.xcontent.XContentBuilder; +import org.opensearch.transport.TransportService; import test.com.amazon.opendistroforelasticsearch.ad.util.JsonDeserializer; diff --git a/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/ForwardADTaskTests.java b/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/ForwardADTaskTests.java index cc63b3dad..6a9d04c5b 100644 --- a/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/ForwardADTaskTests.java +++ b/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/ForwardADTaskTests.java @@ -19,13 +19,13 @@ import java.time.Instant; import java.util.Collection; -import org.elasticsearch.action.ActionRequestValidationException; -import org.elasticsearch.common.io.stream.BytesStreamOutput; -import org.elasticsearch.common.io.stream.NamedWriteableAwareStreamInput; -import org.elasticsearch.common.io.stream.NamedWriteableRegistry; -import org.elasticsearch.plugins.Plugin; -import org.elasticsearch.test.ESSingleNodeTestCase; -import org.elasticsearch.test.InternalSettingsPlugin; +import org.opensearch.action.ActionRequestValidationException; +import org.opensearch.common.io.stream.BytesStreamOutput; +import org.opensearch.common.io.stream.NamedWriteableAwareStreamInput; +import org.opensearch.common.io.stream.NamedWriteableRegistry; +import org.opensearch.plugins.Plugin; +import org.opensearch.test.InternalSettingsPlugin; +import org.opensearch.test.OpenSearchSingleNodeTestCase; import com.amazon.opendistroforelasticsearch.ad.AnomalyDetectorPlugin; import com.amazon.opendistroforelasticsearch.ad.TestHelpers; @@ -33,7 +33,7 @@ import com.amazon.opendistroforelasticsearch.ad.model.ADTaskAction; import com.google.common.collect.ImmutableMap; -public class ForwardADTaskTests extends ESSingleNodeTestCase { +public class ForwardADTaskTests extends OpenSearchSingleNodeTestCase { @Override protected Collection> getPlugins() { diff --git a/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/GetAnomalyDetectorActionTests.java b/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/GetAnomalyDetectorActionTests.java index 7e6cefc10..b260ce538 100644 --- a/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/GetAnomalyDetectorActionTests.java +++ b/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/GetAnomalyDetectorActionTests.java @@ -17,14 +17,14 @@ import java.io.IOException; -import org.elasticsearch.common.io.stream.BytesStreamOutput; -import org.elasticsearch.common.io.stream.StreamInput; -import org.elasticsearch.rest.RestStatus; import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mockito; +import org.opensearch.common.io.stream.BytesStreamOutput; +import org.opensearch.common.io.stream.StreamInput; +import org.opensearch.rest.RestStatus; import org.powermock.api.mockito.PowerMockito; import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; diff --git a/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/GetAnomalyDetectorTests.java b/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/GetAnomalyDetectorTests.java index b88ffd6eb..56997a446 100644 --- a/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/GetAnomalyDetectorTests.java +++ b/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/GetAnomalyDetectorTests.java @@ -27,19 +27,19 @@ import java.util.Collections; import java.util.HashSet; -import org.elasticsearch.action.ActionListener; -import org.elasticsearch.action.get.GetRequest; -import org.elasticsearch.action.get.GetResponse; -import org.elasticsearch.action.support.ActionFilters; -import org.elasticsearch.action.support.PlainActionFuture; -import org.elasticsearch.client.Client; -import org.elasticsearch.cluster.service.ClusterService; -import org.elasticsearch.common.settings.ClusterSettings; -import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.transport.Transport; -import org.elasticsearch.transport.TransportService; import org.junit.AfterClass; import org.junit.BeforeClass; +import org.opensearch.action.ActionListener; +import org.opensearch.action.get.GetRequest; +import org.opensearch.action.get.GetResponse; +import org.opensearch.action.support.ActionFilters; +import org.opensearch.action.support.PlainActionFuture; +import org.opensearch.client.Client; +import org.opensearch.cluster.service.ClusterService; +import org.opensearch.common.settings.ClusterSettings; +import org.opensearch.common.settings.Settings; +import org.opensearch.transport.Transport; +import org.opensearch.transport.TransportService; import com.amazon.opendistroforelasticsearch.ad.AbstractADTest; import com.amazon.opendistroforelasticsearch.ad.constant.CommonErrorMessages; diff --git a/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/GetAnomalyDetectorTransportActionTests.java b/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/GetAnomalyDetectorTransportActionTests.java index 2fa4f0a3e..f84117480 100644 --- a/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/GetAnomalyDetectorTransportActionTests.java +++ b/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/GetAnomalyDetectorTransportActionTests.java @@ -25,25 +25,25 @@ import java.util.HashSet; import java.util.Map; -import org.elasticsearch.action.ActionListener; -import org.elasticsearch.action.support.ActionFilters; -import org.elasticsearch.cluster.service.ClusterService; -import org.elasticsearch.common.io.stream.BytesStreamOutput; -import org.elasticsearch.common.io.stream.NamedWriteableAwareStreamInput; -import org.elasticsearch.common.io.stream.NamedWriteableRegistry; -import org.elasticsearch.common.io.stream.StreamInput; -import org.elasticsearch.common.settings.ClusterSettings; -import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.common.xcontent.ToXContent; -import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.rest.RestStatus; -import org.elasticsearch.tasks.Task; -import org.elasticsearch.test.ESSingleNodeTestCase; -import org.elasticsearch.transport.TransportService; import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.mockito.Mockito; +import org.opensearch.action.ActionListener; +import org.opensearch.action.support.ActionFilters; +import org.opensearch.cluster.service.ClusterService; +import org.opensearch.common.io.stream.BytesStreamOutput; +import org.opensearch.common.io.stream.NamedWriteableAwareStreamInput; +import org.opensearch.common.io.stream.NamedWriteableRegistry; +import org.opensearch.common.io.stream.StreamInput; +import org.opensearch.common.settings.ClusterSettings; +import org.opensearch.common.settings.Settings; +import org.opensearch.common.xcontent.ToXContent; +import org.opensearch.common.xcontent.XContentBuilder; +import org.opensearch.rest.RestStatus; +import org.opensearch.tasks.Task; +import org.opensearch.test.OpenSearchSingleNodeTestCase; +import org.opensearch.transport.TransportService; import com.amazon.opendistroforelasticsearch.ad.TestHelpers; import com.amazon.opendistroforelasticsearch.ad.model.ADTask; @@ -56,7 +56,7 @@ import com.amazon.opendistroforelasticsearch.ad.util.RestHandlerUtils; import com.google.common.collect.ImmutableMap; -public class GetAnomalyDetectorTransportActionTests extends ESSingleNodeTestCase { +public class GetAnomalyDetectorTransportActionTests extends OpenSearchSingleNodeTestCase { private GetAnomalyDetectorTransportAction action; private Task task; private ActionListener response; diff --git a/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/IndexAnomalyDetectorActionTests.java b/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/IndexAnomalyDetectorActionTests.java index dacf1c662..871fe4c2e 100644 --- a/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/IndexAnomalyDetectorActionTests.java +++ b/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/IndexAnomalyDetectorActionTests.java @@ -18,26 +18,26 @@ import java.time.Instant; import java.util.Map; -import org.elasticsearch.action.support.WriteRequest; -import org.elasticsearch.common.io.stream.BytesStreamOutput; -import org.elasticsearch.common.io.stream.NamedWriteableAwareStreamInput; -import org.elasticsearch.common.io.stream.NamedWriteableRegistry; -import org.elasticsearch.common.unit.TimeValue; -import org.elasticsearch.common.xcontent.ToXContent; -import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestStatus; -import org.elasticsearch.test.ESSingleNodeTestCase; import org.junit.Assert; import org.junit.Before; import org.junit.Test; +import org.opensearch.action.support.WriteRequest; +import org.opensearch.common.io.stream.BytesStreamOutput; +import org.opensearch.common.io.stream.NamedWriteableAwareStreamInput; +import org.opensearch.common.io.stream.NamedWriteableRegistry; +import org.opensearch.common.unit.TimeValue; +import org.opensearch.common.xcontent.ToXContent; +import org.opensearch.common.xcontent.XContentBuilder; +import org.opensearch.rest.RestRequest; +import org.opensearch.rest.RestStatus; +import org.opensearch.test.OpenSearchSingleNodeTestCase; import com.amazon.opendistroforelasticsearch.ad.TestHelpers; import com.amazon.opendistroforelasticsearch.ad.model.AnomalyDetector; import com.amazon.opendistroforelasticsearch.ad.util.RestHandlerUtils; import com.google.common.collect.ImmutableMap; -public class IndexAnomalyDetectorActionTests extends ESSingleNodeTestCase { +public class IndexAnomalyDetectorActionTests extends OpenSearchSingleNodeTestCase { @Before public void setUp() throws Exception { super.setUp(); diff --git a/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/IndexAnomalyDetectorTransportActionTests.java b/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/IndexAnomalyDetectorTransportActionTests.java index e3d882806..10f696edb 100644 --- a/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/IndexAnomalyDetectorTransportActionTests.java +++ b/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/IndexAnomalyDetectorTransportActionTests.java @@ -22,23 +22,23 @@ import java.util.Collections; import java.util.HashSet; -import org.elasticsearch.action.ActionListener; -import org.elasticsearch.action.support.ActionFilters; -import org.elasticsearch.action.support.WriteRequest; -import org.elasticsearch.client.Client; -import org.elasticsearch.cluster.service.ClusterService; -import org.elasticsearch.common.settings.ClusterSettings; -import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.common.unit.TimeValue; -import org.elasticsearch.common.util.concurrent.ThreadContext; -import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.tasks.Task; -import org.elasticsearch.test.ESIntegTestCase; -import org.elasticsearch.threadpool.ThreadPool; -import org.elasticsearch.transport.TransportService; import org.junit.Assert; import org.junit.Before; import org.junit.Test; +import org.opensearch.action.ActionListener; +import org.opensearch.action.support.ActionFilters; +import org.opensearch.action.support.WriteRequest; +import org.opensearch.client.Client; +import org.opensearch.cluster.service.ClusterService; +import org.opensearch.common.settings.ClusterSettings; +import org.opensearch.common.settings.Settings; +import org.opensearch.common.unit.TimeValue; +import org.opensearch.common.util.concurrent.ThreadContext; +import org.opensearch.rest.RestRequest; +import org.opensearch.tasks.Task; +import org.opensearch.test.OpenSearchIntegTestCase; +import org.opensearch.threadpool.ThreadPool; +import org.opensearch.transport.TransportService; import com.amazon.opendistroforelasticsearch.ad.indices.AnomalyDetectionIndices; import com.amazon.opendistroforelasticsearch.ad.model.AnomalyDetector; @@ -46,7 +46,7 @@ import com.amazon.opendistroforelasticsearch.ad.task.ADTaskManager; import com.amazon.opendistroforelasticsearch.commons.ConfigConstants; -public class IndexAnomalyDetectorTransportActionTests extends ESIntegTestCase { +public class IndexAnomalyDetectorTransportActionTests extends OpenSearchIntegTestCase { private IndexAnomalyDetectorTransportAction action; private Task task; private IndexAnomalyDetectorRequest request; @@ -116,7 +116,7 @@ public void testIndexTransportActionWithUserAndFilterOn() { threadContext.putTransient(ConfigConstants.OPENDISTRO_SECURITY_USER_INFO_THREAD_CONTEXT, "alice|odfe,aes|engineering,operations"); when(clusterService.getClusterSettings()).thenReturn(clusterSettings); Client client = mock(Client.class); - org.elasticsearch.threadpool.ThreadPool mockThreadPool = mock(ThreadPool.class); + org.opensearch.threadpool.ThreadPool mockThreadPool = mock(ThreadPool.class); when(client.threadPool()).thenReturn(mockThreadPool); when(mockThreadPool.getThreadContext()).thenReturn(threadContext); @@ -140,7 +140,7 @@ public void testIndexTransportActionWithUserAndFilterOff() { threadContext.putTransient(ConfigConstants.OPENDISTRO_SECURITY_USER_INFO_THREAD_CONTEXT, "alice|odfe,aes|engineering,operations"); when(clusterService.getClusterSettings()).thenReturn(clusterSettings); Client client = mock(Client.class); - org.elasticsearch.threadpool.ThreadPool mockThreadPool = mock(ThreadPool.class); + org.opensearch.threadpool.ThreadPool mockThreadPool = mock(ThreadPool.class); when(client.threadPool()).thenReturn(mockThreadPool); when(mockThreadPool.getThreadContext()).thenReturn(threadContext); diff --git a/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/MultientityResultTests.java b/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/MultientityResultTests.java index c616771db..8d3f69d70 100644 --- a/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/MultientityResultTests.java +++ b/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/MultientityResultTests.java @@ -34,31 +34,31 @@ import java.util.Optional; import java.util.function.Function; -import org.elasticsearch.action.ActionListener; -import org.elasticsearch.action.support.ActionFilters; -import org.elasticsearch.action.support.PlainActionFuture; -import org.elasticsearch.action.support.master.AcknowledgedResponse; -import org.elasticsearch.client.Client; -import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver; -import org.elasticsearch.cluster.service.ClusterService; -import org.elasticsearch.common.io.stream.StreamInput; -import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.common.unit.TimeValue; -import org.elasticsearch.common.util.concurrent.ThreadContext; -import org.elasticsearch.index.IndexNotFoundException; -import org.elasticsearch.threadpool.ThreadPool; -import org.elasticsearch.transport.Transport; -import org.elasticsearch.transport.TransportException; -import org.elasticsearch.transport.TransportInterceptor; -import org.elasticsearch.transport.TransportRequest; -import org.elasticsearch.transport.TransportRequestOptions; -import org.elasticsearch.transport.TransportResponse; -import org.elasticsearch.transport.TransportResponseHandler; -import org.elasticsearch.transport.TransportService; import org.junit.After; import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; +import org.opensearch.action.ActionListener; +import org.opensearch.action.support.ActionFilters; +import org.opensearch.action.support.PlainActionFuture; +import org.opensearch.action.support.master.AcknowledgedResponse; +import org.opensearch.client.Client; +import org.opensearch.cluster.metadata.IndexNameExpressionResolver; +import org.opensearch.cluster.service.ClusterService; +import org.opensearch.common.io.stream.StreamInput; +import org.opensearch.common.settings.Settings; +import org.opensearch.common.unit.TimeValue; +import org.opensearch.common.util.concurrent.ThreadContext; +import org.opensearch.index.IndexNotFoundException; +import org.opensearch.threadpool.ThreadPool; +import org.opensearch.transport.Transport; +import org.opensearch.transport.TransportException; +import org.opensearch.transport.TransportInterceptor; +import org.opensearch.transport.TransportRequest; +import org.opensearch.transport.TransportRequestOptions; +import org.opensearch.transport.TransportResponse; +import org.opensearch.transport.TransportResponseHandler; +import org.opensearch.transport.TransportService; import test.com.amazon.opendistroforelasticsearch.ad.util.MLUtil; diff --git a/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/PreviewAnomalyDetectorActionTests.java b/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/PreviewAnomalyDetectorActionTests.java index cb57a0c7c..cf63ef843 100644 --- a/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/PreviewAnomalyDetectorActionTests.java +++ b/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/PreviewAnomalyDetectorActionTests.java @@ -17,13 +17,13 @@ import java.time.Instant; -import org.elasticsearch.common.io.stream.BytesStreamOutput; -import org.elasticsearch.common.io.stream.NamedWriteableAwareStreamInput; -import org.elasticsearch.common.io.stream.NamedWriteableRegistry; -import org.elasticsearch.common.xcontent.ToXContent; -import org.elasticsearch.test.ESSingleNodeTestCase; import org.junit.Assert; import org.junit.Test; +import org.opensearch.common.io.stream.BytesStreamOutput; +import org.opensearch.common.io.stream.NamedWriteableAwareStreamInput; +import org.opensearch.common.io.stream.NamedWriteableRegistry; +import org.opensearch.common.xcontent.ToXContent; +import org.opensearch.test.OpenSearchSingleNodeTestCase; import com.amazon.opendistroforelasticsearch.ad.TestHelpers; import com.amazon.opendistroforelasticsearch.ad.model.AnomalyDetector; @@ -31,7 +31,7 @@ import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; -public class PreviewAnomalyDetectorActionTests extends ESSingleNodeTestCase { +public class PreviewAnomalyDetectorActionTests extends OpenSearchSingleNodeTestCase { @Override protected NamedWriteableRegistry writableRegistry() { diff --git a/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/PreviewAnomalyDetectorTransportActionTests.java b/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/PreviewAnomalyDetectorTransportActionTests.java index 1dd1c181c..a6f7e5581 100644 --- a/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/PreviewAnomalyDetectorTransportActionTests.java +++ b/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/PreviewAnomalyDetectorTransportActionTests.java @@ -33,29 +33,29 @@ import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; -import org.elasticsearch.action.ActionListener; -import org.elasticsearch.action.admin.indices.create.CreateIndexRequest; -import org.elasticsearch.action.admin.indices.create.CreateIndexResponse; -import org.elasticsearch.action.index.IndexRequest; -import org.elasticsearch.action.index.IndexResponse; -import org.elasticsearch.action.support.ActionFilters; -import org.elasticsearch.action.support.WriteRequest; -import org.elasticsearch.client.Client; -import org.elasticsearch.cluster.service.ClusterService; -import org.elasticsearch.common.settings.ClusterSettings; -import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.common.util.concurrent.ThreadContext; -import org.elasticsearch.common.xcontent.ToXContent; -import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentFactory; -import org.elasticsearch.rest.RestStatus; -import org.elasticsearch.tasks.Task; -import org.elasticsearch.test.ESSingleNodeTestCase; -import org.elasticsearch.threadpool.ThreadPool; -import org.elasticsearch.transport.TransportService; import org.junit.Assert; import org.junit.Before; import org.junit.Test; +import org.opensearch.action.ActionListener; +import org.opensearch.action.admin.indices.create.CreateIndexRequest; +import org.opensearch.action.admin.indices.create.CreateIndexResponse; +import org.opensearch.action.index.IndexRequest; +import org.opensearch.action.index.IndexResponse; +import org.opensearch.action.support.ActionFilters; +import org.opensearch.action.support.WriteRequest; +import org.opensearch.client.Client; +import org.opensearch.cluster.service.ClusterService; +import org.opensearch.common.settings.ClusterSettings; +import org.opensearch.common.settings.Settings; +import org.opensearch.common.util.concurrent.ThreadContext; +import org.opensearch.common.xcontent.ToXContent; +import org.opensearch.common.xcontent.XContentBuilder; +import org.opensearch.common.xcontent.XContentFactory; +import org.opensearch.rest.RestStatus; +import org.opensearch.tasks.Task; +import org.opensearch.test.OpenSearchSingleNodeTestCase; +import org.opensearch.threadpool.ThreadPool; +import org.opensearch.transport.TransportService; import com.amazon.opendistroforelasticsearch.ad.AnomalyDetectorRunner; import com.amazon.opendistroforelasticsearch.ad.TestHelpers; @@ -70,7 +70,7 @@ import com.amazon.opendistroforelasticsearch.commons.ConfigConstants; import com.google.common.collect.ImmutableMap; -public class PreviewAnomalyDetectorTransportActionTests extends ESSingleNodeTestCase { +public class PreviewAnomalyDetectorTransportActionTests extends OpenSearchSingleNodeTestCase { private ActionListener response; private PreviewAnomalyDetectorTransportAction action; private AnomalyDetectorRunner runner; @@ -256,7 +256,7 @@ public void testPreviewTransportActionNoContext() throws IOException, Interrupte Client client = mock(Client.class); ThreadContext threadContext = new ThreadContext(settings); threadContext.putTransient(ConfigConstants.OPENDISTRO_SECURITY_USER_INFO_THREAD_CONTEXT, "alice|odfe,aes|engineering,operations"); - org.elasticsearch.threadpool.ThreadPool mockThreadPool = mock(ThreadPool.class); + org.opensearch.threadpool.ThreadPool mockThreadPool = mock(ThreadPool.class); when(client.threadPool()).thenReturn(mockThreadPool); when(mockThreadPool.getThreadContext()).thenReturn(threadContext); PreviewAnomalyDetectorTransportAction previewAction = new PreviewAnomalyDetectorTransportAction( diff --git a/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/ProfileIT.java b/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/ProfileIT.java index 7a41b0439..21a234b96 100644 --- a/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/ProfileIT.java +++ b/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/ProfileIT.java @@ -20,14 +20,14 @@ import java.util.HashSet; import java.util.concurrent.ExecutionException; -import org.elasticsearch.plugins.Plugin; -import org.elasticsearch.test.ESIntegTestCase; +import org.opensearch.plugins.Plugin; +import org.opensearch.test.OpenSearchIntegTestCase; import com.amazon.opendistroforelasticsearch.ad.AnomalyDetectorPlugin; import com.amazon.opendistroforelasticsearch.ad.model.DetectorProfileName; -@ESIntegTestCase.ClusterScope(transportClientRatio = 0.9) -public class ProfileIT extends ESIntegTestCase { +@OpenSearchIntegTestCase.ClusterScope(transportClientRatio = 0.9) +public class ProfileIT extends OpenSearchIntegTestCase { @Override protected Collection> nodePlugins() { diff --git a/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/ProfileTests.java b/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/ProfileTests.java index e767a29c6..79c0809e3 100644 --- a/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/ProfileTests.java +++ b/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/ProfileTests.java @@ -17,7 +17,7 @@ import static java.util.Collections.emptyMap; import static java.util.Collections.emptySet; -import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder; +import static org.opensearch.common.xcontent.XContentFactory.jsonBuilder; import java.io.IOException; import java.util.Arrays; @@ -28,19 +28,19 @@ import java.util.Map; import java.util.Set; -import org.elasticsearch.Version; -import org.elasticsearch.action.FailedNodeException; -import org.elasticsearch.cluster.ClusterName; -import org.elasticsearch.cluster.node.DiscoveryNode; -import org.elasticsearch.common.Strings; -import org.elasticsearch.common.io.stream.BytesStreamOutput; -import org.elasticsearch.common.io.stream.StreamInput; -import org.elasticsearch.common.transport.TransportAddress; -import org.elasticsearch.common.xcontent.ToXContent; -import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.test.ESTestCase; import org.junit.Before; import org.junit.Test; +import org.opensearch.Version; +import org.opensearch.action.FailedNodeException; +import org.opensearch.cluster.ClusterName; +import org.opensearch.cluster.node.DiscoveryNode; +import org.opensearch.common.Strings; +import org.opensearch.common.io.stream.BytesStreamOutput; +import org.opensearch.common.io.stream.StreamInput; +import org.opensearch.common.transport.TransportAddress; +import org.opensearch.common.xcontent.ToXContent; +import org.opensearch.common.xcontent.XContentBuilder; +import org.opensearch.test.OpenSearchTestCase; import test.com.amazon.opendistroforelasticsearch.ad.util.JsonDeserializer; @@ -51,7 +51,7 @@ import com.google.gson.JsonArray; import com.google.gson.JsonElement; -public class ProfileTests extends ESTestCase { +public class ProfileTests extends OpenSearchTestCase { String node1, nodeName1, clusterName; String node2, nodeName2; Map clusterStats; diff --git a/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/ProfileTransportActionTests.java b/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/ProfileTransportActionTests.java index b011cdc45..74bbf3fa9 100644 --- a/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/ProfileTransportActionTests.java +++ b/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/ProfileTransportActionTests.java @@ -28,13 +28,13 @@ import java.util.Map; import java.util.Set; -import org.elasticsearch.action.FailedNodeException; -import org.elasticsearch.action.support.ActionFilters; -import org.elasticsearch.cluster.node.DiscoveryNode; -import org.elasticsearch.test.ESIntegTestCase; -import org.elasticsearch.transport.TransportService; import org.junit.Before; import org.junit.Test; +import org.opensearch.action.FailedNodeException; +import org.opensearch.action.support.ActionFilters; +import org.opensearch.cluster.node.DiscoveryNode; +import org.opensearch.test.OpenSearchIntegTestCase; +import org.opensearch.transport.TransportService; import com.amazon.opendistroforelasticsearch.ad.caching.CacheProvider; import com.amazon.opendistroforelasticsearch.ad.caching.EntityCache; @@ -42,7 +42,7 @@ import com.amazon.opendistroforelasticsearch.ad.ml.ModelManager; import com.amazon.opendistroforelasticsearch.ad.model.DetectorProfileName; -public class ProfileTransportActionTests extends ESIntegTestCase { +public class ProfileTransportActionTests extends OpenSearchIntegTestCase { private ProfileTransportAction action; private String detectorId = "Pl536HEBnXkDrah03glg"; String node1, nodeName1; diff --git a/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/RCFPollingTests.java b/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/RCFPollingTests.java index 1eeec696a..641678961 100644 --- a/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/RCFPollingTests.java +++ b/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/RCFPollingTests.java @@ -27,29 +27,29 @@ import java.util.Collections; import java.util.Optional; -import org.elasticsearch.Version; -import org.elasticsearch.action.ActionListener; -import org.elasticsearch.action.support.ActionFilters; -import org.elasticsearch.action.support.PlainActionFuture; -import org.elasticsearch.cluster.node.DiscoveryNode; -import org.elasticsearch.cluster.service.ClusterService; -import org.elasticsearch.common.io.stream.StreamInput; -import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.common.transport.TransportAddress; -import org.elasticsearch.common.xcontent.ToXContent; -import org.elasticsearch.tasks.Task; -import org.elasticsearch.transport.ConnectTransportException; -import org.elasticsearch.transport.Transport; -import org.elasticsearch.transport.TransportException; -import org.elasticsearch.transport.TransportInterceptor; -import org.elasticsearch.transport.TransportRequest; -import org.elasticsearch.transport.TransportRequestOptions; -import org.elasticsearch.transport.TransportResponse; -import org.elasticsearch.transport.TransportResponseHandler; -import org.elasticsearch.transport.TransportService; import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; +import org.opensearch.Version; +import org.opensearch.action.ActionListener; +import org.opensearch.action.support.ActionFilters; +import org.opensearch.action.support.PlainActionFuture; +import org.opensearch.cluster.node.DiscoveryNode; +import org.opensearch.cluster.service.ClusterService; +import org.opensearch.common.io.stream.StreamInput; +import org.opensearch.common.settings.Settings; +import org.opensearch.common.transport.TransportAddress; +import org.opensearch.common.xcontent.ToXContent; +import org.opensearch.tasks.Task; +import org.opensearch.transport.ConnectTransportException; +import org.opensearch.transport.Transport; +import org.opensearch.transport.TransportException; +import org.opensearch.transport.TransportInterceptor; +import org.opensearch.transport.TransportRequest; +import org.opensearch.transport.TransportRequestOptions; +import org.opensearch.transport.TransportResponse; +import org.opensearch.transport.TransportResponseHandler; +import org.opensearch.transport.TransportService; import test.com.amazon.opendistroforelasticsearch.ad.util.FakeNode; import test.com.amazon.opendistroforelasticsearch.ad.util.JsonDeserializer; diff --git a/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/RCFResultIT.java b/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/RCFResultIT.java index 8b972396c..635bddf9b 100644 --- a/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/RCFResultIT.java +++ b/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/RCFResultIT.java @@ -19,15 +19,15 @@ import java.util.Collections; import java.util.concurrent.ExecutionException; -import org.elasticsearch.action.ActionFuture; -import org.elasticsearch.action.ActionRequestValidationException; -import org.elasticsearch.plugins.Plugin; -import org.elasticsearch.test.ESIntegTestCase; +import org.opensearch.action.ActionFuture; +import org.opensearch.action.ActionRequestValidationException; +import org.opensearch.plugins.Plugin; +import org.opensearch.test.OpenSearchIntegTestCase; import com.amazon.opendistroforelasticsearch.ad.AnomalyDetectorPlugin; -@ESIntegTestCase.ClusterScope(transportClientRatio = 0.9) -public class RCFResultIT extends ESIntegTestCase { +@OpenSearchIntegTestCase.ClusterScope(transportClientRatio = 0.9) +public class RCFResultIT extends OpenSearchIntegTestCase { @Override protected Collection> nodePlugins() { diff --git a/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/RCFResultTests.java b/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/RCFResultTests.java index 5bc5e4b7a..6c1d1924e 100644 --- a/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/RCFResultTests.java +++ b/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/RCFResultTests.java @@ -15,7 +15,6 @@ package com.amazon.opendistroforelasticsearch.ad.transport; -import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.hasItem; import static org.mockito.ArgumentMatchers.any; @@ -23,26 +22,27 @@ import static org.mockito.Mockito.doThrow; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; +import static org.opensearch.common.xcontent.XContentFactory.jsonBuilder; import java.io.IOException; import java.util.Arrays; import java.util.Collections; -import org.elasticsearch.action.ActionListener; -import org.elasticsearch.action.ActionRequestValidationException; -import org.elasticsearch.action.support.ActionFilters; -import org.elasticsearch.action.support.PlainActionFuture; -import org.elasticsearch.common.Strings; -import org.elasticsearch.common.io.stream.BytesStreamOutput; -import org.elasticsearch.common.io.stream.StreamInput; -import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.common.xcontent.ToXContent; -import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.tasks.Task; -import org.elasticsearch.test.ESTestCase; -import org.elasticsearch.transport.Transport; -import org.elasticsearch.transport.TransportService; import org.hamcrest.Matchers; +import org.opensearch.action.ActionListener; +import org.opensearch.action.ActionRequestValidationException; +import org.opensearch.action.support.ActionFilters; +import org.opensearch.action.support.PlainActionFuture; +import org.opensearch.common.Strings; +import org.opensearch.common.io.stream.BytesStreamOutput; +import org.opensearch.common.io.stream.StreamInput; +import org.opensearch.common.settings.Settings; +import org.opensearch.common.xcontent.ToXContent; +import org.opensearch.common.xcontent.XContentBuilder; +import org.opensearch.tasks.Task; +import org.opensearch.test.OpenSearchTestCase; +import org.opensearch.transport.Transport; +import org.opensearch.transport.TransportService; import test.com.amazon.opendistroforelasticsearch.ad.util.JsonDeserializer; @@ -56,7 +56,7 @@ import com.google.gson.Gson; import com.google.gson.GsonBuilder; -public class RCFResultTests extends ESTestCase { +public class RCFResultTests extends OpenSearchTestCase { Gson gson = new GsonBuilder().create(); private double[] attribution = new double[] { 1. }; diff --git a/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/SearchADTasksActionTests.java b/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/SearchADTasksActionTests.java index f9994e624..d37c50a90 100644 --- a/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/SearchADTasksActionTests.java +++ b/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/SearchADTasksActionTests.java @@ -19,8 +19,8 @@ import java.io.IOException; -import org.elasticsearch.action.search.SearchResponse; import org.junit.Test; +import org.opensearch.action.search.SearchResponse; import com.amazon.opendistroforelasticsearch.ad.HistoricalDetectorIntegTestCase; import com.amazon.opendistroforelasticsearch.ad.TestHelpers; diff --git a/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/SearchADTasksTransportActionTests.java b/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/SearchADTasksTransportActionTests.java index 7ab4de262..1a0e7f939 100644 --- a/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/SearchADTasksTransportActionTests.java +++ b/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/SearchADTasksTransportActionTests.java @@ -22,21 +22,21 @@ import java.time.Instant; import java.time.temporal.ChronoUnit; -import org.elasticsearch.action.search.SearchRequest; -import org.elasticsearch.action.search.SearchResponse; -import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.index.IndexNotFoundException; -import org.elasticsearch.index.query.BoolQueryBuilder; -import org.elasticsearch.index.query.TermQueryBuilder; -import org.elasticsearch.search.builder.SearchSourceBuilder; -import org.elasticsearch.test.ESIntegTestCase; import org.junit.Before; +import org.opensearch.action.search.SearchRequest; +import org.opensearch.action.search.SearchResponse; +import org.opensearch.common.settings.Settings; +import org.opensearch.index.IndexNotFoundException; +import org.opensearch.index.query.BoolQueryBuilder; +import org.opensearch.index.query.TermQueryBuilder; +import org.opensearch.search.builder.SearchSourceBuilder; +import org.opensearch.test.OpenSearchIntegTestCase; import com.amazon.opendistroforelasticsearch.ad.HistoricalDetectorIntegTestCase; import com.amazon.opendistroforelasticsearch.ad.constant.CommonName; import com.amazon.opendistroforelasticsearch.ad.model.ADTask; -@ESIntegTestCase.ClusterScope(scope = ESIntegTestCase.Scope.TEST, numDataNodes = 2) +@OpenSearchIntegTestCase.ClusterScope(scope = OpenSearchIntegTestCase.Scope.TEST, numDataNodes = 2) public class SearchADTasksTransportActionTests extends HistoricalDetectorIntegTestCase { private Instant startTime; diff --git a/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/SearchAnomalyDetectorActionTests.java b/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/SearchAnomalyDetectorActionTests.java index 8eefcc10f..59fc080c1 100644 --- a/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/SearchAnomalyDetectorActionTests.java +++ b/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/SearchAnomalyDetectorActionTests.java @@ -21,12 +21,12 @@ import java.time.Instant; import java.time.temporal.ChronoUnit; -import org.elasticsearch.action.search.SearchRequest; -import org.elasticsearch.action.search.SearchResponse; -import org.elasticsearch.index.query.BoolQueryBuilder; -import org.elasticsearch.index.query.MatchAllQueryBuilder; -import org.elasticsearch.index.query.TermQueryBuilder; -import org.elasticsearch.search.builder.SearchSourceBuilder; +import org.opensearch.action.search.SearchRequest; +import org.opensearch.action.search.SearchResponse; +import org.opensearch.index.query.BoolQueryBuilder; +import org.opensearch.index.query.MatchAllQueryBuilder; +import org.opensearch.index.query.TermQueryBuilder; +import org.opensearch.search.builder.SearchSourceBuilder; import com.amazon.opendistroforelasticsearch.ad.HistoricalDetectorIntegTestCase; import com.amazon.opendistroforelasticsearch.ad.TestHelpers; diff --git a/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/SearchAnomalyDetectorInfoActionTests.java b/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/SearchAnomalyDetectorInfoActionTests.java index 21a85df23..ecbffa747 100644 --- a/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/SearchAnomalyDetectorInfoActionTests.java +++ b/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/SearchAnomalyDetectorInfoActionTests.java @@ -19,21 +19,21 @@ import java.io.IOException; -import org.elasticsearch.action.ActionListener; -import org.elasticsearch.action.support.ActionFilters; -import org.elasticsearch.common.io.stream.BytesStreamOutput; -import org.elasticsearch.common.io.stream.StreamInput; -import org.elasticsearch.common.xcontent.ToXContent; -import org.elasticsearch.tasks.Task; -import org.elasticsearch.test.ESIntegTestCase; -import org.elasticsearch.transport.TransportService; import org.junit.Assert; import org.junit.Before; import org.junit.Test; +import org.opensearch.action.ActionListener; +import org.opensearch.action.support.ActionFilters; +import org.opensearch.common.io.stream.BytesStreamOutput; +import org.opensearch.common.io.stream.StreamInput; +import org.opensearch.common.xcontent.ToXContent; +import org.opensearch.tasks.Task; +import org.opensearch.test.OpenSearchIntegTestCase; +import org.opensearch.transport.TransportService; import com.amazon.opendistroforelasticsearch.ad.TestHelpers; -public class SearchAnomalyDetectorInfoActionTests extends ESIntegTestCase { +public class SearchAnomalyDetectorInfoActionTests extends OpenSearchIntegTestCase { private SearchAnomalyDetectorInfoRequest request; private ActionListener response; private SearchAnomalyDetectorInfoTransportAction action; diff --git a/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/SearchAnomalyResultActionTests.java b/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/SearchAnomalyResultActionTests.java index 83994ea45..e6ba5dcce 100644 --- a/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/SearchAnomalyResultActionTests.java +++ b/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/SearchAnomalyResultActionTests.java @@ -19,8 +19,8 @@ import java.io.IOException; -import org.elasticsearch.action.search.SearchResponse; import org.junit.Test; +import org.opensearch.action.search.SearchResponse; import com.amazon.opendistroforelasticsearch.ad.HistoricalDetectorIntegTestCase; import com.amazon.opendistroforelasticsearch.ad.TestHelpers; diff --git a/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/StatsAnomalyDetectorActionTests.java b/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/StatsAnomalyDetectorActionTests.java index d043a7192..409e58bf6 100644 --- a/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/StatsAnomalyDetectorActionTests.java +++ b/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/StatsAnomalyDetectorActionTests.java @@ -21,22 +21,22 @@ import java.util.List; import java.util.Map; -import org.elasticsearch.action.FailedNodeException; -import org.elasticsearch.cluster.ClusterName; -import org.elasticsearch.common.io.stream.BytesStreamOutput; -import org.elasticsearch.common.io.stream.StreamInput; -import org.elasticsearch.common.xcontent.ToXContent; -import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentFactory; -import org.elasticsearch.common.xcontent.XContentParser; -import org.elasticsearch.test.ESTestCase; import org.junit.Assert; import org.junit.Before; import org.junit.Test; +import org.opensearch.action.FailedNodeException; +import org.opensearch.cluster.ClusterName; +import org.opensearch.common.io.stream.BytesStreamOutput; +import org.opensearch.common.io.stream.StreamInput; +import org.opensearch.common.xcontent.ToXContent; +import org.opensearch.common.xcontent.XContentBuilder; +import org.opensearch.common.xcontent.XContentFactory; +import org.opensearch.common.xcontent.XContentParser; +import org.opensearch.test.OpenSearchTestCase; import com.amazon.opendistroforelasticsearch.ad.stats.ADStatsResponse; -public class StatsAnomalyDetectorActionTests extends ESTestCase { +public class StatsAnomalyDetectorActionTests extends OpenSearchTestCase { @Override @Before diff --git a/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/StopDetectorActionTests.java b/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/StopDetectorActionTests.java index cd8ab923d..6d94ff464 100644 --- a/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/StopDetectorActionTests.java +++ b/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/StopDetectorActionTests.java @@ -15,12 +15,12 @@ package com.amazon.opendistroforelasticsearch.ad.transport; -import org.elasticsearch.test.ESIntegTestCase; import org.junit.Assert; import org.junit.Before; import org.junit.Test; +import org.opensearch.test.OpenSearchIntegTestCase; -public class StopDetectorActionTests extends ESIntegTestCase { +public class StopDetectorActionTests extends OpenSearchIntegTestCase { @Override @Before diff --git a/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/ThresholdResultIT.java b/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/ThresholdResultIT.java index b4f7142e9..314b265a1 100644 --- a/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/ThresholdResultIT.java +++ b/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/ThresholdResultIT.java @@ -19,15 +19,15 @@ import java.util.Collections; import java.util.concurrent.ExecutionException; -import org.elasticsearch.action.ActionFuture; -import org.elasticsearch.action.ActionRequestValidationException; -import org.elasticsearch.plugins.Plugin; -import org.elasticsearch.test.ESIntegTestCase; +import org.opensearch.action.ActionFuture; +import org.opensearch.action.ActionRequestValidationException; +import org.opensearch.plugins.Plugin; +import org.opensearch.test.OpenSearchIntegTestCase; import com.amazon.opendistroforelasticsearch.ad.AnomalyDetectorPlugin; -@ESIntegTestCase.ClusterScope(transportClientRatio = 0.9) -public class ThresholdResultIT extends ESIntegTestCase { +@OpenSearchIntegTestCase.ClusterScope(transportClientRatio = 0.9) +public class ThresholdResultIT extends OpenSearchIntegTestCase { @Override protected Collection> nodePlugins() { diff --git a/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/ThresholdResultTests.java b/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/ThresholdResultTests.java index 8ac7d2392..bb38581f1 100644 --- a/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/ThresholdResultTests.java +++ b/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/ThresholdResultTests.java @@ -15,32 +15,32 @@ package com.amazon.opendistroforelasticsearch.ad.transport; -import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder; import static org.hamcrest.Matchers.equalTo; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyDouble; import static org.mockito.Mockito.doAnswer; import static org.mockito.Mockito.doThrow; import static org.mockito.Mockito.mock; +import static org.opensearch.common.xcontent.XContentFactory.jsonBuilder; import java.io.IOException; import java.util.Collections; -import org.elasticsearch.action.ActionListener; -import org.elasticsearch.action.ActionRequestValidationException; -import org.elasticsearch.action.support.ActionFilters; -import org.elasticsearch.action.support.PlainActionFuture; -import org.elasticsearch.common.Strings; -import org.elasticsearch.common.io.stream.BytesStreamOutput; -import org.elasticsearch.common.io.stream.StreamInput; -import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.common.xcontent.ToXContent; -import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.tasks.Task; -import org.elasticsearch.test.ESTestCase; -import org.elasticsearch.transport.Transport; -import org.elasticsearch.transport.TransportService; import org.hamcrest.Matchers; +import org.opensearch.action.ActionListener; +import org.opensearch.action.ActionRequestValidationException; +import org.opensearch.action.support.ActionFilters; +import org.opensearch.action.support.PlainActionFuture; +import org.opensearch.common.Strings; +import org.opensearch.common.io.stream.BytesStreamOutput; +import org.opensearch.common.io.stream.StreamInput; +import org.opensearch.common.settings.Settings; +import org.opensearch.common.xcontent.ToXContent; +import org.opensearch.common.xcontent.XContentBuilder; +import org.opensearch.tasks.Task; +import org.opensearch.test.OpenSearchTestCase; +import org.opensearch.transport.Transport; +import org.opensearch.transport.TransportService; import test.com.amazon.opendistroforelasticsearch.ad.util.JsonDeserializer; @@ -50,7 +50,7 @@ import com.amazon.opendistroforelasticsearch.ad.ml.ModelManager; import com.amazon.opendistroforelasticsearch.ad.ml.ThresholdingResult; -public class ThresholdResultTests extends ESTestCase { +public class ThresholdResultTests extends OpenSearchTestCase { @SuppressWarnings("unchecked") public void testNormal() { diff --git a/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/handler/ADSearchHandlerTests.java b/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/handler/ADSearchHandlerTests.java index 43ddf34e4..3fcbdad2e 100644 --- a/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/handler/ADSearchHandlerTests.java +++ b/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/handler/ADSearchHandlerTests.java @@ -24,16 +24,16 @@ import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; -import org.elasticsearch.action.ActionListener; -import org.elasticsearch.action.search.SearchRequest; -import org.elasticsearch.action.search.SearchResponse; -import org.elasticsearch.client.Client; -import org.elasticsearch.cluster.service.ClusterService; -import org.elasticsearch.common.settings.ClusterSettings; -import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.common.util.concurrent.ThreadContext; -import org.elasticsearch.threadpool.ThreadPool; import org.junit.Before; +import org.opensearch.action.ActionListener; +import org.opensearch.action.search.SearchRequest; +import org.opensearch.action.search.SearchResponse; +import org.opensearch.client.Client; +import org.opensearch.cluster.service.ClusterService; +import org.opensearch.common.settings.ClusterSettings; +import org.opensearch.common.settings.Settings; +import org.opensearch.common.util.concurrent.ThreadContext; +import org.opensearch.threadpool.ThreadPool; import com.amazon.opendistroforelasticsearch.ad.ADUnitTestCase; import com.amazon.opendistroforelasticsearch.commons.ConfigConstants; @@ -63,7 +63,7 @@ public void setUp() throws Exception { ThreadContext threadContext = new ThreadContext(settings); threadContext.putTransient(ConfigConstants.OPENDISTRO_SECURITY_USER_INFO_THREAD_CONTEXT, "alice|odfe,aes|engineering,operations"); - org.elasticsearch.threadpool.ThreadPool mockThreadPool = mock(ThreadPool.class); + org.opensearch.threadpool.ThreadPool mockThreadPool = mock(ThreadPool.class); when(client.threadPool()).thenReturn(mockThreadPool); when(client.threadPool().getThreadContext()).thenReturn(threadContext); when(mockThreadPool.getThreadContext()).thenReturn(threadContext); diff --git a/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/handler/AnomalyResultBulkIndexHandlerTests.java b/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/handler/AnomalyResultBulkIndexHandlerTests.java index afa1efdd7..8c5612f3d 100644 --- a/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/handler/AnomalyResultBulkIndexHandlerTests.java +++ b/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/handler/AnomalyResultBulkIndexHandlerTests.java @@ -28,14 +28,14 @@ import java.io.IOException; import java.time.Clock; -import org.elasticsearch.action.ActionListener; -import org.elasticsearch.action.admin.indices.create.CreateIndexResponse; -import org.elasticsearch.action.bulk.BulkRequestBuilder; -import org.elasticsearch.action.bulk.BulkResponse; -import org.elasticsearch.client.Client; -import org.elasticsearch.cluster.service.ClusterService; -import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.threadpool.ThreadPool; +import org.opensearch.action.ActionListener; +import org.opensearch.action.admin.indices.create.CreateIndexResponse; +import org.opensearch.action.bulk.BulkRequestBuilder; +import org.opensearch.action.bulk.BulkResponse; +import org.opensearch.client.Client; +import org.opensearch.cluster.service.ClusterService; +import org.opensearch.common.settings.Settings; +import org.opensearch.threadpool.ThreadPool; import com.amazon.opendistroforelasticsearch.ad.ADUnitTestCase; import com.amazon.opendistroforelasticsearch.ad.TestHelpers; diff --git a/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/handler/AnomalyResultHandlerTests.java b/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/handler/AnomalyResultHandlerTests.java index 25fd2140b..3a70a8720 100644 --- a/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/handler/AnomalyResultHandlerTests.java +++ b/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/handler/AnomalyResultHandlerTests.java @@ -30,20 +30,6 @@ import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; -import org.elasticsearch.ResourceAlreadyExistsException; -import org.elasticsearch.action.ActionListener; -import org.elasticsearch.action.admin.indices.create.CreateIndexResponse; -import org.elasticsearch.action.index.IndexRequest; -import org.elasticsearch.action.index.IndexResponse; -import org.elasticsearch.client.Client; -import org.elasticsearch.cluster.ClusterState; -import org.elasticsearch.cluster.metadata.IndexMetadata; -import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver; -import org.elasticsearch.cluster.service.ClusterService; -import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.common.unit.TimeValue; -import org.elasticsearch.common.util.concurrent.EsRejectedExecutionException; -import org.elasticsearch.threadpool.ThreadPool; import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; @@ -53,6 +39,20 @@ import org.mockito.ArgumentMatchers; import org.mockito.Mock; import org.mockito.MockitoAnnotations; +import org.opensearch.ResourceAlreadyExistsException; +import org.opensearch.action.ActionListener; +import org.opensearch.action.admin.indices.create.CreateIndexResponse; +import org.opensearch.action.index.IndexRequest; +import org.opensearch.action.index.IndexResponse; +import org.opensearch.client.Client; +import org.opensearch.cluster.ClusterState; +import org.opensearch.cluster.metadata.IndexMetadata; +import org.opensearch.cluster.metadata.IndexNameExpressionResolver; +import org.opensearch.cluster.service.ClusterService; +import org.opensearch.common.settings.Settings; +import org.opensearch.common.unit.TimeValue; +import org.opensearch.common.util.concurrent.OpenSearchRejectedExecutionException; +import org.opensearch.threadpool.ThreadPool; import com.amazon.opendistroforelasticsearch.ad.AbstractADTest; import com.amazon.opendistroforelasticsearch.ad.NodeStateManager; @@ -260,8 +260,8 @@ private void setWriteBlockAdResultIndex(boolean blocked) { /** * Template to test exponential backoff retry during saving anomaly result. * - * @param throwEsRejectedExecutionException whether to throw - * EsRejectedExecutionException in the + * @param throwOpenSearchRejectedExecutionException whether to throw + * OpenSearchRejectedExecutionException in the * client::index mock or not * @param latchCount used for coordinating. Equal to * number of expected retries plus 1. @@ -269,7 +269,7 @@ private void setWriteBlockAdResultIndex(boolean blocked) { * @throws IOException if IO failures */ @SuppressWarnings("unchecked") - private void savingFailureTemplate(boolean throwEsRejectedExecutionException, int latchCount, boolean adResultIndexExists) + private void savingFailureTemplate(boolean throwOpenSearchRejectedExecutionException, int latchCount, boolean adResultIndexExists) throws InterruptedException, IOException { setUpSavingAnomalyResultIndex(adResultIndexExists); @@ -282,8 +282,8 @@ private void savingFailureTemplate(boolean throwEsRejectedExecutionException, in IndexRequest request = invocation.getArgument(0); ActionListener listener = invocation.getArgument(1); assertTrue(request != null && listener != null); - if (throwEsRejectedExecutionException) { - listener.onFailure(new EsRejectedExecutionException("")); + if (throwOpenSearchRejectedExecutionException) { + listener.onFailure(new OpenSearchRejectedExecutionException("")); } else { listener.onFailure(new IllegalArgumentException()); } diff --git a/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/handler/DetectorStateHandlerTests.java b/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/handler/DetectorStateHandlerTests.java index 75ae5f934..0f0a5f729 100644 --- a/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/handler/DetectorStateHandlerTests.java +++ b/src/test/java/com/amazon/opendistroforelasticsearch/ad/transport/handler/DetectorStateHandlerTests.java @@ -27,14 +27,14 @@ import java.time.Clock; import java.time.Instant; -import org.elasticsearch.action.ActionListener; -import org.elasticsearch.action.get.GetResponse; -import org.elasticsearch.client.Client; -import org.elasticsearch.cluster.service.ClusterService; -import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.common.xcontent.NamedXContentRegistry; -import org.elasticsearch.test.ESTestCase; -import org.elasticsearch.threadpool.ThreadPool; +import org.opensearch.action.ActionListener; +import org.opensearch.action.get.GetResponse; +import org.opensearch.client.Client; +import org.opensearch.cluster.service.ClusterService; +import org.opensearch.common.settings.Settings; +import org.opensearch.common.xcontent.NamedXContentRegistry; +import org.opensearch.test.OpenSearchTestCase; +import org.opensearch.threadpool.ThreadPool; import com.amazon.opendistroforelasticsearch.ad.NodeStateManager; import com.amazon.opendistroforelasticsearch.ad.TestHelpers; @@ -47,7 +47,7 @@ import com.amazon.opendistroforelasticsearch.ad.util.Throttler; import com.amazon.opendistroforelasticsearch.ad.util.ThrowingConsumerWrapper; -public class DetectorStateHandlerTests extends ESTestCase { +public class DetectorStateHandlerTests extends OpenSearchTestCase { private DetectionStateHandler detectorStateHandler; private String detectorId = "123"; private Client client; diff --git a/src/test/java/com/amazon/opendistroforelasticsearch/ad/util/ExceptionUtilsTests.java b/src/test/java/com/amazon/opendistroforelasticsearch/ad/util/ExceptionUtilsTests.java index 624422cb0..73d6f8eaa 100644 --- a/src/test/java/com/amazon/opendistroforelasticsearch/ad/util/ExceptionUtilsTests.java +++ b/src/test/java/com/amazon/opendistroforelasticsearch/ad/util/ExceptionUtilsTests.java @@ -15,16 +15,16 @@ package com.amazon.opendistroforelasticsearch.ad.util; -import org.elasticsearch.ElasticsearchException; -import org.elasticsearch.action.index.IndexResponse; -import org.elasticsearch.action.support.replication.ReplicationResponse; -import org.elasticsearch.index.shard.ShardId; -import org.elasticsearch.rest.RestStatus; -import org.elasticsearch.test.ESTestCase; +import org.opensearch.OpenSearchException; +import org.opensearch.action.index.IndexResponse; +import org.opensearch.action.support.replication.ReplicationResponse; +import org.opensearch.index.shard.ShardId; +import org.opensearch.rest.RestStatus; +import org.opensearch.test.OpenSearchTestCase; import com.amazon.opendistroforelasticsearch.ad.common.exception.AnomalyDetectionException; -public class ExceptionUtilsTests extends ESTestCase { +public class ExceptionUtilsTests extends OpenSearchTestCase { public void testGetShardsFailure() { ShardId shardId = new ShardId(randomAlphaOfLength(5), randomAlphaOfLength(5), 1); @@ -77,7 +77,7 @@ public void testCountInStats() { public void testGetErrorMessage() { assertEquals("test", ExceptionUtil.getErrorMessage(new AnomalyDetectionException("test"))); assertEquals("test", ExceptionUtil.getErrorMessage(new IllegalArgumentException("test"))); - assertEquals("org.elasticsearch.ElasticsearchException: test", ExceptionUtil.getErrorMessage(new ElasticsearchException("test"))); + assertEquals("org.opensearch.OpenSearchException: test", ExceptionUtil.getErrorMessage(new OpenSearchException("test"))); assertTrue( ExceptionUtil .getErrorMessage(new RuntimeException("test")) diff --git a/src/test/java/com/amazon/opendistroforelasticsearch/ad/util/IndexUtilsTests.java b/src/test/java/com/amazon/opendistroforelasticsearch/ad/util/IndexUtilsTests.java index d9386da49..7e66375be 100644 --- a/src/test/java/com/amazon/opendistroforelasticsearch/ad/util/IndexUtilsTests.java +++ b/src/test/java/com/amazon/opendistroforelasticsearch/ad/util/IndexUtilsTests.java @@ -19,18 +19,18 @@ import java.time.Clock; -import org.elasticsearch.action.support.master.AcknowledgedResponse; -import org.elasticsearch.client.Client; -import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver; -import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.test.ESIntegTestCase; -import org.elasticsearch.threadpool.ThreadPool; import org.junit.Before; import org.junit.Test; +import org.opensearch.action.support.master.AcknowledgedResponse; +import org.opensearch.client.Client; +import org.opensearch.cluster.metadata.IndexNameExpressionResolver; +import org.opensearch.common.settings.Settings; +import org.opensearch.test.OpenSearchIntegTestCase; +import org.opensearch.threadpool.ThreadPool; import com.amazon.opendistroforelasticsearch.ad.TestHelpers; -public class IndexUtilsTests extends ESIntegTestCase { +public class IndexUtilsTests extends OpenSearchIntegTestCase { private ClientUtil clientUtil; diff --git a/src/test/java/com/amazon/opendistroforelasticsearch/ad/util/MultiResponsesDelegateActionListenerTests.java b/src/test/java/com/amazon/opendistroforelasticsearch/ad/util/MultiResponsesDelegateActionListenerTests.java index e14a1fbb4..826d54270 100644 --- a/src/test/java/com/amazon/opendistroforelasticsearch/ad/util/MultiResponsesDelegateActionListenerTests.java +++ b/src/test/java/com/amazon/opendistroforelasticsearch/ad/util/MultiResponsesDelegateActionListenerTests.java @@ -23,14 +23,14 @@ import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; -import org.elasticsearch.action.ActionListener; -import org.elasticsearch.test.ESTestCase; +import org.opensearch.action.ActionListener; +import org.opensearch.test.OpenSearchTestCase; import com.amazon.opendistroforelasticsearch.ad.model.AnomalyResult; import com.amazon.opendistroforelasticsearch.ad.model.DetectorProfile; import com.amazon.opendistroforelasticsearch.ad.model.EntityAnomalyResult; -public class MultiResponsesDelegateActionListenerTests extends ESTestCase { +public class MultiResponsesDelegateActionListenerTests extends OpenSearchTestCase { public void testEmptyResponse() throws InterruptedException { final CountDownLatch inProgressLatch = new CountDownLatch(1); diff --git a/src/test/java/com/amazon/opendistroforelasticsearch/ad/util/ParseUtilsTests.java b/src/test/java/com/amazon/opendistroforelasticsearch/ad/util/ParseUtilsTests.java index 87963fa5e..946a35669 100644 --- a/src/test/java/com/amazon/opendistroforelasticsearch/ad/util/ParseUtilsTests.java +++ b/src/test/java/com/amazon/opendistroforelasticsearch/ad/util/ParseUtilsTests.java @@ -21,13 +21,13 @@ import java.time.Instant; import java.time.temporal.ChronoUnit; -import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentFactory; -import org.elasticsearch.common.xcontent.XContentParser; -import org.elasticsearch.search.aggregations.AggregationBuilder; -import org.elasticsearch.search.aggregations.AggregatorFactories; -import org.elasticsearch.search.builder.SearchSourceBuilder; -import org.elasticsearch.test.ESTestCase; +import org.opensearch.common.xcontent.XContentBuilder; +import org.opensearch.common.xcontent.XContentFactory; +import org.opensearch.common.xcontent.XContentParser; +import org.opensearch.search.aggregations.AggregationBuilder; +import org.opensearch.search.aggregations.AggregatorFactories; +import org.opensearch.search.builder.SearchSourceBuilder; +import org.opensearch.test.OpenSearchTestCase; import com.amazon.opendistroforelasticsearch.ad.TestHelpers; import com.amazon.opendistroforelasticsearch.ad.common.exception.AnomalyDetectionException; @@ -37,7 +37,7 @@ import com.amazon.opendistroforelasticsearch.commons.authuser.User; import com.google.common.collect.ImmutableList; -public class ParseUtilsTests extends ESTestCase { +public class ParseUtilsTests extends OpenSearchTestCase { public void testToInstant() throws IOException { long epochMilli = Instant.now().toEpochMilli(); diff --git a/src/test/java/com/amazon/opendistroforelasticsearch/ad/util/RestHandlerUtilsTests.java b/src/test/java/com/amazon/opendistroforelasticsearch/ad/util/RestHandlerUtilsTests.java index 0b57ef50a..b62b6af0a 100644 --- a/src/test/java/com/amazon/opendistroforelasticsearch/ad/util/RestHandlerUtilsTests.java +++ b/src/test/java/com/amazon/opendistroforelasticsearch/ad/util/RestHandlerUtilsTests.java @@ -20,23 +20,23 @@ import java.io.IOException; -import org.elasticsearch.common.bytes.BytesReference; -import org.elasticsearch.common.xcontent.NamedXContentRegistry; -import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.common.xcontent.XContentParser; -import org.elasticsearch.rest.RestChannel; -import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.search.fetch.subphase.FetchSourceContext; -import org.elasticsearch.test.ESTestCase; -import org.elasticsearch.test.rest.FakeRestChannel; -import org.elasticsearch.test.rest.FakeRestRequest; +import org.opensearch.common.bytes.BytesReference; +import org.opensearch.common.xcontent.NamedXContentRegistry; +import org.opensearch.common.xcontent.XContentBuilder; +import org.opensearch.common.xcontent.XContentParser; +import org.opensearch.rest.RestChannel; +import org.opensearch.rest.RestRequest; +import org.opensearch.search.fetch.subphase.FetchSourceContext; +import org.opensearch.test.OpenSearchTestCase; +import org.opensearch.test.rest.FakeRestChannel; +import org.opensearch.test.rest.FakeRestRequest; import com.amazon.opendistroforelasticsearch.ad.TestHelpers; import com.amazon.opendistroforelasticsearch.ad.model.AnomalyDetector; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; -public class RestHandlerUtilsTests extends ESTestCase { +public class RestHandlerUtilsTests extends OpenSearchTestCase { public void testGetSourceContext() { RestRequest request = new FakeRestRequest(); diff --git a/src/test/java/com/amazon/opendistroforelasticsearch/ad/util/ThrottlerTests.java b/src/test/java/com/amazon/opendistroforelasticsearch/ad/util/ThrottlerTests.java index dfaa5fb9c..f381d53f9 100644 --- a/src/test/java/com/amazon/opendistroforelasticsearch/ad/util/ThrottlerTests.java +++ b/src/test/java/com/amazon/opendistroforelasticsearch/ad/util/ThrottlerTests.java @@ -20,14 +20,14 @@ import java.time.Clock; -import org.elasticsearch.action.search.SearchRequest; -import org.elasticsearch.test.ESTestCase; import org.junit.Before; import org.junit.Test; +import org.opensearch.action.search.SearchRequest; +import org.opensearch.test.OpenSearchTestCase; import com.amazon.opendistroforelasticsearch.ad.model.AnomalyDetector; -public class ThrottlerTests extends ESTestCase { +public class ThrottlerTests extends OpenSearchTestCase { private Throttler throttler; @Before diff --git a/src/test/java/org/elasticsearch/action/admin/indices/mapping/get/IndexAnomalyDetectorActionHandlerTests.java b/src/test/java/org/opensearch/action/admin/indices/mapping/get/IndexAnomalyDetectorActionHandlerTests.java similarity index 95% rename from src/test/java/org/elasticsearch/action/admin/indices/mapping/get/IndexAnomalyDetectorActionHandlerTests.java rename to src/test/java/org/opensearch/action/admin/indices/mapping/get/IndexAnomalyDetectorActionHandlerTests.java index 84c803025..689ceac57 100644 --- a/src/test/java/org/elasticsearch/action/admin/indices/mapping/get/IndexAnomalyDetectorActionHandlerTests.java +++ b/src/test/java/org/opensearch/action/admin/indices/mapping/get/IndexAnomalyDetectorActionHandlerTests.java @@ -13,7 +13,7 @@ * permissions and limitations under the License. */ -package org.elasticsearch.action.admin.indices.mapping.get; +package org.opensearch.action.admin.indices.mapping.get; import static com.amazon.opendistroforelasticsearch.ad.model.AnomalyDetector.ANOMALY_DETECTORS_INDEX; import static org.mockito.ArgumentMatchers.any; @@ -30,32 +30,32 @@ import java.util.Arrays; import java.util.concurrent.TimeUnit; -import org.elasticsearch.action.ActionListener; -import org.elasticsearch.action.ActionRequest; -import org.elasticsearch.action.ActionResponse; -import org.elasticsearch.action.ActionType; -import org.elasticsearch.action.get.GetAction; -import org.elasticsearch.action.get.GetRequest; -import org.elasticsearch.action.get.GetResponse; -import org.elasticsearch.action.search.SearchAction; -import org.elasticsearch.action.search.SearchRequest; -import org.elasticsearch.action.search.SearchResponse; -import org.elasticsearch.action.support.WriteRequest; -import org.elasticsearch.client.node.NodeClient; -import org.elasticsearch.cluster.ClusterName; -import org.elasticsearch.cluster.ClusterState; -import org.elasticsearch.cluster.metadata.Metadata; -import org.elasticsearch.cluster.service.ClusterService; -import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.common.unit.TimeValue; -import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.threadpool.TestThreadPool; -import org.elasticsearch.threadpool.ThreadPool; -import org.elasticsearch.transport.TransportService; import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; import org.mockito.ArgumentCaptor; +import org.opensearch.action.ActionListener; +import org.opensearch.action.ActionRequest; +import org.opensearch.action.ActionResponse; +import org.opensearch.action.ActionType; +import org.opensearch.action.get.GetAction; +import org.opensearch.action.get.GetRequest; +import org.opensearch.action.get.GetResponse; +import org.opensearch.action.search.SearchAction; +import org.opensearch.action.search.SearchRequest; +import org.opensearch.action.search.SearchResponse; +import org.opensearch.action.support.WriteRequest; +import org.opensearch.client.node.NodeClient; +import org.opensearch.cluster.ClusterName; +import org.opensearch.cluster.ClusterState; +import org.opensearch.cluster.metadata.Metadata; +import org.opensearch.cluster.service.ClusterService; +import org.opensearch.common.settings.Settings; +import org.opensearch.common.unit.TimeValue; +import org.opensearch.rest.RestRequest; +import org.opensearch.threadpool.TestThreadPool; +import org.opensearch.threadpool.ThreadPool; +import org.opensearch.transport.TransportService; import com.amazon.opendistroforelasticsearch.ad.AbstractADTest; import com.amazon.opendistroforelasticsearch.ad.TestHelpers; @@ -69,7 +69,7 @@ /** * * we need to put the test in the same package of GetFieldMappingsResponse - * (org.elasticsearch.action.admin.indices.mapping.get) since its constructor is + * (org.opensearch.action.admin.indices.mapping.get) since its constructor is * package private * */ diff --git a/src/test/java/org/elasticsearch/search/aggregations/metrics/CardinalityProfileTests.java b/src/test/java/org/opensearch/search/aggregations/metrics/CardinalityProfileTests.java similarity index 95% rename from src/test/java/org/elasticsearch/search/aggregations/metrics/CardinalityProfileTests.java rename to src/test/java/org/opensearch/search/aggregations/metrics/CardinalityProfileTests.java index 8b90c4f76..740e56893 100644 --- a/src/test/java/org/elasticsearch/search/aggregations/metrics/CardinalityProfileTests.java +++ b/src/test/java/org/opensearch/search/aggregations/metrics/CardinalityProfileTests.java @@ -13,7 +13,7 @@ * permissions and limitations under the License. */ -package org.elasticsearch.search.aggregations.metrics; +package org.opensearch.search.aggregations.metrics; import static com.amazon.opendistroforelasticsearch.ad.model.AnomalyDetector.ANOMALY_DETECTORS_INDEX; import static com.amazon.opendistroforelasticsearch.ad.model.AnomalyDetectorJob.ANOMALY_DETECTOR_JOB_INDEX; @@ -35,15 +35,15 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; -import org.elasticsearch.action.ActionListener; -import org.elasticsearch.action.get.GetRequest; -import org.elasticsearch.action.get.GetResponse; -import org.elasticsearch.action.search.SearchRequest; -import org.elasticsearch.action.search.SearchResponse; -import org.elasticsearch.cluster.ClusterName; -import org.elasticsearch.common.util.BigArrays; -import org.elasticsearch.search.aggregations.InternalAggregation; -import org.elasticsearch.search.aggregations.InternalAggregations; +import org.opensearch.action.ActionListener; +import org.opensearch.action.get.GetRequest; +import org.opensearch.action.get.GetResponse; +import org.opensearch.action.search.SearchRequest; +import org.opensearch.action.search.SearchResponse; +import org.opensearch.cluster.ClusterName; +import org.opensearch.common.util.BigArrays; +import org.opensearch.search.aggregations.InternalAggregation; +import org.opensearch.search.aggregations.InternalAggregations; import com.amazon.opendistroforelasticsearch.ad.AbstractProfileRunnerTests; import com.amazon.opendistroforelasticsearch.ad.TestHelpers; diff --git a/src/test/java/test/com/amazon/opendistroforelasticsearch/ad/util/ClusterCreation.java b/src/test/java/test/com/amazon/opendistroforelasticsearch/ad/util/ClusterCreation.java index 990957699..8b70f83a9 100644 --- a/src/test/java/test/com/amazon/opendistroforelasticsearch/ad/util/ClusterCreation.java +++ b/src/test/java/test/com/amazon/opendistroforelasticsearch/ad/util/ClusterCreation.java @@ -15,23 +15,23 @@ package test.com.amazon.opendistroforelasticsearch.ad.util; -import static org.elasticsearch.cluster.node.DiscoveryNodeRole.DATA_ROLE; -import static org.elasticsearch.cluster.node.DiscoveryNodeRole.MASTER_ROLE; import static org.mockito.Mockito.mock; +import static org.opensearch.cluster.node.DiscoveryNodeRole.DATA_ROLE; +import static org.opensearch.cluster.node.DiscoveryNodeRole.MASTER_ROLE; import java.net.InetAddress; import java.util.ArrayList; import java.util.Collections; import java.util.List; -import org.elasticsearch.Version; -import org.elasticsearch.cluster.ClusterName; -import org.elasticsearch.cluster.ClusterState; -import org.elasticsearch.cluster.metadata.Metadata; -import org.elasticsearch.cluster.node.DiscoveryNode; -import org.elasticsearch.cluster.node.DiscoveryNodes; -import org.elasticsearch.common.collect.ImmutableOpenMap; -import org.elasticsearch.common.transport.TransportAddress; +import org.opensearch.Version; +import org.opensearch.cluster.ClusterName; +import org.opensearch.cluster.ClusterState; +import org.opensearch.cluster.metadata.Metadata; +import org.opensearch.cluster.node.DiscoveryNode; +import org.opensearch.cluster.node.DiscoveryNodes; +import org.opensearch.common.collect.ImmutableOpenMap; +import org.opensearch.common.transport.TransportAddress; public class ClusterCreation { /** diff --git a/src/test/java/test/com/amazon/opendistroforelasticsearch/ad/util/FakeNode.java b/src/test/java/test/com/amazon/opendistroforelasticsearch/ad/util/FakeNode.java index 1dffbeda3..fbd9c0fe2 100644 --- a/src/test/java/test/com/amazon/opendistroforelasticsearch/ad/util/FakeNode.java +++ b/src/test/java/test/com/amazon/opendistroforelasticsearch/ad/util/FakeNode.java @@ -17,8 +17,8 @@ import static java.util.Collections.emptyMap; import static java.util.Collections.emptySet; -import static org.elasticsearch.test.ClusterServiceUtils.createClusterService; -import static org.elasticsearch.test.ClusterServiceUtils.setState; +import static org.opensearch.test.ClusterServiceUtils.createClusterService; +import static org.opensearch.test.ClusterServiceUtils.setState; import java.util.ArrayList; import java.util.Collections; @@ -29,29 +29,29 @@ import java.util.function.Function; import org.apache.lucene.util.SetOnce; -import org.elasticsearch.Version; -import org.elasticsearch.action.admin.cluster.node.tasks.cancel.TransportCancelTasksAction; -import org.elasticsearch.action.admin.cluster.node.tasks.list.TransportListTasksAction; -import org.elasticsearch.action.support.ActionFilters; -import org.elasticsearch.cluster.ClusterModule; -import org.elasticsearch.cluster.ClusterName; -import org.elasticsearch.cluster.node.DiscoveryNode; -import org.elasticsearch.cluster.service.ClusterService; -import org.elasticsearch.common.io.stream.NamedWriteableRegistry; -import org.elasticsearch.common.lease.Releasable; -import org.elasticsearch.common.network.NetworkService; -import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.common.transport.BoundTransportAddress; -import org.elasticsearch.common.transport.TransportAddress; -import org.elasticsearch.common.util.PageCacheRecycler; -import org.elasticsearch.indices.breaker.NoneCircuitBreakerService; -import org.elasticsearch.tasks.TaskManager; -import org.elasticsearch.test.ESTestCase; -import org.elasticsearch.test.tasks.MockTaskManager; -import org.elasticsearch.threadpool.ThreadPool; -import org.elasticsearch.transport.TransportInterceptor; -import org.elasticsearch.transport.TransportService; -import org.elasticsearch.transport.nio.MockNioTransport; +import org.opensearch.Version; +import org.opensearch.action.admin.cluster.node.tasks.cancel.TransportCancelTasksAction; +import org.opensearch.action.admin.cluster.node.tasks.list.TransportListTasksAction; +import org.opensearch.action.support.ActionFilters; +import org.opensearch.cluster.ClusterModule; +import org.opensearch.cluster.ClusterName; +import org.opensearch.cluster.node.DiscoveryNode; +import org.opensearch.cluster.service.ClusterService; +import org.opensearch.common.io.stream.NamedWriteableRegistry; +import org.opensearch.common.lease.Releasable; +import org.opensearch.common.network.NetworkService; +import org.opensearch.common.settings.Settings; +import org.opensearch.common.transport.BoundTransportAddress; +import org.opensearch.common.transport.TransportAddress; +import org.opensearch.common.util.PageCacheRecycler; +import org.opensearch.indices.breaker.NoneCircuitBreakerService; +import org.opensearch.tasks.TaskManager; +import org.opensearch.test.OpenSearchTestCase; +import org.opensearch.test.tasks.MockTaskManager; +import org.opensearch.threadpool.ThreadPool; +import org.opensearch.transport.TransportInterceptor; +import org.opensearch.transport.TransportService; +import org.opensearch.transport.nio.MockNioTransport; public class FakeNode implements Releasable { public FakeNode(String name, ThreadPool threadPool, Settings settings, TransportInterceptor transportInterceptor) { @@ -72,7 +72,7 @@ public FakeNode(String name, ThreadPool threadPool, Settings settings, Transport ) { @Override public TransportAddress[] addressesFromString(String address) { - return new TransportAddress[] { dns.getOrDefault(address, ESTestCase.buildNewFakeTransportAddress()) }; + return new TransportAddress[] { dns.getOrDefault(address, OpenSearchTestCase.buildNewFakeTransportAddress()) }; } }, threadPool, diff --git a/src/test/resources/job-scheduler/opendistro-job-scheduler-1.13.0.0.zip b/src/test/resources/job-scheduler/opendistro-job-scheduler-1.13.0.0.zip deleted file mode 100644 index adf906b58..000000000 Binary files a/src/test/resources/job-scheduler/opendistro-job-scheduler-1.13.0.0.zip and /dev/null differ diff --git a/src/test/resources/job-scheduler/opendistro-job-scheduler-1.15.0.0-SNAPSHOT.zip b/src/test/resources/job-scheduler/opendistro-job-scheduler-1.15.0.0-SNAPSHOT.zip new file mode 100644 index 000000000..dbc934eb7 Binary files /dev/null and b/src/test/resources/job-scheduler/opendistro-job-scheduler-1.15.0.0-SNAPSHOT.zip differ