This repository has been archived by the owner on Sep 6, 2021. It is now read-only.
forked from cloudfoundry/bosh-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fake_release_index.go
296 lines (270 loc) · 8.05 KB
/
fake_release_index.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
// Code generated by counterfeiter. DO NOT EDIT.
package releasedirfakes
import (
"sync"
boshrel "github.com/cloudfoundry/bosh-cli/release"
boshrelman "github.com/cloudfoundry/bosh-cli/release/manifest"
"github.com/cloudfoundry/bosh-cli/releasedir"
semver "github.com/cppforlife/go-semi-semantic/version"
)
type FakeReleaseIndex struct {
LastVersionStub func(name string) (*semver.Version, error)
lastVersionMutex sync.RWMutex
lastVersionArgsForCall []struct {
name string
}
lastVersionReturns struct {
result1 *semver.Version
result2 error
}
lastVersionReturnsOnCall map[int]struct {
result1 *semver.Version
result2 error
}
ContainsStub func(boshrel.Release) (bool, error)
containsMutex sync.RWMutex
containsArgsForCall []struct {
arg1 boshrel.Release
}
containsReturns struct {
result1 bool
result2 error
}
containsReturnsOnCall map[int]struct {
result1 bool
result2 error
}
AddStub func(boshrelman.Manifest) error
addMutex sync.RWMutex
addArgsForCall []struct {
arg1 boshrelman.Manifest
}
addReturns struct {
result1 error
}
addReturnsOnCall map[int]struct {
result1 error
}
ManifestPathStub func(name, version string) string
manifestPathMutex sync.RWMutex
manifestPathArgsForCall []struct {
name string
version string
}
manifestPathReturns struct {
result1 string
}
manifestPathReturnsOnCall map[int]struct {
result1 string
}
invocations map[string][][]interface{}
invocationsMutex sync.RWMutex
}
func (fake *FakeReleaseIndex) LastVersion(name string) (*semver.Version, error) {
fake.lastVersionMutex.Lock()
ret, specificReturn := fake.lastVersionReturnsOnCall[len(fake.lastVersionArgsForCall)]
fake.lastVersionArgsForCall = append(fake.lastVersionArgsForCall, struct {
name string
}{name})
fake.recordInvocation("LastVersion", []interface{}{name})
fake.lastVersionMutex.Unlock()
if fake.LastVersionStub != nil {
return fake.LastVersionStub(name)
}
if specificReturn {
return ret.result1, ret.result2
}
return fake.lastVersionReturns.result1, fake.lastVersionReturns.result2
}
func (fake *FakeReleaseIndex) LastVersionCallCount() int {
fake.lastVersionMutex.RLock()
defer fake.lastVersionMutex.RUnlock()
return len(fake.lastVersionArgsForCall)
}
func (fake *FakeReleaseIndex) LastVersionArgsForCall(i int) string {
fake.lastVersionMutex.RLock()
defer fake.lastVersionMutex.RUnlock()
return fake.lastVersionArgsForCall[i].name
}
func (fake *FakeReleaseIndex) LastVersionReturns(result1 *semver.Version, result2 error) {
fake.LastVersionStub = nil
fake.lastVersionReturns = struct {
result1 *semver.Version
result2 error
}{result1, result2}
}
func (fake *FakeReleaseIndex) LastVersionReturnsOnCall(i int, result1 *semver.Version, result2 error) {
fake.LastVersionStub = nil
if fake.lastVersionReturnsOnCall == nil {
fake.lastVersionReturnsOnCall = make(map[int]struct {
result1 *semver.Version
result2 error
})
}
fake.lastVersionReturnsOnCall[i] = struct {
result1 *semver.Version
result2 error
}{result1, result2}
}
func (fake *FakeReleaseIndex) Contains(arg1 boshrel.Release) (bool, error) {
fake.containsMutex.Lock()
ret, specificReturn := fake.containsReturnsOnCall[len(fake.containsArgsForCall)]
fake.containsArgsForCall = append(fake.containsArgsForCall, struct {
arg1 boshrel.Release
}{arg1})
fake.recordInvocation("Contains", []interface{}{arg1})
fake.containsMutex.Unlock()
if fake.ContainsStub != nil {
return fake.ContainsStub(arg1)
}
if specificReturn {
return ret.result1, ret.result2
}
return fake.containsReturns.result1, fake.containsReturns.result2
}
func (fake *FakeReleaseIndex) ContainsCallCount() int {
fake.containsMutex.RLock()
defer fake.containsMutex.RUnlock()
return len(fake.containsArgsForCall)
}
func (fake *FakeReleaseIndex) ContainsArgsForCall(i int) boshrel.Release {
fake.containsMutex.RLock()
defer fake.containsMutex.RUnlock()
return fake.containsArgsForCall[i].arg1
}
func (fake *FakeReleaseIndex) ContainsReturns(result1 bool, result2 error) {
fake.ContainsStub = nil
fake.containsReturns = struct {
result1 bool
result2 error
}{result1, result2}
}
func (fake *FakeReleaseIndex) ContainsReturnsOnCall(i int, result1 bool, result2 error) {
fake.ContainsStub = nil
if fake.containsReturnsOnCall == nil {
fake.containsReturnsOnCall = make(map[int]struct {
result1 bool
result2 error
})
}
fake.containsReturnsOnCall[i] = struct {
result1 bool
result2 error
}{result1, result2}
}
func (fake *FakeReleaseIndex) Add(arg1 boshrelman.Manifest) error {
fake.addMutex.Lock()
ret, specificReturn := fake.addReturnsOnCall[len(fake.addArgsForCall)]
fake.addArgsForCall = append(fake.addArgsForCall, struct {
arg1 boshrelman.Manifest
}{arg1})
fake.recordInvocation("Add", []interface{}{arg1})
fake.addMutex.Unlock()
if fake.AddStub != nil {
return fake.AddStub(arg1)
}
if specificReturn {
return ret.result1
}
return fake.addReturns.result1
}
func (fake *FakeReleaseIndex) AddCallCount() int {
fake.addMutex.RLock()
defer fake.addMutex.RUnlock()
return len(fake.addArgsForCall)
}
func (fake *FakeReleaseIndex) AddArgsForCall(i int) boshrelman.Manifest {
fake.addMutex.RLock()
defer fake.addMutex.RUnlock()
return fake.addArgsForCall[i].arg1
}
func (fake *FakeReleaseIndex) AddReturns(result1 error) {
fake.AddStub = nil
fake.addReturns = struct {
result1 error
}{result1}
}
func (fake *FakeReleaseIndex) AddReturnsOnCall(i int, result1 error) {
fake.AddStub = nil
if fake.addReturnsOnCall == nil {
fake.addReturnsOnCall = make(map[int]struct {
result1 error
})
}
fake.addReturnsOnCall[i] = struct {
result1 error
}{result1}
}
func (fake *FakeReleaseIndex) ManifestPath(name string, version string) string {
fake.manifestPathMutex.Lock()
ret, specificReturn := fake.manifestPathReturnsOnCall[len(fake.manifestPathArgsForCall)]
fake.manifestPathArgsForCall = append(fake.manifestPathArgsForCall, struct {
name string
version string
}{name, version})
fake.recordInvocation("ManifestPath", []interface{}{name, version})
fake.manifestPathMutex.Unlock()
if fake.ManifestPathStub != nil {
return fake.ManifestPathStub(name, version)
}
if specificReturn {
return ret.result1
}
return fake.manifestPathReturns.result1
}
func (fake *FakeReleaseIndex) ManifestPathCallCount() int {
fake.manifestPathMutex.RLock()
defer fake.manifestPathMutex.RUnlock()
return len(fake.manifestPathArgsForCall)
}
func (fake *FakeReleaseIndex) ManifestPathArgsForCall(i int) (string, string) {
fake.manifestPathMutex.RLock()
defer fake.manifestPathMutex.RUnlock()
return fake.manifestPathArgsForCall[i].name, fake.manifestPathArgsForCall[i].version
}
func (fake *FakeReleaseIndex) ManifestPathReturns(result1 string) {
fake.ManifestPathStub = nil
fake.manifestPathReturns = struct {
result1 string
}{result1}
}
func (fake *FakeReleaseIndex) ManifestPathReturnsOnCall(i int, result1 string) {
fake.ManifestPathStub = nil
if fake.manifestPathReturnsOnCall == nil {
fake.manifestPathReturnsOnCall = make(map[int]struct {
result1 string
})
}
fake.manifestPathReturnsOnCall[i] = struct {
result1 string
}{result1}
}
func (fake *FakeReleaseIndex) Invocations() map[string][][]interface{} {
fake.invocationsMutex.RLock()
defer fake.invocationsMutex.RUnlock()
fake.lastVersionMutex.RLock()
defer fake.lastVersionMutex.RUnlock()
fake.containsMutex.RLock()
defer fake.containsMutex.RUnlock()
fake.addMutex.RLock()
defer fake.addMutex.RUnlock()
fake.manifestPathMutex.RLock()
defer fake.manifestPathMutex.RUnlock()
copiedInvocations := map[string][][]interface{}{}
for key, value := range fake.invocations {
copiedInvocations[key] = value
}
return copiedInvocations
}
func (fake *FakeReleaseIndex) 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 _ releasedir.ReleaseIndex = new(FakeReleaseIndex)