Skip to content

Commit

Permalink
Rename Class
Browse files Browse the repository at this point in the history
Signed-off-by: pranikum <[email protected]>
  • Loading branch information
pranikum committed Sep 22, 2022
1 parent 86f8c54 commit 24ab026
Show file tree
Hide file tree
Showing 13 changed files with 67 additions and 67 deletions.
8 changes: 4 additions & 4 deletions server/src/main/java/org/opensearch/action/ActionModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
import org.opensearch.action.admin.cluster.configuration.TransportAddVotingConfigExclusionsAction;
import org.opensearch.action.admin.cluster.configuration.TransportClearVotingConfigExclusionsAction;
import org.opensearch.action.admin.cluster.decommission.awareness.delete.DeleteDecommissionStateAction;
import org.opensearch.action.admin.cluster.decommission.awareness.delete.TransportDeleteDecommissionAction;
import org.opensearch.action.admin.cluster.decommission.awareness.delete.TransportDeleteDecommissionStateAction;
import org.opensearch.action.admin.cluster.health.ClusterHealthAction;
import org.opensearch.action.admin.cluster.health.TransportClusterHealthAction;
import org.opensearch.action.admin.cluster.node.hotthreads.NodesHotThreadsAction;
Expand Down Expand Up @@ -304,7 +304,7 @@
import org.opensearch.rest.action.admin.cluster.RestClusterStatsAction;
import org.opensearch.rest.action.admin.cluster.RestClusterUpdateSettingsAction;
import org.opensearch.rest.action.admin.cluster.RestCreateSnapshotAction;
import org.opensearch.rest.action.admin.cluster.RestDeleteDecommissionAction;
import org.opensearch.rest.action.admin.cluster.RestDeleteDecommissionStateAction;
import org.opensearch.rest.action.admin.cluster.RestDeleteRepositoryAction;
import org.opensearch.rest.action.admin.cluster.RestDeleteSnapshotAction;
import org.opensearch.rest.action.admin.cluster.RestDeleteStoredScriptAction;
Expand Down Expand Up @@ -565,7 +565,7 @@ public <Request extends ActionRequest, Response extends ActionResponse> void reg
actions.register(CloneSnapshotAction.INSTANCE, TransportCloneSnapshotAction.class);
actions.register(RestoreSnapshotAction.INSTANCE, TransportRestoreSnapshotAction.class);
actions.register(SnapshotsStatusAction.INSTANCE, TransportSnapshotsStatusAction.class);
actions.register(DeleteDecommissionStateAction.INSTANCE, TransportDeleteDecommissionAction.class);
actions.register(DeleteDecommissionStateAction.INSTANCE, TransportDeleteDecommissionStateAction.class);

actions.register(IndicesStatsAction.INSTANCE, TransportIndicesStatsAction.class);
actions.register(IndicesSegmentsAction.INSTANCE, TransportIndicesSegmentsAction.class);
Expand Down Expand Up @@ -877,7 +877,7 @@ public void initRestHandlers(Supplier<DiscoveryNodes> nodesInCluster) {
}
}
registerHandler.accept(new RestCatAction(catActions));
registerHandler.accept(new RestDeleteDecommissionAction());
registerHandler.accept(new RestDeleteDecommissionStateAction());

// Remote Store APIs
if (FeatureFlags.isEnabled(FeatureFlags.REMOTE_STORE)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@
* @opensearch.internal
*/

public class DeleteDecommissionStateAction extends ActionType<DeleteDecommissionResponse> {
public class DeleteDecommissionStateAction extends ActionType<DeleteDecommissionStateResponse> {
public static final DeleteDecommissionStateAction INSTANCE = new DeleteDecommissionStateAction();
public static final String NAME = "cluster:admin/decommission/awareness/delete";

private DeleteDecommissionStateAction() {
super(NAME, DeleteDecommissionResponse::new);
super(NAME, DeleteDecommissionStateResponse::new);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@
*
* @opensearch.internal
*/
public class DeleteDecommissionRequest extends ClusterManagerNodeRequest<DeleteDecommissionRequest> {
public class DeleteDecommissionStateRequest extends ClusterManagerNodeRequest<DeleteDecommissionStateRequest> {

public DeleteDecommissionRequest() {}
public DeleteDecommissionStateRequest() {}

public DeleteDecommissionRequest(StreamInput in) throws IOException {
public DeleteDecommissionStateRequest(StreamInput in) throws IOException {
super(in);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@
*
* @opensearch.internal
*/
public class DeleteDecommissionRequestBuilder extends ClusterManagerNodeOperationRequestBuilder<
DeleteDecommissionRequest,
DeleteDecommissionResponse,
DeleteDecommissionRequestBuilder> {
public class DeleteDecommissionStateRequestBuilder extends ClusterManagerNodeOperationRequestBuilder<
DeleteDecommissionStateRequest,
DeleteDecommissionStateResponse,
DeleteDecommissionStateRequestBuilder> {

public DeleteDecommissionRequestBuilder(OpenSearchClient client, DeleteDecommissionStateAction action) {
super(client, action, new DeleteDecommissionRequest());
public DeleteDecommissionStateRequestBuilder(OpenSearchClient client, DeleteDecommissionStateAction action) {
super(client, action, new DeleteDecommissionStateRequest());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@
*
* @opensearch.internal
*/
public class DeleteDecommissionResponse extends AcknowledgedResponse implements ToXContentObject {
public class DeleteDecommissionStateResponse extends AcknowledgedResponse implements ToXContentObject {

public DeleteDecommissionResponse(StreamInput in) throws IOException {
public DeleteDecommissionStateResponse(StreamInput in) throws IOException {
super(in);
}

public DeleteDecommissionResponse(boolean acknowledged) {
public DeleteDecommissionStateResponse(boolean acknowledged) {
super(acknowledged);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@
*
* @opensearch.internal
*/
public class TransportDeleteDecommissionAction extends TransportClusterManagerNodeAction<
DeleteDecommissionRequest,
DeleteDecommissionResponse> {
public class TransportDeleteDecommissionStateAction extends TransportClusterManagerNodeAction<
DeleteDecommissionStateRequest,
DeleteDecommissionStateResponse> {

private static final Logger logger = LogManager.getLogger(TransportDeleteDecommissionAction.class);
private static final Logger logger = LogManager.getLogger(TransportDeleteDecommissionStateAction.class);

@Inject
public TransportDeleteDecommissionAction(
public TransportDeleteDecommissionStateAction(
TransportService transportService,
ClusterService clusterService,
ThreadPool threadPool,
Expand All @@ -50,7 +50,7 @@ public TransportDeleteDecommissionAction(
clusterService,
threadPool,
actionFilters,
DeleteDecommissionRequest::new,
DeleteDecommissionStateRequest::new,
indexNameExpressionResolver
);
}
Expand All @@ -61,23 +61,23 @@ protected String executor() {
}

@Override
protected DeleteDecommissionResponse read(StreamInput in) throws IOException {
return new DeleteDecommissionResponse(in);
protected DeleteDecommissionStateResponse read(StreamInput in) throws IOException {
return new DeleteDecommissionStateResponse(in);
}

@Override
protected ClusterBlockException checkBlock(DeleteDecommissionRequest request, ClusterState state) {
protected ClusterBlockException checkBlock(DeleteDecommissionStateRequest request, ClusterState state) {
return state.blocks().globalBlockedException(ClusterBlockLevel.METADATA_WRITE);
}

@Override
protected void clusterManagerOperation(
DeleteDecommissionRequest request,
DeleteDecommissionStateRequest request,
ClusterState state,
ActionListener<DeleteDecommissionResponse> listener
ActionListener<DeleteDecommissionStateResponse> listener
) {
// TODO: Enable when service class change is merged
logger.info("Received delete decommission Request");
listener.onResponse(new DeleteDecommissionResponse(true));
listener.onResponse(new DeleteDecommissionStateResponse(true));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@
import org.opensearch.action.admin.cluster.allocation.ClusterAllocationExplainRequest;
import org.opensearch.action.admin.cluster.allocation.ClusterAllocationExplainRequestBuilder;
import org.opensearch.action.admin.cluster.allocation.ClusterAllocationExplainResponse;
import org.opensearch.action.admin.cluster.decommission.awareness.delete.DeleteDecommissionRequest;
import org.opensearch.action.admin.cluster.decommission.awareness.delete.DeleteDecommissionRequestBuilder;
import org.opensearch.action.admin.cluster.decommission.awareness.delete.DeleteDecommissionResponse;
import org.opensearch.action.admin.cluster.decommission.awareness.delete.DeleteDecommissionStateRequest;
import org.opensearch.action.admin.cluster.decommission.awareness.delete.DeleteDecommissionStateRequestBuilder;
import org.opensearch.action.admin.cluster.decommission.awareness.delete.DeleteDecommissionStateResponse;
import org.opensearch.action.admin.cluster.health.ClusterHealthRequest;
import org.opensearch.action.admin.cluster.health.ClusterHealthRequestBuilder;
import org.opensearch.action.admin.cluster.health.ClusterHealthResponse;
Expand Down Expand Up @@ -798,15 +798,15 @@ public interface ClusterAdminClient extends OpenSearchClient {
/**
* Deletes the decommission metadata.
*/
ActionFuture<DeleteDecommissionResponse> deleteDecommission(DeleteDecommissionRequest request);
ActionFuture<DeleteDecommissionStateResponse> deleteDecommission(DeleteDecommissionStateRequest request);

/**
* Deletes the decommission metadata.
*/
void deleteDecommission(DeleteDecommissionRequest request, ActionListener<DeleteDecommissionResponse> listener);
void deleteDecommission(DeleteDecommissionStateRequest request, ActionListener<DeleteDecommissionStateResponse> listener);

/**
* Deletes the decommission metadata.
*/
DeleteDecommissionRequestBuilder prepareDeleteDecommission();
DeleteDecommissionStateRequestBuilder prepareDeleteDecommission();
}
6 changes: 3 additions & 3 deletions server/src/main/java/org/opensearch/client/Requests.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

package org.opensearch.client;

import org.opensearch.action.admin.cluster.decommission.awareness.delete.DeleteDecommissionRequest;
import org.opensearch.action.admin.cluster.decommission.awareness.delete.DeleteDecommissionStateRequest;
import org.opensearch.action.admin.cluster.health.ClusterHealthRequest;
import org.opensearch.action.admin.cluster.node.info.NodesInfoRequest;
import org.opensearch.action.admin.cluster.node.stats.NodesStatsRequest;
Expand Down Expand Up @@ -543,8 +543,8 @@ public static DeleteSnapshotRequest deleteSnapshotRequest(String repository, Str
/**
* Creates a new delete decommission request.
*/
public static DeleteDecommissionRequest deleteDecommissionRequest() {
return new DeleteDecommissionRequest();
public static DeleteDecommissionStateRequest deleteDecommissionRequest() {
return new DeleteDecommissionStateRequest();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@
import org.opensearch.action.admin.cluster.allocation.ClusterAllocationExplainRequestBuilder;
import org.opensearch.action.admin.cluster.allocation.ClusterAllocationExplainResponse;
import org.opensearch.action.admin.cluster.decommission.awareness.delete.DeleteDecommissionStateAction;
import org.opensearch.action.admin.cluster.decommission.awareness.delete.DeleteDecommissionRequest;
import org.opensearch.action.admin.cluster.decommission.awareness.delete.DeleteDecommissionRequestBuilder;
import org.opensearch.action.admin.cluster.decommission.awareness.delete.DeleteDecommissionResponse;
import org.opensearch.action.admin.cluster.decommission.awareness.delete.DeleteDecommissionStateRequest;
import org.opensearch.action.admin.cluster.decommission.awareness.delete.DeleteDecommissionStateRequestBuilder;
import org.opensearch.action.admin.cluster.decommission.awareness.delete.DeleteDecommissionStateResponse;
import org.opensearch.action.admin.cluster.health.ClusterHealthAction;
import org.opensearch.action.admin.cluster.health.ClusterHealthRequest;
import org.opensearch.action.admin.cluster.health.ClusterHealthRequestBuilder;
Expand Down Expand Up @@ -1269,18 +1269,18 @@ public ActionFuture<AcknowledgedResponse> deleteDanglingIndex(DeleteDanglingInde
}

@Override
public ActionFuture<DeleteDecommissionResponse> deleteDecommission(DeleteDecommissionRequest request) {
public ActionFuture<DeleteDecommissionStateResponse> deleteDecommission(DeleteDecommissionStateRequest request) {
return execute(DeleteDecommissionStateAction.INSTANCE, request);
}

@Override
public void deleteDecommission(DeleteDecommissionRequest request, ActionListener<DeleteDecommissionResponse> listener) {
public void deleteDecommission(DeleteDecommissionStateRequest request, ActionListener<DeleteDecommissionStateResponse> listener) {
execute(DeleteDecommissionStateAction.INSTANCE, request, listener);
}

@Override
public DeleteDecommissionRequestBuilder prepareDeleteDecommission() {
return new DeleteDecommissionRequestBuilder(this, DeleteDecommissionStateAction.INSTANCE);
public DeleteDecommissionStateRequestBuilder prepareDeleteDecommission() {
return new DeleteDecommissionStateRequestBuilder(this, DeleteDecommissionStateAction.INSTANCE);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

package org.opensearch.rest.action.admin.cluster;

import org.opensearch.action.admin.cluster.decommission.awareness.delete.DeleteDecommissionRequest;
import org.opensearch.action.admin.cluster.decommission.awareness.delete.DeleteDecommissionStateRequest;
import org.opensearch.client.Requests;
import org.opensearch.client.node.NodeClient;
import org.opensearch.rest.BaseRestHandler;
Expand All @@ -26,7 +26,7 @@
*
* @opensearch.api
*/
public class RestDeleteDecommissionAction extends BaseRestHandler {
public class RestDeleteDecommissionStateAction extends BaseRestHandler {

@Override
public List<Route> routes() {
Expand All @@ -35,16 +35,16 @@ public List<Route> routes() {

@Override
public String getName() {
return "delete_decommission_action";
return "delete_decommission_state_action";
}

@Override
protected RestChannelConsumer prepareRequest(RestRequest request, NodeClient client) throws IOException {
DeleteDecommissionRequest deleteDecommissionRequest = createRequest();
return channel -> client.admin().cluster().deleteDecommission(deleteDecommissionRequest, new RestToXContentListener<>(channel));
DeleteDecommissionStateRequest deleteDecommissionStateRequest = createRequest();
return channel -> client.admin().cluster().deleteDecommission(deleteDecommissionStateRequest, new RestToXContentListener<>(channel));
}

DeleteDecommissionRequest createRequest() {
DeleteDecommissionStateRequest createRequest() {
return Requests.deleteDecommissionRequest();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,23 @@

package org.opensearch.action.admin.cluster.decommission.awareness;

import org.opensearch.action.admin.cluster.decommission.awareness.delete.DeleteDecommissionRequest;
import org.opensearch.action.admin.cluster.decommission.awareness.delete.DeleteDecommissionStateRequest;
import org.opensearch.common.io.stream.BytesStreamOutput;
import org.opensearch.common.io.stream.StreamInput;
import org.opensearch.test.OpenSearchTestCase;

import java.io.IOException;

public class DeleteDecommissionRequestTests extends OpenSearchTestCase {
public class DeleteDecommissionStateRequestTests extends OpenSearchTestCase {

public void testSerialization() throws IOException {
final DeleteDecommissionRequest originalRequest = new DeleteDecommissionRequest();
final DeleteDecommissionStateRequest originalRequest = new DeleteDecommissionStateRequest();

final DeleteDecommissionRequest cloneRequest;
final DeleteDecommissionStateRequest cloneRequest;
try (BytesStreamOutput out = new BytesStreamOutput()) {
originalRequest.writeTo(out);
try (StreamInput in = out.bytes().streamInput()) {
cloneRequest = new DeleteDecommissionRequest(in);
cloneRequest = new DeleteDecommissionStateRequest(in);
}
}
assertEquals(cloneRequest.clusterManagerNodeTimeout(), originalRequest.clusterManagerNodeTimeout());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,20 @@

package org.opensearch.action.admin.cluster.decommission.awareness;

import org.opensearch.action.admin.cluster.decommission.awareness.delete.DeleteDecommissionResponse;
import org.opensearch.action.admin.cluster.decommission.awareness.delete.DeleteDecommissionStateResponse;
import org.opensearch.test.OpenSearchTestCase;

import java.io.IOException;

public class DeleteDecommissionResponseTests extends OpenSearchTestCase {
public class DeleteDecommissionStateResponseTests extends OpenSearchTestCase {

public void testSerialization() throws IOException {
final DeleteDecommissionResponse originalResponse = new DeleteDecommissionResponse(true);
final DeleteDecommissionStateResponse originalResponse = new DeleteDecommissionStateResponse(true);

final DeleteDecommissionResponse deserialized = copyWriteable(
final DeleteDecommissionStateResponse deserialized = copyWriteable(
originalResponse,
writableRegistry(),
DeleteDecommissionResponse::new
DeleteDecommissionStateResponse::new
);
assertEquals(deserialized, originalResponse);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,21 @@
package org.opensearch.rest.action.admin.cluster;

import org.junit.Before;
import org.opensearch.action.admin.cluster.decommission.awareness.delete.DeleteDecommissionRequest;
import org.opensearch.action.admin.cluster.decommission.awareness.delete.DeleteDecommissionStateRequest;
import org.opensearch.rest.RestHandler;
import org.opensearch.rest.RestRequest;
import org.opensearch.test.rest.FakeRestRequest;
import org.opensearch.test.rest.RestActionTestCase;

import java.util.List;

public class RestDeleteDecommissionActionTests extends RestActionTestCase {
public class RestDeleteDecommissionStateActionTests extends RestActionTestCase {

private RestDeleteDecommissionAction action;
private RestDeleteDecommissionStateAction action;

@Before
public void setupAction() {
action = new RestDeleteDecommissionAction();
action = new RestDeleteDecommissionStateAction();
controller().registerHandler(action);
}

Expand All @@ -35,7 +35,7 @@ public void testRoutes() {
}

public void testCreateRequest() {
DeleteDecommissionRequest request = action.createRequest();
DeleteDecommissionStateRequest request = action.createRequest();
assertNotNull(request);
}

Expand Down

0 comments on commit 24ab026

Please sign in to comment.