github.com/hyperledger-labs/bdls@v2.1.1+incompatible/core/chaincode/lifecycle/mock/chaincode_info_cache.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 ChaincodeInfoCache struct { 11 ChaincodeInfoStub func(string, string) (*lifecycle.LocalChaincodeInfo, error) 12 chaincodeInfoMutex sync.RWMutex 13 chaincodeInfoArgsForCall []struct { 14 arg1 string 15 arg2 string 16 } 17 chaincodeInfoReturns struct { 18 result1 *lifecycle.LocalChaincodeInfo 19 result2 error 20 } 21 chaincodeInfoReturnsOnCall map[int]struct { 22 result1 *lifecycle.LocalChaincodeInfo 23 result2 error 24 } 25 invocations map[string][][]interface{} 26 invocationsMutex sync.RWMutex 27 } 28 29 func (fake *ChaincodeInfoCache) ChaincodeInfo(arg1 string, arg2 string) (*lifecycle.LocalChaincodeInfo, error) { 30 fake.chaincodeInfoMutex.Lock() 31 ret, specificReturn := fake.chaincodeInfoReturnsOnCall[len(fake.chaincodeInfoArgsForCall)] 32 fake.chaincodeInfoArgsForCall = append(fake.chaincodeInfoArgsForCall, struct { 33 arg1 string 34 arg2 string 35 }{arg1, arg2}) 36 fake.recordInvocation("ChaincodeInfo", []interface{}{arg1, arg2}) 37 fake.chaincodeInfoMutex.Unlock() 38 if fake.ChaincodeInfoStub != nil { 39 return fake.ChaincodeInfoStub(arg1, arg2) 40 } 41 if specificReturn { 42 return ret.result1, ret.result2 43 } 44 fakeReturns := fake.chaincodeInfoReturns 45 return fakeReturns.result1, fakeReturns.result2 46 } 47 48 func (fake *ChaincodeInfoCache) ChaincodeInfoCallCount() int { 49 fake.chaincodeInfoMutex.RLock() 50 defer fake.chaincodeInfoMutex.RUnlock() 51 return len(fake.chaincodeInfoArgsForCall) 52 } 53 54 func (fake *ChaincodeInfoCache) ChaincodeInfoCalls(stub func(string, string) (*lifecycle.LocalChaincodeInfo, error)) { 55 fake.chaincodeInfoMutex.Lock() 56 defer fake.chaincodeInfoMutex.Unlock() 57 fake.ChaincodeInfoStub = stub 58 } 59 60 func (fake *ChaincodeInfoCache) ChaincodeInfoArgsForCall(i int) (string, string) { 61 fake.chaincodeInfoMutex.RLock() 62 defer fake.chaincodeInfoMutex.RUnlock() 63 argsForCall := fake.chaincodeInfoArgsForCall[i] 64 return argsForCall.arg1, argsForCall.arg2 65 } 66 67 func (fake *ChaincodeInfoCache) ChaincodeInfoReturns(result1 *lifecycle.LocalChaincodeInfo, result2 error) { 68 fake.chaincodeInfoMutex.Lock() 69 defer fake.chaincodeInfoMutex.Unlock() 70 fake.ChaincodeInfoStub = nil 71 fake.chaincodeInfoReturns = struct { 72 result1 *lifecycle.LocalChaincodeInfo 73 result2 error 74 }{result1, result2} 75 } 76 77 func (fake *ChaincodeInfoCache) ChaincodeInfoReturnsOnCall(i int, result1 *lifecycle.LocalChaincodeInfo, result2 error) { 78 fake.chaincodeInfoMutex.Lock() 79 defer fake.chaincodeInfoMutex.Unlock() 80 fake.ChaincodeInfoStub = nil 81 if fake.chaincodeInfoReturnsOnCall == nil { 82 fake.chaincodeInfoReturnsOnCall = make(map[int]struct { 83 result1 *lifecycle.LocalChaincodeInfo 84 result2 error 85 }) 86 } 87 fake.chaincodeInfoReturnsOnCall[i] = struct { 88 result1 *lifecycle.LocalChaincodeInfo 89 result2 error 90 }{result1, result2} 91 } 92 93 func (fake *ChaincodeInfoCache) Invocations() map[string][][]interface{} { 94 fake.invocationsMutex.RLock() 95 defer fake.invocationsMutex.RUnlock() 96 fake.chaincodeInfoMutex.RLock() 97 defer fake.chaincodeInfoMutex.RUnlock() 98 copiedInvocations := map[string][][]interface{}{} 99 for key, value := range fake.invocations { 100 copiedInvocations[key] = value 101 } 102 return copiedInvocations 103 } 104 105 func (fake *ChaincodeInfoCache) recordInvocation(key string, args []interface{}) { 106 fake.invocationsMutex.Lock() 107 defer fake.invocationsMutex.Unlock() 108 if fake.invocations == nil { 109 fake.invocations = map[string][][]interface{}{} 110 } 111 if fake.invocations[key] == nil { 112 fake.invocations[key] = [][]interface{}{} 113 } 114 fake.invocations[key] = append(fake.invocations[key], args) 115 } 116 117 var _ lifecycle.ChaincodeInfoCache = new(ChaincodeInfoCache)