This repository has been archived by the owner on Mar 24, 2022. It is now read-only.
/
fake_fetch_source.go
221 lines (202 loc) · 6.01 KB
/
fake_fetch_source.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
// Code generated by counterfeiter. DO NOT EDIT.
package resourcefakes
import (
"context"
"sync"
"github.com/concourse/atc/resource"
)
type FakeFetchSource struct {
LockNameStub func() (string, error)
lockNameMutex sync.RWMutex
lockNameArgsForCall []struct{}
lockNameReturns struct {
result1 string
result2 error
}
lockNameReturnsOnCall map[int]struct {
result1 string
result2 error
}
FindStub func() (resource.VersionedSource, bool, error)
findMutex sync.RWMutex
findArgsForCall []struct{}
findReturns struct {
result1 resource.VersionedSource
result2 bool
result3 error
}
findReturnsOnCall map[int]struct {
result1 resource.VersionedSource
result2 bool
result3 error
}
CreateStub func(context.Context) (resource.VersionedSource, error)
createMutex sync.RWMutex
createArgsForCall []struct {
arg1 context.Context
}
createReturns struct {
result1 resource.VersionedSource
result2 error
}
createReturnsOnCall map[int]struct {
result1 resource.VersionedSource
result2 error
}
invocations map[string][][]interface{}
invocationsMutex sync.RWMutex
}
func (fake *FakeFetchSource) LockName() (string, error) {
fake.lockNameMutex.Lock()
ret, specificReturn := fake.lockNameReturnsOnCall[len(fake.lockNameArgsForCall)]
fake.lockNameArgsForCall = append(fake.lockNameArgsForCall, struct{}{})
fake.recordInvocation("LockName", []interface{}{})
fake.lockNameMutex.Unlock()
if fake.LockNameStub != nil {
return fake.LockNameStub()
}
if specificReturn {
return ret.result1, ret.result2
}
return fake.lockNameReturns.result1, fake.lockNameReturns.result2
}
func (fake *FakeFetchSource) LockNameCallCount() int {
fake.lockNameMutex.RLock()
defer fake.lockNameMutex.RUnlock()
return len(fake.lockNameArgsForCall)
}
func (fake *FakeFetchSource) LockNameReturns(result1 string, result2 error) {
fake.LockNameStub = nil
fake.lockNameReturns = struct {
result1 string
result2 error
}{result1, result2}
}
func (fake *FakeFetchSource) LockNameReturnsOnCall(i int, result1 string, result2 error) {
fake.LockNameStub = nil
if fake.lockNameReturnsOnCall == nil {
fake.lockNameReturnsOnCall = make(map[int]struct {
result1 string
result2 error
})
}
fake.lockNameReturnsOnCall[i] = struct {
result1 string
result2 error
}{result1, result2}
}
func (fake *FakeFetchSource) Find() (resource.VersionedSource, bool, error) {
fake.findMutex.Lock()
ret, specificReturn := fake.findReturnsOnCall[len(fake.findArgsForCall)]
fake.findArgsForCall = append(fake.findArgsForCall, struct{}{})
fake.recordInvocation("Find", []interface{}{})
fake.findMutex.Unlock()
if fake.FindStub != nil {
return fake.FindStub()
}
if specificReturn {
return ret.result1, ret.result2, ret.result3
}
return fake.findReturns.result1, fake.findReturns.result2, fake.findReturns.result3
}
func (fake *FakeFetchSource) FindCallCount() int {
fake.findMutex.RLock()
defer fake.findMutex.RUnlock()
return len(fake.findArgsForCall)
}
func (fake *FakeFetchSource) FindReturns(result1 resource.VersionedSource, result2 bool, result3 error) {
fake.FindStub = nil
fake.findReturns = struct {
result1 resource.VersionedSource
result2 bool
result3 error
}{result1, result2, result3}
}
func (fake *FakeFetchSource) FindReturnsOnCall(i int, result1 resource.VersionedSource, result2 bool, result3 error) {
fake.FindStub = nil
if fake.findReturnsOnCall == nil {
fake.findReturnsOnCall = make(map[int]struct {
result1 resource.VersionedSource
result2 bool
result3 error
})
}
fake.findReturnsOnCall[i] = struct {
result1 resource.VersionedSource
result2 bool
result3 error
}{result1, result2, result3}
}
func (fake *FakeFetchSource) Create(arg1 context.Context) (resource.VersionedSource, error) {
fake.createMutex.Lock()
ret, specificReturn := fake.createReturnsOnCall[len(fake.createArgsForCall)]
fake.createArgsForCall = append(fake.createArgsForCall, struct {
arg1 context.Context
}{arg1})
fake.recordInvocation("Create", []interface{}{arg1})
fake.createMutex.Unlock()
if fake.CreateStub != nil {
return fake.CreateStub(arg1)
}
if specificReturn {
return ret.result1, ret.result2
}
return fake.createReturns.result1, fake.createReturns.result2
}
func (fake *FakeFetchSource) CreateCallCount() int {
fake.createMutex.RLock()
defer fake.createMutex.RUnlock()
return len(fake.createArgsForCall)
}
func (fake *FakeFetchSource) CreateArgsForCall(i int) context.Context {
fake.createMutex.RLock()
defer fake.createMutex.RUnlock()
return fake.createArgsForCall[i].arg1
}
func (fake *FakeFetchSource) CreateReturns(result1 resource.VersionedSource, result2 error) {
fake.CreateStub = nil
fake.createReturns = struct {
result1 resource.VersionedSource
result2 error
}{result1, result2}
}
func (fake *FakeFetchSource) CreateReturnsOnCall(i int, result1 resource.VersionedSource, result2 error) {
fake.CreateStub = nil
if fake.createReturnsOnCall == nil {
fake.createReturnsOnCall = make(map[int]struct {
result1 resource.VersionedSource
result2 error
})
}
fake.createReturnsOnCall[i] = struct {
result1 resource.VersionedSource
result2 error
}{result1, result2}
}
func (fake *FakeFetchSource) Invocations() map[string][][]interface{} {
fake.invocationsMutex.RLock()
defer fake.invocationsMutex.RUnlock()
fake.lockNameMutex.RLock()
defer fake.lockNameMutex.RUnlock()
fake.findMutex.RLock()
defer fake.findMutex.RUnlock()
fake.createMutex.RLock()
defer fake.createMutex.RUnlock()
copiedInvocations := map[string][][]interface{}{}
for key, value := range fake.invocations {
copiedInvocations[key] = value
}
return copiedInvocations
}
func (fake *FakeFetchSource) 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.FetchSource = new(FakeFetchSource)