Class RestActionTestCase.VerifyingClient

java.lang.Object
org.elasticsearch.client.support.AbstractClient
org.elasticsearch.client.node.NodeClient
org.elasticsearch.test.client.NoOpNodeClient
org.elasticsearch.test.rest.RestActionTestCase.VerifyingClient
All Implemented Interfaces:
java.io.Closeable, java.lang.AutoCloseable, org.elasticsearch.client.Client, org.elasticsearch.client.ElasticsearchClient, org.elasticsearch.common.lease.Releasable
Enclosing class:
RestActionTestCase

public static class RestActionTestCase.VerifyingClient
extends NoOpNodeClient
A mocked NodeClient which can be easily reconfigured to verify arbitrary verification functions, and can be reset to allow reconfiguration partway through a test without having to construct a new object. By default, will throw AssertionError when any execution method is called, unless configured otherwise using setExecuteVerifier(java.util.function.BiConsumer<org.elasticsearch.action.ActionType<?>, org.elasticsearch.action.ActionRequest>) or setExecuteLocallyVerifier(java.util.function.BiFunction<org.elasticsearch.action.ActionType<?>, org.elasticsearch.action.ActionRequest, org.elasticsearch.action.ActionResponse>).
  • Field Summary

    Fields inherited from class org.elasticsearch.client.support.AbstractClient

    logger, settings

    Fields inherited from interface org.elasticsearch.client.Client

    CLIENT_TYPE_SETTING_S
  • Constructor Summary

    Constructors
    Constructor Description
    VerifyingClient​(java.lang.String testName)  
  • Method Summary

    Modifier and Type Method Description
    <Request extends org.elasticsearch.action.ActionRequest,​ Response extends org.elasticsearch.action.ActionResponse>
    void
    doExecute​(org.elasticsearch.action.ActionType<Response> action, Request request, org.elasticsearch.action.ActionListener<Response> listener)  
    <Request extends org.elasticsearch.action.ActionRequest,​ Response extends org.elasticsearch.action.ActionResponse>
    org.elasticsearch.tasks.Task
    executeLocally​(org.elasticsearch.action.ActionType<Response> action, Request request, org.elasticsearch.action.ActionListener<Response> listener)  
    <Request extends org.elasticsearch.action.ActionRequest,​ Response extends org.elasticsearch.action.ActionResponse>
    org.elasticsearch.tasks.Task
    executeLocally​(org.elasticsearch.action.ActionType<Response> action, Request request, org.elasticsearch.tasks.TaskListener<Response> listener)  
    java.lang.String getLocalNodeId()  
    void reset()
    void setExecuteLocallyVerifier​(java.util.function.BiFunction<org.elasticsearch.action.ActionType<?>,​org.elasticsearch.action.ActionRequest,​org.elasticsearch.action.ActionResponse> verifier)
    Sets the function that will be called when executeLocally(ActionType, ActionRequest, TaskListener)is called.
    void setExecuteVerifier​(java.util.function.BiConsumer<org.elasticsearch.action.ActionType<?>,​org.elasticsearch.action.ActionRequest> verifier)
    Sets the function that will be called when doExecute(ActionType, ActionRequest, ActionListener) is called.

    Methods inherited from class org.elasticsearch.test.client.NoOpNodeClient

    close, getRemoteClusterClient, initialize

    Methods inherited from class org.elasticsearch.client.node.NodeClient

    getNamedWriteableRegistry

    Methods inherited from class org.elasticsearch.client.support.AbstractClient

    admin, bulk, bulk, clearScroll, clearScroll, delete, delete, execute, execute, explain, explain, fieldCaps, fieldCaps, filterWithHeader, get, get, index, index, multiGet, multiGet, multiSearch, multiSearch, multiTermVectors, multiTermVectors, prepareBulk, prepareBulk, prepareClearScroll, prepareDelete, prepareDelete, prepareExplain, prepareFieldCaps, prepareGet, prepareGet, prepareIndex, prepareIndex, prepareIndex, prepareMultiGet, prepareMultiSearch, prepareMultiTermVectors, prepareSearch, prepareSearchScroll, prepareTermVectors, prepareTermVectors, prepareUpdate, prepareUpdate, search, search, searchScroll, searchScroll, settings, termVectors, termVectors, threadPool, update, update

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait