github.com/chenbh/concourse/v6@v6.4.2/atc/wrappa/wrappafakes/fake_concurrent_request_policy.go (about) 1 // Code generated by counterfeiter. DO NOT EDIT. 2 package wrappafakes 3 4 import ( 5 "sync" 6 7 "github.com/chenbh/concourse/v6/atc/wrappa" 8 ) 9 10 type FakeConcurrentRequestPolicy struct { 11 HandlerPoolStub func(string) (wrappa.Pool, bool) 12 handlerPoolMutex sync.RWMutex 13 handlerPoolArgsForCall []struct { 14 arg1 string 15 } 16 handlerPoolReturns struct { 17 result1 wrappa.Pool 18 result2 bool 19 } 20 handlerPoolReturnsOnCall map[int]struct { 21 result1 wrappa.Pool 22 result2 bool 23 } 24 invocations map[string][][]interface{} 25 invocationsMutex sync.RWMutex 26 } 27 28 func (fake *FakeConcurrentRequestPolicy) HandlerPool(arg1 string) (wrappa.Pool, bool) { 29 fake.handlerPoolMutex.Lock() 30 ret, specificReturn := fake.handlerPoolReturnsOnCall[len(fake.handlerPoolArgsForCall)] 31 fake.handlerPoolArgsForCall = append(fake.handlerPoolArgsForCall, struct { 32 arg1 string 33 }{arg1}) 34 fake.recordInvocation("HandlerPool", []interface{}{arg1}) 35 fake.handlerPoolMutex.Unlock() 36 if fake.HandlerPoolStub != nil { 37 return fake.HandlerPoolStub(arg1) 38 } 39 if specificReturn { 40 return ret.result1, ret.result2 41 } 42 fakeReturns := fake.handlerPoolReturns 43 return fakeReturns.result1, fakeReturns.result2 44 } 45 46 func (fake *FakeConcurrentRequestPolicy) HandlerPoolCallCount() int { 47 fake.handlerPoolMutex.RLock() 48 defer fake.handlerPoolMutex.RUnlock() 49 return len(fake.handlerPoolArgsForCall) 50 } 51 52 func (fake *FakeConcurrentRequestPolicy) HandlerPoolCalls(stub func(string) (wrappa.Pool, bool)) { 53 fake.handlerPoolMutex.Lock() 54 defer fake.handlerPoolMutex.Unlock() 55 fake.HandlerPoolStub = stub 56 } 57 58 func (fake *FakeConcurrentRequestPolicy) HandlerPoolArgsForCall(i int) string { 59 fake.handlerPoolMutex.RLock() 60 defer fake.handlerPoolMutex.RUnlock() 61 argsForCall := fake.handlerPoolArgsForCall[i] 62 return argsForCall.arg1 63 } 64 65 func (fake *FakeConcurrentRequestPolicy) HandlerPoolReturns(result1 wrappa.Pool, result2 bool) { 66 fake.handlerPoolMutex.Lock() 67 defer fake.handlerPoolMutex.Unlock() 68 fake.HandlerPoolStub = nil 69 fake.handlerPoolReturns = struct { 70 result1 wrappa.Pool 71 result2 bool 72 }{result1, result2} 73 } 74 75 func (fake *FakeConcurrentRequestPolicy) HandlerPoolReturnsOnCall(i int, result1 wrappa.Pool, result2 bool) { 76 fake.handlerPoolMutex.Lock() 77 defer fake.handlerPoolMutex.Unlock() 78 fake.HandlerPoolStub = nil 79 if fake.handlerPoolReturnsOnCall == nil { 80 fake.handlerPoolReturnsOnCall = make(map[int]struct { 81 result1 wrappa.Pool 82 result2 bool 83 }) 84 } 85 fake.handlerPoolReturnsOnCall[i] = struct { 86 result1 wrappa.Pool 87 result2 bool 88 }{result1, result2} 89 } 90 91 func (fake *FakeConcurrentRequestPolicy) Invocations() map[string][][]interface{} { 92 fake.invocationsMutex.RLock() 93 defer fake.invocationsMutex.RUnlock() 94 fake.handlerPoolMutex.RLock() 95 defer fake.handlerPoolMutex.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 *FakeConcurrentRequestPolicy) 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 _ wrappa.ConcurrentRequestPolicy = new(FakeConcurrentRequestPolicy)