github.com/true-sqn/fabric@v2.1.1+incompatible/core/ledger/mock/health_check_registry.go (about) 1 // Code generated by counterfeiter. DO NOT EDIT. 2 package mock 3 4 import ( 5 "sync" 6 7 "github.com/hyperledger/fabric-lib-go/healthz" 8 "github.com/hyperledger/fabric/core/ledger" 9 ) 10 11 type HealthCheckRegistry struct { 12 RegisterCheckerStub func(string, healthz.HealthChecker) error 13 registerCheckerMutex sync.RWMutex 14 registerCheckerArgsForCall []struct { 15 arg1 string 16 arg2 healthz.HealthChecker 17 } 18 registerCheckerReturns struct { 19 result1 error 20 } 21 registerCheckerReturnsOnCall map[int]struct { 22 result1 error 23 } 24 invocations map[string][][]interface{} 25 invocationsMutex sync.RWMutex 26 } 27 28 func (fake *HealthCheckRegistry) RegisterChecker(arg1 string, arg2 healthz.HealthChecker) error { 29 fake.registerCheckerMutex.Lock() 30 ret, specificReturn := fake.registerCheckerReturnsOnCall[len(fake.registerCheckerArgsForCall)] 31 fake.registerCheckerArgsForCall = append(fake.registerCheckerArgsForCall, struct { 32 arg1 string 33 arg2 healthz.HealthChecker 34 }{arg1, arg2}) 35 fake.recordInvocation("RegisterChecker", []interface{}{arg1, arg2}) 36 fake.registerCheckerMutex.Unlock() 37 if fake.RegisterCheckerStub != nil { 38 return fake.RegisterCheckerStub(arg1, arg2) 39 } 40 if specificReturn { 41 return ret.result1 42 } 43 fakeReturns := fake.registerCheckerReturns 44 return fakeReturns.result1 45 } 46 47 func (fake *HealthCheckRegistry) RegisterCheckerCallCount() int { 48 fake.registerCheckerMutex.RLock() 49 defer fake.registerCheckerMutex.RUnlock() 50 return len(fake.registerCheckerArgsForCall) 51 } 52 53 func (fake *HealthCheckRegistry) RegisterCheckerCalls(stub func(string, healthz.HealthChecker) error) { 54 fake.registerCheckerMutex.Lock() 55 defer fake.registerCheckerMutex.Unlock() 56 fake.RegisterCheckerStub = stub 57 } 58 59 func (fake *HealthCheckRegistry) RegisterCheckerArgsForCall(i int) (string, healthz.HealthChecker) { 60 fake.registerCheckerMutex.RLock() 61 defer fake.registerCheckerMutex.RUnlock() 62 argsForCall := fake.registerCheckerArgsForCall[i] 63 return argsForCall.arg1, argsForCall.arg2 64 } 65 66 func (fake *HealthCheckRegistry) RegisterCheckerReturns(result1 error) { 67 fake.registerCheckerMutex.Lock() 68 defer fake.registerCheckerMutex.Unlock() 69 fake.RegisterCheckerStub = nil 70 fake.registerCheckerReturns = struct { 71 result1 error 72 }{result1} 73 } 74 75 func (fake *HealthCheckRegistry) RegisterCheckerReturnsOnCall(i int, result1 error) { 76 fake.registerCheckerMutex.Lock() 77 defer fake.registerCheckerMutex.Unlock() 78 fake.RegisterCheckerStub = nil 79 if fake.registerCheckerReturnsOnCall == nil { 80 fake.registerCheckerReturnsOnCall = make(map[int]struct { 81 result1 error 82 }) 83 } 84 fake.registerCheckerReturnsOnCall[i] = struct { 85 result1 error 86 }{result1} 87 } 88 89 func (fake *HealthCheckRegistry) Invocations() map[string][][]interface{} { 90 fake.invocationsMutex.RLock() 91 defer fake.invocationsMutex.RUnlock() 92 fake.registerCheckerMutex.RLock() 93 defer fake.registerCheckerMutex.RUnlock() 94 copiedInvocations := map[string][][]interface{}{} 95 for key, value := range fake.invocations { 96 copiedInvocations[key] = value 97 } 98 return copiedInvocations 99 } 100 101 func (fake *HealthCheckRegistry) recordInvocation(key string, args []interface{}) { 102 fake.invocationsMutex.Lock() 103 defer fake.invocationsMutex.Unlock() 104 if fake.invocations == nil { 105 fake.invocations = map[string][][]interface{}{} 106 } 107 if fake.invocations[key] == nil { 108 fake.invocations[key] = [][]interface{}{} 109 } 110 fake.invocations[key] = append(fake.invocations[key], args) 111 } 112 113 var _ ledger.HealthCheckRegistry = new(HealthCheckRegistry)