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