github.com/loggregator/cli@v6.33.1-0.20180224010324-82334f081791+incompatible/cf/api/apifakes/fake_route_repository.go (about) 1 // This file was generated by counterfeiter 2 package apifakes 3 4 import ( 5 "sync" 6 7 "code.cloudfoundry.org/cli/cf/api" 8 "code.cloudfoundry.org/cli/cf/models" 9 ) 10 11 type FakeRouteRepository struct { 12 ListRoutesStub func(cb func(models.Route) bool) (apiErr error) 13 listRoutesMutex sync.RWMutex 14 listRoutesArgsForCall []struct { 15 cb func(models.Route) bool 16 } 17 listRoutesReturns struct { 18 result1 error 19 } 20 ListAllRoutesStub func(cb func(models.Route) bool) (apiErr error) 21 listAllRoutesMutex sync.RWMutex 22 listAllRoutesArgsForCall []struct { 23 cb func(models.Route) bool 24 } 25 listAllRoutesReturns struct { 26 result1 error 27 } 28 FindStub func(host string, domain models.DomainFields, path string, port int) (route models.Route, apiErr error) 29 findMutex sync.RWMutex 30 findArgsForCall []struct { 31 host string 32 domain models.DomainFields 33 path string 34 port int 35 } 36 findReturns struct { 37 result1 models.Route 38 result2 error 39 } 40 CreateStub func(host string, domain models.DomainFields, path string, port int, useRandomPort bool) (createdRoute models.Route, apiErr error) 41 createMutex sync.RWMutex 42 createArgsForCall []struct { 43 host string 44 domain models.DomainFields 45 path string 46 port int 47 useRandomPort bool 48 } 49 createReturns struct { 50 result1 models.Route 51 result2 error 52 } 53 CheckIfExistsStub func(host string, domain models.DomainFields, path string) (found bool, apiErr error) 54 checkIfExistsMutex sync.RWMutex 55 checkIfExistsArgsForCall []struct { 56 host string 57 domain models.DomainFields 58 path string 59 } 60 checkIfExistsReturns struct { 61 result1 bool 62 result2 error 63 } 64 CreateInSpaceStub func(host, path, domainGUID, spaceGUID string, port int, randomPort bool) (createdRoute models.Route, apiErr error) 65 createInSpaceMutex sync.RWMutex 66 createInSpaceArgsForCall []struct { 67 host string 68 path string 69 domainGUID string 70 spaceGUID string 71 port int 72 randomPort bool 73 } 74 createInSpaceReturns struct { 75 result1 models.Route 76 result2 error 77 } 78 BindStub func(routeGUID, appGUID string) (apiErr error) 79 bindMutex sync.RWMutex 80 bindArgsForCall []struct { 81 routeGUID string 82 appGUID string 83 } 84 bindReturns struct { 85 result1 error 86 } 87 UnbindStub func(routeGUID, appGUID string) (apiErr error) 88 unbindMutex sync.RWMutex 89 unbindArgsForCall []struct { 90 routeGUID string 91 appGUID string 92 } 93 unbindReturns struct { 94 result1 error 95 } 96 DeleteStub func(routeGUID string) (apiErr error) 97 deleteMutex sync.RWMutex 98 deleteArgsForCall []struct { 99 routeGUID string 100 } 101 deleteReturns struct { 102 result1 error 103 } 104 invocations map[string][][]interface{} 105 invocationsMutex sync.RWMutex 106 } 107 108 func (fake *FakeRouteRepository) ListRoutes(cb func(models.Route) bool) (apiErr error) { 109 fake.listRoutesMutex.Lock() 110 fake.listRoutesArgsForCall = append(fake.listRoutesArgsForCall, struct { 111 cb func(models.Route) bool 112 }{cb}) 113 fake.recordInvocation("ListRoutes", []interface{}{cb}) 114 fake.listRoutesMutex.Unlock() 115 if fake.ListRoutesStub != nil { 116 return fake.ListRoutesStub(cb) 117 } else { 118 return fake.listRoutesReturns.result1 119 } 120 } 121 122 func (fake *FakeRouteRepository) ListRoutesCallCount() int { 123 fake.listRoutesMutex.RLock() 124 defer fake.listRoutesMutex.RUnlock() 125 return len(fake.listRoutesArgsForCall) 126 } 127 128 func (fake *FakeRouteRepository) ListRoutesArgsForCall(i int) func(models.Route) bool { 129 fake.listRoutesMutex.RLock() 130 defer fake.listRoutesMutex.RUnlock() 131 return fake.listRoutesArgsForCall[i].cb 132 } 133 134 func (fake *FakeRouteRepository) ListRoutesReturns(result1 error) { 135 fake.ListRoutesStub = nil 136 fake.listRoutesReturns = struct { 137 result1 error 138 }{result1} 139 } 140 141 func (fake *FakeRouteRepository) ListAllRoutes(cb func(models.Route) bool) (apiErr error) { 142 fake.listAllRoutesMutex.Lock() 143 fake.listAllRoutesArgsForCall = append(fake.listAllRoutesArgsForCall, struct { 144 cb func(models.Route) bool 145 }{cb}) 146 fake.recordInvocation("ListAllRoutes", []interface{}{cb}) 147 fake.listAllRoutesMutex.Unlock() 148 if fake.ListAllRoutesStub != nil { 149 return fake.ListAllRoutesStub(cb) 150 } else { 151 return fake.listAllRoutesReturns.result1 152 } 153 } 154 155 func (fake *FakeRouteRepository) ListAllRoutesCallCount() int { 156 fake.listAllRoutesMutex.RLock() 157 defer fake.listAllRoutesMutex.RUnlock() 158 return len(fake.listAllRoutesArgsForCall) 159 } 160 161 func (fake *FakeRouteRepository) ListAllRoutesArgsForCall(i int) func(models.Route) bool { 162 fake.listAllRoutesMutex.RLock() 163 defer fake.listAllRoutesMutex.RUnlock() 164 return fake.listAllRoutesArgsForCall[i].cb 165 } 166 167 func (fake *FakeRouteRepository) ListAllRoutesReturns(result1 error) { 168 fake.ListAllRoutesStub = nil 169 fake.listAllRoutesReturns = struct { 170 result1 error 171 }{result1} 172 } 173 174 func (fake *FakeRouteRepository) Find(host string, domain models.DomainFields, path string, port int) (route models.Route, apiErr error) { 175 fake.findMutex.Lock() 176 fake.findArgsForCall = append(fake.findArgsForCall, struct { 177 host string 178 domain models.DomainFields 179 path string 180 port int 181 }{host, domain, path, port}) 182 fake.recordInvocation("Find", []interface{}{host, domain, path, port}) 183 fake.findMutex.Unlock() 184 if fake.FindStub != nil { 185 return fake.FindStub(host, domain, path, port) 186 } else { 187 return fake.findReturns.result1, fake.findReturns.result2 188 } 189 } 190 191 func (fake *FakeRouteRepository) FindCallCount() int { 192 fake.findMutex.RLock() 193 defer fake.findMutex.RUnlock() 194 return len(fake.findArgsForCall) 195 } 196 197 func (fake *FakeRouteRepository) FindArgsForCall(i int) (string, models.DomainFields, string, int) { 198 fake.findMutex.RLock() 199 defer fake.findMutex.RUnlock() 200 return fake.findArgsForCall[i].host, fake.findArgsForCall[i].domain, fake.findArgsForCall[i].path, fake.findArgsForCall[i].port 201 } 202 203 func (fake *FakeRouteRepository) FindReturns(result1 models.Route, result2 error) { 204 fake.FindStub = nil 205 fake.findReturns = struct { 206 result1 models.Route 207 result2 error 208 }{result1, result2} 209 } 210 211 func (fake *FakeRouteRepository) Create(host string, domain models.DomainFields, path string, port int, useRandomPort bool) (createdRoute models.Route, apiErr error) { 212 fake.createMutex.Lock() 213 fake.createArgsForCall = append(fake.createArgsForCall, struct { 214 host string 215 domain models.DomainFields 216 path string 217 port int 218 useRandomPort bool 219 }{host, domain, path, port, useRandomPort}) 220 fake.recordInvocation("Create", []interface{}{host, domain, path, port, useRandomPort}) 221 fake.createMutex.Unlock() 222 if fake.CreateStub != nil { 223 return fake.CreateStub(host, domain, path, port, useRandomPort) 224 } else { 225 return fake.createReturns.result1, fake.createReturns.result2 226 } 227 } 228 229 func (fake *FakeRouteRepository) CreateCallCount() int { 230 fake.createMutex.RLock() 231 defer fake.createMutex.RUnlock() 232 return len(fake.createArgsForCall) 233 } 234 235 func (fake *FakeRouteRepository) CreateArgsForCall(i int) (string, models.DomainFields, string, int, bool) { 236 fake.createMutex.RLock() 237 defer fake.createMutex.RUnlock() 238 return fake.createArgsForCall[i].host, fake.createArgsForCall[i].domain, fake.createArgsForCall[i].path, fake.createArgsForCall[i].port, fake.createArgsForCall[i].useRandomPort 239 } 240 241 func (fake *FakeRouteRepository) CreateReturns(result1 models.Route, result2 error) { 242 fake.CreateStub = nil 243 fake.createReturns = struct { 244 result1 models.Route 245 result2 error 246 }{result1, result2} 247 } 248 249 func (fake *FakeRouteRepository) CheckIfExists(host string, domain models.DomainFields, path string) (found bool, apiErr error) { 250 fake.checkIfExistsMutex.Lock() 251 fake.checkIfExistsArgsForCall = append(fake.checkIfExistsArgsForCall, struct { 252 host string 253 domain models.DomainFields 254 path string 255 }{host, domain, path}) 256 fake.recordInvocation("CheckIfExists", []interface{}{host, domain, path}) 257 fake.checkIfExistsMutex.Unlock() 258 if fake.CheckIfExistsStub != nil { 259 return fake.CheckIfExistsStub(host, domain, path) 260 } else { 261 return fake.checkIfExistsReturns.result1, fake.checkIfExistsReturns.result2 262 } 263 } 264 265 func (fake *FakeRouteRepository) CheckIfExistsCallCount() int { 266 fake.checkIfExistsMutex.RLock() 267 defer fake.checkIfExistsMutex.RUnlock() 268 return len(fake.checkIfExistsArgsForCall) 269 } 270 271 func (fake *FakeRouteRepository) CheckIfExistsArgsForCall(i int) (string, models.DomainFields, string) { 272 fake.checkIfExistsMutex.RLock() 273 defer fake.checkIfExistsMutex.RUnlock() 274 return fake.checkIfExistsArgsForCall[i].host, fake.checkIfExistsArgsForCall[i].domain, fake.checkIfExistsArgsForCall[i].path 275 } 276 277 func (fake *FakeRouteRepository) CheckIfExistsReturns(result1 bool, result2 error) { 278 fake.CheckIfExistsStub = nil 279 fake.checkIfExistsReturns = struct { 280 result1 bool 281 result2 error 282 }{result1, result2} 283 } 284 285 func (fake *FakeRouteRepository) CreateInSpace(host string, path string, domainGUID string, spaceGUID string, port int, randomPort bool) (createdRoute models.Route, apiErr error) { 286 fake.createInSpaceMutex.Lock() 287 fake.createInSpaceArgsForCall = append(fake.createInSpaceArgsForCall, struct { 288 host string 289 path string 290 domainGUID string 291 spaceGUID string 292 port int 293 randomPort bool 294 }{host, path, domainGUID, spaceGUID, port, randomPort}) 295 fake.recordInvocation("CreateInSpace", []interface{}{host, path, domainGUID, spaceGUID, port, randomPort}) 296 fake.createInSpaceMutex.Unlock() 297 if fake.CreateInSpaceStub != nil { 298 return fake.CreateInSpaceStub(host, path, domainGUID, spaceGUID, port, randomPort) 299 } else { 300 return fake.createInSpaceReturns.result1, fake.createInSpaceReturns.result2 301 } 302 } 303 304 func (fake *FakeRouteRepository) CreateInSpaceCallCount() int { 305 fake.createInSpaceMutex.RLock() 306 defer fake.createInSpaceMutex.RUnlock() 307 return len(fake.createInSpaceArgsForCall) 308 } 309 310 func (fake *FakeRouteRepository) CreateInSpaceArgsForCall(i int) (string, string, string, string, int, bool) { 311 fake.createInSpaceMutex.RLock() 312 defer fake.createInSpaceMutex.RUnlock() 313 return fake.createInSpaceArgsForCall[i].host, fake.createInSpaceArgsForCall[i].path, fake.createInSpaceArgsForCall[i].domainGUID, fake.createInSpaceArgsForCall[i].spaceGUID, fake.createInSpaceArgsForCall[i].port, fake.createInSpaceArgsForCall[i].randomPort 314 } 315 316 func (fake *FakeRouteRepository) CreateInSpaceReturns(result1 models.Route, result2 error) { 317 fake.CreateInSpaceStub = nil 318 fake.createInSpaceReturns = struct { 319 result1 models.Route 320 result2 error 321 }{result1, result2} 322 } 323 324 func (fake *FakeRouteRepository) Bind(routeGUID string, appGUID string) (apiErr error) { 325 fake.bindMutex.Lock() 326 fake.bindArgsForCall = append(fake.bindArgsForCall, struct { 327 routeGUID string 328 appGUID string 329 }{routeGUID, appGUID}) 330 fake.recordInvocation("Bind", []interface{}{routeGUID, appGUID}) 331 fake.bindMutex.Unlock() 332 if fake.BindStub != nil { 333 return fake.BindStub(routeGUID, appGUID) 334 } else { 335 return fake.bindReturns.result1 336 } 337 } 338 339 func (fake *FakeRouteRepository) BindCallCount() int { 340 fake.bindMutex.RLock() 341 defer fake.bindMutex.RUnlock() 342 return len(fake.bindArgsForCall) 343 } 344 345 func (fake *FakeRouteRepository) BindArgsForCall(i int) (string, string) { 346 fake.bindMutex.RLock() 347 defer fake.bindMutex.RUnlock() 348 return fake.bindArgsForCall[i].routeGUID, fake.bindArgsForCall[i].appGUID 349 } 350 351 func (fake *FakeRouteRepository) BindReturns(result1 error) { 352 fake.BindStub = nil 353 fake.bindReturns = struct { 354 result1 error 355 }{result1} 356 } 357 358 func (fake *FakeRouteRepository) Unbind(routeGUID string, appGUID string) (apiErr error) { 359 fake.unbindMutex.Lock() 360 fake.unbindArgsForCall = append(fake.unbindArgsForCall, struct { 361 routeGUID string 362 appGUID string 363 }{routeGUID, appGUID}) 364 fake.recordInvocation("Unbind", []interface{}{routeGUID, appGUID}) 365 fake.unbindMutex.Unlock() 366 if fake.UnbindStub != nil { 367 return fake.UnbindStub(routeGUID, appGUID) 368 } else { 369 return fake.unbindReturns.result1 370 } 371 } 372 373 func (fake *FakeRouteRepository) UnbindCallCount() int { 374 fake.unbindMutex.RLock() 375 defer fake.unbindMutex.RUnlock() 376 return len(fake.unbindArgsForCall) 377 } 378 379 func (fake *FakeRouteRepository) UnbindArgsForCall(i int) (string, string) { 380 fake.unbindMutex.RLock() 381 defer fake.unbindMutex.RUnlock() 382 return fake.unbindArgsForCall[i].routeGUID, fake.unbindArgsForCall[i].appGUID 383 } 384 385 func (fake *FakeRouteRepository) UnbindReturns(result1 error) { 386 fake.UnbindStub = nil 387 fake.unbindReturns = struct { 388 result1 error 389 }{result1} 390 } 391 392 func (fake *FakeRouteRepository) Delete(routeGUID string) (apiErr error) { 393 fake.deleteMutex.Lock() 394 fake.deleteArgsForCall = append(fake.deleteArgsForCall, struct { 395 routeGUID string 396 }{routeGUID}) 397 fake.recordInvocation("Delete", []interface{}{routeGUID}) 398 fake.deleteMutex.Unlock() 399 if fake.DeleteStub != nil { 400 return fake.DeleteStub(routeGUID) 401 } else { 402 return fake.deleteReturns.result1 403 } 404 } 405 406 func (fake *FakeRouteRepository) DeleteCallCount() int { 407 fake.deleteMutex.RLock() 408 defer fake.deleteMutex.RUnlock() 409 return len(fake.deleteArgsForCall) 410 } 411 412 func (fake *FakeRouteRepository) DeleteArgsForCall(i int) string { 413 fake.deleteMutex.RLock() 414 defer fake.deleteMutex.RUnlock() 415 return fake.deleteArgsForCall[i].routeGUID 416 } 417 418 func (fake *FakeRouteRepository) DeleteReturns(result1 error) { 419 fake.DeleteStub = nil 420 fake.deleteReturns = struct { 421 result1 error 422 }{result1} 423 } 424 425 func (fake *FakeRouteRepository) Invocations() map[string][][]interface{} { 426 fake.invocationsMutex.RLock() 427 defer fake.invocationsMutex.RUnlock() 428 fake.listRoutesMutex.RLock() 429 defer fake.listRoutesMutex.RUnlock() 430 fake.listAllRoutesMutex.RLock() 431 defer fake.listAllRoutesMutex.RUnlock() 432 fake.findMutex.RLock() 433 defer fake.findMutex.RUnlock() 434 fake.createMutex.RLock() 435 defer fake.createMutex.RUnlock() 436 fake.checkIfExistsMutex.RLock() 437 defer fake.checkIfExistsMutex.RUnlock() 438 fake.createInSpaceMutex.RLock() 439 defer fake.createInSpaceMutex.RUnlock() 440 fake.bindMutex.RLock() 441 defer fake.bindMutex.RUnlock() 442 fake.unbindMutex.RLock() 443 defer fake.unbindMutex.RUnlock() 444 fake.deleteMutex.RLock() 445 defer fake.deleteMutex.RUnlock() 446 return fake.invocations 447 } 448 449 func (fake *FakeRouteRepository) recordInvocation(key string, args []interface{}) { 450 fake.invocationsMutex.Lock() 451 defer fake.invocationsMutex.Unlock() 452 if fake.invocations == nil { 453 fake.invocations = map[string][][]interface{}{} 454 } 455 if fake.invocations[key] == nil { 456 fake.invocations[key] = [][]interface{}{} 457 } 458 fake.invocations[key] = append(fake.invocations[key], args) 459 } 460 461 var _ api.RouteRepository = new(FakeRouteRepository)