github.com/lukasheimann/cloudfoundrycli@v7.1.0+incompatible/actor/pluginaction/pluginactionfakes/fake_plugin_client.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/api/plugin"
     9  )
    10  
    11  type FakePluginClient struct {
    12  	DownloadPluginStub        func(string, string, plugin.ProxyReader) error
    13  	downloadPluginMutex       sync.RWMutex
    14  	downloadPluginArgsForCall []struct {
    15  		arg1 string
    16  		arg2 string
    17  		arg3 plugin.ProxyReader
    18  	}
    19  	downloadPluginReturns struct {
    20  		result1 error
    21  	}
    22  	downloadPluginReturnsOnCall map[int]struct {
    23  		result1 error
    24  	}
    25  	GetPluginRepositoryStub        func(string) (plugin.PluginRepository, error)
    26  	getPluginRepositoryMutex       sync.RWMutex
    27  	getPluginRepositoryArgsForCall []struct {
    28  		arg1 string
    29  	}
    30  	getPluginRepositoryReturns struct {
    31  		result1 plugin.PluginRepository
    32  		result2 error
    33  	}
    34  	getPluginRepositoryReturnsOnCall map[int]struct {
    35  		result1 plugin.PluginRepository
    36  		result2 error
    37  	}
    38  	invocations      map[string][][]interface{}
    39  	invocationsMutex sync.RWMutex
    40  }
    41  
    42  func (fake *FakePluginClient) DownloadPlugin(arg1 string, arg2 string, arg3 plugin.ProxyReader) error {
    43  	fake.downloadPluginMutex.Lock()
    44  	ret, specificReturn := fake.downloadPluginReturnsOnCall[len(fake.downloadPluginArgsForCall)]
    45  	fake.downloadPluginArgsForCall = append(fake.downloadPluginArgsForCall, struct {
    46  		arg1 string
    47  		arg2 string
    48  		arg3 plugin.ProxyReader
    49  	}{arg1, arg2, arg3})
    50  	fake.recordInvocation("DownloadPlugin", []interface{}{arg1, arg2, arg3})
    51  	fake.downloadPluginMutex.Unlock()
    52  	if fake.DownloadPluginStub != nil {
    53  		return fake.DownloadPluginStub(arg1, arg2, arg3)
    54  	}
    55  	if specificReturn {
    56  		return ret.result1
    57  	}
    58  	fakeReturns := fake.downloadPluginReturns
    59  	return fakeReturns.result1
    60  }
    61  
    62  func (fake *FakePluginClient) DownloadPluginCallCount() int {
    63  	fake.downloadPluginMutex.RLock()
    64  	defer fake.downloadPluginMutex.RUnlock()
    65  	return len(fake.downloadPluginArgsForCall)
    66  }
    67  
    68  func (fake *FakePluginClient) DownloadPluginCalls(stub func(string, string, plugin.ProxyReader) error) {
    69  	fake.downloadPluginMutex.Lock()
    70  	defer fake.downloadPluginMutex.Unlock()
    71  	fake.DownloadPluginStub = stub
    72  }
    73  
    74  func (fake *FakePluginClient) DownloadPluginArgsForCall(i int) (string, string, plugin.ProxyReader) {
    75  	fake.downloadPluginMutex.RLock()
    76  	defer fake.downloadPluginMutex.RUnlock()
    77  	argsForCall := fake.downloadPluginArgsForCall[i]
    78  	return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3
    79  }
    80  
    81  func (fake *FakePluginClient) DownloadPluginReturns(result1 error) {
    82  	fake.downloadPluginMutex.Lock()
    83  	defer fake.downloadPluginMutex.Unlock()
    84  	fake.DownloadPluginStub = nil
    85  	fake.downloadPluginReturns = struct {
    86  		result1 error
    87  	}{result1}
    88  }
    89  
    90  func (fake *FakePluginClient) DownloadPluginReturnsOnCall(i int, result1 error) {
    91  	fake.downloadPluginMutex.Lock()
    92  	defer fake.downloadPluginMutex.Unlock()
    93  	fake.DownloadPluginStub = nil
    94  	if fake.downloadPluginReturnsOnCall == nil {
    95  		fake.downloadPluginReturnsOnCall = make(map[int]struct {
    96  			result1 error
    97  		})
    98  	}
    99  	fake.downloadPluginReturnsOnCall[i] = struct {
   100  		result1 error
   101  	}{result1}
   102  }
   103  
   104  func (fake *FakePluginClient) GetPluginRepository(arg1 string) (plugin.PluginRepository, error) {
   105  	fake.getPluginRepositoryMutex.Lock()
   106  	ret, specificReturn := fake.getPluginRepositoryReturnsOnCall[len(fake.getPluginRepositoryArgsForCall)]
   107  	fake.getPluginRepositoryArgsForCall = append(fake.getPluginRepositoryArgsForCall, struct {
   108  		arg1 string
   109  	}{arg1})
   110  	fake.recordInvocation("GetPluginRepository", []interface{}{arg1})
   111  	fake.getPluginRepositoryMutex.Unlock()
   112  	if fake.GetPluginRepositoryStub != nil {
   113  		return fake.GetPluginRepositoryStub(arg1)
   114  	}
   115  	if specificReturn {
   116  		return ret.result1, ret.result2
   117  	}
   118  	fakeReturns := fake.getPluginRepositoryReturns
   119  	return fakeReturns.result1, fakeReturns.result2
   120  }
   121  
   122  func (fake *FakePluginClient) GetPluginRepositoryCallCount() int {
   123  	fake.getPluginRepositoryMutex.RLock()
   124  	defer fake.getPluginRepositoryMutex.RUnlock()
   125  	return len(fake.getPluginRepositoryArgsForCall)
   126  }
   127  
   128  func (fake *FakePluginClient) GetPluginRepositoryCalls(stub func(string) (plugin.PluginRepository, error)) {
   129  	fake.getPluginRepositoryMutex.Lock()
   130  	defer fake.getPluginRepositoryMutex.Unlock()
   131  	fake.GetPluginRepositoryStub = stub
   132  }
   133  
   134  func (fake *FakePluginClient) GetPluginRepositoryArgsForCall(i int) string {
   135  	fake.getPluginRepositoryMutex.RLock()
   136  	defer fake.getPluginRepositoryMutex.RUnlock()
   137  	argsForCall := fake.getPluginRepositoryArgsForCall[i]
   138  	return argsForCall.arg1
   139  }
   140  
   141  func (fake *FakePluginClient) GetPluginRepositoryReturns(result1 plugin.PluginRepository, result2 error) {
   142  	fake.getPluginRepositoryMutex.Lock()
   143  	defer fake.getPluginRepositoryMutex.Unlock()
   144  	fake.GetPluginRepositoryStub = nil
   145  	fake.getPluginRepositoryReturns = struct {
   146  		result1 plugin.PluginRepository
   147  		result2 error
   148  	}{result1, result2}
   149  }
   150  
   151  func (fake *FakePluginClient) GetPluginRepositoryReturnsOnCall(i int, result1 plugin.PluginRepository, result2 error) {
   152  	fake.getPluginRepositoryMutex.Lock()
   153  	defer fake.getPluginRepositoryMutex.Unlock()
   154  	fake.GetPluginRepositoryStub = nil
   155  	if fake.getPluginRepositoryReturnsOnCall == nil {
   156  		fake.getPluginRepositoryReturnsOnCall = make(map[int]struct {
   157  			result1 plugin.PluginRepository
   158  			result2 error
   159  		})
   160  	}
   161  	fake.getPluginRepositoryReturnsOnCall[i] = struct {
   162  		result1 plugin.PluginRepository
   163  		result2 error
   164  	}{result1, result2}
   165  }
   166  
   167  func (fake *FakePluginClient) Invocations() map[string][][]interface{} {
   168  	fake.invocationsMutex.RLock()
   169  	defer fake.invocationsMutex.RUnlock()
   170  	fake.downloadPluginMutex.RLock()
   171  	defer fake.downloadPluginMutex.RUnlock()
   172  	fake.getPluginRepositoryMutex.RLock()
   173  	defer fake.getPluginRepositoryMutex.RUnlock()
   174  	copiedInvocations := map[string][][]interface{}{}
   175  	for key, value := range fake.invocations {
   176  		copiedInvocations[key] = value
   177  	}
   178  	return copiedInvocations
   179  }
   180  
   181  func (fake *FakePluginClient) recordInvocation(key string, args []interface{}) {
   182  	fake.invocationsMutex.Lock()
   183  	defer fake.invocationsMutex.Unlock()
   184  	if fake.invocations == nil {
   185  		fake.invocations = map[string][][]interface{}{}
   186  	}
   187  	if fake.invocations[key] == nil {
   188  		fake.invocations[key] = [][]interface{}{}
   189  	}
   190  	fake.invocations[key] = append(fake.invocations[key], args)
   191  }
   192  
   193  var _ pluginaction.PluginClient = new(FakePluginClient)