github.com/suchongming/fabric@v2.1.1+incompatible/core/operations/fakes/healthchecker.go (about) 1 // Code generated by counterfeiter. DO NOT EDIT. 2 package fakes 3 4 import ( 5 "context" 6 "sync" 7 ) 8 9 type HealthChecker struct { 10 HealthCheckStub func(context.Context) error 11 healthCheckMutex sync.RWMutex 12 healthCheckArgsForCall []struct { 13 arg1 context.Context 14 } 15 healthCheckReturns struct { 16 result1 error 17 } 18 healthCheckReturnsOnCall map[int]struct { 19 result1 error 20 } 21 invocations map[string][][]interface{} 22 invocationsMutex sync.RWMutex 23 } 24 25 func (fake *HealthChecker) HealthCheck(arg1 context.Context) error { 26 fake.healthCheckMutex.Lock() 27 ret, specificReturn := fake.healthCheckReturnsOnCall[len(fake.healthCheckArgsForCall)] 28 fake.healthCheckArgsForCall = append(fake.healthCheckArgsForCall, struct { 29 arg1 context.Context 30 }{arg1}) 31 fake.recordInvocation("HealthCheck", []interface{}{arg1}) 32 fake.healthCheckMutex.Unlock() 33 if fake.HealthCheckStub != nil { 34 return fake.HealthCheckStub(arg1) 35 } 36 if specificReturn { 37 return ret.result1 38 } 39 fakeReturns := fake.healthCheckReturns 40 return fakeReturns.result1 41 } 42 43 func (fake *HealthChecker) HealthCheckCallCount() int { 44 fake.healthCheckMutex.RLock() 45 defer fake.healthCheckMutex.RUnlock() 46 return len(fake.healthCheckArgsForCall) 47 } 48 49 func (fake *HealthChecker) HealthCheckCalls(stub func(context.Context) error) { 50 fake.healthCheckMutex.Lock() 51 defer fake.healthCheckMutex.Unlock() 52 fake.HealthCheckStub = stub 53 } 54 55 func (fake *HealthChecker) HealthCheckArgsForCall(i int) context.Context { 56 fake.healthCheckMutex.RLock() 57 defer fake.healthCheckMutex.RUnlock() 58 argsForCall := fake.healthCheckArgsForCall[i] 59 return argsForCall.arg1 60 } 61 62 func (fake *HealthChecker) HealthCheckReturns(result1 error) { 63 fake.healthCheckMutex.Lock() 64 defer fake.healthCheckMutex.Unlock() 65 fake.HealthCheckStub = nil 66 fake.healthCheckReturns = struct { 67 result1 error 68 }{result1} 69 } 70 71 func (fake *HealthChecker) HealthCheckReturnsOnCall(i int, result1 error) { 72 fake.healthCheckMutex.Lock() 73 defer fake.healthCheckMutex.Unlock() 74 fake.HealthCheckStub = nil 75 if fake.healthCheckReturnsOnCall == nil { 76 fake.healthCheckReturnsOnCall = make(map[int]struct { 77 result1 error 78 }) 79 } 80 fake.healthCheckReturnsOnCall[i] = struct { 81 result1 error 82 }{result1} 83 } 84 85 func (fake *HealthChecker) Invocations() map[string][][]interface{} { 86 fake.invocationsMutex.RLock() 87 defer fake.invocationsMutex.RUnlock() 88 fake.healthCheckMutex.RLock() 89 defer fake.healthCheckMutex.RUnlock() 90 copiedInvocations := map[string][][]interface{}{} 91 for key, value := range fake.invocations { 92 copiedInvocations[key] = value 93 } 94 return copiedInvocations 95 } 96 97 func (fake *HealthChecker) recordInvocation(key string, args []interface{}) { 98 fake.invocationsMutex.Lock() 99 defer fake.invocationsMutex.Unlock() 100 if fake.invocations == nil { 101 fake.invocations = map[string][][]interface{}{} 102 } 103 if fake.invocations[key] == nil { 104 fake.invocations[key] = [][]interface{}{} 105 } 106 fake.invocations[key] = append(fake.invocations[key], args) 107 }