-
Notifications
You must be signed in to change notification settings - Fork 17
/
fake_service.go
246 lines (221 loc) · 6.12 KB
/
fake_service.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
// This file was generated by counterfeiter
package apihubfakes
import (
"sync"
"time"
"github.com/apihub/apihub"
)
type FakeService struct {
HostStub func() string
hostMutex sync.RWMutex
hostArgsForCall []struct{}
hostReturns struct {
result1 string
}
StartStub func() error
startMutex sync.RWMutex
startArgsForCall []struct{}
startReturns struct {
result1 error
}
StopStub func() error
stopMutex sync.RWMutex
stopArgsForCall []struct{}
stopReturns struct {
result1 error
}
InfoStub func() (apihub.ServiceSpec, error)
infoMutex sync.RWMutex
infoArgsForCall []struct{}
infoReturns struct {
result1 apihub.ServiceSpec
result2 error
}
BackendsStub func() ([]apihub.BackendInfo, error)
backendsMutex sync.RWMutex
backendsArgsForCall []struct{}
backendsReturns struct {
result1 []apihub.BackendInfo
result2 error
}
SetTimeoutStub func(time.Duration) error
setTimeoutMutex sync.RWMutex
setTimeoutArgsForCall []struct {
arg1 time.Duration
}
setTimeoutReturns struct {
result1 error
}
invocations map[string][][]interface{}
invocationsMutex sync.RWMutex
}
func (fake *FakeService) Host() string {
fake.hostMutex.Lock()
fake.hostArgsForCall = append(fake.hostArgsForCall, struct{}{})
fake.recordInvocation("Host", []interface{}{})
fake.hostMutex.Unlock()
if fake.HostStub != nil {
return fake.HostStub()
} else {
return fake.hostReturns.result1
}
}
func (fake *FakeService) HostCallCount() int {
fake.hostMutex.RLock()
defer fake.hostMutex.RUnlock()
return len(fake.hostArgsForCall)
}
func (fake *FakeService) HostReturns(result1 string) {
fake.HostStub = nil
fake.hostReturns = struct {
result1 string
}{result1}
}
func (fake *FakeService) Start() error {
fake.startMutex.Lock()
fake.startArgsForCall = append(fake.startArgsForCall, struct{}{})
fake.recordInvocation("Start", []interface{}{})
fake.startMutex.Unlock()
if fake.StartStub != nil {
return fake.StartStub()
} else {
return fake.startReturns.result1
}
}
func (fake *FakeService) StartCallCount() int {
fake.startMutex.RLock()
defer fake.startMutex.RUnlock()
return len(fake.startArgsForCall)
}
func (fake *FakeService) StartReturns(result1 error) {
fake.StartStub = nil
fake.startReturns = struct {
result1 error
}{result1}
}
func (fake *FakeService) Stop() error {
fake.stopMutex.Lock()
fake.stopArgsForCall = append(fake.stopArgsForCall, struct{}{})
fake.recordInvocation("Stop", []interface{}{})
fake.stopMutex.Unlock()
if fake.StopStub != nil {
return fake.StopStub()
} else {
return fake.stopReturns.result1
}
}
func (fake *FakeService) StopCallCount() int {
fake.stopMutex.RLock()
defer fake.stopMutex.RUnlock()
return len(fake.stopArgsForCall)
}
func (fake *FakeService) StopReturns(result1 error) {
fake.StopStub = nil
fake.stopReturns = struct {
result1 error
}{result1}
}
func (fake *FakeService) Info() (apihub.ServiceSpec, error) {
fake.infoMutex.Lock()
fake.infoArgsForCall = append(fake.infoArgsForCall, struct{}{})
fake.recordInvocation("Info", []interface{}{})
fake.infoMutex.Unlock()
if fake.InfoStub != nil {
return fake.InfoStub()
} else {
return fake.infoReturns.result1, fake.infoReturns.result2
}
}
func (fake *FakeService) InfoCallCount() int {
fake.infoMutex.RLock()
defer fake.infoMutex.RUnlock()
return len(fake.infoArgsForCall)
}
func (fake *FakeService) InfoReturns(result1 apihub.ServiceSpec, result2 error) {
fake.InfoStub = nil
fake.infoReturns = struct {
result1 apihub.ServiceSpec
result2 error
}{result1, result2}
}
func (fake *FakeService) Backends() ([]apihub.BackendInfo, error) {
fake.backendsMutex.Lock()
fake.backendsArgsForCall = append(fake.backendsArgsForCall, struct{}{})
fake.recordInvocation("Backends", []interface{}{})
fake.backendsMutex.Unlock()
if fake.BackendsStub != nil {
return fake.BackendsStub()
} else {
return fake.backendsReturns.result1, fake.backendsReturns.result2
}
}
func (fake *FakeService) BackendsCallCount() int {
fake.backendsMutex.RLock()
defer fake.backendsMutex.RUnlock()
return len(fake.backendsArgsForCall)
}
func (fake *FakeService) BackendsReturns(result1 []apihub.BackendInfo, result2 error) {
fake.BackendsStub = nil
fake.backendsReturns = struct {
result1 []apihub.BackendInfo
result2 error
}{result1, result2}
}
func (fake *FakeService) SetTimeout(arg1 time.Duration) error {
fake.setTimeoutMutex.Lock()
fake.setTimeoutArgsForCall = append(fake.setTimeoutArgsForCall, struct {
arg1 time.Duration
}{arg1})
fake.recordInvocation("SetTimeout", []interface{}{arg1})
fake.setTimeoutMutex.Unlock()
if fake.SetTimeoutStub != nil {
return fake.SetTimeoutStub(arg1)
} else {
return fake.setTimeoutReturns.result1
}
}
func (fake *FakeService) SetTimeoutCallCount() int {
fake.setTimeoutMutex.RLock()
defer fake.setTimeoutMutex.RUnlock()
return len(fake.setTimeoutArgsForCall)
}
func (fake *FakeService) SetTimeoutArgsForCall(i int) time.Duration {
fake.setTimeoutMutex.RLock()
defer fake.setTimeoutMutex.RUnlock()
return fake.setTimeoutArgsForCall[i].arg1
}
func (fake *FakeService) SetTimeoutReturns(result1 error) {
fake.SetTimeoutStub = nil
fake.setTimeoutReturns = struct {
result1 error
}{result1}
}
func (fake *FakeService) Invocations() map[string][][]interface{} {
fake.invocationsMutex.RLock()
defer fake.invocationsMutex.RUnlock()
fake.hostMutex.RLock()
defer fake.hostMutex.RUnlock()
fake.startMutex.RLock()
defer fake.startMutex.RUnlock()
fake.stopMutex.RLock()
defer fake.stopMutex.RUnlock()
fake.infoMutex.RLock()
defer fake.infoMutex.RUnlock()
fake.backendsMutex.RLock()
defer fake.backendsMutex.RUnlock()
fake.setTimeoutMutex.RLock()
defer fake.setTimeoutMutex.RUnlock()
return fake.invocations
}
func (fake *FakeService) 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 _ apihub.Service = new(FakeService)