github.com/hyperledger-labs/bdls@v2.1.1+incompatible/core/chaincode/lifecycle/mock/chaincode_launcher.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/chaincode/lifecycle" 8 ) 9 10 type ChaincodeLauncher struct { 11 LaunchStub func(string) error 12 launchMutex sync.RWMutex 13 launchArgsForCall []struct { 14 arg1 string 15 } 16 launchReturns struct { 17 result1 error 18 } 19 launchReturnsOnCall map[int]struct { 20 result1 error 21 } 22 StopStub func(string) error 23 stopMutex sync.RWMutex 24 stopArgsForCall []struct { 25 arg1 string 26 } 27 stopReturns struct { 28 result1 error 29 } 30 stopReturnsOnCall map[int]struct { 31 result1 error 32 } 33 invocations map[string][][]interface{} 34 invocationsMutex sync.RWMutex 35 } 36 37 func (fake *ChaincodeLauncher) Launch(arg1 string) error { 38 fake.launchMutex.Lock() 39 ret, specificReturn := fake.launchReturnsOnCall[len(fake.launchArgsForCall)] 40 fake.launchArgsForCall = append(fake.launchArgsForCall, struct { 41 arg1 string 42 }{arg1}) 43 fake.recordInvocation("Launch", []interface{}{arg1}) 44 fake.launchMutex.Unlock() 45 if fake.LaunchStub != nil { 46 return fake.LaunchStub(arg1) 47 } 48 if specificReturn { 49 return ret.result1 50 } 51 fakeReturns := fake.launchReturns 52 return fakeReturns.result1 53 } 54 55 func (fake *ChaincodeLauncher) LaunchCallCount() int { 56 fake.launchMutex.RLock() 57 defer fake.launchMutex.RUnlock() 58 return len(fake.launchArgsForCall) 59 } 60 61 func (fake *ChaincodeLauncher) LaunchCalls(stub func(string) error) { 62 fake.launchMutex.Lock() 63 defer fake.launchMutex.Unlock() 64 fake.LaunchStub = stub 65 } 66 67 func (fake *ChaincodeLauncher) LaunchArgsForCall(i int) string { 68 fake.launchMutex.RLock() 69 defer fake.launchMutex.RUnlock() 70 argsForCall := fake.launchArgsForCall[i] 71 return argsForCall.arg1 72 } 73 74 func (fake *ChaincodeLauncher) LaunchReturns(result1 error) { 75 fake.launchMutex.Lock() 76 defer fake.launchMutex.Unlock() 77 fake.LaunchStub = nil 78 fake.launchReturns = struct { 79 result1 error 80 }{result1} 81 } 82 83 func (fake *ChaincodeLauncher) LaunchReturnsOnCall(i int, result1 error) { 84 fake.launchMutex.Lock() 85 defer fake.launchMutex.Unlock() 86 fake.LaunchStub = nil 87 if fake.launchReturnsOnCall == nil { 88 fake.launchReturnsOnCall = make(map[int]struct { 89 result1 error 90 }) 91 } 92 fake.launchReturnsOnCall[i] = struct { 93 result1 error 94 }{result1} 95 } 96 97 func (fake *ChaincodeLauncher) Stop(arg1 string) error { 98 fake.stopMutex.Lock() 99 ret, specificReturn := fake.stopReturnsOnCall[len(fake.stopArgsForCall)] 100 fake.stopArgsForCall = append(fake.stopArgsForCall, struct { 101 arg1 string 102 }{arg1}) 103 fake.recordInvocation("Stop", []interface{}{arg1}) 104 fake.stopMutex.Unlock() 105 if fake.StopStub != nil { 106 return fake.StopStub(arg1) 107 } 108 if specificReturn { 109 return ret.result1 110 } 111 fakeReturns := fake.stopReturns 112 return fakeReturns.result1 113 } 114 115 func (fake *ChaincodeLauncher) StopCallCount() int { 116 fake.stopMutex.RLock() 117 defer fake.stopMutex.RUnlock() 118 return len(fake.stopArgsForCall) 119 } 120 121 func (fake *ChaincodeLauncher) StopCalls(stub func(string) error) { 122 fake.stopMutex.Lock() 123 defer fake.stopMutex.Unlock() 124 fake.StopStub = stub 125 } 126 127 func (fake *ChaincodeLauncher) StopArgsForCall(i int) string { 128 fake.stopMutex.RLock() 129 defer fake.stopMutex.RUnlock() 130 argsForCall := fake.stopArgsForCall[i] 131 return argsForCall.arg1 132 } 133 134 func (fake *ChaincodeLauncher) StopReturns(result1 error) { 135 fake.stopMutex.Lock() 136 defer fake.stopMutex.Unlock() 137 fake.StopStub = nil 138 fake.stopReturns = struct { 139 result1 error 140 }{result1} 141 } 142 143 func (fake *ChaincodeLauncher) StopReturnsOnCall(i int, result1 error) { 144 fake.stopMutex.Lock() 145 defer fake.stopMutex.Unlock() 146 fake.StopStub = nil 147 if fake.stopReturnsOnCall == nil { 148 fake.stopReturnsOnCall = make(map[int]struct { 149 result1 error 150 }) 151 } 152 fake.stopReturnsOnCall[i] = struct { 153 result1 error 154 }{result1} 155 } 156 157 func (fake *ChaincodeLauncher) Invocations() map[string][][]interface{} { 158 fake.invocationsMutex.RLock() 159 defer fake.invocationsMutex.RUnlock() 160 fake.launchMutex.RLock() 161 defer fake.launchMutex.RUnlock() 162 fake.stopMutex.RLock() 163 defer fake.stopMutex.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 *ChaincodeLauncher) 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 } 182 183 var _ lifecycle.ChaincodeLauncher = new(ChaincodeLauncher)