github.com/cloudfoundry-attic/ltc@v0.0.0-20151123212628-098adc7919fc/ssh/command_factory/mocks/fake_ssh.go (about) 1 // This file was generated by counterfeiter 2 package mocks 3 4 import ( 5 "sync" 6 7 config_package "github.com/cloudfoundry-incubator/ltc/config" 8 "github.com/cloudfoundry-incubator/ltc/ssh/command_factory" 9 ) 10 11 type FakeSSH struct { 12 ConnectStub func(appName string, instanceIndex int, config *config_package.Config) error 13 connectMutex sync.RWMutex 14 connectArgsForCall []struct { 15 appName string 16 instanceIndex int 17 config *config_package.Config 18 } 19 connectReturns struct { 20 result1 error 21 } 22 ForwardStub func(localAddress, remoteAddress string) error 23 forwardMutex sync.RWMutex 24 forwardArgsForCall []struct { 25 localAddress string 26 remoteAddress string 27 } 28 forwardReturns struct { 29 result1 error 30 } 31 ShellStub func(command string, ptyDespired bool) error 32 shellMutex sync.RWMutex 33 shellArgsForCall []struct { 34 command string 35 ptyDespired bool 36 } 37 shellReturns struct { 38 result1 error 39 } 40 } 41 42 func (fake *FakeSSH) Connect(appName string, instanceIndex int, config *config_package.Config) error { 43 fake.connectMutex.Lock() 44 fake.connectArgsForCall = append(fake.connectArgsForCall, struct { 45 appName string 46 instanceIndex int 47 config *config_package.Config 48 }{appName, instanceIndex, config}) 49 fake.connectMutex.Unlock() 50 if fake.ConnectStub != nil { 51 return fake.ConnectStub(appName, instanceIndex, config) 52 } else { 53 return fake.connectReturns.result1 54 } 55 } 56 57 func (fake *FakeSSH) ConnectCallCount() int { 58 fake.connectMutex.RLock() 59 defer fake.connectMutex.RUnlock() 60 return len(fake.connectArgsForCall) 61 } 62 63 func (fake *FakeSSH) ConnectArgsForCall(i int) (string, int, *config_package.Config) { 64 fake.connectMutex.RLock() 65 defer fake.connectMutex.RUnlock() 66 return fake.connectArgsForCall[i].appName, fake.connectArgsForCall[i].instanceIndex, fake.connectArgsForCall[i].config 67 } 68 69 func (fake *FakeSSH) ConnectReturns(result1 error) { 70 fake.ConnectStub = nil 71 fake.connectReturns = struct { 72 result1 error 73 }{result1} 74 } 75 76 func (fake *FakeSSH) Forward(localAddress string, remoteAddress string) error { 77 fake.forwardMutex.Lock() 78 fake.forwardArgsForCall = append(fake.forwardArgsForCall, struct { 79 localAddress string 80 remoteAddress string 81 }{localAddress, remoteAddress}) 82 fake.forwardMutex.Unlock() 83 if fake.ForwardStub != nil { 84 return fake.ForwardStub(localAddress, remoteAddress) 85 } else { 86 return fake.forwardReturns.result1 87 } 88 } 89 90 func (fake *FakeSSH) ForwardCallCount() int { 91 fake.forwardMutex.RLock() 92 defer fake.forwardMutex.RUnlock() 93 return len(fake.forwardArgsForCall) 94 } 95 96 func (fake *FakeSSH) ForwardArgsForCall(i int) (string, string) { 97 fake.forwardMutex.RLock() 98 defer fake.forwardMutex.RUnlock() 99 return fake.forwardArgsForCall[i].localAddress, fake.forwardArgsForCall[i].remoteAddress 100 } 101 102 func (fake *FakeSSH) ForwardReturns(result1 error) { 103 fake.ForwardStub = nil 104 fake.forwardReturns = struct { 105 result1 error 106 }{result1} 107 } 108 109 func (fake *FakeSSH) Shell(command string, ptyDespired bool) error { 110 fake.shellMutex.Lock() 111 fake.shellArgsForCall = append(fake.shellArgsForCall, struct { 112 command string 113 ptyDespired bool 114 }{command, ptyDespired}) 115 fake.shellMutex.Unlock() 116 if fake.ShellStub != nil { 117 return fake.ShellStub(command, ptyDespired) 118 } else { 119 return fake.shellReturns.result1 120 } 121 } 122 123 func (fake *FakeSSH) ShellCallCount() int { 124 fake.shellMutex.RLock() 125 defer fake.shellMutex.RUnlock() 126 return len(fake.shellArgsForCall) 127 } 128 129 func (fake *FakeSSH) ShellArgsForCall(i int) (string, bool) { 130 fake.shellMutex.RLock() 131 defer fake.shellMutex.RUnlock() 132 return fake.shellArgsForCall[i].command, fake.shellArgsForCall[i].ptyDespired 133 } 134 135 func (fake *FakeSSH) ShellReturns(result1 error) { 136 fake.ShellStub = nil 137 fake.shellReturns = struct { 138 result1 error 139 }{result1} 140 } 141 142 var _ command_factory.SSH = new(FakeSSH)