github.com/cloudfoundry/cli@v7.1.0+incompatible/cf/ssh/sshfakes/fake_secure_shell.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  	"code.cloudfoundry.org/cli/cf/ssh/options"
     9  )
    10  
    11  type FakeSecureShell struct {
    12  	CloseStub        func() error
    13  	closeMutex       sync.RWMutex
    14  	closeArgsForCall []struct {
    15  	}
    16  	closeReturns struct {
    17  		result1 error
    18  	}
    19  	closeReturnsOnCall map[int]struct {
    20  		result1 error
    21  	}
    22  	ConnectStub        func(*options.SSHOptions) error
    23  	connectMutex       sync.RWMutex
    24  	connectArgsForCall []struct {
    25  		arg1 *options.SSHOptions
    26  	}
    27  	connectReturns struct {
    28  		result1 error
    29  	}
    30  	connectReturnsOnCall map[int]struct {
    31  		result1 error
    32  	}
    33  	InteractiveSessionStub        func() error
    34  	interactiveSessionMutex       sync.RWMutex
    35  	interactiveSessionArgsForCall []struct {
    36  	}
    37  	interactiveSessionReturns struct {
    38  		result1 error
    39  	}
    40  	interactiveSessionReturnsOnCall map[int]struct {
    41  		result1 error
    42  	}
    43  	LocalPortForwardStub        func() error
    44  	localPortForwardMutex       sync.RWMutex
    45  	localPortForwardArgsForCall []struct {
    46  	}
    47  	localPortForwardReturns struct {
    48  		result1 error
    49  	}
    50  	localPortForwardReturnsOnCall map[int]struct {
    51  		result1 error
    52  	}
    53  	WaitStub        func() error
    54  	waitMutex       sync.RWMutex
    55  	waitArgsForCall []struct {
    56  	}
    57  	waitReturns struct {
    58  		result1 error
    59  	}
    60  	waitReturnsOnCall map[int]struct {
    61  		result1 error
    62  	}
    63  	invocations      map[string][][]interface{}
    64  	invocationsMutex sync.RWMutex
    65  }
    66  
    67  func (fake *FakeSecureShell) Close() error {
    68  	fake.closeMutex.Lock()
    69  	ret, specificReturn := fake.closeReturnsOnCall[len(fake.closeArgsForCall)]
    70  	fake.closeArgsForCall = append(fake.closeArgsForCall, struct {
    71  	}{})
    72  	fake.recordInvocation("Close", []interface{}{})
    73  	fake.closeMutex.Unlock()
    74  	if fake.CloseStub != nil {
    75  		return fake.CloseStub()
    76  	}
    77  	if specificReturn {
    78  		return ret.result1
    79  	}
    80  	fakeReturns := fake.closeReturns
    81  	return fakeReturns.result1
    82  }
    83  
    84  func (fake *FakeSecureShell) CloseCallCount() int {
    85  	fake.closeMutex.RLock()
    86  	defer fake.closeMutex.RUnlock()
    87  	return len(fake.closeArgsForCall)
    88  }
    89  
    90  func (fake *FakeSecureShell) CloseCalls(stub func() error) {
    91  	fake.closeMutex.Lock()
    92  	defer fake.closeMutex.Unlock()
    93  	fake.CloseStub = stub
    94  }
    95  
    96  func (fake *FakeSecureShell) CloseReturns(result1 error) {
    97  	fake.closeMutex.Lock()
    98  	defer fake.closeMutex.Unlock()
    99  	fake.CloseStub = nil
   100  	fake.closeReturns = struct {
   101  		result1 error
   102  	}{result1}
   103  }
   104  
   105  func (fake *FakeSecureShell) CloseReturnsOnCall(i int, result1 error) {
   106  	fake.closeMutex.Lock()
   107  	defer fake.closeMutex.Unlock()
   108  	fake.CloseStub = nil
   109  	if fake.closeReturnsOnCall == nil {
   110  		fake.closeReturnsOnCall = make(map[int]struct {
   111  			result1 error
   112  		})
   113  	}
   114  	fake.closeReturnsOnCall[i] = struct {
   115  		result1 error
   116  	}{result1}
   117  }
   118  
   119  func (fake *FakeSecureShell) Connect(arg1 *options.SSHOptions) error {
   120  	fake.connectMutex.Lock()
   121  	ret, specificReturn := fake.connectReturnsOnCall[len(fake.connectArgsForCall)]
   122  	fake.connectArgsForCall = append(fake.connectArgsForCall, struct {
   123  		arg1 *options.SSHOptions
   124  	}{arg1})
   125  	fake.recordInvocation("Connect", []interface{}{arg1})
   126  	fake.connectMutex.Unlock()
   127  	if fake.ConnectStub != nil {
   128  		return fake.ConnectStub(arg1)
   129  	}
   130  	if specificReturn {
   131  		return ret.result1
   132  	}
   133  	fakeReturns := fake.connectReturns
   134  	return fakeReturns.result1
   135  }
   136  
   137  func (fake *FakeSecureShell) ConnectCallCount() int {
   138  	fake.connectMutex.RLock()
   139  	defer fake.connectMutex.RUnlock()
   140  	return len(fake.connectArgsForCall)
   141  }
   142  
   143  func (fake *FakeSecureShell) ConnectCalls(stub func(*options.SSHOptions) error) {
   144  	fake.connectMutex.Lock()
   145  	defer fake.connectMutex.Unlock()
   146  	fake.ConnectStub = stub
   147  }
   148  
   149  func (fake *FakeSecureShell) ConnectArgsForCall(i int) *options.SSHOptions {
   150  	fake.connectMutex.RLock()
   151  	defer fake.connectMutex.RUnlock()
   152  	argsForCall := fake.connectArgsForCall[i]
   153  	return argsForCall.arg1
   154  }
   155  
   156  func (fake *FakeSecureShell) ConnectReturns(result1 error) {
   157  	fake.connectMutex.Lock()
   158  	defer fake.connectMutex.Unlock()
   159  	fake.ConnectStub = nil
   160  	fake.connectReturns = struct {
   161  		result1 error
   162  	}{result1}
   163  }
   164  
   165  func (fake *FakeSecureShell) ConnectReturnsOnCall(i int, result1 error) {
   166  	fake.connectMutex.Lock()
   167  	defer fake.connectMutex.Unlock()
   168  	fake.ConnectStub = nil
   169  	if fake.connectReturnsOnCall == nil {
   170  		fake.connectReturnsOnCall = make(map[int]struct {
   171  			result1 error
   172  		})
   173  	}
   174  	fake.connectReturnsOnCall[i] = struct {
   175  		result1 error
   176  	}{result1}
   177  }
   178  
   179  func (fake *FakeSecureShell) InteractiveSession() error {
   180  	fake.interactiveSessionMutex.Lock()
   181  	ret, specificReturn := fake.interactiveSessionReturnsOnCall[len(fake.interactiveSessionArgsForCall)]
   182  	fake.interactiveSessionArgsForCall = append(fake.interactiveSessionArgsForCall, struct {
   183  	}{})
   184  	fake.recordInvocation("InteractiveSession", []interface{}{})
   185  	fake.interactiveSessionMutex.Unlock()
   186  	if fake.InteractiveSessionStub != nil {
   187  		return fake.InteractiveSessionStub()
   188  	}
   189  	if specificReturn {
   190  		return ret.result1
   191  	}
   192  	fakeReturns := fake.interactiveSessionReturns
   193  	return fakeReturns.result1
   194  }
   195  
   196  func (fake *FakeSecureShell) InteractiveSessionCallCount() int {
   197  	fake.interactiveSessionMutex.RLock()
   198  	defer fake.interactiveSessionMutex.RUnlock()
   199  	return len(fake.interactiveSessionArgsForCall)
   200  }
   201  
   202  func (fake *FakeSecureShell) InteractiveSessionCalls(stub func() error) {
   203  	fake.interactiveSessionMutex.Lock()
   204  	defer fake.interactiveSessionMutex.Unlock()
   205  	fake.InteractiveSessionStub = stub
   206  }
   207  
   208  func (fake *FakeSecureShell) InteractiveSessionReturns(result1 error) {
   209  	fake.interactiveSessionMutex.Lock()
   210  	defer fake.interactiveSessionMutex.Unlock()
   211  	fake.InteractiveSessionStub = nil
   212  	fake.interactiveSessionReturns = struct {
   213  		result1 error
   214  	}{result1}
   215  }
   216  
   217  func (fake *FakeSecureShell) InteractiveSessionReturnsOnCall(i int, result1 error) {
   218  	fake.interactiveSessionMutex.Lock()
   219  	defer fake.interactiveSessionMutex.Unlock()
   220  	fake.InteractiveSessionStub = nil
   221  	if fake.interactiveSessionReturnsOnCall == nil {
   222  		fake.interactiveSessionReturnsOnCall = make(map[int]struct {
   223  			result1 error
   224  		})
   225  	}
   226  	fake.interactiveSessionReturnsOnCall[i] = struct {
   227  		result1 error
   228  	}{result1}
   229  }
   230  
   231  func (fake *FakeSecureShell) LocalPortForward() error {
   232  	fake.localPortForwardMutex.Lock()
   233  	ret, specificReturn := fake.localPortForwardReturnsOnCall[len(fake.localPortForwardArgsForCall)]
   234  	fake.localPortForwardArgsForCall = append(fake.localPortForwardArgsForCall, struct {
   235  	}{})
   236  	fake.recordInvocation("LocalPortForward", []interface{}{})
   237  	fake.localPortForwardMutex.Unlock()
   238  	if fake.LocalPortForwardStub != nil {
   239  		return fake.LocalPortForwardStub()
   240  	}
   241  	if specificReturn {
   242  		return ret.result1
   243  	}
   244  	fakeReturns := fake.localPortForwardReturns
   245  	return fakeReturns.result1
   246  }
   247  
   248  func (fake *FakeSecureShell) LocalPortForwardCallCount() int {
   249  	fake.localPortForwardMutex.RLock()
   250  	defer fake.localPortForwardMutex.RUnlock()
   251  	return len(fake.localPortForwardArgsForCall)
   252  }
   253  
   254  func (fake *FakeSecureShell) LocalPortForwardCalls(stub func() error) {
   255  	fake.localPortForwardMutex.Lock()
   256  	defer fake.localPortForwardMutex.Unlock()
   257  	fake.LocalPortForwardStub = stub
   258  }
   259  
   260  func (fake *FakeSecureShell) LocalPortForwardReturns(result1 error) {
   261  	fake.localPortForwardMutex.Lock()
   262  	defer fake.localPortForwardMutex.Unlock()
   263  	fake.LocalPortForwardStub = nil
   264  	fake.localPortForwardReturns = struct {
   265  		result1 error
   266  	}{result1}
   267  }
   268  
   269  func (fake *FakeSecureShell) LocalPortForwardReturnsOnCall(i int, result1 error) {
   270  	fake.localPortForwardMutex.Lock()
   271  	defer fake.localPortForwardMutex.Unlock()
   272  	fake.LocalPortForwardStub = nil
   273  	if fake.localPortForwardReturnsOnCall == nil {
   274  		fake.localPortForwardReturnsOnCall = make(map[int]struct {
   275  			result1 error
   276  		})
   277  	}
   278  	fake.localPortForwardReturnsOnCall[i] = struct {
   279  		result1 error
   280  	}{result1}
   281  }
   282  
   283  func (fake *FakeSecureShell) Wait() error {
   284  	fake.waitMutex.Lock()
   285  	ret, specificReturn := fake.waitReturnsOnCall[len(fake.waitArgsForCall)]
   286  	fake.waitArgsForCall = append(fake.waitArgsForCall, struct {
   287  	}{})
   288  	fake.recordInvocation("Wait", []interface{}{})
   289  	fake.waitMutex.Unlock()
   290  	if fake.WaitStub != nil {
   291  		return fake.WaitStub()
   292  	}
   293  	if specificReturn {
   294  		return ret.result1
   295  	}
   296  	fakeReturns := fake.waitReturns
   297  	return fakeReturns.result1
   298  }
   299  
   300  func (fake *FakeSecureShell) WaitCallCount() int {
   301  	fake.waitMutex.RLock()
   302  	defer fake.waitMutex.RUnlock()
   303  	return len(fake.waitArgsForCall)
   304  }
   305  
   306  func (fake *FakeSecureShell) WaitCalls(stub func() error) {
   307  	fake.waitMutex.Lock()
   308  	defer fake.waitMutex.Unlock()
   309  	fake.WaitStub = stub
   310  }
   311  
   312  func (fake *FakeSecureShell) WaitReturns(result1 error) {
   313  	fake.waitMutex.Lock()
   314  	defer fake.waitMutex.Unlock()
   315  	fake.WaitStub = nil
   316  	fake.waitReturns = struct {
   317  		result1 error
   318  	}{result1}
   319  }
   320  
   321  func (fake *FakeSecureShell) WaitReturnsOnCall(i int, result1 error) {
   322  	fake.waitMutex.Lock()
   323  	defer fake.waitMutex.Unlock()
   324  	fake.WaitStub = nil
   325  	if fake.waitReturnsOnCall == nil {
   326  		fake.waitReturnsOnCall = make(map[int]struct {
   327  			result1 error
   328  		})
   329  	}
   330  	fake.waitReturnsOnCall[i] = struct {
   331  		result1 error
   332  	}{result1}
   333  }
   334  
   335  func (fake *FakeSecureShell) Invocations() map[string][][]interface{} {
   336  	fake.invocationsMutex.RLock()
   337  	defer fake.invocationsMutex.RUnlock()
   338  	fake.closeMutex.RLock()
   339  	defer fake.closeMutex.RUnlock()
   340  	fake.connectMutex.RLock()
   341  	defer fake.connectMutex.RUnlock()
   342  	fake.interactiveSessionMutex.RLock()
   343  	defer fake.interactiveSessionMutex.RUnlock()
   344  	fake.localPortForwardMutex.RLock()
   345  	defer fake.localPortForwardMutex.RUnlock()
   346  	fake.waitMutex.RLock()
   347  	defer fake.waitMutex.RUnlock()
   348  	copiedInvocations := map[string][][]interface{}{}
   349  	for key, value := range fake.invocations {
   350  		copiedInvocations[key] = value
   351  	}
   352  	return copiedInvocations
   353  }
   354  
   355  func (fake *FakeSecureShell) recordInvocation(key string, args []interface{}) {
   356  	fake.invocationsMutex.Lock()
   357  	defer fake.invocationsMutex.Unlock()
   358  	if fake.invocations == nil {
   359  		fake.invocations = map[string][][]interface{}{}
   360  	}
   361  	if fake.invocations[key] == nil {
   362  		fake.invocations[key] = [][]interface{}{}
   363  	}
   364  	fake.invocations[key] = append(fake.invocations[key], args)
   365  }
   366  
   367  var _ sshCmd.SecureShell = new(FakeSecureShell)