github.com/hechain20/hechain@v0.0.0-20220316014945-b544036ba106/orderer/common/follower/mocks/chain_creator.go (about) 1 // Code generated by counterfeiter. DO NOT EDIT. 2 package mocks 3 4 import ( 5 "sync" 6 7 "github.com/hechain20/hechain/orderer/common/follower" 8 ) 9 10 type ChainCreator struct { 11 SwitchFollowerToChainStub func(string) 12 switchFollowerToChainMutex sync.RWMutex 13 switchFollowerToChainArgsForCall []struct { 14 arg1 string 15 } 16 invocations map[string][][]interface{} 17 invocationsMutex sync.RWMutex 18 } 19 20 func (fake *ChainCreator) SwitchFollowerToChain(arg1 string) { 21 fake.switchFollowerToChainMutex.Lock() 22 fake.switchFollowerToChainArgsForCall = append(fake.switchFollowerToChainArgsForCall, struct { 23 arg1 string 24 }{arg1}) 25 fake.recordInvocation("SwitchFollowerToChain", []interface{}{arg1}) 26 fake.switchFollowerToChainMutex.Unlock() 27 if fake.SwitchFollowerToChainStub != nil { 28 fake.SwitchFollowerToChainStub(arg1) 29 } 30 } 31 32 func (fake *ChainCreator) SwitchFollowerToChainCallCount() int { 33 fake.switchFollowerToChainMutex.RLock() 34 defer fake.switchFollowerToChainMutex.RUnlock() 35 return len(fake.switchFollowerToChainArgsForCall) 36 } 37 38 func (fake *ChainCreator) SwitchFollowerToChainCalls(stub func(string)) { 39 fake.switchFollowerToChainMutex.Lock() 40 defer fake.switchFollowerToChainMutex.Unlock() 41 fake.SwitchFollowerToChainStub = stub 42 } 43 44 func (fake *ChainCreator) SwitchFollowerToChainArgsForCall(i int) string { 45 fake.switchFollowerToChainMutex.RLock() 46 defer fake.switchFollowerToChainMutex.RUnlock() 47 argsForCall := fake.switchFollowerToChainArgsForCall[i] 48 return argsForCall.arg1 49 } 50 51 func (fake *ChainCreator) Invocations() map[string][][]interface{} { 52 fake.invocationsMutex.RLock() 53 defer fake.invocationsMutex.RUnlock() 54 fake.switchFollowerToChainMutex.RLock() 55 defer fake.switchFollowerToChainMutex.RUnlock() 56 copiedInvocations := map[string][][]interface{}{} 57 for key, value := range fake.invocations { 58 copiedInvocations[key] = value 59 } 60 return copiedInvocations 61 } 62 63 func (fake *ChainCreator) recordInvocation(key string, args []interface{}) { 64 fake.invocationsMutex.Lock() 65 defer fake.invocationsMutex.Unlock() 66 if fake.invocations == nil { 67 fake.invocations = map[string][][]interface{}{} 68 } 69 if fake.invocations[key] == nil { 70 fake.invocations[key] = [][]interface{}{} 71 } 72 fake.invocations[key] = append(fake.invocations[key], args) 73 } 74 75 var _ follower.ChainCreator = new(ChainCreator)