Search in sources :

Example 1 with MapBuilder

use of org.opensearch.common.collect.MapBuilder in project OpenSearch by opensearch-project.

the class RestTasksActionTests method testConsumesParameters.

public void testConsumesParameters() throws Exception {
    RestTasksAction action = new RestTasksAction(() -> DiscoveryNodes.EMPTY_NODES);
    FakeRestRequest fakeRestRequest = new FakeRestRequest.Builder(NamedXContentRegistry.EMPTY).withParams(MapBuilder.<String, String>newMapBuilder().put("parent_task_id", "the node:3").put("nodes", "node1,node2").put("actions", "*").map()).build();
    FakeRestChannel fakeRestChannel = new FakeRestChannel(fakeRestRequest, false, 1);
    try (NoOpNodeClient nodeClient = buildNodeClient()) {
        action.handleRequest(fakeRestRequest, fakeRestChannel, nodeClient);
    }
    assertThat(fakeRestChannel.errors().get(), is(0));
    assertThat(fakeRestChannel.responses().get(), is(1));
}
Also used : MapBuilder(org.opensearch.common.collect.MapBuilder) FakeRestRequest(org.opensearch.test.rest.FakeRestRequest) FakeRestChannel(org.opensearch.test.rest.FakeRestChannel) NoOpNodeClient(org.opensearch.test.client.NoOpNodeClient)

Aggregations

MapBuilder (org.opensearch.common.collect.MapBuilder)1 NoOpNodeClient (org.opensearch.test.client.NoOpNodeClient)1 FakeRestChannel (org.opensearch.test.rest.FakeRestChannel)1 FakeRestRequest (org.opensearch.test.rest.FakeRestRequest)1