cleanup tests

- make DeleteActionTests pass
- remove getType from LifecycleType
This commit is contained in:
Tal Levy 2018-04-11 18:28:46 -07:00
parent 7f4801f03c
commit c1b00d0154
7 changed files with 4 additions and 22 deletions

View File

@ -53,7 +53,7 @@ public class DeleteAction implements LifecycleAction {
@Override
public List<Step> toSteps(Client client, String phase, Step.StepKey nextStepKey) {
Step.StepKey deleteStepKey = new Step.StepKey(phase, NAME, "delete-step");
Step.StepKey deleteStepKey = new Step.StepKey(phase, NAME, DeleteStep.NAME);
return Collections.singletonList(new DeleteStep(deleteStepKey, nextStepKey, client));
}

View File

@ -11,6 +11,7 @@ import org.elasticsearch.client.Client;
import org.elasticsearch.cluster.metadata.IndexMetaData;
public class DeleteStep extends AsyncActionStep {
public static final String NAME = "delete";
public DeleteStep(StepKey key, StepKey nextStepKey, Client client) {
super(key, nextStepKey, client);

View File

@ -129,7 +129,7 @@ public class LifecyclePolicy extends AbstractDiffable<LifecyclePolicy>
@Override
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
builder.startObject();
builder.field(TYPE_FIELD.getPreferredName(), type.getType());
builder.field(TYPE_FIELD.getPreferredName(), type.getWriteableName());
builder.startObject(PHASES_FIELD.getPreferredName());
for (Phase phase : phases.values()) {
builder.field(phase.getName(), phase);

View File

@ -31,13 +31,4 @@ public interface LifecycleType extends NamedWriteable {
* if a specific phase or lack of a specific phase is invalid.
*/
void validate(Collection<Phase> phases);
/**
* Each {@link LifecyclePolicy} has a specific type to differentiate
* themselves. Every implementation is responsible to providing its specific
* type.
*
* @return the {@link LifecyclePolicy} type.
*/
String getType();
}

View File

@ -54,11 +54,6 @@ public class TimeseriesLifecycleType implements LifecycleType {
public void writeTo(StreamOutput out) throws IOException {
}
@Override
public String getType() {
return TYPE;
}
@Override
public String getWriteableName() {
return TYPE;

View File

@ -38,7 +38,7 @@ public class DeleteActionTests extends AbstractSerializingTestCase<DeleteAction>
List<Step> steps = action.toSteps(null, phase, nextStepKey);
assertNotNull(steps);
assertEquals(1, steps.size());
StepKey expectedFirstStepKey = new StepKey(phase, AllocateAction.NAME, AllocateAction.NAME);
StepKey expectedFirstStepKey = new StepKey(phase, DeleteAction.NAME, DeleteStep.NAME);
DeleteStep firstStep = (DeleteStep) steps.get(0);
assertEquals(expectedFirstStepKey, firstStep.getKey());
assertEquals(nextStepKey, firstStep.getNextStepKey());

View File

@ -25,11 +25,6 @@ public class TestLifecycleType implements LifecycleType {
public void writeTo(StreamOutput out) throws IOException {
}
@Override
public String getType() {
return TYPE;
}
@Override
public String getWriteableName() {
return TYPE;