github.com/hyperledger-labs/bdls@v2.1.1+incompatible/core/chaincode/mock/ccstreamhandler.go (about) 1 // Code generated by counterfeiter. DO NOT EDIT. 2 package mock 3 4 import ( 5 "sync" 6 7 "github.com/hyperledger/fabric/core/container/ccintf" 8 ) 9 10 type ChaincodeStreamHandler struct { 11 HandleChaincodeStreamStub func(ccintf.ChaincodeStream) error 12 handleChaincodeStreamMutex sync.RWMutex 13 handleChaincodeStreamArgsForCall []struct { 14 arg1 ccintf.ChaincodeStream 15 } 16 handleChaincodeStreamReturns struct { 17 result1 error 18 } 19 handleChaincodeStreamReturnsOnCall map[int]struct { 20 result1 error 21 } 22 invocations map[string][][]interface{} 23 invocationsMutex sync.RWMutex 24 } 25 26 func (fake *ChaincodeStreamHandler) HandleChaincodeStream(arg1 ccintf.ChaincodeStream) error { 27 fake.handleChaincodeStreamMutex.Lock() 28 ret, specificReturn := fake.handleChaincodeStreamReturnsOnCall[len(fake.handleChaincodeStreamArgsForCall)] 29 fake.handleChaincodeStreamArgsForCall = append(fake.handleChaincodeStreamArgsForCall, struct { 30 arg1 ccintf.ChaincodeStream 31 }{arg1}) 32 fake.recordInvocation("HandleChaincodeStream", []interface{}{arg1}) 33 fake.handleChaincodeStreamMutex.Unlock() 34 if fake.HandleChaincodeStreamStub != nil { 35 return fake.HandleChaincodeStreamStub(arg1) 36 } 37 if specificReturn { 38 return ret.result1 39 } 40 fakeReturns := fake.handleChaincodeStreamReturns 41 return fakeReturns.result1 42 } 43 44 func (fake *ChaincodeStreamHandler) HandleChaincodeStreamCallCount() int { 45 fake.handleChaincodeStreamMutex.RLock() 46 defer fake.handleChaincodeStreamMutex.RUnlock() 47 return len(fake.handleChaincodeStreamArgsForCall) 48 } 49 50 func (fake *ChaincodeStreamHandler) HandleChaincodeStreamCalls(stub func(ccintf.ChaincodeStream) error) { 51 fake.handleChaincodeStreamMutex.Lock() 52 defer fake.handleChaincodeStreamMutex.Unlock() 53 fake.HandleChaincodeStreamStub = stub 54 } 55 56 func (fake *ChaincodeStreamHandler) HandleChaincodeStreamArgsForCall(i int) ccintf.ChaincodeStream { 57 fake.handleChaincodeStreamMutex.RLock() 58 defer fake.handleChaincodeStreamMutex.RUnlock() 59 argsForCall := fake.handleChaincodeStreamArgsForCall[i] 60 return argsForCall.arg1 61 } 62 63 func (fake *ChaincodeStreamHandler) HandleChaincodeStreamReturns(result1 error) { 64 fake.handleChaincodeStreamMutex.Lock() 65 defer fake.handleChaincodeStreamMutex.Unlock() 66 fake.HandleChaincodeStreamStub = nil 67 fake.handleChaincodeStreamReturns = struct { 68 result1 error 69 }{result1} 70 } 71 72 func (fake *ChaincodeStreamHandler) HandleChaincodeStreamReturnsOnCall(i int, result1 error) { 73 fake.handleChaincodeStreamMutex.Lock() 74 defer fake.handleChaincodeStreamMutex.Unlock() 75 fake.HandleChaincodeStreamStub = nil 76 if fake.handleChaincodeStreamReturnsOnCall == nil { 77 fake.handleChaincodeStreamReturnsOnCall = make(map[int]struct { 78 result1 error 79 }) 80 } 81 fake.handleChaincodeStreamReturnsOnCall[i] = struct { 82 result1 error 83 }{result1} 84 } 85 86 func (fake *ChaincodeStreamHandler) Invocations() map[string][][]interface{} { 87 fake.invocationsMutex.RLock() 88 defer fake.invocationsMutex.RUnlock() 89 fake.handleChaincodeStreamMutex.RLock() 90 defer fake.handleChaincodeStreamMutex.RUnlock() 91 copiedInvocations := map[string][][]interface{}{} 92 for key, value := range fake.invocations { 93 copiedInvocations[key] = value 94 } 95 return copiedInvocations 96 } 97 98 func (fake *ChaincodeStreamHandler) recordInvocation(key string, args []interface{}) { 99 fake.invocationsMutex.Lock() 100 defer fake.invocationsMutex.Unlock() 101 if fake.invocations == nil { 102 fake.invocations = map[string][][]interface{}{} 103 } 104 if fake.invocations[key] == nil { 105 fake.invocations[key] = [][]interface{}{} 106 } 107 fake.invocations[key] = append(fake.invocations[key], args) 108 }