diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/ShrinkAction.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/ShrinkAction.java index 055ce5be9f7..00b7be6f551 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/ShrinkAction.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/ShrinkAction.java @@ -79,11 +79,11 @@ public class ShrinkAction implements LifecycleAction { public List toSteps(Client client, String phase, Step.StepKey nextStepKey) { StepKey shrinkKey = new StepKey(phase, NAME, ShrinkStep.NAME); StepKey enoughShardsKey = new StepKey(phase, NAME, ShrunkShardsAllocatedStep.NAME); - StepKey aliasKey = new StepKey(phase, NAME, AliasStep.NAME); + StepKey aliasKey = new StepKey(phase, NAME, ShrinkSetAliasStep.NAME); StepKey isShrunkIndexKey = new StepKey(phase, NAME, ShrunkenIndexCheckStep.NAME); ShrinkStep shrink = new ShrinkStep(shrinkKey, enoughShardsKey, client, numberOfShards, SHRUNKEN_INDEX_PREFIX); ShrunkShardsAllocatedStep allocated = new ShrunkShardsAllocatedStep(enoughShardsKey, aliasKey, numberOfShards, SHRUNKEN_INDEX_PREFIX); - AliasStep aliasSwapAndDelete = new AliasStep(aliasKey, isShrunkIndexKey, client, SHRUNKEN_INDEX_PREFIX); + ShrinkSetAliasStep aliasSwapAndDelete = new ShrinkSetAliasStep(aliasKey, isShrunkIndexKey, client, SHRUNKEN_INDEX_PREFIX); ShrunkenIndexCheckStep waitOnShrinkTakeover = new ShrunkenIndexCheckStep(isShrunkIndexKey, nextStepKey, SHRUNKEN_INDEX_PREFIX); return Arrays.asList(shrink, allocated, aliasSwapAndDelete, waitOnShrinkTakeover); } diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/AliasStep.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/ShrinkSetAliasStep.java similarity index 89% rename from x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/AliasStep.java rename to x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/ShrinkSetAliasStep.java index 903d82d25cf..809aa092203 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/AliasStep.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/ShrinkSetAliasStep.java @@ -12,11 +12,11 @@ import org.elasticsearch.cluster.metadata.IndexMetaData; import java.util.Objects; -public class AliasStep extends AsyncActionStep { +public class ShrinkSetAliasStep extends AsyncActionStep { public static final String NAME = "aliases"; private String shrunkIndexPrefix; - public AliasStep(StepKey key, StepKey nextStepKey, Client client, String shrunkIndexPrefix) { + public ShrinkSetAliasStep(StepKey key, StepKey nextStepKey, Client client, String shrunkIndexPrefix) { super(key, nextStepKey, client); this.shrunkIndexPrefix = shrunkIndexPrefix; } @@ -53,7 +53,7 @@ public class AliasStep extends AsyncActionStep { if (getClass() != obj.getClass()) { return false; } - AliasStep other = (AliasStep) obj; + ShrinkSetAliasStep other = (ShrinkSetAliasStep) obj; return super.equals(obj) && Objects.equals(shrunkIndexPrefix, other.shrunkIndexPrefix); } diff --git a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/indexlifecycle/ShrinkActionTests.java b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/indexlifecycle/ShrinkActionTests.java index 0bfc2f75111..90351ef4ced 100644 --- a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/indexlifecycle/ShrinkActionTests.java +++ b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/indexlifecycle/ShrinkActionTests.java @@ -51,7 +51,7 @@ public class ShrinkActionTests extends AbstractSerializingTestCase assertThat(steps.size(), equalTo(4)); StepKey expectedFirstKey = new StepKey(phase, ShrinkAction.NAME, ShrinkStep.NAME); StepKey expectedSecondKey = new StepKey(phase, ShrinkAction.NAME, ShrunkShardsAllocatedStep.NAME); - StepKey expectedThirdKey = new StepKey(phase, ShrinkAction.NAME, AliasStep.NAME); + StepKey expectedThirdKey = new StepKey(phase, ShrinkAction.NAME, ShrinkSetAliasStep.NAME); StepKey expectedFourthKey = new StepKey(phase, ShrinkAction.NAME, ShrunkenIndexCheckStep.NAME); assertTrue(steps.get(0) instanceof ShrinkStep); assertThat(steps.get(0).getKey(), equalTo(expectedFirstKey)); @@ -61,9 +61,9 @@ public class ShrinkActionTests extends AbstractSerializingTestCase assertThat(steps.get(1).getKey(), equalTo(expectedSecondKey)); assertThat(((ShrunkShardsAllocatedStep) steps.get(1)).getNumberOfShards(), equalTo(action.getNumberOfShards())); assertThat(((ShrunkShardsAllocatedStep) steps.get(1)).getShrunkIndexPrefix(), equalTo(ShrinkAction.SHRUNKEN_INDEX_PREFIX)); - assertTrue(steps.get(2) instanceof AliasStep); + assertTrue(steps.get(2) instanceof ShrinkSetAliasStep); assertThat(steps.get(2).getKey(), equalTo(expectedThirdKey)); - assertThat(((AliasStep) steps.get(2)).getShrunkIndexPrefix(), equalTo(ShrinkAction.SHRUNKEN_INDEX_PREFIX)); + assertThat(((ShrinkSetAliasStep) steps.get(2)).getShrunkIndexPrefix(), equalTo(ShrinkAction.SHRUNKEN_INDEX_PREFIX)); assertTrue(steps.get(3) instanceof ShrunkenIndexCheckStep); assertThat(steps.get(3).getKey(), equalTo(expectedFourthKey)); assertThat(((ShrunkenIndexCheckStep) steps.get(3)).getShrunkIndexPrefix(), equalTo(ShrinkAction.SHRUNKEN_INDEX_PREFIX)); diff --git a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/indexlifecycle/AliasStepTests.java b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/indexlifecycle/ShrinkSetAliasStepTests.java similarity index 90% rename from x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/indexlifecycle/AliasStepTests.java rename to x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/indexlifecycle/ShrinkSetAliasStepTests.java index bcd69150456..31d5ffd00a6 100644 --- a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/indexlifecycle/AliasStepTests.java +++ b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/indexlifecycle/ShrinkSetAliasStepTests.java @@ -29,7 +29,7 @@ import java.util.List; import static org.hamcrest.Matchers.equalTo; -public class AliasStepTests extends AbstractStepTestCase { +public class ShrinkSetAliasStepTests extends AbstractStepTestCase { private Client client; @@ -39,15 +39,15 @@ public class AliasStepTests extends AbstractStepTestCase { } @Override - public AliasStep createRandomInstance() { + public ShrinkSetAliasStep createRandomInstance() { StepKey stepKey = new StepKey(randomAlphaOfLength(10), randomAlphaOfLength(10), randomAlphaOfLength(10)); StepKey nextStepKey = new StepKey(randomAlphaOfLength(10), randomAlphaOfLength(10), randomAlphaOfLength(10)); String shrunkIndexPrefix = randomAlphaOfLength(10); - return new AliasStep(stepKey, nextStepKey, client, shrunkIndexPrefix); + return new ShrinkSetAliasStep(stepKey, nextStepKey, client, shrunkIndexPrefix); } @Override - public AliasStep mutateInstance(AliasStep instance) { + public ShrinkSetAliasStep mutateInstance(ShrinkSetAliasStep instance) { StepKey key = instance.getKey(); StepKey nextKey = instance.getNextStepKey(); String shrunkIndexPrefix = instance.getShrunkIndexPrefix(); @@ -64,18 +64,18 @@ public class AliasStepTests extends AbstractStepTestCase { default: throw new AssertionError("Illegal randomisation branch"); } - return new AliasStep(key, nextKey, instance.getClient(), shrunkIndexPrefix); + return new ShrinkSetAliasStep(key, nextKey, instance.getClient(), shrunkIndexPrefix); } @Override - public AliasStep copyInstance(AliasStep instance) { - return new AliasStep(instance.getKey(), instance.getNextStepKey(), instance.getClient(), instance.getShrunkIndexPrefix()); + public ShrinkSetAliasStep copyInstance(ShrinkSetAliasStep instance) { + return new ShrinkSetAliasStep(instance.getKey(), instance.getNextStepKey(), instance.getClient(), instance.getShrunkIndexPrefix()); } public void testPerformAction() { IndexMetaData indexMetaData = IndexMetaData.builder(randomAlphaOfLength(10)).settings(settings(Version.CURRENT)) .numberOfShards(randomIntBetween(1, 5)).numberOfReplicas(randomIntBetween(0, 5)).build(); - AliasStep step = createRandomInstance(); + ShrinkSetAliasStep step = createRandomInstance(); String sourceIndex = indexMetaData.getIndex().getName(); String shrunkenIndex = step.getShrunkIndexPrefix() + sourceIndex; @@ -128,7 +128,7 @@ public class AliasStepTests extends AbstractStepTestCase { IndexMetaData indexMetaData = IndexMetaData.builder(randomAlphaOfLength(10)).settings(settings(Version.CURRENT)) .numberOfShards(randomIntBetween(1, 5)).numberOfReplicas(randomIntBetween(0, 5)).build(); Exception exception = new RuntimeException(); - AliasStep step = createRandomInstance(); + ShrinkSetAliasStep step = createRandomInstance(); AdminClient adminClient = Mockito.mock(AdminClient.class); IndicesAdminClient indicesClient = Mockito.mock(IndicesAdminClient.class);