github.com/hechain20/hechain@v0.0.0-20220316014945-b544036ba106/discovery/support/mocks/config_getter.go (about) 1 // Code generated by counterfeiter. DO NOT EDIT. 2 package mocks 3 4 import ( 5 "sync" 6 7 "github.com/hyperledger/fabric-protos-go/common" 8 ) 9 10 type ConfigGetter struct { 11 GetCurrConfigStub func(string) *common.Config 12 getCurrConfigMutex sync.RWMutex 13 getCurrConfigArgsForCall []struct { 14 arg1 string 15 } 16 getCurrConfigReturns struct { 17 result1 *common.Config 18 } 19 getCurrConfigReturnsOnCall map[int]struct { 20 result1 *common.Config 21 } 22 invocations map[string][][]interface{} 23 invocationsMutex sync.RWMutex 24 } 25 26 func (fake *ConfigGetter) GetCurrConfig(arg1 string) *common.Config { 27 fake.getCurrConfigMutex.Lock() 28 ret, specificReturn := fake.getCurrConfigReturnsOnCall[len(fake.getCurrConfigArgsForCall)] 29 fake.getCurrConfigArgsForCall = append(fake.getCurrConfigArgsForCall, struct { 30 arg1 string 31 }{arg1}) 32 fake.recordInvocation("GetCurrConfig", []interface{}{arg1}) 33 fake.getCurrConfigMutex.Unlock() 34 if fake.GetCurrConfigStub != nil { 35 return fake.GetCurrConfigStub(arg1) 36 } 37 if specificReturn { 38 return ret.result1 39 } 40 fakeReturns := fake.getCurrConfigReturns 41 return fakeReturns.result1 42 } 43 44 func (fake *ConfigGetter) GetCurrConfigCallCount() int { 45 fake.getCurrConfigMutex.RLock() 46 defer fake.getCurrConfigMutex.RUnlock() 47 return len(fake.getCurrConfigArgsForCall) 48 } 49 50 func (fake *ConfigGetter) GetCurrConfigCalls(stub func(string) *common.Config) { 51 fake.getCurrConfigMutex.Lock() 52 defer fake.getCurrConfigMutex.Unlock() 53 fake.GetCurrConfigStub = stub 54 } 55 56 func (fake *ConfigGetter) GetCurrConfigArgsForCall(i int) string { 57 fake.getCurrConfigMutex.RLock() 58 defer fake.getCurrConfigMutex.RUnlock() 59 argsForCall := fake.getCurrConfigArgsForCall[i] 60 return argsForCall.arg1 61 } 62 63 func (fake *ConfigGetter) GetCurrConfigReturns(result1 *common.Config) { 64 fake.getCurrConfigMutex.Lock() 65 defer fake.getCurrConfigMutex.Unlock() 66 fake.GetCurrConfigStub = nil 67 fake.getCurrConfigReturns = struct { 68 result1 *common.Config 69 }{result1} 70 } 71 72 func (fake *ConfigGetter) GetCurrConfigReturnsOnCall(i int, result1 *common.Config) { 73 fake.getCurrConfigMutex.Lock() 74 defer fake.getCurrConfigMutex.Unlock() 75 fake.GetCurrConfigStub = nil 76 if fake.getCurrConfigReturnsOnCall == nil { 77 fake.getCurrConfigReturnsOnCall = make(map[int]struct { 78 result1 *common.Config 79 }) 80 } 81 fake.getCurrConfigReturnsOnCall[i] = struct { 82 result1 *common.Config 83 }{result1} 84 } 85 86 func (fake *ConfigGetter) Invocations() map[string][][]interface{} { 87 fake.invocationsMutex.RLock() 88 defer fake.invocationsMutex.RUnlock() 89 fake.getCurrConfigMutex.RLock() 90 defer fake.getCurrConfigMutex.RUnlock() 91 copiedInvocations := map[string][][]interface{}{} 92 for key, value := range fake.invocations { 93 copiedInvocations[key] = value 94 } 95 return copiedInvocations 96 } 97 98 func (fake *ConfigGetter) recordInvocation(key string, args []interface{}) { 99 fake.invocationsMutex.Lock() 100 defer fake.invocationsMutex.Unlock() 101 if fake.invocations == nil { 102 fake.invocations = map[string][][]interface{}{} 103 } 104 if fake.invocations[key] == nil { 105 fake.invocations[key] = [][]interface{}{} 106 } 107 fake.invocations[key] = append(fake.invocations[key], args) 108 }