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

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