github.com/hyperledger-labs/bdls@v2.1.1+incompatible/core/chaincode/lifecycle/mock/channel_config_source.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 "github.com/hyperledger/fabric/core/chaincode/lifecycle" 9 ) 10 11 type ChannelConfigSource struct { 12 GetStableChannelConfigStub func(string) channelconfig.Resources 13 getStableChannelConfigMutex sync.RWMutex 14 getStableChannelConfigArgsForCall []struct { 15 arg1 string 16 } 17 getStableChannelConfigReturns struct { 18 result1 channelconfig.Resources 19 } 20 getStableChannelConfigReturnsOnCall map[int]struct { 21 result1 channelconfig.Resources 22 } 23 invocations map[string][][]interface{} 24 invocationsMutex sync.RWMutex 25 } 26 27 func (fake *ChannelConfigSource) GetStableChannelConfig(arg1 string) channelconfig.Resources { 28 fake.getStableChannelConfigMutex.Lock() 29 ret, specificReturn := fake.getStableChannelConfigReturnsOnCall[len(fake.getStableChannelConfigArgsForCall)] 30 fake.getStableChannelConfigArgsForCall = append(fake.getStableChannelConfigArgsForCall, struct { 31 arg1 string 32 }{arg1}) 33 fake.recordInvocation("GetStableChannelConfig", []interface{}{arg1}) 34 fake.getStableChannelConfigMutex.Unlock() 35 if fake.GetStableChannelConfigStub != nil { 36 return fake.GetStableChannelConfigStub(arg1) 37 } 38 if specificReturn { 39 return ret.result1 40 } 41 fakeReturns := fake.getStableChannelConfigReturns 42 return fakeReturns.result1 43 } 44 45 func (fake *ChannelConfigSource) GetStableChannelConfigCallCount() int { 46 fake.getStableChannelConfigMutex.RLock() 47 defer fake.getStableChannelConfigMutex.RUnlock() 48 return len(fake.getStableChannelConfigArgsForCall) 49 } 50 51 func (fake *ChannelConfigSource) GetStableChannelConfigCalls(stub func(string) channelconfig.Resources) { 52 fake.getStableChannelConfigMutex.Lock() 53 defer fake.getStableChannelConfigMutex.Unlock() 54 fake.GetStableChannelConfigStub = stub 55 } 56 57 func (fake *ChannelConfigSource) GetStableChannelConfigArgsForCall(i int) string { 58 fake.getStableChannelConfigMutex.RLock() 59 defer fake.getStableChannelConfigMutex.RUnlock() 60 argsForCall := fake.getStableChannelConfigArgsForCall[i] 61 return argsForCall.arg1 62 } 63 64 func (fake *ChannelConfigSource) GetStableChannelConfigReturns(result1 channelconfig.Resources) { 65 fake.getStableChannelConfigMutex.Lock() 66 defer fake.getStableChannelConfigMutex.Unlock() 67 fake.GetStableChannelConfigStub = nil 68 fake.getStableChannelConfigReturns = struct { 69 result1 channelconfig.Resources 70 }{result1} 71 } 72 73 func (fake *ChannelConfigSource) GetStableChannelConfigReturnsOnCall(i int, result1 channelconfig.Resources) { 74 fake.getStableChannelConfigMutex.Lock() 75 defer fake.getStableChannelConfigMutex.Unlock() 76 fake.GetStableChannelConfigStub = nil 77 if fake.getStableChannelConfigReturnsOnCall == nil { 78 fake.getStableChannelConfigReturnsOnCall = make(map[int]struct { 79 result1 channelconfig.Resources 80 }) 81 } 82 fake.getStableChannelConfigReturnsOnCall[i] = struct { 83 result1 channelconfig.Resources 84 }{result1} 85 } 86 87 func (fake *ChannelConfigSource) Invocations() map[string][][]interface{} { 88 fake.invocationsMutex.RLock() 89 defer fake.invocationsMutex.RUnlock() 90 fake.getStableChannelConfigMutex.RLock() 91 defer fake.getStableChannelConfigMutex.RUnlock() 92 copiedInvocations := map[string][][]interface{}{} 93 for key, value := range fake.invocations { 94 copiedInvocations[key] = value 95 } 96 return copiedInvocations 97 } 98 99 func (fake *ChannelConfigSource) recordInvocation(key string, args []interface{}) { 100 fake.invocationsMutex.Lock() 101 defer fake.invocationsMutex.Unlock() 102 if fake.invocations == nil { 103 fake.invocations = map[string][][]interface{}{} 104 } 105 if fake.invocations[key] == nil { 106 fake.invocations[key] = [][]interface{}{} 107 } 108 fake.invocations[key] = append(fake.invocations[key], args) 109 } 110 111 var _ lifecycle.ChannelConfigSource = new(ChannelConfigSource)