forked from cloudfoundry/bosh-agent
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fake_applier.go
258 lines (232 loc) · 6.82 KB
/
fake_applier.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
// This file was generated by counterfeiter
package jobsfakes
import (
"sync"
"github.com/cloudfoundry/bosh-agent/agent/applier/jobs"
"github.com/cloudfoundry/bosh-agent/agent/applier/models"
)
type FakeApplier struct {
PrepareStub func(job models.Job) error
prepareMutex sync.RWMutex
prepareArgsForCall []struct {
job models.Job
}
prepareReturns struct {
result1 error
}
ApplyStub func(job models.Job) error
applyMutex sync.RWMutex
applyArgsForCall []struct {
job models.Job
}
applyReturns struct {
result1 error
}
ConfigureStub func(job models.Job, jobIndex int) error
configureMutex sync.RWMutex
configureArgsForCall []struct {
job models.Job
jobIndex int
}
configureReturns struct {
result1 error
}
KeepOnlyStub func(jobs []models.Job) error
keepOnlyMutex sync.RWMutex
keepOnlyArgsForCall []struct {
jobs []models.Job
}
keepOnlyReturns struct {
result1 error
}
CreateDirectoriesStub func(job models.Job, baseDir string) error
createDirectoriesMutex sync.RWMutex
createDirectoriesArgsForCall []struct {
job models.Job
baseDir string
}
createDirectoriesReturns struct {
result1 error
}
invocations map[string][][]interface{}
invocationsMutex sync.RWMutex
}
func (fake *FakeApplier) Prepare(job models.Job) error {
fake.prepareMutex.Lock()
fake.prepareArgsForCall = append(fake.prepareArgsForCall, struct {
job models.Job
}{job})
fake.recordInvocation("Prepare", []interface{}{job})
fake.prepareMutex.Unlock()
if fake.PrepareStub != nil {
return fake.PrepareStub(job)
} else {
return fake.prepareReturns.result1
}
}
func (fake *FakeApplier) PrepareCallCount() int {
fake.prepareMutex.RLock()
defer fake.prepareMutex.RUnlock()
return len(fake.prepareArgsForCall)
}
func (fake *FakeApplier) PrepareArgsForCall(i int) models.Job {
fake.prepareMutex.RLock()
defer fake.prepareMutex.RUnlock()
return fake.prepareArgsForCall[i].job
}
func (fake *FakeApplier) PrepareReturns(result1 error) {
fake.PrepareStub = nil
fake.prepareReturns = struct {
result1 error
}{result1}
}
func (fake *FakeApplier) Apply(job models.Job) error {
fake.applyMutex.Lock()
fake.applyArgsForCall = append(fake.applyArgsForCall, struct {
job models.Job
}{job})
fake.recordInvocation("Apply", []interface{}{job})
fake.applyMutex.Unlock()
if fake.ApplyStub != nil {
return fake.ApplyStub(job)
} else {
return fake.applyReturns.result1
}
}
func (fake *FakeApplier) ApplyCallCount() int {
fake.applyMutex.RLock()
defer fake.applyMutex.RUnlock()
return len(fake.applyArgsForCall)
}
func (fake *FakeApplier) ApplyArgsForCall(i int) models.Job {
fake.applyMutex.RLock()
defer fake.applyMutex.RUnlock()
return fake.applyArgsForCall[i].job
}
func (fake *FakeApplier) ApplyReturns(result1 error) {
fake.ApplyStub = nil
fake.applyReturns = struct {
result1 error
}{result1}
}
func (fake *FakeApplier) Configure(job models.Job, jobIndex int) error {
fake.configureMutex.Lock()
fake.configureArgsForCall = append(fake.configureArgsForCall, struct {
job models.Job
jobIndex int
}{job, jobIndex})
fake.recordInvocation("Configure", []interface{}{job, jobIndex})
fake.configureMutex.Unlock()
if fake.ConfigureStub != nil {
return fake.ConfigureStub(job, jobIndex)
} else {
return fake.configureReturns.result1
}
}
func (fake *FakeApplier) ConfigureCallCount() int {
fake.configureMutex.RLock()
defer fake.configureMutex.RUnlock()
return len(fake.configureArgsForCall)
}
func (fake *FakeApplier) ConfigureArgsForCall(i int) (models.Job, int) {
fake.configureMutex.RLock()
defer fake.configureMutex.RUnlock()
return fake.configureArgsForCall[i].job, fake.configureArgsForCall[i].jobIndex
}
func (fake *FakeApplier) ConfigureReturns(result1 error) {
fake.ConfigureStub = nil
fake.configureReturns = struct {
result1 error
}{result1}
}
func (fake *FakeApplier) KeepOnly(jobs []models.Job) error {
var jobsCopy []models.Job
if jobs != nil {
jobsCopy = make([]models.Job, len(jobs))
copy(jobsCopy, jobs)
}
fake.keepOnlyMutex.Lock()
fake.keepOnlyArgsForCall = append(fake.keepOnlyArgsForCall, struct {
jobs []models.Job
}{jobsCopy})
fake.recordInvocation("KeepOnly", []interface{}{jobsCopy})
fake.keepOnlyMutex.Unlock()
if fake.KeepOnlyStub != nil {
return fake.KeepOnlyStub(jobs)
} else {
return fake.keepOnlyReturns.result1
}
}
func (fake *FakeApplier) KeepOnlyCallCount() int {
fake.keepOnlyMutex.RLock()
defer fake.keepOnlyMutex.RUnlock()
return len(fake.keepOnlyArgsForCall)
}
func (fake *FakeApplier) KeepOnlyArgsForCall(i int) []models.Job {
fake.keepOnlyMutex.RLock()
defer fake.keepOnlyMutex.RUnlock()
return fake.keepOnlyArgsForCall[i].jobs
}
func (fake *FakeApplier) KeepOnlyReturns(result1 error) {
fake.KeepOnlyStub = nil
fake.keepOnlyReturns = struct {
result1 error
}{result1}
}
func (fake *FakeApplier) CreateDirectories(job models.Job, baseDir string) error {
fake.createDirectoriesMutex.Lock()
fake.createDirectoriesArgsForCall = append(fake.createDirectoriesArgsForCall, struct {
job models.Job
baseDir string
}{job, baseDir})
fake.recordInvocation("CreateDirectories", []interface{}{job, baseDir})
fake.createDirectoriesMutex.Unlock()
if fake.CreateDirectoriesStub != nil {
return fake.CreateDirectoriesStub(job, baseDir)
} else {
return fake.createDirectoriesReturns.result1
}
}
func (fake *FakeApplier) CreateDirectoriesCallCount() int {
fake.createDirectoriesMutex.RLock()
defer fake.createDirectoriesMutex.RUnlock()
return len(fake.createDirectoriesArgsForCall)
}
func (fake *FakeApplier) CreateDirectoriesArgsForCall(i int) (models.Job, string) {
fake.createDirectoriesMutex.RLock()
defer fake.createDirectoriesMutex.RUnlock()
return fake.createDirectoriesArgsForCall[i].job, fake.createDirectoriesArgsForCall[i].baseDir
}
func (fake *FakeApplier) CreateDirectoriesReturns(result1 error) {
fake.CreateDirectoriesStub = nil
fake.createDirectoriesReturns = struct {
result1 error
}{result1}
}
func (fake *FakeApplier) Invocations() map[string][][]interface{} {
fake.invocationsMutex.RLock()
defer fake.invocationsMutex.RUnlock()
fake.prepareMutex.RLock()
defer fake.prepareMutex.RUnlock()
fake.applyMutex.RLock()
defer fake.applyMutex.RUnlock()
fake.configureMutex.RLock()
defer fake.configureMutex.RUnlock()
fake.keepOnlyMutex.RLock()
defer fake.keepOnlyMutex.RUnlock()
fake.createDirectoriesMutex.RLock()
defer fake.createDirectoriesMutex.RUnlock()
return fake.invocations
}
func (fake *FakeApplier) 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 _ jobs.Applier = new(FakeApplier)