github.com/sleungcy-sap/cli@v7.1.0+incompatible/cf/ssh/sshfakes/fake_secure_dialer.go (about) 1 // Code generated by counterfeiter. DO NOT EDIT. 2 package sshfakes 3 4 import ( 5 "sync" 6 7 sshCmd "code.cloudfoundry.org/cli/cf/ssh" 8 "golang.org/x/crypto/ssh" 9 ) 10 11 type FakeSecureDialer struct { 12 DialStub func(string, string, *ssh.ClientConfig) (sshCmd.SecureClient, error) 13 dialMutex sync.RWMutex 14 dialArgsForCall []struct { 15 arg1 string 16 arg2 string 17 arg3 *ssh.ClientConfig 18 } 19 dialReturns struct { 20 result1 sshCmd.SecureClient 21 result2 error 22 } 23 dialReturnsOnCall map[int]struct { 24 result1 sshCmd.SecureClient 25 result2 error 26 } 27 invocations map[string][][]interface{} 28 invocationsMutex sync.RWMutex 29 } 30 31 func (fake *FakeSecureDialer) Dial(arg1 string, arg2 string, arg3 *ssh.ClientConfig) (sshCmd.SecureClient, error) { 32 fake.dialMutex.Lock() 33 ret, specificReturn := fake.dialReturnsOnCall[len(fake.dialArgsForCall)] 34 fake.dialArgsForCall = append(fake.dialArgsForCall, struct { 35 arg1 string 36 arg2 string 37 arg3 *ssh.ClientConfig 38 }{arg1, arg2, arg3}) 39 fake.recordInvocation("Dial", []interface{}{arg1, arg2, arg3}) 40 fake.dialMutex.Unlock() 41 if fake.DialStub != nil { 42 return fake.DialStub(arg1, arg2, arg3) 43 } 44 if specificReturn { 45 return ret.result1, ret.result2 46 } 47 fakeReturns := fake.dialReturns 48 return fakeReturns.result1, fakeReturns.result2 49 } 50 51 func (fake *FakeSecureDialer) DialCallCount() int { 52 fake.dialMutex.RLock() 53 defer fake.dialMutex.RUnlock() 54 return len(fake.dialArgsForCall) 55 } 56 57 func (fake *FakeSecureDialer) DialCalls(stub func(string, string, *ssh.ClientConfig) (sshCmd.SecureClient, error)) { 58 fake.dialMutex.Lock() 59 defer fake.dialMutex.Unlock() 60 fake.DialStub = stub 61 } 62 63 func (fake *FakeSecureDialer) DialArgsForCall(i int) (string, string, *ssh.ClientConfig) { 64 fake.dialMutex.RLock() 65 defer fake.dialMutex.RUnlock() 66 argsForCall := fake.dialArgsForCall[i] 67 return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3 68 } 69 70 func (fake *FakeSecureDialer) DialReturns(result1 sshCmd.SecureClient, result2 error) { 71 fake.dialMutex.Lock() 72 defer fake.dialMutex.Unlock() 73 fake.DialStub = nil 74 fake.dialReturns = struct { 75 result1 sshCmd.SecureClient 76 result2 error 77 }{result1, result2} 78 } 79 80 func (fake *FakeSecureDialer) DialReturnsOnCall(i int, result1 sshCmd.SecureClient, result2 error) { 81 fake.dialMutex.Lock() 82 defer fake.dialMutex.Unlock() 83 fake.DialStub = nil 84 if fake.dialReturnsOnCall == nil { 85 fake.dialReturnsOnCall = make(map[int]struct { 86 result1 sshCmd.SecureClient 87 result2 error 88 }) 89 } 90 fake.dialReturnsOnCall[i] = struct { 91 result1 sshCmd.SecureClient 92 result2 error 93 }{result1, result2} 94 } 95 96 func (fake *FakeSecureDialer) Invocations() map[string][][]interface{} { 97 fake.invocationsMutex.RLock() 98 defer fake.invocationsMutex.RUnlock() 99 fake.dialMutex.RLock() 100 defer fake.dialMutex.RUnlock() 101 copiedInvocations := map[string][][]interface{}{} 102 for key, value := range fake.invocations { 103 copiedInvocations[key] = value 104 } 105 return copiedInvocations 106 } 107 108 func (fake *FakeSecureDialer) recordInvocation(key string, args []interface{}) { 109 fake.invocationsMutex.Lock() 110 defer fake.invocationsMutex.Unlock() 111 if fake.invocations == nil { 112 fake.invocations = map[string][][]interface{}{} 113 } 114 if fake.invocations[key] == nil { 115 fake.invocations[key] = [][]interface{}{} 116 } 117 fake.invocations[key] = append(fake.invocations[key], args) 118 } 119 120 var _ sshCmd.SecureDialer = new(FakeSecureDialer)