-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmock_hbase.go
More file actions
307 lines (258 loc) · 11.2 KB
/
mock_hbase.go
File metadata and controls
307 lines (258 loc) · 11.2 KB
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
package hbase
import (
"github.com/stretchr/testify/mock"
)
// MockHbase is a mock implementation of the Hbase interface that is used only
// in the package-local unit tests.
type MockHbase struct {
mock.Mock
}
// NoErrorReturningFunc is a mock function
func (m *MockHbase) NoErrorReturningFunc() {}
// InvalidErrorReturningFunc is a mock function
func (m *MockHbase) InvalidErrorReturningFunc() (error, bool) {
return nil, false
}
// AtomicIncrement is a mock function
func (m *MockHbase) AtomicIncrement(tableName Text, row Text, column Text, value int64) (int64, error) {
args := m.Called(tableName, row, column, value)
return args.Get(0).(int64), args.Error(1)
}
// Compact is a mock function
func (m *MockHbase) Compact(tableNameOrRegionName Bytes) error {
args := m.Called(tableNameOrRegionName)
return args.Error(0)
}
// CreateTable is a mock function
func (m *MockHbase) CreateTable(tableName Text, columnFamilies []*ColumnDescriptor) error {
args := m.Called(tableName, columnFamilies)
return args.Error(0)
}
// DeleteAll is a mock function
func (m *MockHbase) DeleteAll(tableName Text, row Text, column Text, attributes map[string]Text) error {
args := m.Called(tableName, row, column, attributes)
return args.Error(0)
}
// DeleteAllRow is a mock function
func (m *MockHbase) DeleteAllRow(tableName Text, row Text, attributes map[string]Text) error {
args := m.Called(tableName, row, attributes)
return args.Error(0)
}
// DeleteAllRowTs is a mock function
func (m *MockHbase) DeleteAllRowTs(tableName Text, row Text, timestamp int64, attributes map[string]Text) error {
args := m.Called(tableName, row, timestamp, attributes)
return args.Error(0)
}
// DeleteAllTs is a mock function
func (m *MockHbase) DeleteAllTs(tableName Text, row Text, column Text, timestamp int64, attributes map[string]Text) error {
args := m.Called(tableName, row, column, timestamp, attributes)
return args.Error(0)
}
// DeleteTable is a mock function
func (m *MockHbase) DeleteTable(tableName Text) error {
args := m.Called(tableName)
return args.Error(0)
}
// DisableTable is a mock function
func (m *MockHbase) DisableTable(tableName Bytes) error {
args := m.Called(tableName)
return args.Error(0)
}
// EnableTable is a mock function
func (m *MockHbase) EnableTable(tableName Bytes) error {
args := m.Called(tableName)
return args.Error(0)
}
// Get is a mock function
func (m *MockHbase) Get(tableName Text, row Text, column Text, attributes map[string]Text) ([]*TCell, error) {
args := m.Called(tableName, row, column, attributes)
return args.Get(0).([]*TCell), args.Error(1)
}
// GetColumnDescriptors is a mock function
func (m *MockHbase) GetColumnDescriptors(tableName Text) (map[string]*ColumnDescriptor, error) {
args := m.Called(tableName)
return args.Get(0).(map[string]*ColumnDescriptor), args.Error(1)
}
// GetRegionInfo is a mock function
func (m *MockHbase) GetRegionInfo(row Text) (*TRegionInfo, error) {
args := m.Called(row)
return args.Get(0).(*TRegionInfo), args.Error(1)
}
// GetRow is a mock function
func (m *MockHbase) GetRow(tableName Text, row Text, attributes map[string]Text) ([]*TRowResult_, error) {
args := m.Called(tableName, row, attributes)
return args.Get(0).([]*TRowResult_), args.Error(1)
}
// GetRowOrBefore is a mock function
func (m *MockHbase) GetRowOrBefore(tableName Text, row Text, family Text) ([]*TCell, error) {
args := m.Called(tableName, row, family)
return args.Get(0).([]*TCell), args.Error(1)
}
// GetRowTs is a mock function
func (m *MockHbase) GetRowTs(tableName Text, row Text, timestamp int64, attributes map[string]Text) ([]*TRowResult_, error) {
args := m.Called(tableName, row, timestamp, attributes)
return args.Get(0).([]*TRowResult_), args.Error(1)
}
// GetRowWithColumns is a mock function
func (m *MockHbase) GetRowWithColumns(tableName Text, row Text, columns [][]byte, attributes map[string]Text) ([]*TRowResult_, error) {
args := m.Called(tableName, row, columns, attributes)
return args.Get(0).([]*TRowResult_), args.Error(1)
}
// GetRowWithColumnsTs is a mock function
func (m *MockHbase) GetRowWithColumnsTs(tableName Text, row Text, columns [][]byte, timestamp int64, attributes map[string]Text) ([]*TRowResult_, error) {
args := m.Called(tableName, row, columns, timestamp, attributes)
return args.Get(0).([]*TRowResult_), args.Error(1)
}
// GetRows is a mock function
func (m *MockHbase) GetRows(tableName Text, rows [][]byte, attributes map[string]Text) ([]*TRowResult_, error) {
args := m.Called(tableName, rows, attributes)
return args.Get(0).([]*TRowResult_), args.Error(1)
}
// GetRowsTs is a mock function
func (m *MockHbase) GetRowsTs(tableName Text, rows [][]byte, timestamp int64, attributes map[string]Text) ([]*TRowResult_, error) {
args := m.Called(tableName, rows, timestamp, attributes)
return args.Get(0).([]*TRowResult_), args.Error(1)
}
// GetRowsWithColumns is a mock function
func (m *MockHbase) GetRowsWithColumns(tableName Text, rows [][]byte, columns [][]byte, attributes map[string]Text) ([]*TRowResult_, error) {
args := m.Called(tableName, rows, columns, attributes)
return args.Get(0).([]*TRowResult_), args.Error(1)
}
// GetRowsWithColumnsTs is a mock function
func (m *MockHbase) GetRowsWithColumnsTs(tableName Text, rows [][]byte, columns [][]byte, timestamp int64, attributes map[string]Text) ([]*TRowResult_, error) {
args := m.Called(tableName, rows, columns, timestamp, attributes)
return args.Get(0).([]*TRowResult_), args.Error(1)
}
// GetTableNames is a mock function
func (m *MockHbase) GetTableNames() ([][]byte, error) {
args := m.Called()
return args.Get(0).([][]byte), args.Error(1)
}
// GetTableRegions is a mock function
func (m *MockHbase) GetTableRegions(tableName Text) ([]*TRegionInfo, error) {
args := m.Called(tableName)
return args.Get(0).([]*TRegionInfo), args.Error(1)
}
// GetVer is a mock function
func (m *MockHbase) GetVer(tableName Text, row Text, column Text, numVersions int32, attributes map[string]Text) ([]*TCell, error) {
args := m.Called(tableName, row, column, numVersions, attributes)
return args.Get(0).([]*TCell), args.Error(1)
}
// GetVerTs is a mock function
func (m *MockHbase) GetVerTs(tableName Text, row Text, column Text, timestamp int64, numVersions int32, attributes map[string]Text) ([]*TCell, error) {
args := m.Called(tableName, row, column, timestamp, numVersions, attributes)
return args.Get(0).([]*TCell), args.Error(1)
}
// Increment is a mock function
func (m *MockHbase) Increment(increment *TIncrement) error {
args := m.Called(increment)
return args.Error(0)
}
// IncrementRows is a mock function
func (m *MockHbase) IncrementRows(increments []*TIncrement) error {
args := m.Called(increments)
return args.Error(0)
}
// IsTableEnabled is a mock function
func (m *MockHbase) IsTableEnabled(tableName Bytes) (bool, error) {
args := m.Called(tableName)
return args.Bool(0), args.Error(1)
}
// MajorCompact is a mock function
func (m *MockHbase) MajorCompact(tableNameOrRegionName Bytes) error {
args := m.Called(tableNameOrRegionName)
return args.Error(0)
}
// MutateRow is a mock function
func (m *MockHbase) MutateRow(tableName Text, row Text, mutations []*Mutation, attributes map[string]Text) error {
args := m.Called(tableName, row, mutations, attributes)
return args.Error(0)
}
// MutateRowTs is a mock function
func (m *MockHbase) MutateRowTs(tableName Text, row Text, mutations []*Mutation, timestamp int64, attributes map[string]Text) error {
args := m.Called(tableName, row, mutations, timestamp, attributes)
return args.Error(0)
}
// MutateRows is a mock function
func (m *MockHbase) MutateRows(tableName Text, rowBatches []*BatchMutation, attributes map[string]Text) error {
args := m.Called(tableName, rowBatches, attributes)
return args.Error(0)
}
// MutateRowsTs is a mock function
func (m *MockHbase) MutateRowsTs(tableName Text, rowBatches []*BatchMutation, timestamp int64, attributes map[string]Text) error {
args := m.Called(tableName, rowBatches, timestamp, attributes)
return args.Error(0)
}
// ScannerClose is a mock function
func (m *MockHbase) ScannerClose(id ScannerID) error {
args := m.Called(id)
return args.Error(0)
}
// ScannerGet is a mock function
func (m *MockHbase) ScannerGet(id ScannerID) ([]*TRowResult_, error) {
args := m.Called(id)
return args.Get(0).([]*TRowResult_), args.Error(1)
}
// ScannerGetList is a mock function
func (m *MockHbase) ScannerGetList(id ScannerID, nbRows int32) ([]*TRowResult_, error) {
args := m.Called(id, nbRows)
return args.Get(0).([]*TRowResult_), args.Error(1)
}
// ScannerOpen is a mock function
func (m *MockHbase) ScannerOpen(tableName Text, startRow Text, columns [][]byte, attributes map[string]Text) (ScannerID, error) {
args := m.Called(tableName, startRow, columns, attributes)
return args.Get(0).(ScannerID), args.Error(1)
}
// ScannerOpenTs is a mock function
func (m *MockHbase) ScannerOpenTs(tableName Text, startRow Text, columns [][]byte, timestamp int64, attributes map[string]Text) (ScannerID, error) {
args := m.Called(tableName, startRow, columns, timestamp, attributes)
return args.Get(0).(ScannerID), args.Error(1)
}
// ScannerOpenWithPrefix is a mock function
func (m *MockHbase) ScannerOpenWithPrefix(tableName Text, startAndPrefix Text, columns [][]byte, attributes map[string]Text) (ScannerID, error) {
args := m.Called(tableName, startAndPrefix, columns, attributes)
return args.Get(0).(ScannerID), args.Error(1)
}
// ScannerOpenWithScan is a mock function
func (m *MockHbase) ScannerOpenWithScan(tableName Text, scan *TScan, attributes map[string]Text) (ScannerID, error) {
args := m.Called(tableName, scan, attributes)
return args.Get(0).(ScannerID), args.Error(1)
}
// ScannerOpenWithStop is a mock function
func (m *MockHbase) ScannerOpenWithStop(tableName Text, startRow Text, stopRow Text, columns [][]byte, attributes map[string]Text) (ScannerID, error) {
args := m.Called(tableName, startRow, stopRow, columns, attributes)
return args.Get(0).(ScannerID), args.Error(1)
}
// ScannerOpenWithStopTs is a mock function
func (m *MockHbase) ScannerOpenWithStopTs(tableName Text, startRow Text, stopRow Text, columns [][]byte, timestamp int64, attributes map[string]Text) (ScannerID, error) {
args := m.Called(tableName, startRow, stopRow, columns, timestamp, attributes)
return args.Get(0).(ScannerID), args.Error(1)
}
// Appends values to one or more columns within a single row.
//
// @return values of columns after the append operation.
//
// Parameters:
// - Append: The single append operation to apply
func (m *MockHbase) Append(append *TAppend) (r []*TCell, err error) {
args := m.Called(append)
return args.Get(0).([]*TCell), args.Error(1)
}
// Atomically checks if a row/family/qualifier value matches the expected
// value. If it does, it adds the corresponding mutation operation for put.
//
// @return true if the new put was executed, false otherwise
//
// Parameters:
// - TableName: name of table
// - Row: row key
// - Column: column name
// - Value: the expected value for the column parameter, if not
// provided the check is for the non-existence of the
// column in question
// - Mput: mutation for the put
// - Attributes: Mutation attributes
func (m *MockHbase) CheckAndPut(tableName Text, row Text, column Text, value Text, mput *Mutation, attributes map[string]Text) (r bool, err error) {
args := m.Called(tableName, row, column, value, mput, attributes)
return args.Bool(0), args.Error(1)
}