github.com/loggregator/cli@v6.33.1-0.20180224010324-82334f081791+incompatible/api/cloudcontroller/ccv2/ccv2fakes/fake_connection_wrapper.go (about)

     1  // Code generated by counterfeiter. DO NOT EDIT.
     2  package ccv2fakes
     3  
     4  import (
     5  	"sync"
     6  
     7  	"code.cloudfoundry.org/cli/api/cloudcontroller"
     8  	"code.cloudfoundry.org/cli/api/cloudcontroller/ccv2"
     9  )
    10  
    11  type FakeConnectionWrapper struct {
    12  	MakeStub        func(request *cloudcontroller.Request, passedResponse *cloudcontroller.Response) error
    13  	makeMutex       sync.RWMutex
    14  	makeArgsForCall []struct {
    15  		request        *cloudcontroller.Request
    16  		passedResponse *cloudcontroller.Response
    17  	}
    18  	makeReturns struct {
    19  		result1 error
    20  	}
    21  	makeReturnsOnCall map[int]struct {
    22  		result1 error
    23  	}
    24  	WrapStub        func(innerconnection cloudcontroller.Connection) cloudcontroller.Connection
    25  	wrapMutex       sync.RWMutex
    26  	wrapArgsForCall []struct {
    27  		innerconnection cloudcontroller.Connection
    28  	}
    29  	wrapReturns struct {
    30  		result1 cloudcontroller.Connection
    31  	}
    32  	wrapReturnsOnCall map[int]struct {
    33  		result1 cloudcontroller.Connection
    34  	}
    35  	invocations      map[string][][]interface{}
    36  	invocationsMutex sync.RWMutex
    37  }
    38  
    39  func (fake *FakeConnectionWrapper) Make(request *cloudcontroller.Request, passedResponse *cloudcontroller.Response) error {
    40  	fake.makeMutex.Lock()
    41  	ret, specificReturn := fake.makeReturnsOnCall[len(fake.makeArgsForCall)]
    42  	fake.makeArgsForCall = append(fake.makeArgsForCall, struct {
    43  		request        *cloudcontroller.Request
    44  		passedResponse *cloudcontroller.Response
    45  	}{request, passedResponse})
    46  	fake.recordInvocation("Make", []interface{}{request, passedResponse})
    47  	fake.makeMutex.Unlock()
    48  	if fake.MakeStub != nil {
    49  		return fake.MakeStub(request, passedResponse)
    50  	}
    51  	if specificReturn {
    52  		return ret.result1
    53  	}
    54  	return fake.makeReturns.result1
    55  }
    56  
    57  func (fake *FakeConnectionWrapper) MakeCallCount() int {
    58  	fake.makeMutex.RLock()
    59  	defer fake.makeMutex.RUnlock()
    60  	return len(fake.makeArgsForCall)
    61  }
    62  
    63  func (fake *FakeConnectionWrapper) MakeArgsForCall(i int) (*cloudcontroller.Request, *cloudcontroller.Response) {
    64  	fake.makeMutex.RLock()
    65  	defer fake.makeMutex.RUnlock()
    66  	return fake.makeArgsForCall[i].request, fake.makeArgsForCall[i].passedResponse
    67  }
    68  
    69  func (fake *FakeConnectionWrapper) MakeReturns(result1 error) {
    70  	fake.MakeStub = nil
    71  	fake.makeReturns = struct {
    72  		result1 error
    73  	}{result1}
    74  }
    75  
    76  func (fake *FakeConnectionWrapper) MakeReturnsOnCall(i int, result1 error) {
    77  	fake.MakeStub = nil
    78  	if fake.makeReturnsOnCall == nil {
    79  		fake.makeReturnsOnCall = make(map[int]struct {
    80  			result1 error
    81  		})
    82  	}
    83  	fake.makeReturnsOnCall[i] = struct {
    84  		result1 error
    85  	}{result1}
    86  }
    87  
    88  func (fake *FakeConnectionWrapper) Wrap(innerconnection cloudcontroller.Connection) cloudcontroller.Connection {
    89  	fake.wrapMutex.Lock()
    90  	ret, specificReturn := fake.wrapReturnsOnCall[len(fake.wrapArgsForCall)]
    91  	fake.wrapArgsForCall = append(fake.wrapArgsForCall, struct {
    92  		innerconnection cloudcontroller.Connection
    93  	}{innerconnection})
    94  	fake.recordInvocation("Wrap", []interface{}{innerconnection})
    95  	fake.wrapMutex.Unlock()
    96  	if fake.WrapStub != nil {
    97  		return fake.WrapStub(innerconnection)
    98  	}
    99  	if specificReturn {
   100  		return ret.result1
   101  	}
   102  	return fake.wrapReturns.result1
   103  }
   104  
   105  func (fake *FakeConnectionWrapper) WrapCallCount() int {
   106  	fake.wrapMutex.RLock()
   107  	defer fake.wrapMutex.RUnlock()
   108  	return len(fake.wrapArgsForCall)
   109  }
   110  
   111  func (fake *FakeConnectionWrapper) WrapArgsForCall(i int) cloudcontroller.Connection {
   112  	fake.wrapMutex.RLock()
   113  	defer fake.wrapMutex.RUnlock()
   114  	return fake.wrapArgsForCall[i].innerconnection
   115  }
   116  
   117  func (fake *FakeConnectionWrapper) WrapReturns(result1 cloudcontroller.Connection) {
   118  	fake.WrapStub = nil
   119  	fake.wrapReturns = struct {
   120  		result1 cloudcontroller.Connection
   121  	}{result1}
   122  }
   123  
   124  func (fake *FakeConnectionWrapper) WrapReturnsOnCall(i int, result1 cloudcontroller.Connection) {
   125  	fake.WrapStub = nil
   126  	if fake.wrapReturnsOnCall == nil {
   127  		fake.wrapReturnsOnCall = make(map[int]struct {
   128  			result1 cloudcontroller.Connection
   129  		})
   130  	}
   131  	fake.wrapReturnsOnCall[i] = struct {
   132  		result1 cloudcontroller.Connection
   133  	}{result1}
   134  }
   135  
   136  func (fake *FakeConnectionWrapper) Invocations() map[string][][]interface{} {
   137  	fake.invocationsMutex.RLock()
   138  	defer fake.invocationsMutex.RUnlock()
   139  	fake.makeMutex.RLock()
   140  	defer fake.makeMutex.RUnlock()
   141  	fake.wrapMutex.RLock()
   142  	defer fake.wrapMutex.RUnlock()
   143  	copiedInvocations := map[string][][]interface{}{}
   144  	for key, value := range fake.invocations {
   145  		copiedInvocations[key] = value
   146  	}
   147  	return copiedInvocations
   148  }
   149  
   150  func (fake *FakeConnectionWrapper) recordInvocation(key string, args []interface{}) {
   151  	fake.invocationsMutex.Lock()
   152  	defer fake.invocationsMutex.Unlock()
   153  	if fake.invocations == nil {
   154  		fake.invocations = map[string][][]interface{}{}
   155  	}
   156  	if fake.invocations[key] == nil {
   157  		fake.invocations[key] = [][]interface{}{}
   158  	}
   159  	fake.invocations[key] = append(fake.invocations[key], args)
   160  }
   161  
   162  var _ ccv2.ConnectionWrapper = new(FakeConnectionWrapper)