github.com/hechain20/hechain@v0.0.0-20220316014945-b544036ba106/core/ledger/kvledger/mock/chaincode_info_provider.go (about) 1 // Code generated by counterfeiter. DO NOT EDIT. 2 package mock 3 4 import ( 5 "sync" 6 7 "github.com/hechain20/hechain/core/ledger" 8 "github.com/hechain20/hechain/core/ledger/cceventmgmt" 9 ) 10 11 type ChaincodeInfoProvider struct { 12 GetDeployedChaincodeInfoStub func(string, *cceventmgmt.ChaincodeDefinition) (*ledger.DeployedChaincodeInfo, error) 13 getDeployedChaincodeInfoMutex sync.RWMutex 14 getDeployedChaincodeInfoArgsForCall []struct { 15 arg1 string 16 arg2 *cceventmgmt.ChaincodeDefinition 17 } 18 getDeployedChaincodeInfoReturns struct { 19 result1 *ledger.DeployedChaincodeInfo 20 result2 error 21 } 22 getDeployedChaincodeInfoReturnsOnCall map[int]struct { 23 result1 *ledger.DeployedChaincodeInfo 24 result2 error 25 } 26 RetrieveChaincodeArtifactsStub func(*cceventmgmt.ChaincodeDefinition) (bool, []byte, error) 27 retrieveChaincodeArtifactsMutex sync.RWMutex 28 retrieveChaincodeArtifactsArgsForCall []struct { 29 arg1 *cceventmgmt.ChaincodeDefinition 30 } 31 retrieveChaincodeArtifactsReturns struct { 32 result1 bool 33 result2 []byte 34 result3 error 35 } 36 retrieveChaincodeArtifactsReturnsOnCall map[int]struct { 37 result1 bool 38 result2 []byte 39 result3 error 40 } 41 invocations map[string][][]interface{} 42 invocationsMutex sync.RWMutex 43 } 44 45 func (fake *ChaincodeInfoProvider) GetDeployedChaincodeInfo(arg1 string, arg2 *cceventmgmt.ChaincodeDefinition) (*ledger.DeployedChaincodeInfo, error) { 46 fake.getDeployedChaincodeInfoMutex.Lock() 47 ret, specificReturn := fake.getDeployedChaincodeInfoReturnsOnCall[len(fake.getDeployedChaincodeInfoArgsForCall)] 48 fake.getDeployedChaincodeInfoArgsForCall = append(fake.getDeployedChaincodeInfoArgsForCall, struct { 49 arg1 string 50 arg2 *cceventmgmt.ChaincodeDefinition 51 }{arg1, arg2}) 52 fake.recordInvocation("GetDeployedChaincodeInfo", []interface{}{arg1, arg2}) 53 fake.getDeployedChaincodeInfoMutex.Unlock() 54 if fake.GetDeployedChaincodeInfoStub != nil { 55 return fake.GetDeployedChaincodeInfoStub(arg1, arg2) 56 } 57 if specificReturn { 58 return ret.result1, ret.result2 59 } 60 fakeReturns := fake.getDeployedChaincodeInfoReturns 61 return fakeReturns.result1, fakeReturns.result2 62 } 63 64 func (fake *ChaincodeInfoProvider) GetDeployedChaincodeInfoCallCount() int { 65 fake.getDeployedChaincodeInfoMutex.RLock() 66 defer fake.getDeployedChaincodeInfoMutex.RUnlock() 67 return len(fake.getDeployedChaincodeInfoArgsForCall) 68 } 69 70 func (fake *ChaincodeInfoProvider) GetDeployedChaincodeInfoCalls(stub func(string, *cceventmgmt.ChaincodeDefinition) (*ledger.DeployedChaincodeInfo, error)) { 71 fake.getDeployedChaincodeInfoMutex.Lock() 72 defer fake.getDeployedChaincodeInfoMutex.Unlock() 73 fake.GetDeployedChaincodeInfoStub = stub 74 } 75 76 func (fake *ChaincodeInfoProvider) GetDeployedChaincodeInfoArgsForCall(i int) (string, *cceventmgmt.ChaincodeDefinition) { 77 fake.getDeployedChaincodeInfoMutex.RLock() 78 defer fake.getDeployedChaincodeInfoMutex.RUnlock() 79 argsForCall := fake.getDeployedChaincodeInfoArgsForCall[i] 80 return argsForCall.arg1, argsForCall.arg2 81 } 82 83 func (fake *ChaincodeInfoProvider) GetDeployedChaincodeInfoReturns(result1 *ledger.DeployedChaincodeInfo, result2 error) { 84 fake.getDeployedChaincodeInfoMutex.Lock() 85 defer fake.getDeployedChaincodeInfoMutex.Unlock() 86 fake.GetDeployedChaincodeInfoStub = nil 87 fake.getDeployedChaincodeInfoReturns = struct { 88 result1 *ledger.DeployedChaincodeInfo 89 result2 error 90 }{result1, result2} 91 } 92 93 func (fake *ChaincodeInfoProvider) GetDeployedChaincodeInfoReturnsOnCall(i int, result1 *ledger.DeployedChaincodeInfo, result2 error) { 94 fake.getDeployedChaincodeInfoMutex.Lock() 95 defer fake.getDeployedChaincodeInfoMutex.Unlock() 96 fake.GetDeployedChaincodeInfoStub = nil 97 if fake.getDeployedChaincodeInfoReturnsOnCall == nil { 98 fake.getDeployedChaincodeInfoReturnsOnCall = make(map[int]struct { 99 result1 *ledger.DeployedChaincodeInfo 100 result2 error 101 }) 102 } 103 fake.getDeployedChaincodeInfoReturnsOnCall[i] = struct { 104 result1 *ledger.DeployedChaincodeInfo 105 result2 error 106 }{result1, result2} 107 } 108 109 func (fake *ChaincodeInfoProvider) RetrieveChaincodeArtifacts(arg1 *cceventmgmt.ChaincodeDefinition) (bool, []byte, error) { 110 fake.retrieveChaincodeArtifactsMutex.Lock() 111 ret, specificReturn := fake.retrieveChaincodeArtifactsReturnsOnCall[len(fake.retrieveChaincodeArtifactsArgsForCall)] 112 fake.retrieveChaincodeArtifactsArgsForCall = append(fake.retrieveChaincodeArtifactsArgsForCall, struct { 113 arg1 *cceventmgmt.ChaincodeDefinition 114 }{arg1}) 115 fake.recordInvocation("RetrieveChaincodeArtifacts", []interface{}{arg1}) 116 fake.retrieveChaincodeArtifactsMutex.Unlock() 117 if fake.RetrieveChaincodeArtifactsStub != nil { 118 return fake.RetrieveChaincodeArtifactsStub(arg1) 119 } 120 if specificReturn { 121 return ret.result1, ret.result2, ret.result3 122 } 123 fakeReturns := fake.retrieveChaincodeArtifactsReturns 124 return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 125 } 126 127 func (fake *ChaincodeInfoProvider) RetrieveChaincodeArtifactsCallCount() int { 128 fake.retrieveChaincodeArtifactsMutex.RLock() 129 defer fake.retrieveChaincodeArtifactsMutex.RUnlock() 130 return len(fake.retrieveChaincodeArtifactsArgsForCall) 131 } 132 133 func (fake *ChaincodeInfoProvider) RetrieveChaincodeArtifactsCalls(stub func(*cceventmgmt.ChaincodeDefinition) (bool, []byte, error)) { 134 fake.retrieveChaincodeArtifactsMutex.Lock() 135 defer fake.retrieveChaincodeArtifactsMutex.Unlock() 136 fake.RetrieveChaincodeArtifactsStub = stub 137 } 138 139 func (fake *ChaincodeInfoProvider) RetrieveChaincodeArtifactsArgsForCall(i int) *cceventmgmt.ChaincodeDefinition { 140 fake.retrieveChaincodeArtifactsMutex.RLock() 141 defer fake.retrieveChaincodeArtifactsMutex.RUnlock() 142 argsForCall := fake.retrieveChaincodeArtifactsArgsForCall[i] 143 return argsForCall.arg1 144 } 145 146 func (fake *ChaincodeInfoProvider) RetrieveChaincodeArtifactsReturns(result1 bool, result2 []byte, result3 error) { 147 fake.retrieveChaincodeArtifactsMutex.Lock() 148 defer fake.retrieveChaincodeArtifactsMutex.Unlock() 149 fake.RetrieveChaincodeArtifactsStub = nil 150 fake.retrieveChaincodeArtifactsReturns = struct { 151 result1 bool 152 result2 []byte 153 result3 error 154 }{result1, result2, result3} 155 } 156 157 func (fake *ChaincodeInfoProvider) RetrieveChaincodeArtifactsReturnsOnCall(i int, result1 bool, result2 []byte, result3 error) { 158 fake.retrieveChaincodeArtifactsMutex.Lock() 159 defer fake.retrieveChaincodeArtifactsMutex.Unlock() 160 fake.RetrieveChaincodeArtifactsStub = nil 161 if fake.retrieveChaincodeArtifactsReturnsOnCall == nil { 162 fake.retrieveChaincodeArtifactsReturnsOnCall = make(map[int]struct { 163 result1 bool 164 result2 []byte 165 result3 error 166 }) 167 } 168 fake.retrieveChaincodeArtifactsReturnsOnCall[i] = struct { 169 result1 bool 170 result2 []byte 171 result3 error 172 }{result1, result2, result3} 173 } 174 175 func (fake *ChaincodeInfoProvider) Invocations() map[string][][]interface{} { 176 fake.invocationsMutex.RLock() 177 defer fake.invocationsMutex.RUnlock() 178 fake.getDeployedChaincodeInfoMutex.RLock() 179 defer fake.getDeployedChaincodeInfoMutex.RUnlock() 180 fake.retrieveChaincodeArtifactsMutex.RLock() 181 defer fake.retrieveChaincodeArtifactsMutex.RUnlock() 182 copiedInvocations := map[string][][]interface{}{} 183 for key, value := range fake.invocations { 184 copiedInvocations[key] = value 185 } 186 return copiedInvocations 187 } 188 189 func (fake *ChaincodeInfoProvider) recordInvocation(key string, args []interface{}) { 190 fake.invocationsMutex.Lock() 191 defer fake.invocationsMutex.Unlock() 192 if fake.invocations == nil { 193 fake.invocations = map[string][][]interface{}{} 194 } 195 if fake.invocations[key] == nil { 196 fake.invocations[key] = [][]interface{}{} 197 } 198 fake.invocations[key] = append(fake.invocations[key], args) 199 }