github.com/sleungcy-sap/cli@v7.1.0+incompatible/cf/ssh/sshfakes/fake_secure_client.go (about)

     1  // Code generated by counterfeiter. DO NOT EDIT.
     2  package sshfakes
     3  
     4  import (
     5  	"net"
     6  	"sync"
     7  
     8  	sshCmd "code.cloudfoundry.org/cli/cf/ssh"
     9  	"golang.org/x/crypto/ssh"
    10  )
    11  
    12  type FakeSecureClient struct {
    13  	CloseStub        func() error
    14  	closeMutex       sync.RWMutex
    15  	closeArgsForCall []struct {
    16  	}
    17  	closeReturns struct {
    18  		result1 error
    19  	}
    20  	closeReturnsOnCall map[int]struct {
    21  		result1 error
    22  	}
    23  	ConnStub        func() ssh.Conn
    24  	connMutex       sync.RWMutex
    25  	connArgsForCall []struct {
    26  	}
    27  	connReturns struct {
    28  		result1 ssh.Conn
    29  	}
    30  	connReturnsOnCall map[int]struct {
    31  		result1 ssh.Conn
    32  	}
    33  	DialStub        func(string, string) (net.Conn, error)
    34  	dialMutex       sync.RWMutex
    35  	dialArgsForCall []struct {
    36  		arg1 string
    37  		arg2 string
    38  	}
    39  	dialReturns struct {
    40  		result1 net.Conn
    41  		result2 error
    42  	}
    43  	dialReturnsOnCall map[int]struct {
    44  		result1 net.Conn
    45  		result2 error
    46  	}
    47  	NewSessionStub        func() (sshCmd.SecureSession, error)
    48  	newSessionMutex       sync.RWMutex
    49  	newSessionArgsForCall []struct {
    50  	}
    51  	newSessionReturns struct {
    52  		result1 sshCmd.SecureSession
    53  		result2 error
    54  	}
    55  	newSessionReturnsOnCall map[int]struct {
    56  		result1 sshCmd.SecureSession
    57  		result2 error
    58  	}
    59  	WaitStub        func() error
    60  	waitMutex       sync.RWMutex
    61  	waitArgsForCall []struct {
    62  	}
    63  	waitReturns struct {
    64  		result1 error
    65  	}
    66  	waitReturnsOnCall map[int]struct {
    67  		result1 error
    68  	}
    69  	invocations      map[string][][]interface{}
    70  	invocationsMutex sync.RWMutex
    71  }
    72  
    73  func (fake *FakeSecureClient) Close() error {
    74  	fake.closeMutex.Lock()
    75  	ret, specificReturn := fake.closeReturnsOnCall[len(fake.closeArgsForCall)]
    76  	fake.closeArgsForCall = append(fake.closeArgsForCall, struct {
    77  	}{})
    78  	fake.recordInvocation("Close", []interface{}{})
    79  	fake.closeMutex.Unlock()
    80  	if fake.CloseStub != nil {
    81  		return fake.CloseStub()
    82  	}
    83  	if specificReturn {
    84  		return ret.result1
    85  	}
    86  	fakeReturns := fake.closeReturns
    87  	return fakeReturns.result1
    88  }
    89  
    90  func (fake *FakeSecureClient) CloseCallCount() int {
    91  	fake.closeMutex.RLock()
    92  	defer fake.closeMutex.RUnlock()
    93  	return len(fake.closeArgsForCall)
    94  }
    95  
    96  func (fake *FakeSecureClient) CloseCalls(stub func() error) {
    97  	fake.closeMutex.Lock()
    98  	defer fake.closeMutex.Unlock()
    99  	fake.CloseStub = stub
   100  }
   101  
   102  func (fake *FakeSecureClient) CloseReturns(result1 error) {
   103  	fake.closeMutex.Lock()
   104  	defer fake.closeMutex.Unlock()
   105  	fake.CloseStub = nil
   106  	fake.closeReturns = struct {
   107  		result1 error
   108  	}{result1}
   109  }
   110  
   111  func (fake *FakeSecureClient) CloseReturnsOnCall(i int, result1 error) {
   112  	fake.closeMutex.Lock()
   113  	defer fake.closeMutex.Unlock()
   114  	fake.CloseStub = nil
   115  	if fake.closeReturnsOnCall == nil {
   116  		fake.closeReturnsOnCall = make(map[int]struct {
   117  			result1 error
   118  		})
   119  	}
   120  	fake.closeReturnsOnCall[i] = struct {
   121  		result1 error
   122  	}{result1}
   123  }
   124  
   125  func (fake *FakeSecureClient) Conn() ssh.Conn {
   126  	fake.connMutex.Lock()
   127  	ret, specificReturn := fake.connReturnsOnCall[len(fake.connArgsForCall)]
   128  	fake.connArgsForCall = append(fake.connArgsForCall, struct {
   129  	}{})
   130  	fake.recordInvocation("Conn", []interface{}{})
   131  	fake.connMutex.Unlock()
   132  	if fake.ConnStub != nil {
   133  		return fake.ConnStub()
   134  	}
   135  	if specificReturn {
   136  		return ret.result1
   137  	}
   138  	fakeReturns := fake.connReturns
   139  	return fakeReturns.result1
   140  }
   141  
   142  func (fake *FakeSecureClient) ConnCallCount() int {
   143  	fake.connMutex.RLock()
   144  	defer fake.connMutex.RUnlock()
   145  	return len(fake.connArgsForCall)
   146  }
   147  
   148  func (fake *FakeSecureClient) ConnCalls(stub func() ssh.Conn) {
   149  	fake.connMutex.Lock()
   150  	defer fake.connMutex.Unlock()
   151  	fake.ConnStub = stub
   152  }
   153  
   154  func (fake *FakeSecureClient) ConnReturns(result1 ssh.Conn) {
   155  	fake.connMutex.Lock()
   156  	defer fake.connMutex.Unlock()
   157  	fake.ConnStub = nil
   158  	fake.connReturns = struct {
   159  		result1 ssh.Conn
   160  	}{result1}
   161  }
   162  
   163  func (fake *FakeSecureClient) ConnReturnsOnCall(i int, result1 ssh.Conn) {
   164  	fake.connMutex.Lock()
   165  	defer fake.connMutex.Unlock()
   166  	fake.ConnStub = nil
   167  	if fake.connReturnsOnCall == nil {
   168  		fake.connReturnsOnCall = make(map[int]struct {
   169  			result1 ssh.Conn
   170  		})
   171  	}
   172  	fake.connReturnsOnCall[i] = struct {
   173  		result1 ssh.Conn
   174  	}{result1}
   175  }
   176  
   177  func (fake *FakeSecureClient) Dial(arg1 string, arg2 string) (net.Conn, error) {
   178  	fake.dialMutex.Lock()
   179  	ret, specificReturn := fake.dialReturnsOnCall[len(fake.dialArgsForCall)]
   180  	fake.dialArgsForCall = append(fake.dialArgsForCall, struct {
   181  		arg1 string
   182  		arg2 string
   183  	}{arg1, arg2})
   184  	fake.recordInvocation("Dial", []interface{}{arg1, arg2})
   185  	fake.dialMutex.Unlock()
   186  	if fake.DialStub != nil {
   187  		return fake.DialStub(arg1, arg2)
   188  	}
   189  	if specificReturn {
   190  		return ret.result1, ret.result2
   191  	}
   192  	fakeReturns := fake.dialReturns
   193  	return fakeReturns.result1, fakeReturns.result2
   194  }
   195  
   196  func (fake *FakeSecureClient) DialCallCount() int {
   197  	fake.dialMutex.RLock()
   198  	defer fake.dialMutex.RUnlock()
   199  	return len(fake.dialArgsForCall)
   200  }
   201  
   202  func (fake *FakeSecureClient) DialCalls(stub func(string, string) (net.Conn, error)) {
   203  	fake.dialMutex.Lock()
   204  	defer fake.dialMutex.Unlock()
   205  	fake.DialStub = stub
   206  }
   207  
   208  func (fake *FakeSecureClient) DialArgsForCall(i int) (string, string) {
   209  	fake.dialMutex.RLock()
   210  	defer fake.dialMutex.RUnlock()
   211  	argsForCall := fake.dialArgsForCall[i]
   212  	return argsForCall.arg1, argsForCall.arg2
   213  }
   214  
   215  func (fake *FakeSecureClient) DialReturns(result1 net.Conn, result2 error) {
   216  	fake.dialMutex.Lock()
   217  	defer fake.dialMutex.Unlock()
   218  	fake.DialStub = nil
   219  	fake.dialReturns = struct {
   220  		result1 net.Conn
   221  		result2 error
   222  	}{result1, result2}
   223  }
   224  
   225  func (fake *FakeSecureClient) DialReturnsOnCall(i int, result1 net.Conn, result2 error) {
   226  	fake.dialMutex.Lock()
   227  	defer fake.dialMutex.Unlock()
   228  	fake.DialStub = nil
   229  	if fake.dialReturnsOnCall == nil {
   230  		fake.dialReturnsOnCall = make(map[int]struct {
   231  			result1 net.Conn
   232  			result2 error
   233  		})
   234  	}
   235  	fake.dialReturnsOnCall[i] = struct {
   236  		result1 net.Conn
   237  		result2 error
   238  	}{result1, result2}
   239  }
   240  
   241  func (fake *FakeSecureClient) NewSession() (sshCmd.SecureSession, error) {
   242  	fake.newSessionMutex.Lock()
   243  	ret, specificReturn := fake.newSessionReturnsOnCall[len(fake.newSessionArgsForCall)]
   244  	fake.newSessionArgsForCall = append(fake.newSessionArgsForCall, struct {
   245  	}{})
   246  	fake.recordInvocation("NewSession", []interface{}{})
   247  	fake.newSessionMutex.Unlock()
   248  	if fake.NewSessionStub != nil {
   249  		return fake.NewSessionStub()
   250  	}
   251  	if specificReturn {
   252  		return ret.result1, ret.result2
   253  	}
   254  	fakeReturns := fake.newSessionReturns
   255  	return fakeReturns.result1, fakeReturns.result2
   256  }
   257  
   258  func (fake *FakeSecureClient) NewSessionCallCount() int {
   259  	fake.newSessionMutex.RLock()
   260  	defer fake.newSessionMutex.RUnlock()
   261  	return len(fake.newSessionArgsForCall)
   262  }
   263  
   264  func (fake *FakeSecureClient) NewSessionCalls(stub func() (sshCmd.SecureSession, error)) {
   265  	fake.newSessionMutex.Lock()
   266  	defer fake.newSessionMutex.Unlock()
   267  	fake.NewSessionStub = stub
   268  }
   269  
   270  func (fake *FakeSecureClient) NewSessionReturns(result1 sshCmd.SecureSession, result2 error) {
   271  	fake.newSessionMutex.Lock()
   272  	defer fake.newSessionMutex.Unlock()
   273  	fake.NewSessionStub = nil
   274  	fake.newSessionReturns = struct {
   275  		result1 sshCmd.SecureSession
   276  		result2 error
   277  	}{result1, result2}
   278  }
   279  
   280  func (fake *FakeSecureClient) NewSessionReturnsOnCall(i int, result1 sshCmd.SecureSession, result2 error) {
   281  	fake.newSessionMutex.Lock()
   282  	defer fake.newSessionMutex.Unlock()
   283  	fake.NewSessionStub = nil
   284  	if fake.newSessionReturnsOnCall == nil {
   285  		fake.newSessionReturnsOnCall = make(map[int]struct {
   286  			result1 sshCmd.SecureSession
   287  			result2 error
   288  		})
   289  	}
   290  	fake.newSessionReturnsOnCall[i] = struct {
   291  		result1 sshCmd.SecureSession
   292  		result2 error
   293  	}{result1, result2}
   294  }
   295  
   296  func (fake *FakeSecureClient) Wait() error {
   297  	fake.waitMutex.Lock()
   298  	ret, specificReturn := fake.waitReturnsOnCall[len(fake.waitArgsForCall)]
   299  	fake.waitArgsForCall = append(fake.waitArgsForCall, struct {
   300  	}{})
   301  	fake.recordInvocation("Wait", []interface{}{})
   302  	fake.waitMutex.Unlock()
   303  	if fake.WaitStub != nil {
   304  		return fake.WaitStub()
   305  	}
   306  	if specificReturn {
   307  		return ret.result1
   308  	}
   309  	fakeReturns := fake.waitReturns
   310  	return fakeReturns.result1
   311  }
   312  
   313  func (fake *FakeSecureClient) WaitCallCount() int {
   314  	fake.waitMutex.RLock()
   315  	defer fake.waitMutex.RUnlock()
   316  	return len(fake.waitArgsForCall)
   317  }
   318  
   319  func (fake *FakeSecureClient) WaitCalls(stub func() error) {
   320  	fake.waitMutex.Lock()
   321  	defer fake.waitMutex.Unlock()
   322  	fake.WaitStub = stub
   323  }
   324  
   325  func (fake *FakeSecureClient) WaitReturns(result1 error) {
   326  	fake.waitMutex.Lock()
   327  	defer fake.waitMutex.Unlock()
   328  	fake.WaitStub = nil
   329  	fake.waitReturns = struct {
   330  		result1 error
   331  	}{result1}
   332  }
   333  
   334  func (fake *FakeSecureClient) WaitReturnsOnCall(i int, result1 error) {
   335  	fake.waitMutex.Lock()
   336  	defer fake.waitMutex.Unlock()
   337  	fake.WaitStub = nil
   338  	if fake.waitReturnsOnCall == nil {
   339  		fake.waitReturnsOnCall = make(map[int]struct {
   340  			result1 error
   341  		})
   342  	}
   343  	fake.waitReturnsOnCall[i] = struct {
   344  		result1 error
   345  	}{result1}
   346  }
   347  
   348  func (fake *FakeSecureClient) Invocations() map[string][][]interface{} {
   349  	fake.invocationsMutex.RLock()
   350  	defer fake.invocationsMutex.RUnlock()
   351  	fake.closeMutex.RLock()
   352  	defer fake.closeMutex.RUnlock()
   353  	fake.connMutex.RLock()
   354  	defer fake.connMutex.RUnlock()
   355  	fake.dialMutex.RLock()
   356  	defer fake.dialMutex.RUnlock()
   357  	fake.newSessionMutex.RLock()
   358  	defer fake.newSessionMutex.RUnlock()
   359  	fake.waitMutex.RLock()
   360  	defer fake.waitMutex.RUnlock()
   361  	copiedInvocations := map[string][][]interface{}{}
   362  	for key, value := range fake.invocations {
   363  		copiedInvocations[key] = value
   364  	}
   365  	return copiedInvocations
   366  }
   367  
   368  func (fake *FakeSecureClient) recordInvocation(key string, args []interface{}) {
   369  	fake.invocationsMutex.Lock()
   370  	defer fake.invocationsMutex.Unlock()
   371  	if fake.invocations == nil {
   372  		fake.invocations = map[string][][]interface{}{}
   373  	}
   374  	if fake.invocations[key] == nil {
   375  		fake.invocations[key] = [][]interface{}{}
   376  	}
   377  	fake.invocations[key] = append(fake.invocations[key], args)
   378  }
   379  
   380  var _ sshCmd.SecureClient = new(FakeSecureClient)