forked from vmware-archive/atc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fake_resource.go
311 lines (286 loc) · 9.07 KB
/
fake_resource.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
// Code generated by counterfeiter. DO NOT EDIT.
package resourcefakes
import (
"os"
"sync"
"github.com/concourse/atc"
"github.com/concourse/atc/resource"
"github.com/concourse/atc/worker"
)
type FakeResource struct {
GetStub func(worker.Volume, resource.IOConfig, atc.Source, atc.Params, atc.Version, <-chan os.Signal, chan<- struct{}) (resource.VersionedSource, error)
getMutex sync.RWMutex
getArgsForCall []struct {
arg1 worker.Volume
arg2 resource.IOConfig
arg3 atc.Source
arg4 atc.Params
arg5 atc.Version
arg6 <-chan os.Signal
arg7 chan<- struct{}
}
getReturns struct {
result1 resource.VersionedSource
result2 error
}
getReturnsOnCall map[int]struct {
result1 resource.VersionedSource
result2 error
}
PutStub func(resource.IOConfig, atc.Source, atc.Params, <-chan os.Signal, chan<- struct{}) (resource.VersionedSource, error)
putMutex sync.RWMutex
putArgsForCall []struct {
arg1 resource.IOConfig
arg2 atc.Source
arg3 atc.Params
arg4 <-chan os.Signal
arg5 chan<- struct{}
}
putReturns struct {
result1 resource.VersionedSource
result2 error
}
putReturnsOnCall map[int]struct {
result1 resource.VersionedSource
result2 error
}
CheckStub func(atc.Source, atc.Version) ([]atc.Version, error)
checkMutex sync.RWMutex
checkArgsForCall []struct {
arg1 atc.Source
arg2 atc.Version
}
checkReturns struct {
result1 []atc.Version
result2 error
}
checkReturnsOnCall map[int]struct {
result1 []atc.Version
result2 error
}
ContainerStub func() worker.Container
containerMutex sync.RWMutex
containerArgsForCall []struct{}
containerReturns struct {
result1 worker.Container
}
containerReturnsOnCall map[int]struct {
result1 worker.Container
}
invocations map[string][][]interface{}
invocationsMutex sync.RWMutex
}
func (fake *FakeResource) Get(arg1 worker.Volume, arg2 resource.IOConfig, arg3 atc.Source, arg4 atc.Params, arg5 atc.Version, arg6 <-chan os.Signal, arg7 chan<- struct{}) (resource.VersionedSource, error) {
fake.getMutex.Lock()
ret, specificReturn := fake.getReturnsOnCall[len(fake.getArgsForCall)]
fake.getArgsForCall = append(fake.getArgsForCall, struct {
arg1 worker.Volume
arg2 resource.IOConfig
arg3 atc.Source
arg4 atc.Params
arg5 atc.Version
arg6 <-chan os.Signal
arg7 chan<- struct{}
}{arg1, arg2, arg3, arg4, arg5, arg6, arg7})
fake.recordInvocation("Get", []interface{}{arg1, arg2, arg3, arg4, arg5, arg6, arg7})
fake.getMutex.Unlock()
if fake.GetStub != nil {
return fake.GetStub(arg1, arg2, arg3, arg4, arg5, arg6, arg7)
}
if specificReturn {
return ret.result1, ret.result2
}
return fake.getReturns.result1, fake.getReturns.result2
}
func (fake *FakeResource) GetCallCount() int {
fake.getMutex.RLock()
defer fake.getMutex.RUnlock()
return len(fake.getArgsForCall)
}
func (fake *FakeResource) GetArgsForCall(i int) (worker.Volume, resource.IOConfig, atc.Source, atc.Params, atc.Version, <-chan os.Signal, chan<- struct{}) {
fake.getMutex.RLock()
defer fake.getMutex.RUnlock()
return fake.getArgsForCall[i].arg1, fake.getArgsForCall[i].arg2, fake.getArgsForCall[i].arg3, fake.getArgsForCall[i].arg4, fake.getArgsForCall[i].arg5, fake.getArgsForCall[i].arg6, fake.getArgsForCall[i].arg7
}
func (fake *FakeResource) GetReturns(result1 resource.VersionedSource, result2 error) {
fake.GetStub = nil
fake.getReturns = struct {
result1 resource.VersionedSource
result2 error
}{result1, result2}
}
func (fake *FakeResource) GetReturnsOnCall(i int, result1 resource.VersionedSource, result2 error) {
fake.GetStub = nil
if fake.getReturnsOnCall == nil {
fake.getReturnsOnCall = make(map[int]struct {
result1 resource.VersionedSource
result2 error
})
}
fake.getReturnsOnCall[i] = struct {
result1 resource.VersionedSource
result2 error
}{result1, result2}
}
func (fake *FakeResource) Put(arg1 resource.IOConfig, arg2 atc.Source, arg3 atc.Params, arg4 <-chan os.Signal, arg5 chan<- struct{}) (resource.VersionedSource, error) {
fake.putMutex.Lock()
ret, specificReturn := fake.putReturnsOnCall[len(fake.putArgsForCall)]
fake.putArgsForCall = append(fake.putArgsForCall, struct {
arg1 resource.IOConfig
arg2 atc.Source
arg3 atc.Params
arg4 <-chan os.Signal
arg5 chan<- struct{}
}{arg1, arg2, arg3, arg4, arg5})
fake.recordInvocation("Put", []interface{}{arg1, arg2, arg3, arg4, arg5})
fake.putMutex.Unlock()
if fake.PutStub != nil {
return fake.PutStub(arg1, arg2, arg3, arg4, arg5)
}
if specificReturn {
return ret.result1, ret.result2
}
return fake.putReturns.result1, fake.putReturns.result2
}
func (fake *FakeResource) PutCallCount() int {
fake.putMutex.RLock()
defer fake.putMutex.RUnlock()
return len(fake.putArgsForCall)
}
func (fake *FakeResource) PutArgsForCall(i int) (resource.IOConfig, atc.Source, atc.Params, <-chan os.Signal, chan<- struct{}) {
fake.putMutex.RLock()
defer fake.putMutex.RUnlock()
return fake.putArgsForCall[i].arg1, fake.putArgsForCall[i].arg2, fake.putArgsForCall[i].arg3, fake.putArgsForCall[i].arg4, fake.putArgsForCall[i].arg5
}
func (fake *FakeResource) PutReturns(result1 resource.VersionedSource, result2 error) {
fake.PutStub = nil
fake.putReturns = struct {
result1 resource.VersionedSource
result2 error
}{result1, result2}
}
func (fake *FakeResource) PutReturnsOnCall(i int, result1 resource.VersionedSource, result2 error) {
fake.PutStub = nil
if fake.putReturnsOnCall == nil {
fake.putReturnsOnCall = make(map[int]struct {
result1 resource.VersionedSource
result2 error
})
}
fake.putReturnsOnCall[i] = struct {
result1 resource.VersionedSource
result2 error
}{result1, result2}
}
func (fake *FakeResource) Check(arg1 atc.Source, arg2 atc.Version) ([]atc.Version, error) {
fake.checkMutex.Lock()
ret, specificReturn := fake.checkReturnsOnCall[len(fake.checkArgsForCall)]
fake.checkArgsForCall = append(fake.checkArgsForCall, struct {
arg1 atc.Source
arg2 atc.Version
}{arg1, arg2})
fake.recordInvocation("Check", []interface{}{arg1, arg2})
fake.checkMutex.Unlock()
if fake.CheckStub != nil {
return fake.CheckStub(arg1, arg2)
}
if specificReturn {
return ret.result1, ret.result2
}
return fake.checkReturns.result1, fake.checkReturns.result2
}
func (fake *FakeResource) CheckCallCount() int {
fake.checkMutex.RLock()
defer fake.checkMutex.RUnlock()
return len(fake.checkArgsForCall)
}
func (fake *FakeResource) CheckArgsForCall(i int) (atc.Source, atc.Version) {
fake.checkMutex.RLock()
defer fake.checkMutex.RUnlock()
return fake.checkArgsForCall[i].arg1, fake.checkArgsForCall[i].arg2
}
func (fake *FakeResource) CheckReturns(result1 []atc.Version, result2 error) {
fake.CheckStub = nil
fake.checkReturns = struct {
result1 []atc.Version
result2 error
}{result1, result2}
}
func (fake *FakeResource) CheckReturnsOnCall(i int, result1 []atc.Version, result2 error) {
fake.CheckStub = nil
if fake.checkReturnsOnCall == nil {
fake.checkReturnsOnCall = make(map[int]struct {
result1 []atc.Version
result2 error
})
}
fake.checkReturnsOnCall[i] = struct {
result1 []atc.Version
result2 error
}{result1, result2}
}
func (fake *FakeResource) Container() worker.Container {
fake.containerMutex.Lock()
ret, specificReturn := fake.containerReturnsOnCall[len(fake.containerArgsForCall)]
fake.containerArgsForCall = append(fake.containerArgsForCall, struct{}{})
fake.recordInvocation("Container", []interface{}{})
fake.containerMutex.Unlock()
if fake.ContainerStub != nil {
return fake.ContainerStub()
}
if specificReturn {
return ret.result1
}
return fake.containerReturns.result1
}
func (fake *FakeResource) ContainerCallCount() int {
fake.containerMutex.RLock()
defer fake.containerMutex.RUnlock()
return len(fake.containerArgsForCall)
}
func (fake *FakeResource) ContainerReturns(result1 worker.Container) {
fake.ContainerStub = nil
fake.containerReturns = struct {
result1 worker.Container
}{result1}
}
func (fake *FakeResource) ContainerReturnsOnCall(i int, result1 worker.Container) {
fake.ContainerStub = nil
if fake.containerReturnsOnCall == nil {
fake.containerReturnsOnCall = make(map[int]struct {
result1 worker.Container
})
}
fake.containerReturnsOnCall[i] = struct {
result1 worker.Container
}{result1}
}
func (fake *FakeResource) Invocations() map[string][][]interface{} {
fake.invocationsMutex.RLock()
defer fake.invocationsMutex.RUnlock()
fake.getMutex.RLock()
defer fake.getMutex.RUnlock()
fake.putMutex.RLock()
defer fake.putMutex.RUnlock()
fake.checkMutex.RLock()
defer fake.checkMutex.RUnlock()
fake.containerMutex.RLock()
defer fake.containerMutex.RUnlock()
copiedInvocations := map[string][][]interface{}{}
for key, value := range fake.invocations {
copiedInvocations[key] = value
}
return copiedInvocations
}
func (fake *FakeResource) 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 _ resource.Resource = new(FakeResource)