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