com.google.bigtable.admin.table.v1.Table

Here are the examples of the java api class com.google.bigtable.admin.table.v1.Table taken from open source projects.

1. BigtableWriteIT#testE2EBigtableWrite()

Project: incubator-beam
File: BigtableWriteIT.java
@Test
public void testE2EBigtableWrite() throws Exception {
    final String tableName = bigtableOptions.getClusterName().toTableNameStr(tableId);
    final String clusterName = bigtableOptions.getClusterName().toString();
    final int numRows = 1000;
    final List<KV<ByteString, ByteString>> testData = generateTableData(numRows);
    createEmptyTable(clusterName, tableId);
    Pipeline p = Pipeline.create(options);
    p.apply(CountingInput.upTo(numRows)).apply(ParDo.of(new DoFn<Long, KV<ByteString, Iterable<Mutation>>>() {

        @Override
        public void processElement(ProcessContext c) {
            int index = c.element().intValue();
            Iterable<Mutation> mutations = ImmutableList.of(Mutation.newBuilder().setSetCell(Mutation.SetCell.newBuilder().setValue(testData.get(index).getValue()).setFamilyName(COLUMN_FAMILY_NAME)).build());
            c.output(KV.of(testData.get(index).getKey(), mutations));
        }
    })).apply(BigtableIO.write().withBigtableOptions(bigtableOptions).withTableId(tableId));
    p.run();
    // Test number of column families and column family name equality
    Table table = getTable(tableName);
    assertThat(table.getColumnFamilies().keySet(), Matchers.hasSize(1));
    assertThat(table.getColumnFamilies(), Matchers.hasKey(COLUMN_FAMILY_NAME));
    // Test table data equality
    List<KV<ByteString, ByteString>> tableData = getTableData(tableName);
    assertThat(tableData, Matchers.containsInAnyOrder(testData.toArray()));
}