github.com/pf-qiu/concourse/v6@v6.7.3-0.20201207032516-1f455d73275f/atc/exec/execfakes/fake_get_delegate_factory.go (about)

     1  // Code generated by counterfeiter. DO NOT EDIT.
     2  package execfakes
     3  
     4  import (
     5  	"sync"
     6  
     7  	"github.com/pf-qiu/concourse/v6/atc/exec"
     8  )
     9  
    10  type FakeGetDelegateFactory struct {
    11  	GetDelegateStub        func(exec.RunState) exec.GetDelegate
    12  	getDelegateMutex       sync.RWMutex
    13  	getDelegateArgsForCall []struct {
    14  		arg1 exec.RunState
    15  	}
    16  	getDelegateReturns struct {
    17  		result1 exec.GetDelegate
    18  	}
    19  	getDelegateReturnsOnCall map[int]struct {
    20  		result1 exec.GetDelegate
    21  	}
    22  	invocations      map[string][][]interface{}
    23  	invocationsMutex sync.RWMutex
    24  }
    25  
    26  func (fake *FakeGetDelegateFactory) GetDelegate(arg1 exec.RunState) exec.GetDelegate {
    27  	fake.getDelegateMutex.Lock()
    28  	ret, specificReturn := fake.getDelegateReturnsOnCall[len(fake.getDelegateArgsForCall)]
    29  	fake.getDelegateArgsForCall = append(fake.getDelegateArgsForCall, struct {
    30  		arg1 exec.RunState
    31  	}{arg1})
    32  	fake.recordInvocation("GetDelegate", []interface{}{arg1})
    33  	fake.getDelegateMutex.Unlock()
    34  	if fake.GetDelegateStub != nil {
    35  		return fake.GetDelegateStub(arg1)
    36  	}
    37  	if specificReturn {
    38  		return ret.result1
    39  	}
    40  	fakeReturns := fake.getDelegateReturns
    41  	return fakeReturns.result1
    42  }
    43  
    44  func (fake *FakeGetDelegateFactory) GetDelegateCallCount() int {
    45  	fake.getDelegateMutex.RLock()
    46  	defer fake.getDelegateMutex.RUnlock()
    47  	return len(fake.getDelegateArgsForCall)
    48  }
    49  
    50  func (fake *FakeGetDelegateFactory) GetDelegateCalls(stub func(exec.RunState) exec.GetDelegate) {
    51  	fake.getDelegateMutex.Lock()
    52  	defer fake.getDelegateMutex.Unlock()
    53  	fake.GetDelegateStub = stub
    54  }
    55  
    56  func (fake *FakeGetDelegateFactory) GetDelegateArgsForCall(i int) exec.RunState {
    57  	fake.getDelegateMutex.RLock()
    58  	defer fake.getDelegateMutex.RUnlock()
    59  	argsForCall := fake.getDelegateArgsForCall[i]
    60  	return argsForCall.arg1
    61  }
    62  
    63  func (fake *FakeGetDelegateFactory) GetDelegateReturns(result1 exec.GetDelegate) {
    64  	fake.getDelegateMutex.Lock()
    65  	defer fake.getDelegateMutex.Unlock()
    66  	fake.GetDelegateStub = nil
    67  	fake.getDelegateReturns = struct {
    68  		result1 exec.GetDelegate
    69  	}{result1}
    70  }
    71  
    72  func (fake *FakeGetDelegateFactory) GetDelegateReturnsOnCall(i int, result1 exec.GetDelegate) {
    73  	fake.getDelegateMutex.Lock()
    74  	defer fake.getDelegateMutex.Unlock()
    75  	fake.GetDelegateStub = nil
    76  	if fake.getDelegateReturnsOnCall == nil {
    77  		fake.getDelegateReturnsOnCall = make(map[int]struct {
    78  			result1 exec.GetDelegate
    79  		})
    80  	}
    81  	fake.getDelegateReturnsOnCall[i] = struct {
    82  		result1 exec.GetDelegate
    83  	}{result1}
    84  }
    85  
    86  func (fake *FakeGetDelegateFactory) Invocations() map[string][][]interface{} {
    87  	fake.invocationsMutex.RLock()
    88  	defer fake.invocationsMutex.RUnlock()
    89  	fake.getDelegateMutex.RLock()
    90  	defer fake.getDelegateMutex.RUnlock()
    91  	copiedInvocations := map[string][][]interface{}{}
    92  	for key, value := range fake.invocations {
    93  		copiedInvocations[key] = value
    94  	}
    95  	return copiedInvocations
    96  }
    97  
    98  func (fake *FakeGetDelegateFactory) recordInvocation(key string, args []interface{}) {
    99  	fake.invocationsMutex.Lock()
   100  	defer fake.invocationsMutex.Unlock()
   101  	if fake.invocations == nil {
   102  		fake.invocations = map[string][][]interface{}{}
   103  	}
   104  	if fake.invocations[key] == nil {
   105  		fake.invocations[key] = [][]interface{}{}
   106  	}
   107  	fake.invocations[key] = append(fake.invocations[key], args)
   108  }
   109  
   110  var _ exec.GetDelegateFactory = new(FakeGetDelegateFactory)