github.com/ewagmig/fabric@v2.1.1+incompatible/common/deliver/mock/response_sender.go (about) 1 // Code generated by counterfeiter. DO NOT EDIT. 2 package mock 3 4 import ( 5 "sync" 6 7 "github.com/hyperledger/fabric-protos-go/common" 8 "github.com/hyperledger/fabric/common/deliver" 9 "github.com/hyperledger/fabric/protoutil" 10 ) 11 12 type ResponseSender struct { 13 DataTypeStub func() string 14 dataTypeMutex sync.RWMutex 15 dataTypeArgsForCall []struct { 16 } 17 dataTypeReturns struct { 18 result1 string 19 } 20 dataTypeReturnsOnCall map[int]struct { 21 result1 string 22 } 23 SendBlockResponseStub func(*common.Block, string, deliver.Chain, *protoutil.SignedData) error 24 sendBlockResponseMutex sync.RWMutex 25 sendBlockResponseArgsForCall []struct { 26 arg1 *common.Block 27 arg2 string 28 arg3 deliver.Chain 29 arg4 *protoutil.SignedData 30 } 31 sendBlockResponseReturns struct { 32 result1 error 33 } 34 sendBlockResponseReturnsOnCall map[int]struct { 35 result1 error 36 } 37 SendStatusResponseStub func(common.Status) error 38 sendStatusResponseMutex sync.RWMutex 39 sendStatusResponseArgsForCall []struct { 40 arg1 common.Status 41 } 42 sendStatusResponseReturns struct { 43 result1 error 44 } 45 sendStatusResponseReturnsOnCall map[int]struct { 46 result1 error 47 } 48 invocations map[string][][]interface{} 49 invocationsMutex sync.RWMutex 50 } 51 52 func (fake *ResponseSender) DataType() string { 53 fake.dataTypeMutex.Lock() 54 ret, specificReturn := fake.dataTypeReturnsOnCall[len(fake.dataTypeArgsForCall)] 55 fake.dataTypeArgsForCall = append(fake.dataTypeArgsForCall, struct { 56 }{}) 57 fake.recordInvocation("DataType", []interface{}{}) 58 fake.dataTypeMutex.Unlock() 59 if fake.DataTypeStub != nil { 60 return fake.DataTypeStub() 61 } 62 if specificReturn { 63 return ret.result1 64 } 65 fakeReturns := fake.dataTypeReturns 66 return fakeReturns.result1 67 } 68 69 func (fake *ResponseSender) DataTypeCallCount() int { 70 fake.dataTypeMutex.RLock() 71 defer fake.dataTypeMutex.RUnlock() 72 return len(fake.dataTypeArgsForCall) 73 } 74 75 func (fake *ResponseSender) DataTypeCalls(stub func() string) { 76 fake.dataTypeMutex.Lock() 77 defer fake.dataTypeMutex.Unlock() 78 fake.DataTypeStub = stub 79 } 80 81 func (fake *ResponseSender) DataTypeReturns(result1 string) { 82 fake.dataTypeMutex.Lock() 83 defer fake.dataTypeMutex.Unlock() 84 fake.DataTypeStub = nil 85 fake.dataTypeReturns = struct { 86 result1 string 87 }{result1} 88 } 89 90 func (fake *ResponseSender) DataTypeReturnsOnCall(i int, result1 string) { 91 fake.dataTypeMutex.Lock() 92 defer fake.dataTypeMutex.Unlock() 93 fake.DataTypeStub = nil 94 if fake.dataTypeReturnsOnCall == nil { 95 fake.dataTypeReturnsOnCall = make(map[int]struct { 96 result1 string 97 }) 98 } 99 fake.dataTypeReturnsOnCall[i] = struct { 100 result1 string 101 }{result1} 102 } 103 104 func (fake *ResponseSender) SendBlockResponse(arg1 *common.Block, arg2 string, arg3 deliver.Chain, arg4 *protoutil.SignedData) error { 105 fake.sendBlockResponseMutex.Lock() 106 ret, specificReturn := fake.sendBlockResponseReturnsOnCall[len(fake.sendBlockResponseArgsForCall)] 107 fake.sendBlockResponseArgsForCall = append(fake.sendBlockResponseArgsForCall, struct { 108 arg1 *common.Block 109 arg2 string 110 arg3 deliver.Chain 111 arg4 *protoutil.SignedData 112 }{arg1, arg2, arg3, arg4}) 113 fake.recordInvocation("SendBlockResponse", []interface{}{arg1, arg2, arg3, arg4}) 114 fake.sendBlockResponseMutex.Unlock() 115 if fake.SendBlockResponseStub != nil { 116 return fake.SendBlockResponseStub(arg1, arg2, arg3, arg4) 117 } 118 if specificReturn { 119 return ret.result1 120 } 121 fakeReturns := fake.sendBlockResponseReturns 122 return fakeReturns.result1 123 } 124 125 func (fake *ResponseSender) SendBlockResponseCallCount() int { 126 fake.sendBlockResponseMutex.RLock() 127 defer fake.sendBlockResponseMutex.RUnlock() 128 return len(fake.sendBlockResponseArgsForCall) 129 } 130 131 func (fake *ResponseSender) SendBlockResponseCalls(stub func(*common.Block, string, deliver.Chain, *protoutil.SignedData) error) { 132 fake.sendBlockResponseMutex.Lock() 133 defer fake.sendBlockResponseMutex.Unlock() 134 fake.SendBlockResponseStub = stub 135 } 136 137 func (fake *ResponseSender) SendBlockResponseArgsForCall(i int) (*common.Block, string, deliver.Chain, *protoutil.SignedData) { 138 fake.sendBlockResponseMutex.RLock() 139 defer fake.sendBlockResponseMutex.RUnlock() 140 argsForCall := fake.sendBlockResponseArgsForCall[i] 141 return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3, argsForCall.arg4 142 } 143 144 func (fake *ResponseSender) SendBlockResponseReturns(result1 error) { 145 fake.sendBlockResponseMutex.Lock() 146 defer fake.sendBlockResponseMutex.Unlock() 147 fake.SendBlockResponseStub = nil 148 fake.sendBlockResponseReturns = struct { 149 result1 error 150 }{result1} 151 } 152 153 func (fake *ResponseSender) SendBlockResponseReturnsOnCall(i int, result1 error) { 154 fake.sendBlockResponseMutex.Lock() 155 defer fake.sendBlockResponseMutex.Unlock() 156 fake.SendBlockResponseStub = nil 157 if fake.sendBlockResponseReturnsOnCall == nil { 158 fake.sendBlockResponseReturnsOnCall = make(map[int]struct { 159 result1 error 160 }) 161 } 162 fake.sendBlockResponseReturnsOnCall[i] = struct { 163 result1 error 164 }{result1} 165 } 166 167 func (fake *ResponseSender) SendStatusResponse(arg1 common.Status) error { 168 fake.sendStatusResponseMutex.Lock() 169 ret, specificReturn := fake.sendStatusResponseReturnsOnCall[len(fake.sendStatusResponseArgsForCall)] 170 fake.sendStatusResponseArgsForCall = append(fake.sendStatusResponseArgsForCall, struct { 171 arg1 common.Status 172 }{arg1}) 173 fake.recordInvocation("SendStatusResponse", []interface{}{arg1}) 174 fake.sendStatusResponseMutex.Unlock() 175 if fake.SendStatusResponseStub != nil { 176 return fake.SendStatusResponseStub(arg1) 177 } 178 if specificReturn { 179 return ret.result1 180 } 181 fakeReturns := fake.sendStatusResponseReturns 182 return fakeReturns.result1 183 } 184 185 func (fake *ResponseSender) SendStatusResponseCallCount() int { 186 fake.sendStatusResponseMutex.RLock() 187 defer fake.sendStatusResponseMutex.RUnlock() 188 return len(fake.sendStatusResponseArgsForCall) 189 } 190 191 func (fake *ResponseSender) SendStatusResponseCalls(stub func(common.Status) error) { 192 fake.sendStatusResponseMutex.Lock() 193 defer fake.sendStatusResponseMutex.Unlock() 194 fake.SendStatusResponseStub = stub 195 } 196 197 func (fake *ResponseSender) SendStatusResponseArgsForCall(i int) common.Status { 198 fake.sendStatusResponseMutex.RLock() 199 defer fake.sendStatusResponseMutex.RUnlock() 200 argsForCall := fake.sendStatusResponseArgsForCall[i] 201 return argsForCall.arg1 202 } 203 204 func (fake *ResponseSender) SendStatusResponseReturns(result1 error) { 205 fake.sendStatusResponseMutex.Lock() 206 defer fake.sendStatusResponseMutex.Unlock() 207 fake.SendStatusResponseStub = nil 208 fake.sendStatusResponseReturns = struct { 209 result1 error 210 }{result1} 211 } 212 213 func (fake *ResponseSender) SendStatusResponseReturnsOnCall(i int, result1 error) { 214 fake.sendStatusResponseMutex.Lock() 215 defer fake.sendStatusResponseMutex.Unlock() 216 fake.SendStatusResponseStub = nil 217 if fake.sendStatusResponseReturnsOnCall == nil { 218 fake.sendStatusResponseReturnsOnCall = make(map[int]struct { 219 result1 error 220 }) 221 } 222 fake.sendStatusResponseReturnsOnCall[i] = struct { 223 result1 error 224 }{result1} 225 } 226 227 func (fake *ResponseSender) Invocations() map[string][][]interface{} { 228 fake.invocationsMutex.RLock() 229 defer fake.invocationsMutex.RUnlock() 230 fake.dataTypeMutex.RLock() 231 defer fake.dataTypeMutex.RUnlock() 232 fake.sendBlockResponseMutex.RLock() 233 defer fake.sendBlockResponseMutex.RUnlock() 234 fake.sendStatusResponseMutex.RLock() 235 defer fake.sendStatusResponseMutex.RUnlock() 236 copiedInvocations := map[string][][]interface{}{} 237 for key, value := range fake.invocations { 238 copiedInvocations[key] = value 239 } 240 return copiedInvocations 241 } 242 243 func (fake *ResponseSender) recordInvocation(key string, args []interface{}) { 244 fake.invocationsMutex.Lock() 245 defer fake.invocationsMutex.Unlock() 246 if fake.invocations == nil { 247 fake.invocations = map[string][][]interface{}{} 248 } 249 if fake.invocations[key] == nil { 250 fake.invocations[key] = [][]interface{}{} 251 } 252 fake.invocations[key] = append(fake.invocations[key], args) 253 } 254 255 var _ deliver.ResponseSender = new(ResponseSender)