github.com/wanddynosios/cli/v8@v8.7.9-0.20240221182337-1a92e3a7017f/api/router/routerfakes/fake_connection_wrapper.go (about)

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