github.com/pf-qiu/concourse/v6@v6.7.3-0.20201207032516-1f455d73275f/tsa/tsafakes/fake_endpoint_picker.go (about)

     1  // Code generated by counterfeiter. DO NOT EDIT.
     2  package tsafakes
     3  
     4  import (
     5  	"sync"
     6  
     7  	"github.com/pf-qiu/concourse/v6/tsa"
     8  	"github.com/tedsuo/rata"
     9  )
    10  
    11  type FakeEndpointPicker struct {
    12  	PickStub        func() *rata.RequestGenerator
    13  	pickMutex       sync.RWMutex
    14  	pickArgsForCall []struct {
    15  	}
    16  	pickReturns struct {
    17  		result1 *rata.RequestGenerator
    18  	}
    19  	pickReturnsOnCall map[int]struct {
    20  		result1 *rata.RequestGenerator
    21  	}
    22  	invocations      map[string][][]interface{}
    23  	invocationsMutex sync.RWMutex
    24  }
    25  
    26  func (fake *FakeEndpointPicker) Pick() *rata.RequestGenerator {
    27  	fake.pickMutex.Lock()
    28  	ret, specificReturn := fake.pickReturnsOnCall[len(fake.pickArgsForCall)]
    29  	fake.pickArgsForCall = append(fake.pickArgsForCall, struct {
    30  	}{})
    31  	fake.recordInvocation("Pick", []interface{}{})
    32  	fake.pickMutex.Unlock()
    33  	if fake.PickStub != nil {
    34  		return fake.PickStub()
    35  	}
    36  	if specificReturn {
    37  		return ret.result1
    38  	}
    39  	fakeReturns := fake.pickReturns
    40  	return fakeReturns.result1
    41  }
    42  
    43  func (fake *FakeEndpointPicker) PickCallCount() int {
    44  	fake.pickMutex.RLock()
    45  	defer fake.pickMutex.RUnlock()
    46  	return len(fake.pickArgsForCall)
    47  }
    48  
    49  func (fake *FakeEndpointPicker) PickCalls(stub func() *rata.RequestGenerator) {
    50  	fake.pickMutex.Lock()
    51  	defer fake.pickMutex.Unlock()
    52  	fake.PickStub = stub
    53  }
    54  
    55  func (fake *FakeEndpointPicker) PickReturns(result1 *rata.RequestGenerator) {
    56  	fake.pickMutex.Lock()
    57  	defer fake.pickMutex.Unlock()
    58  	fake.PickStub = nil
    59  	fake.pickReturns = struct {
    60  		result1 *rata.RequestGenerator
    61  	}{result1}
    62  }
    63  
    64  func (fake *FakeEndpointPicker) PickReturnsOnCall(i int, result1 *rata.RequestGenerator) {
    65  	fake.pickMutex.Lock()
    66  	defer fake.pickMutex.Unlock()
    67  	fake.PickStub = nil
    68  	if fake.pickReturnsOnCall == nil {
    69  		fake.pickReturnsOnCall = make(map[int]struct {
    70  			result1 *rata.RequestGenerator
    71  		})
    72  	}
    73  	fake.pickReturnsOnCall[i] = struct {
    74  		result1 *rata.RequestGenerator
    75  	}{result1}
    76  }
    77  
    78  func (fake *FakeEndpointPicker) Invocations() map[string][][]interface{} {
    79  	fake.invocationsMutex.RLock()
    80  	defer fake.invocationsMutex.RUnlock()
    81  	fake.pickMutex.RLock()
    82  	defer fake.pickMutex.RUnlock()
    83  	copiedInvocations := map[string][][]interface{}{}
    84  	for key, value := range fake.invocations {
    85  		copiedInvocations[key] = value
    86  	}
    87  	return copiedInvocations
    88  }
    89  
    90  func (fake *FakeEndpointPicker) recordInvocation(key string, args []interface{}) {
    91  	fake.invocationsMutex.Lock()
    92  	defer fake.invocationsMutex.Unlock()
    93  	if fake.invocations == nil {
    94  		fake.invocations = map[string][][]interface{}{}
    95  	}
    96  	if fake.invocations[key] == nil {
    97  		fake.invocations[key] = [][]interface{}{}
    98  	}
    99  	fake.invocations[key] = append(fake.invocations[key], args)
   100  }
   101  
   102  var _ tsa.EndpointPicker = new(FakeEndpointPicker)