String entityTableName = "test";
byte[] startKey = "000".getBytes();
byte[] endKey = "111".getBytes();
int limit = 100;
int batch = 20;
ScanAction action = new ScanAction(readerMode, indexTableName, entityTableName,
startKey, endKey);
action.addEntityColumn("test", "f", "c", DataType.STRING, Bytes.toBytes(""));
action.addEntityColumn("test", "f", "c", DataType.STRING, Bytes.toBytes(""));
action.setBatch(batch);
action.setLimit(limit);
ScanActionProto proto = ProtobufUtil.convertScanAction(action);
action = (ScanAction) ProtobufUtil.convertScanAction(proto);
Assert.assertTrue(readerMode == action.getReaderMode());
Assert.assertTrue(indexTableName.equals(action.getIndexTableName()));
Assert.assertTrue(entityTableName.equals(action.getEntityTableName()));
Assert.assertTrue(Bytes.toString(action.getStartKey()).equals("000"));
Assert.assertTrue(Bytes.toString(action.getEndKey()).equals("111"));
Assert.assertTrue(action.getBatch() == batch);
Assert.assertTrue(action.getLimit() == limit);
Assert.assertTrue(action.getColumns().get(0).getFamilyName().equals("f")
&& action.getColumns().get(0).getColumnName().equals("c")
&& Bytes.toString(action.getColumns().get(0).getValue()).equals(""));
Assert.assertTrue(action.getColumns().get(1).getFamilyName().equals("f")
&& action.getColumns().get(1).getColumnName().equals("c")
&& Bytes.toString(action.getColumns().get(1).getValue()).equals(""));
}