github.com/nimakaviani/cli@v6.37.1-0.20180619223813-e734901a73fa+incompatible/command/v3/v3fakes/fake_sshactor.go (about) 1 // Code generated by counterfeiter. DO NOT EDIT. 2 package v3fakes 3 4 import ( 5 "sync" 6 7 "code.cloudfoundry.org/cli/actor/sharedaction" 8 "code.cloudfoundry.org/cli/command/v3" 9 ) 10 11 type FakeSSHActor struct { 12 ExecuteSecureShellStub func(sshClient sharedaction.SecureShellClient, sshOptions sharedaction.SSHOptions) error 13 executeSecureShellMutex sync.RWMutex 14 executeSecureShellArgsForCall []struct { 15 sshClient sharedaction.SecureShellClient 16 sshOptions sharedaction.SSHOptions 17 } 18 executeSecureShellReturns struct { 19 result1 error 20 } 21 executeSecureShellReturnsOnCall map[int]struct { 22 result1 error 23 } 24 invocations map[string][][]interface{} 25 invocationsMutex sync.RWMutex 26 } 27 28 func (fake *FakeSSHActor) ExecuteSecureShell(sshClient sharedaction.SecureShellClient, sshOptions sharedaction.SSHOptions) error { 29 fake.executeSecureShellMutex.Lock() 30 ret, specificReturn := fake.executeSecureShellReturnsOnCall[len(fake.executeSecureShellArgsForCall)] 31 fake.executeSecureShellArgsForCall = append(fake.executeSecureShellArgsForCall, struct { 32 sshClient sharedaction.SecureShellClient 33 sshOptions sharedaction.SSHOptions 34 }{sshClient, sshOptions}) 35 fake.recordInvocation("ExecuteSecureShell", []interface{}{sshClient, sshOptions}) 36 fake.executeSecureShellMutex.Unlock() 37 if fake.ExecuteSecureShellStub != nil { 38 return fake.ExecuteSecureShellStub(sshClient, sshOptions) 39 } 40 if specificReturn { 41 return ret.result1 42 } 43 return fake.executeSecureShellReturns.result1 44 } 45 46 func (fake *FakeSSHActor) ExecuteSecureShellCallCount() int { 47 fake.executeSecureShellMutex.RLock() 48 defer fake.executeSecureShellMutex.RUnlock() 49 return len(fake.executeSecureShellArgsForCall) 50 } 51 52 func (fake *FakeSSHActor) ExecuteSecureShellArgsForCall(i int) (sharedaction.SecureShellClient, sharedaction.SSHOptions) { 53 fake.executeSecureShellMutex.RLock() 54 defer fake.executeSecureShellMutex.RUnlock() 55 return fake.executeSecureShellArgsForCall[i].sshClient, fake.executeSecureShellArgsForCall[i].sshOptions 56 } 57 58 func (fake *FakeSSHActor) ExecuteSecureShellReturns(result1 error) { 59 fake.ExecuteSecureShellStub = nil 60 fake.executeSecureShellReturns = struct { 61 result1 error 62 }{result1} 63 } 64 65 func (fake *FakeSSHActor) ExecuteSecureShellReturnsOnCall(i int, result1 error) { 66 fake.ExecuteSecureShellStub = nil 67 if fake.executeSecureShellReturnsOnCall == nil { 68 fake.executeSecureShellReturnsOnCall = make(map[int]struct { 69 result1 error 70 }) 71 } 72 fake.executeSecureShellReturnsOnCall[i] = struct { 73 result1 error 74 }{result1} 75 } 76 77 func (fake *FakeSSHActor) Invocations() map[string][][]interface{} { 78 fake.invocationsMutex.RLock() 79 defer fake.invocationsMutex.RUnlock() 80 fake.executeSecureShellMutex.RLock() 81 defer fake.executeSecureShellMutex.RUnlock() 82 copiedInvocations := map[string][][]interface{}{} 83 for key, value := range fake.invocations { 84 copiedInvocations[key] = value 85 } 86 return copiedInvocations 87 } 88 89 func (fake *FakeSSHActor) recordInvocation(key string, args []interface{}) { 90 fake.invocationsMutex.Lock() 91 defer fake.invocationsMutex.Unlock() 92 if fake.invocations == nil { 93 fake.invocations = map[string][][]interface{}{} 94 } 95 if fake.invocations[key] == nil { 96 fake.invocations[key] = [][]interface{}{} 97 } 98 fake.invocations[key] = append(fake.invocations[key], args) 99 } 100 101 var _ v3.SSHActor = new(FakeSSHActor)