use of org.elasticsearch.test.client.NoOpClient in project elasticsearch by elastic.
the class IndexRequestBuilderTests method setUp.
@Override
@Before
public void setUp() throws Exception {
super.setUp();
this.testClient = new NoOpClient(getTestName());
}
use of org.elasticsearch.test.client.NoOpClient in project elasticsearch by elastic.
the class ParentTaskAssigningClientTests method testSetsParentId.
public void testSetsParentId() {
TaskId[] parentTaskId = new TaskId[] { new TaskId(randomAsciiOfLength(3), randomLong()) };
// This mock will do nothing but verify that parentTaskId is set on all requests sent to it.
NoOpClient mock = new NoOpClient(getTestName()) {
@Override
protected <Request extends ActionRequest, Response extends ActionResponse, RequestBuilder extends ActionRequestBuilder<Request, Response, RequestBuilder>> void doExecute(Action<Request, Response, RequestBuilder> action, Request request, ActionListener<Response> listener) {
assertEquals(parentTaskId[0], request.getParentTask());
super.doExecute(action, request, listener);
}
};
try (ParentTaskAssigningClient client = new ParentTaskAssigningClient(mock, parentTaskId[0])) {
// All of these should have the parentTaskId set
client.bulk(new BulkRequest());
client.search(new SearchRequest());
client.clearScroll(new ClearScrollRequest());
// Now lets verify that unwrapped calls don't have the parentTaskId set
parentTaskId[0] = TaskId.EMPTY_TASK_ID;
client.unwrap().bulk(new BulkRequest());
client.unwrap().search(new SearchRequest());
client.unwrap().clearScroll(new ClearScrollRequest());
}
}
use of org.elasticsearch.test.client.NoOpClient in project elasticsearch by elastic.
the class CreateIndexRequestBuilderTests method setUp.
@Override
@Before
public void setUp() throws Exception {
super.setUp();
this.testClient = new NoOpClient(getTestName());
}
Aggregations