github.com/wanddynosios/cli/v8@v8.7.9-0.20240221182337-1a92e3a7017f/api/cloudcontroller/ccv3/ccv3fakes/fake_connection_wrapper.go (about)

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