[HLRC] Update Stop & Start ILM APIs to use Validatable (#34242)
Convert the Stop and Start request objects to inherit from the preferred Validatable instead of ActionRequest.
This commit is contained in:
parent
f10735aa9a
commit
d66a63ed7a
|
@ -19,19 +19,13 @@
|
||||||
|
|
||||||
package org.elasticsearch.client.indexlifecycle;
|
package org.elasticsearch.client.indexlifecycle;
|
||||||
|
|
||||||
import org.elasticsearch.action.ActionRequestValidationException;
|
import org.elasticsearch.client.TimedRequest;
|
||||||
import org.elasticsearch.action.support.master.AcknowledgedRequest;
|
|
||||||
|
|
||||||
public class StartILMRequest extends AcknowledgedRequest<StartILMRequest> {
|
public class StartILMRequest extends TimedRequest {
|
||||||
|
|
||||||
public StartILMRequest() {
|
public StartILMRequest() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public ActionRequestValidationException validate() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return 64;
|
return 64;
|
||||||
|
|
|
@ -19,19 +19,13 @@
|
||||||
|
|
||||||
package org.elasticsearch.client.indexlifecycle;
|
package org.elasticsearch.client.indexlifecycle;
|
||||||
|
|
||||||
import org.elasticsearch.action.ActionRequestValidationException;
|
import org.elasticsearch.client.TimedRequest;
|
||||||
import org.elasticsearch.action.support.master.AcknowledgedRequest;
|
|
||||||
|
|
||||||
public class StopILMRequest extends AcknowledgedRequest<StopILMRequest> {
|
public class StopILMRequest extends TimedRequest {
|
||||||
|
|
||||||
public StopILMRequest() {
|
public StopILMRequest() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public ActionRequestValidationException validate() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return 75;
|
return 75;
|
||||||
|
|
|
@ -1530,8 +1530,8 @@ public class RequestConvertersTests extends ESTestCase {
|
||||||
public void testStartILM() throws Exception {
|
public void testStartILM() throws Exception {
|
||||||
StartILMRequest req = new StartILMRequest();
|
StartILMRequest req = new StartILMRequest();
|
||||||
Map<String, String> expectedParams = new HashMap<>();
|
Map<String, String> expectedParams = new HashMap<>();
|
||||||
setRandomMasterTimeout(req, expectedParams);
|
setRandomMasterTimeout(req::setMasterTimeout, StartILMRequest.DEFAULT_MASTER_TIMEOUT, expectedParams);
|
||||||
setRandomTimeout(req::timeout, AcknowledgedRequest.DEFAULT_ACK_TIMEOUT, expectedParams);
|
setRandomTimeoutTimeValue(req::setTimeout, StartILMRequest.DEFAULT_TIMEOUT, expectedParams);
|
||||||
|
|
||||||
Request request = RequestConverters.startILM(req);
|
Request request = RequestConverters.startILM(req);
|
||||||
assertThat(request.getMethod(), equalTo(HttpPost.METHOD_NAME));
|
assertThat(request.getMethod(), equalTo(HttpPost.METHOD_NAME));
|
||||||
|
@ -1542,8 +1542,8 @@ public class RequestConvertersTests extends ESTestCase {
|
||||||
public void testStopILM() throws Exception {
|
public void testStopILM() throws Exception {
|
||||||
StopILMRequest req = new StopILMRequest();
|
StopILMRequest req = new StopILMRequest();
|
||||||
Map<String, String> expectedParams = new HashMap<>();
|
Map<String, String> expectedParams = new HashMap<>();
|
||||||
setRandomMasterTimeout(req, expectedParams);
|
setRandomMasterTimeout(req::setMasterTimeout, StopILMRequest.DEFAULT_MASTER_TIMEOUT, expectedParams);
|
||||||
setRandomTimeout(req::timeout, AcknowledgedRequest.DEFAULT_ACK_TIMEOUT, expectedParams);
|
setRandomTimeoutTimeValue(req::setTimeout, StopILMRequest.DEFAULT_TIMEOUT, expectedParams);
|
||||||
|
|
||||||
Request request = RequestConverters.stopILM(req);
|
Request request = RequestConverters.stopILM(req);
|
||||||
assertThat(request.getMethod(), equalTo(HttpPost.METHOD_NAME));
|
assertThat(request.getMethod(), equalTo(HttpPost.METHOD_NAME));
|
||||||
|
|
|
@ -19,23 +19,22 @@
|
||||||
|
|
||||||
package org.elasticsearch.client.indexlifecycle;
|
package org.elasticsearch.client.indexlifecycle;
|
||||||
|
|
||||||
import org.elasticsearch.test.AbstractStreamableTestCase;
|
import org.elasticsearch.test.ESTestCase;
|
||||||
|
import org.elasticsearch.test.EqualsHashCodeTestUtils;
|
||||||
|
|
||||||
public class StartILMRequestTests extends AbstractStreamableTestCase<StartILMRequest> {
|
public class StartILMRequestTests extends ESTestCase {
|
||||||
|
|
||||||
@Override
|
|
||||||
protected StartILMRequest createBlankInstance() {
|
|
||||||
return new StartILMRequest();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected StartILMRequest createTestInstance() {
|
protected StartILMRequest createTestInstance() {
|
||||||
return new StartILMRequest();
|
return new StartILMRequest();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testValidate() {
|
public void testValidate() {
|
||||||
StartILMRequest request = createTestInstance();
|
StartILMRequest request = createTestInstance();
|
||||||
assertNull(request.validate());
|
assertFalse(request.validate().isPresent());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testEqualsAndHashcode() {
|
||||||
|
EqualsHashCodeTestUtils.checkEqualsAndHashCode(createTestInstance(), (original) -> createTestInstance());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,23 +19,22 @@
|
||||||
|
|
||||||
package org.elasticsearch.client.indexlifecycle;
|
package org.elasticsearch.client.indexlifecycle;
|
||||||
|
|
||||||
import org.elasticsearch.test.AbstractStreamableTestCase;
|
import org.elasticsearch.test.ESTestCase;
|
||||||
|
import org.elasticsearch.test.EqualsHashCodeTestUtils;
|
||||||
|
|
||||||
public class StopILMRequestTests extends AbstractStreamableTestCase<StopILMRequest> {
|
public class StopILMRequestTests extends ESTestCase {
|
||||||
|
|
||||||
@Override
|
|
||||||
protected StopILMRequest createBlankInstance() {
|
|
||||||
return new StopILMRequest();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected StopILMRequest createTestInstance() {
|
protected StopILMRequest createTestInstance() {
|
||||||
return new StopILMRequest();
|
return new StopILMRequest();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testValidate() {
|
public void testValidate() {
|
||||||
StopILMRequest request = createTestInstance();
|
StopILMRequest request = createTestInstance();
|
||||||
assertNull(request.validate());
|
assertFalse(request.validate().isPresent());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testEqualsAndHashcode() {
|
||||||
|
EqualsHashCodeTestUtils.checkEqualsAndHashCode(createTestInstance(), (original) -> createTestInstance());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue