-
Notifications
You must be signed in to change notification settings - Fork 787
/
TaskManager.go
307 lines (254 loc) · 10 KB
/
TaskManager.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
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
// Modifications Copyright (c) 2020 Uber Technologies Inc.
// Copyright (c) 2020 Temporal Technologies, Inc.
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
// Code generated by mockery v2.32.0. DO NOT EDIT.
package mocks
import (
context "context"
mock "github.com/stretchr/testify/mock"
persistence "github.com/uber/cadence/common/persistence"
)
// TaskManager is an autogenerated mock type for the TaskManager type
type TaskManager struct {
mock.Mock
}
// Close provides a mock function with given fields:
func (_m *TaskManager) Close() {
_m.Called()
}
// CompleteTask provides a mock function with given fields: ctx, request
func (_m *TaskManager) CompleteTask(ctx context.Context, request *persistence.CompleteTaskRequest) error {
ret := _m.Called(ctx, request)
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, *persistence.CompleteTaskRequest) error); ok {
r0 = rf(ctx, request)
} else {
r0 = ret.Error(0)
}
return r0
}
// CompleteTasksLessThan provides a mock function with given fields: ctx, request
func (_m *TaskManager) CompleteTasksLessThan(ctx context.Context, request *persistence.CompleteTasksLessThanRequest) (*persistence.CompleteTasksLessThanResponse, error) {
ret := _m.Called(ctx, request)
var r0 *persistence.CompleteTasksLessThanResponse
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *persistence.CompleteTasksLessThanRequest) (*persistence.CompleteTasksLessThanResponse, error)); ok {
return rf(ctx, request)
}
if rf, ok := ret.Get(0).(func(context.Context, *persistence.CompleteTasksLessThanRequest) *persistence.CompleteTasksLessThanResponse); ok {
r0 = rf(ctx, request)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*persistence.CompleteTasksLessThanResponse)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *persistence.CompleteTasksLessThanRequest) error); ok {
r1 = rf(ctx, request)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// CreateTasks provides a mock function with given fields: ctx, request
func (_m *TaskManager) CreateTasks(ctx context.Context, request *persistence.CreateTasksRequest) (*persistence.CreateTasksResponse, error) {
ret := _m.Called(ctx, request)
var r0 *persistence.CreateTasksResponse
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *persistence.CreateTasksRequest) (*persistence.CreateTasksResponse, error)); ok {
return rf(ctx, request)
}
if rf, ok := ret.Get(0).(func(context.Context, *persistence.CreateTasksRequest) *persistence.CreateTasksResponse); ok {
r0 = rf(ctx, request)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*persistence.CreateTasksResponse)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *persistence.CreateTasksRequest) error); ok {
r1 = rf(ctx, request)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// DeleteTaskList provides a mock function with given fields: ctx, request
func (_m *TaskManager) DeleteTaskList(ctx context.Context, request *persistence.DeleteTaskListRequest) error {
ret := _m.Called(ctx, request)
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, *persistence.DeleteTaskListRequest) error); ok {
r0 = rf(ctx, request)
} else {
r0 = ret.Error(0)
}
return r0
}
// GetName provides a mock function with given fields:
func (_m *TaskManager) GetName() string {
ret := _m.Called()
var r0 string
if rf, ok := ret.Get(0).(func() string); ok {
r0 = rf()
} else {
r0 = ret.Get(0).(string)
}
return r0
}
// GetOrphanTasks provides a mock function with given fields: ctx, request
func (_m *TaskManager) GetOrphanTasks(ctx context.Context, request *persistence.GetOrphanTasksRequest) (*persistence.GetOrphanTasksResponse, error) {
ret := _m.Called(ctx, request)
var r0 *persistence.GetOrphanTasksResponse
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *persistence.GetOrphanTasksRequest) (*persistence.GetOrphanTasksResponse, error)); ok {
return rf(ctx, request)
}
if rf, ok := ret.Get(0).(func(context.Context, *persistence.GetOrphanTasksRequest) *persistence.GetOrphanTasksResponse); ok {
r0 = rf(ctx, request)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*persistence.GetOrphanTasksResponse)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *persistence.GetOrphanTasksRequest) error); ok {
r1 = rf(ctx, request)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// GetTaskListSize provides a mock function with given fields: ctx, request
func (_m *TaskManager) GetTaskListSize(ctx context.Context, request *persistence.GetTaskListSizeRequest) (*persistence.GetTaskListSizeResponse, error) {
ret := _m.Called(ctx, request)
var r0 *persistence.GetTaskListSizeResponse
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *persistence.GetTaskListSizeRequest) (*persistence.GetTaskListSizeResponse, error)); ok {
return rf(ctx, request)
}
if rf, ok := ret.Get(0).(func(context.Context, *persistence.GetTaskListSizeRequest) *persistence.GetTaskListSizeResponse); ok {
r0 = rf(ctx, request)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*persistence.GetTaskListSizeResponse)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *persistence.GetTaskListSizeRequest) error); ok {
r1 = rf(ctx, request)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// GetTasks provides a mock function with given fields: ctx, request
func (_m *TaskManager) GetTasks(ctx context.Context, request *persistence.GetTasksRequest) (*persistence.GetTasksResponse, error) {
ret := _m.Called(ctx, request)
var r0 *persistence.GetTasksResponse
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *persistence.GetTasksRequest) (*persistence.GetTasksResponse, error)); ok {
return rf(ctx, request)
}
if rf, ok := ret.Get(0).(func(context.Context, *persistence.GetTasksRequest) *persistence.GetTasksResponse); ok {
r0 = rf(ctx, request)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*persistence.GetTasksResponse)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *persistence.GetTasksRequest) error); ok {
r1 = rf(ctx, request)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// LeaseTaskList provides a mock function with given fields: ctx, request
func (_m *TaskManager) LeaseTaskList(ctx context.Context, request *persistence.LeaseTaskListRequest) (*persistence.LeaseTaskListResponse, error) {
ret := _m.Called(ctx, request)
var r0 *persistence.LeaseTaskListResponse
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *persistence.LeaseTaskListRequest) (*persistence.LeaseTaskListResponse, error)); ok {
return rf(ctx, request)
}
if rf, ok := ret.Get(0).(func(context.Context, *persistence.LeaseTaskListRequest) *persistence.LeaseTaskListResponse); ok {
r0 = rf(ctx, request)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*persistence.LeaseTaskListResponse)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *persistence.LeaseTaskListRequest) error); ok {
r1 = rf(ctx, request)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// ListTaskList provides a mock function with given fields: ctx, request
func (_m *TaskManager) ListTaskList(ctx context.Context, request *persistence.ListTaskListRequest) (*persistence.ListTaskListResponse, error) {
ret := _m.Called(ctx, request)
var r0 *persistence.ListTaskListResponse
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *persistence.ListTaskListRequest) (*persistence.ListTaskListResponse, error)); ok {
return rf(ctx, request)
}
if rf, ok := ret.Get(0).(func(context.Context, *persistence.ListTaskListRequest) *persistence.ListTaskListResponse); ok {
r0 = rf(ctx, request)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*persistence.ListTaskListResponse)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *persistence.ListTaskListRequest) error); ok {
r1 = rf(ctx, request)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// UpdateTaskList provides a mock function with given fields: ctx, request
func (_m *TaskManager) UpdateTaskList(ctx context.Context, request *persistence.UpdateTaskListRequest) (*persistence.UpdateTaskListResponse, error) {
ret := _m.Called(ctx, request)
var r0 *persistence.UpdateTaskListResponse
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *persistence.UpdateTaskListRequest) (*persistence.UpdateTaskListResponse, error)); ok {
return rf(ctx, request)
}
if rf, ok := ret.Get(0).(func(context.Context, *persistence.UpdateTaskListRequest) *persistence.UpdateTaskListResponse); ok {
r0 = rf(ctx, request)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*persistence.UpdateTaskListResponse)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *persistence.UpdateTaskListRequest) error); ok {
r1 = rf(ctx, request)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// NewTaskManager creates a new instance of TaskManager. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// The first argument is typically a *testing.T value.
func NewTaskManager(t interface {
mock.TestingT
Cleanup(func())
}) *TaskManager {
mock := &TaskManager{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}