github.com/pf-qiu/concourse/v6@v6.7.3-0.20201207032516-1f455d73275f/atc/db/dbfakes/fake_job_factory.go (about)

     1  // Code generated by counterfeiter. DO NOT EDIT.
     2  package dbfakes
     3  
     4  import (
     5  	"sync"
     6  
     7  	"github.com/pf-qiu/concourse/v6/atc"
     8  	"github.com/pf-qiu/concourse/v6/atc/db"
     9  )
    10  
    11  type FakeJobFactory struct {
    12  	AllActiveJobsStub        func() ([]atc.JobSummary, error)
    13  	allActiveJobsMutex       sync.RWMutex
    14  	allActiveJobsArgsForCall []struct {
    15  	}
    16  	allActiveJobsReturns struct {
    17  		result1 []atc.JobSummary
    18  		result2 error
    19  	}
    20  	allActiveJobsReturnsOnCall map[int]struct {
    21  		result1 []atc.JobSummary
    22  		result2 error
    23  	}
    24  	JobsToScheduleStub        func() (db.SchedulerJobs, error)
    25  	jobsToScheduleMutex       sync.RWMutex
    26  	jobsToScheduleArgsForCall []struct {
    27  	}
    28  	jobsToScheduleReturns struct {
    29  		result1 db.SchedulerJobs
    30  		result2 error
    31  	}
    32  	jobsToScheduleReturnsOnCall map[int]struct {
    33  		result1 db.SchedulerJobs
    34  		result2 error
    35  	}
    36  	VisibleJobsStub        func([]string) ([]atc.JobSummary, error)
    37  	visibleJobsMutex       sync.RWMutex
    38  	visibleJobsArgsForCall []struct {
    39  		arg1 []string
    40  	}
    41  	visibleJobsReturns struct {
    42  		result1 []atc.JobSummary
    43  		result2 error
    44  	}
    45  	visibleJobsReturnsOnCall map[int]struct {
    46  		result1 []atc.JobSummary
    47  		result2 error
    48  	}
    49  	invocations      map[string][][]interface{}
    50  	invocationsMutex sync.RWMutex
    51  }
    52  
    53  func (fake *FakeJobFactory) AllActiveJobs() ([]atc.JobSummary, error) {
    54  	fake.allActiveJobsMutex.Lock()
    55  	ret, specificReturn := fake.allActiveJobsReturnsOnCall[len(fake.allActiveJobsArgsForCall)]
    56  	fake.allActiveJobsArgsForCall = append(fake.allActiveJobsArgsForCall, struct {
    57  	}{})
    58  	fake.recordInvocation("AllActiveJobs", []interface{}{})
    59  	fake.allActiveJobsMutex.Unlock()
    60  	if fake.AllActiveJobsStub != nil {
    61  		return fake.AllActiveJobsStub()
    62  	}
    63  	if specificReturn {
    64  		return ret.result1, ret.result2
    65  	}
    66  	fakeReturns := fake.allActiveJobsReturns
    67  	return fakeReturns.result1, fakeReturns.result2
    68  }
    69  
    70  func (fake *FakeJobFactory) AllActiveJobsCallCount() int {
    71  	fake.allActiveJobsMutex.RLock()
    72  	defer fake.allActiveJobsMutex.RUnlock()
    73  	return len(fake.allActiveJobsArgsForCall)
    74  }
    75  
    76  func (fake *FakeJobFactory) AllActiveJobsCalls(stub func() ([]atc.JobSummary, error)) {
    77  	fake.allActiveJobsMutex.Lock()
    78  	defer fake.allActiveJobsMutex.Unlock()
    79  	fake.AllActiveJobsStub = stub
    80  }
    81  
    82  func (fake *FakeJobFactory) AllActiveJobsReturns(result1 []atc.JobSummary, result2 error) {
    83  	fake.allActiveJobsMutex.Lock()
    84  	defer fake.allActiveJobsMutex.Unlock()
    85  	fake.AllActiveJobsStub = nil
    86  	fake.allActiveJobsReturns = struct {
    87  		result1 []atc.JobSummary
    88  		result2 error
    89  	}{result1, result2}
    90  }
    91  
    92  func (fake *FakeJobFactory) AllActiveJobsReturnsOnCall(i int, result1 []atc.JobSummary, result2 error) {
    93  	fake.allActiveJobsMutex.Lock()
    94  	defer fake.allActiveJobsMutex.Unlock()
    95  	fake.AllActiveJobsStub = nil
    96  	if fake.allActiveJobsReturnsOnCall == nil {
    97  		fake.allActiveJobsReturnsOnCall = make(map[int]struct {
    98  			result1 []atc.JobSummary
    99  			result2 error
   100  		})
   101  	}
   102  	fake.allActiveJobsReturnsOnCall[i] = struct {
   103  		result1 []atc.JobSummary
   104  		result2 error
   105  	}{result1, result2}
   106  }
   107  
   108  func (fake *FakeJobFactory) JobsToSchedule() (db.SchedulerJobs, error) {
   109  	fake.jobsToScheduleMutex.Lock()
   110  	ret, specificReturn := fake.jobsToScheduleReturnsOnCall[len(fake.jobsToScheduleArgsForCall)]
   111  	fake.jobsToScheduleArgsForCall = append(fake.jobsToScheduleArgsForCall, struct {
   112  	}{})
   113  	fake.recordInvocation("JobsToSchedule", []interface{}{})
   114  	fake.jobsToScheduleMutex.Unlock()
   115  	if fake.JobsToScheduleStub != nil {
   116  		return fake.JobsToScheduleStub()
   117  	}
   118  	if specificReturn {
   119  		return ret.result1, ret.result2
   120  	}
   121  	fakeReturns := fake.jobsToScheduleReturns
   122  	return fakeReturns.result1, fakeReturns.result2
   123  }
   124  
   125  func (fake *FakeJobFactory) JobsToScheduleCallCount() int {
   126  	fake.jobsToScheduleMutex.RLock()
   127  	defer fake.jobsToScheduleMutex.RUnlock()
   128  	return len(fake.jobsToScheduleArgsForCall)
   129  }
   130  
   131  func (fake *FakeJobFactory) JobsToScheduleCalls(stub func() (db.SchedulerJobs, error)) {
   132  	fake.jobsToScheduleMutex.Lock()
   133  	defer fake.jobsToScheduleMutex.Unlock()
   134  	fake.JobsToScheduleStub = stub
   135  }
   136  
   137  func (fake *FakeJobFactory) JobsToScheduleReturns(result1 db.SchedulerJobs, result2 error) {
   138  	fake.jobsToScheduleMutex.Lock()
   139  	defer fake.jobsToScheduleMutex.Unlock()
   140  	fake.JobsToScheduleStub = nil
   141  	fake.jobsToScheduleReturns = struct {
   142  		result1 db.SchedulerJobs
   143  		result2 error
   144  	}{result1, result2}
   145  }
   146  
   147  func (fake *FakeJobFactory) JobsToScheduleReturnsOnCall(i int, result1 db.SchedulerJobs, result2 error) {
   148  	fake.jobsToScheduleMutex.Lock()
   149  	defer fake.jobsToScheduleMutex.Unlock()
   150  	fake.JobsToScheduleStub = nil
   151  	if fake.jobsToScheduleReturnsOnCall == nil {
   152  		fake.jobsToScheduleReturnsOnCall = make(map[int]struct {
   153  			result1 db.SchedulerJobs
   154  			result2 error
   155  		})
   156  	}
   157  	fake.jobsToScheduleReturnsOnCall[i] = struct {
   158  		result1 db.SchedulerJobs
   159  		result2 error
   160  	}{result1, result2}
   161  }
   162  
   163  func (fake *FakeJobFactory) VisibleJobs(arg1 []string) ([]atc.JobSummary, error) {
   164  	var arg1Copy []string
   165  	if arg1 != nil {
   166  		arg1Copy = make([]string, len(arg1))
   167  		copy(arg1Copy, arg1)
   168  	}
   169  	fake.visibleJobsMutex.Lock()
   170  	ret, specificReturn := fake.visibleJobsReturnsOnCall[len(fake.visibleJobsArgsForCall)]
   171  	fake.visibleJobsArgsForCall = append(fake.visibleJobsArgsForCall, struct {
   172  		arg1 []string
   173  	}{arg1Copy})
   174  	fake.recordInvocation("VisibleJobs", []interface{}{arg1Copy})
   175  	fake.visibleJobsMutex.Unlock()
   176  	if fake.VisibleJobsStub != nil {
   177  		return fake.VisibleJobsStub(arg1)
   178  	}
   179  	if specificReturn {
   180  		return ret.result1, ret.result2
   181  	}
   182  	fakeReturns := fake.visibleJobsReturns
   183  	return fakeReturns.result1, fakeReturns.result2
   184  }
   185  
   186  func (fake *FakeJobFactory) VisibleJobsCallCount() int {
   187  	fake.visibleJobsMutex.RLock()
   188  	defer fake.visibleJobsMutex.RUnlock()
   189  	return len(fake.visibleJobsArgsForCall)
   190  }
   191  
   192  func (fake *FakeJobFactory) VisibleJobsCalls(stub func([]string) ([]atc.JobSummary, error)) {
   193  	fake.visibleJobsMutex.Lock()
   194  	defer fake.visibleJobsMutex.Unlock()
   195  	fake.VisibleJobsStub = stub
   196  }
   197  
   198  func (fake *FakeJobFactory) VisibleJobsArgsForCall(i int) []string {
   199  	fake.visibleJobsMutex.RLock()
   200  	defer fake.visibleJobsMutex.RUnlock()
   201  	argsForCall := fake.visibleJobsArgsForCall[i]
   202  	return argsForCall.arg1
   203  }
   204  
   205  func (fake *FakeJobFactory) VisibleJobsReturns(result1 []atc.JobSummary, result2 error) {
   206  	fake.visibleJobsMutex.Lock()
   207  	defer fake.visibleJobsMutex.Unlock()
   208  	fake.VisibleJobsStub = nil
   209  	fake.visibleJobsReturns = struct {
   210  		result1 []atc.JobSummary
   211  		result2 error
   212  	}{result1, result2}
   213  }
   214  
   215  func (fake *FakeJobFactory) VisibleJobsReturnsOnCall(i int, result1 []atc.JobSummary, result2 error) {
   216  	fake.visibleJobsMutex.Lock()
   217  	defer fake.visibleJobsMutex.Unlock()
   218  	fake.VisibleJobsStub = nil
   219  	if fake.visibleJobsReturnsOnCall == nil {
   220  		fake.visibleJobsReturnsOnCall = make(map[int]struct {
   221  			result1 []atc.JobSummary
   222  			result2 error
   223  		})
   224  	}
   225  	fake.visibleJobsReturnsOnCall[i] = struct {
   226  		result1 []atc.JobSummary
   227  		result2 error
   228  	}{result1, result2}
   229  }
   230  
   231  func (fake *FakeJobFactory) Invocations() map[string][][]interface{} {
   232  	fake.invocationsMutex.RLock()
   233  	defer fake.invocationsMutex.RUnlock()
   234  	fake.allActiveJobsMutex.RLock()
   235  	defer fake.allActiveJobsMutex.RUnlock()
   236  	fake.jobsToScheduleMutex.RLock()
   237  	defer fake.jobsToScheduleMutex.RUnlock()
   238  	fake.visibleJobsMutex.RLock()
   239  	defer fake.visibleJobsMutex.RUnlock()
   240  	copiedInvocations := map[string][][]interface{}{}
   241  	for key, value := range fake.invocations {
   242  		copiedInvocations[key] = value
   243  	}
   244  	return copiedInvocations
   245  }
   246  
   247  func (fake *FakeJobFactory) recordInvocation(key string, args []interface{}) {
   248  	fake.invocationsMutex.Lock()
   249  	defer fake.invocationsMutex.Unlock()
   250  	if fake.invocations == nil {
   251  		fake.invocations = map[string][][]interface{}{}
   252  	}
   253  	if fake.invocations[key] == nil {
   254  		fake.invocations[key] = [][]interface{}{}
   255  	}
   256  	fake.invocations[key] = append(fake.invocations[key], args)
   257  }
   258  
   259  var _ db.JobFactory = new(FakeJobFactory)