forked from cloudfoundry/cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fake_config.go
552 lines (503 loc) · 15.8 KB
/
fake_config.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
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
// Code generated by counterfeiter. DO NOT EDIT.
package pluginactionfakes
import (
"sync"
"code.cloudfoundry.org/cli/actor/pluginaction"
"code.cloudfoundry.org/cli/util/configv3"
)
type FakeConfig struct {
AddPluginStub func(configv3.Plugin)
addPluginMutex sync.RWMutex
addPluginArgsForCall []struct {
arg1 configv3.Plugin
}
AddPluginRepositoryStub func(string, string)
addPluginRepositoryMutex sync.RWMutex
addPluginRepositoryArgsForCall []struct {
arg1 string
arg2 string
}
BinaryVersionStub func() string
binaryVersionMutex sync.RWMutex
binaryVersionArgsForCall []struct {
}
binaryVersionReturns struct {
result1 string
}
binaryVersionReturnsOnCall map[int]struct {
result1 string
}
GetPluginStub func(string) (configv3.Plugin, bool)
getPluginMutex sync.RWMutex
getPluginArgsForCall []struct {
arg1 string
}
getPluginReturns struct {
result1 configv3.Plugin
result2 bool
}
getPluginReturnsOnCall map[int]struct {
result1 configv3.Plugin
result2 bool
}
PluginHomeStub func() string
pluginHomeMutex sync.RWMutex
pluginHomeArgsForCall []struct {
}
pluginHomeReturns struct {
result1 string
}
pluginHomeReturnsOnCall map[int]struct {
result1 string
}
PluginRepositoriesStub func() []configv3.PluginRepository
pluginRepositoriesMutex sync.RWMutex
pluginRepositoriesArgsForCall []struct {
}
pluginRepositoriesReturns struct {
result1 []configv3.PluginRepository
}
pluginRepositoriesReturnsOnCall map[int]struct {
result1 []configv3.PluginRepository
}
PluginsStub func() []configv3.Plugin
pluginsMutex sync.RWMutex
pluginsArgsForCall []struct {
}
pluginsReturns struct {
result1 []configv3.Plugin
}
pluginsReturnsOnCall map[int]struct {
result1 []configv3.Plugin
}
RemovePluginStub func(string)
removePluginMutex sync.RWMutex
removePluginArgsForCall []struct {
arg1 string
}
WritePluginConfigStub func() error
writePluginConfigMutex sync.RWMutex
writePluginConfigArgsForCall []struct {
}
writePluginConfigReturns struct {
result1 error
}
writePluginConfigReturnsOnCall map[int]struct {
result1 error
}
invocations map[string][][]interface{}
invocationsMutex sync.RWMutex
}
func (fake *FakeConfig) AddPlugin(arg1 configv3.Plugin) {
fake.addPluginMutex.Lock()
fake.addPluginArgsForCall = append(fake.addPluginArgsForCall, struct {
arg1 configv3.Plugin
}{arg1})
fake.recordInvocation("AddPlugin", []interface{}{arg1})
fake.addPluginMutex.Unlock()
if fake.AddPluginStub != nil {
fake.AddPluginStub(arg1)
}
}
func (fake *FakeConfig) AddPluginCallCount() int {
fake.addPluginMutex.RLock()
defer fake.addPluginMutex.RUnlock()
return len(fake.addPluginArgsForCall)
}
func (fake *FakeConfig) AddPluginCalls(stub func(configv3.Plugin)) {
fake.addPluginMutex.Lock()
defer fake.addPluginMutex.Unlock()
fake.AddPluginStub = stub
}
func (fake *FakeConfig) AddPluginArgsForCall(i int) configv3.Plugin {
fake.addPluginMutex.RLock()
defer fake.addPluginMutex.RUnlock()
argsForCall := fake.addPluginArgsForCall[i]
return argsForCall.arg1
}
func (fake *FakeConfig) AddPluginRepository(arg1 string, arg2 string) {
fake.addPluginRepositoryMutex.Lock()
fake.addPluginRepositoryArgsForCall = append(fake.addPluginRepositoryArgsForCall, struct {
arg1 string
arg2 string
}{arg1, arg2})
fake.recordInvocation("AddPluginRepository", []interface{}{arg1, arg2})
fake.addPluginRepositoryMutex.Unlock()
if fake.AddPluginRepositoryStub != nil {
fake.AddPluginRepositoryStub(arg1, arg2)
}
}
func (fake *FakeConfig) AddPluginRepositoryCallCount() int {
fake.addPluginRepositoryMutex.RLock()
defer fake.addPluginRepositoryMutex.RUnlock()
return len(fake.addPluginRepositoryArgsForCall)
}
func (fake *FakeConfig) AddPluginRepositoryCalls(stub func(string, string)) {
fake.addPluginRepositoryMutex.Lock()
defer fake.addPluginRepositoryMutex.Unlock()
fake.AddPluginRepositoryStub = stub
}
func (fake *FakeConfig) AddPluginRepositoryArgsForCall(i int) (string, string) {
fake.addPluginRepositoryMutex.RLock()
defer fake.addPluginRepositoryMutex.RUnlock()
argsForCall := fake.addPluginRepositoryArgsForCall[i]
return argsForCall.arg1, argsForCall.arg2
}
func (fake *FakeConfig) BinaryVersion() string {
fake.binaryVersionMutex.Lock()
ret, specificReturn := fake.binaryVersionReturnsOnCall[len(fake.binaryVersionArgsForCall)]
fake.binaryVersionArgsForCall = append(fake.binaryVersionArgsForCall, struct {
}{})
fake.recordInvocation("BinaryVersion", []interface{}{})
fake.binaryVersionMutex.Unlock()
if fake.BinaryVersionStub != nil {
return fake.BinaryVersionStub()
}
if specificReturn {
return ret.result1
}
fakeReturns := fake.binaryVersionReturns
return fakeReturns.result1
}
func (fake *FakeConfig) BinaryVersionCallCount() int {
fake.binaryVersionMutex.RLock()
defer fake.binaryVersionMutex.RUnlock()
return len(fake.binaryVersionArgsForCall)
}
func (fake *FakeConfig) BinaryVersionCalls(stub func() string) {
fake.binaryVersionMutex.Lock()
defer fake.binaryVersionMutex.Unlock()
fake.BinaryVersionStub = stub
}
func (fake *FakeConfig) BinaryVersionReturns(result1 string) {
fake.binaryVersionMutex.Lock()
defer fake.binaryVersionMutex.Unlock()
fake.BinaryVersionStub = nil
fake.binaryVersionReturns = struct {
result1 string
}{result1}
}
func (fake *FakeConfig) BinaryVersionReturnsOnCall(i int, result1 string) {
fake.binaryVersionMutex.Lock()
defer fake.binaryVersionMutex.Unlock()
fake.BinaryVersionStub = nil
if fake.binaryVersionReturnsOnCall == nil {
fake.binaryVersionReturnsOnCall = make(map[int]struct {
result1 string
})
}
fake.binaryVersionReturnsOnCall[i] = struct {
result1 string
}{result1}
}
func (fake *FakeConfig) GetPlugin(arg1 string) (configv3.Plugin, bool) {
fake.getPluginMutex.Lock()
ret, specificReturn := fake.getPluginReturnsOnCall[len(fake.getPluginArgsForCall)]
fake.getPluginArgsForCall = append(fake.getPluginArgsForCall, struct {
arg1 string
}{arg1})
fake.recordInvocation("GetPlugin", []interface{}{arg1})
fake.getPluginMutex.Unlock()
if fake.GetPluginStub != nil {
return fake.GetPluginStub(arg1)
}
if specificReturn {
return ret.result1, ret.result2
}
fakeReturns := fake.getPluginReturns
return fakeReturns.result1, fakeReturns.result2
}
func (fake *FakeConfig) GetPluginCallCount() int {
fake.getPluginMutex.RLock()
defer fake.getPluginMutex.RUnlock()
return len(fake.getPluginArgsForCall)
}
func (fake *FakeConfig) GetPluginCalls(stub func(string) (configv3.Plugin, bool)) {
fake.getPluginMutex.Lock()
defer fake.getPluginMutex.Unlock()
fake.GetPluginStub = stub
}
func (fake *FakeConfig) GetPluginArgsForCall(i int) string {
fake.getPluginMutex.RLock()
defer fake.getPluginMutex.RUnlock()
argsForCall := fake.getPluginArgsForCall[i]
return argsForCall.arg1
}
func (fake *FakeConfig) GetPluginReturns(result1 configv3.Plugin, result2 bool) {
fake.getPluginMutex.Lock()
defer fake.getPluginMutex.Unlock()
fake.GetPluginStub = nil
fake.getPluginReturns = struct {
result1 configv3.Plugin
result2 bool
}{result1, result2}
}
func (fake *FakeConfig) GetPluginReturnsOnCall(i int, result1 configv3.Plugin, result2 bool) {
fake.getPluginMutex.Lock()
defer fake.getPluginMutex.Unlock()
fake.GetPluginStub = nil
if fake.getPluginReturnsOnCall == nil {
fake.getPluginReturnsOnCall = make(map[int]struct {
result1 configv3.Plugin
result2 bool
})
}
fake.getPluginReturnsOnCall[i] = struct {
result1 configv3.Plugin
result2 bool
}{result1, result2}
}
func (fake *FakeConfig) PluginHome() string {
fake.pluginHomeMutex.Lock()
ret, specificReturn := fake.pluginHomeReturnsOnCall[len(fake.pluginHomeArgsForCall)]
fake.pluginHomeArgsForCall = append(fake.pluginHomeArgsForCall, struct {
}{})
fake.recordInvocation("PluginHome", []interface{}{})
fake.pluginHomeMutex.Unlock()
if fake.PluginHomeStub != nil {
return fake.PluginHomeStub()
}
if specificReturn {
return ret.result1
}
fakeReturns := fake.pluginHomeReturns
return fakeReturns.result1
}
func (fake *FakeConfig) PluginHomeCallCount() int {
fake.pluginHomeMutex.RLock()
defer fake.pluginHomeMutex.RUnlock()
return len(fake.pluginHomeArgsForCall)
}
func (fake *FakeConfig) PluginHomeCalls(stub func() string) {
fake.pluginHomeMutex.Lock()
defer fake.pluginHomeMutex.Unlock()
fake.PluginHomeStub = stub
}
func (fake *FakeConfig) PluginHomeReturns(result1 string) {
fake.pluginHomeMutex.Lock()
defer fake.pluginHomeMutex.Unlock()
fake.PluginHomeStub = nil
fake.pluginHomeReturns = struct {
result1 string
}{result1}
}
func (fake *FakeConfig) PluginHomeReturnsOnCall(i int, result1 string) {
fake.pluginHomeMutex.Lock()
defer fake.pluginHomeMutex.Unlock()
fake.PluginHomeStub = nil
if fake.pluginHomeReturnsOnCall == nil {
fake.pluginHomeReturnsOnCall = make(map[int]struct {
result1 string
})
}
fake.pluginHomeReturnsOnCall[i] = struct {
result1 string
}{result1}
}
func (fake *FakeConfig) PluginRepositories() []configv3.PluginRepository {
fake.pluginRepositoriesMutex.Lock()
ret, specificReturn := fake.pluginRepositoriesReturnsOnCall[len(fake.pluginRepositoriesArgsForCall)]
fake.pluginRepositoriesArgsForCall = append(fake.pluginRepositoriesArgsForCall, struct {
}{})
fake.recordInvocation("PluginRepositories", []interface{}{})
fake.pluginRepositoriesMutex.Unlock()
if fake.PluginRepositoriesStub != nil {
return fake.PluginRepositoriesStub()
}
if specificReturn {
return ret.result1
}
fakeReturns := fake.pluginRepositoriesReturns
return fakeReturns.result1
}
func (fake *FakeConfig) PluginRepositoriesCallCount() int {
fake.pluginRepositoriesMutex.RLock()
defer fake.pluginRepositoriesMutex.RUnlock()
return len(fake.pluginRepositoriesArgsForCall)
}
func (fake *FakeConfig) PluginRepositoriesCalls(stub func() []configv3.PluginRepository) {
fake.pluginRepositoriesMutex.Lock()
defer fake.pluginRepositoriesMutex.Unlock()
fake.PluginRepositoriesStub = stub
}
func (fake *FakeConfig) PluginRepositoriesReturns(result1 []configv3.PluginRepository) {
fake.pluginRepositoriesMutex.Lock()
defer fake.pluginRepositoriesMutex.Unlock()
fake.PluginRepositoriesStub = nil
fake.pluginRepositoriesReturns = struct {
result1 []configv3.PluginRepository
}{result1}
}
func (fake *FakeConfig) PluginRepositoriesReturnsOnCall(i int, result1 []configv3.PluginRepository) {
fake.pluginRepositoriesMutex.Lock()
defer fake.pluginRepositoriesMutex.Unlock()
fake.PluginRepositoriesStub = nil
if fake.pluginRepositoriesReturnsOnCall == nil {
fake.pluginRepositoriesReturnsOnCall = make(map[int]struct {
result1 []configv3.PluginRepository
})
}
fake.pluginRepositoriesReturnsOnCall[i] = struct {
result1 []configv3.PluginRepository
}{result1}
}
func (fake *FakeConfig) Plugins() []configv3.Plugin {
fake.pluginsMutex.Lock()
ret, specificReturn := fake.pluginsReturnsOnCall[len(fake.pluginsArgsForCall)]
fake.pluginsArgsForCall = append(fake.pluginsArgsForCall, struct {
}{})
fake.recordInvocation("Plugins", []interface{}{})
fake.pluginsMutex.Unlock()
if fake.PluginsStub != nil {
return fake.PluginsStub()
}
if specificReturn {
return ret.result1
}
fakeReturns := fake.pluginsReturns
return fakeReturns.result1
}
func (fake *FakeConfig) PluginsCallCount() int {
fake.pluginsMutex.RLock()
defer fake.pluginsMutex.RUnlock()
return len(fake.pluginsArgsForCall)
}
func (fake *FakeConfig) PluginsCalls(stub func() []configv3.Plugin) {
fake.pluginsMutex.Lock()
defer fake.pluginsMutex.Unlock()
fake.PluginsStub = stub
}
func (fake *FakeConfig) PluginsReturns(result1 []configv3.Plugin) {
fake.pluginsMutex.Lock()
defer fake.pluginsMutex.Unlock()
fake.PluginsStub = nil
fake.pluginsReturns = struct {
result1 []configv3.Plugin
}{result1}
}
func (fake *FakeConfig) PluginsReturnsOnCall(i int, result1 []configv3.Plugin) {
fake.pluginsMutex.Lock()
defer fake.pluginsMutex.Unlock()
fake.PluginsStub = nil
if fake.pluginsReturnsOnCall == nil {
fake.pluginsReturnsOnCall = make(map[int]struct {
result1 []configv3.Plugin
})
}
fake.pluginsReturnsOnCall[i] = struct {
result1 []configv3.Plugin
}{result1}
}
func (fake *FakeConfig) RemovePlugin(arg1 string) {
fake.removePluginMutex.Lock()
fake.removePluginArgsForCall = append(fake.removePluginArgsForCall, struct {
arg1 string
}{arg1})
fake.recordInvocation("RemovePlugin", []interface{}{arg1})
fake.removePluginMutex.Unlock()
if fake.RemovePluginStub != nil {
fake.RemovePluginStub(arg1)
}
}
func (fake *FakeConfig) RemovePluginCallCount() int {
fake.removePluginMutex.RLock()
defer fake.removePluginMutex.RUnlock()
return len(fake.removePluginArgsForCall)
}
func (fake *FakeConfig) RemovePluginCalls(stub func(string)) {
fake.removePluginMutex.Lock()
defer fake.removePluginMutex.Unlock()
fake.RemovePluginStub = stub
}
func (fake *FakeConfig) RemovePluginArgsForCall(i int) string {
fake.removePluginMutex.RLock()
defer fake.removePluginMutex.RUnlock()
argsForCall := fake.removePluginArgsForCall[i]
return argsForCall.arg1
}
func (fake *FakeConfig) WritePluginConfig() error {
fake.writePluginConfigMutex.Lock()
ret, specificReturn := fake.writePluginConfigReturnsOnCall[len(fake.writePluginConfigArgsForCall)]
fake.writePluginConfigArgsForCall = append(fake.writePluginConfigArgsForCall, struct {
}{})
fake.recordInvocation("WritePluginConfig", []interface{}{})
fake.writePluginConfigMutex.Unlock()
if fake.WritePluginConfigStub != nil {
return fake.WritePluginConfigStub()
}
if specificReturn {
return ret.result1
}
fakeReturns := fake.writePluginConfigReturns
return fakeReturns.result1
}
func (fake *FakeConfig) WritePluginConfigCallCount() int {
fake.writePluginConfigMutex.RLock()
defer fake.writePluginConfigMutex.RUnlock()
return len(fake.writePluginConfigArgsForCall)
}
func (fake *FakeConfig) WritePluginConfigCalls(stub func() error) {
fake.writePluginConfigMutex.Lock()
defer fake.writePluginConfigMutex.Unlock()
fake.WritePluginConfigStub = stub
}
func (fake *FakeConfig) WritePluginConfigReturns(result1 error) {
fake.writePluginConfigMutex.Lock()
defer fake.writePluginConfigMutex.Unlock()
fake.WritePluginConfigStub = nil
fake.writePluginConfigReturns = struct {
result1 error
}{result1}
}
func (fake *FakeConfig) WritePluginConfigReturnsOnCall(i int, result1 error) {
fake.writePluginConfigMutex.Lock()
defer fake.writePluginConfigMutex.Unlock()
fake.WritePluginConfigStub = nil
if fake.writePluginConfigReturnsOnCall == nil {
fake.writePluginConfigReturnsOnCall = make(map[int]struct {
result1 error
})
}
fake.writePluginConfigReturnsOnCall[i] = struct {
result1 error
}{result1}
}
func (fake *FakeConfig) Invocations() map[string][][]interface{} {
fake.invocationsMutex.RLock()
defer fake.invocationsMutex.RUnlock()
fake.addPluginMutex.RLock()
defer fake.addPluginMutex.RUnlock()
fake.addPluginRepositoryMutex.RLock()
defer fake.addPluginRepositoryMutex.RUnlock()
fake.binaryVersionMutex.RLock()
defer fake.binaryVersionMutex.RUnlock()
fake.getPluginMutex.RLock()
defer fake.getPluginMutex.RUnlock()
fake.pluginHomeMutex.RLock()
defer fake.pluginHomeMutex.RUnlock()
fake.pluginRepositoriesMutex.RLock()
defer fake.pluginRepositoriesMutex.RUnlock()
fake.pluginsMutex.RLock()
defer fake.pluginsMutex.RUnlock()
fake.removePluginMutex.RLock()
defer fake.removePluginMutex.RUnlock()
fake.writePluginConfigMutex.RLock()
defer fake.writePluginConfigMutex.RUnlock()
copiedInvocations := map[string][][]interface{}{}
for key, value := range fake.invocations {
copiedInvocations[key] = value
}
return copiedInvocations
}
func (fake *FakeConfig) 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 _ pluginaction.Config = new(FakeConfig)