Skip to content

Commit

Permalink
[Rename] server/src/test/java/org/elasticsearch/action (#191)
Browse files Browse the repository at this point in the history
Signed-off-by: Abbas Hussain <[email protected]>
  • Loading branch information
abbashus authored and nknize committed Mar 22, 2021
1 parent 82f9ff9 commit 4aeed1a
Show file tree
Hide file tree
Showing 269 changed files with 3,357 additions and 3,361 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,14 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.elasticsearch.action;
package org.opensearch.action;

import org.opensearch.action.support.PlainActionFuture;
import org.elasticsearch.common.CheckedConsumer;
import org.elasticsearch.test.ESTestCase;
import org.opensearch.common.CheckedConsumer;
import org.opensearch.test.OpenSearchTestCase;
import org.opensearch.action.ActionListener;


import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
Expand All @@ -34,7 +35,7 @@
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.instanceOf;

public class ActionListenerTests extends ESTestCase {
public class ActionListenerTests extends OpenSearchTestCase {

public void testWrap() {
AtomicReference<Boolean> reference = new AtomicReference<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,35 +17,36 @@
* under the License.
*/

package org.elasticsearch.action;
package org.opensearch.action;

import org.elasticsearch.action.main.MainAction;
import org.elasticsearch.action.main.TransportMainAction;
import org.opensearch.action.main.MainAction;
import org.opensearch.action.main.TransportMainAction;
import org.opensearch.action.support.ActionFilters;
import org.opensearch.action.support.TransportAction;
import org.elasticsearch.client.node.NodeClient;
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
import org.elasticsearch.cluster.node.DiscoveryNodes;
import org.elasticsearch.common.settings.ClusterSettings;
import org.elasticsearch.common.settings.IndexScopedSettings;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.settings.SettingsFilter;
import org.elasticsearch.common.settings.SettingsModule;
import org.elasticsearch.common.util.concurrent.ThreadContext;
import org.elasticsearch.plugins.ActionPlugin;
import org.elasticsearch.plugins.ActionPlugin.ActionHandler;
import org.opensearch.client.node.NodeClient;
import org.opensearch.cluster.metadata.IndexNameExpressionResolver;
import org.opensearch.cluster.node.DiscoveryNodes;
import org.opensearch.common.settings.ClusterSettings;
import org.opensearch.common.settings.IndexScopedSettings;
import org.opensearch.common.settings.Settings;
import org.opensearch.common.settings.SettingsFilter;
import org.opensearch.common.settings.SettingsModule;
import org.opensearch.common.util.concurrent.ThreadContext;
import org.opensearch.plugins.ActionPlugin;
import org.opensearch.plugins.ActionPlugin.ActionHandler;

import org.opensearch.rest.RestChannel;
import org.opensearch.rest.RestController;
import org.opensearch.rest.RestHandler;
import org.opensearch.rest.RestRequest;
import org.opensearch.rest.RestRequest.Method;
import org.opensearch.rest.action.RestMainAction;
import org.elasticsearch.tasks.Task;
import org.elasticsearch.tasks.TaskManager;
import org.elasticsearch.test.ESTestCase;
import org.elasticsearch.threadpool.TestThreadPool;
import org.elasticsearch.threadpool.ThreadPool;
import org.elasticsearch.usage.UsageService;
import org.opensearch.tasks.Task;
import org.opensearch.tasks.TaskManager;
import org.opensearch.test.OpenSearchTestCase;
import org.opensearch.threadpool.TestThreadPool;
import org.opensearch.threadpool.ThreadPool;
import org.opensearch.usage.UsageService;
import org.opensearch.action.ActionListener;
import org.opensearch.action.ActionModule;
import org.opensearch.action.ActionRequest;
Expand All @@ -62,7 +63,7 @@
import static org.hamcrest.Matchers.hasEntry;
import static org.hamcrest.Matchers.startsWith;

public class ActionModuleTests extends ESTestCase {
public class ActionModuleTests extends OpenSearchTestCase {
public void testSetupActionsContainsKnownBuiltin() {
assertThat(ActionModule.setupActions(emptyList()),
hasEntry(MainAction.INSTANCE.name(), new ActionHandler<>(MainAction.INSTANCE, TransportMainAction.class)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@
* under the License.
*/

package org.elasticsearch.action;
package org.opensearch.action;

import org.elasticsearch.test.ESTestCase;
import org.opensearch.test.OpenSearchTestCase;
import org.opensearch.action.ActionResponse;
import org.opensearch.action.ActionType;

public class ActionTests extends ESTestCase {
public class ActionTests extends OpenSearchTestCase {

public void testEquals() {
class FakeAction extends ActionType<ActionResponse> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,27 +17,26 @@
* under the License.
*/

package org.elasticsearch.action;
package org.opensearch.action;

import org.opensearch.action.DocWriteResponse;
import org.opensearch.action.DocWriteResponse.Result;
import org.elasticsearch.action.support.replication.ReplicationResponse.ShardInfo;
import org.elasticsearch.common.bytes.BytesReference;
import org.elasticsearch.common.xcontent.ToXContent;
import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.common.xcontent.json.JsonXContent;
import org.elasticsearch.index.seqno.SequenceNumbers;
import org.elasticsearch.index.shard.ShardId;
import org.elasticsearch.test.ESTestCase;
import org.opensearch.action.support.replication.ReplicationResponse.ShardInfo;
import org.opensearch.common.bytes.BytesReference;
import org.opensearch.common.xcontent.ToXContent;
import org.opensearch.common.xcontent.XContentBuilder;
import org.opensearch.common.xcontent.XContentParser;
import org.opensearch.common.xcontent.json.JsonXContent;
import org.opensearch.index.seqno.SequenceNumbers;
import org.opensearch.index.shard.ShardId;
import org.opensearch.test.OpenSearchTestCase;

import java.io.IOException;

import static org.hamcrest.Matchers.hasEntry;
import static org.hamcrest.Matchers.hasKey;
import static org.hamcrest.Matchers.not;

public class DocWriteResponseTests extends ESTestCase {
public class DocWriteResponseTests extends OpenSearchTestCase {
public void testGetLocation() {
final DocWriteResponse response =
new DocWriteResponse(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@
* under the License.
*/

package org.elasticsearch.action;
package org.opensearch.action;

import org.elasticsearch.test.ESTestCase;
import org.opensearch.test.OpenSearchTestCase;
import org.opensearch.action.NotifyOnceListener;

import java.util.concurrent.atomic.AtomicReference;

public class NotifyOnceListenerTests extends ESTestCase {
public class NotifyOnceListenerTests extends OpenSearchTestCase {

public void testWhenSuccessCannotNotifyMultipleTimes() {
AtomicReference<String> response = new AtomicReference<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,21 @@
* under the License.
*/

package org.elasticsearch.action;
package org.opensearch.action;

import org.elasticsearch.Version;
import org.opensearch.Version;
import org.opensearch.action.support.IndicesOptions;
import org.elasticsearch.common.io.stream.BytesStreamOutput;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.test.ESTestCase;
import org.opensearch.common.io.stream.BytesStreamOutput;
import org.opensearch.common.io.stream.StreamInput;
import org.opensearch.test.OpenSearchTestCase;
import org.opensearch.action.OriginalIndices;

import java.io.IOException;

import static org.elasticsearch.test.VersionUtils.randomCompatibleVersion;
import static org.opensearch.test.VersionUtils.randomCompatibleVersion;
import static org.hamcrest.CoreMatchers.equalTo;

public class OriginalIndicesTests extends ESTestCase {
public class OriginalIndicesTests extends OpenSearchTestCase {

private static final IndicesOptions[] indicesOptionsValues = new IndicesOptions[]{
IndicesOptions.lenientExpandOpen() , IndicesOptions.strictExpand(), IndicesOptions.strictExpandOpen(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@
* under the License.
*/

package org.elasticsearch.action;
package org.opensearch.action;

import org.opensearch.action.admin.indices.mapping.put.PutMappingRequest;
import org.elasticsearch.common.Randomness;
import org.elasticsearch.test.ESTestCase;
import org.elasticsearch.test.hamcrest.OptionalMatchers;
import org.opensearch.common.Randomness;
import org.opensearch.test.OpenSearchTestCase;
import org.opensearch.test.hamcrest.OptionalMatchers;
import org.hamcrest.Matchers;
import org.opensearch.action.RequestValidators;

Expand All @@ -32,7 +32,7 @@
import java.util.List;
import java.util.Optional;

public class RequestValidatorsTests extends ESTestCase {
public class RequestValidatorsTests extends OpenSearchTestCase {

private final RequestValidators.RequestValidator<PutMappingRequest> EMPTY = (request, state, indices) -> Optional.empty();
private final RequestValidators.RequestValidator<PutMappingRequest> FAIL =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,18 @@
* under the License.
*/

package org.elasticsearch.action;
package org.opensearch.action;

import org.elasticsearch.common.Nullable;
import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.xcontent.XContentBuilder;
import org.opensearch.common.Nullable;
import org.opensearch.common.io.stream.StreamOutput;
import org.opensearch.common.xcontent.XContentBuilder;
import org.opensearch.rest.RestStatus;
import org.elasticsearch.test.ESTestCase;
import org.opensearch.test.OpenSearchTestCase;
import org.opensearch.action.ShardOperationFailedException;

import java.io.IOException;

public class ShardOperationFailedExceptionTests extends ESTestCase {
public class ShardOperationFailedExceptionTests extends OpenSearchTestCase {

public void testCauseCannotBeNull() {
NullPointerException nullPointerException = expectThrows(NullPointerException.class, () -> new Failure(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,28 +16,28 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.elasticsearch.action;
package org.opensearch.action;

import org.opensearch.action.admin.indices.validate.query.ShardValidateQueryRequest;
import org.opensearch.action.admin.indices.validate.query.ValidateQueryRequest;
import org.elasticsearch.common.io.stream.BytesStreamOutput;
import org.elasticsearch.common.io.stream.NamedWriteableAwareStreamInput;
import org.elasticsearch.common.io.stream.NamedWriteableRegistry;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.index.shard.ShardId;
import org.elasticsearch.indices.IndicesModule;
import org.elasticsearch.search.SearchModule;
import org.elasticsearch.search.internal.AliasFilter;
import org.elasticsearch.test.ESTestCase;
import org.opensearch.common.io.stream.BytesStreamOutput;
import org.opensearch.common.io.stream.NamedWriteableAwareStreamInput;
import org.opensearch.common.io.stream.NamedWriteableRegistry;
import org.opensearch.common.io.stream.StreamInput;
import org.opensearch.common.settings.Settings;
import org.opensearch.index.query.QueryBuilders;
import org.opensearch.index.shard.ShardId;
import org.opensearch.indices.IndicesModule;
import org.opensearch.search.SearchModule;
import org.opensearch.search.internal.AliasFilter;
import org.opensearch.test.OpenSearchTestCase;

import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class ShardValidateQueryRequestTests extends ESTestCase {
public class ShardValidateQueryRequestTests extends OpenSearchTestCase {
protected NamedWriteableRegistry namedWriteableRegistry;

public void setUp() throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@
* under the License.
*/

package org.elasticsearch.action;
package org.opensearch.action;

import org.elasticsearch.test.ESTestCase;
import org.elasticsearch.threadpool.TestThreadPool;
import org.elasticsearch.threadpool.ThreadPool;
import org.elasticsearch.transport.RemoteTransportException;
import org.opensearch.test.OpenSearchTestCase;
import org.opensearch.threadpool.TestThreadPool;
import org.opensearch.threadpool.ThreadPool;
import org.opensearch.transport.RemoteTransportException;
import org.junit.After;
import org.junit.Before;
import org.opensearch.action.StepListener;
Expand All @@ -34,7 +34,7 @@

import static org.hamcrest.Matchers.equalTo;

public class StepListenerTests extends ESTestCase {
public class StepListenerTests extends OpenSearchTestCase {
private ThreadPool threadPool;

@Before
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
* under the License.
*/

package org.elasticsearch.action;
package org.opensearch.action;

import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.test.AbstractXContentTestCase;
import org.opensearch.common.xcontent.XContentParser;
import org.opensearch.test.AbstractXContentTestCase;
import org.opensearch.action.TaskOperationFailure;

import java.io.IOException;
Expand All @@ -45,8 +45,8 @@ protected void assertEqualInstances(TaskOperationFailure expectedInstance, TaskO
assertThat(newInstance.getNodeId(), equalTo(expectedInstance.getNodeId()));
assertThat(newInstance.getTaskId(), equalTo(expectedInstance.getTaskId()));
assertThat(newInstance.getStatus(), equalTo(expectedInstance.getStatus()));
// XContent loses the original exception and wraps it as a message in Elasticsearch exception
assertThat(newInstance.getCause().getMessage(), equalTo("Elasticsearch exception [type=illegal_state_exception, reason=message]"));
// XContent loses the original exception and wraps it as a message in OpenSearch exception
assertThat(newInstance.getCause().getMessage(), equalTo("OpenSearch exception [type=illegal_state_exception, reason=message]"));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,26 +17,26 @@
* under the License.
*/

package org.elasticsearch.action.admin.cluster.allocation;

import org.elasticsearch.action.support.replication.ClusterStateCreationUtils;
import org.elasticsearch.cluster.ClusterState;
import org.elasticsearch.cluster.routing.RoutingNode;
import org.elasticsearch.cluster.routing.ShardRouting;
import org.elasticsearch.cluster.routing.ShardRoutingState;
import org.elasticsearch.cluster.routing.UnassignedInfo;
import org.elasticsearch.cluster.routing.allocation.AllocationDecision;
import org.elasticsearch.cluster.routing.allocation.AllocationService;
import org.elasticsearch.cluster.routing.allocation.RoutingAllocation;
import org.elasticsearch.cluster.routing.allocation.ShardAllocationDecision;
import org.elasticsearch.cluster.routing.allocation.allocator.ShardsAllocator;
import org.elasticsearch.cluster.routing.allocation.decider.AllocationDeciders;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.xcontent.ToXContent;
import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentFactory;
import org.elasticsearch.test.ESTestCase;
import org.elasticsearch.test.gateway.TestGatewayAllocator;
package org.opensearch.action.admin.cluster.allocation;

import org.opensearch.action.support.replication.ClusterStateCreationUtils;
import org.opensearch.cluster.ClusterState;
import org.opensearch.cluster.routing.RoutingNode;
import org.opensearch.cluster.routing.ShardRouting;
import org.opensearch.cluster.routing.ShardRoutingState;
import org.opensearch.cluster.routing.UnassignedInfo;
import org.opensearch.cluster.routing.allocation.AllocationDecision;
import org.opensearch.cluster.routing.allocation.AllocationService;
import org.opensearch.cluster.routing.allocation.RoutingAllocation;
import org.opensearch.cluster.routing.allocation.ShardAllocationDecision;
import org.opensearch.cluster.routing.allocation.allocator.ShardsAllocator;
import org.opensearch.cluster.routing.allocation.decider.AllocationDeciders;
import org.opensearch.common.Strings;
import org.opensearch.common.xcontent.ToXContent;
import org.opensearch.common.xcontent.XContentBuilder;
import org.opensearch.common.xcontent.XContentFactory;
import org.opensearch.test.OpenSearchTestCase;
import org.opensearch.test.gateway.TestGatewayAllocator;
import org.opensearch.action.admin.cluster.allocation.ClusterAllocationExplainRequest;
import org.opensearch.action.admin.cluster.allocation.ClusterAllocationExplanation;
import org.opensearch.action.admin.cluster.allocation.TransportClusterAllocationExplainAction;
Expand All @@ -50,7 +50,7 @@
/**
* Tests for the {@link TransportClusterAllocationExplainAction} class.
*/
public class ClusterAllocationExplainActionTests extends ESTestCase {
public class ClusterAllocationExplainActionTests extends OpenSearchTestCase {

private static final AllocationDeciders NOOP_DECIDERS = new AllocationDeciders(Collections.emptyList());

Expand Down
Loading

0 comments on commit 4aeed1a

Please sign in to comment.