github.com/pf-qiu/concourse/v6@v6.7.3-0.20201207032516-1f455d73275f/atc/engine/enginefakes/fake_runnable.go (about)

     1  // Code generated by counterfeiter. DO NOT EDIT.
     2  package enginefakes
     3  
     4  import (
     5  	"context"
     6  	"sync"
     7  
     8  	"github.com/pf-qiu/concourse/v6/atc/engine"
     9  )
    10  
    11  type FakeRunnable struct {
    12  	RunStub        func(context.Context)
    13  	runMutex       sync.RWMutex
    14  	runArgsForCall []struct {
    15  		arg1 context.Context
    16  	}
    17  	invocations      map[string][][]interface{}
    18  	invocationsMutex sync.RWMutex
    19  }
    20  
    21  func (fake *FakeRunnable) Run(arg1 context.Context) {
    22  	fake.runMutex.Lock()
    23  	fake.runArgsForCall = append(fake.runArgsForCall, struct {
    24  		arg1 context.Context
    25  	}{arg1})
    26  	fake.recordInvocation("Run", []interface{}{arg1})
    27  	fake.runMutex.Unlock()
    28  	if fake.RunStub != nil {
    29  		fake.RunStub(arg1)
    30  	}
    31  }
    32  
    33  func (fake *FakeRunnable) RunCallCount() int {
    34  	fake.runMutex.RLock()
    35  	defer fake.runMutex.RUnlock()
    36  	return len(fake.runArgsForCall)
    37  }
    38  
    39  func (fake *FakeRunnable) RunCalls(stub func(context.Context)) {
    40  	fake.runMutex.Lock()
    41  	defer fake.runMutex.Unlock()
    42  	fake.RunStub = stub
    43  }
    44  
    45  func (fake *FakeRunnable) RunArgsForCall(i int) context.Context {
    46  	fake.runMutex.RLock()
    47  	defer fake.runMutex.RUnlock()
    48  	argsForCall := fake.runArgsForCall[i]
    49  	return argsForCall.arg1
    50  }
    51  
    52  func (fake *FakeRunnable) Invocations() map[string][][]interface{} {
    53  	fake.invocationsMutex.RLock()
    54  	defer fake.invocationsMutex.RUnlock()
    55  	fake.runMutex.RLock()
    56  	defer fake.runMutex.RUnlock()
    57  	copiedInvocations := map[string][][]interface{}{}
    58  	for key, value := range fake.invocations {
    59  		copiedInvocations[key] = value
    60  	}
    61  	return copiedInvocations
    62  }
    63  
    64  func (fake *FakeRunnable) recordInvocation(key string, args []interface{}) {
    65  	fake.invocationsMutex.Lock()
    66  	defer fake.invocationsMutex.Unlock()
    67  	if fake.invocations == nil {
    68  		fake.invocations = map[string][][]interface{}{}
    69  	}
    70  	if fake.invocations[key] == nil {
    71  		fake.invocations[key] = [][]interface{}{}
    72  	}
    73  	fake.invocations[key] = append(fake.invocations[key], args)
    74  }
    75  
    76  var _ engine.Runnable = new(FakeRunnable)