예제 #1
0
 private CellScanner doCreateCellArray(final int itemsPerList) {
   Cell[] cells = new Cell[itemsPerList];
   for (int i = 0; i < itemsPerList; i++) {
     cells[i] = new TestCell(i);
   }
   return CellUtil.createCellScanner(cells);
 }
예제 #2
0
 /**
  * Was overflowing if 100k or so lists of cellscanners to return.
  *
  * @throws IOException
  */
 @Test
 public void testCreateCellScannerOverflow() throws IOException {
   consume(doCreateCellScanner(1, 1), 1 * 1);
   consume(doCreateCellScanner(3, 0), 3 * 0);
   consume(doCreateCellScanner(3, 3), 3 * 3);
   consume(doCreateCellScanner(0, 1), 0 * 1);
   // Do big number. See HBASE-11813 for why.
   final int hundredK = 100000;
   consume(doCreateCellScanner(hundredK, 0), hundredK * 0);
   consume(doCreateCellArray(1), 1);
   consume(doCreateCellArray(0), 0);
   consume(doCreateCellArray(3), 3);
   List<CellScannable> cells = new ArrayList<CellScannable>(hundredK);
   for (int i = 0; i < hundredK; i++) {
     cells.add(new TestCellScannable(1));
   }
   consume(CellUtil.createCellScanner(cells), hundredK * 1);
   NavigableMap<byte[], List<Cell>> m = new TreeMap<byte[], List<Cell>>(Bytes.BYTES_COMPARATOR);
   List<Cell> cellArray = new ArrayList<Cell>(hundredK);
   for (int i = 0; i < hundredK; i++) cellArray.add(new TestCell(i));
   m.put(new byte[] {'f'}, cellArray);
   consume(CellUtil.createCellScanner(m), hundredK * 1);
 }
예제 #3
0
 private CellScanner doCreateCellScanner(final int listsCount, final int itemsPerList)
     throws IOException {
   List<CellScannable> cells = new ArrayList<CellScannable>(listsCount);
   for (int i = 0; i < listsCount; i++) {
     CellScannable cs =
         new CellScannable() {
           @Override
           public CellScanner cellScanner() {
             return new TestCellScanner(itemsPerList);
           }
         };
     cells.add(cs);
   }
   return CellUtil.createCellScanner(cells);
 }