github.com/loafoe/cli@v7.1.0+incompatible/actor/sharedaction/sharedactionfakes/fake_secure_shell_client.go (about)

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