|
22 | 22 | import org.apache.http.HttpEntity;
|
23 | 23 | import org.apache.http.entity.ContentType;
|
24 | 24 | import org.apache.http.nio.entity.NStringEntity;
|
25 |
| -import org.apache.http.util.EntityUtils; |
26 | 25 | import org.elasticsearch.action.admin.indices.settings.get.GetSettingsRequest;
|
27 | 26 | import org.elasticsearch.action.admin.indices.settings.get.GetSettingsResponse;
|
28 | 27 | import org.elasticsearch.action.support.master.AcknowledgedResponse;
|
29 | 28 | import org.elasticsearch.client.indexlifecycle.DeleteLifecyclePolicyRequest;
|
| 29 | +import org.elasticsearch.client.indexlifecycle.StatusILMResponse; |
30 | 30 | import org.elasticsearch.common.settings.Settings;
|
31 | 31 | import org.elasticsearch.protocol.xpack.indexlifecycle.ExplainLifecycleRequest;
|
32 | 32 | import org.elasticsearch.protocol.xpack.indexlifecycle.ExplainLifecycleResponse;
|
@@ -169,35 +169,30 @@ public void testStartStopILM() throws Exception {
|
169 | 169 | createIndex("baz", Settings.builder().put("index.lifecycle.name", "eggplant").build());
|
170 | 170 | createIndex("squash", Settings.EMPTY);
|
171 | 171 |
|
172 |
| - // TODO: NORELEASE convert this to using the high level client once |
173 |
| - // there are APIs for it |
174 |
| - Request statusReq = new Request("GET", "/_ilm/status"); |
175 |
| - Response statusResponse = client().performRequest(statusReq); |
176 |
| - String statusResponseString = EntityUtils.toString(statusResponse.getEntity()); |
177 |
| - assertEquals("{\"operation_mode\":\"RUNNING\"}", statusResponseString); |
| 172 | + TimedRequest statusRequest = new TimedRequest(); |
| 173 | + StatusILMResponse statusResponse = execute(statusRequest, highLevelClient().indexLifecycle()::StatusILM, |
| 174 | + highLevelClient().indexLifecycle()::StatusILMAsync); |
| 175 | + assertEquals(statusResponse.getOperationMode(), StatusILMResponse.OperationMode.RUNNING); |
178 | 176 |
|
179 | 177 | StopILMRequest stopReq = new StopILMRequest();
|
180 | 178 | AcknowledgedResponse stopResponse = execute(stopReq, highLevelClient().indexLifecycle()::stopILM,
|
181 | 179 | highLevelClient().indexLifecycle()::stopILMAsync);
|
182 | 180 | assertTrue(stopResponse.isAcknowledged());
|
183 | 181 |
|
184 |
| - // TODO: NORELEASE convert this to using the high level client once there are APIs for it |
185 |
| - statusReq = new Request("GET", "/_ilm/status"); |
186 |
| - statusResponse = client().performRequest(statusReq); |
187 |
| - statusResponseString = EntityUtils.toString(statusResponse.getEntity()); |
188 |
| - assertThat(statusResponseString, |
189 |
| - Matchers.anyOf(equalTo("{\"operation_mode\":\"STOPPING\"}"), equalTo("{\"operation_mode\":\"STOPPED\"}"))); |
| 182 | + |
| 183 | + statusResponse = execute(statusRequest, highLevelClient().indexLifecycle()::StatusILM, |
| 184 | + highLevelClient().indexLifecycle()::StatusILMAsync); |
| 185 | + assertThat(statusResponse.getOperationMode(), |
| 186 | + Matchers.anyOf(equalTo(StatusILMResponse.OperationMode.STOPPING), equalTo(StatusILMResponse.OperationMode.STOPPED))); |
190 | 187 |
|
191 | 188 | StartILMRequest startReq = new StartILMRequest();
|
192 | 189 | AcknowledgedResponse startResponse = execute(startReq, highLevelClient().indexLifecycle()::startILM,
|
193 | 190 | highLevelClient().indexLifecycle()::startILMAsync);
|
194 | 191 | assertTrue(startResponse.isAcknowledged());
|
195 | 192 |
|
196 |
| - // TODO: NORELEASE convert this to using the high level client once there are APIs for it |
197 |
| - statusReq = new Request("GET", "/_ilm/status"); |
198 |
| - statusResponse = client().performRequest(statusReq); |
199 |
| - statusResponseString = EntityUtils.toString(statusResponse.getEntity()); |
200 |
| - assertEquals("{\"operation_mode\":\"RUNNING\"}", statusResponseString); |
| 193 | + statusResponse = execute(statusRequest, highLevelClient().indexLifecycle()::StatusILM, |
| 194 | + highLevelClient().indexLifecycle()::StatusILMAsync); |
| 195 | + assertEquals(statusResponse.getOperationMode(), StatusILMResponse.OperationMode.RUNNING); |
201 | 196 | }
|
202 | 197 |
|
203 | 198 | public void testExplainLifecycle() throws Exception {
|
|
0 commit comments