github.com/chenbh/concourse/v6@v6.4.2/atc/wrappa/wrappafakes/fake_pool.go (about) 1 // Code generated by counterfeiter. DO NOT EDIT. 2 package wrappafakes 3 4 import ( 5 "sync" 6 7 "github.com/chenbh/concourse/v6/atc/wrappa" 8 ) 9 10 type FakePool struct { 11 ReleaseStub func() 12 releaseMutex sync.RWMutex 13 releaseArgsForCall []struct { 14 } 15 SizeStub func() int 16 sizeMutex sync.RWMutex 17 sizeArgsForCall []struct { 18 } 19 sizeReturns struct { 20 result1 int 21 } 22 sizeReturnsOnCall map[int]struct { 23 result1 int 24 } 25 TryAcquireStub func() bool 26 tryAcquireMutex sync.RWMutex 27 tryAcquireArgsForCall []struct { 28 } 29 tryAcquireReturns struct { 30 result1 bool 31 } 32 tryAcquireReturnsOnCall map[int]struct { 33 result1 bool 34 } 35 invocations map[string][][]interface{} 36 invocationsMutex sync.RWMutex 37 } 38 39 func (fake *FakePool) Release() { 40 fake.releaseMutex.Lock() 41 fake.releaseArgsForCall = append(fake.releaseArgsForCall, struct { 42 }{}) 43 fake.recordInvocation("Release", []interface{}{}) 44 fake.releaseMutex.Unlock() 45 if fake.ReleaseStub != nil { 46 fake.ReleaseStub() 47 } 48 } 49 50 func (fake *FakePool) ReleaseCallCount() int { 51 fake.releaseMutex.RLock() 52 defer fake.releaseMutex.RUnlock() 53 return len(fake.releaseArgsForCall) 54 } 55 56 func (fake *FakePool) ReleaseCalls(stub func()) { 57 fake.releaseMutex.Lock() 58 defer fake.releaseMutex.Unlock() 59 fake.ReleaseStub = stub 60 } 61 62 func (fake *FakePool) Size() int { 63 fake.sizeMutex.Lock() 64 ret, specificReturn := fake.sizeReturnsOnCall[len(fake.sizeArgsForCall)] 65 fake.sizeArgsForCall = append(fake.sizeArgsForCall, struct { 66 }{}) 67 fake.recordInvocation("Size", []interface{}{}) 68 fake.sizeMutex.Unlock() 69 if fake.SizeStub != nil { 70 return fake.SizeStub() 71 } 72 if specificReturn { 73 return ret.result1 74 } 75 fakeReturns := fake.sizeReturns 76 return fakeReturns.result1 77 } 78 79 func (fake *FakePool) SizeCallCount() int { 80 fake.sizeMutex.RLock() 81 defer fake.sizeMutex.RUnlock() 82 return len(fake.sizeArgsForCall) 83 } 84 85 func (fake *FakePool) SizeCalls(stub func() int) { 86 fake.sizeMutex.Lock() 87 defer fake.sizeMutex.Unlock() 88 fake.SizeStub = stub 89 } 90 91 func (fake *FakePool) SizeReturns(result1 int) { 92 fake.sizeMutex.Lock() 93 defer fake.sizeMutex.Unlock() 94 fake.SizeStub = nil 95 fake.sizeReturns = struct { 96 result1 int 97 }{result1} 98 } 99 100 func (fake *FakePool) SizeReturnsOnCall(i int, result1 int) { 101 fake.sizeMutex.Lock() 102 defer fake.sizeMutex.Unlock() 103 fake.SizeStub = nil 104 if fake.sizeReturnsOnCall == nil { 105 fake.sizeReturnsOnCall = make(map[int]struct { 106 result1 int 107 }) 108 } 109 fake.sizeReturnsOnCall[i] = struct { 110 result1 int 111 }{result1} 112 } 113 114 func (fake *FakePool) TryAcquire() bool { 115 fake.tryAcquireMutex.Lock() 116 ret, specificReturn := fake.tryAcquireReturnsOnCall[len(fake.tryAcquireArgsForCall)] 117 fake.tryAcquireArgsForCall = append(fake.tryAcquireArgsForCall, struct { 118 }{}) 119 fake.recordInvocation("TryAcquire", []interface{}{}) 120 fake.tryAcquireMutex.Unlock() 121 if fake.TryAcquireStub != nil { 122 return fake.TryAcquireStub() 123 } 124 if specificReturn { 125 return ret.result1 126 } 127 fakeReturns := fake.tryAcquireReturns 128 return fakeReturns.result1 129 } 130 131 func (fake *FakePool) TryAcquireCallCount() int { 132 fake.tryAcquireMutex.RLock() 133 defer fake.tryAcquireMutex.RUnlock() 134 return len(fake.tryAcquireArgsForCall) 135 } 136 137 func (fake *FakePool) TryAcquireCalls(stub func() bool) { 138 fake.tryAcquireMutex.Lock() 139 defer fake.tryAcquireMutex.Unlock() 140 fake.TryAcquireStub = stub 141 } 142 143 func (fake *FakePool) TryAcquireReturns(result1 bool) { 144 fake.tryAcquireMutex.Lock() 145 defer fake.tryAcquireMutex.Unlock() 146 fake.TryAcquireStub = nil 147 fake.tryAcquireReturns = struct { 148 result1 bool 149 }{result1} 150 } 151 152 func (fake *FakePool) TryAcquireReturnsOnCall(i int, result1 bool) { 153 fake.tryAcquireMutex.Lock() 154 defer fake.tryAcquireMutex.Unlock() 155 fake.TryAcquireStub = nil 156 if fake.tryAcquireReturnsOnCall == nil { 157 fake.tryAcquireReturnsOnCall = make(map[int]struct { 158 result1 bool 159 }) 160 } 161 fake.tryAcquireReturnsOnCall[i] = struct { 162 result1 bool 163 }{result1} 164 } 165 166 func (fake *FakePool) Invocations() map[string][][]interface{} { 167 fake.invocationsMutex.RLock() 168 defer fake.invocationsMutex.RUnlock() 169 fake.releaseMutex.RLock() 170 defer fake.releaseMutex.RUnlock() 171 fake.sizeMutex.RLock() 172 defer fake.sizeMutex.RUnlock() 173 fake.tryAcquireMutex.RLock() 174 defer fake.tryAcquireMutex.RUnlock() 175 copiedInvocations := map[string][][]interface{}{} 176 for key, value := range fake.invocations { 177 copiedInvocations[key] = value 178 } 179 return copiedInvocations 180 } 181 182 func (fake *FakePool) recordInvocation(key string, args []interface{}) { 183 fake.invocationsMutex.Lock() 184 defer fake.invocationsMutex.Unlock() 185 if fake.invocations == nil { 186 fake.invocations = map[string][][]interface{}{} 187 } 188 if fake.invocations[key] == nil { 189 fake.invocations[key] = [][]interface{}{} 190 } 191 fake.invocations[key] = append(fake.invocations[key], args) 192 } 193 194 var _ wrappa.Pool = new(FakePool)