This repository has been archived by the owner on Jan 21, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
fake_config.go
403 lines (367 loc) · 11.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
// 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(repoName string, repoURL string)
addPluginRepositoryMutex sync.RWMutex
addPluginRepositoryArgsForCall []struct {
repoName string
repoURL string
}
GetPluginStub func(pluginName string) (configv3.Plugin, bool)
getPluginMutex sync.RWMutex
getPluginArgsForCall []struct {
pluginName 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) AddPluginArgsForCall(i int) configv3.Plugin {
fake.addPluginMutex.RLock()
defer fake.addPluginMutex.RUnlock()
return fake.addPluginArgsForCall[i].arg1
}
func (fake *FakeConfig) AddPluginRepository(repoName string, repoURL string) {
fake.addPluginRepositoryMutex.Lock()
fake.addPluginRepositoryArgsForCall = append(fake.addPluginRepositoryArgsForCall, struct {
repoName string
repoURL string
}{repoName, repoURL})
fake.recordInvocation("AddPluginRepository", []interface{}{repoName, repoURL})
fake.addPluginRepositoryMutex.Unlock()
if fake.AddPluginRepositoryStub != nil {
fake.AddPluginRepositoryStub(repoName, repoURL)
}
}
func (fake *FakeConfig) AddPluginRepositoryCallCount() int {
fake.addPluginRepositoryMutex.RLock()
defer fake.addPluginRepositoryMutex.RUnlock()
return len(fake.addPluginRepositoryArgsForCall)
}
func (fake *FakeConfig) AddPluginRepositoryArgsForCall(i int) (string, string) {
fake.addPluginRepositoryMutex.RLock()
defer fake.addPluginRepositoryMutex.RUnlock()
return fake.addPluginRepositoryArgsForCall[i].repoName, fake.addPluginRepositoryArgsForCall[i].repoURL
}
func (fake *FakeConfig) GetPlugin(pluginName string) (configv3.Plugin, bool) {
fake.getPluginMutex.Lock()
ret, specificReturn := fake.getPluginReturnsOnCall[len(fake.getPluginArgsForCall)]
fake.getPluginArgsForCall = append(fake.getPluginArgsForCall, struct {
pluginName string
}{pluginName})
fake.recordInvocation("GetPlugin", []interface{}{pluginName})
fake.getPluginMutex.Unlock()
if fake.GetPluginStub != nil {
return fake.GetPluginStub(pluginName)
}
if specificReturn {
return ret.result1, ret.result2
}
return fake.getPluginReturns.result1, fake.getPluginReturns.result2
}
func (fake *FakeConfig) GetPluginCallCount() int {
fake.getPluginMutex.RLock()
defer fake.getPluginMutex.RUnlock()
return len(fake.getPluginArgsForCall)
}
func (fake *FakeConfig) GetPluginArgsForCall(i int) string {
fake.getPluginMutex.RLock()
defer fake.getPluginMutex.RUnlock()
return fake.getPluginArgsForCall[i].pluginName
}
func (fake *FakeConfig) GetPluginReturns(result1 configv3.Plugin, result2 bool) {
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.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
}
return fake.pluginHomeReturns.result1
}
func (fake *FakeConfig) PluginHomeCallCount() int {
fake.pluginHomeMutex.RLock()
defer fake.pluginHomeMutex.RUnlock()
return len(fake.pluginHomeArgsForCall)
}
func (fake *FakeConfig) PluginHomeReturns(result1 string) {
fake.PluginHomeStub = nil
fake.pluginHomeReturns = struct {
result1 string
}{result1}
}
func (fake *FakeConfig) PluginHomeReturnsOnCall(i int, result1 string) {
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
}
return fake.pluginRepositoriesReturns.result1
}
func (fake *FakeConfig) PluginRepositoriesCallCount() int {
fake.pluginRepositoriesMutex.RLock()
defer fake.pluginRepositoriesMutex.RUnlock()
return len(fake.pluginRepositoriesArgsForCall)
}
func (fake *FakeConfig) PluginRepositoriesReturns(result1 []configv3.PluginRepository) {
fake.PluginRepositoriesStub = nil
fake.pluginRepositoriesReturns = struct {
result1 []configv3.PluginRepository
}{result1}
}
func (fake *FakeConfig) PluginRepositoriesReturnsOnCall(i int, result1 []configv3.PluginRepository) {
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
}
return fake.pluginsReturns.result1
}
func (fake *FakeConfig) PluginsCallCount() int {
fake.pluginsMutex.RLock()
defer fake.pluginsMutex.RUnlock()
return len(fake.pluginsArgsForCall)
}
func (fake *FakeConfig) PluginsReturns(result1 []configv3.Plugin) {
fake.PluginsStub = nil
fake.pluginsReturns = struct {
result1 []configv3.Plugin
}{result1}
}
func (fake *FakeConfig) PluginsReturnsOnCall(i int, result1 []configv3.Plugin) {
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) RemovePluginArgsForCall(i int) string {
fake.removePluginMutex.RLock()
defer fake.removePluginMutex.RUnlock()
return fake.removePluginArgsForCall[i].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
}
return fake.writePluginConfigReturns.result1
}
func (fake *FakeConfig) WritePluginConfigCallCount() int {
fake.writePluginConfigMutex.RLock()
defer fake.writePluginConfigMutex.RUnlock()
return len(fake.writePluginConfigArgsForCall)
}
func (fake *FakeConfig) WritePluginConfigReturns(result1 error) {
fake.WritePluginConfigStub = nil
fake.writePluginConfigReturns = struct {
result1 error
}{result1}
}
func (fake *FakeConfig) WritePluginConfigReturnsOnCall(i int, result1 error) {
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.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)