fix compilation changes

This commit is contained in:
Tal Levy 2018-03-12 12:29:22 -07:00
parent 9850f44b95
commit ebff02c1b2
8 changed files with 44 additions and 64 deletions

View File

@ -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);

View File

@ -59,14 +59,6 @@ public class PutLifecycleAction extends Action<PutLifecycleAction.Request, PutLi
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);

View File

@ -22,8 +22,8 @@ public class DeleteLifecycleRequestTests extends AbstractStreamableTestCase<Dele
}
@Override
protected MutateFunction<Request> getMutateFunction() {
return resp -> new Request(resp.getPolicyName() + randomAlphaOfLengthBetween(1, 10));
protected Request mutateInstance(Request request) {
return new Request(request.getPolicyName() + randomAlphaOfLengthBetween(1, 10));
}
}

View File

@ -22,8 +22,8 @@ public class DeleteLifecycleResponseTests extends AbstractStreamableTestCase<Del
}
@Override
protected MutateFunction<Response> getMutateFunction() {
return resp -> new Response(resp.isAcknowledged() == false);
protected Response mutateInstance(Response response) {
return new Response(response.isAcknowledged() == false);
}
}

View File

@ -22,7 +22,7 @@ public class GetLifecycleRequestTests extends AbstractStreamableTestCase<GetLife
}
@Override
protected MutateFunction<Request> getMutateFunction() {
return resp -> new Request(resp.getPolicyName() + randomAlphaOfLengthBetween(1, 10));
protected Request mutateInstance(Request request) {
return new Request(request.getPolicyName() + randomAlphaOfLengthBetween(1, 10));
}
}

View File

@ -50,25 +50,23 @@ public class GetLifecycleResponseTests extends AbstractStreamableTestCase<GetLif
}
@Override
protected MutateFunction<Response> getMutateFunction() {
return resp -> {
LifecyclePolicy policy = resp.getPolicy();
String name = policy.getName();
Map<String, Phase> 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<String, Phase> 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));
}
}

View File

@ -74,26 +74,24 @@ public class PutLifecycleRequestTests extends AbstractStreamableXContentTestCase
}
@Override
protected MutateFunction<Request> getMutateFunction() {
return resp -> {
LifecyclePolicy policy = resp.getPolicy();
String name = policy.getName();
Map<String, Phase> 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<String, Phase> 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));
}
}

View File

@ -22,8 +22,8 @@ public class PutLifecycleResponseTests extends AbstractStreamableTestCase<PutLif
}
@Override
protected MutateFunction<Response> getMutateFunction() {
return resp -> new Response(resp.isAcknowledged() == false);
protected Response mutateInstance(Response response) {
return new Response(response.isAcknowledged() == false);
}
}