github.com/true-sqn/fabric@v2.1.1+incompatible/core/chaincode/fake/query_response_builder.go (about) 1 // Code generated by counterfeiter. DO NOT EDIT. 2 package fake 3 4 import ( 5 "sync" 6 7 "github.com/hyperledger/fabric-protos-go/peer" 8 "github.com/hyperledger/fabric/common/ledger" 9 "github.com/hyperledger/fabric/core/chaincode" 10 ) 11 12 type QueryResponseBuilder struct { 13 BuildQueryResponseStub func(*chaincode.TransactionContext, ledger.ResultsIterator, string, bool, int32) (*peer.QueryResponse, error) 14 buildQueryResponseMutex sync.RWMutex 15 buildQueryResponseArgsForCall []struct { 16 arg1 *chaincode.TransactionContext 17 arg2 ledger.ResultsIterator 18 arg3 string 19 arg4 bool 20 arg5 int32 21 } 22 buildQueryResponseReturns struct { 23 result1 *peer.QueryResponse 24 result2 error 25 } 26 buildQueryResponseReturnsOnCall map[int]struct { 27 result1 *peer.QueryResponse 28 result2 error 29 } 30 invocations map[string][][]interface{} 31 invocationsMutex sync.RWMutex 32 } 33 34 func (fake *QueryResponseBuilder) BuildQueryResponse(arg1 *chaincode.TransactionContext, arg2 ledger.ResultsIterator, arg3 string, arg4 bool, arg5 int32) (*peer.QueryResponse, error) { 35 fake.buildQueryResponseMutex.Lock() 36 ret, specificReturn := fake.buildQueryResponseReturnsOnCall[len(fake.buildQueryResponseArgsForCall)] 37 fake.buildQueryResponseArgsForCall = append(fake.buildQueryResponseArgsForCall, struct { 38 arg1 *chaincode.TransactionContext 39 arg2 ledger.ResultsIterator 40 arg3 string 41 arg4 bool 42 arg5 int32 43 }{arg1, arg2, arg3, arg4, arg5}) 44 fake.recordInvocation("BuildQueryResponse", []interface{}{arg1, arg2, arg3, arg4, arg5}) 45 fake.buildQueryResponseMutex.Unlock() 46 if fake.BuildQueryResponseStub != nil { 47 return fake.BuildQueryResponseStub(arg1, arg2, arg3, arg4, arg5) 48 } 49 if specificReturn { 50 return ret.result1, ret.result2 51 } 52 fakeReturns := fake.buildQueryResponseReturns 53 return fakeReturns.result1, fakeReturns.result2 54 } 55 56 func (fake *QueryResponseBuilder) BuildQueryResponseCallCount() int { 57 fake.buildQueryResponseMutex.RLock() 58 defer fake.buildQueryResponseMutex.RUnlock() 59 return len(fake.buildQueryResponseArgsForCall) 60 } 61 62 func (fake *QueryResponseBuilder) BuildQueryResponseCalls(stub func(*chaincode.TransactionContext, ledger.ResultsIterator, string, bool, int32) (*peer.QueryResponse, error)) { 63 fake.buildQueryResponseMutex.Lock() 64 defer fake.buildQueryResponseMutex.Unlock() 65 fake.BuildQueryResponseStub = stub 66 } 67 68 func (fake *QueryResponseBuilder) BuildQueryResponseArgsForCall(i int) (*chaincode.TransactionContext, ledger.ResultsIterator, string, bool, int32) { 69 fake.buildQueryResponseMutex.RLock() 70 defer fake.buildQueryResponseMutex.RUnlock() 71 argsForCall := fake.buildQueryResponseArgsForCall[i] 72 return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3, argsForCall.arg4, argsForCall.arg5 73 } 74 75 func (fake *QueryResponseBuilder) BuildQueryResponseReturns(result1 *peer.QueryResponse, result2 error) { 76 fake.buildQueryResponseMutex.Lock() 77 defer fake.buildQueryResponseMutex.Unlock() 78 fake.BuildQueryResponseStub = nil 79 fake.buildQueryResponseReturns = struct { 80 result1 *peer.QueryResponse 81 result2 error 82 }{result1, result2} 83 } 84 85 func (fake *QueryResponseBuilder) BuildQueryResponseReturnsOnCall(i int, result1 *peer.QueryResponse, result2 error) { 86 fake.buildQueryResponseMutex.Lock() 87 defer fake.buildQueryResponseMutex.Unlock() 88 fake.BuildQueryResponseStub = nil 89 if fake.buildQueryResponseReturnsOnCall == nil { 90 fake.buildQueryResponseReturnsOnCall = make(map[int]struct { 91 result1 *peer.QueryResponse 92 result2 error 93 }) 94 } 95 fake.buildQueryResponseReturnsOnCall[i] = struct { 96 result1 *peer.QueryResponse 97 result2 error 98 }{result1, result2} 99 } 100 101 func (fake *QueryResponseBuilder) Invocations() map[string][][]interface{} { 102 fake.invocationsMutex.RLock() 103 defer fake.invocationsMutex.RUnlock() 104 fake.buildQueryResponseMutex.RLock() 105 defer fake.buildQueryResponseMutex.RUnlock() 106 copiedInvocations := map[string][][]interface{}{} 107 for key, value := range fake.invocations { 108 copiedInvocations[key] = value 109 } 110 return copiedInvocations 111 } 112 113 func (fake *QueryResponseBuilder) recordInvocation(key string, args []interface{}) { 114 fake.invocationsMutex.Lock() 115 defer fake.invocationsMutex.Unlock() 116 if fake.invocations == nil { 117 fake.invocations = map[string][][]interface{}{} 118 } 119 if fake.invocations[key] == nil { 120 fake.invocations[key] = [][]interface{}{} 121 } 122 fake.invocations[key] = append(fake.invocations[key], args) 123 }