forked from cloudfoundry/cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fake_route_actor.go
406 lines (368 loc) · 12.9 KB
/
fake_route_actor.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
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
// This file was generated by counterfeiter
package actorsfakes
import (
"sync"
"code.cloudfoundry.org/cli/cf/actors"
"code.cloudfoundry.org/cli/cf/models"
)
type FakeRouteActor struct {
CreateRandomTCPRouteStub func(domain models.DomainFields) (models.Route, error)
createRandomTCPRouteMutex sync.RWMutex
createRandomTCPRouteArgsForCall []struct {
domain models.DomainFields
}
createRandomTCPRouteReturns struct {
result1 models.Route
result2 error
}
FindOrCreateRouteStub func(hostname string, domain models.DomainFields, path string, port int, useRandomPort bool) (models.Route, error)
findOrCreateRouteMutex sync.RWMutex
findOrCreateRouteArgsForCall []struct {
hostname string
domain models.DomainFields
path string
port int
useRandomPort bool
}
findOrCreateRouteReturns struct {
result1 models.Route
result2 error
}
BindRouteStub func(app models.Application, route models.Route) error
bindRouteMutex sync.RWMutex
bindRouteArgsForCall []struct {
app models.Application
route models.Route
}
bindRouteReturns struct {
result1 error
}
UnbindAllStub func(app models.Application) error
unbindAllMutex sync.RWMutex
unbindAllArgsForCall []struct {
app models.Application
}
unbindAllReturns struct {
result1 error
}
FindDomainStub func(routeName string) (string, models.DomainFields, error)
findDomainMutex sync.RWMutex
findDomainArgsForCall []struct {
routeName string
}
findDomainReturns struct {
result1 string
result2 models.DomainFields
result3 error
}
FindPathStub func(routeName string) (string, string)
findPathMutex sync.RWMutex
findPathArgsForCall []struct {
routeName string
}
findPathReturns struct {
result1 string
result2 string
}
FindPortStub func(routeName string) (string, int, error)
findPortMutex sync.RWMutex
findPortArgsForCall []struct {
routeName string
}
findPortReturns struct {
result1 string
result2 int
result3 error
}
FindAndBindRouteStub func(routeName string, app models.Application, appParamsFromContext models.AppParams) error
findAndBindRouteMutex sync.RWMutex
findAndBindRouteArgsForCall []struct {
routeName string
app models.Application
appParamsFromContext models.AppParams
}
findAndBindRouteReturns struct {
result1 error
}
invocations map[string][][]interface{}
invocationsMutex sync.RWMutex
}
func (fake *FakeRouteActor) CreateRandomTCPRoute(domain models.DomainFields) (models.Route, error) {
fake.createRandomTCPRouteMutex.Lock()
fake.createRandomTCPRouteArgsForCall = append(fake.createRandomTCPRouteArgsForCall, struct {
domain models.DomainFields
}{domain})
fake.recordInvocation("CreateRandomTCPRoute", []interface{}{domain})
fake.createRandomTCPRouteMutex.Unlock()
if fake.CreateRandomTCPRouteStub != nil {
return fake.CreateRandomTCPRouteStub(domain)
} else {
return fake.createRandomTCPRouteReturns.result1, fake.createRandomTCPRouteReturns.result2
}
}
func (fake *FakeRouteActor) CreateRandomTCPRouteCallCount() int {
fake.createRandomTCPRouteMutex.RLock()
defer fake.createRandomTCPRouteMutex.RUnlock()
return len(fake.createRandomTCPRouteArgsForCall)
}
func (fake *FakeRouteActor) CreateRandomTCPRouteArgsForCall(i int) models.DomainFields {
fake.createRandomTCPRouteMutex.RLock()
defer fake.createRandomTCPRouteMutex.RUnlock()
return fake.createRandomTCPRouteArgsForCall[i].domain
}
func (fake *FakeRouteActor) CreateRandomTCPRouteReturns(result1 models.Route, result2 error) {
fake.CreateRandomTCPRouteStub = nil
fake.createRandomTCPRouteReturns = struct {
result1 models.Route
result2 error
}{result1, result2}
}
func (fake *FakeRouteActor) FindOrCreateRoute(hostname string, domain models.DomainFields, path string, port int, useRandomPort bool) (models.Route, error) {
fake.findOrCreateRouteMutex.Lock()
fake.findOrCreateRouteArgsForCall = append(fake.findOrCreateRouteArgsForCall, struct {
hostname string
domain models.DomainFields
path string
port int
useRandomPort bool
}{hostname, domain, path, port, useRandomPort})
fake.recordInvocation("FindOrCreateRoute", []interface{}{hostname, domain, path, port, useRandomPort})
fake.findOrCreateRouteMutex.Unlock()
if fake.FindOrCreateRouteStub != nil {
return fake.FindOrCreateRouteStub(hostname, domain, path, port, useRandomPort)
} else {
return fake.findOrCreateRouteReturns.result1, fake.findOrCreateRouteReturns.result2
}
}
func (fake *FakeRouteActor) FindOrCreateRouteCallCount() int {
fake.findOrCreateRouteMutex.RLock()
defer fake.findOrCreateRouteMutex.RUnlock()
return len(fake.findOrCreateRouteArgsForCall)
}
func (fake *FakeRouteActor) FindOrCreateRouteArgsForCall(i int) (string, models.DomainFields, string, int, bool) {
fake.findOrCreateRouteMutex.RLock()
defer fake.findOrCreateRouteMutex.RUnlock()
return fake.findOrCreateRouteArgsForCall[i].hostname, fake.findOrCreateRouteArgsForCall[i].domain, fake.findOrCreateRouteArgsForCall[i].path, fake.findOrCreateRouteArgsForCall[i].port, fake.findOrCreateRouteArgsForCall[i].useRandomPort
}
func (fake *FakeRouteActor) FindOrCreateRouteReturns(result1 models.Route, result2 error) {
fake.FindOrCreateRouteStub = nil
fake.findOrCreateRouteReturns = struct {
result1 models.Route
result2 error
}{result1, result2}
}
func (fake *FakeRouteActor) BindRoute(app models.Application, route models.Route) error {
fake.bindRouteMutex.Lock()
fake.bindRouteArgsForCall = append(fake.bindRouteArgsForCall, struct {
app models.Application
route models.Route
}{app, route})
fake.recordInvocation("BindRoute", []interface{}{app, route})
fake.bindRouteMutex.Unlock()
if fake.BindRouteStub != nil {
return fake.BindRouteStub(app, route)
} else {
return fake.bindRouteReturns.result1
}
}
func (fake *FakeRouteActor) BindRouteCallCount() int {
fake.bindRouteMutex.RLock()
defer fake.bindRouteMutex.RUnlock()
return len(fake.bindRouteArgsForCall)
}
func (fake *FakeRouteActor) BindRouteArgsForCall(i int) (models.Application, models.Route) {
fake.bindRouteMutex.RLock()
defer fake.bindRouteMutex.RUnlock()
return fake.bindRouteArgsForCall[i].app, fake.bindRouteArgsForCall[i].route
}
func (fake *FakeRouteActor) BindRouteReturns(result1 error) {
fake.BindRouteStub = nil
fake.bindRouteReturns = struct {
result1 error
}{result1}
}
func (fake *FakeRouteActor) UnbindAll(app models.Application) error {
fake.unbindAllMutex.Lock()
fake.unbindAllArgsForCall = append(fake.unbindAllArgsForCall, struct {
app models.Application
}{app})
fake.recordInvocation("UnbindAll", []interface{}{app})
fake.unbindAllMutex.Unlock()
if fake.UnbindAllStub != nil {
return fake.UnbindAllStub(app)
} else {
return fake.unbindAllReturns.result1
}
}
func (fake *FakeRouteActor) UnbindAllCallCount() int {
fake.unbindAllMutex.RLock()
defer fake.unbindAllMutex.RUnlock()
return len(fake.unbindAllArgsForCall)
}
func (fake *FakeRouteActor) UnbindAllArgsForCall(i int) models.Application {
fake.unbindAllMutex.RLock()
defer fake.unbindAllMutex.RUnlock()
return fake.unbindAllArgsForCall[i].app
}
func (fake *FakeRouteActor) UnbindAllReturns(result1 error) {
fake.UnbindAllStub = nil
fake.unbindAllReturns = struct {
result1 error
}{result1}
}
func (fake *FakeRouteActor) FindDomain(routeName string) (string, models.DomainFields, error) {
fake.findDomainMutex.Lock()
fake.findDomainArgsForCall = append(fake.findDomainArgsForCall, struct {
routeName string
}{routeName})
fake.recordInvocation("FindDomain", []interface{}{routeName})
fake.findDomainMutex.Unlock()
if fake.FindDomainStub != nil {
return fake.FindDomainStub(routeName)
} else {
return fake.findDomainReturns.result1, fake.findDomainReturns.result2, fake.findDomainReturns.result3
}
}
func (fake *FakeRouteActor) FindDomainCallCount() int {
fake.findDomainMutex.RLock()
defer fake.findDomainMutex.RUnlock()
return len(fake.findDomainArgsForCall)
}
func (fake *FakeRouteActor) FindDomainArgsForCall(i int) string {
fake.findDomainMutex.RLock()
defer fake.findDomainMutex.RUnlock()
return fake.findDomainArgsForCall[i].routeName
}
func (fake *FakeRouteActor) FindDomainReturns(result1 string, result2 models.DomainFields, result3 error) {
fake.FindDomainStub = nil
fake.findDomainReturns = struct {
result1 string
result2 models.DomainFields
result3 error
}{result1, result2, result3}
}
func (fake *FakeRouteActor) FindPath(routeName string) (string, string) {
fake.findPathMutex.Lock()
fake.findPathArgsForCall = append(fake.findPathArgsForCall, struct {
routeName string
}{routeName})
fake.recordInvocation("FindPath", []interface{}{routeName})
fake.findPathMutex.Unlock()
if fake.FindPathStub != nil {
return fake.FindPathStub(routeName)
} else {
return fake.findPathReturns.result1, fake.findPathReturns.result2
}
}
func (fake *FakeRouteActor) FindPathCallCount() int {
fake.findPathMutex.RLock()
defer fake.findPathMutex.RUnlock()
return len(fake.findPathArgsForCall)
}
func (fake *FakeRouteActor) FindPathArgsForCall(i int) string {
fake.findPathMutex.RLock()
defer fake.findPathMutex.RUnlock()
return fake.findPathArgsForCall[i].routeName
}
func (fake *FakeRouteActor) FindPathReturns(result1 string, result2 string) {
fake.FindPathStub = nil
fake.findPathReturns = struct {
result1 string
result2 string
}{result1, result2}
}
func (fake *FakeRouteActor) FindPort(routeName string) (string, int, error) {
fake.findPortMutex.Lock()
fake.findPortArgsForCall = append(fake.findPortArgsForCall, struct {
routeName string
}{routeName})
fake.recordInvocation("FindPort", []interface{}{routeName})
fake.findPortMutex.Unlock()
if fake.FindPortStub != nil {
return fake.FindPortStub(routeName)
} else {
return fake.findPortReturns.result1, fake.findPortReturns.result2, fake.findPortReturns.result3
}
}
func (fake *FakeRouteActor) FindPortCallCount() int {
fake.findPortMutex.RLock()
defer fake.findPortMutex.RUnlock()
return len(fake.findPortArgsForCall)
}
func (fake *FakeRouteActor) FindPortArgsForCall(i int) string {
fake.findPortMutex.RLock()
defer fake.findPortMutex.RUnlock()
return fake.findPortArgsForCall[i].routeName
}
func (fake *FakeRouteActor) FindPortReturns(result1 string, result2 int, result3 error) {
fake.FindPortStub = nil
fake.findPortReturns = struct {
result1 string
result2 int
result3 error
}{result1, result2, result3}
}
func (fake *FakeRouteActor) FindAndBindRoute(routeName string, app models.Application, appParamsFromContext models.AppParams) error {
fake.findAndBindRouteMutex.Lock()
fake.findAndBindRouteArgsForCall = append(fake.findAndBindRouteArgsForCall, struct {
routeName string
app models.Application
appParamsFromContext models.AppParams
}{routeName, app, appParamsFromContext})
fake.recordInvocation("FindAndBindRoute", []interface{}{routeName, app, appParamsFromContext})
fake.findAndBindRouteMutex.Unlock()
if fake.FindAndBindRouteStub != nil {
return fake.FindAndBindRouteStub(routeName, app, appParamsFromContext)
} else {
return fake.findAndBindRouteReturns.result1
}
}
func (fake *FakeRouteActor) FindAndBindRouteCallCount() int {
fake.findAndBindRouteMutex.RLock()
defer fake.findAndBindRouteMutex.RUnlock()
return len(fake.findAndBindRouteArgsForCall)
}
func (fake *FakeRouteActor) FindAndBindRouteArgsForCall(i int) (string, models.Application, models.AppParams) {
fake.findAndBindRouteMutex.RLock()
defer fake.findAndBindRouteMutex.RUnlock()
return fake.findAndBindRouteArgsForCall[i].routeName, fake.findAndBindRouteArgsForCall[i].app, fake.findAndBindRouteArgsForCall[i].appParamsFromContext
}
func (fake *FakeRouteActor) FindAndBindRouteReturns(result1 error) {
fake.FindAndBindRouteStub = nil
fake.findAndBindRouteReturns = struct {
result1 error
}{result1}
}
func (fake *FakeRouteActor) Invocations() map[string][][]interface{} {
fake.invocationsMutex.RLock()
defer fake.invocationsMutex.RUnlock()
fake.createRandomTCPRouteMutex.RLock()
defer fake.createRandomTCPRouteMutex.RUnlock()
fake.findOrCreateRouteMutex.RLock()
defer fake.findOrCreateRouteMutex.RUnlock()
fake.bindRouteMutex.RLock()
defer fake.bindRouteMutex.RUnlock()
fake.unbindAllMutex.RLock()
defer fake.unbindAllMutex.RUnlock()
fake.findDomainMutex.RLock()
defer fake.findDomainMutex.RUnlock()
fake.findPathMutex.RLock()
defer fake.findPathMutex.RUnlock()
fake.findPortMutex.RLock()
defer fake.findPortMutex.RUnlock()
fake.findAndBindRouteMutex.RLock()
defer fake.findAndBindRouteMutex.RUnlock()
return fake.invocations
}
func (fake *FakeRouteActor) 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 _ actors.RouteActor = new(FakeRouteActor)