@Test public void testInsertAll() throws Exception, IOException { // Build up a list of indices to fail on each invocation. This should result in // 5 calls to insertAll. List<List<Long>> errorsIndices = new ArrayList<>(); errorsIndices.add(Arrays.asList(0L, 5L, 10L, 15L, 20L)); errorsIndices.add(Arrays.asList(0L, 2L, 4L)); errorsIndices.add(Arrays.asList(0L, 2L)); errorsIndices.add(new ArrayList<Long>()); onInsertAll(errorsIndices); TableReference ref = BigQueryIO.parseTableSpec("project:dataset.table"); BigQueryTableInserter inserter = new BigQueryTableInserter(mockClient, 5); List<TableRow> rows = new ArrayList<>(); List<String> ids = new ArrayList<>(); for (int i = 0; i < 25; ++i) { rows.add(new TableRow()); ids.add(new String()); } try { inserter.insertAll(ref, rows, ids); } finally { verifyInsertAll(5); } }
/** Insert all rows from the given list. */ public void insertAll(List<TableRow> rowList) throws IOException { insertAll(rowList, null); }