github.com/hyperledger-labs/bdls@v2.1.1+incompatible/core/chaincode/lifecycle/mock/chaincode_store.go (about) 1 // Code generated by counterfeiter. DO NOT EDIT. 2 package mock 3 4 import ( 5 "sync" 6 7 "github.com/hyperledger/fabric/common/chaincode" 8 ) 9 10 type ChaincodeStore struct { 11 DeleteStub func(string) error 12 deleteMutex sync.RWMutex 13 deleteArgsForCall []struct { 14 arg1 string 15 } 16 deleteReturns struct { 17 result1 error 18 } 19 deleteReturnsOnCall map[int]struct { 20 result1 error 21 } 22 ListInstalledChaincodesStub func() ([]chaincode.InstalledChaincode, error) 23 listInstalledChaincodesMutex sync.RWMutex 24 listInstalledChaincodesArgsForCall []struct { 25 } 26 listInstalledChaincodesReturns struct { 27 result1 []chaincode.InstalledChaincode 28 result2 error 29 } 30 listInstalledChaincodesReturnsOnCall map[int]struct { 31 result1 []chaincode.InstalledChaincode 32 result2 error 33 } 34 LoadStub func(string) ([]byte, error) 35 loadMutex sync.RWMutex 36 loadArgsForCall []struct { 37 arg1 string 38 } 39 loadReturns struct { 40 result1 []byte 41 result2 error 42 } 43 loadReturnsOnCall map[int]struct { 44 result1 []byte 45 result2 error 46 } 47 SaveStub func(string, []byte) (string, error) 48 saveMutex sync.RWMutex 49 saveArgsForCall []struct { 50 arg1 string 51 arg2 []byte 52 } 53 saveReturns struct { 54 result1 string 55 result2 error 56 } 57 saveReturnsOnCall map[int]struct { 58 result1 string 59 result2 error 60 } 61 invocations map[string][][]interface{} 62 invocationsMutex sync.RWMutex 63 } 64 65 func (fake *ChaincodeStore) Delete(arg1 string) error { 66 fake.deleteMutex.Lock() 67 ret, specificReturn := fake.deleteReturnsOnCall[len(fake.deleteArgsForCall)] 68 fake.deleteArgsForCall = append(fake.deleteArgsForCall, struct { 69 arg1 string 70 }{arg1}) 71 fake.recordInvocation("Delete", []interface{}{arg1}) 72 fake.deleteMutex.Unlock() 73 if fake.DeleteStub != nil { 74 return fake.DeleteStub(arg1) 75 } 76 if specificReturn { 77 return ret.result1 78 } 79 fakeReturns := fake.deleteReturns 80 return fakeReturns.result1 81 } 82 83 func (fake *ChaincodeStore) DeleteCallCount() int { 84 fake.deleteMutex.RLock() 85 defer fake.deleteMutex.RUnlock() 86 return len(fake.deleteArgsForCall) 87 } 88 89 func (fake *ChaincodeStore) DeleteCalls(stub func(string) error) { 90 fake.deleteMutex.Lock() 91 defer fake.deleteMutex.Unlock() 92 fake.DeleteStub = stub 93 } 94 95 func (fake *ChaincodeStore) DeleteArgsForCall(i int) string { 96 fake.deleteMutex.RLock() 97 defer fake.deleteMutex.RUnlock() 98 argsForCall := fake.deleteArgsForCall[i] 99 return argsForCall.arg1 100 } 101 102 func (fake *ChaincodeStore) DeleteReturns(result1 error) { 103 fake.deleteMutex.Lock() 104 defer fake.deleteMutex.Unlock() 105 fake.DeleteStub = nil 106 fake.deleteReturns = struct { 107 result1 error 108 }{result1} 109 } 110 111 func (fake *ChaincodeStore) DeleteReturnsOnCall(i int, result1 error) { 112 fake.deleteMutex.Lock() 113 defer fake.deleteMutex.Unlock() 114 fake.DeleteStub = nil 115 if fake.deleteReturnsOnCall == nil { 116 fake.deleteReturnsOnCall = make(map[int]struct { 117 result1 error 118 }) 119 } 120 fake.deleteReturnsOnCall[i] = struct { 121 result1 error 122 }{result1} 123 } 124 125 func (fake *ChaincodeStore) ListInstalledChaincodes() ([]chaincode.InstalledChaincode, error) { 126 fake.listInstalledChaincodesMutex.Lock() 127 ret, specificReturn := fake.listInstalledChaincodesReturnsOnCall[len(fake.listInstalledChaincodesArgsForCall)] 128 fake.listInstalledChaincodesArgsForCall = append(fake.listInstalledChaincodesArgsForCall, struct { 129 }{}) 130 fake.recordInvocation("ListInstalledChaincodes", []interface{}{}) 131 fake.listInstalledChaincodesMutex.Unlock() 132 if fake.ListInstalledChaincodesStub != nil { 133 return fake.ListInstalledChaincodesStub() 134 } 135 if specificReturn { 136 return ret.result1, ret.result2 137 } 138 fakeReturns := fake.listInstalledChaincodesReturns 139 return fakeReturns.result1, fakeReturns.result2 140 } 141 142 func (fake *ChaincodeStore) ListInstalledChaincodesCallCount() int { 143 fake.listInstalledChaincodesMutex.RLock() 144 defer fake.listInstalledChaincodesMutex.RUnlock() 145 return len(fake.listInstalledChaincodesArgsForCall) 146 } 147 148 func (fake *ChaincodeStore) ListInstalledChaincodesCalls(stub func() ([]chaincode.InstalledChaincode, error)) { 149 fake.listInstalledChaincodesMutex.Lock() 150 defer fake.listInstalledChaincodesMutex.Unlock() 151 fake.ListInstalledChaincodesStub = stub 152 } 153 154 func (fake *ChaincodeStore) ListInstalledChaincodesReturns(result1 []chaincode.InstalledChaincode, result2 error) { 155 fake.listInstalledChaincodesMutex.Lock() 156 defer fake.listInstalledChaincodesMutex.Unlock() 157 fake.ListInstalledChaincodesStub = nil 158 fake.listInstalledChaincodesReturns = struct { 159 result1 []chaincode.InstalledChaincode 160 result2 error 161 }{result1, result2} 162 } 163 164 func (fake *ChaincodeStore) ListInstalledChaincodesReturnsOnCall(i int, result1 []chaincode.InstalledChaincode, result2 error) { 165 fake.listInstalledChaincodesMutex.Lock() 166 defer fake.listInstalledChaincodesMutex.Unlock() 167 fake.ListInstalledChaincodesStub = nil 168 if fake.listInstalledChaincodesReturnsOnCall == nil { 169 fake.listInstalledChaincodesReturnsOnCall = make(map[int]struct { 170 result1 []chaincode.InstalledChaincode 171 result2 error 172 }) 173 } 174 fake.listInstalledChaincodesReturnsOnCall[i] = struct { 175 result1 []chaincode.InstalledChaincode 176 result2 error 177 }{result1, result2} 178 } 179 180 func (fake *ChaincodeStore) Load(arg1 string) ([]byte, error) { 181 fake.loadMutex.Lock() 182 ret, specificReturn := fake.loadReturnsOnCall[len(fake.loadArgsForCall)] 183 fake.loadArgsForCall = append(fake.loadArgsForCall, struct { 184 arg1 string 185 }{arg1}) 186 fake.recordInvocation("Load", []interface{}{arg1}) 187 fake.loadMutex.Unlock() 188 if fake.LoadStub != nil { 189 return fake.LoadStub(arg1) 190 } 191 if specificReturn { 192 return ret.result1, ret.result2 193 } 194 fakeReturns := fake.loadReturns 195 return fakeReturns.result1, fakeReturns.result2 196 } 197 198 func (fake *ChaincodeStore) LoadCallCount() int { 199 fake.loadMutex.RLock() 200 defer fake.loadMutex.RUnlock() 201 return len(fake.loadArgsForCall) 202 } 203 204 func (fake *ChaincodeStore) LoadCalls(stub func(string) ([]byte, error)) { 205 fake.loadMutex.Lock() 206 defer fake.loadMutex.Unlock() 207 fake.LoadStub = stub 208 } 209 210 func (fake *ChaincodeStore) LoadArgsForCall(i int) string { 211 fake.loadMutex.RLock() 212 defer fake.loadMutex.RUnlock() 213 argsForCall := fake.loadArgsForCall[i] 214 return argsForCall.arg1 215 } 216 217 func (fake *ChaincodeStore) LoadReturns(result1 []byte, result2 error) { 218 fake.loadMutex.Lock() 219 defer fake.loadMutex.Unlock() 220 fake.LoadStub = nil 221 fake.loadReturns = struct { 222 result1 []byte 223 result2 error 224 }{result1, result2} 225 } 226 227 func (fake *ChaincodeStore) LoadReturnsOnCall(i int, result1 []byte, result2 error) { 228 fake.loadMutex.Lock() 229 defer fake.loadMutex.Unlock() 230 fake.LoadStub = nil 231 if fake.loadReturnsOnCall == nil { 232 fake.loadReturnsOnCall = make(map[int]struct { 233 result1 []byte 234 result2 error 235 }) 236 } 237 fake.loadReturnsOnCall[i] = struct { 238 result1 []byte 239 result2 error 240 }{result1, result2} 241 } 242 243 func (fake *ChaincodeStore) Save(arg1 string, arg2 []byte) (string, error) { 244 var arg2Copy []byte 245 if arg2 != nil { 246 arg2Copy = make([]byte, len(arg2)) 247 copy(arg2Copy, arg2) 248 } 249 fake.saveMutex.Lock() 250 ret, specificReturn := fake.saveReturnsOnCall[len(fake.saveArgsForCall)] 251 fake.saveArgsForCall = append(fake.saveArgsForCall, struct { 252 arg1 string 253 arg2 []byte 254 }{arg1, arg2Copy}) 255 fake.recordInvocation("Save", []interface{}{arg1, arg2Copy}) 256 fake.saveMutex.Unlock() 257 if fake.SaveStub != nil { 258 return fake.SaveStub(arg1, arg2) 259 } 260 if specificReturn { 261 return ret.result1, ret.result2 262 } 263 fakeReturns := fake.saveReturns 264 return fakeReturns.result1, fakeReturns.result2 265 } 266 267 func (fake *ChaincodeStore) SaveCallCount() int { 268 fake.saveMutex.RLock() 269 defer fake.saveMutex.RUnlock() 270 return len(fake.saveArgsForCall) 271 } 272 273 func (fake *ChaincodeStore) SaveCalls(stub func(string, []byte) (string, error)) { 274 fake.saveMutex.Lock() 275 defer fake.saveMutex.Unlock() 276 fake.SaveStub = stub 277 } 278 279 func (fake *ChaincodeStore) SaveArgsForCall(i int) (string, []byte) { 280 fake.saveMutex.RLock() 281 defer fake.saveMutex.RUnlock() 282 argsForCall := fake.saveArgsForCall[i] 283 return argsForCall.arg1, argsForCall.arg2 284 } 285 286 func (fake *ChaincodeStore) SaveReturns(result1 string, result2 error) { 287 fake.saveMutex.Lock() 288 defer fake.saveMutex.Unlock() 289 fake.SaveStub = nil 290 fake.saveReturns = struct { 291 result1 string 292 result2 error 293 }{result1, result2} 294 } 295 296 func (fake *ChaincodeStore) SaveReturnsOnCall(i int, result1 string, result2 error) { 297 fake.saveMutex.Lock() 298 defer fake.saveMutex.Unlock() 299 fake.SaveStub = nil 300 if fake.saveReturnsOnCall == nil { 301 fake.saveReturnsOnCall = make(map[int]struct { 302 result1 string 303 result2 error 304 }) 305 } 306 fake.saveReturnsOnCall[i] = struct { 307 result1 string 308 result2 error 309 }{result1, result2} 310 } 311 312 func (fake *ChaincodeStore) Invocations() map[string][][]interface{} { 313 fake.invocationsMutex.RLock() 314 defer fake.invocationsMutex.RUnlock() 315 fake.deleteMutex.RLock() 316 defer fake.deleteMutex.RUnlock() 317 fake.listInstalledChaincodesMutex.RLock() 318 defer fake.listInstalledChaincodesMutex.RUnlock() 319 fake.loadMutex.RLock() 320 defer fake.loadMutex.RUnlock() 321 fake.saveMutex.RLock() 322 defer fake.saveMutex.RUnlock() 323 copiedInvocations := map[string][][]interface{}{} 324 for key, value := range fake.invocations { 325 copiedInvocations[key] = value 326 } 327 return copiedInvocations 328 } 329 330 func (fake *ChaincodeStore) recordInvocation(key string, args []interface{}) { 331 fake.invocationsMutex.Lock() 332 defer fake.invocationsMutex.Unlock() 333 if fake.invocations == nil { 334 fake.invocations = map[string][][]interface{}{} 335 } 336 if fake.invocations[key] == nil { 337 fake.invocations[key] = [][]interface{}{} 338 } 339 fake.invocations[key] = append(fake.invocations[key], args) 340 }