github.com/yimialmonte/fabric@v2.1.1+incompatible/core/scc/mock/chaincode_stream_handler.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 LaunchInProcStub func(string) <-chan struct{} 23 launchInProcMutex sync.RWMutex 24 launchInProcArgsForCall []struct { 25 arg1 string 26 } 27 launchInProcReturns struct { 28 result1 <-chan struct{} 29 } 30 launchInProcReturnsOnCall map[int]struct { 31 result1 <-chan struct{} 32 } 33 invocations map[string][][]interface{} 34 invocationsMutex sync.RWMutex 35 } 36 37 func (fake *ChaincodeStreamHandler) HandleChaincodeStream(arg1 ccintf.ChaincodeStream) error { 38 fake.handleChaincodeStreamMutex.Lock() 39 ret, specificReturn := fake.handleChaincodeStreamReturnsOnCall[len(fake.handleChaincodeStreamArgsForCall)] 40 fake.handleChaincodeStreamArgsForCall = append(fake.handleChaincodeStreamArgsForCall, struct { 41 arg1 ccintf.ChaincodeStream 42 }{arg1}) 43 fake.recordInvocation("HandleChaincodeStream", []interface{}{arg1}) 44 fake.handleChaincodeStreamMutex.Unlock() 45 if fake.HandleChaincodeStreamStub != nil { 46 return fake.HandleChaincodeStreamStub(arg1) 47 } 48 if specificReturn { 49 return ret.result1 50 } 51 fakeReturns := fake.handleChaincodeStreamReturns 52 return fakeReturns.result1 53 } 54 55 func (fake *ChaincodeStreamHandler) HandleChaincodeStreamCallCount() int { 56 fake.handleChaincodeStreamMutex.RLock() 57 defer fake.handleChaincodeStreamMutex.RUnlock() 58 return len(fake.handleChaincodeStreamArgsForCall) 59 } 60 61 func (fake *ChaincodeStreamHandler) HandleChaincodeStreamCalls(stub func(ccintf.ChaincodeStream) error) { 62 fake.handleChaincodeStreamMutex.Lock() 63 defer fake.handleChaincodeStreamMutex.Unlock() 64 fake.HandleChaincodeStreamStub = stub 65 } 66 67 func (fake *ChaincodeStreamHandler) HandleChaincodeStreamArgsForCall(i int) ccintf.ChaincodeStream { 68 fake.handleChaincodeStreamMutex.RLock() 69 defer fake.handleChaincodeStreamMutex.RUnlock() 70 argsForCall := fake.handleChaincodeStreamArgsForCall[i] 71 return argsForCall.arg1 72 } 73 74 func (fake *ChaincodeStreamHandler) HandleChaincodeStreamReturns(result1 error) { 75 fake.handleChaincodeStreamMutex.Lock() 76 defer fake.handleChaincodeStreamMutex.Unlock() 77 fake.HandleChaincodeStreamStub = nil 78 fake.handleChaincodeStreamReturns = struct { 79 result1 error 80 }{result1} 81 } 82 83 func (fake *ChaincodeStreamHandler) HandleChaincodeStreamReturnsOnCall(i int, result1 error) { 84 fake.handleChaincodeStreamMutex.Lock() 85 defer fake.handleChaincodeStreamMutex.Unlock() 86 fake.HandleChaincodeStreamStub = nil 87 if fake.handleChaincodeStreamReturnsOnCall == nil { 88 fake.handleChaincodeStreamReturnsOnCall = make(map[int]struct { 89 result1 error 90 }) 91 } 92 fake.handleChaincodeStreamReturnsOnCall[i] = struct { 93 result1 error 94 }{result1} 95 } 96 97 func (fake *ChaincodeStreamHandler) LaunchInProc(arg1 string) <-chan struct{} { 98 fake.launchInProcMutex.Lock() 99 ret, specificReturn := fake.launchInProcReturnsOnCall[len(fake.launchInProcArgsForCall)] 100 fake.launchInProcArgsForCall = append(fake.launchInProcArgsForCall, struct { 101 arg1 string 102 }{arg1}) 103 fake.recordInvocation("LaunchInProc", []interface{}{arg1}) 104 fake.launchInProcMutex.Unlock() 105 if fake.LaunchInProcStub != nil { 106 return fake.LaunchInProcStub(arg1) 107 } 108 if specificReturn { 109 return ret.result1 110 } 111 fakeReturns := fake.launchInProcReturns 112 return fakeReturns.result1 113 } 114 115 func (fake *ChaincodeStreamHandler) LaunchInProcCallCount() int { 116 fake.launchInProcMutex.RLock() 117 defer fake.launchInProcMutex.RUnlock() 118 return len(fake.launchInProcArgsForCall) 119 } 120 121 func (fake *ChaincodeStreamHandler) LaunchInProcCalls(stub func(string) <-chan struct{}) { 122 fake.launchInProcMutex.Lock() 123 defer fake.launchInProcMutex.Unlock() 124 fake.LaunchInProcStub = stub 125 } 126 127 func (fake *ChaincodeStreamHandler) LaunchInProcArgsForCall(i int) string { 128 fake.launchInProcMutex.RLock() 129 defer fake.launchInProcMutex.RUnlock() 130 argsForCall := fake.launchInProcArgsForCall[i] 131 return argsForCall.arg1 132 } 133 134 func (fake *ChaincodeStreamHandler) LaunchInProcReturns(result1 <-chan struct{}) { 135 fake.launchInProcMutex.Lock() 136 defer fake.launchInProcMutex.Unlock() 137 fake.LaunchInProcStub = nil 138 fake.launchInProcReturns = struct { 139 result1 <-chan struct{} 140 }{result1} 141 } 142 143 func (fake *ChaincodeStreamHandler) LaunchInProcReturnsOnCall(i int, result1 <-chan struct{}) { 144 fake.launchInProcMutex.Lock() 145 defer fake.launchInProcMutex.Unlock() 146 fake.LaunchInProcStub = nil 147 if fake.launchInProcReturnsOnCall == nil { 148 fake.launchInProcReturnsOnCall = make(map[int]struct { 149 result1 <-chan struct{} 150 }) 151 } 152 fake.launchInProcReturnsOnCall[i] = struct { 153 result1 <-chan struct{} 154 }{result1} 155 } 156 157 func (fake *ChaincodeStreamHandler) Invocations() map[string][][]interface{} { 158 fake.invocationsMutex.RLock() 159 defer fake.invocationsMutex.RUnlock() 160 fake.handleChaincodeStreamMutex.RLock() 161 defer fake.handleChaincodeStreamMutex.RUnlock() 162 fake.launchInProcMutex.RLock() 163 defer fake.launchInProcMutex.RUnlock() 164 copiedInvocations := map[string][][]interface{}{} 165 for key, value := range fake.invocations { 166 copiedInvocations[key] = value 167 } 168 return copiedInvocations 169 } 170 171 func (fake *ChaincodeStreamHandler) recordInvocation(key string, args []interface{}) { 172 fake.invocationsMutex.Lock() 173 defer fake.invocationsMutex.Unlock() 174 if fake.invocations == nil { 175 fake.invocations = map[string][][]interface{}{} 176 } 177 if fake.invocations[key] == nil { 178 fake.invocations[key] = [][]interface{}{} 179 } 180 fake.invocations[key] = append(fake.invocations[key], args) 181 }