github.com/insionng/yougam@v0.0.0-20170714101924-2bc18d833463/libraries/pingcap/go-hbase/client_test.go (about)

     1  package hbase
     2  
     3  import . "github.com/insionng/yougam/libraries/pingcap/check"
     4  
     5  type ClientTestSuit struct {
     6  	cli HBaseClient
     7  }
     8  
     9  var _ = Suite(&ClientTestSuit{})
    10  
    11  func (s *ClientTestSuit) SetUpSuite(c *C) {
    12  }
    13  
    14  func (s *ClientTestSuit) TearDownSuite(c *C) {
    15  }
    16  
    17  func (s *ClientTestSuit) TestCreateRegionName(c *C) {
    18  	table := "t"
    19  	startKey := "key"
    20  	id := "1234"
    21  	newFormat := false
    22  	mockClient := &client{}
    23  
    24  	name := mockClient.createRegionName([]byte(table), []byte(startKey), id, newFormat)
    25  	c.Assert(string(name), Equals, "t,key,1234")
    26  
    27  	startKey = ""
    28  	name = mockClient.createRegionName([]byte(table), []byte(startKey), id, newFormat)
    29  	c.Assert(string(name), Equals, "t,\x00,1234")
    30  
    31  	newFormat = true
    32  	name = mockClient.createRegionName([]byte(table), []byte(startKey), id, newFormat)
    33  	c.Assert(string(name), Equals, "t,\x00,1234.0b33d053d09ba72744f058890ed449b2.")
    34  }