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