HBaseUtils { public static Map<String, HBaseSerde.ColumnDef> columnsFor(Config config) { Map<String, HBaseSerde.ColumnDef> columnDefs = Maps.newHashMap(); Config columns = config.getConfig(COLUMNS_PROPERTY); for (ConfigValue value : columns.root().values()) { Config column = value.atPath("c"); columnDefs.put(column.getString("c.col"), new HBaseSerde.ColumnDef(column.getString("c.cf"), column.getString("c.col"), column.getString("c.type"))); } return columnDefs; }  synchronized static Connection getConnection(Config config); static Configuration getHBaseConfiguration(Config config); static int batchSizeFor(Config config); static TableName tableInfoFor(Config config); static HBaseSerde getSerde(Config config); static byte[] rowKeySeparatorFor(Config config); static List<String> rowKeyFor(Config config); static Map<String, HBaseSerde.ColumnDef> columnsFor(Config config); static StructType buildSchema(Map<String, HBaseSerde.ColumnDef> columnDefinitions); static Scan mergeRangeScans(List<Scan> rangeScans); static byte[] exclusiveStopRow(byte[] startRow); static Validations getValidations(); static final String ZK_QUORUM_PROPERTY; static final String TABLE_NAME_PROPERTY; static final String ROWKEY_PROPERTY; static final String KEY_SEPARATOR; static final String COLUMNS_PROPERTY; static final String SERDE_PROPERTY; static final String HBASE_PASSTHRU_PREFIX; static final String HBASE_BATCH_SIZE; static final int DEFAULT_HBASE_BATCH_SIZE; static final String DEFAULT_SERDE_PROPERTY; static final String DEFAULT_KEY_SEPARATOR; }
@Test public void testColumnsFor() { Config goodConfig = ConfigUtils.configFromResource("/hbase/hbase-output.conf").getConfig("output"); Map<String, HBaseSerde.ColumnDef> columnDefs = HBaseUtils.columnsFor(goodConfig); assertEquals(6, columnDefs.size()); HBaseSerde.ColumnDef def = columnDefs.get("symbol"); assertEquals("rowkey", def.cf); assertEquals("symbol", def.name); assertEquals("string", def.type); def = columnDefs.get("transacttime"); assertEquals("rowkey", def.cf); assertEquals("transacttime", def.name); assertEquals("long", def.type); def = columnDefs.get("clordid"); assertEquals("cf1", def.cf); assertEquals("clordid", def.name); assertEquals("string", def.type); def = columnDefs.get("orderqty"); assertEquals("cf1", def.cf); assertEquals("orderqty", def.name); assertEquals("int", def.type); def = columnDefs.get("leavesqty"); assertEquals("cf1", def.cf); assertEquals("leavesqty", def.name); assertEquals("int", def.type); def = columnDefs.get("cumqty"); assertEquals("cf1", def.cf); assertEquals("cumqty", def.name); assertEquals("int", def.type); }