Exemplo n.º 1
0
  @Test
  public void addData() throws IOException {
    Map<String, String> basicMap = new HashMap<String, String>();
    basicMap.put("username", "Cherry");
    basicMap.put("realname", "李波");
    basicMap.put("sex", "男");
    basicMap.put("passowrd", "123456");

    Map<String, String> detailMap = new HashMap<String, String>();
    detailMap.put("nickname", "Cherry");
    detailMap.put("email", "*****@*****.**");
    detailMap.put("qq", "785028177");
    detailMap.put("mobilephone", "15261897347");
    detailMap.put("compney", "北京宽连十方南京分公司");

    boolean addData = HBaseUtils.addRecord(tableName, rowKey, "basic_info", basicMap);
    logger.info("addData=======basicMap ============" + addData);

    boolean addData2 = HBaseUtils.addRecord(tableName, rowKey, "detail_info", detailMap);
    logger.info("addData=======detailMap ============" + addData2);
  }
Exemplo n.º 2
0
 @Test
 public void getSingleResult() throws Exception {
   Result singleResult =
       HBaseUtils.getSingleResult(tableName, rowKey, new TimeRange(0, System.currentTimeMillis()));
   printResult(singleResult);
 }
Exemplo n.º 3
0
 @Test
 public void deleteAllColumn() {
   boolean deleteAllColumn = HBaseUtils.deleteAllColumn(tableName, Arrays.asList(rowKey));
   logger.info("deleteAllColumn===================" + deleteAllColumn);
 }
Exemplo n.º 4
0
 @Test
 public void creatTable() throws IOException {
   int creatTable =
       HBaseUtils.creatTable(tableName, Arrays.asList(new String[] {"basic_info", "detail_info"}));
   logger.info("creatTable===================" + (creatTable == 0));
 }
Exemplo n.º 5
0
 @Test
 public void isTableExist() throws IOException {
   boolean tableExist = HBaseUtils.isTableExist(tableName);
   logger.info("isTableExist===================" + tableExist);
 }