forked from uber-go/cadence-client
/
Client.go
356 lines (296 loc) · 12.5 KB
/
Client.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
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
// Copyright (c) 2017 Uber 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 v1.0.0
package mocks
import (
"context"
"github.com/stretchr/testify/mock"
"go.uber.org/cadence/.gen/go/shared"
"go.uber.org/cadence/client"
"go.uber.org/cadence/encoded"
"go.uber.org/cadence/internal"
"go.uber.org/cadence/workflow"
)
// Client is an autogenerated mock type for the Client type
type Client struct {
mock.Mock
}
// CancelWorkflow provides a mock function with given fields: ctx, workflowID, runID
func (_m *Client) CancelWorkflow(ctx context.Context, workflowID string, runID string) error {
ret := _m.Called(ctx, workflowID, runID)
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, string, string) error); ok {
r0 = rf(ctx, workflowID, runID)
} else {
r0 = ret.Error(0)
}
return r0
}
// CompleteActivity provides a mock function with given fields: ctx, taskToken, result, err
func (_m *Client) CompleteActivity(ctx context.Context, taskToken []byte, result interface{}, err error) error {
ret := _m.Called(ctx, taskToken, result, err)
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, []byte, interface{}, error) error); ok {
r0 = rf(ctx, taskToken, result, err)
} else {
r0 = ret.Error(0)
}
return r0
}
// CompleteActivityByID provides a mock function with given fields: ctx, domain, workflowID, runID, activityID, result, err
func (_m *Client) CompleteActivityByID(ctx context.Context, domain string, workflowID string, runID string, activityID string, result interface{}, err error) error {
ret := _m.Called(ctx, domain, workflowID, runID, activityID, result, err)
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, string, string, string, string, interface{}, error) error); ok {
r0 = rf(ctx, domain, workflowID, runID, activityID, result, err)
} else {
r0 = ret.Error(0)
}
return r0
}
// DescribeTaskList provides a mock function with given fields: ctx, tasklist, tasklistType
func (_m *Client) DescribeTaskList(ctx context.Context, tasklist string, tasklistType shared.TaskListType) (*shared.DescribeTaskListResponse, error) {
ret := _m.Called(ctx, tasklist, tasklistType)
var r0 *shared.DescribeTaskListResponse
if rf, ok := ret.Get(0).(func(context.Context, string, shared.TaskListType) *shared.DescribeTaskListResponse); ok {
r0 = rf(ctx, tasklist, tasklistType)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*shared.DescribeTaskListResponse)
}
}
var r1 error
if rf, ok := ret.Get(1).(func(context.Context, string, shared.TaskListType) error); ok {
r1 = rf(ctx, tasklist, tasklistType)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// DescribeWorkflowExecution provides a mock function with given fields: ctx, workflowID, runID
func (_m *Client) DescribeWorkflowExecution(ctx context.Context, workflowID string, runID string) (*shared.DescribeWorkflowExecutionResponse, error) {
ret := _m.Called(ctx, workflowID, runID)
var r0 *shared.DescribeWorkflowExecutionResponse
if rf, ok := ret.Get(0).(func(context.Context, string, string) *shared.DescribeWorkflowExecutionResponse); ok {
r0 = rf(ctx, workflowID, runID)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*shared.DescribeWorkflowExecutionResponse)
}
}
var r1 error
if rf, ok := ret.Get(1).(func(context.Context, string, string) error); ok {
r1 = rf(ctx, workflowID, runID)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// ExecuteWorkflow provides a mock function with given fields: ctx, options, workflow, args
func (_m *Client) ExecuteWorkflow(ctx context.Context, options client.StartWorkflowOptions, workflow interface{}, args ...interface{}) (client.WorkflowRun, error) {
var _ca []interface{}
_ca = append(_ca, ctx, options, workflow)
_ca = append(_ca, args...)
ret := _m.Called(_ca...)
var r0 internal.WorkflowRun
if rf, ok := ret.Get(0).(func(context.Context, internal.StartWorkflowOptions, interface{}, ...interface{}) internal.WorkflowRun); ok {
r0 = rf(ctx, options, workflow, args...)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(internal.WorkflowRun)
}
}
var r1 error
if rf, ok := ret.Get(1).(func(context.Context, internal.StartWorkflowOptions, interface{}, ...interface{}) error); ok {
r1 = rf(ctx, options, workflow, args...)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// GetWorkflowHistory provides a mock function with given fields: ctx, workflowID, runID, isLongPoll, filterType
func (_m *Client) GetWorkflowHistory(ctx context.Context, workflowID string, runID string, isLongPoll bool, filterType shared.HistoryEventFilterType) client.HistoryEventIterator {
ret := _m.Called(ctx, workflowID, runID, isLongPoll, filterType)
var r0 internal.HistoryEventIterator
if rf, ok := ret.Get(0).(func(context.Context, string, string, bool, shared.HistoryEventFilterType) internal.HistoryEventIterator); ok {
r0 = rf(ctx, workflowID, runID, isLongPoll, filterType)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(internal.HistoryEventIterator)
}
}
return r0
}
// ListClosedWorkflow provides a mock function with given fields: ctx, request
func (_m *Client) ListClosedWorkflow(ctx context.Context, request *shared.ListClosedWorkflowExecutionsRequest) (*shared.ListClosedWorkflowExecutionsResponse, error) {
ret := _m.Called(ctx, request)
var r0 *shared.ListClosedWorkflowExecutionsResponse
if rf, ok := ret.Get(0).(func(context.Context, *shared.ListClosedWorkflowExecutionsRequest) *shared.ListClosedWorkflowExecutionsResponse); ok {
r0 = rf(ctx, request)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*shared.ListClosedWorkflowExecutionsResponse)
}
}
var r1 error
if rf, ok := ret.Get(1).(func(context.Context, *shared.ListClosedWorkflowExecutionsRequest) error); ok {
r1 = rf(ctx, request)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// ListOpenWorkflow provides a mock function with given fields: ctx, request
func (_m *Client) ListOpenWorkflow(ctx context.Context, request *shared.ListOpenWorkflowExecutionsRequest) (*shared.ListOpenWorkflowExecutionsResponse, error) {
ret := _m.Called(ctx, request)
var r0 *shared.ListOpenWorkflowExecutionsResponse
if rf, ok := ret.Get(0).(func(context.Context, *shared.ListOpenWorkflowExecutionsRequest) *shared.ListOpenWorkflowExecutionsResponse); ok {
r0 = rf(ctx, request)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*shared.ListOpenWorkflowExecutionsResponse)
}
}
var r1 error
if rf, ok := ret.Get(1).(func(context.Context, *shared.ListOpenWorkflowExecutionsRequest) error); ok {
r1 = rf(ctx, request)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// QueryWorkflow provides a mock function with given fields: ctx, workflowID, runID, queryType, args
func (_m *Client) QueryWorkflow(ctx context.Context, workflowID string, runID string, queryType string, args ...interface{}) (encoded.Value, error) {
var _ca []interface{}
_ca = append(_ca, ctx, workflowID, runID, queryType)
_ca = append(_ca, args...)
ret := _m.Called(_ca...)
var r0 encoded.Value
if rf, ok := ret.Get(0).(func(context.Context, string, string, string, ...interface{}) encoded.Value); ok {
r0 = rf(ctx, workflowID, runID, queryType, args...)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(encoded.Value)
}
}
var r1 error
if rf, ok := ret.Get(1).(func(context.Context, string, string, string, ...interface{}) error); ok {
r1 = rf(ctx, workflowID, runID, queryType, args...)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// RecordActivityHeartbeat provides a mock function with given fields: ctx, taskToken, details
func (_m *Client) RecordActivityHeartbeat(ctx context.Context, taskToken []byte, details ...interface{}) error {
var _ca []interface{}
_ca = append(_ca, ctx, taskToken)
_ca = append(_ca, details...)
ret := _m.Called(_ca...)
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, []byte, ...interface{}) error); ok {
r0 = rf(ctx, taskToken, details...)
} else {
r0 = ret.Error(0)
}
return r0
}
// RecordActivityHeartbeatByID provides a mock function with given fields: ctx, domain, workflowID, runID, activityID, details
func (_m *Client) RecordActivityHeartbeatByID(ctx context.Context, domain, workflowID, runID, activityID string, details ...interface{}) error {
var _ca []interface{}
_ca = append(_ca, ctx, domain, workflowID, runID, activityID)
_ca = append(_ca, details...)
ret := _m.Called(_ca...)
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, string, string, string, string, ...interface{}) error); ok {
r0 = rf(ctx, domain, workflowID, runID, activityID, details...)
} else {
r0 = ret.Error(0)
}
return r0
}
// SignalWorkflow provides a mock function with given fields: ctx, workflowID, runID, signalName, arg
func (_m *Client) SignalWorkflow(ctx context.Context, workflowID string, runID string, signalName string, arg interface{}) error {
ret := _m.Called(ctx, workflowID, runID, signalName, arg)
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, string, string, string, interface{}) error); ok {
r0 = rf(ctx, workflowID, runID, signalName, arg)
} else {
r0 = ret.Error(0)
}
return r0
}
// SignalWithStartWorkflow provides a mock function with given fields: ctx, options, workflow, args
func (_m *Client) SignalWithStartWorkflow(ctx context.Context,
workflowID string, signalName string, signalArg interface{},
options client.StartWorkflowOptions, workflow interface{}, workflowArgs ...interface{}) (*workflow.Execution, error) {
var _ca []interface{}
_ca = append(_ca, ctx, workflowID, signalName, signalArg, options, workflow)
_ca = append(_ca, workflowArgs...)
ret := _m.Called(_ca...)
var r0 *internal.WorkflowExecution
if rf, ok := ret.Get(0).(func(context.Context, string, string, interface{}, internal.StartWorkflowOptions, interface{}, ...interface{}) *internal.WorkflowExecution); ok {
r0 = rf(ctx, workflowID, signalName, signalArg, options, workflow, workflowArgs...)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*internal.WorkflowExecution)
}
}
var r1 error
if rf, ok := ret.Get(1).(func(context.Context, string, string, interface{}, internal.StartWorkflowOptions, interface{}, ...interface{}) error); ok {
r1 = rf(ctx, workflowID, signalName, signalArg, options, workflow, workflowArgs...)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// StartWorkflow provides a mock function with given fields: ctx, options, workflow, args
func (_m *Client) StartWorkflow(ctx context.Context, options client.StartWorkflowOptions, workflow interface{}, args ...interface{}) (*workflow.Execution, error) {
var _ca []interface{}
_ca = append(_ca, ctx, options, workflow)
_ca = append(_ca, args...)
ret := _m.Called(_ca...)
var r0 *internal.WorkflowExecution
if rf, ok := ret.Get(0).(func(context.Context, internal.StartWorkflowOptions, interface{}, ...interface{}) *internal.WorkflowExecution); ok {
r0 = rf(ctx, options, workflow, args...)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*internal.WorkflowExecution)
}
}
var r1 error
if rf, ok := ret.Get(1).(func(context.Context, internal.StartWorkflowOptions, interface{}, ...interface{}) error); ok {
r1 = rf(ctx, options, workflow, args...)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// TerminateWorkflow provides a mock function with given fields: ctx, workflowID, runID, reason, details
func (_m *Client) TerminateWorkflow(ctx context.Context, workflowID string, runID string, reason string, details []byte) error {
ret := _m.Called(ctx, workflowID, runID, reason, details)
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, string, string, string, []byte) error); ok {
r0 = rf(ctx, workflowID, runID, reason, details)
} else {
r0 = ret.Error(0)
}
return r0
}