use of org.apache.hbase.thirdparty.com.google.protobuf.RpcController in project hbase by apache.
the class TestMultiLogThreshold method sendMultiRequest.
/**
* Sends a multi request with a certain amount of rows, will populate Multi command with either
* "rows" number of RegionActions with one Action each or one RegionAction with "rows" number of
* Actions
*/
private void sendMultiRequest(int rows, ActionType actionType) throws ServiceException, IOException {
RpcController rpcc = Mockito.mock(HBaseRpcController.class);
MultiRequest.Builder builder = MultiRequest.newBuilder();
int numRAs = 1;
int numAs = 1;
switch(actionType) {
case REGION_ACTIONS:
numRAs = rows;
break;
case ACTIONS:
numAs = rows;
break;
}
for (int i = 0; i < numRAs; i++) {
RegionAction.Builder rab = RegionAction.newBuilder();
rab.setRegion(RequestConverter.buildRegionSpecifier(HBaseProtos.RegionSpecifier.RegionSpecifierType.REGION_NAME, Bytes.toBytes("someStuff" + i)));
for (int j = 0; j < numAs; j++) {
Action.Builder ab = Action.newBuilder();
rab.addAction(ab.build());
}
builder.addRegionAction(rab.build());
}
services = new RSRpcServices(rs);
services.multi(rpcc, builder.build());
}
Aggregations