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 28d15c87db8..531036daa99 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 @@ -57,14 +57,6 @@ public class DeleteLifecycleAction super(acknowledged); } - @Override - public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException { - builder.startObject(); - addAcknowledgedField(builder); - builder.endObject(); - return builder; - } - @Override public void readFrom(StreamInput in) throws IOException { readAcknowledged(in); 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 88a1a4c223c..a813c332c89 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 @@ -59,14 +59,6 @@ public class PutLifecycleAction extends Action getMutateFunction() { - return resp -> new Request(resp.getPolicyName() + randomAlphaOfLengthBetween(1, 10)); + protected Request mutateInstance(Request request) { + return new Request(request.getPolicyName() + randomAlphaOfLengthBetween(1, 10)); } } diff --git a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/indexlifecycle/action/DeleteLifecycleResponseTests.java b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/indexlifecycle/action/DeleteLifecycleResponseTests.java index abff643f674..3467e48a813 100644 --- a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/indexlifecycle/action/DeleteLifecycleResponseTests.java +++ b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/indexlifecycle/action/DeleteLifecycleResponseTests.java @@ -22,8 +22,8 @@ public class DeleteLifecycleResponseTests extends AbstractStreamableTestCase getMutateFunction() { - return resp -> new Response(resp.isAcknowledged() == false); + protected Response mutateInstance(Response response) { + return new Response(response.isAcknowledged() == false); } } 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 323e1b815f9..167f8138216 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 @@ -22,7 +22,7 @@ public class GetLifecycleRequestTests extends AbstractStreamableTestCase getMutateFunction() { - return resp -> new Request(resp.getPolicyName() + randomAlphaOfLengthBetween(1, 10)); + protected Request mutateInstance(Request request) { + return new Request(request.getPolicyName() + randomAlphaOfLengthBetween(1, 10)); } } diff --git a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/indexlifecycle/action/GetLifecycleResponseTests.java b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/indexlifecycle/action/GetLifecycleResponseTests.java index 9683d55263d..92efcd210b2 100644 --- a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/indexlifecycle/action/GetLifecycleResponseTests.java +++ b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/indexlifecycle/action/GetLifecycleResponseTests.java @@ -50,25 +50,23 @@ public class GetLifecycleResponseTests extends AbstractStreamableTestCase getMutateFunction() { - return resp -> { - LifecyclePolicy policy = resp.getPolicy(); - String name = policy.getName(); - Map phases = policy.getPhases(); - switch (between(0, 1)) { - case 0: - name = name + randomAlphaOfLengthBetween(1, 5); - break; - case 1: - phases = new HashMap<>(phases); - String newPhaseName = randomAlphaOfLengthBetween(1, 10); - phases.put(name, new Phase(newPhaseName, TimeValue.timeValueSeconds(randomIntBetween(1, 1000)), - Collections.emptyMap())); - break; - default: - throw new AssertionError("Illegal randomisation branch"); - } - return new Response(new LifecyclePolicy(TestLifecycleType.INSTANCE, name, phases)); - }; + protected Response mutateInstance(Response response) { + LifecyclePolicy policy = response.getPolicy(); + String name = policy.getName(); + Map phases = policy.getPhases(); + switch (between(0, 1)) { + case 0: + name = name + randomAlphaOfLengthBetween(1, 5); + break; + case 1: + phases = new HashMap<>(phases); + String newPhaseName = randomAlphaOfLengthBetween(1, 10); + phases.put(name, new Phase(newPhaseName, TimeValue.timeValueSeconds(randomIntBetween(1, 1000)), + Collections.emptyMap())); + break; + default: + throw new AssertionError("Illegal randomisation branch"); + } + return new Response(new LifecyclePolicy(TestLifecycleType.INSTANCE, name, phases)); } } 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 8bb0b5431c2..51087ff5af4 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 @@ -74,26 +74,24 @@ public class PutLifecycleRequestTests extends AbstractStreamableXContentTestCase } @Override - protected MutateFunction getMutateFunction() { - return resp -> { - LifecyclePolicy policy = resp.getPolicy(); - String name = policy.getName(); - Map phases = policy.getPhases(); - switch (between(0, 1)) { - case 0: - name = name + randomAlphaOfLengthBetween(1, 5); - break; - case 1: - phases = new HashMap<>(phases); - String newPhaseName = randomAlphaOfLengthBetween(1, 10); - phases.put(name, new Phase(newPhaseName, TimeValue.timeValueSeconds(randomIntBetween(1, 1000)), - Collections.emptyMap())); - break; - default: - throw new AssertionError("Illegal randomisation branch"); - } - return new Request(new LifecyclePolicy(TestLifecycleType.INSTANCE, name, phases)); - }; + protected Request mutateInstance(Request request) { + LifecyclePolicy policy = request.getPolicy(); + String name = policy.getName(); + Map phases = policy.getPhases(); + switch (between(0, 1)) { + case 0: + name = name + randomAlphaOfLengthBetween(1, 5); + break; + case 1: + phases = new HashMap<>(phases); + String newPhaseName = randomAlphaOfLengthBetween(1, 10); + phases.put(name, new Phase(newPhaseName, TimeValue.timeValueSeconds(randomIntBetween(1, 1000)), + Collections.emptyMap())); + break; + default: + throw new AssertionError("Illegal randomisation branch"); + } + return new Request(new LifecyclePolicy(TestLifecycleType.INSTANCE, name, phases)); } } diff --git a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/indexlifecycle/action/PutLifecycleResponseTests.java b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/indexlifecycle/action/PutLifecycleResponseTests.java index e0dde842af9..c780bf5f5ed 100644 --- a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/indexlifecycle/action/PutLifecycleResponseTests.java +++ b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/indexlifecycle/action/PutLifecycleResponseTests.java @@ -22,8 +22,8 @@ public class PutLifecycleResponseTests extends AbstractStreamableTestCase getMutateFunction() { - return resp -> new Response(resp.isAcknowledged() == false); + protected Response mutateInstance(Response response) { + return new Response(response.isAcknowledged() == false); } }