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