diff --git a/server/src/main/java/org/elasticsearch/action/admin/cluster/repositories/delete/DeleteRepositoryRequest.java b/server/src/main/java/org/elasticsearch/action/admin/cluster/repositories/delete/DeleteRepositoryRequest.java index 26403b3b45d..5aaa17a3ce9 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/cluster/repositories/delete/DeleteRepositoryRequest.java +++ b/server/src/main/java/org/elasticsearch/action/admin/cluster/repositories/delete/DeleteRepositoryRequest.java @@ -37,6 +37,11 @@ public class DeleteRepositoryRequest extends AcknowledgedRequest requestValidators) { - super(IndicesAliasesAction.NAME, transportService, clusterService, threadPool, actionFilters, indexNameExpressionResolver, - IndicesAliasesRequest::new); + super(IndicesAliasesAction.NAME, transportService, clusterService, threadPool, actionFilters, IndicesAliasesRequest::new, + indexNameExpressionResolver); this.indexAliasesService = indexAliasesService; this.requestValidators = Objects.requireNonNull(requestValidators); } diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/close/CloseIndexRequest.java b/server/src/main/java/org/elasticsearch/action/admin/indices/close/CloseIndexRequest.java index e45af2c6e04..fb846a5caab 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/close/CloseIndexRequest.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/close/CloseIndexRequest.java @@ -42,6 +42,17 @@ public class CloseIndexRequest extends AcknowledgedRequest im private IndicesOptions indicesOptions = IndicesOptions.strictExpandOpen(); private ActiveShardCount waitForActiveShards = ActiveShardCount.NONE; + public CloseIndexRequest(StreamInput in) throws IOException { + super(in); + indices = in.readStringArray(); + indicesOptions = IndicesOptions.readIndicesOptions(in); + if (in.getVersion().onOrAfter(Version.V_7_2_0)) { + waitForActiveShards = ActiveShardCount.readFrom(in); + } else { + waitForActiveShards = ActiveShardCount.NONE; + } + } + public CloseIndexRequest() { } @@ -113,18 +124,6 @@ public class CloseIndexRequest extends AcknowledgedRequest im return this; } - @Override - public void readFrom(StreamInput in) throws IOException { - super.readFrom(in); - indices = in.readStringArray(); - indicesOptions = IndicesOptions.readIndicesOptions(in); - if (in.getVersion().onOrAfter(Version.V_7_2_0)) { - waitForActiveShards = ActiveShardCount.readFrom(in); - } else { - waitForActiveShards = ActiveShardCount.NONE; - } - } - @Override public void writeTo(StreamOutput out) throws IOException { super.writeTo(out); diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/close/TransportCloseIndexAction.java b/server/src/main/java/org/elasticsearch/action/admin/indices/close/TransportCloseIndexAction.java index 954f4b02606..336a1fee290 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/close/TransportCloseIndexAction.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/close/TransportCloseIndexAction.java @@ -60,8 +60,8 @@ public class TransportCloseIndexAction extends TransportMasterNodeAction private ActiveShardCount waitForActiveShards = ActiveShardCount.DEFAULT; + public CreateIndexRequest(StreamInput in) throws IOException { + super(in); + cause = in.readString(); + index = in.readString(); + settings = readSettingsFromStream(in); + int size = in.readVInt(); + for (int i = 0; i < size; i++) { + final String type = in.readString(); + String source = in.readString(); + if (in.getVersion().before(Version.V_6_0_0_alpha1)) { // TODO change to 5.3.0 after backport + // we do not know the content type that comes from earlier versions so we autodetect and convert + source = XContentHelper.convertToJson(new BytesArray(source), false, false, XContentFactory.xContentType(source)); + } + mappings.put(type, source); + } + if (in.getVersion().before(Version.V_6_5_0)) { + // This used to be the size of custom metadata classes + int customSize = in.readVInt(); + assert customSize == 0 : "unexpected custom metadata when none is supported"; + if (customSize > 0) { + throw new IllegalStateException("unexpected custom metadata when none is supported"); + } + } + int aliasesSize = in.readVInt(); + for (int i = 0; i < aliasesSize; i++) { + aliases.add(Alias.read(in)); + } + if (in.getVersion().before(Version.V_7_0_0)) { + in.readBoolean(); // updateAllTypes + } + waitForActiveShards = ActiveShardCount.readFrom(in); + } + public CreateIndexRequest() { } @@ -430,42 +463,7 @@ public class CreateIndexRequest extends AcknowledgedRequest public CreateIndexRequest waitForActiveShards(final int waitForActiveShards) { return waitForActiveShards(ActiveShardCount.from(waitForActiveShards)); } - - - @Override - public void readFrom(StreamInput in) throws IOException { - super.readFrom(in); - cause = in.readString(); - index = in.readString(); - settings = readSettingsFromStream(in); - int size = in.readVInt(); - for (int i = 0; i < size; i++) { - final String type = in.readString(); - String source = in.readString(); - if (in.getVersion().before(Version.V_6_0_0_alpha1)) { // TODO change to 5.3.0 after backport - // we do not know the content type that comes from earlier versions so we autodetect and convert - source = XContentHelper.convertToJson(new BytesArray(source), false, false, XContentFactory.xContentType(source)); - } - mappings.put(type, source); - } - if (in.getVersion().before(Version.V_6_5_0)) { - // This used to be the size of custom metadata classes - int customSize = in.readVInt(); - assert customSize == 0 : "unexpected custom metadata when none is supported"; - if (customSize > 0) { - throw new IllegalStateException("unexpected custom metadata when none is supported"); - } - } - int aliasesSize = in.readVInt(); - for (int i = 0; i < aliasesSize; i++) { - aliases.add(Alias.read(in)); - } - if (in.getVersion().before(Version.V_7_0_0)) { - in.readBoolean(); // updateAllTypes - } - waitForActiveShards = ActiveShardCount.readFrom(in); - } - + @Override public void writeTo(StreamOutput out) throws IOException { super.writeTo(out); diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/create/TransportCreateIndexAction.java b/server/src/main/java/org/elasticsearch/action/admin/indices/create/TransportCreateIndexAction.java index 7dbf0d24c91..935c5efda94 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/create/TransportCreateIndexAction.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/create/TransportCreateIndexAction.java @@ -46,8 +46,8 @@ public class TransportCreateIndexAction extends TransportMasterNodeAction // Delete index should work by default on both open and closed indices. private IndicesOptions indicesOptions = IndicesOptions.fromOptions(false, true, true, true, false, false, true, false); + public DeleteIndexRequest(StreamInput in) throws IOException { + super(in); + indices = in.readStringArray(); + indicesOptions = IndicesOptions.readIndicesOptions(in); + } + public DeleteIndexRequest() { } @@ -94,13 +100,6 @@ public class DeleteIndexRequest extends AcknowledgedRequest return indices; } - @Override - public void readFrom(StreamInput in) throws IOException { - super.readFrom(in); - indices = in.readStringArray(); - indicesOptions = IndicesOptions.readIndicesOptions(in); - } - @Override public void writeTo(StreamOutput out) throws IOException { super.writeTo(out); diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/delete/TransportDeleteIndexAction.java b/server/src/main/java/org/elasticsearch/action/admin/indices/delete/TransportDeleteIndexAction.java index ddea16c9fc0..793b937e390 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/delete/TransportDeleteIndexAction.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/delete/TransportDeleteIndexAction.java @@ -56,8 +56,8 @@ public class TransportDeleteIndexAction extends TransportMasterNodeAction im private Index concreteIndex; + public PutMappingRequest(StreamInput in) throws IOException { + super(in); + indices = in.readStringArray(); + indicesOptions = IndicesOptions.readIndicesOptions(in); + type = in.readOptionalString(); + source = in.readString(); + if (in.getVersion().before(Version.V_7_0_0)) { + in.readBoolean(); // updateAllTypes + } + concreteIndex = in.readOptionalWriteable(Index::new); + if (in.getVersion().onOrAfter(Version.V_6_7_0)) { + origin = in.readOptionalString(); + } else { + origin = null; + } + } + public PutMappingRequest() { } @@ -300,24 +317,6 @@ public class PutMappingRequest extends AcknowledgedRequest im } } - @Override - public void readFrom(StreamInput in) throws IOException { - super.readFrom(in); - indices = in.readStringArray(); - indicesOptions = IndicesOptions.readIndicesOptions(in); - type = in.readOptionalString(); - source = in.readString(); - if (in.getVersion().before(Version.V_7_0_0)) { - in.readBoolean(); // updateAllTypes - } - concreteIndex = in.readOptionalWriteable(Index::new); - if (in.getVersion().onOrAfter(Version.V_6_7_0)) { - origin = in.readOptionalString(); - } else { - origin = null; - } - } - @Override public void writeTo(StreamOutput out) throws IOException { super.writeTo(out); diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/mapping/put/TransportPutMappingAction.java b/server/src/main/java/org/elasticsearch/action/admin/indices/mapping/put/TransportPutMappingAction.java index 2057e3420a3..69d17296a26 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/mapping/put/TransportPutMappingAction.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/mapping/put/TransportPutMappingAction.java @@ -60,8 +60,8 @@ public class TransportPutMappingAction extends TransportMasterNodeAction requestValidators) { - super(PutMappingAction.NAME, transportService, clusterService, threadPool, actionFilters, indexNameExpressionResolver, - PutMappingRequest::new); + super(PutMappingAction.NAME, transportService, clusterService, threadPool, actionFilters, PutMappingRequest::new, + indexNameExpressionResolver); this.metaDataMappingService = metaDataMappingService; this.requestValidators = Objects.requireNonNull(requestValidators); } diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/open/OpenIndexRequest.java b/server/src/main/java/org/elasticsearch/action/admin/indices/open/OpenIndexRequest.java index 0cace4e83bf..958e5b78b74 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/open/OpenIndexRequest.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/open/OpenIndexRequest.java @@ -42,6 +42,15 @@ public class OpenIndexRequest extends AcknowledgedRequest impl private IndicesOptions indicesOptions = IndicesOptions.fromOptions(false, true, false, true); private ActiveShardCount waitForActiveShards = ActiveShardCount.DEFAULT; + public OpenIndexRequest(StreamInput in) throws IOException { + super(in); + indices = in.readStringArray(); + indicesOptions = IndicesOptions.readIndicesOptions(in); + if (in.getVersion().onOrAfter(Version.V_6_1_0)) { + waitForActiveShards = ActiveShardCount.readFrom(in); + } + } + public OpenIndexRequest() { } @@ -136,16 +145,6 @@ public class OpenIndexRequest extends AcknowledgedRequest impl return waitForActiveShards(ActiveShardCount.from(waitForActiveShards)); } - @Override - public void readFrom(StreamInput in) throws IOException { - super.readFrom(in); - indices = in.readStringArray(); - indicesOptions = IndicesOptions.readIndicesOptions(in); - if (in.getVersion().onOrAfter(Version.V_6_1_0)) { - waitForActiveShards = ActiveShardCount.readFrom(in); - } - } - @Override public void writeTo(StreamOutput out) throws IOException { super.writeTo(out); diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/open/TransportOpenIndexAction.java b/server/src/main/java/org/elasticsearch/action/admin/indices/open/TransportOpenIndexAction.java index 20cc156b554..24027c36112 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/open/TransportOpenIndexAction.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/open/TransportOpenIndexAction.java @@ -53,8 +53,8 @@ public class TransportOpenIndexAction extends TransportMasterNodeAction implem //the index name "_na_" is never read back, what matters are settings, mappings and aliases private CreateIndexRequest createIndexRequest = new CreateIndexRequest("_na_"); + public RolloverRequest(StreamInput in) throws IOException { + super(in); + alias = in.readString(); + newIndexName = in.readOptionalString(); + dryRun = in.readBoolean(); + int size = in.readVInt(); + for (int i = 0; i < size; i++) { + Condition condition = in.readNamedWriteable(Condition.class); + this.conditions.put(condition.name, condition); + } + createIndexRequest = new CreateIndexRequest(in); + } + RolloverRequest() {} public RolloverRequest(String alias, String newIndexName) { @@ -112,21 +125,6 @@ public class RolloverRequest extends AcknowledgedRequest implem return validationException; } - @Override - public void readFrom(StreamInput in) throws IOException { - super.readFrom(in); - alias = in.readString(); - newIndexName = in.readOptionalString(); - dryRun = in.readBoolean(); - int size = in.readVInt(); - for (int i = 0; i < size; i++) { - Condition condition = in.readNamedWriteable(Condition.class); - this.conditions.put(condition.name, condition); - } - createIndexRequest = new CreateIndexRequest(); - createIndexRequest.readFrom(in); - } - @Override public void writeTo(StreamOutput out) throws IOException { super.writeTo(out); diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/rollover/TransportRolloverAction.java b/server/src/main/java/org/elasticsearch/action/admin/indices/rollover/TransportRolloverAction.java index 01ad024bc5b..7be1c82b129 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/rollover/TransportRolloverAction.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/rollover/TransportRolloverAction.java @@ -80,8 +80,8 @@ public class TransportRolloverAction extends TransportMasterNodeAction implements private ResizeType type = ResizeType.SHRINK; private Boolean copySettings = true; + public ResizeRequest(StreamInput in) throws IOException { + super(in); + targetIndexRequest = new CreateIndexRequest(in); + sourceIndex = in.readString(); + if (in.getVersion().onOrAfter(ResizeAction.COMPATIBILITY_VERSION)) { + type = in.readEnum(ResizeType.class); + } else { + type = ResizeType.SHRINK; // BWC this used to be shrink only + } + if (in.getVersion().before(Version.V_6_4_0)) { + copySettings = null; + } else { + copySettings = in.readOptionalBoolean(); + } + } + ResizeRequest() {} public ResizeRequest(String targetIndex, String sourceIndex) { @@ -88,24 +104,6 @@ public class ResizeRequest extends AcknowledgedRequest implements this.sourceIndex = index; } - @Override - public void readFrom(StreamInput in) throws IOException { - super.readFrom(in); - targetIndexRequest = new CreateIndexRequest(); - targetIndexRequest.readFrom(in); - sourceIndex = in.readString(); - if (in.getVersion().onOrAfter(ResizeAction.COMPATIBILITY_VERSION)) { - type = in.readEnum(ResizeType.class); - } else { - type = ResizeType.SHRINK; // BWC this used to be shrink only - } - if (in.getVersion().before(Version.V_6_4_0)) { - copySettings = null; - } else { - copySettings = in.readOptionalBoolean(); - } - } - @Override public void writeTo(StreamOutput out) throws IOException { super.writeTo(out); diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/shrink/TransportResizeAction.java b/server/src/main/java/org/elasticsearch/action/admin/indices/shrink/TransportResizeAction.java index 32eb64490fc..af871a91576 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/shrink/TransportResizeAction.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/shrink/TransportResizeAction.java @@ -69,8 +69,7 @@ public class TransportResizeAction extends TransportMasterNodeAction> versions; + public UpgradeSettingsRequest(StreamInput in) throws IOException { + super(in); + int size = in.readVInt(); + versions = new HashMap<>(); + for (int i=0; i(upgradeVersion, oldestLuceneSegment)); + } + } + public UpgradeSettingsRequest() { } @@ -74,20 +86,6 @@ public class UpgradeSettingsRequest extends AcknowledgedRequest(); - for (int i=0; i(upgradeVersion, oldestLuceneSegment)); - } - } - @Override public void writeTo(StreamOutput out) throws IOException { super.writeTo(out); diff --git a/server/src/main/java/org/elasticsearch/action/ingest/DeletePipelineRequest.java b/server/src/main/java/org/elasticsearch/action/ingest/DeletePipelineRequest.java index 65afad730a0..9133dee2303 100644 --- a/server/src/main/java/org/elasticsearch/action/ingest/DeletePipelineRequest.java +++ b/server/src/main/java/org/elasticsearch/action/ingest/DeletePipelineRequest.java @@ -39,6 +39,11 @@ public class DeletePipelineRequest extends AcknowledgedRequest this.xContentType = Objects.requireNonNull(xContentType); } + public PutPipelineRequest(StreamInput in) throws IOException { + super(in); + id = in.readString(); + source = in.readBytesReference(); + xContentType = in.readEnum(XContentType.class); + } + PutPipelineRequest() { } @@ -66,14 +73,6 @@ public class PutPipelineRequest extends AcknowledgedRequest return xContentType; } - @Override - public void readFrom(StreamInput in) throws IOException { - super.readFrom(in); - id = in.readString(); - source = in.readBytesReference(); - xContentType = in.readEnum(XContentType.class); - } - @Override public void writeTo(StreamOutput out) throws IOException { super.writeTo(out); diff --git a/server/src/main/java/org/elasticsearch/action/ingest/PutPipelineTransportAction.java b/server/src/main/java/org/elasticsearch/action/ingest/PutPipelineTransportAction.java index 010704d3aab..bc0937d667a 100644 --- a/server/src/main/java/org/elasticsearch/action/ingest/PutPipelineTransportAction.java +++ b/server/src/main/java/org/elasticsearch/action/ingest/PutPipelineTransportAction.java @@ -53,7 +53,7 @@ public class PutPipelineTransportAction extends TransportMasterNodeAction> entry : cloneRequest.getConditions().entrySet()) { diff --git a/server/src/test/java/org/elasticsearch/action/admin/indices/settings/put/UpdateSettingsRequestStreamableTests.java b/server/src/test/java/org/elasticsearch/action/admin/indices/settings/put/UpdateSettingsRequestSerializationTests.java similarity index 94% rename from server/src/test/java/org/elasticsearch/action/admin/indices/settings/put/UpdateSettingsRequestStreamableTests.java rename to server/src/test/java/org/elasticsearch/action/admin/indices/settings/put/UpdateSettingsRequestSerializationTests.java index 5732630e20c..db67bfb6492 100644 --- a/server/src/test/java/org/elasticsearch/action/admin/indices/settings/put/UpdateSettingsRequestStreamableTests.java +++ b/server/src/test/java/org/elasticsearch/action/admin/indices/settings/put/UpdateSettingsRequestSerializationTests.java @@ -20,11 +20,12 @@ package org.elasticsearch.action.admin.indices.settings.put; import org.elasticsearch.action.support.IndicesOptions; +import org.elasticsearch.common.io.stream.Writeable; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.Settings.Builder; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.common.util.CollectionUtils; -import org.elasticsearch.test.AbstractStreamableTestCase; +import org.elasticsearch.test.AbstractWireSerializingTestCase; import org.elasticsearch.test.ESTestCase; import java.util.ArrayList; @@ -35,7 +36,7 @@ import java.util.Set; import java.util.StringJoiner; import java.util.function.Supplier; -public class UpdateSettingsRequestStreamableTests extends AbstractStreamableTestCase { +public class UpdateSettingsRequestSerializationTests extends AbstractWireSerializingTestCase { @Override protected UpdateSettingsRequest mutateInstance(UpdateSettingsRequest request) { @@ -60,8 +61,8 @@ public class UpdateSettingsRequestStreamableTests extends AbstractStreamableTest } @Override - protected UpdateSettingsRequest createBlankInstance() { - return new UpdateSettingsRequest(); + protected Writeable.Reader instanceReader() { + return UpdateSettingsRequest::new; } public static UpdateSettingsRequest createTestItem() { diff --git a/server/src/test/java/org/elasticsearch/action/admin/indices/settings/put/UpdateSettingsRequestTests.java b/server/src/test/java/org/elasticsearch/action/admin/indices/settings/put/UpdateSettingsRequestTests.java index ff75dbecd52..a0c82c094c3 100644 --- a/server/src/test/java/org/elasticsearch/action/admin/indices/settings/put/UpdateSettingsRequestTests.java +++ b/server/src/test/java/org/elasticsearch/action/admin/indices/settings/put/UpdateSettingsRequestTests.java @@ -32,7 +32,7 @@ public class UpdateSettingsRequestTests extends AbstractXContentTestCase { private License license; private boolean acknowledge = false; + public PutLicenseRequest(StreamInput in) throws IOException { + super(in); + license = License.readLicense(in); + acknowledge = in.readBoolean(); + } + public PutLicenseRequest() { } @@ -61,13 +67,6 @@ public class PutLicenseRequest extends AcknowledgedRequest { return acknowledge; } - @Override - public void readFrom(StreamInput in) throws IOException { - super.readFrom(in); - license = License.readLicense(in); - acknowledge = in.readBoolean(); - } - @Override public void writeTo(StreamOutput out) throws IOException { super.writeTo(out); diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/license/TransportDeleteLicenseAction.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/license/TransportDeleteLicenseAction.java index a0094964b11..f47a14e05bb 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/license/TransportDeleteLicenseAction.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/license/TransportDeleteLicenseAction.java @@ -33,7 +33,7 @@ public class TransportDeleteLicenseAction extends TransportMasterNodeAction { + public DeleteLicenseRequest() {} + + public DeleteLicenseRequest(StreamInput in) throws IOException { + super(in); + } + @Override public ActionRequestValidationException validate() { return null; diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/protocol/xpack/license/PutLicenseRequest.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/protocol/xpack/license/PutLicenseRequest.java index 342e6c296e7..ddf3cd0bffc 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/protocol/xpack/license/PutLicenseRequest.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/protocol/xpack/license/PutLicenseRequest.java @@ -7,12 +7,20 @@ package org.elasticsearch.protocol.xpack.license; import org.elasticsearch.action.ActionRequestValidationException; import org.elasticsearch.action.support.master.AcknowledgedRequest; +import org.elasticsearch.common.io.stream.StreamInput; + +import java.io.IOException; public class PutLicenseRequest extends AcknowledgedRequest { private String licenseDefinition; private boolean acknowledge = false; + public PutLicenseRequest(StreamInput in) throws IOException { + super(in); + + } + public PutLicenseRequest() { } diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/StartILMRequest.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/StartILMRequest.java index de38a5e092a..5f54686805b 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/StartILMRequest.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/StartILMRequest.java @@ -8,9 +8,17 @@ package org.elasticsearch.xpack.core.indexlifecycle; import org.elasticsearch.action.ActionRequestValidationException; import org.elasticsearch.action.support.master.AcknowledgedRequest; +import org.elasticsearch.common.io.stream.StreamInput; + +import java.io.IOException; public class StartILMRequest extends AcknowledgedRequest { + public StartILMRequest(StreamInput in) throws IOException { + super(in); + + } + public StartILMRequest() { } diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/StopILMRequest.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/StopILMRequest.java index 3a2d458406b..14d07150f61 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/StopILMRequest.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/StopILMRequest.java @@ -8,9 +8,17 @@ package org.elasticsearch.xpack.core.indexlifecycle; import org.elasticsearch.action.ActionRequestValidationException; import org.elasticsearch.action.support.master.AcknowledgedRequest; +import org.elasticsearch.common.io.stream.StreamInput; + +import java.io.IOException; public class StopILMRequest extends AcknowledgedRequest { + public StopILMRequest(StreamInput in) throws IOException { + super(in); + + } + public StopILMRequest() { } diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/action/DeleteLifecycleAction.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/action/DeleteLifecycleAction.java index f9f5893bcb0..08655399192 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/action/DeleteLifecycleAction.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/action/DeleteLifecycleAction.java @@ -53,6 +53,11 @@ public class DeleteLifecycleAction extends ActionType { + public Request(StreamInput in) throws IOException { + super(in); + } + public Request() { } @@ -100,11 +104,6 @@ public class GetStatusAction extends StreamableResponseActionType { this.nextStepKey = nextStepKey; } + public Request(StreamInput in) throws IOException { + super(in); + this.index = in.readString(); + this.currentStepKey = new StepKey(in); + this.nextStepKey = new StepKey(in); + } + public Request() { } @@ -97,14 +104,6 @@ public class MoveToStepAction extends ActionType { return PARSER.apply(parser, name); } - @Override - public void readFrom(StreamInput in) throws IOException { - super.readFrom(in); - this.index = in.readString(); - this.currentStepKey = new StepKey(in); - this.nextStepKey = new StepKey(in); - } - @Override public void writeTo(StreamOutput out) throws IOException { super.writeTo(out); diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/action/PutLifecycleAction.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/action/PutLifecycleAction.java index df46356ac20..a9ace834e3d 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/action/PutLifecycleAction.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/action/PutLifecycleAction.java @@ -62,6 +62,11 @@ public class PutLifecycleAction extends ActionType this.policy = policy; } + public Request(StreamInput in) throws IOException { + super(in); + policy = new LifecyclePolicy(in); + } + public Request() { } @@ -86,12 +91,6 @@ public class PutLifecycleAction extends ActionType return builder; } - @Override - public void readFrom(StreamInput in) throws IOException { - super.readFrom(in); - policy = new LifecyclePolicy(in); - } - @Override public void writeTo(StreamOutput out) throws IOException { super.writeTo(out); diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/action/RemoveIndexLifecyclePolicyAction.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/action/RemoveIndexLifecyclePolicyAction.java index 42b45762722..04cdebe2a20 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/action/RemoveIndexLifecyclePolicyAction.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/action/RemoveIndexLifecyclePolicyAction.java @@ -114,6 +114,12 @@ public class RemoveIndexLifecyclePolicyAction extends StreamableResponseActionTy private String[] indices; private IndicesOptions indicesOptions = IndicesOptions.strictExpandOpen(); + public Request(StreamInput in) throws IOException { + super(in); + indices = in.readStringArray(); + indicesOptions = IndicesOptions.readIndicesOptions(in); + } + public Request() { } @@ -148,13 +154,6 @@ public class RemoveIndexLifecyclePolicyAction extends StreamableResponseActionTy return null; } - @Override - public void readFrom(StreamInput in) throws IOException { - super.readFrom(in); - indices = in.readStringArray(); - indicesOptions = IndicesOptions.readIndicesOptions(in); - } - @Override public void writeTo(StreamOutput out) throws IOException { super.writeTo(out); diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/action/RetryAction.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/action/RetryAction.java index f9bcb3474fb..9d25ea093f4 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/action/RetryAction.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/action/RetryAction.java @@ -54,6 +54,12 @@ public class RetryAction extends ActionType { this.indices = indices; } + public Request(StreamInput in) throws IOException { + super(in); + this.indices = in.readStringArray(); + this.indicesOptions = IndicesOptions.readIndicesOptions(in); + } + public Request() { } @@ -83,13 +89,6 @@ public class RetryAction extends ActionType { return null; } - @Override - public void readFrom(StreamInput in) throws IOException { - super.readFrom(in); - this.indices = in.readStringArray(); - this.indicesOptions = IndicesOptions.readIndicesOptions(in); - } - @Override public void writeTo(StreamOutput out) throws IOException { super.writeTo(out); diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/DeleteCalendarAction.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/DeleteCalendarAction.java index 044f13001e7..4ac9cd12b90 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/DeleteCalendarAction.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/DeleteCalendarAction.java @@ -39,6 +39,11 @@ public class DeleteCalendarAction extends ActionType { private String calendarId; + public Request(StreamInput in) throws IOException { + super(in); + calendarId = in.readString(); + } + public Request() { } @@ -55,12 +60,6 @@ public class DeleteCalendarAction extends ActionType { return null; } - @Override - public void readFrom(StreamInput in) throws IOException { - super.readFrom(in); - calendarId = in.readString(); - } - @Override public void writeTo(StreamOutput out) throws IOException { super.writeTo(out); diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/DeleteCalendarEventAction.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/DeleteCalendarEventAction.java index a39a0cec3c9..38a157bd472 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/DeleteCalendarEventAction.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/DeleteCalendarEventAction.java @@ -39,6 +39,12 @@ public class DeleteCalendarEventAction extends ActionType private String calendarId; private String eventId; + public Request(StreamInput in) throws IOException { + super(in); + calendarId = in.readString(); + eventId = in.readString(); + } + public Request() { } @@ -60,13 +66,6 @@ public class DeleteCalendarEventAction extends ActionType return null; } - @Override - public void readFrom(StreamInput in) throws IOException { - super.readFrom(in); - calendarId = in.readString(); - eventId = in.readString(); - } - @Override public void writeTo(StreamOutput out) throws IOException { super.writeTo(out); diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/DeleteDatafeedAction.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/DeleteDatafeedAction.java index 690dc0e55e2..e815704b8ab 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/DeleteDatafeedAction.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/DeleteDatafeedAction.java @@ -74,11 +74,6 @@ public class DeleteDatafeedAction extends ActionType { return null; } - @Override - public void readFrom(StreamInput in) throws IOException { - throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable"); - } - @Override public void writeTo(StreamOutput out) throws IOException { super.writeTo(out); diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/DeleteFilterAction.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/DeleteFilterAction.java index ff591b97d0d..e64e78eca89 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/DeleteFilterAction.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/DeleteFilterAction.java @@ -41,6 +41,11 @@ public class DeleteFilterAction extends ActionType { private String filterId; + public Request(StreamInput in) throws IOException { + super(in); + filterId = in.readString(); + } + public Request() { } @@ -58,12 +63,6 @@ public class DeleteFilterAction extends ActionType { return null; } - @Override - public void readFrom(StreamInput in) throws IOException { - super.readFrom(in); - filterId = in.readString(); - } - @Override public void writeTo(StreamOutput out) throws IOException { super.writeTo(out); diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/DeleteForecastAction.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/DeleteForecastAction.java index 98dcc43ac5a..f201860e7d0 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/DeleteForecastAction.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/DeleteForecastAction.java @@ -40,6 +40,13 @@ public class DeleteForecastAction extends ActionType { private String forecastId; private boolean allowNoForecasts = true; + public Request(StreamInput in) throws IOException { + super(in); + jobId = in.readString(); + forecastId = in.readString(); + allowNoForecasts = in.readBoolean(); + } + public Request() { } @@ -69,14 +76,6 @@ public class DeleteForecastAction extends ActionType { return null; } - @Override - public void readFrom(StreamInput in) throws IOException { - super.readFrom(in); - jobId = in.readString(); - forecastId = in.readString(); - allowNoForecasts = in.readBoolean(); - } - @Override public void writeTo(StreamOutput out) throws IOException { super.writeTo(out); diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/DeleteJobAction.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/DeleteJobAction.java index 543a1e95f56..050cee2d6f0 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/DeleteJobAction.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/DeleteJobAction.java @@ -98,11 +98,6 @@ public class DeleteJobAction extends ActionType { return new JobDeletionTask(id, type, action, "delete-job-" + jobId, parentTaskId, headers); } - @Override - public void readFrom(StreamInput in) throws IOException { - throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable"); - } - @Override public void writeTo(StreamOutput out) throws IOException { super.writeTo(out); diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/PutDataFrameAnalyticsAction.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/PutDataFrameAnalyticsAction.java index 28adc3648f1..ed6a9cd784b 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/PutDataFrameAnalyticsAction.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/PutDataFrameAnalyticsAction.java @@ -60,11 +60,6 @@ public class PutDataFrameAnalyticsAction extends ActionType { return null; } - @Override - public void readFrom(StreamInput in) throws IOException { - throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable"); - } - @Override public void writeTo(StreamOutput out) throws IOException { super.writeTo(out); diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/PutJobAction.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/PutJobAction.java index 1a50ccf8e21..fca9457b9b9 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/PutJobAction.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/PutJobAction.java @@ -86,11 +86,6 @@ public class PutJobAction extends ActionType { return null; } - @Override - public void readFrom(StreamInput in) throws IOException { - throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable"); - } - @Override public void writeTo(StreamOutput out) throws IOException { super.writeTo(out); diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/RevertModelSnapshotAction.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/RevertModelSnapshotAction.java index ce5d08b9c0c..e8dfbd87638 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/RevertModelSnapshotAction.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/RevertModelSnapshotAction.java @@ -102,11 +102,6 @@ public class RevertModelSnapshotAction extends ActionType { } public Request(StreamInput in) throws IOException { - readFrom(in); + super(in); + this.enabled = in.readBoolean(); } public Request() { @@ -68,12 +69,6 @@ public class SetUpgradeModeAction extends ActionType { return null; } - @Override - public void readFrom(StreamInput in) throws IOException { - super.readFrom(in); - this.enabled = in.readBoolean(); - } - @Override public void writeTo(StreamOutput out) throws IOException { super.writeTo(out); diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/UpdateDatafeedAction.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/UpdateDatafeedAction.java index 5cf8dfabf19..5d82a216626 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/UpdateDatafeedAction.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/UpdateDatafeedAction.java @@ -60,11 +60,6 @@ public class UpdateDatafeedAction extends ActionType return null; } - @Override - public void readFrom(StreamInput in) throws IOException { - throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable"); - } - @Override public void writeTo(StreamOutput out) throws IOException { super.writeTo(out); diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/UpdateJobAction.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/UpdateJobAction.java index 59fdd7a8efc..3d491cbe6b0 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/UpdateJobAction.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/UpdateJobAction.java @@ -96,11 +96,6 @@ public class UpdateJobAction extends ActionType { return null; } - @Override - public void readFrom(StreamInput in) throws IOException { - throw new UnsupportedOperationException("usage of Streamable is to be replaced by Writeable"); - } - @Override public void writeTo(StreamOutput out) throws IOException { super.writeTo(out); diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/rollup/action/PutRollupJobAction.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/rollup/action/PutRollupJobAction.java index 4dcdc2c22f8..5d8039d6a35 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/rollup/action/PutRollupJobAction.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/rollup/action/PutRollupJobAction.java @@ -49,6 +49,11 @@ public class PutRollupJobAction extends ActionType { this.config = config; } + public Request(StreamInput in) throws IOException { + super(in); + this.config = new RollupJobConfig(in); + } + public Request() { } @@ -65,12 +70,6 @@ public class PutRollupJobAction extends ActionType { this.config = config; } - @Override - public void readFrom(StreamInput in) throws IOException { - super.readFrom(in); - this.config = new RollupJobConfig(in); - } - @Override public void writeTo(StreamOutput out) throws IOException { super.writeTo(out); diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/snapshotlifecycle/action/DeleteSnapshotLifecycleAction.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/snapshotlifecycle/action/DeleteSnapshotLifecycleAction.java index e9b227a66f7..60a6cf11b35 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/snapshotlifecycle/action/DeleteSnapshotLifecycleAction.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/snapshotlifecycle/action/DeleteSnapshotLifecycleAction.java @@ -35,6 +35,11 @@ public class DeleteSnapshotLifecycleAction extends ActionType { - - @Override - protected StartILMRequest createBlankInstance() { - return new StartILMRequest(); - } +public class StartILMRequestTests extends AbstractWireSerializingTestCase { @Override protected StartILMRequest createTestInstance() { return new StartILMRequest(); } + @Override + protected Writeable.Reader instanceReader() { + return StartILMRequest::new; + } + public void testValidate() { StartILMRequest request = createTestInstance(); assertNull(request.validate()); diff --git a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/indexlifecycle/StopILMRequestTests.java b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/indexlifecycle/StopILMRequestTests.java index be603ee33ac..526965d9adb 100644 --- a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/indexlifecycle/StopILMRequestTests.java +++ b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/indexlifecycle/StopILMRequestTests.java @@ -6,20 +6,21 @@ package org.elasticsearch.xpack.core.indexlifecycle; -import org.elasticsearch.test.AbstractStreamableTestCase; +import org.elasticsearch.common.io.stream.Writeable; +import org.elasticsearch.test.AbstractWireSerializingTestCase; -public class StopILMRequestTests extends AbstractStreamableTestCase { - - @Override - protected StopILMRequest createBlankInstance() { - return new StopILMRequest(); - } +public class StopILMRequestTests extends AbstractWireSerializingTestCase { @Override protected StopILMRequest createTestInstance() { return new StopILMRequest(); } + @Override + protected Writeable.Reader instanceReader() { + return StopILMRequest::new; + } + public void testValidate() { StopILMRequest request = createTestInstance(); assertNull(request.validate()); diff --git a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/indexlifecycle/action/DeleteLifecycleRequestTests.java b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/indexlifecycle/action/DeleteLifecycleRequestTests.java index c864bd76eea..4afe0260abd 100644 --- a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/indexlifecycle/action/DeleteLifecycleRequestTests.java +++ b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/indexlifecycle/action/DeleteLifecycleRequestTests.java @@ -5,10 +5,11 @@ */ package org.elasticsearch.xpack.core.indexlifecycle.action; -import org.elasticsearch.test.AbstractStreamableTestCase; +import org.elasticsearch.common.io.stream.Writeable; +import org.elasticsearch.test.AbstractWireSerializingTestCase; import org.elasticsearch.xpack.core.indexlifecycle.action.DeleteLifecycleAction.Request; -public class DeleteLifecycleRequestTests extends AbstractStreamableTestCase { +public class DeleteLifecycleRequestTests extends AbstractWireSerializingTestCase { @Override protected Request createTestInstance() { @@ -16,8 +17,8 @@ public class DeleteLifecycleRequestTests extends AbstractStreamableTestCase instanceReader() { + return Request::new; } @Override diff --git a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/indexlifecycle/action/GetLifecycleRequestTests.java b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/indexlifecycle/action/GetLifecycleRequestTests.java index 49caa0b4889..976652f29c0 100644 --- a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/indexlifecycle/action/GetLifecycleRequestTests.java +++ b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/indexlifecycle/action/GetLifecycleRequestTests.java @@ -5,12 +5,13 @@ */ package org.elasticsearch.xpack.core.indexlifecycle.action; -import org.elasticsearch.test.AbstractStreamableTestCase; +import org.elasticsearch.common.io.stream.Writeable; +import org.elasticsearch.test.AbstractWireSerializingTestCase; import org.elasticsearch.xpack.core.indexlifecycle.action.GetLifecycleAction.Request; import java.util.Arrays; -public class GetLifecycleRequestTests extends AbstractStreamableTestCase { +public class GetLifecycleRequestTests extends AbstractWireSerializingTestCase { @Override protected Request createTestInstance() { @@ -18,8 +19,8 @@ public class GetLifecycleRequestTests extends AbstractStreamableTestCase instanceReader() { + return Request::new; } @Override diff --git a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/indexlifecycle/action/MoveToStepRequestTests.java b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/indexlifecycle/action/MoveToStepRequestTests.java index 84b966b4023..b79144a7b3f 100644 --- a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/indexlifecycle/action/MoveToStepRequestTests.java +++ b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/indexlifecycle/action/MoveToStepRequestTests.java @@ -6,14 +6,15 @@ */ package org.elasticsearch.xpack.core.indexlifecycle.action; +import org.elasticsearch.common.io.stream.Writeable; import org.elasticsearch.common.xcontent.XContentParser; -import org.elasticsearch.test.AbstractStreamableXContentTestCase; +import org.elasticsearch.test.AbstractSerializingTestCase; import org.elasticsearch.xpack.core.indexlifecycle.Step.StepKey; import org.elasticsearch.xpack.core.indexlifecycle.StepKeyTests; import org.elasticsearch.xpack.core.indexlifecycle.action.MoveToStepAction.Request; import org.junit.Before; -public class MoveToStepRequestTests extends AbstractStreamableXContentTestCase { +public class MoveToStepRequestTests extends AbstractSerializingTestCase { private String index; private static final StepKeyTests stepKeyTests = new StepKeyTests(); @@ -29,8 +30,8 @@ public class MoveToStepRequestTests extends AbstractStreamableXContentTestCase instanceReader() { + return Request::new; } @Override diff --git a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/indexlifecycle/action/PutLifecycleRequestTests.java b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/indexlifecycle/action/PutLifecycleRequestTests.java index 2c59d9ca578..745a3aad468 100644 --- a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/indexlifecycle/action/PutLifecycleRequestTests.java +++ b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/indexlifecycle/action/PutLifecycleRequestTests.java @@ -8,9 +8,10 @@ package org.elasticsearch.xpack.core.indexlifecycle.action; import org.elasticsearch.cluster.ClusterModule; import org.elasticsearch.common.ParseField; import org.elasticsearch.common.io.stream.NamedWriteableRegistry; +import org.elasticsearch.common.io.stream.Writeable; import org.elasticsearch.common.xcontent.NamedXContentRegistry; import org.elasticsearch.common.xcontent.XContentParser; -import org.elasticsearch.test.AbstractStreamableXContentTestCase; +import org.elasticsearch.test.AbstractSerializingTestCase; import org.elasticsearch.xpack.core.indexlifecycle.AllocateAction; import org.elasticsearch.xpack.core.indexlifecycle.DeleteAction; import org.elasticsearch.xpack.core.indexlifecycle.ForceMergeAction; @@ -32,7 +33,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; -public class PutLifecycleRequestTests extends AbstractStreamableXContentTestCase { +public class PutLifecycleRequestTests extends AbstractSerializingTestCase { private String lifecycleName; @@ -47,8 +48,8 @@ public class PutLifecycleRequestTests extends AbstractStreamableXContentTestCase } @Override - protected Request createBlankInstance() { - return new Request(); + protected Writeable.Reader instanceReader() { + return Request::new; } @Override diff --git a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/indexlifecycle/action/RemoveIndexLifecyclePolicyRequestTests.java b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/indexlifecycle/action/RemoveIndexLifecyclePolicyRequestTests.java index e82f84564ca..eeeba87a6e6 100644 --- a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/indexlifecycle/action/RemoveIndexLifecyclePolicyRequestTests.java +++ b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/indexlifecycle/action/RemoveIndexLifecyclePolicyRequestTests.java @@ -7,13 +7,14 @@ package org.elasticsearch.xpack.core.indexlifecycle.action; import org.elasticsearch.action.support.IndicesOptions; -import org.elasticsearch.test.AbstractStreamableTestCase; +import org.elasticsearch.common.io.stream.Writeable; +import org.elasticsearch.test.AbstractWireSerializingTestCase; import org.elasticsearch.xpack.core.indexlifecycle.action.RemoveIndexLifecyclePolicyAction.Request; import java.io.IOException; import java.util.Arrays; -public class RemoveIndexLifecyclePolicyRequestTests extends AbstractStreamableTestCase { +public class RemoveIndexLifecyclePolicyRequestTests extends AbstractWireSerializingTestCase { @Override protected Request createTestInstance() { @@ -30,10 +31,10 @@ public class RemoveIndexLifecyclePolicyRequestTests extends AbstractStreamableTe } @Override - protected Request createBlankInstance() { - return new Request(); + protected Writeable.Reader instanceReader() { + return Request::new; } - + @Override protected Request mutateInstance(Request instance) throws IOException { String[] indices = instance.indices(); diff --git a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/indexlifecycle/action/RetryRequestTests.java b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/indexlifecycle/action/RetryRequestTests.java index 734bcf0b7df..757571f5931 100644 --- a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/indexlifecycle/action/RetryRequestTests.java +++ b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/indexlifecycle/action/RetryRequestTests.java @@ -7,13 +7,14 @@ package org.elasticsearch.xpack.core.indexlifecycle.action; import org.elasticsearch.action.support.IndicesOptions; -import org.elasticsearch.test.AbstractStreamableTestCase; +import org.elasticsearch.common.io.stream.Writeable; +import org.elasticsearch.test.AbstractWireSerializingTestCase; import org.elasticsearch.xpack.core.indexlifecycle.action.RetryAction.Request; import java.io.IOException; import java.util.Arrays; -public class RetryRequestTests extends AbstractStreamableTestCase { +public class RetryRequestTests extends AbstractWireSerializingTestCase { @Override protected Request createTestInstance() { @@ -29,6 +30,11 @@ public class RetryRequestTests extends AbstractStreamableTestCase { return request; } + @Override + protected Writeable.Reader instanceReader() { + return Request::new; + } + @Override protected Request mutateInstance(Request instance) throws IOException { String[] indices = instance.indices(); @@ -50,9 +56,4 @@ public class RetryRequestTests extends AbstractStreamableTestCase { newRequest.indicesOptions(indicesOptions); return newRequest; } - - @Override - protected Request createBlankInstance() { - return new Request(); - } } diff --git a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ml/action/DeleteCalendarEventActionRequestTests.java b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ml/action/DeleteCalendarEventActionRequestTests.java index e6f35c76b78..6c0afaa8cdb 100644 --- a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ml/action/DeleteCalendarEventActionRequestTests.java +++ b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ml/action/DeleteCalendarEventActionRequestTests.java @@ -5,10 +5,11 @@ */ package org.elasticsearch.xpack.core.ml.action; -import org.elasticsearch.test.AbstractStreamableTestCase; +import org.elasticsearch.common.io.stream.Writeable; +import org.elasticsearch.test.AbstractWireSerializingTestCase; import org.elasticsearch.xpack.core.ml.action.DeleteCalendarEventAction.Request; -public class DeleteCalendarEventActionRequestTests extends AbstractStreamableTestCase { +public class DeleteCalendarEventActionRequestTests extends AbstractWireSerializingTestCase { @Override protected Request createTestInstance() { @@ -16,7 +17,7 @@ public class DeleteCalendarEventActionRequestTests extends AbstractStreamableTes } @Override - protected Request createBlankInstance() { - return new Request(); + protected Writeable.Reader instanceReader() { + return Request::new; } } \ No newline at end of file diff --git a/x-pack/plugin/frozen-indices/src/main/java/org/elasticsearch/xpack/frozen/action/TransportFreezeIndexAction.java b/x-pack/plugin/frozen-indices/src/main/java/org/elasticsearch/xpack/frozen/action/TransportFreezeIndexAction.java index 852981e7ff7..806bc30b997 100644 --- a/x-pack/plugin/frozen-indices/src/main/java/org/elasticsearch/xpack/frozen/action/TransportFreezeIndexAction.java +++ b/x-pack/plugin/frozen-indices/src/main/java/org/elasticsearch/xpack/frozen/action/TransportFreezeIndexAction.java @@ -59,8 +59,8 @@ public final class TransportFreezeIndexAction extends IndexNameExpressionResolver indexNameExpressionResolver, DestructiveOperations destructiveOperations, TransportCloseIndexAction transportCloseIndexAction) { - super(FreezeIndexAction.NAME, transportService, clusterService, threadPool, actionFilters, indexNameExpressionResolver, - FreezeRequest::new); + super(FreezeIndexAction.NAME, transportService, clusterService, threadPool, actionFilters, FreezeRequest::new, + indexNameExpressionResolver); this.destructiveOperations = destructiveOperations; this.indexStateService = indexStateService; this.transportCloseIndexAction = transportCloseIndexAction; diff --git a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/indexlifecycle/action/TransportDeleteLifecycleAction.java b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/indexlifecycle/action/TransportDeleteLifecycleAction.java index 0a8c8a685fd..bbabc716686 100644 --- a/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/indexlifecycle/action/TransportDeleteLifecycleAction.java +++ b/x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/indexlifecycle/action/TransportDeleteLifecycleAction.java @@ -45,7 +45,7 @@ public class TransportDeleteLifecycleAction extends TransportMasterNodeAction { +public class PutJobActionRequestTests extends AbstractSerializingTestCase { private String jobId; @@ -29,13 +30,13 @@ public class PutJobActionRequestTests extends AbstractStreamableXContentTestCase } @Override - protected boolean supportsUnknownFields() { - return false; + protected Writeable.Reader instanceReader() { + return Request::new; } @Override - protected Request createBlankInstance() { - return new Request(); + protected boolean supportsUnknownFields() { + return false; } @Override