github.com/anjalikarhana/fabric@v2.1.1+incompatible/orderer/common/blockcutter/mock/config_fetcher.go (about) 1 // Code generated by counterfeiter. DO NOT EDIT. 2 package mock 3 4 import ( 5 "sync" 6 7 "github.com/hyperledger/fabric/common/channelconfig" 8 ) 9 10 type OrdererConfigFetcher struct { 11 OrdererConfigStub func() (channelconfig.Orderer, bool) 12 ordererConfigMutex sync.RWMutex 13 ordererConfigArgsForCall []struct { 14 } 15 ordererConfigReturns struct { 16 result1 channelconfig.Orderer 17 result2 bool 18 } 19 ordererConfigReturnsOnCall map[int]struct { 20 result1 channelconfig.Orderer 21 result2 bool 22 } 23 invocations map[string][][]interface{} 24 invocationsMutex sync.RWMutex 25 } 26 27 func (fake *OrdererConfigFetcher) OrdererConfig() (channelconfig.Orderer, bool) { 28 fake.ordererConfigMutex.Lock() 29 ret, specificReturn := fake.ordererConfigReturnsOnCall[len(fake.ordererConfigArgsForCall)] 30 fake.ordererConfigArgsForCall = append(fake.ordererConfigArgsForCall, struct { 31 }{}) 32 fake.recordInvocation("OrdererConfig", []interface{}{}) 33 fake.ordererConfigMutex.Unlock() 34 if fake.OrdererConfigStub != nil { 35 return fake.OrdererConfigStub() 36 } 37 if specificReturn { 38 return ret.result1, ret.result2 39 } 40 fakeReturns := fake.ordererConfigReturns 41 return fakeReturns.result1, fakeReturns.result2 42 } 43 44 func (fake *OrdererConfigFetcher) OrdererConfigCallCount() int { 45 fake.ordererConfigMutex.RLock() 46 defer fake.ordererConfigMutex.RUnlock() 47 return len(fake.ordererConfigArgsForCall) 48 } 49 50 func (fake *OrdererConfigFetcher) OrdererConfigCalls(stub func() (channelconfig.Orderer, bool)) { 51 fake.ordererConfigMutex.Lock() 52 defer fake.ordererConfigMutex.Unlock() 53 fake.OrdererConfigStub = stub 54 } 55 56 func (fake *OrdererConfigFetcher) OrdererConfigReturns(result1 channelconfig.Orderer, result2 bool) { 57 fake.ordererConfigMutex.Lock() 58 defer fake.ordererConfigMutex.Unlock() 59 fake.OrdererConfigStub = nil 60 fake.ordererConfigReturns = struct { 61 result1 channelconfig.Orderer 62 result2 bool 63 }{result1, result2} 64 } 65 66 func (fake *OrdererConfigFetcher) OrdererConfigReturnsOnCall(i int, result1 channelconfig.Orderer, result2 bool) { 67 fake.ordererConfigMutex.Lock() 68 defer fake.ordererConfigMutex.Unlock() 69 fake.OrdererConfigStub = nil 70 if fake.ordererConfigReturnsOnCall == nil { 71 fake.ordererConfigReturnsOnCall = make(map[int]struct { 72 result1 channelconfig.Orderer 73 result2 bool 74 }) 75 } 76 fake.ordererConfigReturnsOnCall[i] = struct { 77 result1 channelconfig.Orderer 78 result2 bool 79 }{result1, result2} 80 } 81 82 func (fake *OrdererConfigFetcher) Invocations() map[string][][]interface{} { 83 fake.invocationsMutex.RLock() 84 defer fake.invocationsMutex.RUnlock() 85 fake.ordererConfigMutex.RLock() 86 defer fake.ordererConfigMutex.RUnlock() 87 copiedInvocations := map[string][][]interface{}{} 88 for key, value := range fake.invocations { 89 copiedInvocations[key] = value 90 } 91 return copiedInvocations 92 } 93 94 func (fake *OrdererConfigFetcher) recordInvocation(key string, args []interface{}) { 95 fake.invocationsMutex.Lock() 96 defer fake.invocationsMutex.Unlock() 97 if fake.invocations == nil { 98 fake.invocations = map[string][][]interface{}{} 99 } 100 if fake.invocations[key] == nil { 101 fake.invocations[key] = [][]interface{}{} 102 } 103 fake.invocations[key] = append(fake.invocations[key], args) 104 }