github.com/lzy4123/fabric@v2.1.1+incompatible/core/scc/lscc/mock/fs_support.go (about) 1 // Code generated by counterfeiter. DO NOT EDIT. 2 package mock 3 4 import ( 5 "sync" 6 7 "github.com/hyperledger/fabric-protos-go/peer" 8 "github.com/hyperledger/fabric/core/common/ccprovider" 9 ) 10 11 type FileSystemSupport struct { 12 CheckInstantiationPolicyStub func(*peer.SignedProposal, string, []byte) error 13 checkInstantiationPolicyMutex sync.RWMutex 14 checkInstantiationPolicyArgsForCall []struct { 15 arg1 *peer.SignedProposal 16 arg2 string 17 arg3 []byte 18 } 19 checkInstantiationPolicyReturns struct { 20 result1 error 21 } 22 checkInstantiationPolicyReturnsOnCall map[int]struct { 23 result1 error 24 } 25 GetChaincodeFromLocalStorageStub func(string) (ccprovider.CCPackage, error) 26 getChaincodeFromLocalStorageMutex sync.RWMutex 27 getChaincodeFromLocalStorageArgsForCall []struct { 28 arg1 string 29 } 30 getChaincodeFromLocalStorageReturns struct { 31 result1 ccprovider.CCPackage 32 result2 error 33 } 34 getChaincodeFromLocalStorageReturnsOnCall map[int]struct { 35 result1 ccprovider.CCPackage 36 result2 error 37 } 38 GetChaincodesFromLocalStorageStub func() (*peer.ChaincodeQueryResponse, error) 39 getChaincodesFromLocalStorageMutex sync.RWMutex 40 getChaincodesFromLocalStorageArgsForCall []struct { 41 } 42 getChaincodesFromLocalStorageReturns struct { 43 result1 *peer.ChaincodeQueryResponse 44 result2 error 45 } 46 getChaincodesFromLocalStorageReturnsOnCall map[int]struct { 47 result1 *peer.ChaincodeQueryResponse 48 result2 error 49 } 50 GetInstantiationPolicyStub func(string, ccprovider.CCPackage) ([]byte, error) 51 getInstantiationPolicyMutex sync.RWMutex 52 getInstantiationPolicyArgsForCall []struct { 53 arg1 string 54 arg2 ccprovider.CCPackage 55 } 56 getInstantiationPolicyReturns struct { 57 result1 []byte 58 result2 error 59 } 60 getInstantiationPolicyReturnsOnCall map[int]struct { 61 result1 []byte 62 result2 error 63 } 64 PutChaincodeToLocalStorageStub func(ccprovider.CCPackage) error 65 putChaincodeToLocalStorageMutex sync.RWMutex 66 putChaincodeToLocalStorageArgsForCall []struct { 67 arg1 ccprovider.CCPackage 68 } 69 putChaincodeToLocalStorageReturns struct { 70 result1 error 71 } 72 putChaincodeToLocalStorageReturnsOnCall map[int]struct { 73 result1 error 74 } 75 invocations map[string][][]interface{} 76 invocationsMutex sync.RWMutex 77 } 78 79 func (fake *FileSystemSupport) CheckInstantiationPolicy(arg1 *peer.SignedProposal, arg2 string, arg3 []byte) error { 80 var arg3Copy []byte 81 if arg3 != nil { 82 arg3Copy = make([]byte, len(arg3)) 83 copy(arg3Copy, arg3) 84 } 85 fake.checkInstantiationPolicyMutex.Lock() 86 ret, specificReturn := fake.checkInstantiationPolicyReturnsOnCall[len(fake.checkInstantiationPolicyArgsForCall)] 87 fake.checkInstantiationPolicyArgsForCall = append(fake.checkInstantiationPolicyArgsForCall, struct { 88 arg1 *peer.SignedProposal 89 arg2 string 90 arg3 []byte 91 }{arg1, arg2, arg3Copy}) 92 fake.recordInvocation("CheckInstantiationPolicy", []interface{}{arg1, arg2, arg3Copy}) 93 fake.checkInstantiationPolicyMutex.Unlock() 94 if fake.CheckInstantiationPolicyStub != nil { 95 return fake.CheckInstantiationPolicyStub(arg1, arg2, arg3) 96 } 97 if specificReturn { 98 return ret.result1 99 } 100 fakeReturns := fake.checkInstantiationPolicyReturns 101 return fakeReturns.result1 102 } 103 104 func (fake *FileSystemSupport) CheckInstantiationPolicyCallCount() int { 105 fake.checkInstantiationPolicyMutex.RLock() 106 defer fake.checkInstantiationPolicyMutex.RUnlock() 107 return len(fake.checkInstantiationPolicyArgsForCall) 108 } 109 110 func (fake *FileSystemSupport) CheckInstantiationPolicyCalls(stub func(*peer.SignedProposal, string, []byte) error) { 111 fake.checkInstantiationPolicyMutex.Lock() 112 defer fake.checkInstantiationPolicyMutex.Unlock() 113 fake.CheckInstantiationPolicyStub = stub 114 } 115 116 func (fake *FileSystemSupport) CheckInstantiationPolicyArgsForCall(i int) (*peer.SignedProposal, string, []byte) { 117 fake.checkInstantiationPolicyMutex.RLock() 118 defer fake.checkInstantiationPolicyMutex.RUnlock() 119 argsForCall := fake.checkInstantiationPolicyArgsForCall[i] 120 return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3 121 } 122 123 func (fake *FileSystemSupport) CheckInstantiationPolicyReturns(result1 error) { 124 fake.checkInstantiationPolicyMutex.Lock() 125 defer fake.checkInstantiationPolicyMutex.Unlock() 126 fake.CheckInstantiationPolicyStub = nil 127 fake.checkInstantiationPolicyReturns = struct { 128 result1 error 129 }{result1} 130 } 131 132 func (fake *FileSystemSupport) CheckInstantiationPolicyReturnsOnCall(i int, result1 error) { 133 fake.checkInstantiationPolicyMutex.Lock() 134 defer fake.checkInstantiationPolicyMutex.Unlock() 135 fake.CheckInstantiationPolicyStub = nil 136 if fake.checkInstantiationPolicyReturnsOnCall == nil { 137 fake.checkInstantiationPolicyReturnsOnCall = make(map[int]struct { 138 result1 error 139 }) 140 } 141 fake.checkInstantiationPolicyReturnsOnCall[i] = struct { 142 result1 error 143 }{result1} 144 } 145 146 func (fake *FileSystemSupport) GetChaincodeFromLocalStorage(arg1 string) (ccprovider.CCPackage, error) { 147 fake.getChaincodeFromLocalStorageMutex.Lock() 148 ret, specificReturn := fake.getChaincodeFromLocalStorageReturnsOnCall[len(fake.getChaincodeFromLocalStorageArgsForCall)] 149 fake.getChaincodeFromLocalStorageArgsForCall = append(fake.getChaincodeFromLocalStorageArgsForCall, struct { 150 arg1 string 151 }{arg1}) 152 fake.recordInvocation("GetChaincodeFromLocalStorage", []interface{}{arg1}) 153 fake.getChaincodeFromLocalStorageMutex.Unlock() 154 if fake.GetChaincodeFromLocalStorageStub != nil { 155 return fake.GetChaincodeFromLocalStorageStub(arg1) 156 } 157 if specificReturn { 158 return ret.result1, ret.result2 159 } 160 fakeReturns := fake.getChaincodeFromLocalStorageReturns 161 return fakeReturns.result1, fakeReturns.result2 162 } 163 164 func (fake *FileSystemSupport) GetChaincodeFromLocalStorageCallCount() int { 165 fake.getChaincodeFromLocalStorageMutex.RLock() 166 defer fake.getChaincodeFromLocalStorageMutex.RUnlock() 167 return len(fake.getChaincodeFromLocalStorageArgsForCall) 168 } 169 170 func (fake *FileSystemSupport) GetChaincodeFromLocalStorageCalls(stub func(string) (ccprovider.CCPackage, error)) { 171 fake.getChaincodeFromLocalStorageMutex.Lock() 172 defer fake.getChaincodeFromLocalStorageMutex.Unlock() 173 fake.GetChaincodeFromLocalStorageStub = stub 174 } 175 176 func (fake *FileSystemSupport) GetChaincodeFromLocalStorageArgsForCall(i int) string { 177 fake.getChaincodeFromLocalStorageMutex.RLock() 178 defer fake.getChaincodeFromLocalStorageMutex.RUnlock() 179 argsForCall := fake.getChaincodeFromLocalStorageArgsForCall[i] 180 return argsForCall.arg1 181 } 182 183 func (fake *FileSystemSupport) GetChaincodeFromLocalStorageReturns(result1 ccprovider.CCPackage, result2 error) { 184 fake.getChaincodeFromLocalStorageMutex.Lock() 185 defer fake.getChaincodeFromLocalStorageMutex.Unlock() 186 fake.GetChaincodeFromLocalStorageStub = nil 187 fake.getChaincodeFromLocalStorageReturns = struct { 188 result1 ccprovider.CCPackage 189 result2 error 190 }{result1, result2} 191 } 192 193 func (fake *FileSystemSupport) GetChaincodeFromLocalStorageReturnsOnCall(i int, result1 ccprovider.CCPackage, result2 error) { 194 fake.getChaincodeFromLocalStorageMutex.Lock() 195 defer fake.getChaincodeFromLocalStorageMutex.Unlock() 196 fake.GetChaincodeFromLocalStorageStub = nil 197 if fake.getChaincodeFromLocalStorageReturnsOnCall == nil { 198 fake.getChaincodeFromLocalStorageReturnsOnCall = make(map[int]struct { 199 result1 ccprovider.CCPackage 200 result2 error 201 }) 202 } 203 fake.getChaincodeFromLocalStorageReturnsOnCall[i] = struct { 204 result1 ccprovider.CCPackage 205 result2 error 206 }{result1, result2} 207 } 208 209 func (fake *FileSystemSupport) GetChaincodesFromLocalStorage() (*peer.ChaincodeQueryResponse, error) { 210 fake.getChaincodesFromLocalStorageMutex.Lock() 211 ret, specificReturn := fake.getChaincodesFromLocalStorageReturnsOnCall[len(fake.getChaincodesFromLocalStorageArgsForCall)] 212 fake.getChaincodesFromLocalStorageArgsForCall = append(fake.getChaincodesFromLocalStorageArgsForCall, struct { 213 }{}) 214 fake.recordInvocation("GetChaincodesFromLocalStorage", []interface{}{}) 215 fake.getChaincodesFromLocalStorageMutex.Unlock() 216 if fake.GetChaincodesFromLocalStorageStub != nil { 217 return fake.GetChaincodesFromLocalStorageStub() 218 } 219 if specificReturn { 220 return ret.result1, ret.result2 221 } 222 fakeReturns := fake.getChaincodesFromLocalStorageReturns 223 return fakeReturns.result1, fakeReturns.result2 224 } 225 226 func (fake *FileSystemSupport) GetChaincodesFromLocalStorageCallCount() int { 227 fake.getChaincodesFromLocalStorageMutex.RLock() 228 defer fake.getChaincodesFromLocalStorageMutex.RUnlock() 229 return len(fake.getChaincodesFromLocalStorageArgsForCall) 230 } 231 232 func (fake *FileSystemSupport) GetChaincodesFromLocalStorageCalls(stub func() (*peer.ChaincodeQueryResponse, error)) { 233 fake.getChaincodesFromLocalStorageMutex.Lock() 234 defer fake.getChaincodesFromLocalStorageMutex.Unlock() 235 fake.GetChaincodesFromLocalStorageStub = stub 236 } 237 238 func (fake *FileSystemSupport) GetChaincodesFromLocalStorageReturns(result1 *peer.ChaincodeQueryResponse, result2 error) { 239 fake.getChaincodesFromLocalStorageMutex.Lock() 240 defer fake.getChaincodesFromLocalStorageMutex.Unlock() 241 fake.GetChaincodesFromLocalStorageStub = nil 242 fake.getChaincodesFromLocalStorageReturns = struct { 243 result1 *peer.ChaincodeQueryResponse 244 result2 error 245 }{result1, result2} 246 } 247 248 func (fake *FileSystemSupport) GetChaincodesFromLocalStorageReturnsOnCall(i int, result1 *peer.ChaincodeQueryResponse, result2 error) { 249 fake.getChaincodesFromLocalStorageMutex.Lock() 250 defer fake.getChaincodesFromLocalStorageMutex.Unlock() 251 fake.GetChaincodesFromLocalStorageStub = nil 252 if fake.getChaincodesFromLocalStorageReturnsOnCall == nil { 253 fake.getChaincodesFromLocalStorageReturnsOnCall = make(map[int]struct { 254 result1 *peer.ChaincodeQueryResponse 255 result2 error 256 }) 257 } 258 fake.getChaincodesFromLocalStorageReturnsOnCall[i] = struct { 259 result1 *peer.ChaincodeQueryResponse 260 result2 error 261 }{result1, result2} 262 } 263 264 func (fake *FileSystemSupport) GetInstantiationPolicy(arg1 string, arg2 ccprovider.CCPackage) ([]byte, error) { 265 fake.getInstantiationPolicyMutex.Lock() 266 ret, specificReturn := fake.getInstantiationPolicyReturnsOnCall[len(fake.getInstantiationPolicyArgsForCall)] 267 fake.getInstantiationPolicyArgsForCall = append(fake.getInstantiationPolicyArgsForCall, struct { 268 arg1 string 269 arg2 ccprovider.CCPackage 270 }{arg1, arg2}) 271 fake.recordInvocation("GetInstantiationPolicy", []interface{}{arg1, arg2}) 272 fake.getInstantiationPolicyMutex.Unlock() 273 if fake.GetInstantiationPolicyStub != nil { 274 return fake.GetInstantiationPolicyStub(arg1, arg2) 275 } 276 if specificReturn { 277 return ret.result1, ret.result2 278 } 279 fakeReturns := fake.getInstantiationPolicyReturns 280 return fakeReturns.result1, fakeReturns.result2 281 } 282 283 func (fake *FileSystemSupport) GetInstantiationPolicyCallCount() int { 284 fake.getInstantiationPolicyMutex.RLock() 285 defer fake.getInstantiationPolicyMutex.RUnlock() 286 return len(fake.getInstantiationPolicyArgsForCall) 287 } 288 289 func (fake *FileSystemSupport) GetInstantiationPolicyCalls(stub func(string, ccprovider.CCPackage) ([]byte, error)) { 290 fake.getInstantiationPolicyMutex.Lock() 291 defer fake.getInstantiationPolicyMutex.Unlock() 292 fake.GetInstantiationPolicyStub = stub 293 } 294 295 func (fake *FileSystemSupport) GetInstantiationPolicyArgsForCall(i int) (string, ccprovider.CCPackage) { 296 fake.getInstantiationPolicyMutex.RLock() 297 defer fake.getInstantiationPolicyMutex.RUnlock() 298 argsForCall := fake.getInstantiationPolicyArgsForCall[i] 299 return argsForCall.arg1, argsForCall.arg2 300 } 301 302 func (fake *FileSystemSupport) GetInstantiationPolicyReturns(result1 []byte, result2 error) { 303 fake.getInstantiationPolicyMutex.Lock() 304 defer fake.getInstantiationPolicyMutex.Unlock() 305 fake.GetInstantiationPolicyStub = nil 306 fake.getInstantiationPolicyReturns = struct { 307 result1 []byte 308 result2 error 309 }{result1, result2} 310 } 311 312 func (fake *FileSystemSupport) GetInstantiationPolicyReturnsOnCall(i int, result1 []byte, result2 error) { 313 fake.getInstantiationPolicyMutex.Lock() 314 defer fake.getInstantiationPolicyMutex.Unlock() 315 fake.GetInstantiationPolicyStub = nil 316 if fake.getInstantiationPolicyReturnsOnCall == nil { 317 fake.getInstantiationPolicyReturnsOnCall = make(map[int]struct { 318 result1 []byte 319 result2 error 320 }) 321 } 322 fake.getInstantiationPolicyReturnsOnCall[i] = struct { 323 result1 []byte 324 result2 error 325 }{result1, result2} 326 } 327 328 func (fake *FileSystemSupport) PutChaincodeToLocalStorage(arg1 ccprovider.CCPackage) error { 329 fake.putChaincodeToLocalStorageMutex.Lock() 330 ret, specificReturn := fake.putChaincodeToLocalStorageReturnsOnCall[len(fake.putChaincodeToLocalStorageArgsForCall)] 331 fake.putChaincodeToLocalStorageArgsForCall = append(fake.putChaincodeToLocalStorageArgsForCall, struct { 332 arg1 ccprovider.CCPackage 333 }{arg1}) 334 fake.recordInvocation("PutChaincodeToLocalStorage", []interface{}{arg1}) 335 fake.putChaincodeToLocalStorageMutex.Unlock() 336 if fake.PutChaincodeToLocalStorageStub != nil { 337 return fake.PutChaincodeToLocalStorageStub(arg1) 338 } 339 if specificReturn { 340 return ret.result1 341 } 342 fakeReturns := fake.putChaincodeToLocalStorageReturns 343 return fakeReturns.result1 344 } 345 346 func (fake *FileSystemSupport) PutChaincodeToLocalStorageCallCount() int { 347 fake.putChaincodeToLocalStorageMutex.RLock() 348 defer fake.putChaincodeToLocalStorageMutex.RUnlock() 349 return len(fake.putChaincodeToLocalStorageArgsForCall) 350 } 351 352 func (fake *FileSystemSupport) PutChaincodeToLocalStorageCalls(stub func(ccprovider.CCPackage) error) { 353 fake.putChaincodeToLocalStorageMutex.Lock() 354 defer fake.putChaincodeToLocalStorageMutex.Unlock() 355 fake.PutChaincodeToLocalStorageStub = stub 356 } 357 358 func (fake *FileSystemSupport) PutChaincodeToLocalStorageArgsForCall(i int) ccprovider.CCPackage { 359 fake.putChaincodeToLocalStorageMutex.RLock() 360 defer fake.putChaincodeToLocalStorageMutex.RUnlock() 361 argsForCall := fake.putChaincodeToLocalStorageArgsForCall[i] 362 return argsForCall.arg1 363 } 364 365 func (fake *FileSystemSupport) PutChaincodeToLocalStorageReturns(result1 error) { 366 fake.putChaincodeToLocalStorageMutex.Lock() 367 defer fake.putChaincodeToLocalStorageMutex.Unlock() 368 fake.PutChaincodeToLocalStorageStub = nil 369 fake.putChaincodeToLocalStorageReturns = struct { 370 result1 error 371 }{result1} 372 } 373 374 func (fake *FileSystemSupport) PutChaincodeToLocalStorageReturnsOnCall(i int, result1 error) { 375 fake.putChaincodeToLocalStorageMutex.Lock() 376 defer fake.putChaincodeToLocalStorageMutex.Unlock() 377 fake.PutChaincodeToLocalStorageStub = nil 378 if fake.putChaincodeToLocalStorageReturnsOnCall == nil { 379 fake.putChaincodeToLocalStorageReturnsOnCall = make(map[int]struct { 380 result1 error 381 }) 382 } 383 fake.putChaincodeToLocalStorageReturnsOnCall[i] = struct { 384 result1 error 385 }{result1} 386 } 387 388 func (fake *FileSystemSupport) Invocations() map[string][][]interface{} { 389 fake.invocationsMutex.RLock() 390 defer fake.invocationsMutex.RUnlock() 391 fake.checkInstantiationPolicyMutex.RLock() 392 defer fake.checkInstantiationPolicyMutex.RUnlock() 393 fake.getChaincodeFromLocalStorageMutex.RLock() 394 defer fake.getChaincodeFromLocalStorageMutex.RUnlock() 395 fake.getChaincodesFromLocalStorageMutex.RLock() 396 defer fake.getChaincodesFromLocalStorageMutex.RUnlock() 397 fake.getInstantiationPolicyMutex.RLock() 398 defer fake.getInstantiationPolicyMutex.RUnlock() 399 fake.putChaincodeToLocalStorageMutex.RLock() 400 defer fake.putChaincodeToLocalStorageMutex.RUnlock() 401 copiedInvocations := map[string][][]interface{}{} 402 for key, value := range fake.invocations { 403 copiedInvocations[key] = value 404 } 405 return copiedInvocations 406 } 407 408 func (fake *FileSystemSupport) recordInvocation(key string, args []interface{}) { 409 fake.invocationsMutex.Lock() 410 defer fake.invocationsMutex.Unlock() 411 if fake.invocations == nil { 412 fake.invocations = map[string][][]interface{}{} 413 } 414 if fake.invocations[key] == nil { 415 fake.invocations[key] = [][]interface{}{} 416 } 417 fake.invocations[key] = append(fake.invocations[key], args) 418 }