-
Notifications
You must be signed in to change notification settings - Fork 0
/
response_sender.go
184 lines (166 loc) · 5.58 KB
/
response_sender.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
// Code generated by counterfeiter. DO NOT EDIT.
package mock
import (
sync "sync"
deliver "github.com/hyperledger/fabric/common/deliver"
common "github.com/hyperledger/fabric/protos/common"
)
type ResponseSender struct {
SendBlockResponseStub func(*common.Block) error
sendBlockResponseMutex sync.RWMutex
sendBlockResponseArgsForCall []struct {
arg1 *common.Block
}
sendBlockResponseReturns struct {
result1 error
}
sendBlockResponseReturnsOnCall map[int]struct {
result1 error
}
SendStatusResponseStub func(common.Status) error
sendStatusResponseMutex sync.RWMutex
sendStatusResponseArgsForCall []struct {
arg1 common.Status
}
sendStatusResponseReturns struct {
result1 error
}
sendStatusResponseReturnsOnCall map[int]struct {
result1 error
}
invocations map[string][][]interface{}
invocationsMutex sync.RWMutex
}
func (fake *ResponseSender) SendBlockResponse(arg1 *common.Block) error {
fake.sendBlockResponseMutex.Lock()
ret, specificReturn := fake.sendBlockResponseReturnsOnCall[len(fake.sendBlockResponseArgsForCall)]
fake.sendBlockResponseArgsForCall = append(fake.sendBlockResponseArgsForCall, struct {
arg1 *common.Block
}{arg1})
fake.recordInvocation("SendBlockResponse", []interface{}{arg1})
fake.sendBlockResponseMutex.Unlock()
if fake.SendBlockResponseStub != nil {
return fake.SendBlockResponseStub(arg1)
}
if specificReturn {
return ret.result1
}
fakeReturns := fake.sendBlockResponseReturns
return fakeReturns.result1
}
func (fake *ResponseSender) SendBlockResponseCallCount() int {
fake.sendBlockResponseMutex.RLock()
defer fake.sendBlockResponseMutex.RUnlock()
return len(fake.sendBlockResponseArgsForCall)
}
func (fake *ResponseSender) SendBlockResponseCalls(stub func(*common.Block) error) {
fake.sendBlockResponseMutex.Lock()
defer fake.sendBlockResponseMutex.Unlock()
fake.SendBlockResponseStub = stub
}
func (fake *ResponseSender) SendBlockResponseArgsForCall(i int) *common.Block {
fake.sendBlockResponseMutex.RLock()
defer fake.sendBlockResponseMutex.RUnlock()
argsForCall := fake.sendBlockResponseArgsForCall[i]
return argsForCall.arg1
}
func (fake *ResponseSender) SendBlockResponseReturns(result1 error) {
fake.sendBlockResponseMutex.Lock()
defer fake.sendBlockResponseMutex.Unlock()
fake.SendBlockResponseStub = nil
fake.sendBlockResponseReturns = struct {
result1 error
}{result1}
}
func (fake *ResponseSender) SendBlockResponseReturnsOnCall(i int, result1 error) {
fake.sendBlockResponseMutex.Lock()
defer fake.sendBlockResponseMutex.Unlock()
fake.SendBlockResponseStub = nil
if fake.sendBlockResponseReturnsOnCall == nil {
fake.sendBlockResponseReturnsOnCall = make(map[int]struct {
result1 error
})
}
fake.sendBlockResponseReturnsOnCall[i] = struct {
result1 error
}{result1}
}
func (fake *ResponseSender) SendStatusResponse(arg1 common.Status) error {
fake.sendStatusResponseMutex.Lock()
ret, specificReturn := fake.sendStatusResponseReturnsOnCall[len(fake.sendStatusResponseArgsForCall)]
fake.sendStatusResponseArgsForCall = append(fake.sendStatusResponseArgsForCall, struct {
arg1 common.Status
}{arg1})
fake.recordInvocation("SendStatusResponse", []interface{}{arg1})
fake.sendStatusResponseMutex.Unlock()
if fake.SendStatusResponseStub != nil {
return fake.SendStatusResponseStub(arg1)
}
if specificReturn {
return ret.result1
}
fakeReturns := fake.sendStatusResponseReturns
return fakeReturns.result1
}
func (fake *ResponseSender) SendStatusResponseCallCount() int {
fake.sendStatusResponseMutex.RLock()
defer fake.sendStatusResponseMutex.RUnlock()
return len(fake.sendStatusResponseArgsForCall)
}
func (fake *ResponseSender) SendStatusResponseCalls(stub func(common.Status) error) {
fake.sendStatusResponseMutex.Lock()
defer fake.sendStatusResponseMutex.Unlock()
fake.SendStatusResponseStub = stub
}
func (fake *ResponseSender) SendStatusResponseArgsForCall(i int) common.Status {
fake.sendStatusResponseMutex.RLock()
defer fake.sendStatusResponseMutex.RUnlock()
argsForCall := fake.sendStatusResponseArgsForCall[i]
return argsForCall.arg1
}
func (fake *ResponseSender) SendStatusResponseReturns(result1 error) {
fake.sendStatusResponseMutex.Lock()
defer fake.sendStatusResponseMutex.Unlock()
fake.SendStatusResponseStub = nil
fake.sendStatusResponseReturns = struct {
result1 error
}{result1}
}
func (fake *ResponseSender) SendStatusResponseReturnsOnCall(i int, result1 error) {
fake.sendStatusResponseMutex.Lock()
defer fake.sendStatusResponseMutex.Unlock()
fake.SendStatusResponseStub = nil
if fake.sendStatusResponseReturnsOnCall == nil {
fake.sendStatusResponseReturnsOnCall = make(map[int]struct {
result1 error
})
}
fake.sendStatusResponseReturnsOnCall[i] = struct {
result1 error
}{result1}
}
func (fake *ResponseSender) Invocations() map[string][][]interface{} {
fake.invocationsMutex.RLock()
defer fake.invocationsMutex.RUnlock()
fake.sendBlockResponseMutex.RLock()
defer fake.sendBlockResponseMutex.RUnlock()
fake.sendStatusResponseMutex.RLock()
defer fake.sendStatusResponseMutex.RUnlock()
copiedInvocations := map[string][][]interface{}{}
for key, value := range fake.invocations {
copiedInvocations[key] = value
}
return copiedInvocations
}
func (fake *ResponseSender) 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 _ deliver.ResponseSender = new(ResponseSender)