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

     1  // Code generated by counterfeiter. DO NOT EDIT.
     2  package dbfakes
     3  
     4  import (
     5  	"sync"
     6  	"time"
     7  
     8  	"github.com/pf-qiu/concourse/v6/atc/db"
     9  )
    10  
    11  type FakeClock struct {
    12  	NowStub        func() time.Time
    13  	nowMutex       sync.RWMutex
    14  	nowArgsForCall []struct {
    15  	}
    16  	nowReturns struct {
    17  		result1 time.Time
    18  	}
    19  	nowReturnsOnCall map[int]struct {
    20  		result1 time.Time
    21  	}
    22  	UntilStub        func(time.Time) time.Duration
    23  	untilMutex       sync.RWMutex
    24  	untilArgsForCall []struct {
    25  		arg1 time.Time
    26  	}
    27  	untilReturns struct {
    28  		result1 time.Duration
    29  	}
    30  	untilReturnsOnCall map[int]struct {
    31  		result1 time.Duration
    32  	}
    33  	invocations      map[string][][]interface{}
    34  	invocationsMutex sync.RWMutex
    35  }
    36  
    37  func (fake *FakeClock) Now() time.Time {
    38  	fake.nowMutex.Lock()
    39  	ret, specificReturn := fake.nowReturnsOnCall[len(fake.nowArgsForCall)]
    40  	fake.nowArgsForCall = append(fake.nowArgsForCall, struct {
    41  	}{})
    42  	fake.recordInvocation("Now", []interface{}{})
    43  	fake.nowMutex.Unlock()
    44  	if fake.NowStub != nil {
    45  		return fake.NowStub()
    46  	}
    47  	if specificReturn {
    48  		return ret.result1
    49  	}
    50  	fakeReturns := fake.nowReturns
    51  	return fakeReturns.result1
    52  }
    53  
    54  func (fake *FakeClock) NowCallCount() int {
    55  	fake.nowMutex.RLock()
    56  	defer fake.nowMutex.RUnlock()
    57  	return len(fake.nowArgsForCall)
    58  }
    59  
    60  func (fake *FakeClock) NowCalls(stub func() time.Time) {
    61  	fake.nowMutex.Lock()
    62  	defer fake.nowMutex.Unlock()
    63  	fake.NowStub = stub
    64  }
    65  
    66  func (fake *FakeClock) NowReturns(result1 time.Time) {
    67  	fake.nowMutex.Lock()
    68  	defer fake.nowMutex.Unlock()
    69  	fake.NowStub = nil
    70  	fake.nowReturns = struct {
    71  		result1 time.Time
    72  	}{result1}
    73  }
    74  
    75  func (fake *FakeClock) NowReturnsOnCall(i int, result1 time.Time) {
    76  	fake.nowMutex.Lock()
    77  	defer fake.nowMutex.Unlock()
    78  	fake.NowStub = nil
    79  	if fake.nowReturnsOnCall == nil {
    80  		fake.nowReturnsOnCall = make(map[int]struct {
    81  			result1 time.Time
    82  		})
    83  	}
    84  	fake.nowReturnsOnCall[i] = struct {
    85  		result1 time.Time
    86  	}{result1}
    87  }
    88  
    89  func (fake *FakeClock) Until(arg1 time.Time) time.Duration {
    90  	fake.untilMutex.Lock()
    91  	ret, specificReturn := fake.untilReturnsOnCall[len(fake.untilArgsForCall)]
    92  	fake.untilArgsForCall = append(fake.untilArgsForCall, struct {
    93  		arg1 time.Time
    94  	}{arg1})
    95  	fake.recordInvocation("Until", []interface{}{arg1})
    96  	fake.untilMutex.Unlock()
    97  	if fake.UntilStub != nil {
    98  		return fake.UntilStub(arg1)
    99  	}
   100  	if specificReturn {
   101  		return ret.result1
   102  	}
   103  	fakeReturns := fake.untilReturns
   104  	return fakeReturns.result1
   105  }
   106  
   107  func (fake *FakeClock) UntilCallCount() int {
   108  	fake.untilMutex.RLock()
   109  	defer fake.untilMutex.RUnlock()
   110  	return len(fake.untilArgsForCall)
   111  }
   112  
   113  func (fake *FakeClock) UntilCalls(stub func(time.Time) time.Duration) {
   114  	fake.untilMutex.Lock()
   115  	defer fake.untilMutex.Unlock()
   116  	fake.UntilStub = stub
   117  }
   118  
   119  func (fake *FakeClock) UntilArgsForCall(i int) time.Time {
   120  	fake.untilMutex.RLock()
   121  	defer fake.untilMutex.RUnlock()
   122  	argsForCall := fake.untilArgsForCall[i]
   123  	return argsForCall.arg1
   124  }
   125  
   126  func (fake *FakeClock) UntilReturns(result1 time.Duration) {
   127  	fake.untilMutex.Lock()
   128  	defer fake.untilMutex.Unlock()
   129  	fake.UntilStub = nil
   130  	fake.untilReturns = struct {
   131  		result1 time.Duration
   132  	}{result1}
   133  }
   134  
   135  func (fake *FakeClock) UntilReturnsOnCall(i int, result1 time.Duration) {
   136  	fake.untilMutex.Lock()
   137  	defer fake.untilMutex.Unlock()
   138  	fake.UntilStub = nil
   139  	if fake.untilReturnsOnCall == nil {
   140  		fake.untilReturnsOnCall = make(map[int]struct {
   141  			result1 time.Duration
   142  		})
   143  	}
   144  	fake.untilReturnsOnCall[i] = struct {
   145  		result1 time.Duration
   146  	}{result1}
   147  }
   148  
   149  func (fake *FakeClock) Invocations() map[string][][]interface{} {
   150  	fake.invocationsMutex.RLock()
   151  	defer fake.invocationsMutex.RUnlock()
   152  	fake.nowMutex.RLock()
   153  	defer fake.nowMutex.RUnlock()
   154  	fake.untilMutex.RLock()
   155  	defer fake.untilMutex.RUnlock()
   156  	copiedInvocations := map[string][][]interface{}{}
   157  	for key, value := range fake.invocations {
   158  		copiedInvocations[key] = value
   159  	}
   160  	return copiedInvocations
   161  }
   162  
   163  func (fake *FakeClock) recordInvocation(key string, args []interface{}) {
   164  	fake.invocationsMutex.Lock()
   165  	defer fake.invocationsMutex.Unlock()
   166  	if fake.invocations == nil {
   167  		fake.invocations = map[string][][]interface{}{}
   168  	}
   169  	if fake.invocations[key] == nil {
   170  		fake.invocations[key] = [][]interface{}{}
   171  	}
   172  	fake.invocations[key] = append(fake.invocations[key], args)
   173  }
   174  
   175  var _ db.Clock = new(FakeClock)