github.com/chenbh/concourse/v6@v6.4.2/atc/resource/resourcefakes/fake_resource_factory.go (about)

     1  // Code generated by counterfeiter. DO NOT EDIT.
     2  package resourcefakes
     3  
     4  import (
     5  	"sync"
     6  
     7  	"github.com/chenbh/concourse/v6/atc"
     8  	"github.com/chenbh/concourse/v6/atc/resource"
     9  )
    10  
    11  type FakeResourceFactory struct {
    12  	NewResourceStub        func(atc.Source, atc.Params, atc.Version) resource.Resource
    13  	newResourceMutex       sync.RWMutex
    14  	newResourceArgsForCall []struct {
    15  		arg1 atc.Source
    16  		arg2 atc.Params
    17  		arg3 atc.Version
    18  	}
    19  	newResourceReturns struct {
    20  		result1 resource.Resource
    21  	}
    22  	newResourceReturnsOnCall map[int]struct {
    23  		result1 resource.Resource
    24  	}
    25  	invocations      map[string][][]interface{}
    26  	invocationsMutex sync.RWMutex
    27  }
    28  
    29  func (fake *FakeResourceFactory) NewResource(arg1 atc.Source, arg2 atc.Params, arg3 atc.Version) resource.Resource {
    30  	fake.newResourceMutex.Lock()
    31  	ret, specificReturn := fake.newResourceReturnsOnCall[len(fake.newResourceArgsForCall)]
    32  	fake.newResourceArgsForCall = append(fake.newResourceArgsForCall, struct {
    33  		arg1 atc.Source
    34  		arg2 atc.Params
    35  		arg3 atc.Version
    36  	}{arg1, arg2, arg3})
    37  	fake.recordInvocation("NewResource", []interface{}{arg1, arg2, arg3})
    38  	fake.newResourceMutex.Unlock()
    39  	if fake.NewResourceStub != nil {
    40  		return fake.NewResourceStub(arg1, arg2, arg3)
    41  	}
    42  	if specificReturn {
    43  		return ret.result1
    44  	}
    45  	fakeReturns := fake.newResourceReturns
    46  	return fakeReturns.result1
    47  }
    48  
    49  func (fake *FakeResourceFactory) NewResourceCallCount() int {
    50  	fake.newResourceMutex.RLock()
    51  	defer fake.newResourceMutex.RUnlock()
    52  	return len(fake.newResourceArgsForCall)
    53  }
    54  
    55  func (fake *FakeResourceFactory) NewResourceCalls(stub func(atc.Source, atc.Params, atc.Version) resource.Resource) {
    56  	fake.newResourceMutex.Lock()
    57  	defer fake.newResourceMutex.Unlock()
    58  	fake.NewResourceStub = stub
    59  }
    60  
    61  func (fake *FakeResourceFactory) NewResourceArgsForCall(i int) (atc.Source, atc.Params, atc.Version) {
    62  	fake.newResourceMutex.RLock()
    63  	defer fake.newResourceMutex.RUnlock()
    64  	argsForCall := fake.newResourceArgsForCall[i]
    65  	return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3
    66  }
    67  
    68  func (fake *FakeResourceFactory) NewResourceReturns(result1 resource.Resource) {
    69  	fake.newResourceMutex.Lock()
    70  	defer fake.newResourceMutex.Unlock()
    71  	fake.NewResourceStub = nil
    72  	fake.newResourceReturns = struct {
    73  		result1 resource.Resource
    74  	}{result1}
    75  }
    76  
    77  func (fake *FakeResourceFactory) NewResourceReturnsOnCall(i int, result1 resource.Resource) {
    78  	fake.newResourceMutex.Lock()
    79  	defer fake.newResourceMutex.Unlock()
    80  	fake.NewResourceStub = nil
    81  	if fake.newResourceReturnsOnCall == nil {
    82  		fake.newResourceReturnsOnCall = make(map[int]struct {
    83  			result1 resource.Resource
    84  		})
    85  	}
    86  	fake.newResourceReturnsOnCall[i] = struct {
    87  		result1 resource.Resource
    88  	}{result1}
    89  }
    90  
    91  func (fake *FakeResourceFactory) Invocations() map[string][][]interface{} {
    92  	fake.invocationsMutex.RLock()
    93  	defer fake.invocationsMutex.RUnlock()
    94  	fake.newResourceMutex.RLock()
    95  	defer fake.newResourceMutex.RUnlock()
    96  	copiedInvocations := map[string][][]interface{}{}
    97  	for key, value := range fake.invocations {
    98  		copiedInvocations[key] = value
    99  	}
   100  	return copiedInvocations
   101  }
   102  
   103  func (fake *FakeResourceFactory) recordInvocation(key string, args []interface{}) {
   104  	fake.invocationsMutex.Lock()
   105  	defer fake.invocationsMutex.Unlock()
   106  	if fake.invocations == nil {
   107  		fake.invocations = map[string][][]interface{}{}
   108  	}
   109  	if fake.invocations[key] == nil {
   110  		fake.invocations[key] = [][]interface{}{}
   111  	}
   112  	fake.invocations[key] = append(fake.invocations[key], args)
   113  }
   114  
   115  var _ resource.ResourceFactory = new(FakeResourceFactory)