From b636a4b8295d938bd5f50d07cd19f80f4cc8e2bb Mon Sep 17 00:00:00 2001 From: Martijn van Groningen Date: Tue, 24 Jan 2017 12:28:58 +0100 Subject: [PATCH] Fixed timeout (de-)serialization for start and stop datafeeder and open job apis. Original commit: elastic/x-pack-elasticsearch@be054db48c8570366aa91980b7075021df58af0b --- .../xpack/ml/action/OpenJobAction.java | 5 +++-- .../xpack/ml/action/StartDatafeedAction.java | 14 +++++++++----- .../xpack/ml/action/StopDatafeedAction.java | 13 ++++++++----- .../ml/action/CloseJobActionRequestTests.java | 9 +++++++-- .../xpack/ml/action/OpenJobActionRequestTests.java | 7 ++++++- .../ml/action/StartDatafeedActionRequestTests.java | 4 ++++ .../ml/action/StopDatafeedActionRequestTests.java | 10 ++++++---- 7 files changed, 43 insertions(+), 19 deletions(-) diff --git a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/action/OpenJobAction.java b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/action/OpenJobAction.java index 955fddefe13..7e1f0207988 100644 --- a/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/action/OpenJobAction.java +++ b/elasticsearch/src/main/java/org/elasticsearch/xpack/ml/action/OpenJobAction.java @@ -113,7 +113,7 @@ public class OpenJobAction extends Action { @Override protected Request createTestInstance() { - return new Request(randomAsciiOfLengthBetween(1, 20)); + Request request = new Request(randomAsciiOfLengthBetween(1, 20)); + if (randomBoolean()) { + request.setCloseTimeout(TimeValue.timeValueMillis(randomNonNegativeLong())); + } + return request; } @Override diff --git a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/OpenJobActionRequestTests.java b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/OpenJobActionRequestTests.java index 19512ce063c..6244e61fb31 100644 --- a/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/OpenJobActionRequestTests.java +++ b/elasticsearch/src/test/java/org/elasticsearch/xpack/ml/action/OpenJobActionRequestTests.java @@ -5,6 +5,7 @@ */ package org.elasticsearch.xpack.ml.action; +import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.xpack.ml.action.OpenJobAction.Request; import org.elasticsearch.xpack.ml.support.AbstractStreamableTestCase; @@ -12,7 +13,11 @@ public class OpenJobActionRequestTests extends AbstractStreamableTestCase { @@ -24,7 +24,9 @@ public class StopDatafeedActionRequestTests extends AbstractStreamableTestCase