github.com/cloudfoundry-attic/ltc@v0.0.0-20151123212628-098adc7919fc/ssh/mocks/fake_client.go (about) 1 // This file was generated by counterfeiter 2 package mocks 3 4 import ( 5 "io" 6 "sync" 7 8 "github.com/cloudfoundry-incubator/ltc/ssh" 9 "github.com/cloudfoundry-incubator/ltc/ssh/sshapi" 10 ) 11 12 type FakeClient struct { 13 OpenStub func(width, height int, desirePTY bool) (*sshapi.Session, error) 14 openMutex sync.RWMutex 15 openArgsForCall []struct { 16 width int 17 height int 18 desirePTY bool 19 } 20 openReturns struct { 21 result1 *sshapi.Session 22 result2 error 23 } 24 ForwardStub func(localConn io.ReadWriteCloser, remoteAddress string) error 25 forwardMutex sync.RWMutex 26 forwardArgsForCall []struct { 27 localConn io.ReadWriteCloser 28 remoteAddress string 29 } 30 forwardReturns struct { 31 result1 error 32 } 33 } 34 35 func (fake *FakeClient) Open(width int, height int, desirePTY bool) (*sshapi.Session, error) { 36 fake.openMutex.Lock() 37 fake.openArgsForCall = append(fake.openArgsForCall, struct { 38 width int 39 height int 40 desirePTY bool 41 }{width, height, desirePTY}) 42 fake.openMutex.Unlock() 43 if fake.OpenStub != nil { 44 return fake.OpenStub(width, height, desirePTY) 45 } else { 46 return fake.openReturns.result1, fake.openReturns.result2 47 } 48 } 49 50 func (fake *FakeClient) OpenCallCount() int { 51 fake.openMutex.RLock() 52 defer fake.openMutex.RUnlock() 53 return len(fake.openArgsForCall) 54 } 55 56 func (fake *FakeClient) OpenArgsForCall(i int) (int, int, bool) { 57 fake.openMutex.RLock() 58 defer fake.openMutex.RUnlock() 59 return fake.openArgsForCall[i].width, fake.openArgsForCall[i].height, fake.openArgsForCall[i].desirePTY 60 } 61 62 func (fake *FakeClient) OpenReturns(result1 *sshapi.Session, result2 error) { 63 fake.OpenStub = nil 64 fake.openReturns = struct { 65 result1 *sshapi.Session 66 result2 error 67 }{result1, result2} 68 } 69 70 func (fake *FakeClient) Forward(localConn io.ReadWriteCloser, remoteAddress string) error { 71 fake.forwardMutex.Lock() 72 fake.forwardArgsForCall = append(fake.forwardArgsForCall, struct { 73 localConn io.ReadWriteCloser 74 remoteAddress string 75 }{localConn, remoteAddress}) 76 fake.forwardMutex.Unlock() 77 if fake.ForwardStub != nil { 78 return fake.ForwardStub(localConn, remoteAddress) 79 } else { 80 return fake.forwardReturns.result1 81 } 82 } 83 84 func (fake *FakeClient) ForwardCallCount() int { 85 fake.forwardMutex.RLock() 86 defer fake.forwardMutex.RUnlock() 87 return len(fake.forwardArgsForCall) 88 } 89 90 func (fake *FakeClient) ForwardArgsForCall(i int) (io.ReadWriteCloser, string) { 91 fake.forwardMutex.RLock() 92 defer fake.forwardMutex.RUnlock() 93 return fake.forwardArgsForCall[i].localConn, fake.forwardArgsForCall[i].remoteAddress 94 } 95 96 func (fake *FakeClient) ForwardReturns(result1 error) { 97 fake.ForwardStub = nil 98 fake.forwardReturns = struct { 99 result1 error 100 }{result1} 101 } 102 103 var _ ssh.Client = new(FakeClient)