@Test public void requestBuilderTest() { RequestBuilder<MutateRowsRequest> builder = descriptor.getRequestBuilder(); MutateRowsRequest expected = createRequest(5); for (Entry entry : expected.getEntriesList()) { MutateRowsRequest singleReq = MutateRowsRequest.newBuilder() .setTableName(NameUtil.formatTableName(PROJECT_ID, INSTANCE_ID, TABLE_ID)) .addEntries(entry) .build(); builder.appendRequest(singleReq); } MutateRowsRequest actual = builder.build(); assertThat(actual).isEqualTo(expected); }
/** Merge the given batch into this batch. */ public void merge(Batch<RequestT, ResponseT> batch) { requestBuilder.appendRequest(batch.getRequest()); requestIssuerList.addAll(batch.requestIssuerList); if (this.callable == null) { this.callable = batch.callable; } this.byteCount += batch.byteCount; }
public RequestT getRequest() { return requestBuilder.build(); }
/** Merge the given batch into this batch. */ public void merge(Batch<RequestT, ResponseT> batch) { requestBuilder.appendRequest(batch.getRequest()); requestIssuerList.addAll(batch.requestIssuerList); if (this.callable == null) { this.callable = batch.callable; } this.byteCount += batch.byteCount; }
public RequestT getRequest() { return requestBuilder.build(); }
public Batch( BatchingDescriptor<RequestT, ResponseT> descriptor, RequestT request, UnaryCallable<RequestT, ResponseT> callable, BatchedFuture<ResponseT> batchedFuture) { this.requestBuilder = descriptor.getRequestBuilder(); this.requestIssuerList = new ArrayList<>(); this.requestBuilder.appendRequest(request); this.callable = callable; this.requestIssuerList.add( new BatchedRequestIssuer<>(batchedFuture, descriptor.countElements(request))); this.byteCount = descriptor.countBytes(request); }
public Batch( BatchingDescriptor<RequestT, ResponseT> descriptor, RequestT request, UnaryCallable<RequestT, ResponseT> callable, BatchedFuture<ResponseT> batchedFuture) { this.requestBuilder = descriptor.getRequestBuilder(); this.requestIssuerList = new ArrayList<>(); this.requestBuilder.appendRequest(request); this.callable = callable; this.requestIssuerList.add( new BatchedRequestIssuer<>(batchedFuture, descriptor.countElements(request))); this.byteCount = descriptor.countBytes(request); }