Remove PROTO constants

This is a follow-up to the previous commit

Original commit: elastic/x-pack-elasticsearch@4d1e52fe43
This commit is contained in:
David Roberts 2017-01-03 10:49:00 +00:00
parent ad9d65cfa5
commit 161eefe7d8
6 changed files with 5 additions and 12 deletions

View File

@ -46,9 +46,6 @@ import java.util.TreeSet;
*/
public class Job extends AbstractDiffable<Job> implements Writeable, ToXContent {
public static final Job PROTO =
new Job(null, null, null, null, null, 0L, null, null, null, null, null, null, null, null, null, null, null, null, null);
public static final String TYPE = "job";
/*

View File

@ -28,8 +28,6 @@ public class Allocation extends AbstractDiffable<Allocation> implements ToXConte
public static final ParseField STATUS = new ParseField("status");
public static final ParseField STATUS_REASON = new ParseField("status_reason");
static final Allocation PROTO = new Allocation(null, null, false, null, null);
static final ObjectParser<Builder, ParseFieldMatcherSupplier> PARSER = new ObjectParser<>("allocation", Builder::new);
static {

View File

@ -44,7 +44,7 @@ public class PrelertInitializationService extends AbstractComponent implements C
public ClusterState execute(ClusterState currentState) throws Exception {
ClusterState.Builder builder = new ClusterState.Builder(currentState);
MetaData.Builder metadataBuilder = MetaData.builder(currentState.metaData());
metadataBuilder.putCustom(PrelertMetadata.TYPE, PrelertMetadata.PROTO);
metadataBuilder.putCustom(PrelertMetadata.TYPE, PrelertMetadata.EMPTY_METADATA);
builder.metaData(metadataBuilder.build());
return builder.build();
}

View File

@ -47,8 +47,8 @@ public class PrelertMetadata implements MetaData.Custom {
private static final ParseField SCHEDULERS_FIELD = new ParseField("schedulers");
public static final String TYPE = "prelert";
public static final PrelertMetadata PROTO = new PrelertMetadata(Collections.emptySortedMap(), Collections.emptySortedMap(),
Collections.emptySortedMap());
public static final PrelertMetadata EMPTY_METADATA = new PrelertMetadata(Collections.emptySortedMap(),
Collections.emptySortedMap(), Collections.emptySortedMap());
static final ObjectParser<Builder, ParseFieldMatcherSupplier> PRELERT_METADATA_PARSER = new ObjectParser<>("prelert_metadata",
Builder::new);

View File

@ -23,8 +23,6 @@ public class Scheduler extends AbstractDiffable<Scheduler> implements ToXContent
private static final ParseField CONFIG_FIELD = new ParseField("config");
private static final ParseField STATUS_FIELD = new ParseField("status");
public static final Scheduler PROTO = new Scheduler(null, null);
// Used for QueryPage
public static final ParseField RESULTS_FIELD = new ParseField("schedulers");

View File

@ -165,7 +165,7 @@ public class JobManagerTests extends ESTestCase {
.fPut(AnomalyDetectorsIndex.jobResultsIndexName("my-special-place"), indexMetaData).build();
ClusterState cs = ClusterState.builder(new ClusterName("_name"))
.metaData(MetaData.builder().putCustom(PrelertMetadata.TYPE, PrelertMetadata.PROTO).indices(indexMap)).build();
.metaData(MetaData.builder().putCustom(PrelertMetadata.TYPE, PrelertMetadata.EMPTY_METADATA).indices(indexMap)).build();
doAnswer(invocationOnMock -> {
AckedClusterStateUpdateTask<Boolean> task = (AckedClusterStateUpdateTask<Boolean>) invocationOnMock.getArguments()[1];
@ -196,7 +196,7 @@ public class JobManagerTests extends ESTestCase {
private ClusterState createClusterState() {
ClusterState.Builder builder = ClusterState.builder(new ClusterName("_name"));
builder.metaData(MetaData.builder().putCustom(PrelertMetadata.TYPE, PrelertMetadata.PROTO));
builder.metaData(MetaData.builder().putCustom(PrelertMetadata.TYPE, PrelertMetadata.EMPTY_METADATA));
return builder.build();
}
}