forked from cloudfoundry/cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fake_push_actor.go
446 lines (410 loc) · 13.5 KB
/
fake_push_actor.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
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
// Code generated by counterfeiter. DO NOT EDIT.
package actorsfakes
import (
"os"
"sync"
"code.cloudfoundry.org/cli/cf/actors"
"code.cloudfoundry.org/cli/cf/api/resources"
"code.cloudfoundry.org/cli/cf/models"
)
type FakePushActor struct {
GatherFilesStub func([]models.AppFileFields, string, string, bool) ([]resources.AppFileResource, bool, error)
gatherFilesMutex sync.RWMutex
gatherFilesArgsForCall []struct {
arg1 []models.AppFileFields
arg2 string
arg3 string
arg4 bool
}
gatherFilesReturns struct {
result1 []resources.AppFileResource
result2 bool
result3 error
}
gatherFilesReturnsOnCall map[int]struct {
result1 []resources.AppFileResource
result2 bool
result3 error
}
MapManifestRouteStub func(string, models.Application, models.AppParams) error
mapManifestRouteMutex sync.RWMutex
mapManifestRouteArgsForCall []struct {
arg1 string
arg2 models.Application
arg3 models.AppParams
}
mapManifestRouteReturns struct {
result1 error
}
mapManifestRouteReturnsOnCall map[int]struct {
result1 error
}
ProcessPathStub func(string, func(string) error) error
processPathMutex sync.RWMutex
processPathArgsForCall []struct {
arg1 string
arg2 func(string) error
}
processPathReturns struct {
result1 error
}
processPathReturnsOnCall map[int]struct {
result1 error
}
UploadAppStub func(string, *os.File, []resources.AppFileResource) error
uploadAppMutex sync.RWMutex
uploadAppArgsForCall []struct {
arg1 string
arg2 *os.File
arg3 []resources.AppFileResource
}
uploadAppReturns struct {
result1 error
}
uploadAppReturnsOnCall map[int]struct {
result1 error
}
ValidateAppParamsStub func([]models.AppParams) []error
validateAppParamsMutex sync.RWMutex
validateAppParamsArgsForCall []struct {
arg1 []models.AppParams
}
validateAppParamsReturns struct {
result1 []error
}
validateAppParamsReturnsOnCall map[int]struct {
result1 []error
}
invocations map[string][][]interface{}
invocationsMutex sync.RWMutex
}
func (fake *FakePushActor) GatherFiles(arg1 []models.AppFileFields, arg2 string, arg3 string, arg4 bool) ([]resources.AppFileResource, bool, error) {
var arg1Copy []models.AppFileFields
if arg1 != nil {
arg1Copy = make([]models.AppFileFields, len(arg1))
copy(arg1Copy, arg1)
}
fake.gatherFilesMutex.Lock()
ret, specificReturn := fake.gatherFilesReturnsOnCall[len(fake.gatherFilesArgsForCall)]
fake.gatherFilesArgsForCall = append(fake.gatherFilesArgsForCall, struct {
arg1 []models.AppFileFields
arg2 string
arg3 string
arg4 bool
}{arg1Copy, arg2, arg3, arg4})
fake.recordInvocation("GatherFiles", []interface{}{arg1Copy, arg2, arg3, arg4})
fake.gatherFilesMutex.Unlock()
if fake.GatherFilesStub != nil {
return fake.GatherFilesStub(arg1, arg2, arg3, arg4)
}
if specificReturn {
return ret.result1, ret.result2, ret.result3
}
fakeReturns := fake.gatherFilesReturns
return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3
}
func (fake *FakePushActor) GatherFilesCallCount() int {
fake.gatherFilesMutex.RLock()
defer fake.gatherFilesMutex.RUnlock()
return len(fake.gatherFilesArgsForCall)
}
func (fake *FakePushActor) GatherFilesCalls(stub func([]models.AppFileFields, string, string, bool) ([]resources.AppFileResource, bool, error)) {
fake.gatherFilesMutex.Lock()
defer fake.gatherFilesMutex.Unlock()
fake.GatherFilesStub = stub
}
func (fake *FakePushActor) GatherFilesArgsForCall(i int) ([]models.AppFileFields, string, string, bool) {
fake.gatherFilesMutex.RLock()
defer fake.gatherFilesMutex.RUnlock()
argsForCall := fake.gatherFilesArgsForCall[i]
return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3, argsForCall.arg4
}
func (fake *FakePushActor) GatherFilesReturns(result1 []resources.AppFileResource, result2 bool, result3 error) {
fake.gatherFilesMutex.Lock()
defer fake.gatherFilesMutex.Unlock()
fake.GatherFilesStub = nil
fake.gatherFilesReturns = struct {
result1 []resources.AppFileResource
result2 bool
result3 error
}{result1, result2, result3}
}
func (fake *FakePushActor) GatherFilesReturnsOnCall(i int, result1 []resources.AppFileResource, result2 bool, result3 error) {
fake.gatherFilesMutex.Lock()
defer fake.gatherFilesMutex.Unlock()
fake.GatherFilesStub = nil
if fake.gatherFilesReturnsOnCall == nil {
fake.gatherFilesReturnsOnCall = make(map[int]struct {
result1 []resources.AppFileResource
result2 bool
result3 error
})
}
fake.gatherFilesReturnsOnCall[i] = struct {
result1 []resources.AppFileResource
result2 bool
result3 error
}{result1, result2, result3}
}
func (fake *FakePushActor) MapManifestRoute(arg1 string, arg2 models.Application, arg3 models.AppParams) error {
fake.mapManifestRouteMutex.Lock()
ret, specificReturn := fake.mapManifestRouteReturnsOnCall[len(fake.mapManifestRouteArgsForCall)]
fake.mapManifestRouteArgsForCall = append(fake.mapManifestRouteArgsForCall, struct {
arg1 string
arg2 models.Application
arg3 models.AppParams
}{arg1, arg2, arg3})
fake.recordInvocation("MapManifestRoute", []interface{}{arg1, arg2, arg3})
fake.mapManifestRouteMutex.Unlock()
if fake.MapManifestRouteStub != nil {
return fake.MapManifestRouteStub(arg1, arg2, arg3)
}
if specificReturn {
return ret.result1
}
fakeReturns := fake.mapManifestRouteReturns
return fakeReturns.result1
}
func (fake *FakePushActor) MapManifestRouteCallCount() int {
fake.mapManifestRouteMutex.RLock()
defer fake.mapManifestRouteMutex.RUnlock()
return len(fake.mapManifestRouteArgsForCall)
}
func (fake *FakePushActor) MapManifestRouteCalls(stub func(string, models.Application, models.AppParams) error) {
fake.mapManifestRouteMutex.Lock()
defer fake.mapManifestRouteMutex.Unlock()
fake.MapManifestRouteStub = stub
}
func (fake *FakePushActor) MapManifestRouteArgsForCall(i int) (string, models.Application, models.AppParams) {
fake.mapManifestRouteMutex.RLock()
defer fake.mapManifestRouteMutex.RUnlock()
argsForCall := fake.mapManifestRouteArgsForCall[i]
return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3
}
func (fake *FakePushActor) MapManifestRouteReturns(result1 error) {
fake.mapManifestRouteMutex.Lock()
defer fake.mapManifestRouteMutex.Unlock()
fake.MapManifestRouteStub = nil
fake.mapManifestRouteReturns = struct {
result1 error
}{result1}
}
func (fake *FakePushActor) MapManifestRouteReturnsOnCall(i int, result1 error) {
fake.mapManifestRouteMutex.Lock()
defer fake.mapManifestRouteMutex.Unlock()
fake.MapManifestRouteStub = nil
if fake.mapManifestRouteReturnsOnCall == nil {
fake.mapManifestRouteReturnsOnCall = make(map[int]struct {
result1 error
})
}
fake.mapManifestRouteReturnsOnCall[i] = struct {
result1 error
}{result1}
}
func (fake *FakePushActor) ProcessPath(arg1 string, arg2 func(string) error) error {
fake.processPathMutex.Lock()
ret, specificReturn := fake.processPathReturnsOnCall[len(fake.processPathArgsForCall)]
fake.processPathArgsForCall = append(fake.processPathArgsForCall, struct {
arg1 string
arg2 func(string) error
}{arg1, arg2})
fake.recordInvocation("ProcessPath", []interface{}{arg1, arg2})
fake.processPathMutex.Unlock()
if fake.ProcessPathStub != nil {
return fake.ProcessPathStub(arg1, arg2)
}
if specificReturn {
return ret.result1
}
fakeReturns := fake.processPathReturns
return fakeReturns.result1
}
func (fake *FakePushActor) ProcessPathCallCount() int {
fake.processPathMutex.RLock()
defer fake.processPathMutex.RUnlock()
return len(fake.processPathArgsForCall)
}
func (fake *FakePushActor) ProcessPathCalls(stub func(string, func(string) error) error) {
fake.processPathMutex.Lock()
defer fake.processPathMutex.Unlock()
fake.ProcessPathStub = stub
}
func (fake *FakePushActor) ProcessPathArgsForCall(i int) (string, func(string) error) {
fake.processPathMutex.RLock()
defer fake.processPathMutex.RUnlock()
argsForCall := fake.processPathArgsForCall[i]
return argsForCall.arg1, argsForCall.arg2
}
func (fake *FakePushActor) ProcessPathReturns(result1 error) {
fake.processPathMutex.Lock()
defer fake.processPathMutex.Unlock()
fake.ProcessPathStub = nil
fake.processPathReturns = struct {
result1 error
}{result1}
}
func (fake *FakePushActor) ProcessPathReturnsOnCall(i int, result1 error) {
fake.processPathMutex.Lock()
defer fake.processPathMutex.Unlock()
fake.ProcessPathStub = nil
if fake.processPathReturnsOnCall == nil {
fake.processPathReturnsOnCall = make(map[int]struct {
result1 error
})
}
fake.processPathReturnsOnCall[i] = struct {
result1 error
}{result1}
}
func (fake *FakePushActor) UploadApp(arg1 string, arg2 *os.File, arg3 []resources.AppFileResource) error {
var arg3Copy []resources.AppFileResource
if arg3 != nil {
arg3Copy = make([]resources.AppFileResource, len(arg3))
copy(arg3Copy, arg3)
}
fake.uploadAppMutex.Lock()
ret, specificReturn := fake.uploadAppReturnsOnCall[len(fake.uploadAppArgsForCall)]
fake.uploadAppArgsForCall = append(fake.uploadAppArgsForCall, struct {
arg1 string
arg2 *os.File
arg3 []resources.AppFileResource
}{arg1, arg2, arg3Copy})
fake.recordInvocation("UploadApp", []interface{}{arg1, arg2, arg3Copy})
fake.uploadAppMutex.Unlock()
if fake.UploadAppStub != nil {
return fake.UploadAppStub(arg1, arg2, arg3)
}
if specificReturn {
return ret.result1
}
fakeReturns := fake.uploadAppReturns
return fakeReturns.result1
}
func (fake *FakePushActor) UploadAppCallCount() int {
fake.uploadAppMutex.RLock()
defer fake.uploadAppMutex.RUnlock()
return len(fake.uploadAppArgsForCall)
}
func (fake *FakePushActor) UploadAppCalls(stub func(string, *os.File, []resources.AppFileResource) error) {
fake.uploadAppMutex.Lock()
defer fake.uploadAppMutex.Unlock()
fake.UploadAppStub = stub
}
func (fake *FakePushActor) UploadAppArgsForCall(i int) (string, *os.File, []resources.AppFileResource) {
fake.uploadAppMutex.RLock()
defer fake.uploadAppMutex.RUnlock()
argsForCall := fake.uploadAppArgsForCall[i]
return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3
}
func (fake *FakePushActor) UploadAppReturns(result1 error) {
fake.uploadAppMutex.Lock()
defer fake.uploadAppMutex.Unlock()
fake.UploadAppStub = nil
fake.uploadAppReturns = struct {
result1 error
}{result1}
}
func (fake *FakePushActor) UploadAppReturnsOnCall(i int, result1 error) {
fake.uploadAppMutex.Lock()
defer fake.uploadAppMutex.Unlock()
fake.UploadAppStub = nil
if fake.uploadAppReturnsOnCall == nil {
fake.uploadAppReturnsOnCall = make(map[int]struct {
result1 error
})
}
fake.uploadAppReturnsOnCall[i] = struct {
result1 error
}{result1}
}
func (fake *FakePushActor) ValidateAppParams(arg1 []models.AppParams) []error {
var arg1Copy []models.AppParams
if arg1 != nil {
arg1Copy = make([]models.AppParams, len(arg1))
copy(arg1Copy, arg1)
}
fake.validateAppParamsMutex.Lock()
ret, specificReturn := fake.validateAppParamsReturnsOnCall[len(fake.validateAppParamsArgsForCall)]
fake.validateAppParamsArgsForCall = append(fake.validateAppParamsArgsForCall, struct {
arg1 []models.AppParams
}{arg1Copy})
fake.recordInvocation("ValidateAppParams", []interface{}{arg1Copy})
fake.validateAppParamsMutex.Unlock()
if fake.ValidateAppParamsStub != nil {
return fake.ValidateAppParamsStub(arg1)
}
if specificReturn {
return ret.result1
}
fakeReturns := fake.validateAppParamsReturns
return fakeReturns.result1
}
func (fake *FakePushActor) ValidateAppParamsCallCount() int {
fake.validateAppParamsMutex.RLock()
defer fake.validateAppParamsMutex.RUnlock()
return len(fake.validateAppParamsArgsForCall)
}
func (fake *FakePushActor) ValidateAppParamsCalls(stub func([]models.AppParams) []error) {
fake.validateAppParamsMutex.Lock()
defer fake.validateAppParamsMutex.Unlock()
fake.ValidateAppParamsStub = stub
}
func (fake *FakePushActor) ValidateAppParamsArgsForCall(i int) []models.AppParams {
fake.validateAppParamsMutex.RLock()
defer fake.validateAppParamsMutex.RUnlock()
argsForCall := fake.validateAppParamsArgsForCall[i]
return argsForCall.arg1
}
func (fake *FakePushActor) ValidateAppParamsReturns(result1 []error) {
fake.validateAppParamsMutex.Lock()
defer fake.validateAppParamsMutex.Unlock()
fake.ValidateAppParamsStub = nil
fake.validateAppParamsReturns = struct {
result1 []error
}{result1}
}
func (fake *FakePushActor) ValidateAppParamsReturnsOnCall(i int, result1 []error) {
fake.validateAppParamsMutex.Lock()
defer fake.validateAppParamsMutex.Unlock()
fake.ValidateAppParamsStub = nil
if fake.validateAppParamsReturnsOnCall == nil {
fake.validateAppParamsReturnsOnCall = make(map[int]struct {
result1 []error
})
}
fake.validateAppParamsReturnsOnCall[i] = struct {
result1 []error
}{result1}
}
func (fake *FakePushActor) Invocations() map[string][][]interface{} {
fake.invocationsMutex.RLock()
defer fake.invocationsMutex.RUnlock()
fake.gatherFilesMutex.RLock()
defer fake.gatherFilesMutex.RUnlock()
fake.mapManifestRouteMutex.RLock()
defer fake.mapManifestRouteMutex.RUnlock()
fake.processPathMutex.RLock()
defer fake.processPathMutex.RUnlock()
fake.uploadAppMutex.RLock()
defer fake.uploadAppMutex.RUnlock()
fake.validateAppParamsMutex.RLock()
defer fake.validateAppParamsMutex.RUnlock()
copiedInvocations := map[string][][]interface{}{}
for key, value := range fake.invocations {
copiedInvocations[key] = value
}
return copiedInvocations
}
func (fake *FakePushActor) recordInvocation(key string, args []interface{}) {
fake.invocationsMutex.Lock()
defer fake.invocationsMutex.Unlock()
if fake.invocations == nil {
fake.invocations = map[string][][]interface{}{}
}
if fake.invocations[key] == nil {
fake.invocations[key] = [][]interface{}{}
}
fake.invocations[key] = append(fake.invocations[key], args)
}
var _ actors.PushActor = new(FakePushActor)