github.com/wanddynosios/cli/v8@v8.7.9-0.20240221182337-1a92e3a7017f/api/plugin/pluginfakes/fake_connection.go (about)

     1  // Code generated by counterfeiter. DO NOT EDIT.
     2  package pluginfakes
     3  
     4  import (
     5  	"net/http"
     6  	"sync"
     7  
     8  	"code.cloudfoundry.org/cli/api/plugin"
     9  )
    10  
    11  type FakeConnection struct {
    12  	MakeStub        func(*http.Request, *plugin.Response, plugin.ProxyReader) error
    13  	makeMutex       sync.RWMutex
    14  	makeArgsForCall []struct {
    15  		arg1 *http.Request
    16  		arg2 *plugin.Response
    17  		arg3 plugin.ProxyReader
    18  	}
    19  	makeReturns struct {
    20  		result1 error
    21  	}
    22  	makeReturnsOnCall map[int]struct {
    23  		result1 error
    24  	}
    25  	invocations      map[string][][]interface{}
    26  	invocationsMutex sync.RWMutex
    27  }
    28  
    29  func (fake *FakeConnection) Make(arg1 *http.Request, arg2 *plugin.Response, arg3 plugin.ProxyReader) error {
    30  	fake.makeMutex.Lock()
    31  	ret, specificReturn := fake.makeReturnsOnCall[len(fake.makeArgsForCall)]
    32  	fake.makeArgsForCall = append(fake.makeArgsForCall, struct {
    33  		arg1 *http.Request
    34  		arg2 *plugin.Response
    35  		arg3 plugin.ProxyReader
    36  	}{arg1, arg2, arg3})
    37  	fake.recordInvocation("Make", []interface{}{arg1, arg2, arg3})
    38  	fake.makeMutex.Unlock()
    39  	if fake.MakeStub != nil {
    40  		return fake.MakeStub(arg1, arg2, arg3)
    41  	}
    42  	if specificReturn {
    43  		return ret.result1
    44  	}
    45  	fakeReturns := fake.makeReturns
    46  	return fakeReturns.result1
    47  }
    48  
    49  func (fake *FakeConnection) MakeCallCount() int {
    50  	fake.makeMutex.RLock()
    51  	defer fake.makeMutex.RUnlock()
    52  	return len(fake.makeArgsForCall)
    53  }
    54  
    55  func (fake *FakeConnection) MakeCalls(stub func(*http.Request, *plugin.Response, plugin.ProxyReader) error) {
    56  	fake.makeMutex.Lock()
    57  	defer fake.makeMutex.Unlock()
    58  	fake.MakeStub = stub
    59  }
    60  
    61  func (fake *FakeConnection) MakeArgsForCall(i int) (*http.Request, *plugin.Response, plugin.ProxyReader) {
    62  	fake.makeMutex.RLock()
    63  	defer fake.makeMutex.RUnlock()
    64  	argsForCall := fake.makeArgsForCall[i]
    65  	return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3
    66  }
    67  
    68  func (fake *FakeConnection) MakeReturns(result1 error) {
    69  	fake.makeMutex.Lock()
    70  	defer fake.makeMutex.Unlock()
    71  	fake.MakeStub = nil
    72  	fake.makeReturns = struct {
    73  		result1 error
    74  	}{result1}
    75  }
    76  
    77  func (fake *FakeConnection) MakeReturnsOnCall(i int, result1 error) {
    78  	fake.makeMutex.Lock()
    79  	defer fake.makeMutex.Unlock()
    80  	fake.MakeStub = nil
    81  	if fake.makeReturnsOnCall == nil {
    82  		fake.makeReturnsOnCall = make(map[int]struct {
    83  			result1 error
    84  		})
    85  	}
    86  	fake.makeReturnsOnCall[i] = struct {
    87  		result1 error
    88  	}{result1}
    89  }
    90  
    91  func (fake *FakeConnection) Invocations() map[string][][]interface{} {
    92  	fake.invocationsMutex.RLock()
    93  	defer fake.invocationsMutex.RUnlock()
    94  	fake.makeMutex.RLock()
    95  	defer fake.makeMutex.RUnlock()
    96  	copiedInvocations := map[string][][]interface{}{}
    97  	for key, value := range fake.invocations {
    98  		copiedInvocations[key] = value
    99  	}
   100  	return copiedInvocations
   101  }
   102  
   103  func (fake *FakeConnection) recordInvocation(key string, args []interface{}) {
   104  	fake.invocationsMutex.Lock()
   105  	defer fake.invocationsMutex.Unlock()
   106  	if fake.invocations == nil {
   107  		fake.invocations = map[string][][]interface{}{}
   108  	}
   109  	if fake.invocations[key] == nil {
   110  		fake.invocations[key] = [][]interface{}{}
   111  	}
   112  	fake.invocations[key] = append(fake.invocations[key], args)
   113  }
   114  
   115  var _ plugin.Connection = new(FakeConnection)