github.com/hyperledger-labs/bdls@v2.1.1+incompatible/core/chaincode/lifecycle/mock/query_executor.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/ledger" 8 ) 9 10 type SimpleQueryExecutor struct { 11 GetPrivateDataHashStub func(string, string, string) ([]byte, error) 12 getPrivateDataHashMutex sync.RWMutex 13 getPrivateDataHashArgsForCall []struct { 14 arg1 string 15 arg2 string 16 arg3 string 17 } 18 getPrivateDataHashReturns struct { 19 result1 []byte 20 result2 error 21 } 22 getPrivateDataHashReturnsOnCall map[int]struct { 23 result1 []byte 24 result2 error 25 } 26 GetStateStub func(string, string) ([]byte, error) 27 getStateMutex sync.RWMutex 28 getStateArgsForCall []struct { 29 arg1 string 30 arg2 string 31 } 32 getStateReturns struct { 33 result1 []byte 34 result2 error 35 } 36 getStateReturnsOnCall map[int]struct { 37 result1 []byte 38 result2 error 39 } 40 GetStateRangeScanIteratorStub func(string, string, string) (ledger.ResultsIterator, error) 41 getStateRangeScanIteratorMutex sync.RWMutex 42 getStateRangeScanIteratorArgsForCall []struct { 43 arg1 string 44 arg2 string 45 arg3 string 46 } 47 getStateRangeScanIteratorReturns struct { 48 result1 ledger.ResultsIterator 49 result2 error 50 } 51 getStateRangeScanIteratorReturnsOnCall map[int]struct { 52 result1 ledger.ResultsIterator 53 result2 error 54 } 55 invocations map[string][][]interface{} 56 invocationsMutex sync.RWMutex 57 } 58 59 func (fake *SimpleQueryExecutor) GetPrivateDataHash(arg1 string, arg2 string, arg3 string) ([]byte, error) { 60 fake.getPrivateDataHashMutex.Lock() 61 ret, specificReturn := fake.getPrivateDataHashReturnsOnCall[len(fake.getPrivateDataHashArgsForCall)] 62 fake.getPrivateDataHashArgsForCall = append(fake.getPrivateDataHashArgsForCall, struct { 63 arg1 string 64 arg2 string 65 arg3 string 66 }{arg1, arg2, arg3}) 67 fake.recordInvocation("GetPrivateDataHash", []interface{}{arg1, arg2, arg3}) 68 fake.getPrivateDataHashMutex.Unlock() 69 if fake.GetPrivateDataHashStub != nil { 70 return fake.GetPrivateDataHashStub(arg1, arg2, arg3) 71 } 72 if specificReturn { 73 return ret.result1, ret.result2 74 } 75 fakeReturns := fake.getPrivateDataHashReturns 76 return fakeReturns.result1, fakeReturns.result2 77 } 78 79 func (fake *SimpleQueryExecutor) GetPrivateDataHashCallCount() int { 80 fake.getPrivateDataHashMutex.RLock() 81 defer fake.getPrivateDataHashMutex.RUnlock() 82 return len(fake.getPrivateDataHashArgsForCall) 83 } 84 85 func (fake *SimpleQueryExecutor) GetPrivateDataHashCalls(stub func(string, string, string) ([]byte, error)) { 86 fake.getPrivateDataHashMutex.Lock() 87 defer fake.getPrivateDataHashMutex.Unlock() 88 fake.GetPrivateDataHashStub = stub 89 } 90 91 func (fake *SimpleQueryExecutor) GetPrivateDataHashArgsForCall(i int) (string, string, string) { 92 fake.getPrivateDataHashMutex.RLock() 93 defer fake.getPrivateDataHashMutex.RUnlock() 94 argsForCall := fake.getPrivateDataHashArgsForCall[i] 95 return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3 96 } 97 98 func (fake *SimpleQueryExecutor) GetPrivateDataHashReturns(result1 []byte, result2 error) { 99 fake.getPrivateDataHashMutex.Lock() 100 defer fake.getPrivateDataHashMutex.Unlock() 101 fake.GetPrivateDataHashStub = nil 102 fake.getPrivateDataHashReturns = struct { 103 result1 []byte 104 result2 error 105 }{result1, result2} 106 } 107 108 func (fake *SimpleQueryExecutor) GetPrivateDataHashReturnsOnCall(i int, result1 []byte, result2 error) { 109 fake.getPrivateDataHashMutex.Lock() 110 defer fake.getPrivateDataHashMutex.Unlock() 111 fake.GetPrivateDataHashStub = nil 112 if fake.getPrivateDataHashReturnsOnCall == nil { 113 fake.getPrivateDataHashReturnsOnCall = make(map[int]struct { 114 result1 []byte 115 result2 error 116 }) 117 } 118 fake.getPrivateDataHashReturnsOnCall[i] = struct { 119 result1 []byte 120 result2 error 121 }{result1, result2} 122 } 123 124 func (fake *SimpleQueryExecutor) GetState(arg1 string, arg2 string) ([]byte, error) { 125 fake.getStateMutex.Lock() 126 ret, specificReturn := fake.getStateReturnsOnCall[len(fake.getStateArgsForCall)] 127 fake.getStateArgsForCall = append(fake.getStateArgsForCall, struct { 128 arg1 string 129 arg2 string 130 }{arg1, arg2}) 131 fake.recordInvocation("GetState", []interface{}{arg1, arg2}) 132 fake.getStateMutex.Unlock() 133 if fake.GetStateStub != nil { 134 return fake.GetStateStub(arg1, arg2) 135 } 136 if specificReturn { 137 return ret.result1, ret.result2 138 } 139 fakeReturns := fake.getStateReturns 140 return fakeReturns.result1, fakeReturns.result2 141 } 142 143 func (fake *SimpleQueryExecutor) GetStateCallCount() int { 144 fake.getStateMutex.RLock() 145 defer fake.getStateMutex.RUnlock() 146 return len(fake.getStateArgsForCall) 147 } 148 149 func (fake *SimpleQueryExecutor) GetStateCalls(stub func(string, string) ([]byte, error)) { 150 fake.getStateMutex.Lock() 151 defer fake.getStateMutex.Unlock() 152 fake.GetStateStub = stub 153 } 154 155 func (fake *SimpleQueryExecutor) GetStateArgsForCall(i int) (string, string) { 156 fake.getStateMutex.RLock() 157 defer fake.getStateMutex.RUnlock() 158 argsForCall := fake.getStateArgsForCall[i] 159 return argsForCall.arg1, argsForCall.arg2 160 } 161 162 func (fake *SimpleQueryExecutor) GetStateReturns(result1 []byte, result2 error) { 163 fake.getStateMutex.Lock() 164 defer fake.getStateMutex.Unlock() 165 fake.GetStateStub = nil 166 fake.getStateReturns = struct { 167 result1 []byte 168 result2 error 169 }{result1, result2} 170 } 171 172 func (fake *SimpleQueryExecutor) GetStateReturnsOnCall(i int, result1 []byte, result2 error) { 173 fake.getStateMutex.Lock() 174 defer fake.getStateMutex.Unlock() 175 fake.GetStateStub = nil 176 if fake.getStateReturnsOnCall == nil { 177 fake.getStateReturnsOnCall = make(map[int]struct { 178 result1 []byte 179 result2 error 180 }) 181 } 182 fake.getStateReturnsOnCall[i] = struct { 183 result1 []byte 184 result2 error 185 }{result1, result2} 186 } 187 188 func (fake *SimpleQueryExecutor) GetStateRangeScanIterator(arg1 string, arg2 string, arg3 string) (ledger.ResultsIterator, error) { 189 fake.getStateRangeScanIteratorMutex.Lock() 190 ret, specificReturn := fake.getStateRangeScanIteratorReturnsOnCall[len(fake.getStateRangeScanIteratorArgsForCall)] 191 fake.getStateRangeScanIteratorArgsForCall = append(fake.getStateRangeScanIteratorArgsForCall, struct { 192 arg1 string 193 arg2 string 194 arg3 string 195 }{arg1, arg2, arg3}) 196 fake.recordInvocation("GetStateRangeScanIterator", []interface{}{arg1, arg2, arg3}) 197 fake.getStateRangeScanIteratorMutex.Unlock() 198 if fake.GetStateRangeScanIteratorStub != nil { 199 return fake.GetStateRangeScanIteratorStub(arg1, arg2, arg3) 200 } 201 if specificReturn { 202 return ret.result1, ret.result2 203 } 204 fakeReturns := fake.getStateRangeScanIteratorReturns 205 return fakeReturns.result1, fakeReturns.result2 206 } 207 208 func (fake *SimpleQueryExecutor) GetStateRangeScanIteratorCallCount() int { 209 fake.getStateRangeScanIteratorMutex.RLock() 210 defer fake.getStateRangeScanIteratorMutex.RUnlock() 211 return len(fake.getStateRangeScanIteratorArgsForCall) 212 } 213 214 func (fake *SimpleQueryExecutor) GetStateRangeScanIteratorCalls(stub func(string, string, string) (ledger.ResultsIterator, error)) { 215 fake.getStateRangeScanIteratorMutex.Lock() 216 defer fake.getStateRangeScanIteratorMutex.Unlock() 217 fake.GetStateRangeScanIteratorStub = stub 218 } 219 220 func (fake *SimpleQueryExecutor) GetStateRangeScanIteratorArgsForCall(i int) (string, string, string) { 221 fake.getStateRangeScanIteratorMutex.RLock() 222 defer fake.getStateRangeScanIteratorMutex.RUnlock() 223 argsForCall := fake.getStateRangeScanIteratorArgsForCall[i] 224 return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3 225 } 226 227 func (fake *SimpleQueryExecutor) GetStateRangeScanIteratorReturns(result1 ledger.ResultsIterator, result2 error) { 228 fake.getStateRangeScanIteratorMutex.Lock() 229 defer fake.getStateRangeScanIteratorMutex.Unlock() 230 fake.GetStateRangeScanIteratorStub = nil 231 fake.getStateRangeScanIteratorReturns = struct { 232 result1 ledger.ResultsIterator 233 result2 error 234 }{result1, result2} 235 } 236 237 func (fake *SimpleQueryExecutor) GetStateRangeScanIteratorReturnsOnCall(i int, result1 ledger.ResultsIterator, result2 error) { 238 fake.getStateRangeScanIteratorMutex.Lock() 239 defer fake.getStateRangeScanIteratorMutex.Unlock() 240 fake.GetStateRangeScanIteratorStub = nil 241 if fake.getStateRangeScanIteratorReturnsOnCall == nil { 242 fake.getStateRangeScanIteratorReturnsOnCall = make(map[int]struct { 243 result1 ledger.ResultsIterator 244 result2 error 245 }) 246 } 247 fake.getStateRangeScanIteratorReturnsOnCall[i] = struct { 248 result1 ledger.ResultsIterator 249 result2 error 250 }{result1, result2} 251 } 252 253 func (fake *SimpleQueryExecutor) Invocations() map[string][][]interface{} { 254 fake.invocationsMutex.RLock() 255 defer fake.invocationsMutex.RUnlock() 256 fake.getPrivateDataHashMutex.RLock() 257 defer fake.getPrivateDataHashMutex.RUnlock() 258 fake.getStateMutex.RLock() 259 defer fake.getStateMutex.RUnlock() 260 fake.getStateRangeScanIteratorMutex.RLock() 261 defer fake.getStateRangeScanIteratorMutex.RUnlock() 262 copiedInvocations := map[string][][]interface{}{} 263 for key, value := range fake.invocations { 264 copiedInvocations[key] = value 265 } 266 return copiedInvocations 267 } 268 269 func (fake *SimpleQueryExecutor) recordInvocation(key string, args []interface{}) { 270 fake.invocationsMutex.Lock() 271 defer fake.invocationsMutex.Unlock() 272 if fake.invocations == nil { 273 fake.invocations = map[string][][]interface{}{} 274 } 275 if fake.invocations[key] == nil { 276 fake.invocations[key] = [][]interface{}{} 277 } 278 fake.invocations[key] = append(fake.invocations[key], args) 279 }