github.com/sleungcy/cli@v7.1.0+incompatible/actor/pluginaction/pluginactionfakes/fake_config.go (about) 1 // Code generated by counterfeiter. DO NOT EDIT. 2 package pluginactionfakes 3 4 import ( 5 "sync" 6 7 "code.cloudfoundry.org/cli/actor/pluginaction" 8 "code.cloudfoundry.org/cli/util/configv3" 9 ) 10 11 type FakeConfig struct { 12 AddPluginStub func(configv3.Plugin) 13 addPluginMutex sync.RWMutex 14 addPluginArgsForCall []struct { 15 arg1 configv3.Plugin 16 } 17 AddPluginRepositoryStub func(string, string) 18 addPluginRepositoryMutex sync.RWMutex 19 addPluginRepositoryArgsForCall []struct { 20 arg1 string 21 arg2 string 22 } 23 BinaryVersionStub func() string 24 binaryVersionMutex sync.RWMutex 25 binaryVersionArgsForCall []struct { 26 } 27 binaryVersionReturns struct { 28 result1 string 29 } 30 binaryVersionReturnsOnCall map[int]struct { 31 result1 string 32 } 33 GetPluginStub func(string) (configv3.Plugin, bool) 34 getPluginMutex sync.RWMutex 35 getPluginArgsForCall []struct { 36 arg1 string 37 } 38 getPluginReturns struct { 39 result1 configv3.Plugin 40 result2 bool 41 } 42 getPluginReturnsOnCall map[int]struct { 43 result1 configv3.Plugin 44 result2 bool 45 } 46 PluginHomeStub func() string 47 pluginHomeMutex sync.RWMutex 48 pluginHomeArgsForCall []struct { 49 } 50 pluginHomeReturns struct { 51 result1 string 52 } 53 pluginHomeReturnsOnCall map[int]struct { 54 result1 string 55 } 56 PluginRepositoriesStub func() []configv3.PluginRepository 57 pluginRepositoriesMutex sync.RWMutex 58 pluginRepositoriesArgsForCall []struct { 59 } 60 pluginRepositoriesReturns struct { 61 result1 []configv3.PluginRepository 62 } 63 pluginRepositoriesReturnsOnCall map[int]struct { 64 result1 []configv3.PluginRepository 65 } 66 PluginsStub func() []configv3.Plugin 67 pluginsMutex sync.RWMutex 68 pluginsArgsForCall []struct { 69 } 70 pluginsReturns struct { 71 result1 []configv3.Plugin 72 } 73 pluginsReturnsOnCall map[int]struct { 74 result1 []configv3.Plugin 75 } 76 RemovePluginStub func(string) 77 removePluginMutex sync.RWMutex 78 removePluginArgsForCall []struct { 79 arg1 string 80 } 81 WritePluginConfigStub func() error 82 writePluginConfigMutex sync.RWMutex 83 writePluginConfigArgsForCall []struct { 84 } 85 writePluginConfigReturns struct { 86 result1 error 87 } 88 writePluginConfigReturnsOnCall map[int]struct { 89 result1 error 90 } 91 invocations map[string][][]interface{} 92 invocationsMutex sync.RWMutex 93 } 94 95 func (fake *FakeConfig) AddPlugin(arg1 configv3.Plugin) { 96 fake.addPluginMutex.Lock() 97 fake.addPluginArgsForCall = append(fake.addPluginArgsForCall, struct { 98 arg1 configv3.Plugin 99 }{arg1}) 100 fake.recordInvocation("AddPlugin", []interface{}{arg1}) 101 fake.addPluginMutex.Unlock() 102 if fake.AddPluginStub != nil { 103 fake.AddPluginStub(arg1) 104 } 105 } 106 107 func (fake *FakeConfig) AddPluginCallCount() int { 108 fake.addPluginMutex.RLock() 109 defer fake.addPluginMutex.RUnlock() 110 return len(fake.addPluginArgsForCall) 111 } 112 113 func (fake *FakeConfig) AddPluginCalls(stub func(configv3.Plugin)) { 114 fake.addPluginMutex.Lock() 115 defer fake.addPluginMutex.Unlock() 116 fake.AddPluginStub = stub 117 } 118 119 func (fake *FakeConfig) AddPluginArgsForCall(i int) configv3.Plugin { 120 fake.addPluginMutex.RLock() 121 defer fake.addPluginMutex.RUnlock() 122 argsForCall := fake.addPluginArgsForCall[i] 123 return argsForCall.arg1 124 } 125 126 func (fake *FakeConfig) AddPluginRepository(arg1 string, arg2 string) { 127 fake.addPluginRepositoryMutex.Lock() 128 fake.addPluginRepositoryArgsForCall = append(fake.addPluginRepositoryArgsForCall, struct { 129 arg1 string 130 arg2 string 131 }{arg1, arg2}) 132 fake.recordInvocation("AddPluginRepository", []interface{}{arg1, arg2}) 133 fake.addPluginRepositoryMutex.Unlock() 134 if fake.AddPluginRepositoryStub != nil { 135 fake.AddPluginRepositoryStub(arg1, arg2) 136 } 137 } 138 139 func (fake *FakeConfig) AddPluginRepositoryCallCount() int { 140 fake.addPluginRepositoryMutex.RLock() 141 defer fake.addPluginRepositoryMutex.RUnlock() 142 return len(fake.addPluginRepositoryArgsForCall) 143 } 144 145 func (fake *FakeConfig) AddPluginRepositoryCalls(stub func(string, string)) { 146 fake.addPluginRepositoryMutex.Lock() 147 defer fake.addPluginRepositoryMutex.Unlock() 148 fake.AddPluginRepositoryStub = stub 149 } 150 151 func (fake *FakeConfig) AddPluginRepositoryArgsForCall(i int) (string, string) { 152 fake.addPluginRepositoryMutex.RLock() 153 defer fake.addPluginRepositoryMutex.RUnlock() 154 argsForCall := fake.addPluginRepositoryArgsForCall[i] 155 return argsForCall.arg1, argsForCall.arg2 156 } 157 158 func (fake *FakeConfig) BinaryVersion() string { 159 fake.binaryVersionMutex.Lock() 160 ret, specificReturn := fake.binaryVersionReturnsOnCall[len(fake.binaryVersionArgsForCall)] 161 fake.binaryVersionArgsForCall = append(fake.binaryVersionArgsForCall, struct { 162 }{}) 163 fake.recordInvocation("BinaryVersion", []interface{}{}) 164 fake.binaryVersionMutex.Unlock() 165 if fake.BinaryVersionStub != nil { 166 return fake.BinaryVersionStub() 167 } 168 if specificReturn { 169 return ret.result1 170 } 171 fakeReturns := fake.binaryVersionReturns 172 return fakeReturns.result1 173 } 174 175 func (fake *FakeConfig) BinaryVersionCallCount() int { 176 fake.binaryVersionMutex.RLock() 177 defer fake.binaryVersionMutex.RUnlock() 178 return len(fake.binaryVersionArgsForCall) 179 } 180 181 func (fake *FakeConfig) BinaryVersionCalls(stub func() string) { 182 fake.binaryVersionMutex.Lock() 183 defer fake.binaryVersionMutex.Unlock() 184 fake.BinaryVersionStub = stub 185 } 186 187 func (fake *FakeConfig) BinaryVersionReturns(result1 string) { 188 fake.binaryVersionMutex.Lock() 189 defer fake.binaryVersionMutex.Unlock() 190 fake.BinaryVersionStub = nil 191 fake.binaryVersionReturns = struct { 192 result1 string 193 }{result1} 194 } 195 196 func (fake *FakeConfig) BinaryVersionReturnsOnCall(i int, result1 string) { 197 fake.binaryVersionMutex.Lock() 198 defer fake.binaryVersionMutex.Unlock() 199 fake.BinaryVersionStub = nil 200 if fake.binaryVersionReturnsOnCall == nil { 201 fake.binaryVersionReturnsOnCall = make(map[int]struct { 202 result1 string 203 }) 204 } 205 fake.binaryVersionReturnsOnCall[i] = struct { 206 result1 string 207 }{result1} 208 } 209 210 func (fake *FakeConfig) GetPlugin(arg1 string) (configv3.Plugin, bool) { 211 fake.getPluginMutex.Lock() 212 ret, specificReturn := fake.getPluginReturnsOnCall[len(fake.getPluginArgsForCall)] 213 fake.getPluginArgsForCall = append(fake.getPluginArgsForCall, struct { 214 arg1 string 215 }{arg1}) 216 fake.recordInvocation("GetPlugin", []interface{}{arg1}) 217 fake.getPluginMutex.Unlock() 218 if fake.GetPluginStub != nil { 219 return fake.GetPluginStub(arg1) 220 } 221 if specificReturn { 222 return ret.result1, ret.result2 223 } 224 fakeReturns := fake.getPluginReturns 225 return fakeReturns.result1, fakeReturns.result2 226 } 227 228 func (fake *FakeConfig) GetPluginCallCount() int { 229 fake.getPluginMutex.RLock() 230 defer fake.getPluginMutex.RUnlock() 231 return len(fake.getPluginArgsForCall) 232 } 233 234 func (fake *FakeConfig) GetPluginCalls(stub func(string) (configv3.Plugin, bool)) { 235 fake.getPluginMutex.Lock() 236 defer fake.getPluginMutex.Unlock() 237 fake.GetPluginStub = stub 238 } 239 240 func (fake *FakeConfig) GetPluginArgsForCall(i int) string { 241 fake.getPluginMutex.RLock() 242 defer fake.getPluginMutex.RUnlock() 243 argsForCall := fake.getPluginArgsForCall[i] 244 return argsForCall.arg1 245 } 246 247 func (fake *FakeConfig) GetPluginReturns(result1 configv3.Plugin, result2 bool) { 248 fake.getPluginMutex.Lock() 249 defer fake.getPluginMutex.Unlock() 250 fake.GetPluginStub = nil 251 fake.getPluginReturns = struct { 252 result1 configv3.Plugin 253 result2 bool 254 }{result1, result2} 255 } 256 257 func (fake *FakeConfig) GetPluginReturnsOnCall(i int, result1 configv3.Plugin, result2 bool) { 258 fake.getPluginMutex.Lock() 259 defer fake.getPluginMutex.Unlock() 260 fake.GetPluginStub = nil 261 if fake.getPluginReturnsOnCall == nil { 262 fake.getPluginReturnsOnCall = make(map[int]struct { 263 result1 configv3.Plugin 264 result2 bool 265 }) 266 } 267 fake.getPluginReturnsOnCall[i] = struct { 268 result1 configv3.Plugin 269 result2 bool 270 }{result1, result2} 271 } 272 273 func (fake *FakeConfig) PluginHome() string { 274 fake.pluginHomeMutex.Lock() 275 ret, specificReturn := fake.pluginHomeReturnsOnCall[len(fake.pluginHomeArgsForCall)] 276 fake.pluginHomeArgsForCall = append(fake.pluginHomeArgsForCall, struct { 277 }{}) 278 fake.recordInvocation("PluginHome", []interface{}{}) 279 fake.pluginHomeMutex.Unlock() 280 if fake.PluginHomeStub != nil { 281 return fake.PluginHomeStub() 282 } 283 if specificReturn { 284 return ret.result1 285 } 286 fakeReturns := fake.pluginHomeReturns 287 return fakeReturns.result1 288 } 289 290 func (fake *FakeConfig) PluginHomeCallCount() int { 291 fake.pluginHomeMutex.RLock() 292 defer fake.pluginHomeMutex.RUnlock() 293 return len(fake.pluginHomeArgsForCall) 294 } 295 296 func (fake *FakeConfig) PluginHomeCalls(stub func() string) { 297 fake.pluginHomeMutex.Lock() 298 defer fake.pluginHomeMutex.Unlock() 299 fake.PluginHomeStub = stub 300 } 301 302 func (fake *FakeConfig) PluginHomeReturns(result1 string) { 303 fake.pluginHomeMutex.Lock() 304 defer fake.pluginHomeMutex.Unlock() 305 fake.PluginHomeStub = nil 306 fake.pluginHomeReturns = struct { 307 result1 string 308 }{result1} 309 } 310 311 func (fake *FakeConfig) PluginHomeReturnsOnCall(i int, result1 string) { 312 fake.pluginHomeMutex.Lock() 313 defer fake.pluginHomeMutex.Unlock() 314 fake.PluginHomeStub = nil 315 if fake.pluginHomeReturnsOnCall == nil { 316 fake.pluginHomeReturnsOnCall = make(map[int]struct { 317 result1 string 318 }) 319 } 320 fake.pluginHomeReturnsOnCall[i] = struct { 321 result1 string 322 }{result1} 323 } 324 325 func (fake *FakeConfig) PluginRepositories() []configv3.PluginRepository { 326 fake.pluginRepositoriesMutex.Lock() 327 ret, specificReturn := fake.pluginRepositoriesReturnsOnCall[len(fake.pluginRepositoriesArgsForCall)] 328 fake.pluginRepositoriesArgsForCall = append(fake.pluginRepositoriesArgsForCall, struct { 329 }{}) 330 fake.recordInvocation("PluginRepositories", []interface{}{}) 331 fake.pluginRepositoriesMutex.Unlock() 332 if fake.PluginRepositoriesStub != nil { 333 return fake.PluginRepositoriesStub() 334 } 335 if specificReturn { 336 return ret.result1 337 } 338 fakeReturns := fake.pluginRepositoriesReturns 339 return fakeReturns.result1 340 } 341 342 func (fake *FakeConfig) PluginRepositoriesCallCount() int { 343 fake.pluginRepositoriesMutex.RLock() 344 defer fake.pluginRepositoriesMutex.RUnlock() 345 return len(fake.pluginRepositoriesArgsForCall) 346 } 347 348 func (fake *FakeConfig) PluginRepositoriesCalls(stub func() []configv3.PluginRepository) { 349 fake.pluginRepositoriesMutex.Lock() 350 defer fake.pluginRepositoriesMutex.Unlock() 351 fake.PluginRepositoriesStub = stub 352 } 353 354 func (fake *FakeConfig) PluginRepositoriesReturns(result1 []configv3.PluginRepository) { 355 fake.pluginRepositoriesMutex.Lock() 356 defer fake.pluginRepositoriesMutex.Unlock() 357 fake.PluginRepositoriesStub = nil 358 fake.pluginRepositoriesReturns = struct { 359 result1 []configv3.PluginRepository 360 }{result1} 361 } 362 363 func (fake *FakeConfig) PluginRepositoriesReturnsOnCall(i int, result1 []configv3.PluginRepository) { 364 fake.pluginRepositoriesMutex.Lock() 365 defer fake.pluginRepositoriesMutex.Unlock() 366 fake.PluginRepositoriesStub = nil 367 if fake.pluginRepositoriesReturnsOnCall == nil { 368 fake.pluginRepositoriesReturnsOnCall = make(map[int]struct { 369 result1 []configv3.PluginRepository 370 }) 371 } 372 fake.pluginRepositoriesReturnsOnCall[i] = struct { 373 result1 []configv3.PluginRepository 374 }{result1} 375 } 376 377 func (fake *FakeConfig) Plugins() []configv3.Plugin { 378 fake.pluginsMutex.Lock() 379 ret, specificReturn := fake.pluginsReturnsOnCall[len(fake.pluginsArgsForCall)] 380 fake.pluginsArgsForCall = append(fake.pluginsArgsForCall, struct { 381 }{}) 382 fake.recordInvocation("Plugins", []interface{}{}) 383 fake.pluginsMutex.Unlock() 384 if fake.PluginsStub != nil { 385 return fake.PluginsStub() 386 } 387 if specificReturn { 388 return ret.result1 389 } 390 fakeReturns := fake.pluginsReturns 391 return fakeReturns.result1 392 } 393 394 func (fake *FakeConfig) PluginsCallCount() int { 395 fake.pluginsMutex.RLock() 396 defer fake.pluginsMutex.RUnlock() 397 return len(fake.pluginsArgsForCall) 398 } 399 400 func (fake *FakeConfig) PluginsCalls(stub func() []configv3.Plugin) { 401 fake.pluginsMutex.Lock() 402 defer fake.pluginsMutex.Unlock() 403 fake.PluginsStub = stub 404 } 405 406 func (fake *FakeConfig) PluginsReturns(result1 []configv3.Plugin) { 407 fake.pluginsMutex.Lock() 408 defer fake.pluginsMutex.Unlock() 409 fake.PluginsStub = nil 410 fake.pluginsReturns = struct { 411 result1 []configv3.Plugin 412 }{result1} 413 } 414 415 func (fake *FakeConfig) PluginsReturnsOnCall(i int, result1 []configv3.Plugin) { 416 fake.pluginsMutex.Lock() 417 defer fake.pluginsMutex.Unlock() 418 fake.PluginsStub = nil 419 if fake.pluginsReturnsOnCall == nil { 420 fake.pluginsReturnsOnCall = make(map[int]struct { 421 result1 []configv3.Plugin 422 }) 423 } 424 fake.pluginsReturnsOnCall[i] = struct { 425 result1 []configv3.Plugin 426 }{result1} 427 } 428 429 func (fake *FakeConfig) RemovePlugin(arg1 string) { 430 fake.removePluginMutex.Lock() 431 fake.removePluginArgsForCall = append(fake.removePluginArgsForCall, struct { 432 arg1 string 433 }{arg1}) 434 fake.recordInvocation("RemovePlugin", []interface{}{arg1}) 435 fake.removePluginMutex.Unlock() 436 if fake.RemovePluginStub != nil { 437 fake.RemovePluginStub(arg1) 438 } 439 } 440 441 func (fake *FakeConfig) RemovePluginCallCount() int { 442 fake.removePluginMutex.RLock() 443 defer fake.removePluginMutex.RUnlock() 444 return len(fake.removePluginArgsForCall) 445 } 446 447 func (fake *FakeConfig) RemovePluginCalls(stub func(string)) { 448 fake.removePluginMutex.Lock() 449 defer fake.removePluginMutex.Unlock() 450 fake.RemovePluginStub = stub 451 } 452 453 func (fake *FakeConfig) RemovePluginArgsForCall(i int) string { 454 fake.removePluginMutex.RLock() 455 defer fake.removePluginMutex.RUnlock() 456 argsForCall := fake.removePluginArgsForCall[i] 457 return argsForCall.arg1 458 } 459 460 func (fake *FakeConfig) WritePluginConfig() error { 461 fake.writePluginConfigMutex.Lock() 462 ret, specificReturn := fake.writePluginConfigReturnsOnCall[len(fake.writePluginConfigArgsForCall)] 463 fake.writePluginConfigArgsForCall = append(fake.writePluginConfigArgsForCall, struct { 464 }{}) 465 fake.recordInvocation("WritePluginConfig", []interface{}{}) 466 fake.writePluginConfigMutex.Unlock() 467 if fake.WritePluginConfigStub != nil { 468 return fake.WritePluginConfigStub() 469 } 470 if specificReturn { 471 return ret.result1 472 } 473 fakeReturns := fake.writePluginConfigReturns 474 return fakeReturns.result1 475 } 476 477 func (fake *FakeConfig) WritePluginConfigCallCount() int { 478 fake.writePluginConfigMutex.RLock() 479 defer fake.writePluginConfigMutex.RUnlock() 480 return len(fake.writePluginConfigArgsForCall) 481 } 482 483 func (fake *FakeConfig) WritePluginConfigCalls(stub func() error) { 484 fake.writePluginConfigMutex.Lock() 485 defer fake.writePluginConfigMutex.Unlock() 486 fake.WritePluginConfigStub = stub 487 } 488 489 func (fake *FakeConfig) WritePluginConfigReturns(result1 error) { 490 fake.writePluginConfigMutex.Lock() 491 defer fake.writePluginConfigMutex.Unlock() 492 fake.WritePluginConfigStub = nil 493 fake.writePluginConfigReturns = struct { 494 result1 error 495 }{result1} 496 } 497 498 func (fake *FakeConfig) WritePluginConfigReturnsOnCall(i int, result1 error) { 499 fake.writePluginConfigMutex.Lock() 500 defer fake.writePluginConfigMutex.Unlock() 501 fake.WritePluginConfigStub = nil 502 if fake.writePluginConfigReturnsOnCall == nil { 503 fake.writePluginConfigReturnsOnCall = make(map[int]struct { 504 result1 error 505 }) 506 } 507 fake.writePluginConfigReturnsOnCall[i] = struct { 508 result1 error 509 }{result1} 510 } 511 512 func (fake *FakeConfig) Invocations() map[string][][]interface{} { 513 fake.invocationsMutex.RLock() 514 defer fake.invocationsMutex.RUnlock() 515 fake.addPluginMutex.RLock() 516 defer fake.addPluginMutex.RUnlock() 517 fake.addPluginRepositoryMutex.RLock() 518 defer fake.addPluginRepositoryMutex.RUnlock() 519 fake.binaryVersionMutex.RLock() 520 defer fake.binaryVersionMutex.RUnlock() 521 fake.getPluginMutex.RLock() 522 defer fake.getPluginMutex.RUnlock() 523 fake.pluginHomeMutex.RLock() 524 defer fake.pluginHomeMutex.RUnlock() 525 fake.pluginRepositoriesMutex.RLock() 526 defer fake.pluginRepositoriesMutex.RUnlock() 527 fake.pluginsMutex.RLock() 528 defer fake.pluginsMutex.RUnlock() 529 fake.removePluginMutex.RLock() 530 defer fake.removePluginMutex.RUnlock() 531 fake.writePluginConfigMutex.RLock() 532 defer fake.writePluginConfigMutex.RUnlock() 533 copiedInvocations := map[string][][]interface{}{} 534 for key, value := range fake.invocations { 535 copiedInvocations[key] = value 536 } 537 return copiedInvocations 538 } 539 540 func (fake *FakeConfig) recordInvocation(key string, args []interface{}) { 541 fake.invocationsMutex.Lock() 542 defer fake.invocationsMutex.Unlock() 543 if fake.invocations == nil { 544 fake.invocations = map[string][][]interface{}{} 545 } 546 if fake.invocations[key] == nil { 547 fake.invocations[key] = [][]interface{}{} 548 } 549 fake.invocations[key] = append(fake.invocations[key], args) 550 } 551 552 var _ pluginaction.Config = new(FakeConfig)