HBaseMetadata { public void createTableIndex(final long tableId, final IndexSchema indexSchema) { Verify.isValidId(tableId); checkNotNull(indexSchema, "The index schema is invalid"); final List<Put> puts = Lists.newArrayList(); final List<IndexSchema> indexDetailMap = ImmutableList.of(indexSchema); final TableSchema existingSchema = getSchema(tableId); final TableSchema updatedSchema = existingSchema.schemaCopy(); updatedSchema.addIndices(indexDetailMap); puts.add(putTableSchema(tableId, updatedSchema)); puts.add(putIndices(tableId, indexDetailMap)); performMutations(ImmutableList.<Delete>of(), puts); } @Inject  HBaseMetadata(final Provider<HTableInterface> provider); @Inject void setColumnFamily(final @Named(ConfigConstants.COLUMN_FAMILY) String columnFamily); long getTableId(final String tableName); Map<String, Long> getIndexIds(final long tableId); BiMap<String, Long> getColumnIds(final long tableId); TableSchema getSchema(final long tableId); void createTable(final String tableName, final TableSchema schema); void createTableIndex(final long tableId,
                                 final IndexSchema indexSchema); void deleteTableIndex(final long tableId, final String indexName); void deleteTable(String tableName); void renameExistingTable(final String oldTableName, final String newTableName); long getAutoInc(long tableId); long incrementAutoInc(long tableId, long amount); void setAutoInc(long tableId, long value); long getRowCount(long tableId); long incrementRowCount(long tableId, long amount); void truncateRowCount(long tableId);  }
@Test(expected = IllegalArgumentException.class) public void testCreateIndexInvalidTableId() { final long invalidTableId = -1; hbaseMetadata.createTableIndex(invalidTableId, getIndexEmpty("ignore")); }
@Test(expected = NullPointerException.class) public void testCreateIndexNullIndexName() { hbaseMetadata.createTableIndex(1, getIndexEmpty(null)); }
@Test(expected = IllegalArgumentException.class) public void testCreateIndexEmptyIndexName() { hbaseMetadata.createTableIndex(1, getIndexEmpty("")); }
@Test(expected = NullPointerException.class) public void testCreateIndexNullIndexSchema() { hbaseMetadata.createTableIndex(1, null); }