forked from vmware-archive/atc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fake_resource.go
227 lines (206 loc) · 6.85 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
// This file was generated by counterfeiter
package resourcefakes
import (
"os"
"sync"
"time"
"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
}
PutStub func(resource.IOConfig, atc.Source, atc.Params, resource.ArtifactSource, <-chan os.Signal, chan<- struct{}) (resource.VersionedSource, error)
putMutex sync.RWMutex
putArgsForCall []struct {
arg1 resource.IOConfig
arg2 atc.Source
arg3 atc.Params
arg4 resource.ArtifactSource
arg5 <-chan os.Signal
arg6 chan<- struct{}
}
putReturns 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
}
ReleaseStub func(*time.Duration)
releaseMutex sync.RWMutex
releaseArgsForCall []struct {
arg1 *time.Duration
}
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()
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)
} else {
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) Put(arg1 resource.IOConfig, arg2 atc.Source, arg3 atc.Params, arg4 resource.ArtifactSource, arg5 <-chan os.Signal, arg6 chan<- struct{}) (resource.VersionedSource, error) {
fake.putMutex.Lock()
fake.putArgsForCall = append(fake.putArgsForCall, struct {
arg1 resource.IOConfig
arg2 atc.Source
arg3 atc.Params
arg4 resource.ArtifactSource
arg5 <-chan os.Signal
arg6 chan<- struct{}
}{arg1, arg2, arg3, arg4, arg5, arg6})
fake.recordInvocation("Put", []interface{}{arg1, arg2, arg3, arg4, arg5, arg6})
fake.putMutex.Unlock()
if fake.PutStub != nil {
return fake.PutStub(arg1, arg2, arg3, arg4, arg5, arg6)
} else {
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, resource.ArtifactSource, <-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, fake.putArgsForCall[i].arg6
}
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) Check(arg1 atc.Source, arg2 atc.Version) ([]atc.Version, error) {
fake.checkMutex.Lock()
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)
} else {
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) Release(arg1 *time.Duration) {
fake.releaseMutex.Lock()
fake.releaseArgsForCall = append(fake.releaseArgsForCall, struct {
arg1 *time.Duration
}{arg1})
fake.recordInvocation("Release", []interface{}{arg1})
fake.releaseMutex.Unlock()
if fake.ReleaseStub != nil {
fake.ReleaseStub(arg1)
}
}
func (fake *FakeResource) ReleaseCallCount() int {
fake.releaseMutex.RLock()
defer fake.releaseMutex.RUnlock()
return len(fake.releaseArgsForCall)
}
func (fake *FakeResource) ReleaseArgsForCall(i int) *time.Duration {
fake.releaseMutex.RLock()
defer fake.releaseMutex.RUnlock()
return fake.releaseArgsForCall[i].arg1
}
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.releaseMutex.RLock()
defer fake.releaseMutex.RUnlock()
return fake.invocations
}
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)