github.com/loafoe/cli@v7.1.0+incompatible/actor/sharedaction/sharedactionfakes/fake_log_cache_client.go (about) 1 // Code generated by counterfeiter. DO NOT EDIT. 2 package sharedactionfakes 3 4 import ( 5 "context" 6 "sync" 7 "time" 8 9 "code.cloudfoundry.org/cli/actor/sharedaction" 10 client "code.cloudfoundry.org/go-log-cache" 11 "code.cloudfoundry.org/go-loggregator/rpc/loggregator_v2" 12 ) 13 14 type FakeLogCacheClient struct { 15 ReadStub func(context.Context, string, time.Time, ...client.ReadOption) ([]*loggregator_v2.Envelope, error) 16 readMutex sync.RWMutex 17 readArgsForCall []struct { 18 arg1 context.Context 19 arg2 string 20 arg3 time.Time 21 arg4 []client.ReadOption 22 } 23 readReturns struct { 24 result1 []*loggregator_v2.Envelope 25 result2 error 26 } 27 readReturnsOnCall map[int]struct { 28 result1 []*loggregator_v2.Envelope 29 result2 error 30 } 31 invocations map[string][][]interface{} 32 invocationsMutex sync.RWMutex 33 } 34 35 func (fake *FakeLogCacheClient) Read(arg1 context.Context, arg2 string, arg3 time.Time, arg4 ...client.ReadOption) ([]*loggregator_v2.Envelope, error) { 36 fake.readMutex.Lock() 37 ret, specificReturn := fake.readReturnsOnCall[len(fake.readArgsForCall)] 38 fake.readArgsForCall = append(fake.readArgsForCall, struct { 39 arg1 context.Context 40 arg2 string 41 arg3 time.Time 42 arg4 []client.ReadOption 43 }{arg1, arg2, arg3, arg4}) 44 fake.recordInvocation("Read", []interface{}{arg1, arg2, arg3, arg4}) 45 fake.readMutex.Unlock() 46 if fake.ReadStub != nil { 47 return fake.ReadStub(arg1, arg2, arg3, arg4...) 48 } 49 if specificReturn { 50 return ret.result1, ret.result2 51 } 52 fakeReturns := fake.readReturns 53 return fakeReturns.result1, fakeReturns.result2 54 } 55 56 func (fake *FakeLogCacheClient) ReadCallCount() int { 57 fake.readMutex.RLock() 58 defer fake.readMutex.RUnlock() 59 return len(fake.readArgsForCall) 60 } 61 62 func (fake *FakeLogCacheClient) ReadCalls(stub func(context.Context, string, time.Time, ...client.ReadOption) ([]*loggregator_v2.Envelope, error)) { 63 fake.readMutex.Lock() 64 defer fake.readMutex.Unlock() 65 fake.ReadStub = stub 66 } 67 68 func (fake *FakeLogCacheClient) ReadArgsForCall(i int) (context.Context, string, time.Time, []client.ReadOption) { 69 fake.readMutex.RLock() 70 defer fake.readMutex.RUnlock() 71 argsForCall := fake.readArgsForCall[i] 72 return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3, argsForCall.arg4 73 } 74 75 func (fake *FakeLogCacheClient) ReadReturns(result1 []*loggregator_v2.Envelope, result2 error) { 76 fake.readMutex.Lock() 77 defer fake.readMutex.Unlock() 78 fake.ReadStub = nil 79 fake.readReturns = struct { 80 result1 []*loggregator_v2.Envelope 81 result2 error 82 }{result1, result2} 83 } 84 85 func (fake *FakeLogCacheClient) ReadReturnsOnCall(i int, result1 []*loggregator_v2.Envelope, result2 error) { 86 fake.readMutex.Lock() 87 defer fake.readMutex.Unlock() 88 fake.ReadStub = nil 89 if fake.readReturnsOnCall == nil { 90 fake.readReturnsOnCall = make(map[int]struct { 91 result1 []*loggregator_v2.Envelope 92 result2 error 93 }) 94 } 95 fake.readReturnsOnCall[i] = struct { 96 result1 []*loggregator_v2.Envelope 97 result2 error 98 }{result1, result2} 99 } 100 101 func (fake *FakeLogCacheClient) Invocations() map[string][][]interface{} { 102 fake.invocationsMutex.RLock() 103 defer fake.invocationsMutex.RUnlock() 104 fake.readMutex.RLock() 105 defer fake.readMutex.RUnlock() 106 copiedInvocations := map[string][][]interface{}{} 107 for key, value := range fake.invocations { 108 copiedInvocations[key] = value 109 } 110 return copiedInvocations 111 } 112 113 func (fake *FakeLogCacheClient) recordInvocation(key string, args []interface{}) { 114 fake.invocationsMutex.Lock() 115 defer fake.invocationsMutex.Unlock() 116 if fake.invocations == nil { 117 fake.invocations = map[string][][]interface{}{} 118 } 119 if fake.invocations[key] == nil { 120 fake.invocations[key] = [][]interface{}{} 121 } 122 fake.invocations[key] = append(fake.invocations[key], args) 123 } 124 125 var _ sharedaction.LogCacheClient = new(FakeLogCacheClient)