Search in sources :

Example 1 with MainRequest

use of org.opensearch.action.main.MainRequest in project OpenSearch by opensearch-project.

the class CustomRestHighLevelClientTests method testCustomEndpointAsync.

public void testCustomEndpointAsync() throws Exception {
    final MainRequest request = new MainRequest();
    String nodeName = randomAlphaOfLengthBetween(1, 10);
    PlainActionFuture<MainResponse> future = PlainActionFuture.newFuture();
    restHighLevelClient.customAsync(request, optionsForNodeName(nodeName), future);
    assertEquals(nodeName, future.get().getNodeName());
    future = PlainActionFuture.newFuture();
    restHighLevelClient.customAndParseAsync(request, optionsForNodeName(nodeName), future);
    assertEquals(nodeName, future.get().getNodeName());
}
Also used : MainRequest(org.opensearch.action.main.MainRequest) MainResponse(org.opensearch.action.main.MainResponse)

Example 2 with MainRequest

use of org.opensearch.action.main.MainRequest in project OpenSearch by opensearch-project.

the class CustomRestHighLevelClientTests method testCustomEndpoint.

public void testCustomEndpoint() throws IOException {
    final MainRequest request = new MainRequest();
    String nodeName = randomAlphaOfLengthBetween(1, 10);
    MainResponse response = restHighLevelClient.custom(request, optionsForNodeName(nodeName));
    assertEquals(nodeName, response.getNodeName());
    response = restHighLevelClient.customAndParse(request, optionsForNodeName(nodeName));
    assertEquals(nodeName, response.getNodeName());
}
Also used : MainRequest(org.opensearch.action.main.MainRequest) MainResponse(org.opensearch.action.main.MainResponse)

Aggregations

MainRequest (org.opensearch.action.main.MainRequest)2 MainResponse (org.opensearch.action.main.MainResponse)2