-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy paththrift-client_test.go
52 lines (45 loc) · 933 Bytes
/
thrift-client_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package hbase
import (
"github.com/golang/protobuf/proto"
"testing"
"time"
)
func TestNewConsumer(t *testing.T) {
addr := "192.168.10.51:9090"
maxConn := 10
idleTimeout := 60
pool := NewThriftPool(addr, maxConn, idleTimeout, Dial, Close)
putEntityHistoryArr := make([]*TPut, 0)
RowKey := "00000000001"
Qualifier := "a"
Timestamp := time.Now().Unix()
value := "36"
putEntityHistoryArr = append(putEntityHistoryArr,
&TPut{
Row: []byte(RowKey),
ColumnValues: []*TColumnValue{
{
Family: []byte("f"),
Qualifier: []byte(Qualifier),
Timestamp: proto.Int64(int64(Timestamp)),
Value: []byte(value),
},
}})
client, err := pool.Get()
if err != nil {
t.Fail()
return
}
table := "table"
err = client.Client.PutMultiple([]byte(table), putEntityHistoryArr)
if err != nil {
t.Fail()
return
}
err = pool.Put(client)
if err != nil {
t.Fail()
return
}
t.Fail()
}