github.com/dcarley/cf-cli@v6.24.1-0.20170220111324-4225ff346898+incompatible/cf/ssh/sshfakes/fake_secure_shell.go (about)

     1  // This file was generated by counterfeiter
     2  package sshfakes
     3  
     4  import (
     5  	"sync"
     6  
     7  	"code.cloudfoundry.org/cli/cf/ssh"
     8  	"code.cloudfoundry.org/cli/cf/ssh/options"
     9  )
    10  
    11  type FakeSecureShell struct {
    12  	ConnectStub        func(opts *options.SSHOptions) error
    13  	connectMutex       sync.RWMutex
    14  	connectArgsForCall []struct {
    15  		opts *options.SSHOptions
    16  	}
    17  	connectReturns struct {
    18  		result1 error
    19  	}
    20  	InteractiveSessionStub        func() error
    21  	interactiveSessionMutex       sync.RWMutex
    22  	interactiveSessionArgsForCall []struct{}
    23  	interactiveSessionReturns     struct {
    24  		result1 error
    25  	}
    26  	LocalPortForwardStub        func() error
    27  	localPortForwardMutex       sync.RWMutex
    28  	localPortForwardArgsForCall []struct{}
    29  	localPortForwardReturns     struct {
    30  		result1 error
    31  	}
    32  	WaitStub        func() error
    33  	waitMutex       sync.RWMutex
    34  	waitArgsForCall []struct{}
    35  	waitReturns     struct {
    36  		result1 error
    37  	}
    38  	CloseStub        func() error
    39  	closeMutex       sync.RWMutex
    40  	closeArgsForCall []struct{}
    41  	closeReturns     struct {
    42  		result1 error
    43  	}
    44  	invocations      map[string][][]interface{}
    45  	invocationsMutex sync.RWMutex
    46  }
    47  
    48  func (fake *FakeSecureShell) Connect(opts *options.SSHOptions) error {
    49  	fake.connectMutex.Lock()
    50  	fake.connectArgsForCall = append(fake.connectArgsForCall, struct {
    51  		opts *options.SSHOptions
    52  	}{opts})
    53  	fake.recordInvocation("Connect", []interface{}{opts})
    54  	fake.connectMutex.Unlock()
    55  	if fake.ConnectStub != nil {
    56  		return fake.ConnectStub(opts)
    57  	} else {
    58  		return fake.connectReturns.result1
    59  	}
    60  }
    61  
    62  func (fake *FakeSecureShell) ConnectCallCount() int {
    63  	fake.connectMutex.RLock()
    64  	defer fake.connectMutex.RUnlock()
    65  	return len(fake.connectArgsForCall)
    66  }
    67  
    68  func (fake *FakeSecureShell) ConnectArgsForCall(i int) *options.SSHOptions {
    69  	fake.connectMutex.RLock()
    70  	defer fake.connectMutex.RUnlock()
    71  	return fake.connectArgsForCall[i].opts
    72  }
    73  
    74  func (fake *FakeSecureShell) ConnectReturns(result1 error) {
    75  	fake.ConnectStub = nil
    76  	fake.connectReturns = struct {
    77  		result1 error
    78  	}{result1}
    79  }
    80  
    81  func (fake *FakeSecureShell) InteractiveSession() error {
    82  	fake.interactiveSessionMutex.Lock()
    83  	fake.interactiveSessionArgsForCall = append(fake.interactiveSessionArgsForCall, struct{}{})
    84  	fake.recordInvocation("InteractiveSession", []interface{}{})
    85  	fake.interactiveSessionMutex.Unlock()
    86  	if fake.InteractiveSessionStub != nil {
    87  		return fake.InteractiveSessionStub()
    88  	} else {
    89  		return fake.interactiveSessionReturns.result1
    90  	}
    91  }
    92  
    93  func (fake *FakeSecureShell) InteractiveSessionCallCount() int {
    94  	fake.interactiveSessionMutex.RLock()
    95  	defer fake.interactiveSessionMutex.RUnlock()
    96  	return len(fake.interactiveSessionArgsForCall)
    97  }
    98  
    99  func (fake *FakeSecureShell) InteractiveSessionReturns(result1 error) {
   100  	fake.InteractiveSessionStub = nil
   101  	fake.interactiveSessionReturns = struct {
   102  		result1 error
   103  	}{result1}
   104  }
   105  
   106  func (fake *FakeSecureShell) LocalPortForward() error {
   107  	fake.localPortForwardMutex.Lock()
   108  	fake.localPortForwardArgsForCall = append(fake.localPortForwardArgsForCall, struct{}{})
   109  	fake.recordInvocation("LocalPortForward", []interface{}{})
   110  	fake.localPortForwardMutex.Unlock()
   111  	if fake.LocalPortForwardStub != nil {
   112  		return fake.LocalPortForwardStub()
   113  	} else {
   114  		return fake.localPortForwardReturns.result1
   115  	}
   116  }
   117  
   118  func (fake *FakeSecureShell) LocalPortForwardCallCount() int {
   119  	fake.localPortForwardMutex.RLock()
   120  	defer fake.localPortForwardMutex.RUnlock()
   121  	return len(fake.localPortForwardArgsForCall)
   122  }
   123  
   124  func (fake *FakeSecureShell) LocalPortForwardReturns(result1 error) {
   125  	fake.LocalPortForwardStub = nil
   126  	fake.localPortForwardReturns = struct {
   127  		result1 error
   128  	}{result1}
   129  }
   130  
   131  func (fake *FakeSecureShell) Wait() error {
   132  	fake.waitMutex.Lock()
   133  	fake.waitArgsForCall = append(fake.waitArgsForCall, struct{}{})
   134  	fake.recordInvocation("Wait", []interface{}{})
   135  	fake.waitMutex.Unlock()
   136  	if fake.WaitStub != nil {
   137  		return fake.WaitStub()
   138  	} else {
   139  		return fake.waitReturns.result1
   140  	}
   141  }
   142  
   143  func (fake *FakeSecureShell) WaitCallCount() int {
   144  	fake.waitMutex.RLock()
   145  	defer fake.waitMutex.RUnlock()
   146  	return len(fake.waitArgsForCall)
   147  }
   148  
   149  func (fake *FakeSecureShell) WaitReturns(result1 error) {
   150  	fake.WaitStub = nil
   151  	fake.waitReturns = struct {
   152  		result1 error
   153  	}{result1}
   154  }
   155  
   156  func (fake *FakeSecureShell) Close() error {
   157  	fake.closeMutex.Lock()
   158  	fake.closeArgsForCall = append(fake.closeArgsForCall, struct{}{})
   159  	fake.recordInvocation("Close", []interface{}{})
   160  	fake.closeMutex.Unlock()
   161  	if fake.CloseStub != nil {
   162  		return fake.CloseStub()
   163  	} else {
   164  		return fake.closeReturns.result1
   165  	}
   166  }
   167  
   168  func (fake *FakeSecureShell) CloseCallCount() int {
   169  	fake.closeMutex.RLock()
   170  	defer fake.closeMutex.RUnlock()
   171  	return len(fake.closeArgsForCall)
   172  }
   173  
   174  func (fake *FakeSecureShell) CloseReturns(result1 error) {
   175  	fake.CloseStub = nil
   176  	fake.closeReturns = struct {
   177  		result1 error
   178  	}{result1}
   179  }
   180  
   181  func (fake *FakeSecureShell) Invocations() map[string][][]interface{} {
   182  	fake.invocationsMutex.RLock()
   183  	defer fake.invocationsMutex.RUnlock()
   184  	fake.connectMutex.RLock()
   185  	defer fake.connectMutex.RUnlock()
   186  	fake.interactiveSessionMutex.RLock()
   187  	defer fake.interactiveSessionMutex.RUnlock()
   188  	fake.localPortForwardMutex.RLock()
   189  	defer fake.localPortForwardMutex.RUnlock()
   190  	fake.waitMutex.RLock()
   191  	defer fake.waitMutex.RUnlock()
   192  	fake.closeMutex.RLock()
   193  	defer fake.closeMutex.RUnlock()
   194  	return fake.invocations
   195  }
   196  
   197  func (fake *FakeSecureShell) recordInvocation(key string, args []interface{}) {
   198  	fake.invocationsMutex.Lock()
   199  	defer fake.invocationsMutex.Unlock()
   200  	if fake.invocations == nil {
   201  		fake.invocations = map[string][][]interface{}{}
   202  	}
   203  	if fake.invocations[key] == nil {
   204  		fake.invocations[key] = [][]interface{}{}
   205  	}
   206  	fake.invocations[key] = append(fake.invocations[key], args)
   207  }
   208  
   209  var _ sshCmd.SecureShell = new(FakeSecureShell)