github.com/true-sqn/fabric@v2.1.1+incompatible/core/ledger/mock/cc_event_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/ledger" 8 ) 9 10 type ChaincodeLifecycleEventProvider struct { 11 RegisterListenerStub func(string, ledger.ChaincodeLifecycleEventListener) 12 registerListenerMutex sync.RWMutex 13 registerListenerArgsForCall []struct { 14 arg1 string 15 arg2 ledger.ChaincodeLifecycleEventListener 16 } 17 invocations map[string][][]interface{} 18 invocationsMutex sync.RWMutex 19 } 20 21 func (fake *ChaincodeLifecycleEventProvider) RegisterListener(arg1 string, arg2 ledger.ChaincodeLifecycleEventListener) { 22 fake.registerListenerMutex.Lock() 23 fake.registerListenerArgsForCall = append(fake.registerListenerArgsForCall, struct { 24 arg1 string 25 arg2 ledger.ChaincodeLifecycleEventListener 26 }{arg1, arg2}) 27 fake.recordInvocation("RegisterListener", []interface{}{arg1, arg2}) 28 fake.registerListenerMutex.Unlock() 29 if fake.RegisterListenerStub != nil { 30 fake.RegisterListenerStub(arg1, arg2) 31 } 32 } 33 34 func (fake *ChaincodeLifecycleEventProvider) RegisterListenerCallCount() int { 35 fake.registerListenerMutex.RLock() 36 defer fake.registerListenerMutex.RUnlock() 37 return len(fake.registerListenerArgsForCall) 38 } 39 40 func (fake *ChaincodeLifecycleEventProvider) RegisterListenerCalls(stub func(string, ledger.ChaincodeLifecycleEventListener)) { 41 fake.registerListenerMutex.Lock() 42 defer fake.registerListenerMutex.Unlock() 43 fake.RegisterListenerStub = stub 44 } 45 46 func (fake *ChaincodeLifecycleEventProvider) RegisterListenerArgsForCall(i int) (string, ledger.ChaincodeLifecycleEventListener) { 47 fake.registerListenerMutex.RLock() 48 defer fake.registerListenerMutex.RUnlock() 49 argsForCall := fake.registerListenerArgsForCall[i] 50 return argsForCall.arg1, argsForCall.arg2 51 } 52 53 func (fake *ChaincodeLifecycleEventProvider) Invocations() map[string][][]interface{} { 54 fake.invocationsMutex.RLock() 55 defer fake.invocationsMutex.RUnlock() 56 fake.registerListenerMutex.RLock() 57 defer fake.registerListenerMutex.RUnlock() 58 copiedInvocations := map[string][][]interface{}{} 59 for key, value := range fake.invocations { 60 copiedInvocations[key] = value 61 } 62 return copiedInvocations 63 } 64 65 func (fake *ChaincodeLifecycleEventProvider) recordInvocation(key string, args []interface{}) { 66 fake.invocationsMutex.Lock() 67 defer fake.invocationsMutex.Unlock() 68 if fake.invocations == nil { 69 fake.invocations = map[string][][]interface{}{} 70 } 71 if fake.invocations[key] == nil { 72 fake.invocations[key] = [][]interface{}{} 73 } 74 fake.invocations[key] = append(fake.invocations[key], args) 75 } 76 77 var _ ledger.ChaincodeLifecycleEventProvider = new(ChaincodeLifecycleEventProvider)