github.com/jasonkeene/cli@v6.14.1-0.20160816203908-ca5715166dfb+incompatible/cf/actors/plugininstaller/plugininstallerfakes/fake_plugin_installer.go (about) 1 // This file was generated by counterfeiter 2 package plugininstallerfakes 3 4 import ( 5 "sync" 6 7 "github.com/cloudfoundry/cli/cf/actors/plugininstaller" 8 ) 9 10 type FakePluginInstaller struct { 11 InstallStub func(inputSourceFilepath string) string 12 installMutex sync.RWMutex 13 installArgsForCall []struct { 14 inputSourceFilepath string 15 } 16 installReturns struct { 17 result1 string 18 } 19 invocations map[string][][]interface{} 20 invocationsMutex sync.RWMutex 21 } 22 23 func (fake *FakePluginInstaller) Install(inputSourceFilepath string) string { 24 fake.installMutex.Lock() 25 fake.installArgsForCall = append(fake.installArgsForCall, struct { 26 inputSourceFilepath string 27 }{inputSourceFilepath}) 28 fake.recordInvocation("Install", []interface{}{inputSourceFilepath}) 29 fake.installMutex.Unlock() 30 if fake.InstallStub != nil { 31 return fake.InstallStub(inputSourceFilepath) 32 } else { 33 return fake.installReturns.result1 34 } 35 } 36 37 func (fake *FakePluginInstaller) InstallCallCount() int { 38 fake.installMutex.RLock() 39 defer fake.installMutex.RUnlock() 40 return len(fake.installArgsForCall) 41 } 42 43 func (fake *FakePluginInstaller) InstallArgsForCall(i int) string { 44 fake.installMutex.RLock() 45 defer fake.installMutex.RUnlock() 46 return fake.installArgsForCall[i].inputSourceFilepath 47 } 48 49 func (fake *FakePluginInstaller) InstallReturns(result1 string) { 50 fake.InstallStub = nil 51 fake.installReturns = struct { 52 result1 string 53 }{result1} 54 } 55 56 func (fake *FakePluginInstaller) Invocations() map[string][][]interface{} { 57 fake.invocationsMutex.RLock() 58 defer fake.invocationsMutex.RUnlock() 59 fake.installMutex.RLock() 60 defer fake.installMutex.RUnlock() 61 return fake.invocations 62 } 63 64 func (fake *FakePluginInstaller) recordInvocation(key string, args []interface{}) { 65 fake.invocationsMutex.Lock() 66 defer fake.invocationsMutex.Unlock() 67 if fake.invocations == nil { 68 fake.invocations = map[string][][]interface{}{} 69 } 70 if fake.invocations[key] == nil { 71 fake.invocations[key] = [][]interface{}{} 72 } 73 fake.invocations[key] = append(fake.invocations[key], args) 74 } 75 76 var _ plugininstaller.PluginInstaller = new(FakePluginInstaller)