github.com/dcarley/cf-cli@v6.24.1-0.20170220111324-4225ff346898+incompatible/api/cloudcontroller/ccv3/ccv3fakes/fake_connection_wrapper.go (about)

     1  // This file was generated by counterfeiter
     2  package ccv3fakes
     3  
     4  import (
     5  	"net/http"
     6  	"sync"
     7  
     8  	"code.cloudfoundry.org/cli/api/cloudcontroller"
     9  	"code.cloudfoundry.org/cli/api/cloudcontroller/ccv3"
    10  )
    11  
    12  type FakeConnectionWrapper struct {
    13  	MakeStub        func(request *http.Request, passedResponse *cloudcontroller.Response) error
    14  	makeMutex       sync.RWMutex
    15  	makeArgsForCall []struct {
    16  		request        *http.Request
    17  		passedResponse *cloudcontroller.Response
    18  	}
    19  	makeReturns struct {
    20  		result1 error
    21  	}
    22  	WrapStub        func(innerconnection cloudcontroller.Connection) cloudcontroller.Connection
    23  	wrapMutex       sync.RWMutex
    24  	wrapArgsForCall []struct {
    25  		innerconnection cloudcontroller.Connection
    26  	}
    27  	wrapReturns struct {
    28  		result1 cloudcontroller.Connection
    29  	}
    30  	invocations      map[string][][]interface{}
    31  	invocationsMutex sync.RWMutex
    32  }
    33  
    34  func (fake *FakeConnectionWrapper) Make(request *http.Request, passedResponse *cloudcontroller.Response) error {
    35  	fake.makeMutex.Lock()
    36  	fake.makeArgsForCall = append(fake.makeArgsForCall, struct {
    37  		request        *http.Request
    38  		passedResponse *cloudcontroller.Response
    39  	}{request, passedResponse})
    40  	fake.recordInvocation("Make", []interface{}{request, passedResponse})
    41  	fake.makeMutex.Unlock()
    42  	if fake.MakeStub != nil {
    43  		return fake.MakeStub(request, passedResponse)
    44  	} else {
    45  		return fake.makeReturns.result1
    46  	}
    47  }
    48  
    49  func (fake *FakeConnectionWrapper) MakeCallCount() int {
    50  	fake.makeMutex.RLock()
    51  	defer fake.makeMutex.RUnlock()
    52  	return len(fake.makeArgsForCall)
    53  }
    54  
    55  func (fake *FakeConnectionWrapper) MakeArgsForCall(i int) (*http.Request, *cloudcontroller.Response) {
    56  	fake.makeMutex.RLock()
    57  	defer fake.makeMutex.RUnlock()
    58  	return fake.makeArgsForCall[i].request, fake.makeArgsForCall[i].passedResponse
    59  }
    60  
    61  func (fake *FakeConnectionWrapper) MakeReturns(result1 error) {
    62  	fake.MakeStub = nil
    63  	fake.makeReturns = struct {
    64  		result1 error
    65  	}{result1}
    66  }
    67  
    68  func (fake *FakeConnectionWrapper) Wrap(innerconnection cloudcontroller.Connection) cloudcontroller.Connection {
    69  	fake.wrapMutex.Lock()
    70  	fake.wrapArgsForCall = append(fake.wrapArgsForCall, struct {
    71  		innerconnection cloudcontroller.Connection
    72  	}{innerconnection})
    73  	fake.recordInvocation("Wrap", []interface{}{innerconnection})
    74  	fake.wrapMutex.Unlock()
    75  	if fake.WrapStub != nil {
    76  		return fake.WrapStub(innerconnection)
    77  	} else {
    78  		return fake.wrapReturns.result1
    79  	}
    80  }
    81  
    82  func (fake *FakeConnectionWrapper) WrapCallCount() int {
    83  	fake.wrapMutex.RLock()
    84  	defer fake.wrapMutex.RUnlock()
    85  	return len(fake.wrapArgsForCall)
    86  }
    87  
    88  func (fake *FakeConnectionWrapper) WrapArgsForCall(i int) cloudcontroller.Connection {
    89  	fake.wrapMutex.RLock()
    90  	defer fake.wrapMutex.RUnlock()
    91  	return fake.wrapArgsForCall[i].innerconnection
    92  }
    93  
    94  func (fake *FakeConnectionWrapper) WrapReturns(result1 cloudcontroller.Connection) {
    95  	fake.WrapStub = nil
    96  	fake.wrapReturns = struct {
    97  		result1 cloudcontroller.Connection
    98  	}{result1}
    99  }
   100  
   101  func (fake *FakeConnectionWrapper) Invocations() map[string][][]interface{} {
   102  	fake.invocationsMutex.RLock()
   103  	defer fake.invocationsMutex.RUnlock()
   104  	fake.makeMutex.RLock()
   105  	defer fake.makeMutex.RUnlock()
   106  	fake.wrapMutex.RLock()
   107  	defer fake.wrapMutex.RUnlock()
   108  	return fake.invocations
   109  }
   110  
   111  func (fake *FakeConnectionWrapper) recordInvocation(key string, args []interface{}) {
   112  	fake.invocationsMutex.Lock()
   113  	defer fake.invocationsMutex.Unlock()
   114  	if fake.invocations == nil {
   115  		fake.invocations = map[string][][]interface{}{}
   116  	}
   117  	if fake.invocations[key] == nil {
   118  		fake.invocations[key] = [][]interface{}{}
   119  	}
   120  	fake.invocations[key] = append(fake.invocations[key], args)
   121  }
   122  
   123  var _ ccv3.ConnectionWrapper = new(FakeConnectionWrapper)