github.com/anjalikarhana/fabric@v2.1.1+incompatible/orderer/common/broadcast/mock/ab_server.go (about) 1 // Code generated by counterfeiter. DO NOT EDIT. 2 package mock 3 4 import ( 5 "context" 6 "sync" 7 8 "github.com/hyperledger/fabric-protos-go/common" 9 "github.com/hyperledger/fabric-protos-go/orderer" 10 "google.golang.org/grpc/metadata" 11 ) 12 13 type ABServer struct { 14 ContextStub func() context.Context 15 contextMutex sync.RWMutex 16 contextArgsForCall []struct { 17 } 18 contextReturns struct { 19 result1 context.Context 20 } 21 contextReturnsOnCall map[int]struct { 22 result1 context.Context 23 } 24 RecvStub func() (*common.Envelope, error) 25 recvMutex sync.RWMutex 26 recvArgsForCall []struct { 27 } 28 recvReturns struct { 29 result1 *common.Envelope 30 result2 error 31 } 32 recvReturnsOnCall map[int]struct { 33 result1 *common.Envelope 34 result2 error 35 } 36 RecvMsgStub func(interface{}) error 37 recvMsgMutex sync.RWMutex 38 recvMsgArgsForCall []struct { 39 arg1 interface{} 40 } 41 recvMsgReturns struct { 42 result1 error 43 } 44 recvMsgReturnsOnCall map[int]struct { 45 result1 error 46 } 47 SendStub func(*orderer.BroadcastResponse) error 48 sendMutex sync.RWMutex 49 sendArgsForCall []struct { 50 arg1 *orderer.BroadcastResponse 51 } 52 sendReturns struct { 53 result1 error 54 } 55 sendReturnsOnCall map[int]struct { 56 result1 error 57 } 58 SendHeaderStub func(metadata.MD) error 59 sendHeaderMutex sync.RWMutex 60 sendHeaderArgsForCall []struct { 61 arg1 metadata.MD 62 } 63 sendHeaderReturns struct { 64 result1 error 65 } 66 sendHeaderReturnsOnCall map[int]struct { 67 result1 error 68 } 69 SendMsgStub func(interface{}) error 70 sendMsgMutex sync.RWMutex 71 sendMsgArgsForCall []struct { 72 arg1 interface{} 73 } 74 sendMsgReturns struct { 75 result1 error 76 } 77 sendMsgReturnsOnCall map[int]struct { 78 result1 error 79 } 80 SetHeaderStub func(metadata.MD) error 81 setHeaderMutex sync.RWMutex 82 setHeaderArgsForCall []struct { 83 arg1 metadata.MD 84 } 85 setHeaderReturns struct { 86 result1 error 87 } 88 setHeaderReturnsOnCall map[int]struct { 89 result1 error 90 } 91 SetTrailerStub func(metadata.MD) 92 setTrailerMutex sync.RWMutex 93 setTrailerArgsForCall []struct { 94 arg1 metadata.MD 95 } 96 invocations map[string][][]interface{} 97 invocationsMutex sync.RWMutex 98 } 99 100 func (fake *ABServer) Context() context.Context { 101 fake.contextMutex.Lock() 102 ret, specificReturn := fake.contextReturnsOnCall[len(fake.contextArgsForCall)] 103 fake.contextArgsForCall = append(fake.contextArgsForCall, struct { 104 }{}) 105 fake.recordInvocation("Context", []interface{}{}) 106 fake.contextMutex.Unlock() 107 if fake.ContextStub != nil { 108 return fake.ContextStub() 109 } 110 if specificReturn { 111 return ret.result1 112 } 113 fakeReturns := fake.contextReturns 114 return fakeReturns.result1 115 } 116 117 func (fake *ABServer) ContextCallCount() int { 118 fake.contextMutex.RLock() 119 defer fake.contextMutex.RUnlock() 120 return len(fake.contextArgsForCall) 121 } 122 123 func (fake *ABServer) ContextCalls(stub func() context.Context) { 124 fake.contextMutex.Lock() 125 defer fake.contextMutex.Unlock() 126 fake.ContextStub = stub 127 } 128 129 func (fake *ABServer) ContextReturns(result1 context.Context) { 130 fake.contextMutex.Lock() 131 defer fake.contextMutex.Unlock() 132 fake.ContextStub = nil 133 fake.contextReturns = struct { 134 result1 context.Context 135 }{result1} 136 } 137 138 func (fake *ABServer) ContextReturnsOnCall(i int, result1 context.Context) { 139 fake.contextMutex.Lock() 140 defer fake.contextMutex.Unlock() 141 fake.ContextStub = nil 142 if fake.contextReturnsOnCall == nil { 143 fake.contextReturnsOnCall = make(map[int]struct { 144 result1 context.Context 145 }) 146 } 147 fake.contextReturnsOnCall[i] = struct { 148 result1 context.Context 149 }{result1} 150 } 151 152 func (fake *ABServer) Recv() (*common.Envelope, error) { 153 fake.recvMutex.Lock() 154 ret, specificReturn := fake.recvReturnsOnCall[len(fake.recvArgsForCall)] 155 fake.recvArgsForCall = append(fake.recvArgsForCall, struct { 156 }{}) 157 fake.recordInvocation("Recv", []interface{}{}) 158 fake.recvMutex.Unlock() 159 if fake.RecvStub != nil { 160 return fake.RecvStub() 161 } 162 if specificReturn { 163 return ret.result1, ret.result2 164 } 165 fakeReturns := fake.recvReturns 166 return fakeReturns.result1, fakeReturns.result2 167 } 168 169 func (fake *ABServer) RecvCallCount() int { 170 fake.recvMutex.RLock() 171 defer fake.recvMutex.RUnlock() 172 return len(fake.recvArgsForCall) 173 } 174 175 func (fake *ABServer) RecvCalls(stub func() (*common.Envelope, error)) { 176 fake.recvMutex.Lock() 177 defer fake.recvMutex.Unlock() 178 fake.RecvStub = stub 179 } 180 181 func (fake *ABServer) RecvReturns(result1 *common.Envelope, result2 error) { 182 fake.recvMutex.Lock() 183 defer fake.recvMutex.Unlock() 184 fake.RecvStub = nil 185 fake.recvReturns = struct { 186 result1 *common.Envelope 187 result2 error 188 }{result1, result2} 189 } 190 191 func (fake *ABServer) RecvReturnsOnCall(i int, result1 *common.Envelope, result2 error) { 192 fake.recvMutex.Lock() 193 defer fake.recvMutex.Unlock() 194 fake.RecvStub = nil 195 if fake.recvReturnsOnCall == nil { 196 fake.recvReturnsOnCall = make(map[int]struct { 197 result1 *common.Envelope 198 result2 error 199 }) 200 } 201 fake.recvReturnsOnCall[i] = struct { 202 result1 *common.Envelope 203 result2 error 204 }{result1, result2} 205 } 206 207 func (fake *ABServer) RecvMsg(arg1 interface{}) error { 208 fake.recvMsgMutex.Lock() 209 ret, specificReturn := fake.recvMsgReturnsOnCall[len(fake.recvMsgArgsForCall)] 210 fake.recvMsgArgsForCall = append(fake.recvMsgArgsForCall, struct { 211 arg1 interface{} 212 }{arg1}) 213 fake.recordInvocation("RecvMsg", []interface{}{arg1}) 214 fake.recvMsgMutex.Unlock() 215 if fake.RecvMsgStub != nil { 216 return fake.RecvMsgStub(arg1) 217 } 218 if specificReturn { 219 return ret.result1 220 } 221 fakeReturns := fake.recvMsgReturns 222 return fakeReturns.result1 223 } 224 225 func (fake *ABServer) RecvMsgCallCount() int { 226 fake.recvMsgMutex.RLock() 227 defer fake.recvMsgMutex.RUnlock() 228 return len(fake.recvMsgArgsForCall) 229 } 230 231 func (fake *ABServer) RecvMsgCalls(stub func(interface{}) error) { 232 fake.recvMsgMutex.Lock() 233 defer fake.recvMsgMutex.Unlock() 234 fake.RecvMsgStub = stub 235 } 236 237 func (fake *ABServer) RecvMsgArgsForCall(i int) interface{} { 238 fake.recvMsgMutex.RLock() 239 defer fake.recvMsgMutex.RUnlock() 240 argsForCall := fake.recvMsgArgsForCall[i] 241 return argsForCall.arg1 242 } 243 244 func (fake *ABServer) RecvMsgReturns(result1 error) { 245 fake.recvMsgMutex.Lock() 246 defer fake.recvMsgMutex.Unlock() 247 fake.RecvMsgStub = nil 248 fake.recvMsgReturns = struct { 249 result1 error 250 }{result1} 251 } 252 253 func (fake *ABServer) RecvMsgReturnsOnCall(i int, result1 error) { 254 fake.recvMsgMutex.Lock() 255 defer fake.recvMsgMutex.Unlock() 256 fake.RecvMsgStub = nil 257 if fake.recvMsgReturnsOnCall == nil { 258 fake.recvMsgReturnsOnCall = make(map[int]struct { 259 result1 error 260 }) 261 } 262 fake.recvMsgReturnsOnCall[i] = struct { 263 result1 error 264 }{result1} 265 } 266 267 func (fake *ABServer) Send(arg1 *orderer.BroadcastResponse) error { 268 fake.sendMutex.Lock() 269 ret, specificReturn := fake.sendReturnsOnCall[len(fake.sendArgsForCall)] 270 fake.sendArgsForCall = append(fake.sendArgsForCall, struct { 271 arg1 *orderer.BroadcastResponse 272 }{arg1}) 273 fake.recordInvocation("Send", []interface{}{arg1}) 274 fake.sendMutex.Unlock() 275 if fake.SendStub != nil { 276 return fake.SendStub(arg1) 277 } 278 if specificReturn { 279 return ret.result1 280 } 281 fakeReturns := fake.sendReturns 282 return fakeReturns.result1 283 } 284 285 func (fake *ABServer) SendCallCount() int { 286 fake.sendMutex.RLock() 287 defer fake.sendMutex.RUnlock() 288 return len(fake.sendArgsForCall) 289 } 290 291 func (fake *ABServer) SendCalls(stub func(*orderer.BroadcastResponse) error) { 292 fake.sendMutex.Lock() 293 defer fake.sendMutex.Unlock() 294 fake.SendStub = stub 295 } 296 297 func (fake *ABServer) SendArgsForCall(i int) *orderer.BroadcastResponse { 298 fake.sendMutex.RLock() 299 defer fake.sendMutex.RUnlock() 300 argsForCall := fake.sendArgsForCall[i] 301 return argsForCall.arg1 302 } 303 304 func (fake *ABServer) SendReturns(result1 error) { 305 fake.sendMutex.Lock() 306 defer fake.sendMutex.Unlock() 307 fake.SendStub = nil 308 fake.sendReturns = struct { 309 result1 error 310 }{result1} 311 } 312 313 func (fake *ABServer) SendReturnsOnCall(i int, result1 error) { 314 fake.sendMutex.Lock() 315 defer fake.sendMutex.Unlock() 316 fake.SendStub = nil 317 if fake.sendReturnsOnCall == nil { 318 fake.sendReturnsOnCall = make(map[int]struct { 319 result1 error 320 }) 321 } 322 fake.sendReturnsOnCall[i] = struct { 323 result1 error 324 }{result1} 325 } 326 327 func (fake *ABServer) SendHeader(arg1 metadata.MD) error { 328 fake.sendHeaderMutex.Lock() 329 ret, specificReturn := fake.sendHeaderReturnsOnCall[len(fake.sendHeaderArgsForCall)] 330 fake.sendHeaderArgsForCall = append(fake.sendHeaderArgsForCall, struct { 331 arg1 metadata.MD 332 }{arg1}) 333 fake.recordInvocation("SendHeader", []interface{}{arg1}) 334 fake.sendHeaderMutex.Unlock() 335 if fake.SendHeaderStub != nil { 336 return fake.SendHeaderStub(arg1) 337 } 338 if specificReturn { 339 return ret.result1 340 } 341 fakeReturns := fake.sendHeaderReturns 342 return fakeReturns.result1 343 } 344 345 func (fake *ABServer) SendHeaderCallCount() int { 346 fake.sendHeaderMutex.RLock() 347 defer fake.sendHeaderMutex.RUnlock() 348 return len(fake.sendHeaderArgsForCall) 349 } 350 351 func (fake *ABServer) SendHeaderCalls(stub func(metadata.MD) error) { 352 fake.sendHeaderMutex.Lock() 353 defer fake.sendHeaderMutex.Unlock() 354 fake.SendHeaderStub = stub 355 } 356 357 func (fake *ABServer) SendHeaderArgsForCall(i int) metadata.MD { 358 fake.sendHeaderMutex.RLock() 359 defer fake.sendHeaderMutex.RUnlock() 360 argsForCall := fake.sendHeaderArgsForCall[i] 361 return argsForCall.arg1 362 } 363 364 func (fake *ABServer) SendHeaderReturns(result1 error) { 365 fake.sendHeaderMutex.Lock() 366 defer fake.sendHeaderMutex.Unlock() 367 fake.SendHeaderStub = nil 368 fake.sendHeaderReturns = struct { 369 result1 error 370 }{result1} 371 } 372 373 func (fake *ABServer) SendHeaderReturnsOnCall(i int, result1 error) { 374 fake.sendHeaderMutex.Lock() 375 defer fake.sendHeaderMutex.Unlock() 376 fake.SendHeaderStub = nil 377 if fake.sendHeaderReturnsOnCall == nil { 378 fake.sendHeaderReturnsOnCall = make(map[int]struct { 379 result1 error 380 }) 381 } 382 fake.sendHeaderReturnsOnCall[i] = struct { 383 result1 error 384 }{result1} 385 } 386 387 func (fake *ABServer) SendMsg(arg1 interface{}) error { 388 fake.sendMsgMutex.Lock() 389 ret, specificReturn := fake.sendMsgReturnsOnCall[len(fake.sendMsgArgsForCall)] 390 fake.sendMsgArgsForCall = append(fake.sendMsgArgsForCall, struct { 391 arg1 interface{} 392 }{arg1}) 393 fake.recordInvocation("SendMsg", []interface{}{arg1}) 394 fake.sendMsgMutex.Unlock() 395 if fake.SendMsgStub != nil { 396 return fake.SendMsgStub(arg1) 397 } 398 if specificReturn { 399 return ret.result1 400 } 401 fakeReturns := fake.sendMsgReturns 402 return fakeReturns.result1 403 } 404 405 func (fake *ABServer) SendMsgCallCount() int { 406 fake.sendMsgMutex.RLock() 407 defer fake.sendMsgMutex.RUnlock() 408 return len(fake.sendMsgArgsForCall) 409 } 410 411 func (fake *ABServer) SendMsgCalls(stub func(interface{}) error) { 412 fake.sendMsgMutex.Lock() 413 defer fake.sendMsgMutex.Unlock() 414 fake.SendMsgStub = stub 415 } 416 417 func (fake *ABServer) SendMsgArgsForCall(i int) interface{} { 418 fake.sendMsgMutex.RLock() 419 defer fake.sendMsgMutex.RUnlock() 420 argsForCall := fake.sendMsgArgsForCall[i] 421 return argsForCall.arg1 422 } 423 424 func (fake *ABServer) SendMsgReturns(result1 error) { 425 fake.sendMsgMutex.Lock() 426 defer fake.sendMsgMutex.Unlock() 427 fake.SendMsgStub = nil 428 fake.sendMsgReturns = struct { 429 result1 error 430 }{result1} 431 } 432 433 func (fake *ABServer) SendMsgReturnsOnCall(i int, result1 error) { 434 fake.sendMsgMutex.Lock() 435 defer fake.sendMsgMutex.Unlock() 436 fake.SendMsgStub = nil 437 if fake.sendMsgReturnsOnCall == nil { 438 fake.sendMsgReturnsOnCall = make(map[int]struct { 439 result1 error 440 }) 441 } 442 fake.sendMsgReturnsOnCall[i] = struct { 443 result1 error 444 }{result1} 445 } 446 447 func (fake *ABServer) SetHeader(arg1 metadata.MD) error { 448 fake.setHeaderMutex.Lock() 449 ret, specificReturn := fake.setHeaderReturnsOnCall[len(fake.setHeaderArgsForCall)] 450 fake.setHeaderArgsForCall = append(fake.setHeaderArgsForCall, struct { 451 arg1 metadata.MD 452 }{arg1}) 453 fake.recordInvocation("SetHeader", []interface{}{arg1}) 454 fake.setHeaderMutex.Unlock() 455 if fake.SetHeaderStub != nil { 456 return fake.SetHeaderStub(arg1) 457 } 458 if specificReturn { 459 return ret.result1 460 } 461 fakeReturns := fake.setHeaderReturns 462 return fakeReturns.result1 463 } 464 465 func (fake *ABServer) SetHeaderCallCount() int { 466 fake.setHeaderMutex.RLock() 467 defer fake.setHeaderMutex.RUnlock() 468 return len(fake.setHeaderArgsForCall) 469 } 470 471 func (fake *ABServer) SetHeaderCalls(stub func(metadata.MD) error) { 472 fake.setHeaderMutex.Lock() 473 defer fake.setHeaderMutex.Unlock() 474 fake.SetHeaderStub = stub 475 } 476 477 func (fake *ABServer) SetHeaderArgsForCall(i int) metadata.MD { 478 fake.setHeaderMutex.RLock() 479 defer fake.setHeaderMutex.RUnlock() 480 argsForCall := fake.setHeaderArgsForCall[i] 481 return argsForCall.arg1 482 } 483 484 func (fake *ABServer) SetHeaderReturns(result1 error) { 485 fake.setHeaderMutex.Lock() 486 defer fake.setHeaderMutex.Unlock() 487 fake.SetHeaderStub = nil 488 fake.setHeaderReturns = struct { 489 result1 error 490 }{result1} 491 } 492 493 func (fake *ABServer) SetHeaderReturnsOnCall(i int, result1 error) { 494 fake.setHeaderMutex.Lock() 495 defer fake.setHeaderMutex.Unlock() 496 fake.SetHeaderStub = nil 497 if fake.setHeaderReturnsOnCall == nil { 498 fake.setHeaderReturnsOnCall = make(map[int]struct { 499 result1 error 500 }) 501 } 502 fake.setHeaderReturnsOnCall[i] = struct { 503 result1 error 504 }{result1} 505 } 506 507 func (fake *ABServer) SetTrailer(arg1 metadata.MD) { 508 fake.setTrailerMutex.Lock() 509 fake.setTrailerArgsForCall = append(fake.setTrailerArgsForCall, struct { 510 arg1 metadata.MD 511 }{arg1}) 512 fake.recordInvocation("SetTrailer", []interface{}{arg1}) 513 fake.setTrailerMutex.Unlock() 514 if fake.SetTrailerStub != nil { 515 fake.SetTrailerStub(arg1) 516 } 517 } 518 519 func (fake *ABServer) SetTrailerCallCount() int { 520 fake.setTrailerMutex.RLock() 521 defer fake.setTrailerMutex.RUnlock() 522 return len(fake.setTrailerArgsForCall) 523 } 524 525 func (fake *ABServer) SetTrailerCalls(stub func(metadata.MD)) { 526 fake.setTrailerMutex.Lock() 527 defer fake.setTrailerMutex.Unlock() 528 fake.SetTrailerStub = stub 529 } 530 531 func (fake *ABServer) SetTrailerArgsForCall(i int) metadata.MD { 532 fake.setTrailerMutex.RLock() 533 defer fake.setTrailerMutex.RUnlock() 534 argsForCall := fake.setTrailerArgsForCall[i] 535 return argsForCall.arg1 536 } 537 538 func (fake *ABServer) Invocations() map[string][][]interface{} { 539 fake.invocationsMutex.RLock() 540 defer fake.invocationsMutex.RUnlock() 541 fake.contextMutex.RLock() 542 defer fake.contextMutex.RUnlock() 543 fake.recvMutex.RLock() 544 defer fake.recvMutex.RUnlock() 545 fake.recvMsgMutex.RLock() 546 defer fake.recvMsgMutex.RUnlock() 547 fake.sendMutex.RLock() 548 defer fake.sendMutex.RUnlock() 549 fake.sendHeaderMutex.RLock() 550 defer fake.sendHeaderMutex.RUnlock() 551 fake.sendMsgMutex.RLock() 552 defer fake.sendMsgMutex.RUnlock() 553 fake.setHeaderMutex.RLock() 554 defer fake.setHeaderMutex.RUnlock() 555 fake.setTrailerMutex.RLock() 556 defer fake.setTrailerMutex.RUnlock() 557 copiedInvocations := map[string][][]interface{}{} 558 for key, value := range fake.invocations { 559 copiedInvocations[key] = value 560 } 561 return copiedInvocations 562 } 563 564 func (fake *ABServer) recordInvocation(key string, args []interface{}) { 565 fake.invocationsMutex.Lock() 566 defer fake.invocationsMutex.Unlock() 567 if fake.invocations == nil { 568 fake.invocations = map[string][][]interface{}{} 569 } 570 if fake.invocations[key] == nil { 571 fake.invocations[key] = [][]interface{}{} 572 } 573 fake.invocations[key] = append(fake.invocations[key], args) 574 }