-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathfakeendpoint.go
513 lines (473 loc) · 13.9 KB
/
fakeendpoint.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
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
// SPDX-FileCopyrightText: 2021 Henry Bubert
//
// SPDX-License-Identifier: MIT
// Code generated by counterfeiter. DO NOT EDIT.
package muxrpc
import (
"context"
"net"
"sync"
)
type FakeEndpoint struct {
AsyncStub func(context.Context, interface{}, RequestEncoding, Method, ...interface{}) error
asyncMutex sync.RWMutex
asyncArgsForCall []struct {
arg1 context.Context
arg2 interface{}
arg3 RequestEncoding
arg4 Method
arg5 []interface{}
}
asyncReturns struct {
result1 error
}
asyncReturnsOnCall map[int]struct {
result1 error
}
DuplexStub func(context.Context, RequestEncoding, Method, ...interface{}) (*ByteSource, *ByteSink, error)
duplexMutex sync.RWMutex
duplexArgsForCall []struct {
arg1 context.Context
arg2 RequestEncoding
arg3 Method
arg4 []interface{}
}
duplexReturns struct {
result1 *ByteSource
result2 *ByteSink
result3 error
}
duplexReturnsOnCall map[int]struct {
result1 *ByteSource
result2 *ByteSink
result3 error
}
RemoteStub func() net.Addr
remoteMutex sync.RWMutex
remoteArgsForCall []struct {
}
remoteReturns struct {
result1 net.Addr
}
remoteReturnsOnCall map[int]struct {
result1 net.Addr
}
SinkStub func(context.Context, RequestEncoding, Method, ...interface{}) (*ByteSink, error)
sinkMutex sync.RWMutex
sinkArgsForCall []struct {
arg1 context.Context
arg2 RequestEncoding
arg3 Method
arg4 []interface{}
}
sinkReturns struct {
result1 *ByteSink
result2 error
}
sinkReturnsOnCall map[int]struct {
result1 *ByteSink
result2 error
}
SourceStub func(context.Context, RequestEncoding, Method, ...interface{}) (*ByteSource, error)
sourceMutex sync.RWMutex
sourceArgsForCall []struct {
arg1 context.Context
arg2 RequestEncoding
arg3 Method
arg4 []interface{}
}
sourceReturns struct {
result1 *ByteSource
result2 error
}
sourceReturnsOnCall map[int]struct {
result1 *ByteSource
result2 error
}
TerminateStub func() error
terminateMutex sync.RWMutex
terminateArgsForCall []struct {
}
terminateReturns struct {
result1 error
}
terminateReturnsOnCall map[int]struct {
result1 error
}
invocations map[string][][]interface{}
invocationsMutex sync.RWMutex
}
func (fake *FakeEndpoint) Async(arg1 context.Context, arg2 interface{}, arg3 RequestEncoding, arg4 Method, arg5 ...interface{}) error {
fake.asyncMutex.Lock()
ret, specificReturn := fake.asyncReturnsOnCall[len(fake.asyncArgsForCall)]
fake.asyncArgsForCall = append(fake.asyncArgsForCall, struct {
arg1 context.Context
arg2 interface{}
arg3 RequestEncoding
arg4 Method
arg5 []interface{}
}{arg1, arg2, arg3, arg4, arg5})
stub := fake.AsyncStub
fakeReturns := fake.asyncReturns
fake.recordInvocation("Async", []interface{}{arg1, arg2, arg3, arg4, arg5})
fake.asyncMutex.Unlock()
if stub != nil {
return stub(arg1, arg2, arg3, arg4, arg5...)
}
if specificReturn {
return ret.result1
}
return fakeReturns.result1
}
func (fake *FakeEndpoint) AsyncCallCount() int {
fake.asyncMutex.RLock()
defer fake.asyncMutex.RUnlock()
return len(fake.asyncArgsForCall)
}
func (fake *FakeEndpoint) AsyncCalls(stub func(context.Context, interface{}, RequestEncoding, Method, ...interface{}) error) {
fake.asyncMutex.Lock()
defer fake.asyncMutex.Unlock()
fake.AsyncStub = stub
}
func (fake *FakeEndpoint) AsyncArgsForCall(i int) (context.Context, interface{}, RequestEncoding, Method, []interface{}) {
fake.asyncMutex.RLock()
defer fake.asyncMutex.RUnlock()
argsForCall := fake.asyncArgsForCall[i]
return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3, argsForCall.arg4, argsForCall.arg5
}
func (fake *FakeEndpoint) AsyncReturns(result1 error) {
fake.asyncMutex.Lock()
defer fake.asyncMutex.Unlock()
fake.AsyncStub = nil
fake.asyncReturns = struct {
result1 error
}{result1}
}
func (fake *FakeEndpoint) AsyncReturnsOnCall(i int, result1 error) {
fake.asyncMutex.Lock()
defer fake.asyncMutex.Unlock()
fake.AsyncStub = nil
if fake.asyncReturnsOnCall == nil {
fake.asyncReturnsOnCall = make(map[int]struct {
result1 error
})
}
fake.asyncReturnsOnCall[i] = struct {
result1 error
}{result1}
}
func (fake *FakeEndpoint) Duplex(arg1 context.Context, arg2 RequestEncoding, arg3 Method, arg4 ...interface{}) (*ByteSource, *ByteSink, error) {
fake.duplexMutex.Lock()
ret, specificReturn := fake.duplexReturnsOnCall[len(fake.duplexArgsForCall)]
fake.duplexArgsForCall = append(fake.duplexArgsForCall, struct {
arg1 context.Context
arg2 RequestEncoding
arg3 Method
arg4 []interface{}
}{arg1, arg2, arg3, arg4})
stub := fake.DuplexStub
fakeReturns := fake.duplexReturns
fake.recordInvocation("Duplex", []interface{}{arg1, arg2, arg3, arg4})
fake.duplexMutex.Unlock()
if stub != nil {
return stub(arg1, arg2, arg3, arg4...)
}
if specificReturn {
return ret.result1, ret.result2, ret.result3
}
return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3
}
func (fake *FakeEndpoint) DuplexCallCount() int {
fake.duplexMutex.RLock()
defer fake.duplexMutex.RUnlock()
return len(fake.duplexArgsForCall)
}
func (fake *FakeEndpoint) DuplexCalls(stub func(context.Context, RequestEncoding, Method, ...interface{}) (*ByteSource, *ByteSink, error)) {
fake.duplexMutex.Lock()
defer fake.duplexMutex.Unlock()
fake.DuplexStub = stub
}
func (fake *FakeEndpoint) DuplexArgsForCall(i int) (context.Context, RequestEncoding, Method, []interface{}) {
fake.duplexMutex.RLock()
defer fake.duplexMutex.RUnlock()
argsForCall := fake.duplexArgsForCall[i]
return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3, argsForCall.arg4
}
func (fake *FakeEndpoint) DuplexReturns(result1 *ByteSource, result2 *ByteSink, result3 error) {
fake.duplexMutex.Lock()
defer fake.duplexMutex.Unlock()
fake.DuplexStub = nil
fake.duplexReturns = struct {
result1 *ByteSource
result2 *ByteSink
result3 error
}{result1, result2, result3}
}
func (fake *FakeEndpoint) DuplexReturnsOnCall(i int, result1 *ByteSource, result2 *ByteSink, result3 error) {
fake.duplexMutex.Lock()
defer fake.duplexMutex.Unlock()
fake.DuplexStub = nil
if fake.duplexReturnsOnCall == nil {
fake.duplexReturnsOnCall = make(map[int]struct {
result1 *ByteSource
result2 *ByteSink
result3 error
})
}
fake.duplexReturnsOnCall[i] = struct {
result1 *ByteSource
result2 *ByteSink
result3 error
}{result1, result2, result3}
}
func (fake *FakeEndpoint) Remote() net.Addr {
fake.remoteMutex.Lock()
ret, specificReturn := fake.remoteReturnsOnCall[len(fake.remoteArgsForCall)]
fake.remoteArgsForCall = append(fake.remoteArgsForCall, struct {
}{})
stub := fake.RemoteStub
fakeReturns := fake.remoteReturns
fake.recordInvocation("Remote", []interface{}{})
fake.remoteMutex.Unlock()
if stub != nil {
return stub()
}
if specificReturn {
return ret.result1
}
return fakeReturns.result1
}
func (fake *FakeEndpoint) RemoteCallCount() int {
fake.remoteMutex.RLock()
defer fake.remoteMutex.RUnlock()
return len(fake.remoteArgsForCall)
}
func (fake *FakeEndpoint) RemoteCalls(stub func() net.Addr) {
fake.remoteMutex.Lock()
defer fake.remoteMutex.Unlock()
fake.RemoteStub = stub
}
func (fake *FakeEndpoint) RemoteReturns(result1 net.Addr) {
fake.remoteMutex.Lock()
defer fake.remoteMutex.Unlock()
fake.RemoteStub = nil
fake.remoteReturns = struct {
result1 net.Addr
}{result1}
}
func (fake *FakeEndpoint) RemoteReturnsOnCall(i int, result1 net.Addr) {
fake.remoteMutex.Lock()
defer fake.remoteMutex.Unlock()
fake.RemoteStub = nil
if fake.remoteReturnsOnCall == nil {
fake.remoteReturnsOnCall = make(map[int]struct {
result1 net.Addr
})
}
fake.remoteReturnsOnCall[i] = struct {
result1 net.Addr
}{result1}
}
func (fake *FakeEndpoint) Sink(arg1 context.Context, arg2 RequestEncoding, arg3 Method, arg4 ...interface{}) (*ByteSink, error) {
fake.sinkMutex.Lock()
ret, specificReturn := fake.sinkReturnsOnCall[len(fake.sinkArgsForCall)]
fake.sinkArgsForCall = append(fake.sinkArgsForCall, struct {
arg1 context.Context
arg2 RequestEncoding
arg3 Method
arg4 []interface{}
}{arg1, arg2, arg3, arg4})
stub := fake.SinkStub
fakeReturns := fake.sinkReturns
fake.recordInvocation("Sink", []interface{}{arg1, arg2, arg3, arg4})
fake.sinkMutex.Unlock()
if stub != nil {
return stub(arg1, arg2, arg3, arg4...)
}
if specificReturn {
return ret.result1, ret.result2
}
return fakeReturns.result1, fakeReturns.result2
}
func (fake *FakeEndpoint) SinkCallCount() int {
fake.sinkMutex.RLock()
defer fake.sinkMutex.RUnlock()
return len(fake.sinkArgsForCall)
}
func (fake *FakeEndpoint) SinkCalls(stub func(context.Context, RequestEncoding, Method, ...interface{}) (*ByteSink, error)) {
fake.sinkMutex.Lock()
defer fake.sinkMutex.Unlock()
fake.SinkStub = stub
}
func (fake *FakeEndpoint) SinkArgsForCall(i int) (context.Context, RequestEncoding, Method, []interface{}) {
fake.sinkMutex.RLock()
defer fake.sinkMutex.RUnlock()
argsForCall := fake.sinkArgsForCall[i]
return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3, argsForCall.arg4
}
func (fake *FakeEndpoint) SinkReturns(result1 *ByteSink, result2 error) {
fake.sinkMutex.Lock()
defer fake.sinkMutex.Unlock()
fake.SinkStub = nil
fake.sinkReturns = struct {
result1 *ByteSink
result2 error
}{result1, result2}
}
func (fake *FakeEndpoint) SinkReturnsOnCall(i int, result1 *ByteSink, result2 error) {
fake.sinkMutex.Lock()
defer fake.sinkMutex.Unlock()
fake.SinkStub = nil
if fake.sinkReturnsOnCall == nil {
fake.sinkReturnsOnCall = make(map[int]struct {
result1 *ByteSink
result2 error
})
}
fake.sinkReturnsOnCall[i] = struct {
result1 *ByteSink
result2 error
}{result1, result2}
}
func (fake *FakeEndpoint) Source(arg1 context.Context, arg2 RequestEncoding, arg3 Method, arg4 ...interface{}) (*ByteSource, error) {
fake.sourceMutex.Lock()
ret, specificReturn := fake.sourceReturnsOnCall[len(fake.sourceArgsForCall)]
fake.sourceArgsForCall = append(fake.sourceArgsForCall, struct {
arg1 context.Context
arg2 RequestEncoding
arg3 Method
arg4 []interface{}
}{arg1, arg2, arg3, arg4})
stub := fake.SourceStub
fakeReturns := fake.sourceReturns
fake.recordInvocation("Source", []interface{}{arg1, arg2, arg3, arg4})
fake.sourceMutex.Unlock()
if stub != nil {
return stub(arg1, arg2, arg3, arg4...)
}
if specificReturn {
return ret.result1, ret.result2
}
return fakeReturns.result1, fakeReturns.result2
}
func (fake *FakeEndpoint) SourceCallCount() int {
fake.sourceMutex.RLock()
defer fake.sourceMutex.RUnlock()
return len(fake.sourceArgsForCall)
}
func (fake *FakeEndpoint) SourceCalls(stub func(context.Context, RequestEncoding, Method, ...interface{}) (*ByteSource, error)) {
fake.sourceMutex.Lock()
defer fake.sourceMutex.Unlock()
fake.SourceStub = stub
}
func (fake *FakeEndpoint) SourceArgsForCall(i int) (context.Context, RequestEncoding, Method, []interface{}) {
fake.sourceMutex.RLock()
defer fake.sourceMutex.RUnlock()
argsForCall := fake.sourceArgsForCall[i]
return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3, argsForCall.arg4
}
func (fake *FakeEndpoint) SourceReturns(result1 *ByteSource, result2 error) {
fake.sourceMutex.Lock()
defer fake.sourceMutex.Unlock()
fake.SourceStub = nil
fake.sourceReturns = struct {
result1 *ByteSource
result2 error
}{result1, result2}
}
func (fake *FakeEndpoint) SourceReturnsOnCall(i int, result1 *ByteSource, result2 error) {
fake.sourceMutex.Lock()
defer fake.sourceMutex.Unlock()
fake.SourceStub = nil
if fake.sourceReturnsOnCall == nil {
fake.sourceReturnsOnCall = make(map[int]struct {
result1 *ByteSource
result2 error
})
}
fake.sourceReturnsOnCall[i] = struct {
result1 *ByteSource
result2 error
}{result1, result2}
}
func (fake *FakeEndpoint) Terminate() error {
fake.terminateMutex.Lock()
ret, specificReturn := fake.terminateReturnsOnCall[len(fake.terminateArgsForCall)]
fake.terminateArgsForCall = append(fake.terminateArgsForCall, struct {
}{})
stub := fake.TerminateStub
fakeReturns := fake.terminateReturns
fake.recordInvocation("Terminate", []interface{}{})
fake.terminateMutex.Unlock()
if stub != nil {
return stub()
}
if specificReturn {
return ret.result1
}
return fakeReturns.result1
}
func (fake *FakeEndpoint) TerminateCallCount() int {
fake.terminateMutex.RLock()
defer fake.terminateMutex.RUnlock()
return len(fake.terminateArgsForCall)
}
func (fake *FakeEndpoint) TerminateCalls(stub func() error) {
fake.terminateMutex.Lock()
defer fake.terminateMutex.Unlock()
fake.TerminateStub = stub
}
func (fake *FakeEndpoint) TerminateReturns(result1 error) {
fake.terminateMutex.Lock()
defer fake.terminateMutex.Unlock()
fake.TerminateStub = nil
fake.terminateReturns = struct {
result1 error
}{result1}
}
func (fake *FakeEndpoint) TerminateReturnsOnCall(i int, result1 error) {
fake.terminateMutex.Lock()
defer fake.terminateMutex.Unlock()
fake.TerminateStub = nil
if fake.terminateReturnsOnCall == nil {
fake.terminateReturnsOnCall = make(map[int]struct {
result1 error
})
}
fake.terminateReturnsOnCall[i] = struct {
result1 error
}{result1}
}
func (fake *FakeEndpoint) Invocations() map[string][][]interface{} {
fake.invocationsMutex.RLock()
defer fake.invocationsMutex.RUnlock()
fake.asyncMutex.RLock()
defer fake.asyncMutex.RUnlock()
fake.duplexMutex.RLock()
defer fake.duplexMutex.RUnlock()
fake.remoteMutex.RLock()
defer fake.remoteMutex.RUnlock()
fake.sinkMutex.RLock()
defer fake.sinkMutex.RUnlock()
fake.sourceMutex.RLock()
defer fake.sourceMutex.RUnlock()
fake.terminateMutex.RLock()
defer fake.terminateMutex.RUnlock()
copiedInvocations := map[string][][]interface{}{}
for key, value := range fake.invocations {
copiedInvocations[key] = value
}
return copiedInvocations
}
func (fake *FakeEndpoint) 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 _ Endpoint = new(FakeEndpoint)