Package org.elasticsearch.action.bulk

Examples of org.elasticsearch.action.bulk.BulkItemResponse


        int failed = 0;

        BulkItemResponse[] items = response.getItems();
        for (int i = 0; i < items.length; i++) {

          BulkItemResponse item = items[i];

          if (item.isFailed()) {
            failed++;
          } else {
            succeeded++;

            if (_responseHandler != null) {
              _responseHandler.handle(item.getId(), item.getOpType());
            }
          }
        }

        end(succeeded, failed);
View Full Code Here


        int id = 0;
        BulkItemResponse.Failure failure = mock(BulkItemResponse.Failure.class);
        doReturn("mocked failure message").when(failure).getMessage();
        for (int i = 0; i < 3; ++i) {
            for (int j = 0; j < 3; ++j) {
                responseList.add(new BulkItemResponse(
                        id++,
                        "insert",
                        mock(ActionResponse.class)
                ));
            }
            for (int j = 0; j < 3; ++j) {
                responseList.add(new BulkItemResponse(
                        id++,
                        "insert",
                        failure
                        ));
            }
View Full Code Here

        int failed = 0;

        BulkItemResponse[] items = response.getItems();
        for (int i = 0; i < items.length; i++) {

          BulkItemResponse item = items[i];

          if (item.isFailed()) {
            failed++;
          } else {
            succeeded++;

            if (_responseHandler != null) {
              _responseHandler.handle(item.getId(), item.getOpType());
            }
          }
        }

        end(succeeded, failed);
View Full Code Here

    when(listenableActionFutureMocked.actionGet()).thenReturn(bulkResponseMocked);
    when(bulkResponseMocked.hasFailures()).thenReturn(true);

    Iterator<BulkItemResponse> iteratorMocked = mock(Iterator.class);
    when(bulkResponseMocked.iterator()).thenReturn(iteratorMocked);
    BulkItemResponse response1 = mock(BulkItemResponse.class);
    when(response1.isFailed()).thenReturn(true);
    when(iteratorMocked.hasNext()).thenReturn(true, false);
    when(iteratorMocked.next()).thenReturn(response1);

    // Action
    entityDao.executeBulkRequest(bulkRequestBuilderMocked);
View Full Code Here

                final BulkRequest req = (BulkRequest) invocation.getArguments()[0];
                rateLimiter.acquire(req.numberOfActions());

                BulkItemResponse[] responses = new BulkItemResponse[req.numberOfActions()];
                for (int i = 0; i < responses.length; ++i) {
                    BulkItemResponse response = mock(BulkItemResponse.class);
                    doReturn(false).when(response).isFailed();
                    responses[i] = response;
                }
                ActionFuture<BulkResponse> actionFuture = mock(ActionFuture.class);
                doReturn(new BulkResponse(responses,1000)).when(actionFuture).actionGet();
View Full Code Here

TOP

Related Classes of org.elasticsearch.action.bulk.BulkItemResponse

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.