Skip to content

Commit 0682b4b

Browse files
authored
Removes redundent NORELEASES and ObjectParserUtils (#32427)
1 parent 783e427 commit 0682b4b

File tree

6 files changed

+12
-43
lines changed

6 files changed

+12
-43
lines changed

x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/IndexLifecycleMetadata.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,11 @@ public class IndexLifecycleMetadata implements XPackMetaDataCustom {
3838
public static final IndexLifecycleMetadata EMPTY = new IndexLifecycleMetadata(Collections.emptySortedMap(), OperationMode.RUNNING);
3939

4040
@SuppressWarnings("unchecked")
41-
public static final ConstructingObjectParser<IndexLifecycleMetadata, Void> PARSER = new ConstructingObjectParser<>(
42-
TYPE, a -> new IndexLifecycleMetadata(
43-
ObjectParserUtils.convertListToMapValues(LifecyclePolicyMetadata::getName, (List<LifecyclePolicyMetadata>) a[0]),
44-
OperationMode.valueOf((String) a[1])));
41+
public static final ConstructingObjectParser<IndexLifecycleMetadata, Void> PARSER = new ConstructingObjectParser<>(TYPE,
42+
a -> new IndexLifecycleMetadata(
43+
((List<LifecyclePolicyMetadata>) a[0]).stream()
44+
.collect(Collectors.toMap(LifecyclePolicyMetadata::getName, Function.identity())),
45+
OperationMode.valueOf((String) a[1])));
4546
static {
4647
PARSER.declareNamedObjects(ConstructingObjectParser.constructorArg(), (p, c, n) -> LifecyclePolicyMetadata.parse(p, n),
4748
v -> {

x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/ObjectParserUtils.java

Lines changed: 0 additions & 29 deletions
This file was deleted.

x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/indexlifecycle/Phase.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222
import java.util.Map;
2323
import java.util.Objects;
2424
import java.util.TreeMap;
25-
26-
import static org.elasticsearch.xpack.core.indexlifecycle.ObjectParserUtils.convertListToMapValues;
25+
import java.util.function.Function;
26+
import java.util.stream.Collectors;
2727

2828
/**
2929
* Represents set of {@link LifecycleAction}s which should be executed at a
@@ -36,8 +36,8 @@ public class Phase implements ToXContentObject, Writeable {
3636

3737
@SuppressWarnings("unchecked")
3838
private static final ConstructingObjectParser<Phase, String> PARSER = new ConstructingObjectParser<>("phase", false,
39-
(a, name) -> new Phase(name, (TimeValue) a[0],
40-
convertListToMapValues(LifecycleAction::getWriteableName, (List<LifecycleAction>) a[1])));
39+
(a, name) -> new Phase(name, (TimeValue) a[0], ((List<LifecycleAction>) a[1]).stream()
40+
.collect(Collectors.toMap(LifecycleAction::getWriteableName, Function.identity()))));
4141
static {
4242
PARSER.declareField(ConstructingObjectParser.optionalConstructorArg(),
4343
(p, c) -> TimeValue.parseTimeValue(p.text(), AFTER_FIELD.getPreferredName()), AFTER_FIELD, ValueType.VALUE);

x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/indexlifecycle/LifecyclePolicyMetadataTests.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@ public class LifecyclePolicyMetadataTests extends AbstractSerializingTestCase<Li
2828

2929
@Before
3030
public void setup() {
31-
lifecycleName = randomAlphaOfLength(20); // NORELEASE we need to randomise the lifecycle name rather
32-
// than use the same name for all instances
31+
lifecycleName = randomAlphaOfLength(20);
3332
}
3433

3534
@Override

x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/indexlifecycle/PhaseTests.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@ public class PhaseTests extends AbstractSerializingTestCase<Phase> {
2828

2929
@Before
3030
public void setup() {
31-
phaseName = randomAlphaOfLength(20); // NORELEASE we need to randomise the phase name rather
32-
// than use the same name for all instances
31+
phaseName = randomAlphaOfLength(20);
3332
}
3433

3534
@Override

x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/indexlifecycle/action/PutLifecycleRequestTests.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@ public class PutLifecycleRequestTests extends AbstractStreamableXContentTestCase
3434

3535
@Before
3636
public void setup() {
37-
lifecycleName = randomAlphaOfLength(20); // NORELEASE we need to randomise the lifecycle name rather
38-
// than use the same name for all instances
37+
lifecycleName = randomAlphaOfLength(20);
3938
}
4039

4140
@Override

0 commit comments

Comments
 (0)