-
Notifications
You must be signed in to change notification settings - Fork 24.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add reason to DataFrameTransformState and add hlrc protocol tests (#4…
…0736) add field "reason" to DataFrameTransformState, add hlrc protocol tests and allow unknown fields for DataFrameTransformState
- Loading branch information
Hendrik Muhs
authored
Apr 2, 2019
1 parent
6667bd8
commit 7861e6d
Showing
4 changed files
with
77 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
...a/org/elasticsearch/xpack/core/dataframe/transforms/DataFrameTransformStateHlrcTests.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
package org.elasticsearch.xpack.core.dataframe.transforms; | ||
|
||
import org.elasticsearch.common.xcontent.XContentParser; | ||
import org.elasticsearch.protocol.AbstractHlrcXContentTestCase; | ||
import org.elasticsearch.xpack.core.indexing.IndexerState; | ||
|
||
import java.io.IOException; | ||
import java.util.function.Predicate; | ||
|
||
public class DataFrameTransformStateHlrcTests extends AbstractHlrcXContentTestCase<DataFrameTransformState, | ||
org.elasticsearch.client.dataframe.transforms.DataFrameTransformState> { | ||
|
||
@Override | ||
public org.elasticsearch.client.dataframe.transforms.DataFrameTransformState doHlrcParseInstance(XContentParser parser) | ||
throws IOException { | ||
return org.elasticsearch.client.dataframe.transforms.DataFrameTransformState.fromXContent(parser); | ||
} | ||
|
||
@Override | ||
public DataFrameTransformState convertHlrcToInternal(org.elasticsearch.client.dataframe.transforms.DataFrameTransformState instance) { | ||
return new DataFrameTransformState(DataFrameTransformTaskState.fromString(instance.getTaskState().value()), | ||
IndexerState.fromString(instance.getIndexerState().value()), | ||
instance.getPosition(), instance.getGeneration(), instance.getReason()); | ||
} | ||
|
||
@Override | ||
protected DataFrameTransformState createTestInstance() { | ||
return DataFrameTransformStateTests.randomDataFrameTransformState(); | ||
} | ||
|
||
@Override | ||
protected DataFrameTransformState doParseInstance(XContentParser parser) throws IOException { | ||
return DataFrameTransformState.fromXContent(parser); | ||
} | ||
|
||
@Override | ||
protected boolean supportsUnknownFields() { | ||
return true; | ||
} | ||
|
||
@Override | ||
protected Predicate<String> getRandomFieldsExcludeFilter() { | ||
return field -> field.equals("current_position"); | ||
} | ||
} |