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