github.com/loggregator/cli@v6.33.1-0.20180224010324-82334f081791+incompatible/actor/pluginaction/pluginactionfakes/fake_plugin_uninstaller.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  )
     9  
    10  type FakePluginUninstaller struct {
    11  	RunStub        func(pluginPath string, command string) error
    12  	runMutex       sync.RWMutex
    13  	runArgsForCall []struct {
    14  		pluginPath string
    15  		command    string
    16  	}
    17  	runReturns struct {
    18  		result1 error
    19  	}
    20  	runReturnsOnCall map[int]struct {
    21  		result1 error
    22  	}
    23  	invocations      map[string][][]interface{}
    24  	invocationsMutex sync.RWMutex
    25  }
    26  
    27  func (fake *FakePluginUninstaller) Run(pluginPath string, command string) error {
    28  	fake.runMutex.Lock()
    29  	ret, specificReturn := fake.runReturnsOnCall[len(fake.runArgsForCall)]
    30  	fake.runArgsForCall = append(fake.runArgsForCall, struct {
    31  		pluginPath string
    32  		command    string
    33  	}{pluginPath, command})
    34  	fake.recordInvocation("Run", []interface{}{pluginPath, command})
    35  	fake.runMutex.Unlock()
    36  	if fake.RunStub != nil {
    37  		return fake.RunStub(pluginPath, command)
    38  	}
    39  	if specificReturn {
    40  		return ret.result1
    41  	}
    42  	return fake.runReturns.result1
    43  }
    44  
    45  func (fake *FakePluginUninstaller) RunCallCount() int {
    46  	fake.runMutex.RLock()
    47  	defer fake.runMutex.RUnlock()
    48  	return len(fake.runArgsForCall)
    49  }
    50  
    51  func (fake *FakePluginUninstaller) RunArgsForCall(i int) (string, string) {
    52  	fake.runMutex.RLock()
    53  	defer fake.runMutex.RUnlock()
    54  	return fake.runArgsForCall[i].pluginPath, fake.runArgsForCall[i].command
    55  }
    56  
    57  func (fake *FakePluginUninstaller) RunReturns(result1 error) {
    58  	fake.RunStub = nil
    59  	fake.runReturns = struct {
    60  		result1 error
    61  	}{result1}
    62  }
    63  
    64  func (fake *FakePluginUninstaller) RunReturnsOnCall(i int, result1 error) {
    65  	fake.RunStub = nil
    66  	if fake.runReturnsOnCall == nil {
    67  		fake.runReturnsOnCall = make(map[int]struct {
    68  			result1 error
    69  		})
    70  	}
    71  	fake.runReturnsOnCall[i] = struct {
    72  		result1 error
    73  	}{result1}
    74  }
    75  
    76  func (fake *FakePluginUninstaller) Invocations() map[string][][]interface{} {
    77  	fake.invocationsMutex.RLock()
    78  	defer fake.invocationsMutex.RUnlock()
    79  	fake.runMutex.RLock()
    80  	defer fake.runMutex.RUnlock()
    81  	copiedInvocations := map[string][][]interface{}{}
    82  	for key, value := range fake.invocations {
    83  		copiedInvocations[key] = value
    84  	}
    85  	return copiedInvocations
    86  }
    87  
    88  func (fake *FakePluginUninstaller) recordInvocation(key string, args []interface{}) {
    89  	fake.invocationsMutex.Lock()
    90  	defer fake.invocationsMutex.Unlock()
    91  	if fake.invocations == nil {
    92  		fake.invocations = map[string][][]interface{}{}
    93  	}
    94  	if fake.invocations[key] == nil {
    95  		fake.invocations[key] = [][]interface{}{}
    96  	}
    97  	fake.invocations[key] = append(fake.invocations[key], args)
    98  }
    99  
   100  var _ pluginaction.PluginUninstaller = new(FakePluginUninstaller)