[Rename] remaining packages and resources in test/fixture (#364)

This commit refactors the remaining o.e.index and o.e.test packages in the
test/fixtures module. References throughout the codebase are also refactored.

Signed-off-by: Nicholas Walter Knize <nknize@apache.org>
This commit is contained in:
Nick Knize 2021-03-17 22:51:17 -05:00 committed by Nick Knize
parent 5bef7cec87
commit 5b46a05702
1595 changed files with 4502 additions and 4690 deletions

View File

@ -51,7 +51,7 @@ java.lang.Boolean#getBoolean(java.lang.String)
org.apache.lucene.util.IOUtils @ use @org.opensearch.core.internal.io instead org.apache.lucene.util.IOUtils @ use @org.opensearch.core.internal.io instead
@defaultMessage use executors from org.opensearch.common.util.concurrent.EsExecutors instead which will properly bubble up Errors @defaultMessage use executors from org.opensearch.common.util.concurrent.OpenSearchExecutors instead which will properly bubble up Errors
java.util.concurrent.AbstractExecutorService#<init>() java.util.concurrent.AbstractExecutorService#<init>()
java.util.concurrent.ThreadPoolExecutor#<init>(int, int, long, java.util.concurrent.TimeUnit, java.util.concurrent.BlockingQueue) java.util.concurrent.ThreadPoolExecutor#<init>(int, int, long, java.util.concurrent.TimeUnit, java.util.concurrent.BlockingQueue)
java.util.concurrent.ThreadPoolExecutor#<init>(int, int, long, java.util.concurrent.TimeUnit, java.util.concurrent.BlockingQueue, java.util.concurrent.ThreadFactory) java.util.concurrent.ThreadPoolExecutor#<init>(int, int, long, java.util.concurrent.TimeUnit, java.util.concurrent.BlockingQueue, java.util.concurrent.ThreadFactory)

View File

@ -26,7 +26,7 @@ import org.opensearch.common.xcontent.XContent;
import org.opensearch.common.xcontent.XContentFactory; import org.opensearch.common.xcontent.XContentFactory;
import org.opensearch.common.xcontent.XContentParser; import org.opensearch.common.xcontent.XContentParser;
import org.opensearch.common.xcontent.XContentType; import org.opensearch.common.xcontent.XContentType;
import org.elasticsearch.test.ESTestCase; import org.opensearch.test.OpenSearchTestCase;
import java.io.IOException; import java.io.IOException;
@ -39,7 +39,7 @@ import java.io.IOException;
* @param <C> The class representing the request on the client side. * @param <C> The class representing the request on the client side.
* @param <S> The class representing the request on the server side. * @param <S> The class representing the request on the server side.
*/ */
public abstract class AbstractRequestTestCase<C extends ToXContent, S> extends ESTestCase { public abstract class AbstractRequestTestCase<C extends ToXContent, S> extends OpenSearchTestCase {
public final void testFromXContent() throws IOException { public final void testFromXContent() throws IOException {
final C clientTestInstance = createClientTestInstance(); final C clientTestInstance = createClientTestInstance();

View File

@ -26,7 +26,7 @@ import org.opensearch.common.xcontent.XContent;
import org.opensearch.common.xcontent.XContentFactory; import org.opensearch.common.xcontent.XContentFactory;
import org.opensearch.common.xcontent.XContentParser; import org.opensearch.common.xcontent.XContentParser;
import org.opensearch.common.xcontent.XContentType; import org.opensearch.common.xcontent.XContentType;
import org.elasticsearch.test.ESTestCase; import org.opensearch.test.OpenSearchTestCase;
import java.io.IOException; import java.io.IOException;
@ -39,7 +39,7 @@ import java.io.IOException;
* @param <S> The class representing the response on the server side. * @param <S> The class representing the response on the server side.
* @param <C> The class representing the response on the client side. * @param <C> The class representing the response on the client side.
*/ */
public abstract class AbstractResponseTestCase<S extends ToXContent, C> extends ESTestCase { public abstract class AbstractResponseTestCase<S extends ToXContent, C> extends OpenSearchTestCase {
public final void testFromXContent() throws IOException { public final void testFromXContent() throws IOException {
final XContentType xContentType = randomFrom(XContentType.values()); final XContentType xContentType = randomFrom(XContentType.values());

View File

@ -20,9 +20,6 @@
package org.opensearch.client; package org.opensearch.client;
import com.carrotsearch.randomizedtesting.generators.RandomPicks; import com.carrotsearch.randomizedtesting.generators.RandomPicks;
import org.opensearch.client.Request;
import org.opensearch.client.RequestOptions;
import org.opensearch.client.Response;
import org.opensearch.action.bulk.BulkItemResponse; import org.opensearch.action.bulk.BulkItemResponse;
import org.opensearch.action.bulk.BulkProcessor; import org.opensearch.action.bulk.BulkProcessor;
import org.opensearch.action.bulk.BulkRequest; import org.opensearch.action.bulk.BulkRequest;
@ -57,11 +54,11 @@ import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.IntStream; import java.util.stream.IntStream;
import static org.opensearch.common.xcontent.XContentFactory.jsonBuilder; import static org.opensearch.common.xcontent.XContentFactory.jsonBuilder;
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.fieldFromSource; import static org.opensearch.test.hamcrest.OpenSearchAssertions.fieldFromSource;
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.hasId; import static org.opensearch.test.hamcrest.OpenSearchAssertions.hasId;
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.hasIndex; import static org.opensearch.test.hamcrest.OpenSearchAssertions.hasIndex;
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.hasProperty; import static org.opensearch.test.hamcrest.OpenSearchAssertions.hasProperty;
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.hasType; import static org.opensearch.test.hamcrest.OpenSearchAssertions.hasType;
import static org.hamcrest.Matchers.both; import static org.hamcrest.Matchers.both;
import static org.hamcrest.Matchers.containsInAnyOrder; import static org.hamcrest.Matchers.containsInAnyOrder;
import static org.hamcrest.Matchers.either; import static org.hamcrest.Matchers.either;

View File

@ -19,7 +19,6 @@
package org.opensearch.client; package org.opensearch.client;
import org.opensearch.client.RequestOptions;
import org.opensearch.action.bulk.BulkRequest; import org.opensearch.action.bulk.BulkRequest;
import org.opensearch.action.bulk.BulkResponse; import org.opensearch.action.bulk.BulkResponse;
import org.opensearch.action.index.IndexRequest; import org.opensearch.action.index.IndexRequest;
@ -31,10 +30,10 @@ import org.opensearch.search.SearchHit;
import java.io.IOException; import java.io.IOException;
import java.util.function.Function; import java.util.function.Function;
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.hasId; import static org.opensearch.test.hamcrest.OpenSearchAssertions.hasId;
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.hasIndex; import static org.opensearch.test.hamcrest.OpenSearchAssertions.hasIndex;
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.hasProperty; import static org.opensearch.test.hamcrest.OpenSearchAssertions.hasProperty;
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.hasType; import static org.opensearch.test.hamcrest.OpenSearchAssertions.hasType;
import static org.hamcrest.Matchers.both; import static org.hamcrest.Matchers.both;
import static org.hamcrest.Matchers.containsInAnyOrder; import static org.hamcrest.Matchers.containsInAnyOrder;
import static org.hamcrest.Matchers.emptyIterable; import static org.hamcrest.Matchers.emptyIterable;

View File

@ -65,7 +65,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import static java.util.Collections.emptyMap; import static java.util.Collections.emptyMap;
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked; import static org.opensearch.test.hamcrest.OpenSearchAssertions.assertAcked;
import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.greaterThan; import static org.hamcrest.Matchers.greaterThan;
import static org.hamcrest.Matchers.notNullValue; import static org.hamcrest.Matchers.notNullValue;

View File

@ -31,7 +31,7 @@ import org.opensearch.client.cluster.RemoteInfoRequest;
import org.opensearch.cluster.health.ClusterHealthStatus; import org.opensearch.cluster.health.ClusterHealthStatus;
import org.opensearch.common.Priority; import org.opensearch.common.Priority;
import org.opensearch.common.util.CollectionUtils; import org.opensearch.common.util.CollectionUtils;
import org.elasticsearch.test.ESTestCase; import org.opensearch.test.OpenSearchTestCase;
import org.hamcrest.CoreMatchers; import org.hamcrest.CoreMatchers;
import org.junit.Assert; import org.junit.Assert;
@ -44,7 +44,7 @@ import static java.util.Collections.emptyMap;
import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.Matchers.nullValue; import static org.hamcrest.Matchers.nullValue;
public class ClusterRequestConvertersTests extends ESTestCase { public class ClusterRequestConvertersTests extends OpenSearchTestCase {
public void testClusterPutSettings() throws IOException { public void testClusterPutSettings() throws IOException {
ClusterUpdateSettingsRequest request = new ClusterUpdateSettingsRequest(); ClusterUpdateSettingsRequest request = new ClusterUpdateSettingsRequest();
@ -62,7 +62,7 @@ public class ClusterRequestConvertersTests extends ESTestCase {
ClusterGetSettingsRequest request = new ClusterGetSettingsRequest(); ClusterGetSettingsRequest request = new ClusterGetSettingsRequest();
Map<String, String> expectedParams = new HashMap<>(); Map<String, String> expectedParams = new HashMap<>();
RequestConvertersTests.setRandomMasterTimeout(request, expectedParams); RequestConvertersTests.setRandomMasterTimeout(request, expectedParams);
request.includeDefaults(ESTestCase.randomBoolean()); request.includeDefaults(OpenSearchTestCase.randomBoolean());
if (request.includeDefaults()) { if (request.includeDefaults()) {
expectedParams.put("include_defaults", String.valueOf(true)); expectedParams.put("include_defaults", String.valueOf(true));
} }
@ -77,9 +77,9 @@ public class ClusterRequestConvertersTests extends ESTestCase {
ClusterHealthRequest healthRequest = new ClusterHealthRequest(); ClusterHealthRequest healthRequest = new ClusterHealthRequest();
Map<String, String> expectedParams = new HashMap<>(); Map<String, String> expectedParams = new HashMap<>();
RequestConvertersTests.setRandomLocal(healthRequest::local, expectedParams); RequestConvertersTests.setRandomLocal(healthRequest::local, expectedParams);
String timeoutType = ESTestCase.randomFrom("timeout", "masterTimeout", "both", "none"); String timeoutType = OpenSearchTestCase.randomFrom("timeout", "masterTimeout", "both", "none");
String timeout = ESTestCase.randomTimeValue(); String timeout = OpenSearchTestCase.randomTimeValue();
String masterTimeout = ESTestCase.randomTimeValue(); String masterTimeout = OpenSearchTestCase.randomTimeValue();
switch (timeoutType) { switch (timeoutType) {
case "timeout": case "timeout":
healthRequest.timeout(timeout); healthRequest.timeout(timeout);
@ -106,38 +106,38 @@ public class ClusterRequestConvertersTests extends ESTestCase {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
RequestConvertersTests.setRandomWaitForActiveShards(healthRequest::waitForActiveShards, ActiveShardCount.NONE, expectedParams); RequestConvertersTests.setRandomWaitForActiveShards(healthRequest::waitForActiveShards, ActiveShardCount.NONE, expectedParams);
if (ESTestCase.randomBoolean()) { if (OpenSearchTestCase.randomBoolean()) {
ClusterHealthRequest.Level level = ESTestCase.randomFrom(ClusterHealthRequest.Level.values()); ClusterHealthRequest.Level level = OpenSearchTestCase.randomFrom(ClusterHealthRequest.Level.values());
healthRequest.level(level); healthRequest.level(level);
expectedParams.put("level", level.name().toLowerCase(Locale.ROOT)); expectedParams.put("level", level.name().toLowerCase(Locale.ROOT));
} else { } else {
expectedParams.put("level", "cluster"); expectedParams.put("level", "cluster");
} }
if (ESTestCase.randomBoolean()) { if (OpenSearchTestCase.randomBoolean()) {
Priority priority = ESTestCase.randomFrom(Priority.values()); Priority priority = OpenSearchTestCase.randomFrom(Priority.values());
healthRequest.waitForEvents(priority); healthRequest.waitForEvents(priority);
expectedParams.put("wait_for_events", priority.name().toLowerCase(Locale.ROOT)); expectedParams.put("wait_for_events", priority.name().toLowerCase(Locale.ROOT));
} }
if (ESTestCase.randomBoolean()) { if (OpenSearchTestCase.randomBoolean()) {
ClusterHealthStatus status = ESTestCase.randomFrom(ClusterHealthStatus.values()); ClusterHealthStatus status = OpenSearchTestCase.randomFrom(ClusterHealthStatus.values());
healthRequest.waitForStatus(status); healthRequest.waitForStatus(status);
expectedParams.put("wait_for_status", status.name().toLowerCase(Locale.ROOT)); expectedParams.put("wait_for_status", status.name().toLowerCase(Locale.ROOT));
} }
if (ESTestCase.randomBoolean()) { if (OpenSearchTestCase.randomBoolean()) {
boolean waitForNoInitializingShards = ESTestCase.randomBoolean(); boolean waitForNoInitializingShards = OpenSearchTestCase.randomBoolean();
healthRequest.waitForNoInitializingShards(waitForNoInitializingShards); healthRequest.waitForNoInitializingShards(waitForNoInitializingShards);
if (waitForNoInitializingShards) { if (waitForNoInitializingShards) {
expectedParams.put("wait_for_no_initializing_shards", Boolean.TRUE.toString()); expectedParams.put("wait_for_no_initializing_shards", Boolean.TRUE.toString());
} }
} }
if (ESTestCase.randomBoolean()) { if (OpenSearchTestCase.randomBoolean()) {
boolean waitForNoRelocatingShards = ESTestCase.randomBoolean(); boolean waitForNoRelocatingShards = OpenSearchTestCase.randomBoolean();
healthRequest.waitForNoRelocatingShards(waitForNoRelocatingShards); healthRequest.waitForNoRelocatingShards(waitForNoRelocatingShards);
if (waitForNoRelocatingShards) { if (waitForNoRelocatingShards) {
expectedParams.put("wait_for_no_relocating_shards", Boolean.TRUE.toString()); expectedParams.put("wait_for_no_relocating_shards", Boolean.TRUE.toString());
} }
} }
String[] indices = ESTestCase.randomBoolean() ? null : RequestConvertersTests.randomIndicesNames(0, 5); String[] indices = OpenSearchTestCase.randomBoolean() ? null : RequestConvertersTests.randomIndicesNames(0, 5);
healthRequest.indices(indices); healthRequest.indices(indices);
Request request = ClusterRequestConverters.clusterHealth(healthRequest); Request request = ClusterRequestConverters.clusterHealth(healthRequest);

View File

@ -44,7 +44,7 @@ import org.opensearch.cluster.ClusterName;
import org.opensearch.common.SuppressForbidden; import org.opensearch.common.SuppressForbidden;
import org.opensearch.common.xcontent.XContentHelper; import org.opensearch.common.xcontent.XContentHelper;
import org.opensearch.common.xcontent.XContentType; import org.opensearch.common.xcontent.XContentType;
import org.elasticsearch.test.ESTestCase; import org.opensearch.test.OpenSearchTestCase;
import org.junit.Before; import org.junit.Before;
import java.io.IOException; import java.io.IOException;
@ -67,7 +67,7 @@ import static org.mockito.Mockito.when;
/** /**
* Test and demonstrates how {@link RestHighLevelClient} can be extended to support custom endpoints. * Test and demonstrates how {@link RestHighLevelClient} can be extended to support custom endpoints.
*/ */
public class CustomRestHighLevelClientTests extends ESTestCase { public class CustomRestHighLevelClientTests extends OpenSearchTestCase {
private static final String ENDPOINT = "/_custom"; private static final String ENDPOINT = "/_custom";

View File

@ -23,7 +23,7 @@ import org.opensearch.cluster.metadata.AliasMetadata;
import org.opensearch.common.xcontent.XContentParser; import org.opensearch.common.xcontent.XContentParser;
import org.opensearch.common.xcontent.json.JsonXContent; import org.opensearch.common.xcontent.json.JsonXContent;
import org.opensearch.rest.RestStatus; import org.opensearch.rest.RestStatus;
import org.elasticsearch.test.AbstractXContentTestCase; import org.opensearch.test.AbstractXContentTestCase;
import java.io.IOException; import java.io.IOException;
import java.util.HashMap; import java.util.HashMap;

View File

@ -66,7 +66,7 @@ import org.opensearch.common.settings.Settings;
import org.opensearch.common.unit.TimeValue; import org.opensearch.common.unit.TimeValue;
import org.opensearch.common.util.CollectionUtils; import org.opensearch.common.util.CollectionUtils;
import org.opensearch.common.xcontent.XContentType; import org.opensearch.common.xcontent.XContentType;
import org.elasticsearch.test.ESTestCase; import org.opensearch.test.OpenSearchTestCase;
import org.junit.Assert; import org.junit.Assert;
import java.io.IOException; import java.io.IOException;
@ -82,14 +82,14 @@ import static java.util.Collections.emptyList;
import static java.util.Collections.singletonList; import static java.util.Collections.singletonList;
import static org.opensearch.client.indices.RandomCreateIndexGenerator.randomAliases; import static org.opensearch.client.indices.RandomCreateIndexGenerator.randomAliases;
import static org.opensearch.client.indices.RandomCreateIndexGenerator.randomMapping; import static org.opensearch.client.indices.RandomCreateIndexGenerator.randomMapping;
import static org.elasticsearch.index.RandomCreateIndexGenerator.randomAlias; import static org.opensearch.index.RandomCreateIndexGenerator.randomAlias;
import static org.elasticsearch.index.RandomCreateIndexGenerator.randomIndexSettings; import static org.opensearch.index.RandomCreateIndexGenerator.randomIndexSettings;
import static org.elasticsearch.index.alias.RandomAliasActionsGenerator.randomAliasAction; import static org.opensearch.index.alias.RandomAliasActionsGenerator.randomAliasAction;
import static org.opensearch.rest.BaseRestHandler.INCLUDE_TYPE_NAME_PARAMETER; import static org.opensearch.rest.BaseRestHandler.INCLUDE_TYPE_NAME_PARAMETER;
import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.Matchers.nullValue; import static org.hamcrest.Matchers.nullValue;
public class IndicesRequestConvertersTests extends ESTestCase { public class IndicesRequestConvertersTests extends OpenSearchTestCase {
public void testAnalyzeRequest() throws Exception { public void testAnalyzeRequest() throws Exception {
AnalyzeRequest indexAnalyzeRequest AnalyzeRequest indexAnalyzeRequest
@ -174,7 +174,7 @@ public class IndicesRequestConvertersTests extends ESTestCase {
public void testCreateIndexWithTypes() throws IOException { public void testCreateIndexWithTypes() throws IOException {
org.opensearch.action.admin.indices.create.CreateIndexRequest createIndexRequest = org.opensearch.action.admin.indices.create.CreateIndexRequest createIndexRequest =
org.elasticsearch.index.RandomCreateIndexGenerator.randomCreateIndexRequest(); org.opensearch.index.RandomCreateIndexGenerator.randomCreateIndexRequest();
Map<String, String> expectedParams = new HashMap<>(); Map<String, String> expectedParams = new HashMap<>();
RequestConvertersTests.setRandomTimeout(createIndexRequest::timeout, AcknowledgedRequest.DEFAULT_ACK_TIMEOUT, expectedParams); RequestConvertersTests.setRandomTimeout(createIndexRequest::timeout, AcknowledgedRequest.DEFAULT_ACK_TIMEOUT, expectedParams);
@ -241,7 +241,7 @@ public class IndicesRequestConvertersTests extends ESTestCase {
String[] indices = RequestConvertersTests.randomIndicesNames(0, 5); String[] indices = RequestConvertersTests.randomIndicesNames(0, 5);
putMappingRequest.indices(indices); putMappingRequest.indices(indices);
String type = ESTestCase.randomAlphaOfLengthBetween(3, 10); String type = OpenSearchTestCase.randomAlphaOfLengthBetween(3, 10);
putMappingRequest.type(type); putMappingRequest.type(type);
Map<String, String> expectedParams = new HashMap<>(); Map<String, String> expectedParams = new HashMap<>();
@ -485,7 +485,7 @@ public class IndicesRequestConvertersTests extends ESTestCase {
} }
public void testGetSettings() throws IOException { public void testGetSettings() throws IOException {
String[] indicesUnderTest = ESTestCase.randomBoolean() ? null : RequestConvertersTests.randomIndicesNames(0, 5); String[] indicesUnderTest = OpenSearchTestCase.randomBoolean() ? null : RequestConvertersTests.randomIndicesNames(0, 5);
GetSettingsRequest getSettingsRequest = new GetSettingsRequest().indices(indicesUnderTest); GetSettingsRequest getSettingsRequest = new GetSettingsRequest().indices(indicesUnderTest);
@ -496,10 +496,10 @@ public class IndicesRequestConvertersTests extends ESTestCase {
RequestConvertersTests.setRandomLocal(getSettingsRequest::local, expectedParams); RequestConvertersTests.setRandomLocal(getSettingsRequest::local, expectedParams);
if (ESTestCase.randomBoolean()) { if (OpenSearchTestCase.randomBoolean()) {
// the request object will not have include_defaults present unless it is set to // the request object will not have include_defaults present unless it is set to
// true // true
getSettingsRequest.includeDefaults(ESTestCase.randomBoolean()); getSettingsRequest.includeDefaults(OpenSearchTestCase.randomBoolean());
if (getSettingsRequest.includeDefaults()) { if (getSettingsRequest.includeDefaults()) {
expectedParams.put("include_defaults", Boolean.toString(true)); expectedParams.put("include_defaults", Boolean.toString(true));
} }
@ -511,11 +511,11 @@ public class IndicesRequestConvertersTests extends ESTestCase {
} }
endpoint.add("_settings"); endpoint.add("_settings");
if (ESTestCase.randomBoolean()) { if (OpenSearchTestCase.randomBoolean()) {
String[] names = ESTestCase.randomBoolean() ? null : new String[ESTestCase.randomIntBetween(0, 3)]; String[] names = OpenSearchTestCase.randomBoolean() ? null : new String[OpenSearchTestCase.randomIntBetween(0, 3)];
if (names != null) { if (names != null) {
for (int x = 0; x < names.length; x++) { for (int x = 0; x < names.length; x++) {
names[x] = ESTestCase.randomAlphaOfLengthBetween(3, 10); names[x] = OpenSearchTestCase.randomAlphaOfLengthBetween(3, 10);
} }
} }
getSettingsRequest.names(names); getSettingsRequest.names(names);
@ -533,7 +533,7 @@ public class IndicesRequestConvertersTests extends ESTestCase {
} }
public void testGetIndex() throws IOException { public void testGetIndex() throws IOException {
String[] indicesUnderTest = ESTestCase.randomBoolean() ? null : RequestConvertersTests.randomIndicesNames(0, 5); String[] indicesUnderTest = OpenSearchTestCase.randomBoolean() ? null : RequestConvertersTests.randomIndicesNames(0, 5);
GetIndexRequest getIndexRequest = new GetIndexRequest(indicesUnderTest); GetIndexRequest getIndexRequest = new GetIndexRequest(indicesUnderTest);
@ -543,10 +543,10 @@ public class IndicesRequestConvertersTests extends ESTestCase {
RequestConvertersTests.setRandomLocal(getIndexRequest::local, expectedParams); RequestConvertersTests.setRandomLocal(getIndexRequest::local, expectedParams);
RequestConvertersTests.setRandomHumanReadable(getIndexRequest::humanReadable, expectedParams); RequestConvertersTests.setRandomHumanReadable(getIndexRequest::humanReadable, expectedParams);
if (ESTestCase.randomBoolean()) { if (OpenSearchTestCase.randomBoolean()) {
// the request object will not have include_defaults present unless it is set to // the request object will not have include_defaults present unless it is set to
// true // true
getIndexRequest.includeDefaults(ESTestCase.randomBoolean()); getIndexRequest.includeDefaults(OpenSearchTestCase.randomBoolean());
if (getIndexRequest.includeDefaults()) { if (getIndexRequest.includeDefaults()) {
expectedParams.put("include_defaults", Boolean.toString(true)); expectedParams.put("include_defaults", Boolean.toString(true));
} }
@ -566,7 +566,7 @@ public class IndicesRequestConvertersTests extends ESTestCase {
} }
public void testGetIndexWithTypes() throws IOException { public void testGetIndexWithTypes() throws IOException {
String[] indicesUnderTest = ESTestCase.randomBoolean() ? null : RequestConvertersTests.randomIndicesNames(0, 5); String[] indicesUnderTest = OpenSearchTestCase.randomBoolean() ? null : RequestConvertersTests.randomIndicesNames(0, 5);
org.opensearch.action.admin.indices.get.GetIndexRequest getIndexRequest = org.opensearch.action.admin.indices.get.GetIndexRequest getIndexRequest =
new org.opensearch.action.admin.indices.get.GetIndexRequest().indices(indicesUnderTest); new org.opensearch.action.admin.indices.get.GetIndexRequest().indices(indicesUnderTest);
@ -578,10 +578,10 @@ public class IndicesRequestConvertersTests extends ESTestCase {
RequestConvertersTests.setRandomHumanReadable(getIndexRequest::humanReadable, expectedParams); RequestConvertersTests.setRandomHumanReadable(getIndexRequest::humanReadable, expectedParams);
expectedParams.put(INCLUDE_TYPE_NAME_PARAMETER, "true"); expectedParams.put(INCLUDE_TYPE_NAME_PARAMETER, "true");
if (ESTestCase.randomBoolean()) { if (OpenSearchTestCase.randomBoolean()) {
// the request object will not have include_defaults present unless it is set to // the request object will not have include_defaults present unless it is set to
// true // true
getIndexRequest.includeDefaults(ESTestCase.randomBoolean()); getIndexRequest.includeDefaults(OpenSearchTestCase.randomBoolean());
if (getIndexRequest.includeDefaults()) { if (getIndexRequest.includeDefaults()) {
expectedParams.put("include_defaults", Boolean.toString(true)); expectedParams.put("include_defaults", Boolean.toString(true));
} }
@ -601,7 +601,7 @@ public class IndicesRequestConvertersTests extends ESTestCase {
} }
public void testDeleteIndexEmptyIndices() { public void testDeleteIndexEmptyIndices() {
String[] indices = ESTestCase.randomBoolean() ? null : Strings.EMPTY_ARRAY; String[] indices = OpenSearchTestCase.randomBoolean() ? null : Strings.EMPTY_ARRAY;
ActionRequestValidationException validationException = new DeleteIndexRequest(indices).validate(); ActionRequestValidationException validationException = new DeleteIndexRequest(indices).validate();
Assert.assertNotNull(validationException); Assert.assertNotNull(validationException);
} }
@ -626,7 +626,7 @@ public class IndicesRequestConvertersTests extends ESTestCase {
} }
public void testOpenIndexEmptyIndices() { public void testOpenIndexEmptyIndices() {
String[] indices = ESTestCase.randomBoolean() ? null : Strings.EMPTY_ARRAY; String[] indices = OpenSearchTestCase.randomBoolean() ? null : Strings.EMPTY_ARRAY;
ActionRequestValidationException validationException = new OpenIndexRequest(indices).validate(); ActionRequestValidationException validationException = new OpenIndexRequest(indices).validate();
Assert.assertNotNull(validationException); Assert.assertNotNull(validationException);
} }
@ -651,9 +651,9 @@ public class IndicesRequestConvertersTests extends ESTestCase {
} }
public void testRefresh() { public void testRefresh() {
String[] indices = ESTestCase.randomBoolean() ? null : RequestConvertersTests.randomIndicesNames(0, 5); String[] indices = OpenSearchTestCase.randomBoolean() ? null : RequestConvertersTests.randomIndicesNames(0, 5);
RefreshRequest refreshRequest; RefreshRequest refreshRequest;
if (ESTestCase.randomBoolean()) { if (OpenSearchTestCase.randomBoolean()) {
refreshRequest = new RefreshRequest(indices); refreshRequest = new RefreshRequest(indices);
} else { } else {
refreshRequest = new RefreshRequest(); refreshRequest = new RefreshRequest();
@ -674,9 +674,9 @@ public class IndicesRequestConvertersTests extends ESTestCase {
} }
public void testFlush() { public void testFlush() {
String[] indices = ESTestCase.randomBoolean() ? null : RequestConvertersTests.randomIndicesNames(0, 5); String[] indices = OpenSearchTestCase.randomBoolean() ? null : RequestConvertersTests.randomIndicesNames(0, 5);
FlushRequest flushRequest; FlushRequest flushRequest;
if (ESTestCase.randomBoolean()) { if (OpenSearchTestCase.randomBoolean()) {
flushRequest = new FlushRequest(indices); flushRequest = new FlushRequest(indices);
} else { } else {
flushRequest = new FlushRequest(); flushRequest = new FlushRequest();
@ -684,12 +684,12 @@ public class IndicesRequestConvertersTests extends ESTestCase {
} }
Map<String, String> expectedParams = new HashMap<>(); Map<String, String> expectedParams = new HashMap<>();
RequestConvertersTests.setRandomIndicesOptions(flushRequest::indicesOptions, flushRequest::indicesOptions, expectedParams); RequestConvertersTests.setRandomIndicesOptions(flushRequest::indicesOptions, flushRequest::indicesOptions, expectedParams);
if (ESTestCase.randomBoolean()) { if (OpenSearchTestCase.randomBoolean()) {
flushRequest.force(ESTestCase.randomBoolean()); flushRequest.force(OpenSearchTestCase.randomBoolean());
} }
expectedParams.put("force", Boolean.toString(flushRequest.force())); expectedParams.put("force", Boolean.toString(flushRequest.force()));
if (ESTestCase.randomBoolean()) { if (OpenSearchTestCase.randomBoolean()) {
flushRequest.waitIfOngoing(ESTestCase.randomBoolean()); flushRequest.waitIfOngoing(OpenSearchTestCase.randomBoolean());
} }
expectedParams.put("wait_if_ongoing", Boolean.toString(flushRequest.waitIfOngoing())); expectedParams.put("wait_if_ongoing", Boolean.toString(flushRequest.waitIfOngoing()));
@ -706,9 +706,9 @@ public class IndicesRequestConvertersTests extends ESTestCase {
} }
public void testSyncedFlush() { public void testSyncedFlush() {
String[] indices = ESTestCase.randomBoolean() ? null : RequestConvertersTests.randomIndicesNames(0, 5); String[] indices = OpenSearchTestCase.randomBoolean() ? null : RequestConvertersTests.randomIndicesNames(0, 5);
SyncedFlushRequest syncedFlushRequest; SyncedFlushRequest syncedFlushRequest;
if (ESTestCase.randomBoolean()) { if (OpenSearchTestCase.randomBoolean()) {
syncedFlushRequest = new SyncedFlushRequest(indices); syncedFlushRequest = new SyncedFlushRequest(indices);
} else { } else {
syncedFlushRequest = new SyncedFlushRequest(); syncedFlushRequest = new SyncedFlushRequest();
@ -730,9 +730,9 @@ public class IndicesRequestConvertersTests extends ESTestCase {
} }
public void testForceMerge() { public void testForceMerge() {
String[] indices = ESTestCase.randomBoolean() ? null : RequestConvertersTests.randomIndicesNames(0, 5); String[] indices = OpenSearchTestCase.randomBoolean() ? null : RequestConvertersTests.randomIndicesNames(0, 5);
ForceMergeRequest forceMergeRequest; ForceMergeRequest forceMergeRequest;
if (ESTestCase.randomBoolean()) { if (OpenSearchTestCase.randomBoolean()) {
forceMergeRequest = new ForceMergeRequest(indices); forceMergeRequest = new ForceMergeRequest(indices);
} else { } else {
forceMergeRequest = new ForceMergeRequest(); forceMergeRequest = new ForceMergeRequest();
@ -742,16 +742,16 @@ public class IndicesRequestConvertersTests extends ESTestCase {
Map<String, String> expectedParams = new HashMap<>(); Map<String, String> expectedParams = new HashMap<>();
RequestConvertersTests.setRandomIndicesOptions(forceMergeRequest::indicesOptions, forceMergeRequest::indicesOptions, RequestConvertersTests.setRandomIndicesOptions(forceMergeRequest::indicesOptions, forceMergeRequest::indicesOptions,
expectedParams); expectedParams);
if (ESTestCase.randomBoolean()) { if (OpenSearchTestCase.randomBoolean()) {
forceMergeRequest.maxNumSegments(ESTestCase.randomInt()); forceMergeRequest.maxNumSegments(OpenSearchTestCase.randomInt());
} }
expectedParams.put("max_num_segments", Integer.toString(forceMergeRequest.maxNumSegments())); expectedParams.put("max_num_segments", Integer.toString(forceMergeRequest.maxNumSegments()));
if (ESTestCase.randomBoolean()) { if (OpenSearchTestCase.randomBoolean()) {
forceMergeRequest.onlyExpungeDeletes(ESTestCase.randomBoolean()); forceMergeRequest.onlyExpungeDeletes(OpenSearchTestCase.randomBoolean());
} }
expectedParams.put("only_expunge_deletes", Boolean.toString(forceMergeRequest.onlyExpungeDeletes())); expectedParams.put("only_expunge_deletes", Boolean.toString(forceMergeRequest.onlyExpungeDeletes()));
if (ESTestCase.randomBoolean()) { if (OpenSearchTestCase.randomBoolean()) {
forceMergeRequest.flush(ESTestCase.randomBoolean()); forceMergeRequest.flush(OpenSearchTestCase.randomBoolean());
} }
expectedParams.put("flush", Boolean.toString(forceMergeRequest.flush())); expectedParams.put("flush", Boolean.toString(forceMergeRequest.flush()));
@ -768,9 +768,9 @@ public class IndicesRequestConvertersTests extends ESTestCase {
} }
public void testClearCache() { public void testClearCache() {
String[] indices = ESTestCase.randomBoolean() ? null : RequestConvertersTests.randomIndicesNames(0, 5); String[] indices = OpenSearchTestCase.randomBoolean() ? null : RequestConvertersTests.randomIndicesNames(0, 5);
ClearIndicesCacheRequest clearIndicesCacheRequest; ClearIndicesCacheRequest clearIndicesCacheRequest;
if (ESTestCase.randomBoolean()) { if (OpenSearchTestCase.randomBoolean()) {
clearIndicesCacheRequest = new ClearIndicesCacheRequest(indices); clearIndicesCacheRequest = new ClearIndicesCacheRequest(indices);
} else { } else {
clearIndicesCacheRequest = new ClearIndicesCacheRequest(); clearIndicesCacheRequest = new ClearIndicesCacheRequest();
@ -779,19 +779,19 @@ public class IndicesRequestConvertersTests extends ESTestCase {
Map<String, String> expectedParams = new HashMap<>(); Map<String, String> expectedParams = new HashMap<>();
RequestConvertersTests.setRandomIndicesOptions(clearIndicesCacheRequest::indicesOptions, clearIndicesCacheRequest::indicesOptions, RequestConvertersTests.setRandomIndicesOptions(clearIndicesCacheRequest::indicesOptions, clearIndicesCacheRequest::indicesOptions,
expectedParams); expectedParams);
if (ESTestCase.randomBoolean()) { if (OpenSearchTestCase.randomBoolean()) {
clearIndicesCacheRequest.queryCache(ESTestCase.randomBoolean()); clearIndicesCacheRequest.queryCache(OpenSearchTestCase.randomBoolean());
} }
expectedParams.put("query", Boolean.toString(clearIndicesCacheRequest.queryCache())); expectedParams.put("query", Boolean.toString(clearIndicesCacheRequest.queryCache()));
if (ESTestCase.randomBoolean()) { if (OpenSearchTestCase.randomBoolean()) {
clearIndicesCacheRequest.fieldDataCache(ESTestCase.randomBoolean()); clearIndicesCacheRequest.fieldDataCache(OpenSearchTestCase.randomBoolean());
} }
expectedParams.put("fielddata", Boolean.toString(clearIndicesCacheRequest.fieldDataCache())); expectedParams.put("fielddata", Boolean.toString(clearIndicesCacheRequest.fieldDataCache()));
if (ESTestCase.randomBoolean()) { if (OpenSearchTestCase.randomBoolean()) {
clearIndicesCacheRequest.requestCache(ESTestCase.randomBoolean()); clearIndicesCacheRequest.requestCache(OpenSearchTestCase.randomBoolean());
} }
expectedParams.put("request", Boolean.toString(clearIndicesCacheRequest.requestCache())); expectedParams.put("request", Boolean.toString(clearIndicesCacheRequest.requestCache()));
if (ESTestCase.randomBoolean()) { if (OpenSearchTestCase.randomBoolean()) {
clearIndicesCacheRequest.fields(RequestConvertersTests.randomIndicesNames(1, 5)); clearIndicesCacheRequest.fields(RequestConvertersTests.randomIndicesNames(1, 5));
expectedParams.put("fields", String.join(",", clearIndicesCacheRequest.fields())); expectedParams.put("fields", String.join(",", clearIndicesCacheRequest.fields()));
} }
@ -810,13 +810,13 @@ public class IndicesRequestConvertersTests extends ESTestCase {
public void testExistsAlias() { public void testExistsAlias() {
GetAliasesRequest getAliasesRequest = new GetAliasesRequest(); GetAliasesRequest getAliasesRequest = new GetAliasesRequest();
String[] indices = ESTestCase.randomBoolean() ? null : RequestConvertersTests.randomIndicesNames(0, 5); String[] indices = OpenSearchTestCase.randomBoolean() ? null : RequestConvertersTests.randomIndicesNames(0, 5);
getAliasesRequest.indices(indices); getAliasesRequest.indices(indices);
// the HEAD endpoint requires at least an alias or an index // the HEAD endpoint requires at least an alias or an index
boolean hasIndices = indices != null && indices.length > 0; boolean hasIndices = indices != null && indices.length > 0;
String[] aliases; String[] aliases;
if (hasIndices) { if (hasIndices) {
aliases = ESTestCase.randomBoolean() ? null : RequestConvertersTests.randomIndicesNames(0, 5); aliases = OpenSearchTestCase.randomBoolean() ? null : RequestConvertersTests.randomIndicesNames(0, 5);
} else { } else {
aliases = RequestConvertersTests.randomIndicesNames(1, 5); aliases = RequestConvertersTests.randomIndicesNames(1, 5);
} }
@ -878,11 +878,11 @@ public class IndicesRequestConvertersTests extends ESTestCase {
RequestConvertersTests.setRandomTimeout(s -> resizeRequest.setTimeout(TimeValue.parseTimeValue(s, "timeout")), RequestConvertersTests.setRandomTimeout(s -> resizeRequest.setTimeout(TimeValue.parseTimeValue(s, "timeout")),
resizeRequest.timeout(), expectedParams); resizeRequest.timeout(), expectedParams);
if (ESTestCase.randomBoolean()) { if (OpenSearchTestCase.randomBoolean()) {
if (ESTestCase.randomBoolean()) { if (OpenSearchTestCase.randomBoolean()) {
resizeRequest.setSettings(randomIndexSettings()); resizeRequest.setSettings(randomIndexSettings());
} }
if (ESTestCase.randomBoolean()) { if (OpenSearchTestCase.randomBoolean()) {
int count = randomIntBetween(0, 2); int count = randomIntBetween(0, 2);
for (int i = 0; i < count; i++) { for (int i = 0; i < count; i++) {
resizeRequest.setAliases(singletonList(randomAlias())); resizeRequest.setAliases(singletonList(randomAlias()));
@ -904,29 +904,29 @@ public class IndicesRequestConvertersTests extends ESTestCase {
} }
public void testRollover() throws IOException { public void testRollover() throws IOException {
RolloverRequest rolloverRequest = new RolloverRequest(ESTestCase.randomAlphaOfLengthBetween(3, 10), RolloverRequest rolloverRequest = new RolloverRequest(OpenSearchTestCase.randomAlphaOfLengthBetween(3, 10),
ESTestCase.randomBoolean() ? null : ESTestCase.randomAlphaOfLengthBetween(3, 10)); OpenSearchTestCase.randomBoolean() ? null : OpenSearchTestCase.randomAlphaOfLengthBetween(3, 10));
Map<String, String> expectedParams = new HashMap<>(); Map<String, String> expectedParams = new HashMap<>();
RequestConvertersTests.setRandomTimeout(rolloverRequest, AcknowledgedRequest.DEFAULT_ACK_TIMEOUT, expectedParams); RequestConvertersTests.setRandomTimeout(rolloverRequest, AcknowledgedRequest.DEFAULT_ACK_TIMEOUT, expectedParams);
RequestConvertersTests.setRandomMasterTimeout(rolloverRequest, expectedParams); RequestConvertersTests.setRandomMasterTimeout(rolloverRequest, expectedParams);
if (ESTestCase.randomBoolean()) { if (OpenSearchTestCase.randomBoolean()) {
rolloverRequest.dryRun(ESTestCase.randomBoolean()); rolloverRequest.dryRun(OpenSearchTestCase.randomBoolean());
if (rolloverRequest.isDryRun()) { if (rolloverRequest.isDryRun()) {
expectedParams.put("dry_run", "true"); expectedParams.put("dry_run", "true");
} }
} }
if (ESTestCase.randomBoolean()) { if (OpenSearchTestCase.randomBoolean()) {
rolloverRequest.addMaxIndexAgeCondition(new TimeValue(ESTestCase.randomNonNegativeLong())); rolloverRequest.addMaxIndexAgeCondition(new TimeValue(OpenSearchTestCase.randomNonNegativeLong()));
} }
if (ESTestCase.randomBoolean()) { if (OpenSearchTestCase.randomBoolean()) {
rolloverRequest.getCreateIndexRequest().mapping(randomMapping()); rolloverRequest.getCreateIndexRequest().mapping(randomMapping());
} }
if (ESTestCase.randomBoolean()) { if (OpenSearchTestCase.randomBoolean()) {
randomAliases(rolloverRequest.getCreateIndexRequest()); randomAliases(rolloverRequest.getCreateIndexRequest());
} }
if (ESTestCase.randomBoolean()) { if (OpenSearchTestCase.randomBoolean()) {
rolloverRequest.getCreateIndexRequest().settings( rolloverRequest.getCreateIndexRequest().settings(
org.elasticsearch.index.RandomCreateIndexGenerator.randomIndexSettings()); org.opensearch.index.RandomCreateIndexGenerator.randomIndexSettings());
} }
RequestConvertersTests.setRandomWaitForActiveShards(rolloverRequest.getCreateIndexRequest()::waitForActiveShards, expectedParams); RequestConvertersTests.setRandomWaitForActiveShards(rolloverRequest.getCreateIndexRequest()::waitForActiveShards, expectedParams);
@ -944,32 +944,32 @@ public class IndicesRequestConvertersTests extends ESTestCase {
public void testRolloverWithTypes() throws IOException { public void testRolloverWithTypes() throws IOException {
org.opensearch.action.admin.indices.rollover.RolloverRequest rolloverRequest = org.opensearch.action.admin.indices.rollover.RolloverRequest rolloverRequest =
new org.opensearch.action.admin.indices.rollover.RolloverRequest(ESTestCase.randomAlphaOfLengthBetween(3, 10), new org.opensearch.action.admin.indices.rollover.RolloverRequest(OpenSearchTestCase.randomAlphaOfLengthBetween(3, 10),
ESTestCase.randomBoolean() ? null : ESTestCase.randomAlphaOfLengthBetween(3, 10)); OpenSearchTestCase.randomBoolean() ? null : OpenSearchTestCase.randomAlphaOfLengthBetween(3, 10));
Map<String, String> expectedParams = new HashMap<>(); Map<String, String> expectedParams = new HashMap<>();
RequestConvertersTests.setRandomTimeout(rolloverRequest::timeout, rolloverRequest.timeout(), expectedParams); RequestConvertersTests.setRandomTimeout(rolloverRequest::timeout, rolloverRequest.timeout(), expectedParams);
RequestConvertersTests.setRandomMasterTimeout(rolloverRequest, expectedParams); RequestConvertersTests.setRandomMasterTimeout(rolloverRequest, expectedParams);
if (ESTestCase.randomBoolean()) { if (OpenSearchTestCase.randomBoolean()) {
rolloverRequest.dryRun(ESTestCase.randomBoolean()); rolloverRequest.dryRun(OpenSearchTestCase.randomBoolean());
if (rolloverRequest.isDryRun()) { if (rolloverRequest.isDryRun()) {
expectedParams.put("dry_run", "true"); expectedParams.put("dry_run", "true");
} }
} }
expectedParams.put(INCLUDE_TYPE_NAME_PARAMETER, "true"); expectedParams.put(INCLUDE_TYPE_NAME_PARAMETER, "true");
if (ESTestCase.randomBoolean()) { if (OpenSearchTestCase.randomBoolean()) {
rolloverRequest.addMaxIndexAgeCondition(new TimeValue(ESTestCase.randomNonNegativeLong())); rolloverRequest.addMaxIndexAgeCondition(new TimeValue(OpenSearchTestCase.randomNonNegativeLong()));
} }
if (ESTestCase.randomBoolean()) { if (OpenSearchTestCase.randomBoolean()) {
String type = ESTestCase.randomAlphaOfLengthBetween(3, 10); String type = OpenSearchTestCase.randomAlphaOfLengthBetween(3, 10);
rolloverRequest.getCreateIndexRequest().mapping(type, rolloverRequest.getCreateIndexRequest().mapping(type,
org.elasticsearch.index.RandomCreateIndexGenerator.randomMapping(type)); org.opensearch.index.RandomCreateIndexGenerator.randomMapping(type));
} }
if (ESTestCase.randomBoolean()) { if (OpenSearchTestCase.randomBoolean()) {
org.elasticsearch.index.RandomCreateIndexGenerator.randomAliases(rolloverRequest.getCreateIndexRequest()); org.opensearch.index.RandomCreateIndexGenerator.randomAliases(rolloverRequest.getCreateIndexRequest());
} }
if (ESTestCase.randomBoolean()) { if (OpenSearchTestCase.randomBoolean()) {
rolloverRequest.getCreateIndexRequest().settings( rolloverRequest.getCreateIndexRequest().settings(
org.elasticsearch.index.RandomCreateIndexGenerator.randomIndexSettings()); org.opensearch.index.RandomCreateIndexGenerator.randomIndexSettings());
} }
RequestConvertersTests.setRandomWaitForActiveShards(rolloverRequest.getCreateIndexRequest()::waitForActiveShards, expectedParams); RequestConvertersTests.setRandomWaitForActiveShards(rolloverRequest.getCreateIndexRequest()::waitForActiveShards, expectedParams);
@ -993,8 +993,8 @@ public class IndicesRequestConvertersTests extends ESTestCase {
RequestConvertersTests.setRandomIndicesOptions(getAliasesRequest::indicesOptions, getAliasesRequest::indicesOptions, RequestConvertersTests.setRandomIndicesOptions(getAliasesRequest::indicesOptions, getAliasesRequest::indicesOptions,
expectedParams); expectedParams);
String[] indices = ESTestCase.randomBoolean() ? null : RequestConvertersTests.randomIndicesNames(0, 2); String[] indices = OpenSearchTestCase.randomBoolean() ? null : RequestConvertersTests.randomIndicesNames(0, 2);
String[] aliases = ESTestCase.randomBoolean() ? null : RequestConvertersTests.randomIndicesNames(0, 2); String[] aliases = OpenSearchTestCase.randomBoolean() ? null : RequestConvertersTests.randomIndicesNames(0, 2);
getAliasesRequest.indices(indices); getAliasesRequest.indices(indices);
getAliasesRequest.aliases(aliases); getAliasesRequest.aliases(aliases);
@ -1017,15 +1017,15 @@ public class IndicesRequestConvertersTests extends ESTestCase {
} }
public void testIndexPutSettings() throws IOException { public void testIndexPutSettings() throws IOException {
String[] indices = ESTestCase.randomBoolean() ? null : RequestConvertersTests.randomIndicesNames(0, 2); String[] indices = OpenSearchTestCase.randomBoolean() ? null : RequestConvertersTests.randomIndicesNames(0, 2);
UpdateSettingsRequest updateSettingsRequest = new UpdateSettingsRequest(indices); UpdateSettingsRequest updateSettingsRequest = new UpdateSettingsRequest(indices);
Map<String, String> expectedParams = new HashMap<>(); Map<String, String> expectedParams = new HashMap<>();
RequestConvertersTests.setRandomMasterTimeout(updateSettingsRequest, expectedParams); RequestConvertersTests.setRandomMasterTimeout(updateSettingsRequest, expectedParams);
RequestConvertersTests.setRandomTimeout(updateSettingsRequest::timeout, AcknowledgedRequest.DEFAULT_ACK_TIMEOUT, expectedParams); RequestConvertersTests.setRandomTimeout(updateSettingsRequest::timeout, AcknowledgedRequest.DEFAULT_ACK_TIMEOUT, expectedParams);
RequestConvertersTests.setRandomIndicesOptions(updateSettingsRequest::indicesOptions, updateSettingsRequest::indicesOptions, RequestConvertersTests.setRandomIndicesOptions(updateSettingsRequest::indicesOptions, updateSettingsRequest::indicesOptions,
expectedParams); expectedParams);
if (ESTestCase.randomBoolean()) { if (OpenSearchTestCase.randomBoolean()) {
updateSettingsRequest.setPreserveExisting(ESTestCase.randomBoolean()); updateSettingsRequest.setPreserveExisting(OpenSearchTestCase.randomBoolean());
if (updateSettingsRequest.isPreserveExisting()) { if (updateSettingsRequest.isPreserveExisting()) {
expectedParams.put("preserve_existing", "true"); expectedParams.put("preserve_existing", "true");
} }
@ -1052,32 +1052,32 @@ public class IndicesRequestConvertersTests extends ESTestCase {
org.opensearch.action.admin.indices.template.put.PutIndexTemplateRequest putTemplateRequest = org.opensearch.action.admin.indices.template.put.PutIndexTemplateRequest putTemplateRequest =
new org.opensearch.action.admin.indices.template.put.PutIndexTemplateRequest() new org.opensearch.action.admin.indices.template.put.PutIndexTemplateRequest()
.name(ESTestCase.randomFrom(names.keySet())) .name(OpenSearchTestCase.randomFrom(names.keySet()))
.patterns(Arrays.asList(ESTestCase.generateRandomStringArray(20, 100, false, false))); .patterns(Arrays.asList(OpenSearchTestCase.generateRandomStringArray(20, 100, false, false)));
if (ESTestCase.randomBoolean()) { if (OpenSearchTestCase.randomBoolean()) {
putTemplateRequest.order(ESTestCase.randomInt()); putTemplateRequest.order(OpenSearchTestCase.randomInt());
} }
if (ESTestCase.randomBoolean()) { if (OpenSearchTestCase.randomBoolean()) {
putTemplateRequest.version(ESTestCase.randomInt()); putTemplateRequest.version(OpenSearchTestCase.randomInt());
} }
if (ESTestCase.randomBoolean()) { if (OpenSearchTestCase.randomBoolean()) {
putTemplateRequest.settings(Settings.builder().put("setting-" + ESTestCase.randomInt(), ESTestCase.randomTimeValue())); putTemplateRequest.settings(Settings.builder().put("setting-" + OpenSearchTestCase.randomInt(), OpenSearchTestCase.randomTimeValue()));
} }
Map<String, String> expectedParams = new HashMap<>(); Map<String, String> expectedParams = new HashMap<>();
if (ESTestCase.randomBoolean()) { if (OpenSearchTestCase.randomBoolean()) {
putTemplateRequest.mapping("doc-" + ESTestCase.randomInt(), putTemplateRequest.mapping("doc-" + OpenSearchTestCase.randomInt(),
"field-" + ESTestCase.randomInt(), "type=" + ESTestCase.randomFrom("text", "keyword")); "field-" + OpenSearchTestCase.randomInt(), "type=" + OpenSearchTestCase.randomFrom("text", "keyword"));
} }
expectedParams.put(INCLUDE_TYPE_NAME_PARAMETER, "true"); expectedParams.put(INCLUDE_TYPE_NAME_PARAMETER, "true");
if (ESTestCase.randomBoolean()) { if (OpenSearchTestCase.randomBoolean()) {
putTemplateRequest.alias(new Alias("alias-" + ESTestCase.randomInt())); putTemplateRequest.alias(new Alias("alias-" + OpenSearchTestCase.randomInt()));
} }
if (ESTestCase.randomBoolean()) { if (OpenSearchTestCase.randomBoolean()) {
expectedParams.put("create", Boolean.TRUE.toString()); expectedParams.put("create", Boolean.TRUE.toString());
putTemplateRequest.create(true); putTemplateRequest.create(true);
} }
if (ESTestCase.randomBoolean()) { if (OpenSearchTestCase.randomBoolean()) {
String cause = ESTestCase.randomUnicodeOfCodepointLengthBetween(1, 50); String cause = OpenSearchTestCase.randomUnicodeOfCodepointLengthBetween(1, 50);
putTemplateRequest.cause(cause); putTemplateRequest.cause(cause);
expectedParams.put("cause", cause); expectedParams.put("cause", cause);
} }
@ -1097,31 +1097,31 @@ public class IndicesRequestConvertersTests extends ESTestCase {
names.put("foo^bar", "foo%5Ebar"); names.put("foo^bar", "foo%5Ebar");
PutIndexTemplateRequest putTemplateRequest = PutIndexTemplateRequest putTemplateRequest =
new PutIndexTemplateRequest(ESTestCase.randomFrom(names.keySet())) new PutIndexTemplateRequest(OpenSearchTestCase.randomFrom(names.keySet()))
.patterns(Arrays.asList(ESTestCase.generateRandomStringArray(20, 100, false, false))); .patterns(Arrays.asList(OpenSearchTestCase.generateRandomStringArray(20, 100, false, false)));
if (ESTestCase.randomBoolean()) { if (OpenSearchTestCase.randomBoolean()) {
putTemplateRequest.order(ESTestCase.randomInt()); putTemplateRequest.order(OpenSearchTestCase.randomInt());
} }
if (ESTestCase.randomBoolean()) { if (OpenSearchTestCase.randomBoolean()) {
putTemplateRequest.version(ESTestCase.randomInt()); putTemplateRequest.version(OpenSearchTestCase.randomInt());
} }
if (ESTestCase.randomBoolean()) { if (OpenSearchTestCase.randomBoolean()) {
putTemplateRequest.settings(Settings.builder().put("setting-" + ESTestCase.randomInt(), ESTestCase.randomTimeValue())); putTemplateRequest.settings(Settings.builder().put("setting-" + OpenSearchTestCase.randomInt(), OpenSearchTestCase.randomTimeValue()));
} }
Map<String, String> expectedParams = new HashMap<>(); Map<String, String> expectedParams = new HashMap<>();
if (ESTestCase.randomBoolean()) { if (OpenSearchTestCase.randomBoolean()) {
putTemplateRequest.mapping("{ \"properties\": { \"field-" + ESTestCase.randomInt() + putTemplateRequest.mapping("{ \"properties\": { \"field-" + OpenSearchTestCase.randomInt() +
"\" : { \"type\" : \"" + ESTestCase.randomFrom("text", "keyword") + "\" }}}", XContentType.JSON); "\" : { \"type\" : \"" + OpenSearchTestCase.randomFrom("text", "keyword") + "\" }}}", XContentType.JSON);
} }
if (ESTestCase.randomBoolean()) { if (OpenSearchTestCase.randomBoolean()) {
putTemplateRequest.alias(new Alias("alias-" + ESTestCase.randomInt())); putTemplateRequest.alias(new Alias("alias-" + OpenSearchTestCase.randomInt()));
} }
if (ESTestCase.randomBoolean()) { if (OpenSearchTestCase.randomBoolean()) {
expectedParams.put("create", Boolean.TRUE.toString()); expectedParams.put("create", Boolean.TRUE.toString());
putTemplateRequest.create(true); putTemplateRequest.create(true);
} }
if (ESTestCase.randomBoolean()) { if (OpenSearchTestCase.randomBoolean()) {
String cause = ESTestCase.randomUnicodeOfCodepointLengthBetween(1, 50); String cause = OpenSearchTestCase.randomUnicodeOfCodepointLengthBetween(1, 50);
putTemplateRequest.cause(cause); putTemplateRequest.cause(cause);
expectedParams.put("cause", cause); expectedParams.put("cause", cause);
} }
@ -1133,10 +1133,10 @@ public class IndicesRequestConvertersTests extends ESTestCase {
RequestConvertersTests.assertToXContentBody(putTemplateRequest, request.getEntity()); RequestConvertersTests.assertToXContentBody(putTemplateRequest, request.getEntity());
} }
public void testValidateQuery() throws Exception { public void testValidateQuery() throws Exception {
String[] indices = ESTestCase.randomBoolean() ? null : RequestConvertersTests.randomIndicesNames(0, 5); String[] indices = OpenSearchTestCase.randomBoolean() ? null : RequestConvertersTests.randomIndicesNames(0, 5);
String[] types = ESTestCase.randomBoolean() ? ESTestCase.generateRandomStringArray(5, 5, false, false) : null; String[] types = OpenSearchTestCase.randomBoolean() ? OpenSearchTestCase.generateRandomStringArray(5, 5, false, false) : null;
ValidateQueryRequest validateQueryRequest; ValidateQueryRequest validateQueryRequest;
if (ESTestCase.randomBoolean()) { if (OpenSearchTestCase.randomBoolean()) {
validateQueryRequest = new ValidateQueryRequest(indices); validateQueryRequest = new ValidateQueryRequest(indices);
} else { } else {
validateQueryRequest = new ValidateQueryRequest(); validateQueryRequest = new ValidateQueryRequest();
@ -1146,9 +1146,9 @@ public class IndicesRequestConvertersTests extends ESTestCase {
Map<String, String> expectedParams = new HashMap<>(); Map<String, String> expectedParams = new HashMap<>();
RequestConvertersTests.setRandomIndicesOptions(validateQueryRequest::indicesOptions, validateQueryRequest::indicesOptions, RequestConvertersTests.setRandomIndicesOptions(validateQueryRequest::indicesOptions, validateQueryRequest::indicesOptions,
expectedParams); expectedParams);
validateQueryRequest.explain(ESTestCase.randomBoolean()); validateQueryRequest.explain(OpenSearchTestCase.randomBoolean());
validateQueryRequest.rewrite(ESTestCase.randomBoolean()); validateQueryRequest.rewrite(OpenSearchTestCase.randomBoolean());
validateQueryRequest.allShards(ESTestCase.randomBoolean()); validateQueryRequest.allShards(OpenSearchTestCase.randomBoolean());
expectedParams.put("explain", Boolean.toString(validateQueryRequest.explain())); expectedParams.put("explain", Boolean.toString(validateQueryRequest.explain()));
expectedParams.put("rewrite", Boolean.toString(validateQueryRequest.rewrite())); expectedParams.put("rewrite", Boolean.toString(validateQueryRequest.rewrite()));
expectedParams.put("all_shards", Boolean.toString(validateQueryRequest.allShards())); expectedParams.put("all_shards", Boolean.toString(validateQueryRequest.allShards()));
@ -1174,7 +1174,7 @@ public class IndicesRequestConvertersTests extends ESTestCase {
encodes.put("template#1", "template%231"); encodes.put("template#1", "template%231");
encodes.put("template-*", "template-*"); encodes.put("template-*", "template-*");
encodes.put("foo^bar", "foo%5Ebar"); encodes.put("foo^bar", "foo%5Ebar");
List<String> names = ESTestCase.randomSubsetOf(1, encodes.keySet()); List<String> names = OpenSearchTestCase.randomSubsetOf(1, encodes.keySet());
GetIndexTemplatesRequest getTemplatesRequest = new GetIndexTemplatesRequest(names); GetIndexTemplatesRequest getTemplatesRequest = new GetIndexTemplatesRequest(names);
Map<String, String> expectedParams = new HashMap<>(); Map<String, String> expectedParams = new HashMap<>();
RequestConvertersTests.setRandomMasterTimeout(getTemplatesRequest::setMasterNodeTimeout, expectedParams); RequestConvertersTests.setRandomMasterTimeout(getTemplatesRequest::setMasterNodeTimeout, expectedParams);
@ -1194,11 +1194,11 @@ public class IndicesRequestConvertersTests extends ESTestCase {
} }
public void testTemplatesExistRequest() { public void testTemplatesExistRequest() {
final int numberOfNames = ESTestCase.usually() final int numberOfNames = OpenSearchTestCase.usually()
? 1 ? 1
: ESTestCase.randomIntBetween(2, 20); : OpenSearchTestCase.randomIntBetween(2, 20);
final List<String> names = Arrays.asList(ESTestCase.randomArray(numberOfNames, numberOfNames, String[]::new, final List<String> names = Arrays.asList(OpenSearchTestCase.randomArray(numberOfNames, numberOfNames, String[]::new,
() -> ESTestCase.randomAlphaOfLengthBetween(1, 100))); () -> OpenSearchTestCase.randomAlphaOfLengthBetween(1, 100)));
final Map<String, String> expectedParams = new HashMap<>(); final Map<String, String> expectedParams = new HashMap<>();
final IndexTemplatesExistRequest indexTemplatesExistRequest = new IndexTemplatesExistRequest(names); final IndexTemplatesExistRequest indexTemplatesExistRequest = new IndexTemplatesExistRequest(names);
RequestConvertersTests.setRandomMasterTimeout(indexTemplatesExistRequest::setMasterNodeTimeout, expectedParams); RequestConvertersTests.setRandomMasterTimeout(indexTemplatesExistRequest::setMasterNodeTimeout, expectedParams);

View File

@ -31,7 +31,7 @@ import org.elasticsearch.client.Request;
import org.opensearch.action.support.master.AcknowledgedRequest; import org.opensearch.action.support.master.AcknowledgedRequest;
import org.opensearch.common.bytes.BytesArray; import org.opensearch.common.bytes.BytesArray;
import org.opensearch.common.xcontent.XContentType; import org.opensearch.common.xcontent.XContentType;
import org.elasticsearch.test.ESTestCase; import org.opensearch.test.OpenSearchTestCase;
import org.junit.Assert; import org.junit.Assert;
import java.io.IOException; import java.io.IOException;
@ -40,7 +40,7 @@ import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.StringJoiner; import java.util.StringJoiner;
public class IngestRequestConvertersTests extends ESTestCase { public class IngestRequestConvertersTests extends OpenSearchTestCase {
public void testPutPipeline() throws IOException { public void testPutPipeline() throws IOException {
String pipelineId = "some_pipeline_id"; String pipelineId = "some_pipeline_id";
@ -92,8 +92,8 @@ public class IngestRequestConvertersTests extends ESTestCase {
} }
public void testSimulatePipeline() throws IOException { public void testSimulatePipeline() throws IOException {
String pipelineId = ESTestCase.randomBoolean() ? "some_pipeline_id" : null; String pipelineId = OpenSearchTestCase.randomBoolean() ? "some_pipeline_id" : null;
boolean verbose = ESTestCase.randomBoolean(); boolean verbose = OpenSearchTestCase.randomBoolean();
String json = "{" String json = "{"
+ " \"pipeline\": {" + " \"pipeline\": {"
+ " \"description\": \"_description\"," + " \"description\": \"_description\","

View File

@ -29,7 +29,7 @@ import org.elasticsearch.client.RequestOptions;
import org.elasticsearch.client.Response; import org.elasticsearch.client.Response;
import org.elasticsearch.client.RestClient; import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.WarningFailureException; import org.elasticsearch.client.WarningFailureException;
import org.elasticsearch.test.ESTestCase; import org.opensearch.test.OpenSearchTestCase;
import org.junit.Before; import org.junit.Before;
import java.io.IOException; import java.io.IOException;
@ -42,7 +42,7 @@ import static org.mockito.Mockito.doThrow;
import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when; import static org.mockito.Mockito.when;
public class MockRestHighLevelTests extends ESTestCase { public class MockRestHighLevelTests extends OpenSearchTestCase {
private RestHighLevelClient client; private RestHighLevelClient client;
private static final List<String> WARNINGS = Collections.singletonList("Some Warning"); private static final List<String> WARNINGS = Collections.singletonList("Some Warning");

View File

@ -47,7 +47,7 @@ import org.opensearch.ingest.Pipeline;
import org.opensearch.search.SearchHit; import org.opensearch.search.SearchHit;
import org.opensearch.search.SearchModule; import org.opensearch.search.SearchModule;
import org.opensearch.tasks.TaskId; import org.opensearch.tasks.TaskId;
import org.elasticsearch.test.rest.ESRestTestCase; import org.opensearch.test.rest.OpenSearchRestTestCase;
import org.junit.AfterClass; import org.junit.AfterClass;
import org.junit.Before; import org.junit.Before;
@ -71,7 +71,7 @@ import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.lessThan; import static org.hamcrest.Matchers.lessThan;
import static org.hamcrest.Matchers.notNullValue; import static org.hamcrest.Matchers.notNullValue;
public abstract class OpenSearchRestHighLevelClientTestCase extends ESRestTestCase { public abstract class OpenSearchRestHighLevelClientTestCase extends OpenSearchRestTestCase {
protected static final String CONFLICT_PIPELINE_ID = "conflict_pipeline"; protected static final String CONFLICT_PIPELINE_ID = "conflict_pipeline";

View File

@ -27,7 +27,6 @@ import org.apache.http.client.methods.HttpPost;
import org.apache.http.client.methods.HttpPut; import org.apache.http.client.methods.HttpPut;
import org.apache.http.nio.entity.NByteArrayEntity; import org.apache.http.nio.entity.NByteArrayEntity;
import org.apache.http.util.EntityUtils; import org.apache.http.util.EntityUtils;
import org.opensearch.client.Request;
import org.opensearch.action.DocWriteRequest; import org.opensearch.action.DocWriteRequest;
import org.opensearch.action.admin.cluster.storedscripts.DeleteStoredScriptRequest; import org.opensearch.action.admin.cluster.storedscripts.DeleteStoredScriptRequest;
import org.opensearch.action.admin.cluster.storedscripts.GetStoredScriptRequest; import org.opensearch.action.admin.cluster.storedscripts.GetStoredScriptRequest;
@ -104,8 +103,8 @@ import org.opensearch.search.rescore.QueryRescorerBuilder;
import org.opensearch.search.suggest.SuggestBuilder; import org.opensearch.search.suggest.SuggestBuilder;
import org.opensearch.search.suggest.completion.CompletionSuggestionBuilder; import org.opensearch.search.suggest.completion.CompletionSuggestionBuilder;
import org.opensearch.tasks.TaskId; import org.opensearch.tasks.TaskId;
import org.elasticsearch.test.ESTestCase; import org.opensearch.test.OpenSearchTestCase;
import org.elasticsearch.test.RandomObjects; import org.opensearch.test.RandomObjects;
import org.hamcrest.Matchers; import org.hamcrest.Matchers;
import java.io.IOException; import java.io.IOException;
@ -130,13 +129,13 @@ import static org.opensearch.client.RequestConverters.REQUEST_BODY_CONTENT_TYPE;
import static org.opensearch.client.RequestConverters.enforceSameContentType; import static org.opensearch.client.RequestConverters.enforceSameContentType;
import static org.opensearch.index.query.QueryBuilders.matchAllQuery; import static org.opensearch.index.query.QueryBuilders.matchAllQuery;
import static org.opensearch.search.RandomSearchRequestGenerator.randomSearchRequest; import static org.opensearch.search.RandomSearchRequestGenerator.randomSearchRequest;
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertToXContentEquivalent; import static org.opensearch.test.hamcrest.OpenSearchAssertions.assertToXContentEquivalent;
import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.Matchers.hasEntry; import static org.hamcrest.Matchers.hasEntry;
import static org.hamcrest.Matchers.hasKey; import static org.hamcrest.Matchers.hasKey;
import static org.hamcrest.Matchers.nullValue; import static org.hamcrest.Matchers.nullValue;
public class RequestConvertersTests extends ESTestCase { public class RequestConvertersTests extends OpenSearchTestCase {
private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(RequestConvertersTests.class); private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(RequestConvertersTests.class);

View File

@ -26,7 +26,7 @@ import org.elasticsearch.client.RestClient;
import org.opensearch.common.ParseField; import org.opensearch.common.ParseField;
import org.opensearch.common.xcontent.NamedXContentRegistry; import org.opensearch.common.xcontent.NamedXContentRegistry;
import org.opensearch.common.xcontent.XContentParser; import org.opensearch.common.xcontent.XContentParser;
import org.elasticsearch.test.ESTestCase; import org.opensearch.test.OpenSearchTestCase;
import org.junit.Before; import org.junit.Before;
import java.io.IOException; import java.io.IOException;
@ -40,7 +40,7 @@ import static org.mockito.Mockito.mock;
* This test works against a {@link RestHighLevelClient} subclass that simulates how custom response sections returned by * This test works against a {@link RestHighLevelClient} subclass that simulates how custom response sections returned by
* OpenSearch plugins can be parsed using the high level client. * OpenSearch plugins can be parsed using the high level client.
*/ */
public class RestHighLevelClientExtTests extends ESTestCase { public class RestHighLevelClientExtTests extends OpenSearchTestCase {
private RestHighLevelClient restHighLevelClient; private RestHighLevelClient restHighLevelClient;

View File

@ -33,13 +33,6 @@ import org.apache.http.message.BasicRequestLine;
import org.apache.http.message.BasicStatusLine; import org.apache.http.message.BasicStatusLine;
import org.apache.http.nio.entity.NByteArrayEntity; import org.apache.http.nio.entity.NByteArrayEntity;
import org.apache.http.nio.entity.NStringEntity; import org.apache.http.nio.entity.NStringEntity;
import org.opensearch.client.Cancellable;
import org.opensearch.client.Request;
import org.opensearch.client.RequestOptions;
import org.opensearch.client.Response;
import org.opensearch.client.ResponseException;
import org.opensearch.client.ResponseListener;
import org.opensearch.client.RestClient;
import org.opensearch.OpenSearchException; import org.opensearch.OpenSearchException;
import org.opensearch.action.ActionListener; import org.opensearch.action.ActionListener;
import org.opensearch.action.ActionRequest; import org.opensearch.action.ActionRequest;
@ -77,10 +70,10 @@ import org.opensearch.search.aggregations.Aggregation;
import org.opensearch.search.aggregations.InternalAggregations; import org.opensearch.search.aggregations.InternalAggregations;
import org.opensearch.search.aggregations.matrix.stats.MatrixStatsAggregationBuilder; import org.opensearch.search.aggregations.matrix.stats.MatrixStatsAggregationBuilder;
import org.opensearch.search.suggest.Suggest; import org.opensearch.search.suggest.Suggest;
import org.elasticsearch.test.ESTestCase; import org.opensearch.test.OpenSearchTestCase;
import org.elasticsearch.test.InternalAggregationTestCase; import org.opensearch.test.InternalAggregationTestCase;
import org.elasticsearch.test.rest.yaml.restspec.ClientYamlSuiteRestApi; import org.opensearch.test.rest.yaml.restspec.ClientYamlSuiteRestApi;
import org.elasticsearch.test.rest.yaml.restspec.ClientYamlSuiteRestSpec; import org.opensearch.test.rest.yaml.restspec.ClientYamlSuiteRestSpec;
import org.hamcrest.Matchers; import org.hamcrest.Matchers;
import org.junit.Before; import org.junit.Before;
@ -112,7 +105,7 @@ import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when; import static org.mockito.Mockito.when;
public class RestHighLevelClientTests extends ESTestCase { public class RestHighLevelClientTests extends OpenSearchTestCase {
private static final String SUBMIT_TASK_PREFIX = "submit_"; private static final String SUBMIT_TASK_PREFIX = "submit_";
private static final String SUBMIT_TASK_SUFFIX = "_task"; private static final String SUBMIT_TASK_SUFFIX = "_task";

View File

@ -21,7 +21,6 @@ package org.opensearch.client;
import org.apache.http.client.methods.HttpPost; import org.apache.http.client.methods.HttpPost;
import org.apache.http.client.methods.HttpPut; import org.apache.http.client.methods.HttpPut;
import org.opensearch.client.Request;
import org.opensearch.OpenSearchException; import org.opensearch.OpenSearchException;
import org.opensearch.OpenSearchStatusException; import org.opensearch.OpenSearchStatusException;
import org.opensearch.action.explain.ExplainRequest; import org.opensearch.action.explain.ExplainRequest;
@ -96,7 +95,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import static org.opensearch.common.xcontent.XContentFactory.jsonBuilder; import static org.opensearch.common.xcontent.XContentFactory.jsonBuilder;
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertToXContentEquivalent; import static org.opensearch.test.hamcrest.OpenSearchAssertions.assertToXContentEquivalent;
import static org.hamcrest.Matchers.arrayContaining; import static org.hamcrest.Matchers.arrayContaining;
import static org.hamcrest.Matchers.both; import static org.hamcrest.Matchers.both;
import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.containsString;

View File

@ -38,7 +38,7 @@ import org.opensearch.common.io.PathUtils;
import org.opensearch.common.settings.Settings; import org.opensearch.common.settings.Settings;
import org.opensearch.common.unit.ByteSizeUnit; import org.opensearch.common.unit.ByteSizeUnit;
import org.opensearch.repositories.fs.FsRepository; import org.opensearch.repositories.fs.FsRepository;
import org.elasticsearch.test.ESTestCase; import org.opensearch.test.OpenSearchTestCase;
import java.io.IOException; import java.io.IOException;
import java.nio.file.Path; import java.nio.file.Path;
@ -51,7 +51,7 @@ import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.nullValue; import static org.hamcrest.Matchers.nullValue;
public class SnapshotRequestConvertersTests extends ESTestCase { public class SnapshotRequestConvertersTests extends OpenSearchTestCase {
public void testGetRepositories() { public void testGetRepositories() {
Map<String, String> expectedParams = new HashMap<>(); Map<String, String> expectedParams = new HashMap<>();

View File

@ -34,7 +34,7 @@ import java.util.Collections;
import java.util.Map; import java.util.Map;
import static org.opensearch.common.xcontent.support.XContentMapValues.extractValue; import static org.opensearch.common.xcontent.support.XContentMapValues.extractValue;
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked; import static org.opensearch.test.hamcrest.OpenSearchAssertions.assertAcked;
import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.equalTo;
public class StoredScriptsIT extends OpenSearchRestHighLevelClientTestCase { public class StoredScriptsIT extends OpenSearchRestHighLevelClientTestCase {

View File

@ -32,7 +32,7 @@ import org.opensearch.common.xcontent.XContentType;
import org.elasticsearch.index.shard.ShardId; import org.elasticsearch.index.shard.ShardId;
import org.elasticsearch.indices.flush.ShardsSyncedFlushResult; import org.elasticsearch.indices.flush.ShardsSyncedFlushResult;
import org.elasticsearch.indices.flush.SyncedFlushService; import org.elasticsearch.indices.flush.SyncedFlushService;
import org.elasticsearch.test.ESTestCase; import org.opensearch.test.OpenSearchTestCase;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
@ -42,7 +42,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
public class SyncedFlushResponseTests extends ESTestCase { public class SyncedFlushResponseTests extends OpenSearchTestCase {
public void testXContentSerialization() throws IOException { public void testXContentSerialization() throws IOException {
final XContentType xContentType = randomFrom(XContentType.values()); final XContentType xContentType = randomFrom(XContentType.values());

View File

@ -25,7 +25,7 @@ import org.elasticsearch.client.Request;
import org.opensearch.action.admin.cluster.node.tasks.list.ListTasksRequest; import org.opensearch.action.admin.cluster.node.tasks.list.ListTasksRequest;
import org.opensearch.client.tasks.CancelTasksRequest; import org.opensearch.client.tasks.CancelTasksRequest;
import org.opensearch.tasks.TaskId; import org.opensearch.tasks.TaskId;
import org.elasticsearch.test.ESTestCase; import org.opensearch.test.OpenSearchTestCase;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
@ -34,7 +34,7 @@ import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.Matchers.notNullValue; import static org.hamcrest.Matchers.notNullValue;
import static org.hamcrest.Matchers.nullValue; import static org.hamcrest.Matchers.nullValue;
public class TasksRequestConvertersTests extends ESTestCase { public class TasksRequestConvertersTests extends OpenSearchTestCase {
public void testCancelTasks() { public void testCancelTasks() {
Map<String, String> expectedParams = new HashMap<>(); Map<String, String> expectedParams = new HashMap<>();

View File

@ -20,9 +20,9 @@
package org.opensearch.client; package org.opensearch.client;
import org.opensearch.common.unit.TimeValue; import org.opensearch.common.unit.TimeValue;
import org.elasticsearch.test.ESTestCase; import org.opensearch.test.OpenSearchTestCase;
public class TimedRequestTests extends ESTestCase { public class TimedRequestTests extends OpenSearchTestCase {
public void testDefaults() { public void testDefaults() {
TimedRequest timedRequest = new TimedRequest(){}; TimedRequest timedRequest = new TimedRequest(){};

View File

@ -19,14 +19,14 @@
package org.opensearch.client; package org.opensearch.client;
import org.elasticsearch.test.ESTestCase; import org.opensearch.test.OpenSearchTestCase;
import java.util.Arrays; import java.util.Arrays;
import static org.hamcrest.Matchers.contains; import static org.hamcrest.Matchers.contains;
import static org.hamcrest.Matchers.hasSize; import static org.hamcrest.Matchers.hasSize;
public class ValidationExceptionTests extends ESTestCase { public class ValidationExceptionTests extends OpenSearchTestCase {
private static final String ERROR = "some-error"; private static final String ERROR = "some-error";
private static final String OTHER_ERROR = "some-other-error"; private static final String OTHER_ERROR = "some-other-error";

View File

@ -37,7 +37,7 @@ import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import static org.elasticsearch.test.EqualsHashCodeTestUtils.checkEqualsAndHashCode; import static org.opensearch.test.EqualsHashCodeTestUtils.checkEqualsAndHashCode;
import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.equalTo;
// similar to SearchRequestTests as CountRequest inline several members (and functionality) from SearchRequest // similar to SearchRequestTests as CountRequest inline several members (and functionality) from SearchRequest

View File

@ -24,20 +24,20 @@ import org.opensearch.cluster.metadata.IndexMetadata;
import org.opensearch.common.ParsingException; import org.opensearch.common.ParsingException;
import org.opensearch.common.xcontent.ToXContent; import org.opensearch.common.xcontent.ToXContent;
import org.opensearch.common.xcontent.XContentBuilder; import org.opensearch.common.xcontent.XContentBuilder;
import org.elasticsearch.index.Index; import org.opensearch.index.Index;
import org.elasticsearch.index.shard.ShardId; import org.opensearch.index.shard.ShardId;
import org.opensearch.rest.action.RestActions; import org.opensearch.rest.action.RestActions;
import org.opensearch.search.SearchShardTarget; import org.opensearch.search.SearchShardTarget;
import org.elasticsearch.test.ESTestCase; import org.opensearch.test.OpenSearchTestCase;
import java.io.IOException; import java.io.IOException;
import static org.elasticsearch.test.AbstractXContentTestCase.xContentTester; import static org.opensearch.test.AbstractXContentTestCase.xContentTester;
public class CountResponseTests extends ESTestCase { public class CountResponseTests extends OpenSearchTestCase {
// Not comparing XContent for equivalence as we cannot compare the ShardSearchFailure#cause, because it will be wrapped in an outer // Not comparing XContent for equivalence as we cannot compare the ShardSearchFailure#cause, because it will be wrapped in an outer
// ElasticSearchException. Best effort: try to check that the original message appears somewhere in the rendered xContent // OpenSearchException. Best effort: try to check that the original message appears somewhere in the rendered xContent
// For more see ShardSearchFailureTests. // For more see ShardSearchFailureTests.
public void testFromXContent() throws IOException { public void testFromXContent() throws IOException {
xContentTester( xContentTester(

View File

@ -25,7 +25,7 @@ import org.opensearch.client.AbstractResponseTestCase;
import org.opensearch.cluster.ClusterName; import org.opensearch.cluster.ClusterName;
import org.opensearch.common.xcontent.XContentParser; import org.opensearch.common.xcontent.XContentParser;
import org.opensearch.common.xcontent.XContentType; import org.opensearch.common.xcontent.XContentType;
import org.elasticsearch.test.VersionUtils; import org.opensearch.test.VersionUtils;
import java.io.IOException; import java.io.IOException;
import java.util.Date; import java.util.Date;

View File

@ -20,15 +20,15 @@
package org.opensearch.client.core; package org.opensearch.client.core;
import org.opensearch.common.xcontent.XContentBuilder; import org.opensearch.common.xcontent.XContentBuilder;
import org.elasticsearch.test.ESTestCase; import org.opensearch.test.OpenSearchTestCase;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import static org.elasticsearch.test.AbstractXContentTestCase.xContentTester; import static org.opensearch.test.AbstractXContentTestCase.xContentTester;
public class MultiTermVectorsResponseTests extends ESTestCase { public class MultiTermVectorsResponseTests extends OpenSearchTestCase {
public void testFromXContent() throws IOException { public void testFromXContent() throws IOException {
xContentTester( xContentTester(

View File

@ -19,13 +19,13 @@
package org.opensearch.client.core; package org.opensearch.client.core;
import org.opensearch.common.xcontent.XContentBuilder; import org.opensearch.common.xcontent.XContentBuilder;
import org.elasticsearch.test.ESTestCase; import org.opensearch.test.OpenSearchTestCase;
import java.io.IOException; import java.io.IOException;
import static org.elasticsearch.test.AbstractXContentTestCase.xContentTester; import static org.opensearch.test.AbstractXContentTestCase.xContentTester;
public class ShardsAcknowledgedResponseTests extends ESTestCase { public class ShardsAcknowledgedResponseTests extends OpenSearchTestCase {
public void testFromXContent() throws IOException { public void testFromXContent() throws IOException {
xContentTester(this::createParser, xContentTester(this::createParser,

View File

@ -20,7 +20,7 @@
package org.opensearch.client.core; package org.opensearch.client.core;
import org.opensearch.common.xcontent.XContentBuilder; import org.opensearch.common.xcontent.XContentBuilder;
import org.elasticsearch.test.ESTestCase; import org.opensearch.test.OpenSearchTestCase;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -28,9 +28,9 @@ import java.io.IOException;
import java.util.Collections; import java.util.Collections;
import java.util.Comparator; import java.util.Comparator;
import static org.elasticsearch.test.AbstractXContentTestCase.xContentTester; import static org.opensearch.test.AbstractXContentTestCase.xContentTester;
public class TermVectorsResponseTests extends ESTestCase { public class TermVectorsResponseTests extends OpenSearchTestCase {
public void testFromXContent() throws IOException { public void testFromXContent() throws IOException {
xContentTester( xContentTester(

View File

@ -28,15 +28,15 @@ import org.opensearch.tasks.RawTaskStatus;
import org.opensearch.tasks.Task; import org.opensearch.tasks.Task;
import org.opensearch.tasks.TaskId; import org.opensearch.tasks.TaskId;
import org.opensearch.tasks.TaskInfo; import org.opensearch.tasks.TaskInfo;
import org.elasticsearch.test.ESTestCase; import org.opensearch.test.OpenSearchTestCase;
import java.io.IOException; import java.io.IOException;
import java.util.Collections; import java.util.Collections;
import java.util.Map; import java.util.Map;
import static org.elasticsearch.test.AbstractXContentTestCase.xContentTester; import static org.opensearch.test.AbstractXContentTestCase.xContentTester;
public class GetTaskResponseTests extends ESTestCase { public class GetTaskResponseTests extends OpenSearchTestCase {
public void testFromXContent() throws IOException { public void testFromXContent() throws IOException {
xContentTester( xContentTester(

View File

@ -32,7 +32,7 @@ import org.opensearch.join.query.JoinQueryBuilders;
import org.elasticsearch.index.query.RankFeatureQueryBuilders; import org.elasticsearch.index.query.RankFeatureQueryBuilders;
import org.opensearch.script.Script; import org.opensearch.script.Script;
import org.opensearch.script.ScriptType; import org.opensearch.script.ScriptType;
import org.elasticsearch.test.ESTestCase; import org.opensearch.test.OpenSearchTestCase;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
@ -87,7 +87,7 @@ import static org.elasticsearch.index.query.functionscore.ScoreFunctionBuilders.
* compile and don't throw weird runtime exceptions. Assertions and example data would be nice, but * compile and don't throw weird runtime exceptions. Assertions and example data would be nice, but
* that is secondary. * that is secondary.
*/ */
public class QueryDSLDocumentationTests extends ESTestCase { public class QueryDSLDocumentationTests extends OpenSearchTestCase {
public void testBool() { public void testBool() {
// tag::bool // tag::bool
boolQuery() boolQuery()

View File

@ -45,7 +45,7 @@ import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import static org.opensearch.common.xcontent.support.XContentMapValues.extractValue; import static org.opensearch.common.xcontent.support.XContentMapValues.extractValue;
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked; import static org.opensearch.test.hamcrest.OpenSearchAssertions.assertAcked;
import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.equalTo;
/** /**

View File

@ -23,7 +23,7 @@ import org.opensearch.action.admin.indices.analyze.AnalyzeAction;
import org.opensearch.client.AbstractResponseTestCase; import org.opensearch.client.AbstractResponseTestCase;
import org.opensearch.common.xcontent.XContentParser; import org.opensearch.common.xcontent.XContentParser;
import org.opensearch.common.xcontent.XContentType; import org.opensearch.common.xcontent.XContentType;
import org.elasticsearch.test.RandomObjects; import org.opensearch.test.RandomObjects;
import java.io.IOException; import java.io.IOException;
import java.util.Arrays; import java.util.Arrays;

View File

@ -24,13 +24,13 @@ import org.opensearch.client.TimedRequest;
import org.opensearch.client.ValidationException; import org.opensearch.client.ValidationException;
import org.opensearch.common.Strings; import org.opensearch.common.Strings;
import org.opensearch.common.unit.TimeValue; import org.opensearch.common.unit.TimeValue;
import org.elasticsearch.test.ESTestCase; import org.opensearch.test.OpenSearchTestCase;
import java.util.Optional; import java.util.Optional;
import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.equalTo;
public class CloseIndexRequestTests extends ESTestCase { public class CloseIndexRequestTests extends OpenSearchTestCase {
public void testIndices() { public void testIndices() {
String[] indices = generateRandomStringArray(5, 5, false, true); String[] indices = generateRandomStringArray(5, 5, false, true);

View File

@ -21,7 +21,7 @@ package org.opensearch.client.indices;
import org.opensearch.action.admin.indices.alias.Alias; import org.opensearch.action.admin.indices.alias.Alias;
import org.opensearch.common.xcontent.XContentParser; import org.opensearch.common.xcontent.XContentParser;
import org.elasticsearch.test.AbstractXContentTestCase; import org.opensearch.test.AbstractXContentTestCase;
import java.io.IOException; import java.io.IOException;
import java.util.Set; import java.util.Set;

View File

@ -25,16 +25,16 @@ import org.opensearch.cluster.metadata.Template;
import org.opensearch.common.compress.CompressedXContent; import org.opensearch.common.compress.CompressedXContent;
import org.opensearch.common.settings.Settings; import org.opensearch.common.settings.Settings;
import org.opensearch.common.xcontent.XContentBuilder; import org.opensearch.common.xcontent.XContentBuilder;
import org.elasticsearch.test.ESTestCase; import org.opensearch.test.OpenSearchTestCase;
import java.io.IOException; import java.io.IOException;
import java.util.Collections; import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import static org.elasticsearch.test.AbstractXContentTestCase.xContentTester; import static org.opensearch.test.AbstractXContentTestCase.xContentTester;
public class GetComponentTemplatesResponseTests extends ESTestCase { public class GetComponentTemplatesResponseTests extends OpenSearchTestCase {
public void testFromXContent() throws Exception { public void testFromXContent() throws Exception {
xContentTester( xContentTester(

View File

@ -21,7 +21,7 @@ package org.opensearch.client.indices;
import org.opensearch.cluster.metadata.ComposableIndexTemplate; import org.opensearch.cluster.metadata.ComposableIndexTemplate;
import org.opensearch.common.xcontent.XContentBuilder; import org.opensearch.common.xcontent.XContentBuilder;
import org.elasticsearch.test.ESTestCase; import org.opensearch.test.OpenSearchTestCase;
import java.io.IOException; import java.io.IOException;
import java.util.Arrays; import java.util.Arrays;
@ -31,9 +31,9 @@ import java.util.Map;
import static org.opensearch.client.indices.GetComponentTemplatesResponseTests.randomMeta; import static org.opensearch.client.indices.GetComponentTemplatesResponseTests.randomMeta;
import static org.opensearch.client.indices.GetComponentTemplatesResponseTests.randomTemplate; import static org.opensearch.client.indices.GetComponentTemplatesResponseTests.randomTemplate;
import static org.elasticsearch.test.AbstractXContentTestCase.xContentTester; import static org.opensearch.test.AbstractXContentTestCase.xContentTester;
public class GetComposableIndexTemplatesResponseTests extends ESTestCase { public class GetComposableIndexTemplatesResponseTests extends OpenSearchTestCase {
public void testFromXContent() throws Exception { public void testFromXContent() throws Exception {
xContentTester( xContentTester(

View File

@ -22,16 +22,16 @@ package org.opensearch.client.indices;
import org.opensearch.client.indices.GetFieldMappingsResponse.FieldMappingMetadata; import org.opensearch.client.indices.GetFieldMappingsResponse.FieldMappingMetadata;
import org.opensearch.common.bytes.BytesArray; import org.opensearch.common.bytes.BytesArray;
import org.opensearch.common.xcontent.XContentBuilder; import org.opensearch.common.xcontent.XContentBuilder;
import org.elasticsearch.test.ESTestCase; import org.opensearch.test.OpenSearchTestCase;
import java.io.IOException; import java.io.IOException;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.function.Predicate; import java.util.function.Predicate;
import static org.elasticsearch.test.AbstractXContentTestCase.xContentTester; import static org.opensearch.test.AbstractXContentTestCase.xContentTester;
public class GetFieldMappingsResponseTests extends ESTestCase { public class GetFieldMappingsResponseTests extends OpenSearchTestCase {
public void testFromXContent() throws IOException { public void testFromXContent() throws IOException {
xContentTester( xContentTester(

View File

@ -21,9 +21,9 @@ package org.opensearch.client.indices;
import org.opensearch.action.support.IndicesOptions; import org.opensearch.action.support.IndicesOptions;
import org.opensearch.client.indices.GetIndexRequest.Feature; import org.opensearch.client.indices.GetIndexRequest.Feature;
import org.elasticsearch.test.ESTestCase; import org.opensearch.test.OpenSearchTestCase;
public class GetIndexRequestTests extends ESTestCase { public class GetIndexRequestTests extends OpenSearchTestCase {
public void testIndices() { public void testIndices() {
String[] indices = generateRandomStringArray(5, 5, false, true); String[] indices = generateRandomStringArray(5, 5, false, true);

View File

@ -29,10 +29,10 @@ import org.opensearch.common.settings.Settings;
import org.opensearch.common.xcontent.ToXContent; import org.opensearch.common.xcontent.ToXContent;
import org.opensearch.common.xcontent.ToXContent.Params; import org.opensearch.common.xcontent.ToXContent.Params;
import org.opensearch.common.xcontent.XContentBuilder; import org.opensearch.common.xcontent.XContentBuilder;
import org.elasticsearch.index.RandomCreateIndexGenerator; import org.opensearch.index.RandomCreateIndexGenerator;
import org.elasticsearch.index.mapper.MapperService; import org.elasticsearch.index.mapper.MapperService;
import org.opensearch.rest.BaseRestHandler; import org.opensearch.rest.BaseRestHandler;
import org.elasticsearch.test.ESTestCase; import org.opensearch.test.OpenSearchTestCase;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
@ -44,9 +44,9 @@ import java.util.Locale;
import java.util.Map; import java.util.Map;
import java.util.Objects; import java.util.Objects;
import static org.elasticsearch.test.AbstractXContentTestCase.xContentTester; import static org.opensearch.test.AbstractXContentTestCase.xContentTester;
public class GetIndexResponseTests extends ESTestCase { public class GetIndexResponseTests extends OpenSearchTestCase {
// Because the client-side class does not have a toXContent method, we test xContent serialization by creating // Because the client-side class does not have a toXContent method, we test xContent serialization by creating
// a random client object, converting it to a server object then serializing it to xContent, and finally // a random client object, converting it to a server object then serializing it to xContent, and finally

View File

@ -34,7 +34,7 @@ import org.opensearch.common.xcontent.XContentHelper;
import org.opensearch.common.xcontent.XContentParser; import org.opensearch.common.xcontent.XContentParser;
import org.opensearch.common.xcontent.XContentType; import org.opensearch.common.xcontent.XContentType;
import org.elasticsearch.index.mapper.MapperService; import org.elasticsearch.index.mapper.MapperService;
import org.elasticsearch.test.ESTestCase; import org.opensearch.test.OpenSearchTestCase;
import java.io.IOException; import java.io.IOException;
import java.io.UncheckedIOException; import java.io.UncheckedIOException;
@ -49,12 +49,12 @@ import java.util.function.Predicate;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.IntStream; import java.util.stream.IntStream;
import static org.elasticsearch.index.RandomCreateIndexGenerator.randomIndexSettings; import static org.opensearch.index.RandomCreateIndexGenerator.randomIndexSettings;
import static org.elasticsearch.index.RandomCreateIndexGenerator.randomMappingFields; import static org.opensearch.index.RandomCreateIndexGenerator.randomMappingFields;
import static org.elasticsearch.test.AbstractXContentTestCase.xContentTester; import static org.opensearch.test.AbstractXContentTestCase.xContentTester;
import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.equalTo;
public class GetIndexTemplatesResponseTests extends ESTestCase { public class GetIndexTemplatesResponseTests extends OpenSearchTestCase {
static final String mappingString = "{\"properties\":{\"f1\": {\"type\":\"text\"},\"f2\": {\"type\":\"keyword\"}}}"; static final String mappingString = "{\"properties\":{\"f1\": {\"type\":\"text\"},\"f2\": {\"type\":\"keyword\"}}}";

View File

@ -26,7 +26,7 @@ import org.opensearch.common.xcontent.ToXContent.Params;
import org.opensearch.common.xcontent.XContentBuilder; import org.opensearch.common.xcontent.XContentBuilder;
import org.elasticsearch.index.mapper.MapperService; import org.elasticsearch.index.mapper.MapperService;
import org.opensearch.rest.BaseRestHandler; import org.opensearch.rest.BaseRestHandler;
import org.elasticsearch.test.ESTestCase; import org.opensearch.test.OpenSearchTestCase;
import java.io.IOException; import java.io.IOException;
import java.util.Collections; import java.util.Collections;
@ -36,9 +36,9 @@ import java.util.Objects;
import java.util.function.Predicate; import java.util.function.Predicate;
import static org.opensearch.client.indices.GetMappingsResponse.MAPPINGS; import static org.opensearch.client.indices.GetMappingsResponse.MAPPINGS;
import static org.elasticsearch.test.AbstractXContentTestCase.xContentTester; import static org.opensearch.test.AbstractXContentTestCase.xContentTester;
public class GetMappingsResponseTests extends ESTestCase { public class GetMappingsResponseTests extends OpenSearchTestCase {
// Because the client-side class does not have a toXContent method, we test xContent serialization by creating // Because the client-side class does not have a toXContent method, we test xContent serialization by creating
// a random client object, converting it to a server object then serializing it to xContent, and finally // a random client object, converting it to a server object then serializing it to xContent, and finally

View File

@ -23,7 +23,7 @@ import org.opensearch.action.admin.indices.alias.Alias;
import org.opensearch.common.settings.Settings; import org.opensearch.common.settings.Settings;
import org.opensearch.common.xcontent.XContentFactory; import org.opensearch.common.xcontent.XContentFactory;
import org.opensearch.common.xcontent.XContentParser; import org.opensearch.common.xcontent.XContentParser;
import org.elasticsearch.test.AbstractXContentTestCase; import org.opensearch.test.AbstractXContentTestCase;
import java.io.IOException; import java.io.IOException;
import java.io.UncheckedIOException; import java.io.UncheckedIOException;

View File

@ -21,7 +21,7 @@ package org.opensearch.client.indices;
import org.opensearch.common.xcontent.XContentBuilder; import org.opensearch.common.xcontent.XContentBuilder;
import org.opensearch.common.xcontent.XContentParser; import org.opensearch.common.xcontent.XContentParser;
import org.elasticsearch.test.AbstractXContentTestCase; import org.opensearch.test.AbstractXContentTestCase;
import java.io.IOException; import java.io.IOException;
import java.util.Map; import java.util.Map;

View File

@ -24,8 +24,8 @@ import org.opensearch.common.xcontent.XContentFactory;
import java.io.IOException; import java.io.IOException;
import static org.elasticsearch.index.RandomCreateIndexGenerator.randomAlias; import static org.opensearch.index.RandomCreateIndexGenerator.randomAlias;
import static org.elasticsearch.test.ESTestCase.randomIntBetween; import static org.opensearch.test.OpenSearchTestCase.randomIntBetween;
public class RandomCreateIndexGenerator { public class RandomCreateIndexGenerator {
@ -41,7 +41,7 @@ public class RandomCreateIndexGenerator {
// Because client requests only accept typeless mappings, we must swap out the // Because client requests only accept typeless mappings, we must swap out the
// mapping definition for one that does not contain types. // mapping definition for one that does not contain types.
org.opensearch.action.admin.indices.create.CreateIndexRequest serverRequest = org.opensearch.action.admin.indices.create.CreateIndexRequest serverRequest =
org.elasticsearch.index.RandomCreateIndexGenerator.randomCreateIndexRequest(); org.opensearch.index.RandomCreateIndexGenerator.randomCreateIndexRequest();
return new CreateIndexRequest(serverRequest.index()) return new CreateIndexRequest(serverRequest.index())
.settings(serverRequest.settings()) .settings(serverRequest.settings())
.aliases(serverRequest.aliases()) .aliases(serverRequest.aliases())
@ -57,7 +57,7 @@ public class RandomCreateIndexGenerator {
public static XContentBuilder randomMapping() throws IOException { public static XContentBuilder randomMapping() throws IOException {
XContentBuilder builder = XContentFactory.jsonBuilder(); XContentBuilder builder = XContentFactory.jsonBuilder();
builder.startObject(); builder.startObject();
org.elasticsearch.index.RandomCreateIndexGenerator.randomMappingFields(builder, true); org.opensearch.index.RandomCreateIndexGenerator.randomMappingFields(builder, true);
builder.endObject(); builder.endObject();
return builder; return builder;
} }

View File

@ -25,7 +25,7 @@ import org.opensearch.action.admin.indices.rollover.MaxDocsCondition;
import org.opensearch.action.admin.indices.rollover.MaxSizeCondition; import org.opensearch.action.admin.indices.rollover.MaxSizeCondition;
import org.opensearch.common.unit.ByteSizeValue; import org.opensearch.common.unit.ByteSizeValue;
import org.opensearch.common.unit.TimeValue; import org.opensearch.common.unit.TimeValue;
import org.elasticsearch.test.ESTestCase; import org.opensearch.test.OpenSearchTestCase;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -33,7 +33,7 @@ import java.util.List;
import static org.hamcrest.Matchers.containsInAnyOrder; import static org.hamcrest.Matchers.containsInAnyOrder;
public class RolloverRequestTests extends ESTestCase { public class RolloverRequestTests extends OpenSearchTestCase {
public void testConstructorAndFieldAssignments() { public void testConstructorAndFieldAssignments() {
// test constructor // test constructor
String alias = randomAlphaOfLength(5); String alias = randomAlphaOfLength(5);

View File

@ -27,7 +27,7 @@ import org.opensearch.common.unit.ByteSizeValue;
import org.opensearch.common.unit.TimeValue; import org.opensearch.common.unit.TimeValue;
import org.opensearch.common.xcontent.ToXContent; import org.opensearch.common.xcontent.ToXContent;
import org.opensearch.common.xcontent.XContentBuilder; import org.opensearch.common.xcontent.XContentBuilder;
import org.elasticsearch.test.ESTestCase; import org.opensearch.test.OpenSearchTestCase;
import org.opensearch.rest.BaseRestHandler; import org.opensearch.rest.BaseRestHandler;
import org.opensearch.common.xcontent.ToXContent.Params; import org.opensearch.common.xcontent.ToXContent.Params;
@ -40,9 +40,9 @@ import java.util.function.Predicate;
import java.util.function.Supplier; import java.util.function.Supplier;
import java.util.Collections; import java.util.Collections;
import static org.elasticsearch.test.AbstractXContentTestCase.xContentTester; import static org.opensearch.test.AbstractXContentTestCase.xContentTester;
public class RolloverResponseTests extends ESTestCase { public class RolloverResponseTests extends OpenSearchTestCase {
private static final List<Supplier<Condition<?>>> conditionSuppliers = new ArrayList<>(); private static final List<Supplier<Condition<?>>> conditionSuppliers = new ArrayList<>();
static { static {

View File

@ -20,13 +20,13 @@
package org.opensearch.client.tasks; package org.opensearch.client.tasks;
import org.opensearch.common.xcontent.XContentBuilder; import org.opensearch.common.xcontent.XContentBuilder;
import org.elasticsearch.test.ESTestCase; import org.opensearch.test.OpenSearchTestCase;
import java.io.IOException; import java.io.IOException;
import static org.elasticsearch.test.AbstractXContentTestCase.xContentTester; import static org.opensearch.test.AbstractXContentTestCase.xContentTester;
public class TaskSubmissionResponseTests extends ESTestCase { public class TaskSubmissionResponseTests extends OpenSearchTestCase {
public void testFromXContent() throws IOException { public void testFromXContent() throws IOException {
xContentTester( xContentTester(

View File

@ -19,7 +19,6 @@
package org.opensearch.test.rest; package org.opensearch.test.rest;
import org.elasticsearch.test.rest.ESRestTestCase;
import org.opensearch.client.Request; import org.opensearch.client.Request;
import org.opensearch.client.Response; import org.opensearch.client.Response;
@ -32,7 +31,7 @@ import static org.hamcrest.Matchers.startsWith;
/** /**
* Tests for the "Location" header returned when returning {@code 201 CREATED}. * Tests for the "Location" header returned when returning {@code 201 CREATED}.
*/ */
public class CreatedLocationHeaderIT extends ESRestTestCase { public class CreatedLocationHeaderIT extends OpenSearchRestTestCase {
public void testCreate() throws IOException { public void testCreate() throws IOException {
locationTestCase("PUT", "test/_doc/1"); locationTestCase("PUT", "test/_doc/1");

View File

@ -19,7 +19,6 @@
package org.opensearch.test.rest; package org.opensearch.test.rest;
import org.elasticsearch.test.rest.ESRestTestCase;
import org.opensearch.client.Request; import org.opensearch.client.Request;
import org.opensearch.client.Response; import org.opensearch.client.Response;
import org.opensearch.client.ResponseException; import org.opensearch.client.ResponseException;
@ -37,7 +36,7 @@ import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.greaterThan; import static org.hamcrest.Matchers.greaterThan;
import static org.hamcrest.Matchers.notNullValue; import static org.hamcrest.Matchers.notNullValue;
public class NodeRestUsageIT extends ESRestTestCase { public class NodeRestUsageIT extends OpenSearchRestTestCase {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public void testWithRestUsage() throws IOException { public void testWithRestUsage() throws IOException {

View File

@ -19,7 +19,6 @@
package org.opensearch.test.rest; package org.opensearch.test.rest;
import org.elasticsearch.test.rest.ESRestTestCase;
import org.opensearch.client.ResponseException; import org.opensearch.client.ResponseException;
import org.opensearch.client.Request; import org.opensearch.client.Request;
@ -27,7 +26,7 @@ import java.io.IOException;
import static org.hamcrest.CoreMatchers.containsString; import static org.hamcrest.CoreMatchers.containsString;
public class RequestsWithoutContentIT extends ESRestTestCase { public class RequestsWithoutContentIT extends OpenSearchRestTestCase {
public void testIndexMissingBody() throws IOException { public void testIndexMissingBody() throws IOException {
ResponseException responseException = expectThrows(ResponseException.class, () -> ResponseException responseException = expectThrows(ResponseException.class, () ->

View File

@ -20,7 +20,6 @@
package org.opensearch.test.rest; package org.opensearch.test.rest;
import org.apache.http.util.EntityUtils; import org.apache.http.util.EntityUtils;
import org.elasticsearch.test.rest.ESRestTestCase;
import org.opensearch.action.ActionFuture; import org.opensearch.action.ActionFuture;
import org.opensearch.action.support.PlainActionFuture; import org.opensearch.action.support.PlainActionFuture;
import org.opensearch.client.Request; import org.opensearch.client.Request;
@ -41,7 +40,7 @@ import static org.hamcrest.Matchers.instanceOf;
/** /**
* Tests that wait for refresh is fired if the index is closed. * Tests that wait for refresh is fired if the index is closed.
*/ */
public class WaitForRefreshAndCloseIT extends ESRestTestCase { public class WaitForRefreshAndCloseIT extends OpenSearchRestTestCase {
@Before @Before
public void setupIndex() throws IOException { public void setupIndex() throws IOException {
Request request = new Request("PUT", "/test"); Request request = new Request("PUT", "/test");

View File

@ -23,8 +23,8 @@ import org.opensearch.OpenSearchException;
import org.opensearch.client.Request; import org.opensearch.client.Request;
import org.opensearch.common.io.PathUtils; import org.opensearch.common.io.PathUtils;
import org.opensearch.common.settings.Settings; import org.opensearch.common.settings.Settings;
import org.elasticsearch.test.rest.yaml.ClientYamlTestCandidate; import org.opensearch.test.rest.yaml.ClientYamlTestCandidate;
import org.elasticsearch.test.rest.yaml.ESClientYamlSuiteTestCase; import org.opensearch.test.rest.yaml.OpenSearchClientYamlSuiteTestCase;
import org.junit.AfterClass; import org.junit.AfterClass;
import org.junit.Before; import org.junit.Before;
import org.junit.BeforeClass; import org.junit.BeforeClass;
@ -34,7 +34,7 @@ import java.net.URISyntaxException;
import java.nio.file.Files; import java.nio.file.Files;
import java.nio.file.Path; import java.nio.file.Path;
public class DockerYmlTestSuiteIT extends ESClientYamlSuiteTestCase { public class DockerYmlTestSuiteIT extends OpenSearchClientYamlSuiteTestCase {
private static final String USER = "rest_user"; private static final String USER = "rest_user";
private static final String PASS = "test-password"; private static final String PASS = "test-password";

View File

@ -25,7 +25,7 @@ import org.opensearch.common.settings.SecureSettings;
import org.opensearch.common.settings.SecureString; import org.opensearch.common.settings.SecureString;
import org.opensearch.common.settings.Settings; import org.opensearch.common.settings.Settings;
import org.opensearch.env.Environment; import org.opensearch.env.Environment;
import org.elasticsearch.test.ESTestCase; import org.opensearch.test.OpenSearchTestCase;
import org.junit.After; import org.junit.After;
import org.junit.Before; import org.junit.Before;
@ -41,7 +41,7 @@ import java.util.List;
import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.equalTo;
public class BootstrapTests extends ESTestCase { public class BootstrapTests extends OpenSearchTestCase {
Environment env; Environment env;
List<FileSystem> fileSystems = new ArrayList<>(); List<FileSystem> fileSystems = new ArrayList<>();

View File

@ -26,7 +26,7 @@ import org.apache.lucene.store.SimpleFSDirectory;
import org.opensearch.common.Randomness; import org.opensearch.common.Randomness;
import org.opensearch.core.internal.io.IOUtils; import org.opensearch.core.internal.io.IOUtils;
import org.elasticsearch.env.Environment; import org.elasticsearch.env.Environment;
import org.elasticsearch.test.ESTestCase; import org.opensearch.test.OpenSearchTestCase;
import org.hamcrest.Matchers; import org.hamcrest.Matchers;
import org.junit.After; import org.junit.After;
import org.junit.Before; import org.junit.Before;
@ -66,7 +66,7 @@ import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.instanceOf; import static org.hamcrest.Matchers.instanceOf;
import static org.hamcrest.Matchers.notNullValue; import static org.hamcrest.Matchers.notNullValue;
public class KeyStoreWrapperTests extends ESTestCase { public class KeyStoreWrapperTests extends OpenSearchTestCase {
Environment env; Environment env;
List<FileSystem> fileSystems = new ArrayList<>(); List<FileSystem> fileSystems = new ArrayList<>();

View File

@ -56,8 +56,8 @@ import org.opensearch.common.io.PathUtilsForTesting;
import org.opensearch.common.settings.Settings; import org.opensearch.common.settings.Settings;
import org.elasticsearch.env.Environment; import org.elasticsearch.env.Environment;
import org.opensearch.env.TestEnvironment; import org.opensearch.env.TestEnvironment;
import org.elasticsearch.test.ESTestCase; import org.opensearch.test.OpenSearchTestCase;
import org.elasticsearch.test.PosixPermissionsResetter; import org.opensearch.test.PosixPermissionsResetter;
import org.junit.After; import org.junit.After;
import org.junit.Before; import org.junit.Before;
@ -107,7 +107,7 @@ import java.util.stream.Stream;
import java.util.zip.ZipEntry; import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream; import java.util.zip.ZipOutputStream;
import static org.elasticsearch.test.hamcrest.RegexMatcher.matches; import static org.opensearch.test.hamcrest.RegexMatcher.matches;
import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.Matchers.containsInAnyOrder; import static org.hamcrest.Matchers.containsInAnyOrder;
import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.containsString;
@ -118,7 +118,7 @@ import static org.hamcrest.Matchers.not;
import static org.hamcrest.Matchers.startsWith; import static org.hamcrest.Matchers.startsWith;
@LuceneTestCase.SuppressFileSystems("*") @LuceneTestCase.SuppressFileSystems("*")
public class InstallPluginCommandTests extends ESTestCase { public class InstallPluginCommandTests extends OpenSearchTestCase {
private InstallPluginCommand skipJarHellCommand; private InstallPluginCommand skipJarHellCommand;
private InstallPluginCommand defaultCommand; private InstallPluginCommand defaultCommand;
@ -990,7 +990,7 @@ public class InstallPluginCommandTests extends ESTestCase {
); );
} }
@AwaitsFix(bugUrl = "https://github.com/opendistro-for-elasticsearch/search/issues/100") @AwaitsFix(bugUrl = "https://github.com/opensearch-project/OpenSearch/issues/100")
public void testOfficialPlugin() throws Exception { public void testOfficialPlugin() throws Exception {
String url = "https://artifacts.elastic.co/downloads/elasticsearch-plugins/analysis-icu/analysis-icu-" String url = "https://artifacts.elastic.co/downloads/elasticsearch-plugins/analysis-icu/analysis-icu-"
+ Build.CURRENT.getQualifiedVersion() + Build.CURRENT.getQualifiedVersion()
@ -998,7 +998,7 @@ public class InstallPluginCommandTests extends ESTestCase {
assertInstallPluginFromUrl("analysis-icu", "analysis-icu", url, null, false); assertInstallPluginFromUrl("analysis-icu", "analysis-icu", url, null, false);
} }
@AwaitsFix(bugUrl = "https://github.com/opendistro-for-elasticsearch/search/issues/100") @AwaitsFix(bugUrl = "https://github.com/opensearch-project/OpenSearch/issues/100")
public void testOfficialPluginSnapshot() throws Exception { public void testOfficialPluginSnapshot() throws Exception {
String url = String.format( String url = String.format(
Locale.ROOT, Locale.ROOT,
@ -1009,7 +1009,7 @@ public class InstallPluginCommandTests extends ESTestCase {
assertInstallPluginFromUrl("analysis-icu", "analysis-icu", url, "abc123", true); assertInstallPluginFromUrl("analysis-icu", "analysis-icu", url, "abc123", true);
} }
@AwaitsFix(bugUrl = "https://github.com/opendistro-for-elasticsearch/search/issues/100") @AwaitsFix(bugUrl = "https://github.com/opensearch-project/OpenSearch/issues/100")
public void testInstallReleaseBuildOfPluginOnSnapshotBuild() { public void testInstallReleaseBuildOfPluginOnSnapshotBuild() {
String url = String.format( String url = String.format(
Locale.ROOT, Locale.ROOT,
@ -1025,11 +1025,11 @@ public class InstallPluginCommandTests extends ESTestCase {
assertThat(e.exitCode, equalTo(ExitCodes.CONFIG)); assertThat(e.exitCode, equalTo(ExitCodes.CONFIG));
assertThat( assertThat(
e, e,
hasToString(containsString("attempted to install release build of official plugin on snapshot build of Elasticsearch")) hasToString(containsString("attempted to install release build of official plugin on snapshot build of OpenSearch"))
); );
} }
@AwaitsFix(bugUrl = "https://github.com/opendistro-for-elasticsearch/search/issues/100") @AwaitsFix(bugUrl = "https://github.com/opensearch-project/OpenSearch/issues/100")
public void testOfficialPluginStaging() throws Exception { public void testOfficialPluginStaging() throws Exception {
String url = "https://staging.elastic.co/" String url = "https://staging.elastic.co/"
+ Version.CURRENT + Version.CURRENT
@ -1039,7 +1039,7 @@ public class InstallPluginCommandTests extends ESTestCase {
assertInstallPluginFromUrl("analysis-icu", "analysis-icu", url, "abc123", false); assertInstallPluginFromUrl("analysis-icu", "analysis-icu", url, "abc123", false);
} }
@AwaitsFix(bugUrl = "https://github.com/opendistro-for-elasticsearch/search/issues/100") @AwaitsFix(bugUrl = "https://github.com/opensearch-project/OpenSearch/issues/100")
public void testOfficialPlatformPlugin() throws Exception { public void testOfficialPlatformPlugin() throws Exception {
String url = "https://artifacts.elastic.co/downloads/elasticsearch-plugins/analysis-icu/analysis-icu-" String url = "https://artifacts.elastic.co/downloads/elasticsearch-plugins/analysis-icu/analysis-icu-"
+ Platforms.PLATFORM_NAME + Platforms.PLATFORM_NAME
@ -1049,7 +1049,7 @@ public class InstallPluginCommandTests extends ESTestCase {
assertInstallPluginFromUrl("analysis-icu", "analysis-icu", url, null, false); assertInstallPluginFromUrl("analysis-icu", "analysis-icu", url, null, false);
} }
@AwaitsFix(bugUrl = "https://github.com/opendistro-for-elasticsearch/search/issues/100") @AwaitsFix(bugUrl = "https://github.com/opensearch-project/OpenSearch/issues/100")
public void testOfficialPlatformPluginSnapshot() throws Exception { public void testOfficialPlatformPluginSnapshot() throws Exception {
String url = String.format( String url = String.format(
Locale.ROOT, Locale.ROOT,
@ -1061,7 +1061,7 @@ public class InstallPluginCommandTests extends ESTestCase {
assertInstallPluginFromUrl("analysis-icu", "analysis-icu", url, "abc123", true); assertInstallPluginFromUrl("analysis-icu", "analysis-icu", url, "abc123", true);
} }
@AwaitsFix(bugUrl = "https://github.com/opendistro-for-elasticsearch/search/issues/100") @AwaitsFix(bugUrl = "https://github.com/opensearch-project/OpenSearch/issues/100")
public void testOfficialPlatformPluginStaging() throws Exception { public void testOfficialPlatformPluginStaging() throws Exception {
String url = "https://staging.elastic.co/" String url = "https://staging.elastic.co/"
+ Version.CURRENT + Version.CURRENT
@ -1106,7 +1106,7 @@ public class InstallPluginCommandTests extends ESTestCase {
); );
} }
@AwaitsFix(bugUrl = "https://github.com/opendistro-for-elasticsearch/search/issues/100") @AwaitsFix(bugUrl = "https://github.com/opensearch-project/OpenSearch/issues/100")
public void testOfficialChecksumWithoutFilename() throws Exception { public void testOfficialChecksumWithoutFilename() throws Exception {
String url = "https://artifacts.elastic.co/downloads/elasticsearch-plugins/analysis-icu/analysis-icu-" String url = "https://artifacts.elastic.co/downloads/elasticsearch-plugins/analysis-icu/analysis-icu-"
+ Build.CURRENT.getQualifiedVersion() + Build.CURRENT.getQualifiedVersion()
@ -1130,7 +1130,7 @@ public class InstallPluginCommandTests extends ESTestCase {
assertThat(e.getMessage(), startsWith("Invalid checksum file")); assertThat(e.getMessage(), startsWith("Invalid checksum file"));
} }
@AwaitsFix(bugUrl = "https://github.com/opendistro-for-elasticsearch/search/issues/100") @AwaitsFix(bugUrl = "https://github.com/opensearch-project/OpenSearch/issues/100")
public void testOfficialShaMissing() throws Exception { public void testOfficialShaMissing() throws Exception {
String url = "https://artifacts.elastic.co/downloads/elasticsearch-plugins/analysis-icu/analysis-icu-" String url = "https://artifacts.elastic.co/downloads/elasticsearch-plugins/analysis-icu/analysis-icu-"
+ Build.CURRENT.getQualifiedVersion() + Build.CURRENT.getQualifiedVersion()
@ -1174,7 +1174,7 @@ public class InstallPluginCommandTests extends ESTestCase {
assertEquals("Plugin checksum missing: " + url + ".sha1", e.getMessage()); assertEquals("Plugin checksum missing: " + url + ".sha1", e.getMessage());
} }
@AwaitsFix(bugUrl = "https://github.com/opendistro-for-elasticsearch/search/issues/100") @AwaitsFix(bugUrl = "https://github.com/opensearch-project/OpenSearch/issues/100")
public void testInvalidShaFileMissingFilename() throws Exception { public void testInvalidShaFileMissingFilename() throws Exception {
String url = "https://artifacts.elastic.co/downloads/elasticsearch-plugins/analysis-icu/analysis-icu-" String url = "https://artifacts.elastic.co/downloads/elasticsearch-plugins/analysis-icu/analysis-icu-"
+ Build.CURRENT.getQualifiedVersion() + Build.CURRENT.getQualifiedVersion()
@ -1198,7 +1198,7 @@ public class InstallPluginCommandTests extends ESTestCase {
assertTrue(e.getMessage(), e.getMessage().startsWith("Invalid checksum file")); assertTrue(e.getMessage(), e.getMessage().startsWith("Invalid checksum file"));
} }
@AwaitsFix(bugUrl = "https://github.com/opendistro-for-elasticsearch/search/issues/100") @AwaitsFix(bugUrl = "https://github.com/opensearch-project/OpenSearch/issues/100")
public void testInvalidShaFileMismatchFilename() throws Exception { public void testInvalidShaFileMismatchFilename() throws Exception {
String url = "https://artifacts.elastic.co/downloads/elasticsearch-plugins/analysis-icu/analysis-icu-" String url = "https://artifacts.elastic.co/downloads/elasticsearch-plugins/analysis-icu/analysis-icu-"
+ Build.CURRENT.getQualifiedVersion() + Build.CURRENT.getQualifiedVersion()
@ -1222,7 +1222,7 @@ public class InstallPluginCommandTests extends ESTestCase {
assertThat(e, hasToString(matches("checksum file at \\[.*\\] is not for this plugin"))); assertThat(e, hasToString(matches("checksum file at \\[.*\\] is not for this plugin")));
} }
@AwaitsFix(bugUrl = "https://github.com/opendistro-for-elasticsearch/search/issues/100") @AwaitsFix(bugUrl = "https://github.com/opensearch-project/OpenSearch/issues/100")
public void testInvalidShaFileContainingExtraLine() throws Exception { public void testInvalidShaFileContainingExtraLine() throws Exception {
String url = "https://artifacts.elastic.co/downloads/elasticsearch-plugins/analysis-icu/analysis-icu-" String url = "https://artifacts.elastic.co/downloads/elasticsearch-plugins/analysis-icu/analysis-icu-"
+ Build.CURRENT.getQualifiedVersion() + Build.CURRENT.getQualifiedVersion()
@ -1246,7 +1246,7 @@ public class InstallPluginCommandTests extends ESTestCase {
assertTrue(e.getMessage(), e.getMessage().startsWith("Invalid checksum file")); assertTrue(e.getMessage(), e.getMessage().startsWith("Invalid checksum file"));
} }
@AwaitsFix(bugUrl = "https://github.com/opendistro-for-elasticsearch/search/issues/100") @AwaitsFix(bugUrl = "https://github.com/opensearch-project/OpenSearch/issues/100")
public void testSha512Mismatch() throws Exception { public void testSha512Mismatch() throws Exception {
String url = "https://artifacts.elastic.co/downloads/elasticsearch-plugins/analysis-icu/analysis-icu-" String url = "https://artifacts.elastic.co/downloads/elasticsearch-plugins/analysis-icu/analysis-icu-"
+ Build.CURRENT.getQualifiedVersion() + Build.CURRENT.getQualifiedVersion()
@ -1289,7 +1289,7 @@ public class InstallPluginCommandTests extends ESTestCase {
assertTrue(e.getMessage(), e.getMessage().contains("SHA-1 mismatch, expected foobar")); assertTrue(e.getMessage(), e.getMessage().contains("SHA-1 mismatch, expected foobar"));
} }
@AwaitsFix(bugUrl = "https://github.com/opendistro-for-elasticsearch/search/issues/100") @AwaitsFix(bugUrl = "https://github.com/opensearch-project/OpenSearch/issues/100")
public void testPublicKeyIdMismatchToExpectedPublicKeyId() throws Exception { public void testPublicKeyIdMismatchToExpectedPublicKeyId() throws Exception {
final String icu = "analysis-icu"; final String icu = "analysis-icu";
final String url = "https://artifacts.elastic.co/downloads/elasticsearch-plugins/analysis-icu/" final String url = "https://artifacts.elastic.co/downloads/elasticsearch-plugins/analysis-icu/"
@ -1325,7 +1325,7 @@ public class InstallPluginCommandTests extends ESTestCase {
assertThat(e, hasToString(containsString("key id [" + actualID + "] does not match expected key id [" + expectedID + "]"))); assertThat(e, hasToString(containsString("key id [" + actualID + "] does not match expected key id [" + expectedID + "]")));
} }
@AwaitsFix(bugUrl = "https://github.com/opendistro-for-elasticsearch/search/issues/100") @AwaitsFix(bugUrl = "https://github.com/opensearch-project/OpenSearch/issues/100")
public void testFailedSignatureVerification() throws Exception { public void testFailedSignatureVerification() throws Exception {
final String icu = "analysis-icu"; final String icu = "analysis-icu";
final String url = "https://artifacts.elastic.co/downloads/elasticsearch-plugins/analysis-icu/" final String url = "https://artifacts.elastic.co/downloads/elasticsearch-plugins/analysis-icu/"
@ -1341,7 +1341,7 @@ public class InstallPluginCommandTests extends ESTestCase {
*/ */
final BiFunction<byte[], PGPSecretKey, String> signature = (b, p) -> { final BiFunction<byte[], PGPSecretKey, String> signature = (b, p) -> {
final byte[] bytes = Arrays.copyOf(b, b.length); final byte[] bytes = Arrays.copyOf(b, b.length);
bytes[0] = randomValueOtherThan(b[0], ESTestCase::randomByte); bytes[0] = randomValueOtherThan(b[0], OpenSearchTestCase::randomByte);
return signature(bytes, p); return signature(bytes, p);
}; };
final IllegalStateException e = expectThrows( final IllegalStateException e = expectThrows(

View File

@ -35,11 +35,11 @@ import org.opensearch.cli.UserException;
import org.opensearch.common.settings.Settings; import org.opensearch.common.settings.Settings;
import org.opensearch.env.Environment; import org.opensearch.env.Environment;
import org.opensearch.env.TestEnvironment; import org.opensearch.env.TestEnvironment;
import org.elasticsearch.test.ESTestCase; import org.opensearch.test.OpenSearchTestCase;
import org.junit.Before; import org.junit.Before;
@LuceneTestCase.SuppressFileSystems("*") @LuceneTestCase.SuppressFileSystems("*")
public class ListPluginsCommandTests extends ESTestCase { public class ListPluginsCommandTests extends OpenSearchTestCase {
private Path home; private Path home;
private Environment env; private Environment env;
@ -151,7 +151,7 @@ public class ListPluginsCommandTests extends ESTestCase {
"Name: fake_plugin", "Name: fake_plugin",
"Description: fake desc", "Description: fake desc",
"Version: 1.0", "Version: 1.0",
"Elasticsearch Version: " + Version.CURRENT.toString(), "OpenSearch Version: " + Version.CURRENT.toString(),
"Java Version: 1.8", "Java Version: 1.8",
"Native Controller: false", "Native Controller: false",
"Extended Plugins: []", "Extended Plugins: []",
@ -173,7 +173,7 @@ public class ListPluginsCommandTests extends ESTestCase {
"Name: fake_plugin1", "Name: fake_plugin1",
"Description: fake desc 1", "Description: fake desc 1",
"Version: 1.0", "Version: 1.0",
"Elasticsearch Version: " + Version.CURRENT.toString(), "OpenSearch Version: " + Version.CURRENT.toString(),
"Java Version: 1.8", "Java Version: 1.8",
"Native Controller: true", "Native Controller: true",
"Extended Plugins: []", "Extended Plugins: []",
@ -196,7 +196,7 @@ public class ListPluginsCommandTests extends ESTestCase {
"Name: fake_plugin1", "Name: fake_plugin1",
"Description: fake desc 1", "Description: fake desc 1",
"Version: 1.0", "Version: 1.0",
"Elasticsearch Version: " + Version.CURRENT.toString(), "OpenSearch Version: " + Version.CURRENT.toString(),
"Java Version: 1.8", "Java Version: 1.8",
"Native Controller: false", "Native Controller: false",
"Extended Plugins: []", "Extended Plugins: []",
@ -206,7 +206,7 @@ public class ListPluginsCommandTests extends ESTestCase {
"Name: fake_plugin2", "Name: fake_plugin2",
"Description: fake desc 2", "Description: fake desc 2",
"Version: 1.0", "Version: 1.0",
"Elasticsearch Version: " + Version.CURRENT.toString(), "OpenSearch Version: " + Version.CURRENT.toString(),
"Java Version: 1.8", "Java Version: 1.8",
"Native Controller: false", "Native Controller: false",
"Extended Plugins: []", "Extended Plugins: []",
@ -258,7 +258,7 @@ public class ListPluginsCommandTests extends ESTestCase {
buildFakePlugin(env, "fake desc 2", "fake_plugin2", "org.fake2"); buildFakePlugin(env, "fake desc 2", "fake_plugin2", "org.fake2");
MockTerminal terminal = listPlugins(home); MockTerminal terminal = listPlugins(home);
String message = "plugin [fake_plugin1] was built for Elasticsearch version 1.0 but version " + Version.CURRENT + " is required"; String message = "plugin [fake_plugin1] was built for OpenSearch version 1.0 but version " + Version.CURRENT + " is required";
assertEquals("fake_plugin1\nfake_plugin2\n", terminal.getOutput()); assertEquals("fake_plugin1\nfake_plugin2\n", terminal.getOutput());
assertEquals("WARNING: " + message + "\n", terminal.getErrorOutput()); assertEquals("WARNING: " + message + "\n", terminal.getErrorOutput());

View File

@ -19,7 +19,7 @@
package org.opensearch.plugins; package org.opensearch.plugins;
import org.elasticsearch.test.ESTestCase; import org.opensearch.test.OpenSearchTestCase;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -28,7 +28,7 @@ import static org.hamcrest.Matchers.hasItem;
import static org.hamcrest.Matchers.hasItems; import static org.hamcrest.Matchers.hasItems;
import static org.hamcrest.Matchers.hasSize; import static org.hamcrest.Matchers.hasSize;
public class ProgressInputStreamTests extends ESTestCase { public class ProgressInputStreamTests extends OpenSearchTestCase {
private List<Integer> progresses = new ArrayList<>(); private List<Integer> progresses = new ArrayList<>();

View File

@ -27,8 +27,8 @@ import org.opensearch.cli.UserException;
import org.opensearch.common.settings.Settings; import org.opensearch.common.settings.Settings;
import org.opensearch.env.Environment; import org.opensearch.env.Environment;
import org.opensearch.env.TestEnvironment; import org.opensearch.env.TestEnvironment;
import org.elasticsearch.test.ESTestCase; import org.opensearch.test.OpenSearchTestCase;
import org.elasticsearch.test.VersionUtils; import org.opensearch.test.VersionUtils;
import org.junit.Before; import org.junit.Before;
import java.io.BufferedReader; import java.io.BufferedReader;
@ -45,7 +45,7 @@ import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.hasToString; import static org.hamcrest.Matchers.hasToString;
@LuceneTestCase.SuppressFileSystems("*") @LuceneTestCase.SuppressFileSystems("*")
public class RemovePluginCommandTests extends ESTestCase { public class RemovePluginCommandTests extends OpenSearchTestCase {
private Path home; private Path home;
private Environment env; private Environment env;

View File

@ -21,7 +21,7 @@ package org.opensearch.bootstrap;
import org.opensearch.common.Strings; import org.opensearch.common.Strings;
import org.opensearch.common.io.PathUtils; import org.opensearch.common.io.PathUtils;
import org.elasticsearch.test.ESTestCase; import org.opensearch.test.OpenSearchTestCase;
import java.io.IOException; import java.io.IOException;
import java.net.URL; import java.net.URL;
@ -38,7 +38,7 @@ import java.util.jar.Manifest;
import java.util.zip.ZipEntry; import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream; import java.util.zip.ZipOutputStream;
public class JarHellTests extends ESTestCase { public class JarHellTests extends OpenSearchTestCase {
URL makeJar(Path dir, String name, Manifest manifest, String... files) throws IOException { URL makeJar(Path dir, String name, Manifest manifest, String... files) throws IOException {
Path jarpath = dir.resolve(name); Path jarpath = dir.resolve(name);

View File

@ -19,13 +19,13 @@
package org.opensearch.common; package org.opensearch.common;
import org.elasticsearch.test.ESTestCase; import org.opensearch.test.OpenSearchTestCase;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.is;
public class CharArraysTests extends ESTestCase { public class CharArraysTests extends OpenSearchTestCase {
public void testCharsToBytes() { public void testCharsToBytes() {
final String originalValue = randomUnicodeOfCodepointLengthBetween(0, 32); final String originalValue = randomUnicodeOfCodepointLengthBetween(0, 32);

View File

@ -19,14 +19,14 @@
package org.opensearch.common.collect; package org.opensearch.common.collect;
import org.elasticsearch.test.ESTestCase; import org.opensearch.test.OpenSearchTestCase;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.equalTo;
public class ListTests extends ESTestCase { public class ListTests extends OpenSearchTestCase {
public void testStringListOfZero() { public void testStringListOfZero() {
final String[] strings = {}; final String[] strings = {};

View File

@ -19,11 +19,11 @@
package org.opensearch.common.collect; package org.opensearch.common.collect;
import org.elasticsearch.test.ESTestCase; import org.opensearch.test.OpenSearchTestCase;
import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.equalTo;
public class MapTests extends ESTestCase { public class MapTests extends OpenSearchTestCase {
private static final String[] numbers = {"zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"}; private static final String[] numbers = {"zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"};

View File

@ -19,14 +19,14 @@
package org.opensearch.common.collect; package org.opensearch.common.collect;
import org.elasticsearch.test.ESTestCase; import org.opensearch.test.OpenSearchTestCase;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.equalTo;
public class SetTests extends ESTestCase { public class SetTests extends OpenSearchTestCase {
public void testStringSetOfZero() { public void testStringSetOfZero() {
final String[] strings = {}; final String[] strings = {};

View File

@ -19,11 +19,11 @@
package org.opensearch.common.collect; package org.opensearch.common.collect;
import org.elasticsearch.test.ESTestCase; import org.opensearch.test.OpenSearchTestCase;
import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.equalTo;
public class TupleTests extends ESTestCase { public class TupleTests extends OpenSearchTestCase {
public void testTuple() { public void testTuple() {
Tuple<Long, String> t1 = new Tuple<>(2L, "foo"); Tuple<Long, String> t1 = new Tuple<>(2L, "foo");

View File

@ -19,7 +19,7 @@
package org.opensearch.common.unit; package org.opensearch.common.unit;
import org.elasticsearch.test.ESTestCase; import org.opensearch.test.OpenSearchTestCase;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
@ -30,7 +30,7 @@ import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.lessThan; import static org.hamcrest.Matchers.lessThan;
import static org.hamcrest.object.HasToString.hasToString; import static org.hamcrest.object.HasToString.hasToString;
public class TimeValueTests extends ESTestCase { public class TimeValueTests extends OpenSearchTestCase {
public void testSimple() { public void testSimple() {
assertThat(TimeUnit.MILLISECONDS.toMillis(10), equalTo(new TimeValue(10, TimeUnit.MILLISECONDS).millis())); assertThat(TimeUnit.MILLISECONDS.toMillis(10), equalTo(new TimeValue(10, TimeUnit.MILLISECONDS).millis()));
@ -216,7 +216,7 @@ public class TimeValueTests extends ESTestCase {
public void testCompareValue() { public void testCompareValue() {
long firstRandom = randomNonNegativeLong(); long firstRandom = randomNonNegativeLong();
long secondRandom = randomValueOtherThan(firstRandom, ESTestCase::randomNonNegativeLong); long secondRandom = randomValueOtherThan(firstRandom, OpenSearchTestCase::randomNonNegativeLong);
TimeUnit unit = randomFrom(TimeUnit.values()); TimeUnit unit = randomFrom(TimeUnit.values());
TimeValue firstValue = new TimeValue(firstRandom, unit); TimeValue firstValue = new TimeValue(firstRandom, unit);
TimeValue secondValue = new TimeValue(secondRandom, unit); TimeValue secondValue = new TimeValue(secondRandom, unit);

View File

@ -19,12 +19,12 @@
package org.opensearch.common.util; package org.opensearch.common.util;
import org.elasticsearch.test.ESTestCase; import org.opensearch.test.OpenSearchTestCase;
import static org.opensearch.common.util.OpenSearchSloppyMath.atan; import static org.opensearch.common.util.OpenSearchSloppyMath.atan;
import static org.opensearch.common.util.OpenSearchSloppyMath.sinh; import static org.opensearch.common.util.OpenSearchSloppyMath.sinh;
public class OpenSearchSloppyMathTests extends ESTestCase { public class OpenSearchSloppyMathTests extends OpenSearchTestCase {
// accuracy for atan(x) // accuracy for atan(x)
static double ATAN_DELTA = 1E-15; static double ATAN_DELTA = 1E-15;

View File

@ -18,7 +18,7 @@
*/ */
package org.opensearch.common.util.concurrent; package org.opensearch.common.util.concurrent;
import org.elasticsearch.test.ESTestCase; import org.opensearch.test.OpenSearchTestCase;
import org.hamcrest.Matchers; import org.hamcrest.Matchers;
import java.io.IOException; import java.io.IOException;
@ -29,7 +29,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.is;
public class RefCountedTests extends ESTestCase { public class RefCountedTests extends OpenSearchTestCase {
public void testRefCount() throws IOException { public void testRefCount() throws IOException {
MyRefCounted counted = new MyRefCounted(); MyRefCounted counted = new MyRefCounted();

View File

@ -22,7 +22,7 @@ import org.apache.lucene.mockfile.FilterPath;
import org.apache.lucene.util.Constants; import org.apache.lucene.util.Constants;
import org.opensearch.common.CheckedConsumer; import org.opensearch.common.CheckedConsumer;
import org.opensearch.common.io.PathUtils; import org.opensearch.common.io.PathUtils;
import org.elasticsearch.test.ESTestCase; import org.opensearch.test.OpenSearchTestCase;
import java.io.Closeable; import java.io.Closeable;
import java.io.IOException; import java.io.IOException;
@ -53,7 +53,7 @@ import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyNoMoreInteractions; import static org.mockito.Mockito.verifyNoMoreInteractions;
public class IOUtilsTests extends ESTestCase { public class IOUtilsTests extends OpenSearchTestCase {
public void testCloseArray() throws IOException { public void testCloseArray() throws IOException {
runTestClose(Function.identity(), IOUtils::close); runTestClose(Function.identity(), IOUtils::close);

View File

@ -19,7 +19,7 @@
package org.opensearch.core.internal.io; package org.opensearch.core.internal.io;
import org.elasticsearch.test.ESTestCase; import org.opensearch.test.OpenSearchTestCase;
import java.io.ByteArrayInputStream; import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
@ -29,7 +29,7 @@ import java.util.Arrays;
import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.equalTo;
public class StreamsTests extends ESTestCase { public class StreamsTests extends OpenSearchTestCase {
public void testCopyFromInputStream() throws IOException { public void testCopyFromInputStream() throws IOException {
byte[] content = "content".getBytes(StandardCharsets.UTF_8); byte[] content = "content".getBytes(StandardCharsets.UTF_8);
ByteArrayInputStream in = new ByteArrayInputStream(content); ByteArrayInputStream in = new ByteArrayInputStream(content);

View File

@ -22,9 +22,9 @@ package org.opensearch.core.internal.net;
import org.apache.lucene.util.Constants; import org.apache.lucene.util.Constants;
import org.opensearch.bootstrap.JavaVersion; import org.opensearch.bootstrap.JavaVersion;
import org.opensearch.core.internal.io.IOUtils; import org.opensearch.core.internal.io.IOUtils;
import org.elasticsearch.test.ESTestCase; import org.opensearch.test.OpenSearchTestCase;
public class NetUtilsTests extends ESTestCase { public class NetUtilsTests extends OpenSearchTestCase {
public void testExtendedSocketOptions() { public void testExtendedSocketOptions() {
assumeTrue("JDK possibly not supported", Constants.JVM_NAME.contains("HotSpot") || Constants.JVM_NAME.contains("OpenJDK")); assumeTrue("JDK possibly not supported", Constants.JVM_NAME.contains("HotSpot") || Constants.JVM_NAME.contains("OpenJDK"));

View File

@ -19,7 +19,7 @@
package org.opensearch.dissect; package org.opensearch.dissect;
import org.elasticsearch.test.ESTestCase; import org.opensearch.test.OpenSearchTestCase;
import org.hamcrest.CoreMatchers; import org.hamcrest.CoreMatchers;
import java.util.EnumSet; import java.util.EnumSet;
@ -29,7 +29,7 @@ import java.util.stream.Collectors;
import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.is;
public class DissectKeyTests extends ESTestCase { public class DissectKeyTests extends OpenSearchTestCase {
public void testNoModifier() { public void testNoModifier() {
String keyName = randomAlphaOfLengthBetween(1, 10); String keyName = randomAlphaOfLengthBetween(1, 10);

View File

@ -20,7 +20,7 @@
package org.opensearch.dissect; package org.opensearch.dissect;
import org.opensearch.common.collect.MapBuilder; import org.opensearch.common.collect.MapBuilder;
import org.elasticsearch.test.ESTestCase; import org.opensearch.test.OpenSearchTestCase;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.util.Map; import java.util.Map;
@ -28,7 +28,7 @@ import java.util.stream.IntStream;
import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.equalTo;
public class DissectMatchTests extends ESTestCase { public class DissectMatchTests extends OpenSearchTestCase {
public void testIllegalArgs() { public void testIllegalArgs() {
expectThrows(IllegalArgumentException.class, () -> new DissectMatch("", 0, 1, 0, 0)); expectThrows(IllegalArgumentException.class, () -> new DissectMatch("", 0, 1, 0, 0));

View File

@ -21,7 +21,7 @@ package org.opensearch.dissect;
import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import org.elasticsearch.test.ESTestCase; import org.opensearch.test.OpenSearchTestCase;
import org.hamcrest.CoreMatchers; import org.hamcrest.CoreMatchers;
import org.hamcrest.Matchers; import org.hamcrest.Matchers;
import org.mockito.internal.util.collections.Sets; import org.mockito.internal.util.collections.Sets;
@ -34,7 +34,7 @@ import java.util.Map;
import static com.carrotsearch.randomizedtesting.RandomizedTest.randomAsciiAlphanumOfLengthBetween; import static com.carrotsearch.randomizedtesting.RandomizedTest.randomAsciiAlphanumOfLengthBetween;
public class DissectParserTests extends ESTestCase { public class DissectParserTests extends OpenSearchTestCase {
public void testJavaDocExamples() { public void testJavaDocExamples() {
assertMatch("%{a} %{b},%{c}", "foo bar,baz", Arrays.asList("a", "b", "c"), Arrays.asList("foo", "bar", "baz")); assertMatch("%{a} %{b},%{c}", "foo bar,baz", Arrays.asList("a", "b", "c"), Arrays.asList("foo", "bar", "baz"));

View File

@ -23,7 +23,7 @@ import org.opensearch.OpenSearchException;
import org.opensearch.Version; import org.opensearch.Version;
import org.opensearch.geometry.utils.GeographyValidator; import org.opensearch.geometry.utils.GeographyValidator;
import org.opensearch.geometry.utils.WellKnownText; import org.opensearch.geometry.utils.WellKnownText;
import org.elasticsearch.test.AbstractWireTestCase; import org.opensearch.test.AbstractWireTestCase;
import java.io.IOException; import java.io.IOException;
import java.text.ParseException; import java.text.ParseException;

View File

@ -22,9 +22,9 @@ package org.opensearch.geometry;
import org.opensearch.geometry.utils.GeographyValidator; import org.opensearch.geometry.utils.GeographyValidator;
import org.opensearch.geometry.utils.GeometryValidator; import org.opensearch.geometry.utils.GeometryValidator;
import org.opensearch.geometry.utils.WellKnownText; import org.opensearch.geometry.utils.WellKnownText;
import org.elasticsearch.test.ESTestCase; import org.opensearch.test.OpenSearchTestCase;
public class GeometryValidatorTests extends ESTestCase { public class GeometryValidatorTests extends OpenSearchTestCase {
public static class NoopValidator implements GeometryValidator { public static class NoopValidator implements GeometryValidator {

View File

@ -23,9 +23,9 @@ import org.opensearch.geometry.utils.GeographyValidator;
import org.opensearch.geometry.utils.GeometryValidator; import org.opensearch.geometry.utils.GeometryValidator;
import org.opensearch.geometry.utils.StandardValidator; import org.opensearch.geometry.utils.StandardValidator;
import org.opensearch.geometry.utils.WellKnownText; import org.opensearch.geometry.utils.WellKnownText;
import org.elasticsearch.test.ESTestCase; import org.opensearch.test.OpenSearchTestCase;
public class LinearRingTests extends ESTestCase { public class LinearRingTests extends OpenSearchTestCase {
public void testBasicSerialization() { public void testBasicSerialization() {
UnsupportedOperationException ex = expectThrows(UnsupportedOperationException.class, UnsupportedOperationException ex = expectThrows(UnsupportedOperationException.class,

View File

@ -20,12 +20,12 @@ package org.opensearch.geometry.utils;
import org.opensearch.common.geo.GeoPoint; import org.opensearch.common.geo.GeoPoint;
import org.opensearch.geometry.Rectangle; import org.opensearch.geometry.Rectangle;
import org.elasticsearch.test.ESTestCase; import org.opensearch.test.OpenSearchTestCase;
/** /**
* Tests for {@link Geohash} * Tests for {@link Geohash}
*/ */
public class GeoHashTests extends ESTestCase { public class GeoHashTests extends OpenSearchTestCase {
public void testGeohashAsLongRoutines() { public void testGeohashAsLongRoutines() {
final GeoPoint expected = new GeoPoint(); final GeoPoint expected = new GeoPoint();
final GeoPoint actual = new GeoPoint(); final GeoPoint actual = new GeoPoint();

View File

@ -20,7 +20,7 @@
package org.opensearch.grok; package org.opensearch.grok;
import org.opensearch.grok.GrokCaptureConfig.NativeExtracterMap; import org.opensearch.grok.GrokCaptureConfig.NativeExtracterMap;
import org.elasticsearch.test.ESTestCase; import org.opensearch.test.OpenSearchTestCase;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.util.Arrays; import java.util.Arrays;
@ -50,7 +50,7 @@ import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.nullValue; import static org.hamcrest.Matchers.nullValue;
public class GrokTests extends ESTestCase { public class GrokTests extends OpenSearchTestCase {
public void testMatchWithoutCaptures() { public void testMatchWithoutCaptures() {
Grok grok = new Grok(Grok.BUILTIN_PATTERNS, "value", logger::warn); Grok grok = new Grok(Grok.BUILTIN_PATTERNS, "value", logger::warn);
assertThat(grok.captures("value"), equalTo(org.elasticsearch.common.collect.Map.of())); assertThat(grok.captures("value"), equalTo(org.elasticsearch.common.collect.Map.of()));

View File

@ -23,7 +23,7 @@ import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicBoolean;
import org.elasticsearch.test.ESTestCase; import org.opensearch.test.OpenSearchTestCase;
import org.joni.Matcher; import org.joni.Matcher;
import org.mockito.Mockito; import org.mockito.Mockito;
@ -37,7 +37,7 @@ import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyNoMoreInteractions; import static org.mockito.Mockito.verifyNoMoreInteractions;
import static org.mockito.Mockito.verifyZeroInteractions; import static org.mockito.Mockito.verifyZeroInteractions;
public class MatcherWatchdogTests extends ESTestCase { public class MatcherWatchdogTests extends OpenSearchTestCase {
public void testInterrupt() throws Exception { public void testInterrupt() throws Exception {
AtomicBoolean run = new AtomicBoolean(true); // to avoid a lingering thread when test has completed AtomicBoolean run = new AtomicBoolean(true); // to avoid a lingering thread when test has completed

View File

@ -21,7 +21,7 @@ package org.opensearch.nio;
import org.opensearch.common.CheckedFunction; import org.opensearch.common.CheckedFunction;
import org.opensearch.common.util.PageCacheRecycler; import org.opensearch.common.util.PageCacheRecycler;
import org.elasticsearch.test.ESTestCase; import org.opensearch.test.OpenSearchTestCase;
import org.junit.Before; import org.junit.Before;
import java.io.IOException; import java.io.IOException;
@ -38,7 +38,7 @@ import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when; import static org.mockito.Mockito.when;
public class BytesChannelContextTests extends ESTestCase { public class BytesChannelContextTests extends OpenSearchTestCase {
private CheckedFunction<InboundChannelBuffer, Integer, IOException> readConsumer; private CheckedFunction<InboundChannelBuffer, Integer, IOException> readConsumer;
private NioSocketChannel channel; private NioSocketChannel channel;

View File

@ -19,7 +19,7 @@
package org.opensearch.nio; package org.opensearch.nio;
import org.elasticsearch.test.ESTestCase; import org.opensearch.test.OpenSearchTestCase;
import org.junit.Before; import org.junit.Before;
import java.io.IOException; import java.io.IOException;
@ -39,7 +39,7 @@ import java.util.function.Consumer;
import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verify;
public class ChannelContextTests extends ESTestCase { public class ChannelContextTests extends OpenSearchTestCase {
private TestChannelContext context; private TestChannelContext context;
private Consumer<Exception> exceptionHandler; private Consumer<Exception> exceptionHandler;

View File

@ -20,7 +20,7 @@
package org.opensearch.nio; package org.opensearch.nio;
import org.opensearch.core.internal.io.IOUtils; import org.opensearch.core.internal.io.IOUtils;
import org.elasticsearch.test.ESTestCase; import org.opensearch.test.OpenSearchTestCase;
import org.junit.After; import org.junit.After;
import org.junit.Before; import org.junit.Before;
@ -36,7 +36,7 @@ import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when; import static org.mockito.Mockito.when;
public class ChannelFactoryTests extends ESTestCase { public class ChannelFactoryTests extends OpenSearchTestCase {
private ChannelFactory<NioServerSocketChannel, NioSocketChannel> channelFactory; private ChannelFactory<NioServerSocketChannel, NioSocketChannel> channelFactory;
private ChannelFactory.RawChannelFactory rawChannelFactory; private ChannelFactory.RawChannelFactory rawChannelFactory;

View File

@ -19,7 +19,7 @@
package org.opensearch.nio; package org.opensearch.nio;
import org.elasticsearch.test.ESTestCase; import org.opensearch.test.OpenSearchTestCase;
import org.junit.Before; import org.junit.Before;
import java.io.IOException; import java.io.IOException;
@ -40,7 +40,7 @@ import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when; import static org.mockito.Mockito.when;
public class EventHandlerTests extends ESTestCase { public class EventHandlerTests extends OpenSearchTestCase {
private Consumer<Exception> channelExceptionHandler; private Consumer<Exception> channelExceptionHandler;
private Consumer<Exception> genericExceptionHandler; private Consumer<Exception> genericExceptionHandler;

View File

@ -19,7 +19,7 @@
package org.opensearch.nio; package org.opensearch.nio;
import org.elasticsearch.test.ESTestCase; import org.opensearch.test.OpenSearchTestCase;
import org.junit.Before; import org.junit.Before;
import java.io.IOException; import java.io.IOException;
@ -28,7 +28,7 @@ import java.util.function.BiConsumer;
import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mock;
public class FlushOperationTests extends ESTestCase { public class FlushOperationTests extends OpenSearchTestCase {
private BiConsumer<Void, Exception> listener; private BiConsumer<Void, Exception> listener;

View File

@ -19,14 +19,14 @@
package org.opensearch.nio; package org.opensearch.nio;
import org.elasticsearch.test.ESTestCase; import org.opensearch.test.OpenSearchTestCase;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicBoolean;
import java.util.function.IntFunction; import java.util.function.IntFunction;
public class InboundChannelBufferTests extends ESTestCase { public class InboundChannelBufferTests extends OpenSearchTestCase {
private IntFunction<Page> defaultPageAllocator; private IntFunction<Page> defaultPageAllocator;

View File

@ -21,16 +21,16 @@ package org.opensearch.nio;
import org.opensearch.common.CheckedRunnable; import org.opensearch.common.CheckedRunnable;
import org.opensearch.common.settings.Settings; import org.opensearch.common.settings.Settings;
import org.elasticsearch.test.ESTestCase; import org.opensearch.test.OpenSearchTestCase;
import java.io.IOException; import java.io.IOException;
import java.net.InetSocketAddress; import java.net.InetSocketAddress;
import java.util.function.Consumer; import java.util.function.Consumer;
import static org.opensearch.common.util.concurrent.EsExecutors.daemonThreadFactory; import static org.opensearch.common.util.concurrent.OpenSearchExecutors.daemonThreadFactory;
import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mock;
public class NioSelectorGroupTests extends ESTestCase { public class NioSelectorGroupTests extends OpenSearchTestCase {
private NioSelectorGroup nioGroup; private NioSelectorGroup nioGroup;

View File

@ -22,7 +22,7 @@ package org.opensearch.nio;
import org.opensearch.common.CheckedRunnable; import org.opensearch.common.CheckedRunnable;
import org.opensearch.common.unit.TimeValue; import org.opensearch.common.unit.TimeValue;
import org.opensearch.common.util.concurrent.AbstractRunnable; import org.opensearch.common.util.concurrent.AbstractRunnable;
import org.elasticsearch.test.ESTestCase; import org.opensearch.test.OpenSearchTestCase;
import org.junit.Before; import org.junit.Before;
import org.mockito.ArgumentCaptor; import org.mockito.ArgumentCaptor;
@ -49,7 +49,7 @@ import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when; import static org.mockito.Mockito.when;
public class NioSelectorTests extends ESTestCase { public class NioSelectorTests extends OpenSearchTestCase {
private NioSelector selector; private NioSelector selector;
private EventHandler eventHandler; private EventHandler eventHandler;

View File

@ -20,7 +20,7 @@
package org.opensearch.nio; package org.opensearch.nio;
import org.opensearch.common.SuppressForbidden; import org.opensearch.common.SuppressForbidden;
import org.elasticsearch.test.ESTestCase; import org.opensearch.test.OpenSearchTestCase;
import org.junit.Before; import org.junit.Before;
import org.mockito.ArgumentCaptor; import org.mockito.ArgumentCaptor;
import org.mockito.stubbing.Answer; import org.mockito.stubbing.Answer;
@ -51,7 +51,7 @@ import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when; import static org.mockito.Mockito.when;
@SuppressForbidden(reason = "allow call to socket connect") @SuppressForbidden(reason = "allow call to socket connect")
public class SocketChannelContextTests extends ESTestCase { public class SocketChannelContextTests extends OpenSearchTestCase {
private SocketChannel rawChannel; private SocketChannel rawChannel;
private TestSocketChannelContext context; private TestSocketChannelContext context;

View File

@ -19,13 +19,13 @@
package org.opensearch.nio; package org.opensearch.nio;
import org.elasticsearch.test.ESTestCase; import org.opensearch.test.OpenSearchTestCase;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.locks.LockSupport; import java.util.concurrent.locks.LockSupport;
public class TaskSchedulerTests extends ESTestCase { public class TaskSchedulerTests extends OpenSearchTestCase {
private TaskScheduler scheduler = new TaskScheduler(); private TaskScheduler scheduler = new TaskScheduler();

View File

@ -19,7 +19,7 @@
package org.opensearch.common.ssl; package org.opensearch.common.ssl;
import org.elasticsearch.test.ESTestCase; import org.opensearch.test.OpenSearchTestCase;
import org.junit.Assert; import org.junit.Assert;
import javax.net.ssl.X509ExtendedTrustManager; import javax.net.ssl.X509ExtendedTrustManager;
@ -33,7 +33,7 @@ import static org.hamcrest.Matchers.emptyArray;
import static org.hamcrest.Matchers.emptyIterable; import static org.hamcrest.Matchers.emptyIterable;
import static org.hamcrest.Matchers.not; import static org.hamcrest.Matchers.not;
public class DefaultJdkTrustConfigTests extends ESTestCase { public class DefaultJdkTrustConfigTests extends OpenSearchTestCase {
private static final BiFunction<String, String, String> EMPTY_SYSTEM_PROPERTIES = (key, defaultValue) -> defaultValue; private static final BiFunction<String, String, String> EMPTY_SYSTEM_PROPERTIES = (key, defaultValue) -> defaultValue;

View File

@ -19,7 +19,7 @@
package org.opensearch.common.ssl; package org.opensearch.common.ssl;
import org.elasticsearch.test.ESTestCase; import org.opensearch.test.OpenSearchTestCase;
import org.hamcrest.Matchers; import org.hamcrest.Matchers;
import javax.net.ssl.X509ExtendedKeyManager; import javax.net.ssl.X509ExtendedKeyManager;
@ -41,7 +41,7 @@ import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.iterableWithSize; import static org.hamcrest.Matchers.iterableWithSize;
import static org.hamcrest.Matchers.notNullValue; import static org.hamcrest.Matchers.notNullValue;
public class PemKeyConfigTests extends ESTestCase { public class PemKeyConfigTests extends OpenSearchTestCase {
private static final int IP_NAME = 7; private static final int IP_NAME = 7;
private static final int DNS_NAME = 2; private static final int DNS_NAME = 2;

View File

@ -19,7 +19,7 @@
package org.opensearch.common.ssl; package org.opensearch.common.ssl;
import org.elasticsearch.test.ESTestCase; import org.opensearch.test.OpenSearchTestCase;
import org.hamcrest.Matchers; import org.hamcrest.Matchers;
import java.nio.file.Files; import java.nio.file.Files;
@ -38,7 +38,7 @@ import java.util.stream.Stream;
import javax.net.ssl.X509ExtendedTrustManager; import javax.net.ssl.X509ExtendedTrustManager;
public class PemTrustConfigTests extends ESTestCase { public class PemTrustConfigTests extends OpenSearchTestCase {
public void testBuildTrustConfigFromSinglePemFile() throws Exception { public void testBuildTrustConfigFromSinglePemFile() throws Exception {
final Path cert = getDataPath("/certs/ca1/ca.crt"); final Path cert = getDataPath("/certs/ca1/ca.crt");

View File

@ -19,7 +19,7 @@
package org.opensearch.common.ssl; package org.opensearch.common.ssl;
import org.elasticsearch.test.ESTestCase; import org.opensearch.test.OpenSearchTestCase;
import java.io.InputStream; import java.io.InputStream;
import java.nio.file.Files; import java.nio.file.Files;
@ -38,7 +38,7 @@ import static org.hamcrest.Matchers.instanceOf;
import static org.hamcrest.Matchers.notNullValue; import static org.hamcrest.Matchers.notNullValue;
import static org.hamcrest.core.StringContains.containsString; import static org.hamcrest.core.StringContains.containsString;
public class PemUtilsTests extends ESTestCase { public class PemUtilsTests extends OpenSearchTestCase {
private static final Supplier<char[]> EMPTY_PASSWORD = () -> new char[0]; private static final Supplier<char[]> EMPTY_PASSWORD = () -> new char[0];
private static final Supplier<char[]> TESTNODE_PASSWORD = "testnode"::toCharArray; private static final Supplier<char[]> TESTNODE_PASSWORD = "testnode"::toCharArray;

View File

@ -22,7 +22,7 @@ package org.opensearch.common.ssl;
import org.opensearch.common.settings.MockSecureSettings; import org.opensearch.common.settings.MockSecureSettings;
import org.opensearch.common.settings.SecureString; import org.opensearch.common.settings.SecureString;
import org.opensearch.common.settings.Settings; import org.opensearch.common.settings.Settings;
import org.elasticsearch.test.ESTestCase; import org.opensearch.test.OpenSearchTestCase;
import javax.net.ssl.KeyManagerFactory; import javax.net.ssl.KeyManagerFactory;
import javax.net.ssl.TrustManagerFactory; import javax.net.ssl.TrustManagerFactory;
@ -37,7 +37,7 @@ import static org.hamcrest.Matchers.instanceOf;
import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.notNullValue; import static org.hamcrest.Matchers.notNullValue;
public class SslConfigurationLoaderTests extends ESTestCase { public class SslConfigurationLoaderTests extends OpenSearchTestCase {
private final Path certRoot = getDataPath("/certs/ca1/ca.crt").getParent().getParent(); private final Path certRoot = getDataPath("/certs/ca1/ca.crt").getParent().getParent();

View File

@ -19,8 +19,8 @@
package org.opensearch.common.ssl; package org.opensearch.common.ssl;
import org.elasticsearch.test.ESTestCase; import org.opensearch.test.OpenSearchTestCase;
import org.elasticsearch.test.EqualsHashCodeTestUtils; import org.opensearch.test.EqualsHashCodeTestUtils;
import org.hamcrest.Matchers; import org.hamcrest.Matchers;
import org.mockito.Mockito; import org.mockito.Mockito;
@ -35,7 +35,7 @@ import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.is;
public class SslConfigurationTests extends ESTestCase { public class SslConfigurationTests extends OpenSearchTestCase {
static final String[] VALID_PROTOCOLS = { "TLSv1.2", "TLSv1.1", "TLSv1", "SSLv3", "SSLv2Hello", "SSLv2" }; static final String[] VALID_PROTOCOLS = { "TLSv1.2", "TLSv1.1", "TLSv1", "SSLv3", "SSLv2Hello", "SSLv2" };

View File

@ -20,7 +20,7 @@
package org.opensearch.common.ssl; package org.opensearch.common.ssl;
import org.opensearch.common.Nullable; import org.opensearch.common.Nullable;
import org.elasticsearch.test.ESTestCase; import org.opensearch.test.OpenSearchTestCase;
import org.hamcrest.Matchers; import org.hamcrest.Matchers;
import org.mockito.Mockito; import org.mockito.Mockito;
@ -43,7 +43,7 @@ import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.Stream; import java.util.stream.Stream;
public class SslDiagnosticsTests extends ESTestCase { public class SslDiagnosticsTests extends OpenSearchTestCase {
// Some constants for use in mock certificates // Some constants for use in mock certificates
private static final byte[] MOCK_ENCODING_1 = { 0x61, 0x62, 0x63, 0x64, 0x65, 0x66 }; private static final byte[] MOCK_ENCODING_1 = { 0x61, 0x62, 0x63, 0x64, 0x65, 0x66 };

View File

@ -19,7 +19,7 @@
package org.opensearch.common.ssl; package org.opensearch.common.ssl;
import org.elasticsearch.test.ESTestCase; import org.opensearch.test.OpenSearchTestCase;
import org.hamcrest.Matchers; import org.hamcrest.Matchers;
import javax.net.ssl.KeyManagerFactory; import javax.net.ssl.KeyManagerFactory;
@ -43,7 +43,7 @@ import static org.hamcrest.Matchers.iterableWithSize;
import static org.hamcrest.Matchers.notNullValue; import static org.hamcrest.Matchers.notNullValue;
import static org.hamcrest.Matchers.nullValue; import static org.hamcrest.Matchers.nullValue;
public class StoreKeyConfigTests extends ESTestCase { public class StoreKeyConfigTests extends OpenSearchTestCase {
private static final int IP_NAME = 7; private static final int IP_NAME = 7;
private static final int DNS_NAME = 2; private static final int DNS_NAME = 2;

View File

@ -19,7 +19,7 @@
package org.opensearch.common.ssl; package org.opensearch.common.ssl;
import org.elasticsearch.test.ESTestCase; import org.opensearch.test.OpenSearchTestCase;
import org.hamcrest.Matchers; import org.hamcrest.Matchers;
import javax.net.ssl.TrustManagerFactory; import javax.net.ssl.TrustManagerFactory;
@ -38,7 +38,7 @@ import java.util.stream.Stream;
import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.nullValue; import static org.hamcrest.Matchers.nullValue;
public class StoreTrustConfigTests extends ESTestCase { public class StoreTrustConfigTests extends OpenSearchTestCase {
private static final char[] P12_PASS = "p12-pass".toCharArray(); private static final char[] P12_PASS = "p12-pass".toCharArray();
private static final char[] JKS_PASS = "jks-pass".toCharArray(); private static final char[] JKS_PASS = "jks-pass".toCharArray();

View File

@ -19,14 +19,14 @@
package org.opensearch.common; package org.opensearch.common;
import org.opensearch.common.xcontent.LoggingDeprecationHandler; import org.opensearch.common.xcontent.LoggingDeprecationHandler;
import org.elasticsearch.test.ESTestCase; import org.opensearch.test.OpenSearchTestCase;
import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.not; import static org.hamcrest.CoreMatchers.not;
import static org.hamcrest.CoreMatchers.sameInstance; import static org.hamcrest.CoreMatchers.sameInstance;
import static org.hamcrest.Matchers.arrayContainingInAnyOrder; import static org.hamcrest.Matchers.arrayContainingInAnyOrder;
public class ParseFieldTests extends ESTestCase { public class ParseFieldTests extends OpenSearchTestCase {
public void testParse() { public void testParse() {
String name = "foo_bar"; String name = "foo_bar";
ParseField field = new ParseField(name); ParseField field = new ParseField(name);

Some files were not shown because too many files have changed in this diff Show More