diff --git a/client/rest-high-level/src/main/java/org/elasticsearch/client/IngestClient.java b/client/rest-high-level/src/main/java/org/elasticsearch/client/IngestClient.java index 99d50f6b46b7e..eb070759ed9cf 100644 --- a/client/rest-high-level/src/main/java/org/elasticsearch/client/IngestClient.java +++ b/client/rest-high-level/src/main/java/org/elasticsearch/client/IngestClient.java @@ -55,7 +55,7 @@ public final class IngestClient { * @throws IOException in case there is a problem sending the request or parsing back the response */ public AcknowledgedResponse putPipeline(PutPipelineRequest request, RequestOptions options) throws IOException { - return restHighLevelClient.performRequestAndParseEntity( request, RequestConverters::putPipeline, options, + return restHighLevelClient.performRequestAndParseEntity( request, IngestRequestConverters::putPipeline, options, AcknowledgedResponse::fromXContent, emptySet()); } @@ -68,7 +68,7 @@ public AcknowledgedResponse putPipeline(PutPipelineRequest request, RequestOptio * @param listener the listener to be notified upon request completion */ public void putPipelineAsync(PutPipelineRequest request, RequestOptions options, ActionListener listener) { - restHighLevelClient.performRequestAsyncAndParseEntity( request, RequestConverters::putPipeline, options, + restHighLevelClient.performRequestAsyncAndParseEntity( request, IngestRequestConverters::putPipeline, options, AcknowledgedResponse::fromXContent, listener, emptySet()); } @@ -82,7 +82,7 @@ public void putPipelineAsync(PutPipelineRequest request, RequestOptions options, * @throws IOException in case there is a problem sending the request or parsing back the response */ public GetPipelineResponse getPipeline(GetPipelineRequest request, RequestOptions options) throws IOException { - return restHighLevelClient.performRequestAndParseEntity( request, RequestConverters::getPipeline, options, + return restHighLevelClient.performRequestAndParseEntity( request, IngestRequestConverters::getPipeline, options, GetPipelineResponse::fromXContent, emptySet()); } @@ -95,7 +95,7 @@ public GetPipelineResponse getPipeline(GetPipelineRequest request, RequestOption * @param listener the listener to be notified upon request completion */ public void getPipelineAsync(GetPipelineRequest request, RequestOptions options, ActionListener listener) { - restHighLevelClient.performRequestAsyncAndParseEntity( request, RequestConverters::getPipeline, options, + restHighLevelClient.performRequestAsyncAndParseEntity( request, IngestRequestConverters::getPipeline, options, GetPipelineResponse::fromXContent, listener, emptySet()); } @@ -110,7 +110,7 @@ public void getPipelineAsync(GetPipelineRequest request, RequestOptions options, * @throws IOException in case there is a problem sending the request or parsing back the response */ public AcknowledgedResponse deletePipeline(DeletePipelineRequest request, RequestOptions options) throws IOException { - return restHighLevelClient.performRequestAndParseEntity( request, RequestConverters::deletePipeline, options, + return restHighLevelClient.performRequestAndParseEntity( request, IngestRequestConverters::deletePipeline, options, AcknowledgedResponse::fromXContent, emptySet()); } @@ -124,7 +124,7 @@ public AcknowledgedResponse deletePipeline(DeletePipelineRequest request, Reques * @param listener the listener to be notified upon request completion */ public void deletePipelineAsync(DeletePipelineRequest request, RequestOptions options, ActionListener listener) { - restHighLevelClient.performRequestAsyncAndParseEntity( request, RequestConverters::deletePipeline, options, + restHighLevelClient.performRequestAsyncAndParseEntity( request, IngestRequestConverters::deletePipeline, options, AcknowledgedResponse::fromXContent, listener, emptySet()); } @@ -140,7 +140,7 @@ public void deletePipelineAsync(DeletePipelineRequest request, RequestOptions op * @throws IOException in case there is a problem sending the request or parsing back the response */ public SimulatePipelineResponse simulate(SimulatePipelineRequest request, RequestOptions options) throws IOException { - return restHighLevelClient.performRequestAndParseEntity( request, RequestConverters::simulatePipeline, options, + return restHighLevelClient.performRequestAndParseEntity( request, IngestRequestConverters::simulatePipeline, options, SimulatePipelineResponse::fromXContent, emptySet()); } @@ -157,7 +157,7 @@ public SimulatePipelineResponse simulate(SimulatePipelineRequest request, Reques public void simulateAsync(SimulatePipelineRequest request, RequestOptions options, ActionListener listener) { - restHighLevelClient.performRequestAsyncAndParseEntity( request, RequestConverters::simulatePipeline, options, + restHighLevelClient.performRequestAsyncAndParseEntity( request, IngestRequestConverters::simulatePipeline, options, SimulatePipelineResponse::fromXContent, listener, emptySet()); } } diff --git a/client/rest-high-level/src/main/java/org/elasticsearch/client/IngestRequestConverters.java b/client/rest-high-level/src/main/java/org/elasticsearch/client/IngestRequestConverters.java new file mode 100644 index 0000000000000..e81d716b60f3f --- /dev/null +++ b/client/rest-high-level/src/main/java/org/elasticsearch/client/IngestRequestConverters.java @@ -0,0 +1,89 @@ +/* + * Licensed to Elasticsearch under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.elasticsearch.client; + +import org.apache.http.client.methods.HttpDelete; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.client.methods.HttpPut; +import org.elasticsearch.action.ingest.DeletePipelineRequest; +import org.elasticsearch.action.ingest.GetPipelineRequest; +import org.elasticsearch.action.ingest.PutPipelineRequest; +import org.elasticsearch.action.ingest.SimulatePipelineRequest; + +import java.io.IOException; + +public class IngestRequestConverters { + + static Request getPipeline(GetPipelineRequest getPipelineRequest) { + String endpoint = new RequestConverters.EndpointBuilder() + .addPathPartAsIs("_ingest/pipeline") + .addCommaSeparatedPathParts(getPipelineRequest.getIds()) + .build(); + Request request = new Request(HttpGet.METHOD_NAME, endpoint); + + RequestConverters.Params parameters = new RequestConverters.Params(request); + parameters.withMasterTimeout(getPipelineRequest.masterNodeTimeout()); + return request; + } + + static Request putPipeline(PutPipelineRequest putPipelineRequest) throws IOException { + String endpoint = new RequestConverters.EndpointBuilder() + .addPathPartAsIs("_ingest/pipeline") + .addPathPart(putPipelineRequest.getId()) + .build(); + Request request = new Request(HttpPut.METHOD_NAME, endpoint); + + RequestConverters.Params parameters = new RequestConverters.Params(request); + parameters.withTimeout(putPipelineRequest.timeout()); + parameters.withMasterTimeout(putPipelineRequest.masterNodeTimeout()); + + request.setEntity(RequestConverters.createEntity(putPipelineRequest, RequestConverters.REQUEST_BODY_CONTENT_TYPE)); + return request; + } + + static Request deletePipeline(DeletePipelineRequest deletePipelineRequest) { + String endpoint = new RequestConverters.EndpointBuilder() + .addPathPartAsIs("_ingest/pipeline") + .addPathPart(deletePipelineRequest.getId()) + .build(); + Request request = new Request(HttpDelete.METHOD_NAME, endpoint); + + RequestConverters.Params parameters = new RequestConverters.Params(request); + parameters.withTimeout(deletePipelineRequest.timeout()); + parameters.withMasterTimeout(deletePipelineRequest.masterNodeTimeout()); + + return request; + } + + static Request simulatePipeline(SimulatePipelineRequest simulatePipelineRequest) throws IOException { + RequestConverters.EndpointBuilder builder = new RequestConverters.EndpointBuilder().addPathPartAsIs("_ingest/pipeline"); + if (simulatePipelineRequest.getId() != null && !simulatePipelineRequest.getId().isEmpty()) { + builder.addPathPart(simulatePipelineRequest.getId()); + } + builder.addPathPartAsIs("_simulate"); + String endpoint = builder.build(); + Request request = new Request(HttpPost.METHOD_NAME, endpoint); + RequestConverters.Params params = new RequestConverters.Params(request); + params.putParam("verbose", Boolean.toString(simulatePipelineRequest.isVerbose())); + request.setEntity(RequestConverters.createEntity(simulatePipelineRequest, RequestConverters.REQUEST_BODY_CONTENT_TYPE)); + return request; + } +} diff --git a/client/rest-high-level/src/main/java/org/elasticsearch/client/RequestConverters.java b/client/rest-high-level/src/main/java/org/elasticsearch/client/RequestConverters.java index 5401d32b6b735..5c3c494999438 100644 --- a/client/rest-high-level/src/main/java/org/elasticsearch/client/RequestConverters.java +++ b/client/rest-high-level/src/main/java/org/elasticsearch/client/RequestConverters.java @@ -63,10 +63,6 @@ import org.elasticsearch.action.get.GetRequest; import org.elasticsearch.action.get.MultiGetRequest; import org.elasticsearch.action.index.IndexRequest; -import org.elasticsearch.action.ingest.DeletePipelineRequest; -import org.elasticsearch.action.ingest.GetPipelineRequest; -import org.elasticsearch.action.ingest.PutPipelineRequest; -import org.elasticsearch.action.ingest.SimulatePipelineRequest; import org.elasticsearch.action.search.ClearScrollRequest; import org.elasticsearch.action.search.MultiSearchRequest; import org.elasticsearch.action.search.SearchRequest; @@ -695,47 +691,6 @@ private static Request resize(ResizeRequest resizeRequest) throws IOException { return request; } - static Request getPipeline(GetPipelineRequest getPipelineRequest) { - String endpoint = new EndpointBuilder() - .addPathPartAsIs("_ingest/pipeline") - .addCommaSeparatedPathParts(getPipelineRequest.getIds()) - .build(); - Request request = new Request(HttpGet.METHOD_NAME, endpoint); - - Params parameters = new Params(request); - parameters.withMasterTimeout(getPipelineRequest.masterNodeTimeout()); - return request; - } - - static Request putPipeline(PutPipelineRequest putPipelineRequest) throws IOException { - String endpoint = new EndpointBuilder() - .addPathPartAsIs("_ingest/pipeline") - .addPathPart(putPipelineRequest.getId()) - .build(); - Request request = new Request(HttpPut.METHOD_NAME, endpoint); - - Params parameters = new Params(request); - parameters.withTimeout(putPipelineRequest.timeout()); - parameters.withMasterTimeout(putPipelineRequest.masterNodeTimeout()); - - request.setEntity(createEntity(putPipelineRequest, REQUEST_BODY_CONTENT_TYPE)); - return request; - } - - static Request deletePipeline(DeletePipelineRequest deletePipelineRequest) { - String endpoint = new EndpointBuilder() - .addPathPartAsIs("_ingest/pipeline") - .addPathPart(deletePipelineRequest.getId()) - .build(); - Request request = new Request(HttpDelete.METHOD_NAME, endpoint); - - Params parameters = new Params(request); - parameters.withTimeout(deletePipelineRequest.timeout()); - parameters.withMasterTimeout(deletePipelineRequest.masterNodeTimeout()); - - return request; - } - static Request reindex(ReindexRequest reindexRequest) throws IOException { String endpoint = new EndpointBuilder().addPathPart("_reindex").build(); Request request = new Request(HttpPost.METHOD_NAME, endpoint); @@ -912,20 +867,6 @@ static Request validateQuery(ValidateQueryRequest validateQueryRequest) throws I return request; } - static Request simulatePipeline(SimulatePipelineRequest simulatePipelineRequest) throws IOException { - EndpointBuilder builder = new EndpointBuilder().addPathPartAsIs("_ingest/pipeline"); - if (simulatePipelineRequest.getId() != null && !simulatePipelineRequest.getId().isEmpty()) { - builder.addPathPart(simulatePipelineRequest.getId()); - } - builder.addPathPartAsIs("_simulate"); - String endpoint = builder.build(); - Request request = new Request(HttpPost.METHOD_NAME, endpoint); - Params params = new Params(request); - params.putParam("verbose", Boolean.toString(simulatePipelineRequest.isVerbose())); - request.setEntity(createEntity(simulatePipelineRequest, REQUEST_BODY_CONTENT_TYPE)); - return request; - } - static Request getAlias(GetAliasesRequest getAliasesRequest) { String[] indices = getAliasesRequest.indices() == null ? Strings.EMPTY_ARRAY : getAliasesRequest.indices(); String[] aliases = getAliasesRequest.aliases() == null ? Strings.EMPTY_ARRAY : getAliasesRequest.aliases(); diff --git a/client/rest-high-level/src/test/java/org/elasticsearch/client/ESRestHighLevelClientTestCase.java b/client/rest-high-level/src/test/java/org/elasticsearch/client/ESRestHighLevelClientTestCase.java index f1da9af4a1e72..9217b0b4e5550 100644 --- a/client/rest-high-level/src/test/java/org/elasticsearch/client/ESRestHighLevelClientTestCase.java +++ b/client/rest-high-level/src/test/java/org/elasticsearch/client/ESRestHighLevelClientTestCase.java @@ -130,7 +130,8 @@ protected static void createPipeline(String pipelineId) throws IOException { } protected static void createPipeline(PutPipelineRequest putPipelineRequest) throws IOException { - assertOK(client().performRequest(RequestConverters.putPipeline(putPipelineRequest))); + assertTrue(execute( + putPipelineRequest, highLevelClient().ingest()::putPipeline, highLevelClient().ingest()::putPipelineAsync).isAcknowledged()); } protected static void clusterUpdateSettings(Settings persistentSettings, diff --git a/client/rest-high-level/src/test/java/org/elasticsearch/client/IngestRequestConvertersTests.java b/client/rest-high-level/src/test/java/org/elasticsearch/client/IngestRequestConvertersTests.java new file mode 100644 index 0000000000000..a615757fa22a9 --- /dev/null +++ b/client/rest-high-level/src/test/java/org/elasticsearch/client/IngestRequestConvertersTests.java @@ -0,0 +1,120 @@ +/* + * Licensed to Elasticsearch under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.elasticsearch.client; + +import org.apache.http.client.methods.HttpDelete; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.client.methods.HttpPut; +import org.elasticsearch.action.ingest.DeletePipelineRequest; +import org.elasticsearch.action.ingest.GetPipelineRequest; +import org.elasticsearch.action.ingest.PutPipelineRequest; +import org.elasticsearch.action.ingest.SimulatePipelineRequest; +import org.elasticsearch.action.support.master.AcknowledgedRequest; +import org.elasticsearch.common.bytes.BytesArray; +import org.elasticsearch.common.xcontent.XContentType; +import org.elasticsearch.test.ESTestCase; +import org.junit.Assert; + +import java.io.IOException; +import java.nio.charset.StandardCharsets; +import java.util.HashMap; +import java.util.Map; +import java.util.StringJoiner; + +public class IngestRequestConvertersTests extends ESTestCase { + + public void testPutPipeline() throws IOException { + String pipelineId = "some_pipeline_id"; + PutPipelineRequest request = new PutPipelineRequest( + "some_pipeline_id", + new BytesArray("{}".getBytes(StandardCharsets.UTF_8)), + XContentType.JSON + ); + Map expectedParams = new HashMap<>(); + RequestConvertersTests.setRandomMasterTimeout(request, expectedParams); + RequestConvertersTests.setRandomTimeout(request::timeout, AcknowledgedRequest.DEFAULT_ACK_TIMEOUT, expectedParams); + + Request expectedRequest = IngestRequestConverters.putPipeline(request); + StringJoiner endpoint = new StringJoiner("/", "/", ""); + endpoint.add("_ingest/pipeline"); + endpoint.add(pipelineId); + Assert.assertEquals(endpoint.toString(), expectedRequest.getEndpoint()); + Assert.assertEquals(HttpPut.METHOD_NAME, expectedRequest.getMethod()); + Assert.assertEquals(expectedParams, expectedRequest.getParameters()); + } + + public void testGetPipeline() { + String pipelineId = "some_pipeline_id"; + Map expectedParams = new HashMap<>(); + GetPipelineRequest request = new GetPipelineRequest("some_pipeline_id"); + RequestConvertersTests.setRandomMasterTimeout(request, expectedParams); + Request expectedRequest = IngestRequestConverters.getPipeline(request); + StringJoiner endpoint = new StringJoiner("/", "/", ""); + endpoint.add("_ingest/pipeline"); + endpoint.add(pipelineId); + Assert.assertEquals(endpoint.toString(), expectedRequest.getEndpoint()); + Assert.assertEquals(HttpGet.METHOD_NAME, expectedRequest.getMethod()); + Assert.assertEquals(expectedParams, expectedRequest.getParameters()); + } + + public void testDeletePipeline() { + String pipelineId = "some_pipeline_id"; + Map expectedParams = new HashMap<>(); + DeletePipelineRequest request = new DeletePipelineRequest(pipelineId); + RequestConvertersTests.setRandomMasterTimeout(request, expectedParams); + RequestConvertersTests.setRandomTimeout(request::timeout, AcknowledgedRequest.DEFAULT_ACK_TIMEOUT, expectedParams); + Request expectedRequest = IngestRequestConverters.deletePipeline(request); + StringJoiner endpoint = new StringJoiner("/", "/", ""); + endpoint.add("_ingest/pipeline"); + endpoint.add(pipelineId); + Assert.assertEquals(endpoint.toString(), expectedRequest.getEndpoint()); + Assert.assertEquals(HttpDelete.METHOD_NAME, expectedRequest.getMethod()); + Assert.assertEquals(expectedParams, expectedRequest.getParameters()); + } + + public void testSimulatePipeline() throws IOException { + String pipelineId = ESTestCase.randomBoolean() ? "some_pipeline_id" : null; + boolean verbose = ESTestCase.randomBoolean(); + String json = "{\"pipeline\":{" + + "\"description\":\"_description\"," + + "\"processors\":[{\"set\":{\"field\":\"field2\",\"value\":\"_value\"}}]}," + + "\"docs\":[{\"_index\":\"index\",\"_type\":\"_doc\",\"_id\":\"id\",\"_source\":{\"foo\":\"rab\"}}]}"; + SimulatePipelineRequest request = new SimulatePipelineRequest( + new BytesArray(json.getBytes(StandardCharsets.UTF_8)), + XContentType.JSON + ); + request.setId(pipelineId); + request.setVerbose(verbose); + Map expectedParams = new HashMap<>(); + expectedParams.put("verbose", Boolean.toString(verbose)); + + Request expectedRequest = IngestRequestConverters.simulatePipeline(request); + StringJoiner endpoint = new StringJoiner("/", "/", ""); + endpoint.add("_ingest/pipeline"); + if (pipelineId != null && !pipelineId.isEmpty()) + endpoint.add(pipelineId); + endpoint.add("_simulate"); + Assert.assertEquals(endpoint.toString(), expectedRequest.getEndpoint()); + Assert.assertEquals(HttpPost.METHOD_NAME, expectedRequest.getMethod()); + Assert.assertEquals(expectedParams, expectedRequest.getParameters()); + RequestConvertersTests.assertToXContentBody(request, expectedRequest.getEntity()); + } +} diff --git a/client/rest-high-level/src/test/java/org/elasticsearch/client/RequestConvertersTests.java b/client/rest-high-level/src/test/java/org/elasticsearch/client/RequestConvertersTests.java index d346934ff03eb..f2a5877162369 100644 --- a/client/rest-high-level/src/test/java/org/elasticsearch/client/RequestConvertersTests.java +++ b/client/rest-high-level/src/test/java/org/elasticsearch/client/RequestConvertersTests.java @@ -65,10 +65,6 @@ import org.elasticsearch.action.get.GetRequest; import org.elasticsearch.action.get.MultiGetRequest; import org.elasticsearch.action.index.IndexRequest; -import org.elasticsearch.action.ingest.DeletePipelineRequest; -import org.elasticsearch.action.ingest.GetPipelineRequest; -import org.elasticsearch.action.ingest.PutPipelineRequest; -import org.elasticsearch.action.ingest.SimulatePipelineRequest; import org.elasticsearch.action.search.ClearScrollRequest; import org.elasticsearch.action.search.MultiSearchRequest; import org.elasticsearch.action.search.SearchRequest; @@ -136,7 +132,6 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; -import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; @@ -1811,83 +1806,6 @@ private static void resizeTest(ResizeType resizeType, CheckedFunction expectedParams = new HashMap<>(); - setRandomMasterTimeout(request, expectedParams); - setRandomTimeout(request::timeout, AcknowledgedRequest.DEFAULT_ACK_TIMEOUT, expectedParams); - - Request expectedRequest = RequestConverters.putPipeline(request); - StringJoiner endpoint = new StringJoiner("/", "/", ""); - endpoint.add("_ingest/pipeline"); - endpoint.add(pipelineId); - assertEquals(endpoint.toString(), expectedRequest.getEndpoint()); - assertEquals(HttpPut.METHOD_NAME, expectedRequest.getMethod()); - assertEquals(expectedParams, expectedRequest.getParameters()); - } - - public void testGetPipeline() { - String pipelineId = "some_pipeline_id"; - Map expectedParams = new HashMap<>(); - GetPipelineRequest request = new GetPipelineRequest("some_pipeline_id"); - setRandomMasterTimeout(request, expectedParams); - Request expectedRequest = RequestConverters.getPipeline(request); - StringJoiner endpoint = new StringJoiner("/", "/", ""); - endpoint.add("_ingest/pipeline"); - endpoint.add(pipelineId); - assertEquals(endpoint.toString(), expectedRequest.getEndpoint()); - assertEquals(HttpGet.METHOD_NAME, expectedRequest.getMethod()); - assertEquals(expectedParams, expectedRequest.getParameters()); - } - - public void testDeletePipeline() { - String pipelineId = "some_pipeline_id"; - Map expectedParams = new HashMap<>(); - DeletePipelineRequest request = new DeletePipelineRequest(pipelineId); - setRandomMasterTimeout(request, expectedParams); - setRandomTimeout(request::timeout, AcknowledgedRequest.DEFAULT_ACK_TIMEOUT, expectedParams); - Request expectedRequest = RequestConverters.deletePipeline(request); - StringJoiner endpoint = new StringJoiner("/", "/", ""); - endpoint.add("_ingest/pipeline"); - endpoint.add(pipelineId); - assertEquals(endpoint.toString(), expectedRequest.getEndpoint()); - assertEquals(HttpDelete.METHOD_NAME, expectedRequest.getMethod()); - assertEquals(expectedParams, expectedRequest.getParameters()); - } - - public void testSimulatePipeline() throws IOException { - String pipelineId = randomBoolean() ? "some_pipeline_id" : null; - boolean verbose = randomBoolean(); - String json = "{\"pipeline\":{" + - "\"description\":\"_description\"," + - "\"processors\":[{\"set\":{\"field\":\"field2\",\"value\":\"_value\"}}]}," + - "\"docs\":[{\"_index\":\"index\",\"_type\":\"_doc\",\"_id\":\"id\",\"_source\":{\"foo\":\"rab\"}}]}"; - SimulatePipelineRequest request = new SimulatePipelineRequest( - new BytesArray(json.getBytes(StandardCharsets.UTF_8)), - XContentType.JSON - ); - request.setId(pipelineId); - request.setVerbose(verbose); - Map expectedParams = new HashMap<>(); - expectedParams.put("verbose", Boolean.toString(verbose)); - - Request expectedRequest = RequestConverters.simulatePipeline(request); - StringJoiner endpoint = new StringJoiner("/", "/", ""); - endpoint.add("_ingest/pipeline"); - if (pipelineId != null && !pipelineId.isEmpty()) - endpoint.add(pipelineId); - endpoint.add("_simulate"); - assertEquals(endpoint.toString(), expectedRequest.getEndpoint()); - assertEquals(HttpPost.METHOD_NAME, expectedRequest.getMethod()); - assertEquals(expectedParams, expectedRequest.getParameters()); - assertToXContentBody(request, expectedRequest.getEntity()); - } - public void testRollover() throws IOException { RolloverRequest rolloverRequest = new RolloverRequest(randomAlphaOfLengthBetween(3, 10), randomBoolean() ? null : randomAlphaOfLengthBetween(3, 10));