forked from cloudfoundry/cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fake_shared_actor.go
316 lines (290 loc) · 11.3 KB
/
fake_shared_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
// Code generated by counterfeiter. DO NOT EDIT.
package v3actionfakes
import (
"sync"
"code.cloudfoundry.org/cli/actor/sharedaction"
"code.cloudfoundry.org/cli/actor/v3action"
)
type FakeSharedActor struct {
GatherArchiveResourcesStub func(archivePath string) ([]sharedaction.Resource, error)
gatherArchiveResourcesMutex sync.RWMutex
gatherArchiveResourcesArgsForCall []struct {
archivePath string
}
gatherArchiveResourcesReturns struct {
result1 []sharedaction.Resource
result2 error
}
gatherArchiveResourcesReturnsOnCall map[int]struct {
result1 []sharedaction.Resource
result2 error
}
GatherDirectoryResourcesStub func(sourceDir string) ([]sharedaction.Resource, error)
gatherDirectoryResourcesMutex sync.RWMutex
gatherDirectoryResourcesArgsForCall []struct {
sourceDir string
}
gatherDirectoryResourcesReturns struct {
result1 []sharedaction.Resource
result2 error
}
gatherDirectoryResourcesReturnsOnCall map[int]struct {
result1 []sharedaction.Resource
result2 error
}
ZipArchiveResourcesStub func(sourceArchivePath string, filesToInclude []sharedaction.Resource) (string, error)
zipArchiveResourcesMutex sync.RWMutex
zipArchiveResourcesArgsForCall []struct {
sourceArchivePath string
filesToInclude []sharedaction.Resource
}
zipArchiveResourcesReturns struct {
result1 string
result2 error
}
zipArchiveResourcesReturnsOnCall map[int]struct {
result1 string
result2 error
}
ZipDirectoryResourcesStub func(sourceDir string, filesToInclude []sharedaction.Resource) (string, error)
zipDirectoryResourcesMutex sync.RWMutex
zipDirectoryResourcesArgsForCall []struct {
sourceDir string
filesToInclude []sharedaction.Resource
}
zipDirectoryResourcesReturns struct {
result1 string
result2 error
}
zipDirectoryResourcesReturnsOnCall map[int]struct {
result1 string
result2 error
}
invocations map[string][][]interface{}
invocationsMutex sync.RWMutex
}
func (fake *FakeSharedActor) GatherArchiveResources(archivePath string) ([]sharedaction.Resource, error) {
fake.gatherArchiveResourcesMutex.Lock()
ret, specificReturn := fake.gatherArchiveResourcesReturnsOnCall[len(fake.gatherArchiveResourcesArgsForCall)]
fake.gatherArchiveResourcesArgsForCall = append(fake.gatherArchiveResourcesArgsForCall, struct {
archivePath string
}{archivePath})
fake.recordInvocation("GatherArchiveResources", []interface{}{archivePath})
fake.gatherArchiveResourcesMutex.Unlock()
if fake.GatherArchiveResourcesStub != nil {
return fake.GatherArchiveResourcesStub(archivePath)
}
if specificReturn {
return ret.result1, ret.result2
}
return fake.gatherArchiveResourcesReturns.result1, fake.gatherArchiveResourcesReturns.result2
}
func (fake *FakeSharedActor) GatherArchiveResourcesCallCount() int {
fake.gatherArchiveResourcesMutex.RLock()
defer fake.gatherArchiveResourcesMutex.RUnlock()
return len(fake.gatherArchiveResourcesArgsForCall)
}
func (fake *FakeSharedActor) GatherArchiveResourcesArgsForCall(i int) string {
fake.gatherArchiveResourcesMutex.RLock()
defer fake.gatherArchiveResourcesMutex.RUnlock()
return fake.gatherArchiveResourcesArgsForCall[i].archivePath
}
func (fake *FakeSharedActor) GatherArchiveResourcesReturns(result1 []sharedaction.Resource, result2 error) {
fake.GatherArchiveResourcesStub = nil
fake.gatherArchiveResourcesReturns = struct {
result1 []sharedaction.Resource
result2 error
}{result1, result2}
}
func (fake *FakeSharedActor) GatherArchiveResourcesReturnsOnCall(i int, result1 []sharedaction.Resource, result2 error) {
fake.GatherArchiveResourcesStub = nil
if fake.gatherArchiveResourcesReturnsOnCall == nil {
fake.gatherArchiveResourcesReturnsOnCall = make(map[int]struct {
result1 []sharedaction.Resource
result2 error
})
}
fake.gatherArchiveResourcesReturnsOnCall[i] = struct {
result1 []sharedaction.Resource
result2 error
}{result1, result2}
}
func (fake *FakeSharedActor) GatherDirectoryResources(sourceDir string) ([]sharedaction.Resource, error) {
fake.gatherDirectoryResourcesMutex.Lock()
ret, specificReturn := fake.gatherDirectoryResourcesReturnsOnCall[len(fake.gatherDirectoryResourcesArgsForCall)]
fake.gatherDirectoryResourcesArgsForCall = append(fake.gatherDirectoryResourcesArgsForCall, struct {
sourceDir string
}{sourceDir})
fake.recordInvocation("GatherDirectoryResources", []interface{}{sourceDir})
fake.gatherDirectoryResourcesMutex.Unlock()
if fake.GatherDirectoryResourcesStub != nil {
return fake.GatherDirectoryResourcesStub(sourceDir)
}
if specificReturn {
return ret.result1, ret.result2
}
return fake.gatherDirectoryResourcesReturns.result1, fake.gatherDirectoryResourcesReturns.result2
}
func (fake *FakeSharedActor) GatherDirectoryResourcesCallCount() int {
fake.gatherDirectoryResourcesMutex.RLock()
defer fake.gatherDirectoryResourcesMutex.RUnlock()
return len(fake.gatherDirectoryResourcesArgsForCall)
}
func (fake *FakeSharedActor) GatherDirectoryResourcesArgsForCall(i int) string {
fake.gatherDirectoryResourcesMutex.RLock()
defer fake.gatherDirectoryResourcesMutex.RUnlock()
return fake.gatherDirectoryResourcesArgsForCall[i].sourceDir
}
func (fake *FakeSharedActor) GatherDirectoryResourcesReturns(result1 []sharedaction.Resource, result2 error) {
fake.GatherDirectoryResourcesStub = nil
fake.gatherDirectoryResourcesReturns = struct {
result1 []sharedaction.Resource
result2 error
}{result1, result2}
}
func (fake *FakeSharedActor) GatherDirectoryResourcesReturnsOnCall(i int, result1 []sharedaction.Resource, result2 error) {
fake.GatherDirectoryResourcesStub = nil
if fake.gatherDirectoryResourcesReturnsOnCall == nil {
fake.gatherDirectoryResourcesReturnsOnCall = make(map[int]struct {
result1 []sharedaction.Resource
result2 error
})
}
fake.gatherDirectoryResourcesReturnsOnCall[i] = struct {
result1 []sharedaction.Resource
result2 error
}{result1, result2}
}
func (fake *FakeSharedActor) ZipArchiveResources(sourceArchivePath string, filesToInclude []sharedaction.Resource) (string, error) {
var filesToIncludeCopy []sharedaction.Resource
if filesToInclude != nil {
filesToIncludeCopy = make([]sharedaction.Resource, len(filesToInclude))
copy(filesToIncludeCopy, filesToInclude)
}
fake.zipArchiveResourcesMutex.Lock()
ret, specificReturn := fake.zipArchiveResourcesReturnsOnCall[len(fake.zipArchiveResourcesArgsForCall)]
fake.zipArchiveResourcesArgsForCall = append(fake.zipArchiveResourcesArgsForCall, struct {
sourceArchivePath string
filesToInclude []sharedaction.Resource
}{sourceArchivePath, filesToIncludeCopy})
fake.recordInvocation("ZipArchiveResources", []interface{}{sourceArchivePath, filesToIncludeCopy})
fake.zipArchiveResourcesMutex.Unlock()
if fake.ZipArchiveResourcesStub != nil {
return fake.ZipArchiveResourcesStub(sourceArchivePath, filesToInclude)
}
if specificReturn {
return ret.result1, ret.result2
}
return fake.zipArchiveResourcesReturns.result1, fake.zipArchiveResourcesReturns.result2
}
func (fake *FakeSharedActor) ZipArchiveResourcesCallCount() int {
fake.zipArchiveResourcesMutex.RLock()
defer fake.zipArchiveResourcesMutex.RUnlock()
return len(fake.zipArchiveResourcesArgsForCall)
}
func (fake *FakeSharedActor) ZipArchiveResourcesArgsForCall(i int) (string, []sharedaction.Resource) {
fake.zipArchiveResourcesMutex.RLock()
defer fake.zipArchiveResourcesMutex.RUnlock()
return fake.zipArchiveResourcesArgsForCall[i].sourceArchivePath, fake.zipArchiveResourcesArgsForCall[i].filesToInclude
}
func (fake *FakeSharedActor) ZipArchiveResourcesReturns(result1 string, result2 error) {
fake.ZipArchiveResourcesStub = nil
fake.zipArchiveResourcesReturns = struct {
result1 string
result2 error
}{result1, result2}
}
func (fake *FakeSharedActor) ZipArchiveResourcesReturnsOnCall(i int, result1 string, result2 error) {
fake.ZipArchiveResourcesStub = nil
if fake.zipArchiveResourcesReturnsOnCall == nil {
fake.zipArchiveResourcesReturnsOnCall = make(map[int]struct {
result1 string
result2 error
})
}
fake.zipArchiveResourcesReturnsOnCall[i] = struct {
result1 string
result2 error
}{result1, result2}
}
func (fake *FakeSharedActor) ZipDirectoryResources(sourceDir string, filesToInclude []sharedaction.Resource) (string, error) {
var filesToIncludeCopy []sharedaction.Resource
if filesToInclude != nil {
filesToIncludeCopy = make([]sharedaction.Resource, len(filesToInclude))
copy(filesToIncludeCopy, filesToInclude)
}
fake.zipDirectoryResourcesMutex.Lock()
ret, specificReturn := fake.zipDirectoryResourcesReturnsOnCall[len(fake.zipDirectoryResourcesArgsForCall)]
fake.zipDirectoryResourcesArgsForCall = append(fake.zipDirectoryResourcesArgsForCall, struct {
sourceDir string
filesToInclude []sharedaction.Resource
}{sourceDir, filesToIncludeCopy})
fake.recordInvocation("ZipDirectoryResources", []interface{}{sourceDir, filesToIncludeCopy})
fake.zipDirectoryResourcesMutex.Unlock()
if fake.ZipDirectoryResourcesStub != nil {
return fake.ZipDirectoryResourcesStub(sourceDir, filesToInclude)
}
if specificReturn {
return ret.result1, ret.result2
}
return fake.zipDirectoryResourcesReturns.result1, fake.zipDirectoryResourcesReturns.result2
}
func (fake *FakeSharedActor) ZipDirectoryResourcesCallCount() int {
fake.zipDirectoryResourcesMutex.RLock()
defer fake.zipDirectoryResourcesMutex.RUnlock()
return len(fake.zipDirectoryResourcesArgsForCall)
}
func (fake *FakeSharedActor) ZipDirectoryResourcesArgsForCall(i int) (string, []sharedaction.Resource) {
fake.zipDirectoryResourcesMutex.RLock()
defer fake.zipDirectoryResourcesMutex.RUnlock()
return fake.zipDirectoryResourcesArgsForCall[i].sourceDir, fake.zipDirectoryResourcesArgsForCall[i].filesToInclude
}
func (fake *FakeSharedActor) ZipDirectoryResourcesReturns(result1 string, result2 error) {
fake.ZipDirectoryResourcesStub = nil
fake.zipDirectoryResourcesReturns = struct {
result1 string
result2 error
}{result1, result2}
}
func (fake *FakeSharedActor) ZipDirectoryResourcesReturnsOnCall(i int, result1 string, result2 error) {
fake.ZipDirectoryResourcesStub = nil
if fake.zipDirectoryResourcesReturnsOnCall == nil {
fake.zipDirectoryResourcesReturnsOnCall = make(map[int]struct {
result1 string
result2 error
})
}
fake.zipDirectoryResourcesReturnsOnCall[i] = struct {
result1 string
result2 error
}{result1, result2}
}
func (fake *FakeSharedActor) Invocations() map[string][][]interface{} {
fake.invocationsMutex.RLock()
defer fake.invocationsMutex.RUnlock()
fake.gatherArchiveResourcesMutex.RLock()
defer fake.gatherArchiveResourcesMutex.RUnlock()
fake.gatherDirectoryResourcesMutex.RLock()
defer fake.gatherDirectoryResourcesMutex.RUnlock()
fake.zipArchiveResourcesMutex.RLock()
defer fake.zipArchiveResourcesMutex.RUnlock()
fake.zipDirectoryResourcesMutex.RLock()
defer fake.zipDirectoryResourcesMutex.RUnlock()
copiedInvocations := map[string][][]interface{}{}
for key, value := range fake.invocations {
copiedInvocations[key] = value
}
return copiedInvocations
}
func (fake *FakeSharedActor) 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 _ v3action.SharedActor = new(FakeSharedActor)