github.com/mook-as/cf-cli@v7.0.0-beta.28.0.20200120190804-b91c115fae48+incompatible/cf/api/logs/logsfakes/fake_noaa_consumer.go (about) 1 // Code generated by counterfeiter. DO NOT EDIT. 2 package logsfakes 3 4 import ( 5 "sync" 6 7 "code.cloudfoundry.org/cli/cf/api/logs" 8 "github.com/cloudfoundry/noaa/consumer" 9 "github.com/cloudfoundry/sonde-go/events" 10 ) 11 12 type FakeNoaaConsumer struct { 13 CloseStub func() error 14 closeMutex sync.RWMutex 15 closeArgsForCall []struct { 16 } 17 closeReturns struct { 18 result1 error 19 } 20 closeReturnsOnCall map[int]struct { 21 result1 error 22 } 23 RecentLogsStub func(string, string) ([]*events.LogMessage, error) 24 recentLogsMutex sync.RWMutex 25 recentLogsArgsForCall []struct { 26 arg1 string 27 arg2 string 28 } 29 recentLogsReturns struct { 30 result1 []*events.LogMessage 31 result2 error 32 } 33 recentLogsReturnsOnCall map[int]struct { 34 result1 []*events.LogMessage 35 result2 error 36 } 37 RefreshTokenFromStub func(consumer.TokenRefresher) 38 refreshTokenFromMutex sync.RWMutex 39 refreshTokenFromArgsForCall []struct { 40 arg1 consumer.TokenRefresher 41 } 42 SetOnConnectCallbackStub func(func()) 43 setOnConnectCallbackMutex sync.RWMutex 44 setOnConnectCallbackArgsForCall []struct { 45 arg1 func() 46 } 47 TailingLogsStub func(string, string) (<-chan *events.LogMessage, <-chan error) 48 tailingLogsMutex sync.RWMutex 49 tailingLogsArgsForCall []struct { 50 arg1 string 51 arg2 string 52 } 53 tailingLogsReturns struct { 54 result1 <-chan *events.LogMessage 55 result2 <-chan error 56 } 57 tailingLogsReturnsOnCall map[int]struct { 58 result1 <-chan *events.LogMessage 59 result2 <-chan error 60 } 61 invocations map[string][][]interface{} 62 invocationsMutex sync.RWMutex 63 } 64 65 func (fake *FakeNoaaConsumer) Close() error { 66 fake.closeMutex.Lock() 67 ret, specificReturn := fake.closeReturnsOnCall[len(fake.closeArgsForCall)] 68 fake.closeArgsForCall = append(fake.closeArgsForCall, struct { 69 }{}) 70 fake.recordInvocation("Close", []interface{}{}) 71 fake.closeMutex.Unlock() 72 if fake.CloseStub != nil { 73 return fake.CloseStub() 74 } 75 if specificReturn { 76 return ret.result1 77 } 78 fakeReturns := fake.closeReturns 79 return fakeReturns.result1 80 } 81 82 func (fake *FakeNoaaConsumer) CloseCallCount() int { 83 fake.closeMutex.RLock() 84 defer fake.closeMutex.RUnlock() 85 return len(fake.closeArgsForCall) 86 } 87 88 func (fake *FakeNoaaConsumer) CloseCalls(stub func() error) { 89 fake.closeMutex.Lock() 90 defer fake.closeMutex.Unlock() 91 fake.CloseStub = stub 92 } 93 94 func (fake *FakeNoaaConsumer) CloseReturns(result1 error) { 95 fake.closeMutex.Lock() 96 defer fake.closeMutex.Unlock() 97 fake.CloseStub = nil 98 fake.closeReturns = struct { 99 result1 error 100 }{result1} 101 } 102 103 func (fake *FakeNoaaConsumer) CloseReturnsOnCall(i int, result1 error) { 104 fake.closeMutex.Lock() 105 defer fake.closeMutex.Unlock() 106 fake.CloseStub = nil 107 if fake.closeReturnsOnCall == nil { 108 fake.closeReturnsOnCall = make(map[int]struct { 109 result1 error 110 }) 111 } 112 fake.closeReturnsOnCall[i] = struct { 113 result1 error 114 }{result1} 115 } 116 117 func (fake *FakeNoaaConsumer) RecentLogs(arg1 string, arg2 string) ([]*events.LogMessage, error) { 118 fake.recentLogsMutex.Lock() 119 ret, specificReturn := fake.recentLogsReturnsOnCall[len(fake.recentLogsArgsForCall)] 120 fake.recentLogsArgsForCall = append(fake.recentLogsArgsForCall, struct { 121 arg1 string 122 arg2 string 123 }{arg1, arg2}) 124 fake.recordInvocation("RecentLogs", []interface{}{arg1, arg2}) 125 fake.recentLogsMutex.Unlock() 126 if fake.RecentLogsStub != nil { 127 return fake.RecentLogsStub(arg1, arg2) 128 } 129 if specificReturn { 130 return ret.result1, ret.result2 131 } 132 fakeReturns := fake.recentLogsReturns 133 return fakeReturns.result1, fakeReturns.result2 134 } 135 136 func (fake *FakeNoaaConsumer) RecentLogsCallCount() int { 137 fake.recentLogsMutex.RLock() 138 defer fake.recentLogsMutex.RUnlock() 139 return len(fake.recentLogsArgsForCall) 140 } 141 142 func (fake *FakeNoaaConsumer) RecentLogsCalls(stub func(string, string) ([]*events.LogMessage, error)) { 143 fake.recentLogsMutex.Lock() 144 defer fake.recentLogsMutex.Unlock() 145 fake.RecentLogsStub = stub 146 } 147 148 func (fake *FakeNoaaConsumer) RecentLogsArgsForCall(i int) (string, string) { 149 fake.recentLogsMutex.RLock() 150 defer fake.recentLogsMutex.RUnlock() 151 argsForCall := fake.recentLogsArgsForCall[i] 152 return argsForCall.arg1, argsForCall.arg2 153 } 154 155 func (fake *FakeNoaaConsumer) RecentLogsReturns(result1 []*events.LogMessage, result2 error) { 156 fake.recentLogsMutex.Lock() 157 defer fake.recentLogsMutex.Unlock() 158 fake.RecentLogsStub = nil 159 fake.recentLogsReturns = struct { 160 result1 []*events.LogMessage 161 result2 error 162 }{result1, result2} 163 } 164 165 func (fake *FakeNoaaConsumer) RecentLogsReturnsOnCall(i int, result1 []*events.LogMessage, result2 error) { 166 fake.recentLogsMutex.Lock() 167 defer fake.recentLogsMutex.Unlock() 168 fake.RecentLogsStub = nil 169 if fake.recentLogsReturnsOnCall == nil { 170 fake.recentLogsReturnsOnCall = make(map[int]struct { 171 result1 []*events.LogMessage 172 result2 error 173 }) 174 } 175 fake.recentLogsReturnsOnCall[i] = struct { 176 result1 []*events.LogMessage 177 result2 error 178 }{result1, result2} 179 } 180 181 func (fake *FakeNoaaConsumer) RefreshTokenFrom(arg1 consumer.TokenRefresher) { 182 fake.refreshTokenFromMutex.Lock() 183 fake.refreshTokenFromArgsForCall = append(fake.refreshTokenFromArgsForCall, struct { 184 arg1 consumer.TokenRefresher 185 }{arg1}) 186 fake.recordInvocation("RefreshTokenFrom", []interface{}{arg1}) 187 fake.refreshTokenFromMutex.Unlock() 188 if fake.RefreshTokenFromStub != nil { 189 fake.RefreshTokenFromStub(arg1) 190 } 191 } 192 193 func (fake *FakeNoaaConsumer) RefreshTokenFromCallCount() int { 194 fake.refreshTokenFromMutex.RLock() 195 defer fake.refreshTokenFromMutex.RUnlock() 196 return len(fake.refreshTokenFromArgsForCall) 197 } 198 199 func (fake *FakeNoaaConsumer) RefreshTokenFromCalls(stub func(consumer.TokenRefresher)) { 200 fake.refreshTokenFromMutex.Lock() 201 defer fake.refreshTokenFromMutex.Unlock() 202 fake.RefreshTokenFromStub = stub 203 } 204 205 func (fake *FakeNoaaConsumer) RefreshTokenFromArgsForCall(i int) consumer.TokenRefresher { 206 fake.refreshTokenFromMutex.RLock() 207 defer fake.refreshTokenFromMutex.RUnlock() 208 argsForCall := fake.refreshTokenFromArgsForCall[i] 209 return argsForCall.arg1 210 } 211 212 func (fake *FakeNoaaConsumer) SetOnConnectCallback(arg1 func()) { 213 fake.setOnConnectCallbackMutex.Lock() 214 fake.setOnConnectCallbackArgsForCall = append(fake.setOnConnectCallbackArgsForCall, struct { 215 arg1 func() 216 }{arg1}) 217 fake.recordInvocation("SetOnConnectCallback", []interface{}{arg1}) 218 fake.setOnConnectCallbackMutex.Unlock() 219 if fake.SetOnConnectCallbackStub != nil { 220 fake.SetOnConnectCallbackStub(arg1) 221 } 222 } 223 224 func (fake *FakeNoaaConsumer) SetOnConnectCallbackCallCount() int { 225 fake.setOnConnectCallbackMutex.RLock() 226 defer fake.setOnConnectCallbackMutex.RUnlock() 227 return len(fake.setOnConnectCallbackArgsForCall) 228 } 229 230 func (fake *FakeNoaaConsumer) SetOnConnectCallbackCalls(stub func(func())) { 231 fake.setOnConnectCallbackMutex.Lock() 232 defer fake.setOnConnectCallbackMutex.Unlock() 233 fake.SetOnConnectCallbackStub = stub 234 } 235 236 func (fake *FakeNoaaConsumer) SetOnConnectCallbackArgsForCall(i int) func() { 237 fake.setOnConnectCallbackMutex.RLock() 238 defer fake.setOnConnectCallbackMutex.RUnlock() 239 argsForCall := fake.setOnConnectCallbackArgsForCall[i] 240 return argsForCall.arg1 241 } 242 243 func (fake *FakeNoaaConsumer) TailingLogs(arg1 string, arg2 string) (<-chan *events.LogMessage, <-chan error) { 244 fake.tailingLogsMutex.Lock() 245 ret, specificReturn := fake.tailingLogsReturnsOnCall[len(fake.tailingLogsArgsForCall)] 246 fake.tailingLogsArgsForCall = append(fake.tailingLogsArgsForCall, struct { 247 arg1 string 248 arg2 string 249 }{arg1, arg2}) 250 fake.recordInvocation("TailingLogs", []interface{}{arg1, arg2}) 251 fake.tailingLogsMutex.Unlock() 252 if fake.TailingLogsStub != nil { 253 return fake.TailingLogsStub(arg1, arg2) 254 } 255 if specificReturn { 256 return ret.result1, ret.result2 257 } 258 fakeReturns := fake.tailingLogsReturns 259 return fakeReturns.result1, fakeReturns.result2 260 } 261 262 func (fake *FakeNoaaConsumer) TailingLogsCallCount() int { 263 fake.tailingLogsMutex.RLock() 264 defer fake.tailingLogsMutex.RUnlock() 265 return len(fake.tailingLogsArgsForCall) 266 } 267 268 func (fake *FakeNoaaConsumer) TailingLogsCalls(stub func(string, string) (<-chan *events.LogMessage, <-chan error)) { 269 fake.tailingLogsMutex.Lock() 270 defer fake.tailingLogsMutex.Unlock() 271 fake.TailingLogsStub = stub 272 } 273 274 func (fake *FakeNoaaConsumer) TailingLogsArgsForCall(i int) (string, string) { 275 fake.tailingLogsMutex.RLock() 276 defer fake.tailingLogsMutex.RUnlock() 277 argsForCall := fake.tailingLogsArgsForCall[i] 278 return argsForCall.arg1, argsForCall.arg2 279 } 280 281 func (fake *FakeNoaaConsumer) TailingLogsReturns(result1 <-chan *events.LogMessage, result2 <-chan error) { 282 fake.tailingLogsMutex.Lock() 283 defer fake.tailingLogsMutex.Unlock() 284 fake.TailingLogsStub = nil 285 fake.tailingLogsReturns = struct { 286 result1 <-chan *events.LogMessage 287 result2 <-chan error 288 }{result1, result2} 289 } 290 291 func (fake *FakeNoaaConsumer) TailingLogsReturnsOnCall(i int, result1 <-chan *events.LogMessage, result2 <-chan error) { 292 fake.tailingLogsMutex.Lock() 293 defer fake.tailingLogsMutex.Unlock() 294 fake.TailingLogsStub = nil 295 if fake.tailingLogsReturnsOnCall == nil { 296 fake.tailingLogsReturnsOnCall = make(map[int]struct { 297 result1 <-chan *events.LogMessage 298 result2 <-chan error 299 }) 300 } 301 fake.tailingLogsReturnsOnCall[i] = struct { 302 result1 <-chan *events.LogMessage 303 result2 <-chan error 304 }{result1, result2} 305 } 306 307 func (fake *FakeNoaaConsumer) Invocations() map[string][][]interface{} { 308 fake.invocationsMutex.RLock() 309 defer fake.invocationsMutex.RUnlock() 310 fake.closeMutex.RLock() 311 defer fake.closeMutex.RUnlock() 312 fake.recentLogsMutex.RLock() 313 defer fake.recentLogsMutex.RUnlock() 314 fake.refreshTokenFromMutex.RLock() 315 defer fake.refreshTokenFromMutex.RUnlock() 316 fake.setOnConnectCallbackMutex.RLock() 317 defer fake.setOnConnectCallbackMutex.RUnlock() 318 fake.tailingLogsMutex.RLock() 319 defer fake.tailingLogsMutex.RUnlock() 320 copiedInvocations := map[string][][]interface{}{} 321 for key, value := range fake.invocations { 322 copiedInvocations[key] = value 323 } 324 return copiedInvocations 325 } 326 327 func (fake *FakeNoaaConsumer) recordInvocation(key string, args []interface{}) { 328 fake.invocationsMutex.Lock() 329 defer fake.invocationsMutex.Unlock() 330 if fake.invocations == nil { 331 fake.invocations = map[string][][]interface{}{} 332 } 333 if fake.invocations[key] == nil { 334 fake.invocations[key] = [][]interface{}{} 335 } 336 fake.invocations[key] = append(fake.invocations[key], args) 337 } 338 339 var _ logs.NoaaConsumer = new(FakeNoaaConsumer)