github.com/pf-qiu/concourse/v6@v6.7.3-0.20201207032516-1f455d73275f/atc/db/dbfakes/fake_notifier.go (about) 1 // Code generated by counterfeiter. DO NOT EDIT. 2 package dbfakes 3 4 import ( 5 "sync" 6 7 "github.com/pf-qiu/concourse/v6/atc/db" 8 ) 9 10 type FakeNotifier struct { 11 CloseStub func() error 12 closeMutex sync.RWMutex 13 closeArgsForCall []struct { 14 } 15 closeReturns struct { 16 result1 error 17 } 18 closeReturnsOnCall map[int]struct { 19 result1 error 20 } 21 NotifyStub func() <-chan struct{} 22 notifyMutex sync.RWMutex 23 notifyArgsForCall []struct { 24 } 25 notifyReturns struct { 26 result1 <-chan struct{} 27 } 28 notifyReturnsOnCall map[int]struct { 29 result1 <-chan struct{} 30 } 31 invocations map[string][][]interface{} 32 invocationsMutex sync.RWMutex 33 } 34 35 func (fake *FakeNotifier) Close() error { 36 fake.closeMutex.Lock() 37 ret, specificReturn := fake.closeReturnsOnCall[len(fake.closeArgsForCall)] 38 fake.closeArgsForCall = append(fake.closeArgsForCall, struct { 39 }{}) 40 fake.recordInvocation("Close", []interface{}{}) 41 fake.closeMutex.Unlock() 42 if fake.CloseStub != nil { 43 return fake.CloseStub() 44 } 45 if specificReturn { 46 return ret.result1 47 } 48 fakeReturns := fake.closeReturns 49 return fakeReturns.result1 50 } 51 52 func (fake *FakeNotifier) CloseCallCount() int { 53 fake.closeMutex.RLock() 54 defer fake.closeMutex.RUnlock() 55 return len(fake.closeArgsForCall) 56 } 57 58 func (fake *FakeNotifier) CloseCalls(stub func() error) { 59 fake.closeMutex.Lock() 60 defer fake.closeMutex.Unlock() 61 fake.CloseStub = stub 62 } 63 64 func (fake *FakeNotifier) CloseReturns(result1 error) { 65 fake.closeMutex.Lock() 66 defer fake.closeMutex.Unlock() 67 fake.CloseStub = nil 68 fake.closeReturns = struct { 69 result1 error 70 }{result1} 71 } 72 73 func (fake *FakeNotifier) CloseReturnsOnCall(i int, result1 error) { 74 fake.closeMutex.Lock() 75 defer fake.closeMutex.Unlock() 76 fake.CloseStub = nil 77 if fake.closeReturnsOnCall == nil { 78 fake.closeReturnsOnCall = make(map[int]struct { 79 result1 error 80 }) 81 } 82 fake.closeReturnsOnCall[i] = struct { 83 result1 error 84 }{result1} 85 } 86 87 func (fake *FakeNotifier) Notify() <-chan struct{} { 88 fake.notifyMutex.Lock() 89 ret, specificReturn := fake.notifyReturnsOnCall[len(fake.notifyArgsForCall)] 90 fake.notifyArgsForCall = append(fake.notifyArgsForCall, struct { 91 }{}) 92 fake.recordInvocation("Notify", []interface{}{}) 93 fake.notifyMutex.Unlock() 94 if fake.NotifyStub != nil { 95 return fake.NotifyStub() 96 } 97 if specificReturn { 98 return ret.result1 99 } 100 fakeReturns := fake.notifyReturns 101 return fakeReturns.result1 102 } 103 104 func (fake *FakeNotifier) NotifyCallCount() int { 105 fake.notifyMutex.RLock() 106 defer fake.notifyMutex.RUnlock() 107 return len(fake.notifyArgsForCall) 108 } 109 110 func (fake *FakeNotifier) NotifyCalls(stub func() <-chan struct{}) { 111 fake.notifyMutex.Lock() 112 defer fake.notifyMutex.Unlock() 113 fake.NotifyStub = stub 114 } 115 116 func (fake *FakeNotifier) NotifyReturns(result1 <-chan struct{}) { 117 fake.notifyMutex.Lock() 118 defer fake.notifyMutex.Unlock() 119 fake.NotifyStub = nil 120 fake.notifyReturns = struct { 121 result1 <-chan struct{} 122 }{result1} 123 } 124 125 func (fake *FakeNotifier) NotifyReturnsOnCall(i int, result1 <-chan struct{}) { 126 fake.notifyMutex.Lock() 127 defer fake.notifyMutex.Unlock() 128 fake.NotifyStub = nil 129 if fake.notifyReturnsOnCall == nil { 130 fake.notifyReturnsOnCall = make(map[int]struct { 131 result1 <-chan struct{} 132 }) 133 } 134 fake.notifyReturnsOnCall[i] = struct { 135 result1 <-chan struct{} 136 }{result1} 137 } 138 139 func (fake *FakeNotifier) Invocations() map[string][][]interface{} { 140 fake.invocationsMutex.RLock() 141 defer fake.invocationsMutex.RUnlock() 142 fake.closeMutex.RLock() 143 defer fake.closeMutex.RUnlock() 144 fake.notifyMutex.RLock() 145 defer fake.notifyMutex.RUnlock() 146 copiedInvocations := map[string][][]interface{}{} 147 for key, value := range fake.invocations { 148 copiedInvocations[key] = value 149 } 150 return copiedInvocations 151 } 152 153 func (fake *FakeNotifier) recordInvocation(key string, args []interface{}) { 154 fake.invocationsMutex.Lock() 155 defer fake.invocationsMutex.Unlock() 156 if fake.invocations == nil { 157 fake.invocations = map[string][][]interface{}{} 158 } 159 if fake.invocations[key] == nil { 160 fake.invocations[key] = [][]interface{}{} 161 } 162 fake.invocations[key] = append(fake.invocations[key], args) 163 } 164 165 var _ db.Notifier = new(FakeNotifier)