Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Rename] remaining packages and resources in test/framework #364

Merged
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import org.opensearch.common.xcontent.XContentFactory;
import org.opensearch.common.xcontent.XContentParser;
import org.opensearch.common.xcontent.XContentType;
import org.elasticsearch.test.ESTestCase;
import org.opensearch.test.OpenSearchTestCase;

import java.io.IOException;

Expand All @@ -39,7 +39,7 @@
* @param <C> The class representing the request on the client 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 {
final C clientTestInstance = createClientTestInstance();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import org.opensearch.common.xcontent.XContentFactory;
import org.opensearch.common.xcontent.XContentParser;
import org.opensearch.common.xcontent.XContentType;
import org.elasticsearch.test.ESTestCase;
import org.opensearch.test.OpenSearchTestCase;

import java.io.IOException;

Expand All @@ -39,7 +39,7 @@
* @param <S> The class representing the response on the server 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 {
final XContentType xContentType = randomFrom(XContentType.values());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@
package org.opensearch.client;

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.BulkProcessor;
import org.opensearch.action.bulk.BulkRequest;
Expand Down Expand Up @@ -57,11 +54,11 @@
import java.util.stream.IntStream;

import static org.opensearch.common.xcontent.XContentFactory.jsonBuilder;
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.fieldFromSource;
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.hasId;
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.hasIndex;
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.hasProperty;
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.hasType;
import static org.opensearch.test.hamcrest.ElasticsearchAssertions.fieldFromSource;
import static org.opensearch.test.hamcrest.ElasticsearchAssertions.hasId;
import static org.opensearch.test.hamcrest.ElasticsearchAssertions.hasIndex;
import static org.opensearch.test.hamcrest.ElasticsearchAssertions.hasProperty;
import static org.opensearch.test.hamcrest.ElasticsearchAssertions.hasType;
import static org.hamcrest.Matchers.both;
import static org.hamcrest.Matchers.containsInAnyOrder;
import static org.hamcrest.Matchers.either;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

package org.opensearch.client;

import org.opensearch.client.RequestOptions;
import org.opensearch.action.bulk.BulkRequest;
import org.opensearch.action.bulk.BulkResponse;
import org.opensearch.action.index.IndexRequest;
Expand All @@ -31,10 +30,10 @@
import java.io.IOException;
import java.util.function.Function;

import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.hasId;
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.hasIndex;
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.hasProperty;
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.hasType;
import static org.opensearch.test.hamcrest.ElasticsearchAssertions.hasId;
import static org.opensearch.test.hamcrest.ElasticsearchAssertions.hasIndex;
import static org.opensearch.test.hamcrest.ElasticsearchAssertions.hasProperty;
import static org.opensearch.test.hamcrest.ElasticsearchAssertions.hasType;
import static org.hamcrest.Matchers.both;
import static org.hamcrest.Matchers.containsInAnyOrder;
import static org.hamcrest.Matchers.emptyIterable;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
import java.util.Map;

import static java.util.Collections.emptyMap;
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
import static org.opensearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.greaterThan;
import static org.hamcrest.Matchers.notNullValue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
import org.opensearch.cluster.health.ClusterHealthStatus;
import org.opensearch.common.Priority;
import org.opensearch.common.util.CollectionUtils;
import org.elasticsearch.test.ESTestCase;
import org.opensearch.test.OpenSearchTestCase;
import org.hamcrest.CoreMatchers;
import org.junit.Assert;

Expand All @@ -44,7 +44,7 @@
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.Matchers.nullValue;

public class ClusterRequestConvertersTests extends ESTestCase {
public class ClusterRequestConvertersTests extends OpenSearchTestCase {

public void testClusterPutSettings() throws IOException {
ClusterUpdateSettingsRequest request = new ClusterUpdateSettingsRequest();
Expand All @@ -62,7 +62,7 @@ public void testClusterGetSettings() throws IOException {
ClusterGetSettingsRequest request = new ClusterGetSettingsRequest();
Map<String, String> expectedParams = new HashMap<>();
RequestConvertersTests.setRandomMasterTimeout(request, expectedParams);
request.includeDefaults(ESTestCase.randomBoolean());
request.includeDefaults(OpenSearchTestCase.randomBoolean());
if (request.includeDefaults()) {
expectedParams.put("include_defaults", String.valueOf(true));
}
Expand All @@ -77,9 +77,9 @@ public void testClusterHealth() {
ClusterHealthRequest healthRequest = new ClusterHealthRequest();
Map<String, String> expectedParams = new HashMap<>();
RequestConvertersTests.setRandomLocal(healthRequest::local, expectedParams);
String timeoutType = ESTestCase.randomFrom("timeout", "masterTimeout", "both", "none");
String timeout = ESTestCase.randomTimeValue();
String masterTimeout = ESTestCase.randomTimeValue();
String timeoutType = OpenSearchTestCase.randomFrom("timeout", "masterTimeout", "both", "none");
String timeout = OpenSearchTestCase.randomTimeValue();
String masterTimeout = OpenSearchTestCase.randomTimeValue();
switch (timeoutType) {
case "timeout":
healthRequest.timeout(timeout);
Expand All @@ -106,38 +106,38 @@ public void testClusterHealth() {
throw new UnsupportedOperationException();
}
RequestConvertersTests.setRandomWaitForActiveShards(healthRequest::waitForActiveShards, ActiveShardCount.NONE, expectedParams);
if (ESTestCase.randomBoolean()) {
ClusterHealthRequest.Level level = ESTestCase.randomFrom(ClusterHealthRequest.Level.values());
if (OpenSearchTestCase.randomBoolean()) {
ClusterHealthRequest.Level level = OpenSearchTestCase.randomFrom(ClusterHealthRequest.Level.values());
healthRequest.level(level);
expectedParams.put("level", level.name().toLowerCase(Locale.ROOT));
} else {
expectedParams.put("level", "cluster");
}
if (ESTestCase.randomBoolean()) {
Priority priority = ESTestCase.randomFrom(Priority.values());
if (OpenSearchTestCase.randomBoolean()) {
Priority priority = OpenSearchTestCase.randomFrom(Priority.values());
healthRequest.waitForEvents(priority);
expectedParams.put("wait_for_events", priority.name().toLowerCase(Locale.ROOT));
}
if (ESTestCase.randomBoolean()) {
ClusterHealthStatus status = ESTestCase.randomFrom(ClusterHealthStatus.values());
if (OpenSearchTestCase.randomBoolean()) {
ClusterHealthStatus status = OpenSearchTestCase.randomFrom(ClusterHealthStatus.values());
healthRequest.waitForStatus(status);
expectedParams.put("wait_for_status", status.name().toLowerCase(Locale.ROOT));
}
if (ESTestCase.randomBoolean()) {
boolean waitForNoInitializingShards = ESTestCase.randomBoolean();
if (OpenSearchTestCase.randomBoolean()) {
boolean waitForNoInitializingShards = OpenSearchTestCase.randomBoolean();
healthRequest.waitForNoInitializingShards(waitForNoInitializingShards);
if (waitForNoInitializingShards) {
expectedParams.put("wait_for_no_initializing_shards", Boolean.TRUE.toString());
}
}
if (ESTestCase.randomBoolean()) {
boolean waitForNoRelocatingShards = ESTestCase.randomBoolean();
if (OpenSearchTestCase.randomBoolean()) {
boolean waitForNoRelocatingShards = OpenSearchTestCase.randomBoolean();
healthRequest.waitForNoRelocatingShards(waitForNoRelocatingShards);
if (waitForNoRelocatingShards) {
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);

Request request = ClusterRequestConverters.clusterHealth(healthRequest);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
import org.opensearch.common.SuppressForbidden;
import org.opensearch.common.xcontent.XContentHelper;
import org.opensearch.common.xcontent.XContentType;
import org.elasticsearch.test.ESTestCase;
import org.opensearch.test.OpenSearchTestCase;
import org.junit.Before;

import java.io.IOException;
Expand All @@ -67,7 +67,7 @@
/**
* 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";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import org.opensearch.common.xcontent.XContentParser;
import org.opensearch.common.xcontent.json.JsonXContent;
import org.opensearch.rest.RestStatus;
import org.elasticsearch.test.AbstractXContentTestCase;
import org.opensearch.test.AbstractXContentTestCase;

import java.io.IOException;
import java.util.HashMap;
Expand Down
Loading