[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;
|
||||
|
||||
import org.elasticsearch.action.ActionRequestValidationException;
|
||||
import org.elasticsearch.action.support.master.AcknowledgedRequest;
|
||||
import org.elasticsearch.client.TimedRequest;
|
||||
|
||||
public class StartILMRequest extends AcknowledgedRequest<StartILMRequest> {
|
||||
public class StartILMRequest extends TimedRequest {
|
||||
|
||||
public StartILMRequest() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionRequestValidationException validate() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return 64;
|
||||
|
|
|
@ -19,19 +19,13 @@
|
|||
|
||||
package org.elasticsearch.client.indexlifecycle;
|
||||
|
||||
import org.elasticsearch.action.ActionRequestValidationException;
|
||||
import org.elasticsearch.action.support.master.AcknowledgedRequest;
|
||||
import org.elasticsearch.client.TimedRequest;
|
||||
|
||||
public class StopILMRequest extends AcknowledgedRequest<StopILMRequest> {
|
||||
public class StopILMRequest extends TimedRequest {
|
||||
|
||||
public StopILMRequest() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionRequestValidationException validate() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return 75;
|
||||
|
|
|
@ -1530,8 +1530,8 @@ public class RequestConvertersTests extends ESTestCase {
|
|||
public void testStartILM() throws Exception {
|
||||
StartILMRequest req = new StartILMRequest();
|
||||
Map<String, String> expectedParams = new HashMap<>();
|
||||
setRandomMasterTimeout(req, expectedParams);
|
||||
setRandomTimeout(req::timeout, AcknowledgedRequest.DEFAULT_ACK_TIMEOUT, expectedParams);
|
||||
setRandomMasterTimeout(req::setMasterTimeout, StartILMRequest.DEFAULT_MASTER_TIMEOUT, expectedParams);
|
||||
setRandomTimeoutTimeValue(req::setTimeout, StartILMRequest.DEFAULT_TIMEOUT, expectedParams);
|
||||
|
||||
Request request = RequestConverters.startILM(req);
|
||||
assertThat(request.getMethod(), equalTo(HttpPost.METHOD_NAME));
|
||||
|
@ -1542,8 +1542,8 @@ public class RequestConvertersTests extends ESTestCase {
|
|||
public void testStopILM() throws Exception {
|
||||
StopILMRequest req = new StopILMRequest();
|
||||
Map<String, String> expectedParams = new HashMap<>();
|
||||
setRandomMasterTimeout(req, expectedParams);
|
||||
setRandomTimeout(req::timeout, AcknowledgedRequest.DEFAULT_ACK_TIMEOUT, expectedParams);
|
||||
setRandomMasterTimeout(req::setMasterTimeout, StopILMRequest.DEFAULT_MASTER_TIMEOUT, expectedParams);
|
||||
setRandomTimeoutTimeValue(req::setTimeout, StopILMRequest.DEFAULT_TIMEOUT, expectedParams);
|
||||
|
||||
Request request = RequestConverters.stopILM(req);
|
||||
assertThat(request.getMethod(), equalTo(HttpPost.METHOD_NAME));
|
||||
|
|
|
@ -19,23 +19,22 @@
|
|||
|
||||
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() {
|
||||
return new StartILMRequest();
|
||||
}
|
||||
|
||||
public void testValidate() {
|
||||
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;
|
||||
|
||||
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() {
|
||||
return new StopILMRequest();
|
||||
}
|
||||
|
||||
public void testValidate() {
|
||||
StopILMRequest request = createTestInstance();
|
||||
assertNull(request.validate());
|
||||
assertFalse(request.validate().isPresent());
|
||||
}
|
||||
|
||||
public void testEqualsAndHashcode() {
|
||||
EqualsHashCodeTestUtils.checkEqualsAndHashCode(createTestInstance(), (original) -> createTestInstance());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue