From 0d5cc3218dfb27db294a29bd2e449d1dd35d53c8 Mon Sep 17 00:00:00 2001 From: Hendrik Muhs Date: Thu, 28 Oct 2021 14:05:22 +0200 Subject: [PATCH] [Transform] remove old mixed cluster BWC layers, not required for 8x (#79927) remove old mixed cluster BWC layers, not required for 8x and remove constructor indirection previously used for old endpoints --- .../action/DeleteTransformAction.java | 11 +- .../action/GetTransformStatsAction.java | 22 +-- .../action/PreviewTransformAction.java | 16 +- .../transform/action/PutTransformAction.java | 11 +- .../action/StartTransformAction.java | 7 - .../transform/action/StopTransformAction.java | 21 +-- .../action/UpdateTransformAction.java | 58 ++----- .../DeleteTransformActionDeprecated.java | 21 --- .../compat/GetTransformActionDeprecated.java | 21 --- .../GetTransformStatsActionDeprecated.java | 22 --- .../PreviewTransformActionDeprecated.java | 22 --- .../compat/PutTransformActionDeprecated.java | 22 --- .../StartTransformActionDeprecated.java | 22 --- .../compat/StopTransformActionDeprecated.java | 22 --- .../UpdateTransformActionDeprecated.java | 23 --- .../compat/UpdateTransformActionPre78.java | 145 ------------------ .../authz/store/ReservedRolesStoreTests.java | 16 -- ...viewTransformsActionResponseWireTests.java | 29 ---- .../UpdateTransformActionRequestTests.java | 57 +------ .../UpdateTransformsActionResponseTests.java | 126 +-------------- .../TransportDeleteTransformAction.java | 24 +-- .../action/TransportGetTransformAction.java | 13 +- .../TransportGetTransformStatsAction.java | 23 ++- .../TransportPreviewTransformAction.java | 28 +--- .../action/TransportPutTransformAction.java | 28 +--- .../action/TransportStopTransformAction.java | 25 +-- .../TransportUpdateTransformAction.java | 36 +---- .../TransportUpgradeTransformsAction.java | 26 +--- .../TransportValidateTransformAction.java | 24 +-- 29 files changed, 56 insertions(+), 865 deletions(-) delete mode 100644 x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/action/compat/DeleteTransformActionDeprecated.java delete mode 100644 x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/action/compat/GetTransformActionDeprecated.java delete mode 100644 x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/action/compat/GetTransformStatsActionDeprecated.java delete mode 100644 x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/action/compat/PreviewTransformActionDeprecated.java delete mode 100644 x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/action/compat/PutTransformActionDeprecated.java delete mode 100644 x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/action/compat/StartTransformActionDeprecated.java delete mode 100644 x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/action/compat/StopTransformActionDeprecated.java delete mode 100644 x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/action/compat/UpdateTransformActionDeprecated.java delete mode 100644 x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/action/compat/UpdateTransformActionPre78.java diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/action/DeleteTransformAction.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/action/DeleteTransformAction.java index 6908f757479d3..05661bd28f392 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/action/DeleteTransformAction.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/action/DeleteTransformAction.java @@ -6,7 +6,6 @@ */ package org.elasticsearch.xpack.core.transform.action; -import org.elasticsearch.Version; import org.elasticsearch.action.ActionRequestValidationException; import org.elasticsearch.action.ActionType; import org.elasticsearch.action.support.master.AcknowledgedRequest; @@ -42,11 +41,7 @@ public Request(String id, boolean force, TimeValue timeout) { public Request(StreamInput in) throws IOException { super(in); id = in.readString(); - if (in.getVersion().onOrAfter(Version.V_7_4_0)) { - force = in.readBoolean(); - } else { - force = false; - } + force = in.readBoolean(); } public String getId() { @@ -61,9 +56,7 @@ public boolean isForce() { public void writeTo(StreamOutput out) throws IOException { super.writeTo(out); out.writeString(id); - if (out.getVersion().onOrAfter(Version.V_7_4_0)) { - out.writeBoolean(force); - } + out.writeBoolean(force); } @Override diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/action/GetTransformStatsAction.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/action/GetTransformStatsAction.java index f7940cd79bdf6..8278d9a5f4a0d 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/action/GetTransformStatsAction.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/action/GetTransformStatsAction.java @@ -8,7 +8,6 @@ package org.elasticsearch.xpack.core.transform.action; import org.elasticsearch.ElasticsearchException; -import org.elasticsearch.Version; import org.elasticsearch.action.ActionRequestValidationException; import org.elasticsearch.action.ActionType; import org.elasticsearch.action.TaskOperationFailure; @@ -66,9 +65,7 @@ public Request(StreamInput in) throws IOException { id = in.readString(); expandedIds = Collections.unmodifiableList(in.readStringList()); pageParams = new PageParams(in); - if (in.getVersion().onOrAfter(Version.V_7_3_0)) { - allowNoMatch = in.readBoolean(); - } + allowNoMatch = in.readBoolean(); } @Override @@ -112,9 +109,7 @@ public void writeTo(StreamOutput out) throws IOException { out.writeString(id); out.writeStringCollection(expandedIds); pageParams.writeTo(out); - if (out.getVersion().onOrAfter(Version.V_7_3_0)) { - out.writeBoolean(allowNoMatch); - } + out.writeBoolean(allowNoMatch); } @Override @@ -178,12 +173,7 @@ private Response( public Response(StreamInput in) throws IOException { super(in); - if (in.getVersion().onOrAfter(Version.V_7_3_0)) { - transformsStats = new QueryPage<>(in, TransformStats::new); - } else { - List stats = in.readList(TransformStats::new); - transformsStats = new QueryPage<>(stats, stats.size(), TransformField.TRANSFORMS); - } + transformsStats = new QueryPage<>(in, TransformStats::new); } public List getTransformsStats() { @@ -197,11 +187,7 @@ public long getCount() { @Override public void writeTo(StreamOutput out) throws IOException { super.writeTo(out); - if (out.getVersion().onOrAfter(Version.V_7_3_0)) { - transformsStats.writeTo(out); - } else { - out.writeList(transformsStats.results()); - } + transformsStats.writeTo(out); } @Override diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/action/PreviewTransformAction.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/action/PreviewTransformAction.java index 3fa7b54f76bae..4d6514b60bcba 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/action/PreviewTransformAction.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/action/PreviewTransformAction.java @@ -7,7 +7,6 @@ package org.elasticsearch.xpack.core.transform.action; -import org.elasticsearch.Version; import org.elasticsearch.action.ActionRequestValidationException; import org.elasticsearch.action.ActionResponse; import org.elasticsearch.action.ActionType; @@ -177,14 +176,7 @@ public Response(StreamInput in) throws IOException { for (int i = 0; i < size; i++) { this.docs.add(in.readMap()); } - if (in.getVersion().onOrAfter(Version.V_7_7_0)) { - this.generatedDestIndexSettings = new TransformDestIndexSettings(in); - } else if (in.getVersion().onOrAfter(Version.V_7_3_0)) { - Map objectMap = in.readMap(); - this.generatedDestIndexSettings = new TransformDestIndexSettings(objectMap, null, null); - } else { - this.generatedDestIndexSettings = new TransformDestIndexSettings(null, null, null); - } + this.generatedDestIndexSettings = new TransformDestIndexSettings(in); } public List> getDocs() { @@ -201,11 +193,7 @@ public void writeTo(StreamOutput out) throws IOException { for (Map doc : docs) { out.writeMapWithConsistentOrder(doc); } - if (out.getVersion().onOrAfter(Version.V_7_7_0)) { - generatedDestIndexSettings.writeTo(out); - } else if (out.getVersion().onOrAfter(Version.V_7_3_0)) { - out.writeMap(generatedDestIndexSettings.getMappings()); - } + generatedDestIndexSettings.writeTo(out); } @Override diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/action/PutTransformAction.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/action/PutTransformAction.java index 130fd68491bf2..5f278db31d5ef 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/action/PutTransformAction.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/action/PutTransformAction.java @@ -7,7 +7,6 @@ package org.elasticsearch.xpack.core.transform.action; -import org.elasticsearch.Version; import org.elasticsearch.action.ActionRequestValidationException; import org.elasticsearch.action.ActionType; import org.elasticsearch.action.support.master.AcknowledgedRequest; @@ -53,11 +52,7 @@ public Request(TransformConfig config, boolean deferValidation, TimeValue timeou public Request(StreamInput in) throws IOException { super(in); this.config = new TransformConfig(in); - if (in.getVersion().onOrAfter(Version.V_7_4_0)) { - this.deferValidation = in.readBoolean(); - } else { - this.deferValidation = false; - } + this.deferValidation = in.readBoolean(); } public static Request fromXContent( @@ -122,9 +117,7 @@ public boolean isDeferValidation() { public void writeTo(StreamOutput out) throws IOException { super.writeTo(out); this.config.writeTo(out); - if (out.getVersion().onOrAfter(Version.V_7_4_0)) { - out.writeBoolean(this.deferValidation); - } + out.writeBoolean(this.deferValidation); } @Override diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/action/StartTransformAction.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/action/StartTransformAction.java index d985e2d1bbd85..8979c16c234aa 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/action/StartTransformAction.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/action/StartTransformAction.java @@ -7,7 +7,6 @@ package org.elasticsearch.xpack.core.transform.action; -import org.elasticsearch.Version; import org.elasticsearch.action.ActionRequestValidationException; import org.elasticsearch.action.ActionType; import org.elasticsearch.action.support.master.AcknowledgedRequest; @@ -45,9 +44,6 @@ public Request(String id, TimeValue timeout) { public Request(StreamInput in) throws IOException { super(in); id = in.readString(); - if (in.getVersion().before(Version.V_7_5_0)) { - in.readBoolean(); - } } public String getId() { @@ -58,9 +54,6 @@ public String getId() { public void writeTo(StreamOutput out) throws IOException { super.writeTo(out); out.writeString(id); - if (out.getVersion().before(Version.V_7_5_0)) { - out.writeBoolean(false); - } } @Override diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/action/StopTransformAction.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/action/StopTransformAction.java index 1ca8624675189..62be52fae0ce8 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/action/StopTransformAction.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/action/StopTransformAction.java @@ -8,7 +8,6 @@ import org.apache.logging.log4j.message.ParameterizedMessage; import org.elasticsearch.ElasticsearchException; -import org.elasticsearch.Version; import org.elasticsearch.action.ActionRequestValidationException; import org.elasticsearch.action.ActionType; import org.elasticsearch.action.TaskOperationFailure; @@ -81,16 +80,8 @@ public Request(StreamInput in) throws IOException { if (in.readBoolean()) { expandedIds = new HashSet<>(Arrays.asList(in.readStringArray())); } - if (in.getVersion().onOrAfter(Version.V_7_3_0)) { - this.allowNoMatch = in.readBoolean(); - } else { - this.allowNoMatch = true; - } - if (in.getVersion().onOrAfter(Version.V_7_6_0)) { - this.waitForCheckpoint = in.readBoolean(); - } else { - this.waitForCheckpoint = false; - } + this.allowNoMatch = in.readBoolean(); + this.waitForCheckpoint = in.readBoolean(); } public String getId() { @@ -132,12 +123,8 @@ public void writeTo(StreamOutput out) throws IOException { if (hasExpandedIds) { out.writeStringArray(expandedIds.toArray(new String[0])); } - if (out.getVersion().onOrAfter(Version.V_7_3_0)) { - out.writeBoolean(allowNoMatch); - } - if (out.getVersion().onOrAfter(Version.V_7_6_0)) { - out.writeBoolean(waitForCheckpoint); - } + out.writeBoolean(allowNoMatch); + out.writeBoolean(waitForCheckpoint); } @Override diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/action/UpdateTransformAction.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/action/UpdateTransformAction.java index 3c2f6a42b2988..2c7964ccac457 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/action/UpdateTransformAction.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/action/UpdateTransformAction.java @@ -7,7 +7,6 @@ package org.elasticsearch.xpack.core.transform.action; -import org.elasticsearch.Version; import org.elasticsearch.action.ActionRequestValidationException; import org.elasticsearch.action.ActionType; import org.elasticsearch.action.support.tasks.BaseTasksRequest; @@ -20,7 +19,6 @@ import org.elasticsearch.xcontent.XContentParser; import org.elasticsearch.xpack.core.common.validation.SourceDestValidator; import org.elasticsearch.xpack.core.transform.TransformField; -import org.elasticsearch.xpack.core.transform.action.compat.UpdateTransformActionPre78; import org.elasticsearch.xpack.core.transform.transforms.TransformConfig; import org.elasticsearch.xpack.core.transform.transforms.TransformConfigUpdate; @@ -56,8 +54,7 @@ public Request(TransformConfigUpdate update, String id, boolean deferValidation, this.setTimeout(timeout); } - // use fromStreamWithBWC, this can be changed back to public after BWC is not required anymore - private Request(StreamInput in) throws IOException { + public Request(StreamInput in) throws IOException { super(in); this.update = new TransformConfigUpdate(in); this.id = in.readString(); @@ -67,14 +64,6 @@ private Request(StreamInput in) throws IOException { } } - public static Request fromStreamWithBWC(StreamInput in) throws IOException { - if (in.getVersion().onOrAfter(Version.V_7_8_0)) { - return new Request(in); - } - UpdateTransformActionPre78.Request r = new UpdateTransformActionPre78.Request(in); - return new Request(r.getUpdate(), r.getId(), r.isDeferValidation(), r.timeout()); - } - public static Request fromXContent( final XContentParser parser, final String id, @@ -137,22 +126,16 @@ public void setConfig(TransformConfig config) { @Override public void writeTo(StreamOutput out) throws IOException { - if (out.getVersion().onOrAfter(Version.V_7_8_0)) { - super.writeTo(out); - update.writeTo(out); - out.writeString(id); - out.writeBoolean(deferValidation); - if (config == null) { - out.writeBoolean(false); - } else { - out.writeBoolean(true); - config.writeTo(out); - } - return; + super.writeTo(out); + update.writeTo(out); + out.writeString(id); + out.writeBoolean(deferValidation); + if (config == null) { + out.writeBoolean(false); + } else { + out.writeBoolean(true); + config.writeTo(out); } - - UpdateTransformActionPre78.Request r = new UpdateTransformActionPre78.Request(update, id, deferValidation); - r.writeTo(out); } @Override @@ -190,34 +173,19 @@ public Response(TransformConfig config) { this.config = config; } - // use fromStreamWithBWC, this can be changed back to public after BWC is not required anymore - private Response(StreamInput in) throws IOException { + public Response(StreamInput in) throws IOException { super(in); this.config = new TransformConfig(in); } - public static Response fromStreamWithBWC(StreamInput in) throws IOException { - if (in.getVersion().onOrAfter(Version.V_7_8_0)) { - return new Response(in); - } - UpdateTransformActionPre78.Response r = new UpdateTransformActionPre78.Response(in); - return new Response(r.getConfig()); - } - public TransformConfig getConfig() { return config; } @Override public void writeTo(StreamOutput out) throws IOException { - if (out.getVersion().onOrAfter(Version.V_7_8_0)) { - super.writeTo(out); - config.writeTo(out); - return; - } - - UpdateTransformActionPre78.Response r = new UpdateTransformActionPre78.Response(config); - r.writeTo(out); + super.writeTo(out); + config.writeTo(out); } @Override diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/action/compat/DeleteTransformActionDeprecated.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/action/compat/DeleteTransformActionDeprecated.java deleted file mode 100644 index f327849b9ca17..0000000000000 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/action/compat/DeleteTransformActionDeprecated.java +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -package org.elasticsearch.xpack.core.transform.action.compat; - -import org.elasticsearch.action.ActionType; -import org.elasticsearch.action.support.master.AcknowledgedResponse; - -public class DeleteTransformActionDeprecated extends ActionType { - - public static final DeleteTransformActionDeprecated INSTANCE = new DeleteTransformActionDeprecated(); - public static final String NAME = "cluster:admin/data_frame/delete"; - - private DeleteTransformActionDeprecated() { - super(NAME, AcknowledgedResponse::readFrom); - } -} diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/action/compat/GetTransformActionDeprecated.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/action/compat/GetTransformActionDeprecated.java deleted file mode 100644 index 64473543c2f32..0000000000000 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/action/compat/GetTransformActionDeprecated.java +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -package org.elasticsearch.xpack.core.transform.action.compat; - -import org.elasticsearch.action.ActionType; -import org.elasticsearch.xpack.core.transform.action.GetTransformAction; - -public class GetTransformActionDeprecated extends ActionType { - - public static final GetTransformActionDeprecated INSTANCE = new GetTransformActionDeprecated(); - public static final String NAME = "cluster:monitor/data_frame/get"; - - private GetTransformActionDeprecated() { - super(NAME, GetTransformAction.Response::new); - } -} diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/action/compat/GetTransformStatsActionDeprecated.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/action/compat/GetTransformStatsActionDeprecated.java deleted file mode 100644 index 06005e8b45c7f..0000000000000 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/action/compat/GetTransformStatsActionDeprecated.java +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -package org.elasticsearch.xpack.core.transform.action.compat; - -import org.elasticsearch.action.ActionType; -import org.elasticsearch.xpack.core.transform.action.GetTransformStatsAction; - -public class GetTransformStatsActionDeprecated extends ActionType { - - public static final GetTransformStatsActionDeprecated INSTANCE = new GetTransformStatsActionDeprecated(); - public static final String NAME = "cluster:monitor/data_frame/stats/get"; - - private GetTransformStatsActionDeprecated() { - super(NAME, GetTransformStatsAction.Response::new); - } - -} diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/action/compat/PreviewTransformActionDeprecated.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/action/compat/PreviewTransformActionDeprecated.java deleted file mode 100644 index 3e1f6251050d9..0000000000000 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/action/compat/PreviewTransformActionDeprecated.java +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -package org.elasticsearch.xpack.core.transform.action.compat; - -import org.elasticsearch.action.ActionType; -import org.elasticsearch.xpack.core.transform.action.PreviewTransformAction; - -public class PreviewTransformActionDeprecated extends ActionType { - - public static final PreviewTransformActionDeprecated INSTANCE = new PreviewTransformActionDeprecated(); - public static final String NAME = "cluster:admin/data_frame/preview"; - - private PreviewTransformActionDeprecated() { - super(NAME, PreviewTransformAction.Response::new); - } - -} diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/action/compat/PutTransformActionDeprecated.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/action/compat/PutTransformActionDeprecated.java deleted file mode 100644 index 2246a04e585c8..0000000000000 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/action/compat/PutTransformActionDeprecated.java +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -package org.elasticsearch.xpack.core.transform.action.compat; - -import org.elasticsearch.action.ActionType; -import org.elasticsearch.action.support.master.AcknowledgedResponse; - -public class PutTransformActionDeprecated extends ActionType { - - public static final PutTransformActionDeprecated INSTANCE = new PutTransformActionDeprecated(); - public static final String NAME = "cluster:admin/data_frame/put"; - - private PutTransformActionDeprecated() { - super(NAME, AcknowledgedResponse::readFrom); - } - -} diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/action/compat/StartTransformActionDeprecated.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/action/compat/StartTransformActionDeprecated.java deleted file mode 100644 index 8aae058ceacef..0000000000000 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/action/compat/StartTransformActionDeprecated.java +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -package org.elasticsearch.xpack.core.transform.action.compat; - -import org.elasticsearch.action.ActionType; -import org.elasticsearch.xpack.core.transform.action.StartTransformAction; - -public class StartTransformActionDeprecated extends ActionType { - - public static final StartTransformActionDeprecated INSTANCE = new StartTransformActionDeprecated(); - public static final String NAME = "cluster:admin/data_frame/start"; - - private StartTransformActionDeprecated() { - super(NAME, StartTransformAction.Response::new); - } - -} diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/action/compat/StopTransformActionDeprecated.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/action/compat/StopTransformActionDeprecated.java deleted file mode 100644 index d5b39f1b84516..0000000000000 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/action/compat/StopTransformActionDeprecated.java +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -package org.elasticsearch.xpack.core.transform.action.compat; - -import org.elasticsearch.action.ActionType; -import org.elasticsearch.xpack.core.transform.action.StopTransformAction; - -public class StopTransformActionDeprecated extends ActionType { - - public static final StopTransformActionDeprecated INSTANCE = new StopTransformActionDeprecated(); - public static final String NAME = "cluster:admin/data_frame/stop"; - - private StopTransformActionDeprecated() { - super(NAME, StopTransformAction.Response::new); - } - -} diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/action/compat/UpdateTransformActionDeprecated.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/action/compat/UpdateTransformActionDeprecated.java deleted file mode 100644 index 4804f711a7e23..0000000000000 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/action/compat/UpdateTransformActionDeprecated.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -package org.elasticsearch.xpack.core.transform.action.compat; - -import org.elasticsearch.action.ActionType; -import org.elasticsearch.xpack.core.transform.action.UpdateTransformAction; -import org.elasticsearch.xpack.core.transform.action.UpdateTransformAction.Response; - -public class UpdateTransformActionDeprecated extends ActionType { - - public static final UpdateTransformActionDeprecated INSTANCE = new UpdateTransformActionDeprecated(); - public static final String NAME = "cluster:admin/data_frame/update"; - - private UpdateTransformActionDeprecated() { - super(NAME, Response::fromStreamWithBWC); - } - -} diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/action/compat/UpdateTransformActionPre78.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/action/compat/UpdateTransformActionPre78.java deleted file mode 100644 index 429a4acc4b65c..0000000000000 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/action/compat/UpdateTransformActionPre78.java +++ /dev/null @@ -1,145 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -package org.elasticsearch.xpack.core.transform.action.compat; - -import org.elasticsearch.Version; -import org.elasticsearch.action.ActionRequestValidationException; -import org.elasticsearch.action.ActionResponse; -import org.elasticsearch.action.support.master.AcknowledgedRequest; -import org.elasticsearch.common.io.stream.StreamInput; -import org.elasticsearch.common.io.stream.StreamOutput; -import org.elasticsearch.xcontent.ToXContentObject; -import org.elasticsearch.xcontent.XContentBuilder; -import org.elasticsearch.xcontent.XContentParser; -import org.elasticsearch.xpack.core.transform.transforms.TransformConfig; -import org.elasticsearch.xpack.core.transform.transforms.TransformConfigUpdate; - -import java.io.IOException; -import java.util.Objects; - -/** - * In 7.8 update transform has been changed from ordinary request/response objects to tasks request/response. - * These classes are helpers to translate the old serialization format. - */ -public class UpdateTransformActionPre78 { - - public static class Request extends AcknowledgedRequest { - - private final TransformConfigUpdate update; - private final String id; - private final boolean deferValidation; - - public Request(TransformConfigUpdate update, String id, boolean deferValidation) { - this.update = update; - this.id = id; - this.deferValidation = deferValidation; - } - - public Request(StreamInput in) throws IOException { - super(in); - assert in.getVersion().before(Version.V_7_8_0); - this.update = new TransformConfigUpdate(in); - this.id = in.readString(); - this.deferValidation = in.readBoolean(); - } - - public static Request fromXContent(final XContentParser parser, final String id, final boolean deferValidation) { - return new Request(TransformConfigUpdate.fromXContent(parser), id, deferValidation); - } - - public String getId() { - return id; - } - - public boolean isDeferValidation() { - return deferValidation; - } - - public TransformConfigUpdate getUpdate() { - return update; - } - - @Override - public void writeTo(StreamOutput out) throws IOException { - assert out.getVersion().before(Version.V_7_8_0); - super.writeTo(out); - this.update.writeTo(out); - out.writeString(id); - out.writeBoolean(deferValidation); - } - - @Override - public int hashCode() { - return Objects.hash(update, id, deferValidation); - } - - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - Request other = (Request) obj; - return Objects.equals(update, other.update) && this.deferValidation == other.deferValidation && this.id.equals(other.id); - } - - @Override - public ActionRequestValidationException validate() { - return null; - } - } - - public static class Response extends ActionResponse implements ToXContentObject { - - private final TransformConfig config; - - public Response(TransformConfig config) { - this.config = config; - } - - public Response(StreamInput in) throws IOException { - assert in.getVersion().before(Version.V_7_8_0); - this.config = new TransformConfig(in); - } - - public TransformConfig getConfig() { - return config; - } - - @Override - public void writeTo(StreamOutput out) throws IOException { - assert out.getVersion().before(Version.V_7_8_0); - this.config.writeTo(out); - } - - @Override - public int hashCode() { - return config.hashCode(); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj == null || getClass() != obj.getClass()) { - return false; - } - Response other = (Response) obj; - return Objects.equals(config, other.config); - } - - @Override - public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException { - return config.toXContent(builder, params); - } - } - -} diff --git a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/security/authz/store/ReservedRolesStoreTests.java b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/security/authz/store/ReservedRolesStoreTests.java index 0df7ef733f692..78f458aa460f3 100644 --- a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/security/authz/store/ReservedRolesStoreTests.java +++ b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/security/authz/store/ReservedRolesStoreTests.java @@ -189,14 +189,6 @@ import org.elasticsearch.xpack.core.transform.action.StopTransformAction; import org.elasticsearch.xpack.core.transform.action.UpdateTransformAction; import org.elasticsearch.xpack.core.transform.action.ValidateTransformAction; -import org.elasticsearch.xpack.core.transform.action.compat.DeleteTransformActionDeprecated; -import org.elasticsearch.xpack.core.transform.action.compat.GetTransformActionDeprecated; -import org.elasticsearch.xpack.core.transform.action.compat.GetTransformStatsActionDeprecated; -import org.elasticsearch.xpack.core.transform.action.compat.PreviewTransformActionDeprecated; -import org.elasticsearch.xpack.core.transform.action.compat.PutTransformActionDeprecated; -import org.elasticsearch.xpack.core.transform.action.compat.StartTransformActionDeprecated; -import org.elasticsearch.xpack.core.transform.action.compat.StopTransformActionDeprecated; -import org.elasticsearch.xpack.core.transform.action.compat.UpdateTransformActionDeprecated; import org.elasticsearch.xpack.core.transform.transforms.persistence.TransformInternalIndexConstants; import org.elasticsearch.xpack.core.watcher.execution.TriggeredWatchStoreField; import org.elasticsearch.xpack.core.watcher.history.HistoryStoreField; @@ -731,14 +723,6 @@ public void testKibanaSystemRole() { StopTransformAction.NAME, UpdateTransformAction.NAME, ValidateTransformAction.NAME, - DeleteTransformActionDeprecated.NAME, - GetTransformActionDeprecated.NAME, - GetTransformStatsActionDeprecated.NAME, - PreviewTransformActionDeprecated.NAME, - PutTransformActionDeprecated.NAME, - StartTransformActionDeprecated.NAME, - StopTransformActionDeprecated.NAME, - UpdateTransformActionDeprecated.NAME, "cluster:admin/data_frame/" + randomAlphaOfLengthBetween(3, 8), "cluster:monitor/data_frame/" + randomAlphaOfLengthBetween(3, 8), "cluster:admin/transform/" + randomAlphaOfLengthBetween(3, 8), diff --git a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/transform/action/PreviewTransformsActionResponseWireTests.java b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/transform/action/PreviewTransformsActionResponseWireTests.java index ac5a16835f5bc..576fe003d4017 100644 --- a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/transform/action/PreviewTransformsActionResponseWireTests.java +++ b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/transform/action/PreviewTransformsActionResponseWireTests.java @@ -7,15 +7,9 @@ package org.elasticsearch.xpack.core.transform.action; -import org.elasticsearch.Version; -import org.elasticsearch.common.io.stream.BytesStreamOutput; -import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.Writeable.Reader; import org.elasticsearch.xpack.core.transform.action.PreviewTransformAction.Response; -import java.io.IOException; -import java.util.Map; - public class PreviewTransformsActionResponseWireTests extends AbstractWireSerializingTransformTestCase { @Override @@ -28,27 +22,4 @@ protected Reader instanceReader() { return Response::new; } - public void testBackwardsSerialization76() throws IOException { - Response response = PreviewTransformsActionResponseTests.randomPreviewResponse(); - - try (BytesStreamOutput output = new BytesStreamOutput()) { - output.setVersion(Version.V_7_6_0); - output.writeInt(response.getDocs().size()); - for (Map doc : response.getDocs()) { - output.writeMapWithConsistentOrder(doc); - } - - output.writeMap(response.getGeneratedDestIndexSettings().getMappings()); - try (StreamInput in = output.bytes().streamInput()) { - in.setVersion(Version.V_7_6_0); - Response streamedResponse = new Response(in); - assertEquals( - response.getGeneratedDestIndexSettings().getMappings(), - streamedResponse.getGeneratedDestIndexSettings().getMappings() - ); - assertEquals(response.getDocs(), streamedResponse.getDocs()); - } - } - } - } diff --git a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/transform/action/UpdateTransformActionRequestTests.java b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/transform/action/UpdateTransformActionRequestTests.java index d6fff0a128c4a..a877417c21f79 100644 --- a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/transform/action/UpdateTransformActionRequestTests.java +++ b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/transform/action/UpdateTransformActionRequestTests.java @@ -7,26 +7,21 @@ package org.elasticsearch.xpack.core.transform.action; -import org.elasticsearch.Version; import org.elasticsearch.common.io.stream.Writeable; import org.elasticsearch.core.TimeValue; import org.elasticsearch.xpack.core.transform.action.UpdateTransformAction.Request; -import org.elasticsearch.xpack.core.transform.action.compat.UpdateTransformActionPre78; import org.elasticsearch.xpack.core.transform.transforms.TransformConfigTests; import org.elasticsearch.xpack.core.transform.transforms.TransformConfigUpdate; import java.io.IOException; import static org.elasticsearch.xpack.core.transform.transforms.TransformConfigUpdateTests.randomTransformConfigUpdate; -import static org.hamcrest.Matchers.anEmptyMap; -import static org.hamcrest.Matchers.equalTo; -import static org.hamcrest.Matchers.is; public class UpdateTransformActionRequestTests extends AbstractWireSerializingTransformTestCase { @Override protected Writeable.Reader instanceReader() { - return Request::fromStreamWithBWC; + return Request::new; } @Override @@ -85,54 +80,4 @@ protected Request mutateInstance(Request instance) throws IOException { return new Request(update, id, deferValidation, timeout); } - public void testBWCPre78() throws IOException { - Request newRequest = createTestInstance(); - UpdateTransformActionPre78.Request oldRequest = writeAndReadBWCObject( - newRequest, - getNamedWriteableRegistry(), - (out, value) -> value.writeTo(out), - UpdateTransformActionPre78.Request::new, - Version.V_7_7_0 - ); - - assertEquals(newRequest.getId(), oldRequest.getId()); - assertEquals(newRequest.getUpdate().getDestination(), oldRequest.getUpdate().getDestination()); - assertEquals(newRequest.getUpdate().getFrequency(), oldRequest.getUpdate().getFrequency()); - - if (newRequest.getUpdate().getSource() != null) { - assertThat(oldRequest.getUpdate().getSource().getIndex(), is(equalTo(newRequest.getUpdate().getSource().getIndex()))); - assertThat( - oldRequest.getUpdate().getSource().getQueryConfig(), - is(equalTo(newRequest.getUpdate().getSource().getQueryConfig())) - ); - // runtime_mappings was added in 7.12 so it is always empty after deserializing from 7.7 - assertThat(oldRequest.getUpdate().getSource().getRuntimeMappings(), is(anEmptyMap())); - } - assertEquals(newRequest.getUpdate().getSyncConfig(), oldRequest.getUpdate().getSyncConfig()); - assertEquals(newRequest.isDeferValidation(), oldRequest.isDeferValidation()); - - Request newRequestFromOld = writeAndReadBWCObject( - oldRequest, - getNamedWriteableRegistry(), - (out, value) -> value.writeTo(out), - Request::fromStreamWithBWC, - Version.V_7_7_0 - ); - - assertEquals(newRequest.getId(), newRequestFromOld.getId()); - assertEquals(newRequest.getUpdate().getDestination(), newRequestFromOld.getUpdate().getDestination()); - assertEquals(newRequest.getUpdate().getFrequency(), newRequestFromOld.getUpdate().getFrequency()); - if (newRequest.getUpdate().getSource() != null) { - assertThat(newRequestFromOld.getUpdate().getSource().getIndex(), is(equalTo(newRequest.getUpdate().getSource().getIndex()))); - assertThat( - newRequestFromOld.getUpdate().getSource().getQueryConfig(), - is(equalTo(newRequest.getUpdate().getSource().getQueryConfig())) - ); - // runtime_mappings was added in 7.12 so it is always empty after deserializing from 7.7 - assertThat(newRequestFromOld.getUpdate().getSource().getRuntimeMappings(), is(anEmptyMap())); - } - assertEquals(newRequest.getUpdate().getSyncConfig(), newRequestFromOld.getUpdate().getSyncConfig()); - assertEquals(newRequest.isDeferValidation(), newRequestFromOld.isDeferValidation()); - } - } diff --git a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/transform/action/UpdateTransformsActionResponseTests.java b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/transform/action/UpdateTransformsActionResponseTests.java index 0b3c13c3e2844..f2528afd7f260 100644 --- a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/transform/action/UpdateTransformsActionResponseTests.java +++ b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/transform/action/UpdateTransformsActionResponseTests.java @@ -7,23 +7,14 @@ package org.elasticsearch.xpack.core.transform.action; -import org.elasticsearch.Version; import org.elasticsearch.common.io.stream.Writeable.Reader; import org.elasticsearch.xcontent.XContentParser; import org.elasticsearch.xpack.core.transform.AbstractSerializingTransformTestCase; import org.elasticsearch.xpack.core.transform.action.UpdateTransformAction.Response; -import org.elasticsearch.xpack.core.transform.action.compat.UpdateTransformActionPre78; import org.elasticsearch.xpack.core.transform.transforms.TransformConfig; import org.elasticsearch.xpack.core.transform.transforms.TransformConfigTests; -import org.elasticsearch.xpack.core.transform.transforms.pivot.PivotConfigTests; -import org.elasticsearch.xpack.core.transform.transforms.pivot.SingleGroupSource; import java.io.IOException; -import java.util.Map; - -import static org.hamcrest.Matchers.anEmptyMap; -import static org.hamcrest.Matchers.equalTo; -import static org.hamcrest.Matchers.is; public class UpdateTransformsActionResponseTests extends AbstractSerializingTransformTestCase { @@ -34,7 +25,7 @@ protected Response createTestInstance() { @Override protected Reader instanceReader() { - return Response::fromStreamWithBWC; + return Response::new; } @Override @@ -42,119 +33,4 @@ protected Response doParseInstance(XContentParser parser) throws IOException { return new Response(TransformConfig.fromXContent(parser, null, false)); } - public void testBWCPre78() throws IOException { - // latest has been added in 7.11, so we only need to test pivot - Response newResponse = new Response( - TransformConfigTests.randomTransformConfigWithoutHeaders( - randomAlphaOfLengthBetween(1, 10), - PivotConfigTests.randomPivotConfig(), - null - ) - ); - UpdateTransformActionPre78.Response oldResponse = writeAndReadBWCObject( - newResponse, - getNamedWriteableRegistry(), - (out, value) -> value.writeTo(out), - UpdateTransformActionPre78.Response::new, - Version.V_7_7_0 - ); - assertEquals(newResponse.getConfig().getDescription(), oldResponse.getConfig().getDescription()); - assertEquals(newResponse.getConfig().getId(), oldResponse.getConfig().getId()); - assertEquals(newResponse.getConfig().getCreateTime(), oldResponse.getConfig().getCreateTime()); - assertEquals(newResponse.getConfig().getDestination(), oldResponse.getConfig().getDestination()); - assertEquals(newResponse.getConfig().getFrequency(), oldResponse.getConfig().getFrequency()); - assertEquals( - newResponse.getConfig().getPivotConfig().getGroupConfig().getGroups().keySet(), - oldResponse.getConfig().getPivotConfig().getGroupConfig().getGroups().keySet() - ); - for (Map.Entry oldResponseGroupEntry : oldResponse.getConfig() - .getPivotConfig() - .getGroupConfig() - .getGroups() - .entrySet()) { - SingleGroupSource oldResponseGroup = oldResponseGroupEntry.getValue(); - SingleGroupSource newResponseGroup = newResponse.getConfig() - .getPivotConfig() - .getGroupConfig() - .getGroups() - .get(oldResponseGroupEntry.getKey()); - assertThat(oldResponseGroup.getField(), is(equalTo(newResponseGroup.getField()))); - assertThat(oldResponseGroup.getScriptConfig(), is(equalTo(newResponseGroup.getScriptConfig()))); - // missing_bucket was added in 7.10 so it is always false after deserializing from 7.7 - assertThat(oldResponseGroup.getMissingBucket(), is(false)); - } - assertEquals( - newResponse.getConfig().getPivotConfig().getAggregationConfig(), - oldResponse.getConfig().getPivotConfig().getAggregationConfig() - ); - assertEquals( - newResponse.getConfig().getPivotConfig().getMaxPageSearchSize(), - oldResponse.getConfig().getPivotConfig().getMaxPageSearchSize() - ); - if (newResponse.getConfig().getSource() != null) { - assertThat(newResponse.getConfig().getSource().getIndex(), is(equalTo(newResponse.getConfig().getSource().getIndex()))); - assertThat( - newResponse.getConfig().getSource().getQueryConfig(), - is(equalTo(newResponse.getConfig().getSource().getQueryConfig())) - ); - // runtime_mappings was added in 7.12 so it is always empty after deserializing from 7.7 - assertThat(oldResponse.getConfig().getSource().getRuntimeMappings(), is(anEmptyMap())); - } - assertEquals(newResponse.getConfig().getSyncConfig(), oldResponse.getConfig().getSyncConfig()); - assertEquals(newResponse.getConfig().getVersion(), oldResponse.getConfig().getVersion()); - - // - Response newRequestFromOld = writeAndReadBWCObject( - oldResponse, - getNamedWriteableRegistry(), - (out, value) -> value.writeTo(out), - Response::fromStreamWithBWC, - Version.V_7_7_0 - ); - - assertEquals(newResponse.getConfig().getDescription(), newRequestFromOld.getConfig().getDescription()); - assertEquals(newResponse.getConfig().getId(), newRequestFromOld.getConfig().getId()); - assertEquals(newResponse.getConfig().getCreateTime(), newRequestFromOld.getConfig().getCreateTime()); - assertEquals(newResponse.getConfig().getDestination(), newRequestFromOld.getConfig().getDestination()); - assertEquals(newResponse.getConfig().getFrequency(), newRequestFromOld.getConfig().getFrequency()); - assertEquals( - newResponse.getConfig().getPivotConfig().getGroupConfig().getGroups().keySet(), - newRequestFromOld.getConfig().getPivotConfig().getGroupConfig().getGroups().keySet() - ); - for (Map.Entry newRequestFromOldGroupEntry : newRequestFromOld.getConfig() - .getPivotConfig() - .getGroupConfig() - .getGroups() - .entrySet()) { - SingleGroupSource newRequestFromOldGroup = newRequestFromOldGroupEntry.getValue(); - SingleGroupSource newResponseGroup = newResponse.getConfig() - .getPivotConfig() - .getGroupConfig() - .getGroups() - .get(newRequestFromOldGroupEntry.getKey()); - assertThat(newRequestFromOldGroup.getField(), is(equalTo(newResponseGroup.getField()))); - assertThat(newRequestFromOldGroup.getScriptConfig(), is(equalTo(newResponseGroup.getScriptConfig()))); - // missing_bucket was added in 7.10 so it is always false after deserializing from 7.7 - assertThat(newRequestFromOldGroup.getMissingBucket(), is(false)); - } - assertEquals( - newResponse.getConfig().getPivotConfig().getAggregationConfig(), - newRequestFromOld.getConfig().getPivotConfig().getAggregationConfig() - ); - assertEquals( - newResponse.getConfig().getPivotConfig().getMaxPageSearchSize(), - newRequestFromOld.getConfig().getPivotConfig().getMaxPageSearchSize() - ); - if (newResponse.getConfig().getSource() != null) { - assertThat(newRequestFromOld.getConfig().getSource().getIndex(), is(equalTo(newResponse.getConfig().getSource().getIndex()))); - assertThat( - newRequestFromOld.getConfig().getSource().getQueryConfig(), - is(equalTo(newResponse.getConfig().getSource().getQueryConfig())) - ); - // runtime_mappings was added in 7.12 so it is always empty after deserializing from 7.7 - assertThat(newRequestFromOld.getConfig().getSource().getRuntimeMappings(), is(anEmptyMap())); - } - assertEquals(newResponse.getConfig().getSyncConfig(), newRequestFromOld.getConfig().getSyncConfig()); - assertEquals(newResponse.getConfig().getVersion(), newRequestFromOld.getConfig().getVersion()); - } } diff --git a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/action/TransportDeleteTransformAction.java b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/action/TransportDeleteTransformAction.java index f8fea7b18f58a..d3fe78621a9d7 100644 --- a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/action/TransportDeleteTransformAction.java +++ b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/action/TransportDeleteTransformAction.java @@ -52,31 +52,9 @@ public TransportDeleteTransformAction( IndexNameExpressionResolver indexNameExpressionResolver, TransformServices transformServices, Client client - ) { - this( - DeleteTransformAction.NAME, - transportService, - actionFilters, - threadPool, - clusterService, - indexNameExpressionResolver, - transformServices, - client - ); - } - - protected TransportDeleteTransformAction( - String name, - TransportService transportService, - ActionFilters actionFilters, - ThreadPool threadPool, - ClusterService clusterService, - IndexNameExpressionResolver indexNameExpressionResolver, - TransformServices transformServices, - Client client ) { super( - name, + DeleteTransformAction.NAME, transportService, clusterService, threadPool, diff --git a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/action/TransportGetTransformAction.java b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/action/TransportGetTransformAction.java index 9edcb09cfc496..b0a056d9b5108 100644 --- a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/action/TransportGetTransformAction.java +++ b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/action/TransportGetTransformAction.java @@ -48,18 +48,7 @@ public TransportGetTransformAction( Client client, NamedXContentRegistry xContentRegistry ) { - this(GetTransformAction.NAME, transportService, actionFilters, clusterService, client, xContentRegistry); - } - - protected TransportGetTransformAction( - String name, - TransportService transportService, - ActionFilters actionFilters, - ClusterService clusterService, - Client client, - NamedXContentRegistry xContentRegistry - ) { - super(name, transportService, actionFilters, Request::new, client, xContentRegistry); + super(GetTransformAction.NAME, transportService, actionFilters, Request::new, client, xContentRegistry); this.clusterService = clusterService; } diff --git a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/action/TransportGetTransformStatsAction.java b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/action/TransportGetTransformStatsAction.java index ef5be29650f5c..05c5a69582f12 100644 --- a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/action/TransportGetTransformStatsAction.java +++ b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/action/TransportGetTransformStatsAction.java @@ -72,19 +72,16 @@ public TransportGetTransformStatsAction( Client client, Settings settings ) { - this(GetTransformStatsAction.NAME, transportService, actionFilters, clusterService, transformServices, client, settings); - } - - protected TransportGetTransformStatsAction( - String name, - TransportService transportService, - ActionFilters actionFilters, - ClusterService clusterService, - TransformServices transformServices, - Client client, - Settings settings - ) { - super(name, clusterService, transportService, actionFilters, Request::new, Response::new, Response::new, ThreadPool.Names.SAME); + super( + GetTransformStatsAction.NAME, + clusterService, + transportService, + actionFilters, + Request::new, + Response::new, + Response::new, + ThreadPool.Names.SAME + ); this.transformConfigManager = transformServices.getConfigManager(); this.transformCheckpointService = transformServices.getCheckpointService(); this.client = client; diff --git a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/action/TransportPreviewTransformAction.java b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/action/TransportPreviewTransformAction.java index df8bc277cd8b4..437f6d5598ed6 100644 --- a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/action/TransportPreviewTransformAction.java +++ b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/action/TransportPreviewTransformAction.java @@ -91,33 +91,7 @@ public TransportPreviewTransformAction( Settings settings, IngestService ingestService ) { - this( - PreviewTransformAction.NAME, - licenseState, - transportService, - actionFilters, - client, - threadPool, - indexNameExpressionResolver, - clusterService, - settings, - ingestService - ); - } - - protected TransportPreviewTransformAction( - String name, - XPackLicenseState licenseState, - TransportService transportService, - ActionFilters actionFilters, - Client client, - ThreadPool threadPool, - IndexNameExpressionResolver indexNameExpressionResolver, - ClusterService clusterService, - Settings settings, - IngestService ingestService - ) { - super(name, transportService, actionFilters, Request::new); + super(PreviewTransformAction.NAME, transportService, actionFilters, Request::new); this.licenseState = licenseState; this.securityContext = XPackSettings.SECURITY_ENABLED.get(settings) ? new SecurityContext(settings, threadPool.getThreadContext()) diff --git a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/action/TransportPutTransformAction.java b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/action/TransportPutTransformAction.java index 1cd5eed7f94a7..c9565a108fcba 100644 --- a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/action/TransportPutTransformAction.java +++ b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/action/TransportPutTransformAction.java @@ -69,35 +69,9 @@ public TransportPutTransformAction( TransformServices transformServices, Client client, IngestService ingestService - ) { - this( - PutTransformAction.NAME, - settings, - transportService, - threadPool, - actionFilters, - indexNameExpressionResolver, - clusterService, - transformServices, - client, - ingestService - ); - } - - protected TransportPutTransformAction( - String name, - Settings settings, - TransportService transportService, - ThreadPool threadPool, - ActionFilters actionFilters, - IndexNameExpressionResolver indexNameExpressionResolver, - ClusterService clusterService, - TransformServices transformServices, - Client client, - IngestService ingestService ) { super( - name, + PutTransformAction.NAME, transportService, clusterService, threadPool, diff --git a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/action/TransportStopTransformAction.java b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/action/TransportStopTransformAction.java index 471396d50fbba..b4f441b92409a 100644 --- a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/action/TransportStopTransformAction.java +++ b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/action/TransportStopTransformAction.java @@ -78,29 +78,16 @@ public TransportStopTransformAction( TransformServices transformServices, Client client ) { - this( + super( StopTransformAction.NAME, + clusterService, transportService, actionFilters, - clusterService, - threadPool, - persistentTasksService, - transformServices, - client + Request::new, + Response::new, + Response::new, + ThreadPool.Names.SAME ); - } - - protected TransportStopTransformAction( - String name, - TransportService transportService, - ActionFilters actionFilters, - ClusterService clusterService, - ThreadPool threadPool, - PersistentTasksService persistentTasksService, - TransformServices transformServices, - Client client - ) { - super(name, clusterService, transportService, actionFilters, Request::new, Response::new, Response::new, ThreadPool.Names.SAME); this.threadPool = threadPool; this.transformConfigManager = transformServices.getConfigManager(); this.persistentTasksService = persistentTasksService; diff --git a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/action/TransportUpdateTransformAction.java b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/action/TransportUpdateTransformAction.java index 7319e998cf9b7..5519d9a327547 100644 --- a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/action/TransportUpdateTransformAction.java +++ b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/action/TransportUpdateTransformAction.java @@ -73,41 +73,15 @@ public TransportUpdateTransformAction( TransformServices transformServices, Client client, IngestService ingestService - ) { - this( - UpdateTransformAction.NAME, - settings, - transportService, - threadPool, - actionFilters, - indexNameExpressionResolver, - clusterService, - transformServices, - client, - ingestService - ); - } - - protected TransportUpdateTransformAction( - String name, - Settings settings, - TransportService transportService, - ThreadPool threadPool, - ActionFilters actionFilters, - IndexNameExpressionResolver indexNameExpressionResolver, - ClusterService clusterService, - TransformServices transformServices, - Client client, - IngestService ingestService ) { super( - name, + UpdateTransformAction.NAME, clusterService, transportService, actionFilters, - Request::fromStreamWithBWC, - Response::fromStreamWithBWC, - Response::fromStreamWithBWC, + Request::new, + Response::new, + Response::new, ThreadPool.Names.SAME ); @@ -138,7 +112,7 @@ protected void doExecute(Task task, Request request, ActionListener li nodes.getMasterNode(), actionName, request, - new ActionListenerResponseHandler<>(listener, Response::fromStreamWithBWC) + new ActionListenerResponseHandler<>(listener, Response::new) ); } return; diff --git a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/action/TransportUpgradeTransformsAction.java b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/action/TransportUpgradeTransformsAction.java index d920c7b2feafe..76b95bf7848d5 100644 --- a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/action/TransportUpgradeTransformsAction.java +++ b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/action/TransportUpgradeTransformsAction.java @@ -65,33 +65,9 @@ public TransportUpgradeTransformsAction( TransformServices transformServices, Client client, Settings settings - ) { - this( - UpgradeTransformsAction.NAME, - transportService, - actionFilters, - clusterService, - threadPool, - indexNameExpressionResolver, - transformServices, - client, - settings - ); - } - - protected TransportUpgradeTransformsAction( - String name, - TransportService transportService, - ActionFilters actionFilters, - ClusterService clusterService, - ThreadPool threadPool, - IndexNameExpressionResolver indexNameExpressionResolver, - TransformServices transformServices, - Client client, - Settings settings ) { super( - name, + UpgradeTransformsAction.NAME, transportService, clusterService, threadPool, diff --git a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/action/TransportValidateTransformAction.java b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/action/TransportValidateTransformAction.java index 784ab164ec3e2..399c83487857b 100644 --- a/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/action/TransportValidateTransformAction.java +++ b/x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/action/TransportValidateTransformAction.java @@ -56,29 +56,7 @@ public TransportValidateTransformAction( Settings settings, IngestService ingestService ) { - this( - ValidateTransformAction.NAME, - transportService, - actionFilters, - client, - indexNameExpressionResolver, - clusterService, - settings, - ingestService - ); - } - - protected TransportValidateTransformAction( - String name, - TransportService transportService, - ActionFilters actionFilters, - Client client, - IndexNameExpressionResolver indexNameExpressionResolver, - ClusterService clusterService, - Settings settings, - IngestService ingestService - ) { - super(name, transportService, actionFilters, Request::new); + super(ValidateTransformAction.NAME, transportService, actionFilters, Request::new); this.client = client; this.clusterService = clusterService; this.transportService = transportService;