[ML] Fix compilation errors after Version changes

Original commit: elastic/x-pack-elasticsearch@745c1dffac
This commit is contained in:
Dimitrios Athanasiou 2017-05-17 18:32:47 +01:00
parent 646a3acd56
commit 05daaa8a3c
3 changed files with 7 additions and 7 deletions

View File

@ -553,7 +553,7 @@ public class Job extends AbstractDiffable<Job> implements Writeable, ToXContent
*/
public static Set<String> getCompatibleJobTypes(Version nodeVersion) {
Set<String> compatibleTypes = new HashSet<>();
if (nodeVersion.onOrAfter(Version.V_5_4_0_UNRELEASED)) {
if (nodeVersion.onOrAfter(Version.V_5_4_0)) {
compatibleTypes.add(ANOMALY_DETECTOR_JOB_TYPE);
}
return compatibleTypes;

View File

@ -282,9 +282,9 @@ public class OpenJobActionTests extends ESTestCase {
nodeAttr.put(MachineLearning.ML_ENABLED_NODE_ATTR, "true");
DiscoveryNodes nodes = DiscoveryNodes.builder()
.add(new DiscoveryNode("_node_name1", "_node_id1", new TransportAddress(InetAddress.getLoopbackAddress(), 9300),
nodeAttr, Collections.emptySet(), Version.V_5_4_0_UNRELEASED))
nodeAttr, Collections.emptySet(), Version.V_5_4_0))
.add(new DiscoveryNode("_node_name2", "_node_id2", new TransportAddress(InetAddress.getLoopbackAddress(), 9301),
nodeAttr, Collections.emptySet(), Version.V_5_4_0_UNRELEASED))
nodeAttr, Collections.emptySet(), Version.V_5_4_0))
.build();
PersistentTasksCustomMetaData.Builder tasksBuilder = PersistentTasksCustomMetaData.builder();

View File

@ -392,13 +392,13 @@ public class JobTests extends AbstractSerializingTestCase<Job> {
public void testGetCompatibleJobTypes_givenVersionBefore_V_5_4() {
assertThat(Job.getCompatibleJobTypes(Version.V_5_0_0).isEmpty(), is(true));
assertThat(Job.getCompatibleJobTypes(Version.V_5_3_0_UNRELEASED).isEmpty(), is(true));
assertThat(Job.getCompatibleJobTypes(Version.V_5_3_2_UNRELEASED).isEmpty(), is(true));
assertThat(Job.getCompatibleJobTypes(Version.V_5_3_0).isEmpty(), is(true));
assertThat(Job.getCompatibleJobTypes(Version.V_5_3_2).isEmpty(), is(true));
}
public void testGetCompatibleJobTypes_givenVersionAfter_V_5_4() {
assertThat(Job.getCompatibleJobTypes(Version.V_5_4_0_UNRELEASED), contains(Job.ANOMALY_DETECTOR_JOB_TYPE));
assertThat(Job.getCompatibleJobTypes(Version.V_5_4_0_UNRELEASED).size(), equalTo(1));
assertThat(Job.getCompatibleJobTypes(Version.V_5_4_0), contains(Job.ANOMALY_DETECTOR_JOB_TYPE));
assertThat(Job.getCompatibleJobTypes(Version.V_5_4_0).size(), equalTo(1));
assertThat(Job.getCompatibleJobTypes(Version.V_5_5_0_UNRELEASED), contains(Job.ANOMALY_DETECTOR_JOB_TYPE));
assertThat(Job.getCompatibleJobTypes(Version.V_5_5_0_UNRELEASED).size(), equalTo(1));
}