-
Notifications
You must be signed in to change notification settings - Fork 224
/
fake_registry.go
272 lines (246 loc) · 7.87 KB
/
fake_registry.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
// Code generated by counterfeiter. DO NOT EDIT.
package fakes
import (
"sync"
"code.cloudfoundry.org/gorouter/registry"
"code.cloudfoundry.org/gorouter/route"
)
type FakeRegistry struct {
LookupStub func(route.Uri) *route.EndpointPool
lookupMutex sync.RWMutex
lookupArgsForCall []struct {
arg1 route.Uri
}
lookupReturns struct {
result1 *route.EndpointPool
}
lookupReturnsOnCall map[int]struct {
result1 *route.EndpointPool
}
LookupWithInstanceStub func(route.Uri, string, string) *route.EndpointPool
lookupWithInstanceMutex sync.RWMutex
lookupWithInstanceArgsForCall []struct {
arg1 route.Uri
arg2 string
arg3 string
}
lookupWithInstanceReturns struct {
result1 *route.EndpointPool
}
lookupWithInstanceReturnsOnCall map[int]struct {
result1 *route.EndpointPool
}
RegisterStub func(route.Uri, *route.Endpoint)
registerMutex sync.RWMutex
registerArgsForCall []struct {
arg1 route.Uri
arg2 *route.Endpoint
}
UnregisterStub func(route.Uri, *route.Endpoint)
unregisterMutex sync.RWMutex
unregisterArgsForCall []struct {
arg1 route.Uri
arg2 *route.Endpoint
}
invocations map[string][][]interface{}
invocationsMutex sync.RWMutex
}
func (fake *FakeRegistry) Lookup(arg1 route.Uri) *route.EndpointPool {
fake.lookupMutex.Lock()
ret, specificReturn := fake.lookupReturnsOnCall[len(fake.lookupArgsForCall)]
fake.lookupArgsForCall = append(fake.lookupArgsForCall, struct {
arg1 route.Uri
}{arg1})
stub := fake.LookupStub
fakeReturns := fake.lookupReturns
fake.recordInvocation("Lookup", []interface{}{arg1})
fake.lookupMutex.Unlock()
if stub != nil {
return stub(arg1)
}
if specificReturn {
return ret.result1
}
return fakeReturns.result1
}
func (fake *FakeRegistry) LookupCallCount() int {
fake.lookupMutex.RLock()
defer fake.lookupMutex.RUnlock()
return len(fake.lookupArgsForCall)
}
func (fake *FakeRegistry) LookupCalls(stub func(route.Uri) *route.EndpointPool) {
fake.lookupMutex.Lock()
defer fake.lookupMutex.Unlock()
fake.LookupStub = stub
}
func (fake *FakeRegistry) LookupArgsForCall(i int) route.Uri {
fake.lookupMutex.RLock()
defer fake.lookupMutex.RUnlock()
argsForCall := fake.lookupArgsForCall[i]
return argsForCall.arg1
}
func (fake *FakeRegistry) LookupReturns(result1 *route.EndpointPool) {
fake.lookupMutex.Lock()
defer fake.lookupMutex.Unlock()
fake.LookupStub = nil
fake.lookupReturns = struct {
result1 *route.EndpointPool
}{result1}
}
func (fake *FakeRegistry) LookupReturnsOnCall(i int, result1 *route.EndpointPool) {
fake.lookupMutex.Lock()
defer fake.lookupMutex.Unlock()
fake.LookupStub = nil
if fake.lookupReturnsOnCall == nil {
fake.lookupReturnsOnCall = make(map[int]struct {
result1 *route.EndpointPool
})
}
fake.lookupReturnsOnCall[i] = struct {
result1 *route.EndpointPool
}{result1}
}
func (fake *FakeRegistry) LookupWithInstance(arg1 route.Uri, arg2 string, arg3 string) *route.EndpointPool {
fake.lookupWithInstanceMutex.Lock()
ret, specificReturn := fake.lookupWithInstanceReturnsOnCall[len(fake.lookupWithInstanceArgsForCall)]
fake.lookupWithInstanceArgsForCall = append(fake.lookupWithInstanceArgsForCall, struct {
arg1 route.Uri
arg2 string
arg3 string
}{arg1, arg2, arg3})
stub := fake.LookupWithInstanceStub
fakeReturns := fake.lookupWithInstanceReturns
fake.recordInvocation("LookupWithInstance", []interface{}{arg1, arg2, arg3})
fake.lookupWithInstanceMutex.Unlock()
if stub != nil {
return stub(arg1, arg2, arg3)
}
if specificReturn {
return ret.result1
}
return fakeReturns.result1
}
func (fake *FakeRegistry) LookupWithInstanceCallCount() int {
fake.lookupWithInstanceMutex.RLock()
defer fake.lookupWithInstanceMutex.RUnlock()
return len(fake.lookupWithInstanceArgsForCall)
}
func (fake *FakeRegistry) LookupWithInstanceCalls(stub func(route.Uri, string, string) *route.EndpointPool) {
fake.lookupWithInstanceMutex.Lock()
defer fake.lookupWithInstanceMutex.Unlock()
fake.LookupWithInstanceStub = stub
}
func (fake *FakeRegistry) LookupWithInstanceArgsForCall(i int) (route.Uri, string, string) {
fake.lookupWithInstanceMutex.RLock()
defer fake.lookupWithInstanceMutex.RUnlock()
argsForCall := fake.lookupWithInstanceArgsForCall[i]
return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3
}
func (fake *FakeRegistry) LookupWithInstanceReturns(result1 *route.EndpointPool) {
fake.lookupWithInstanceMutex.Lock()
defer fake.lookupWithInstanceMutex.Unlock()
fake.LookupWithInstanceStub = nil
fake.lookupWithInstanceReturns = struct {
result1 *route.EndpointPool
}{result1}
}
func (fake *FakeRegistry) LookupWithInstanceReturnsOnCall(i int, result1 *route.EndpointPool) {
fake.lookupWithInstanceMutex.Lock()
defer fake.lookupWithInstanceMutex.Unlock()
fake.LookupWithInstanceStub = nil
if fake.lookupWithInstanceReturnsOnCall == nil {
fake.lookupWithInstanceReturnsOnCall = make(map[int]struct {
result1 *route.EndpointPool
})
}
fake.lookupWithInstanceReturnsOnCall[i] = struct {
result1 *route.EndpointPool
}{result1}
}
func (fake *FakeRegistry) Register(arg1 route.Uri, arg2 *route.Endpoint) {
fake.registerMutex.Lock()
fake.registerArgsForCall = append(fake.registerArgsForCall, struct {
arg1 route.Uri
arg2 *route.Endpoint
}{arg1, arg2})
stub := fake.RegisterStub
fake.recordInvocation("Register", []interface{}{arg1, arg2})
fake.registerMutex.Unlock()
if stub != nil {
fake.RegisterStub(arg1, arg2)
}
}
func (fake *FakeRegistry) RegisterCallCount() int {
fake.registerMutex.RLock()
defer fake.registerMutex.RUnlock()
return len(fake.registerArgsForCall)
}
func (fake *FakeRegistry) RegisterCalls(stub func(route.Uri, *route.Endpoint)) {
fake.registerMutex.Lock()
defer fake.registerMutex.Unlock()
fake.RegisterStub = stub
}
func (fake *FakeRegistry) RegisterArgsForCall(i int) (route.Uri, *route.Endpoint) {
fake.registerMutex.RLock()
defer fake.registerMutex.RUnlock()
argsForCall := fake.registerArgsForCall[i]
return argsForCall.arg1, argsForCall.arg2
}
func (fake *FakeRegistry) Unregister(arg1 route.Uri, arg2 *route.Endpoint) {
fake.unregisterMutex.Lock()
fake.unregisterArgsForCall = append(fake.unregisterArgsForCall, struct {
arg1 route.Uri
arg2 *route.Endpoint
}{arg1, arg2})
stub := fake.UnregisterStub
fake.recordInvocation("Unregister", []interface{}{arg1, arg2})
fake.unregisterMutex.Unlock()
if stub != nil {
fake.UnregisterStub(arg1, arg2)
}
}
func (fake *FakeRegistry) UnregisterCallCount() int {
fake.unregisterMutex.RLock()
defer fake.unregisterMutex.RUnlock()
return len(fake.unregisterArgsForCall)
}
func (fake *FakeRegistry) UnregisterCalls(stub func(route.Uri, *route.Endpoint)) {
fake.unregisterMutex.Lock()
defer fake.unregisterMutex.Unlock()
fake.UnregisterStub = stub
}
func (fake *FakeRegistry) UnregisterArgsForCall(i int) (route.Uri, *route.Endpoint) {
fake.unregisterMutex.RLock()
defer fake.unregisterMutex.RUnlock()
argsForCall := fake.unregisterArgsForCall[i]
return argsForCall.arg1, argsForCall.arg2
}
func (fake *FakeRegistry) Invocations() map[string][][]interface{} {
fake.invocationsMutex.RLock()
defer fake.invocationsMutex.RUnlock()
fake.lookupMutex.RLock()
defer fake.lookupMutex.RUnlock()
fake.lookupWithInstanceMutex.RLock()
defer fake.lookupWithInstanceMutex.RUnlock()
fake.registerMutex.RLock()
defer fake.registerMutex.RUnlock()
fake.unregisterMutex.RLock()
defer fake.unregisterMutex.RUnlock()
copiedInvocations := map[string][][]interface{}{}
for key, value := range fake.invocations {
copiedInvocations[key] = value
}
return copiedInvocations
}
func (fake *FakeRegistry) 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 _ registry.Registry = new(FakeRegistry)