github.com/swisscom/cloudfoundry-cli@v7.1.0+incompatible/cf/api/logs/logsfakes/fake_repository.go (about) 1 // Code generated by counterfeiter. DO NOT EDIT. 2 package logsfakes 3 4 import ( 5 "sync" 6 7 "code.cloudfoundry.org/cli/cf/api/logs" 8 ) 9 10 type FakeRepository struct { 11 CloseStub func() 12 closeMutex sync.RWMutex 13 closeArgsForCall []struct { 14 } 15 RecentLogsForStub func(string) ([]logs.Loggable, error) 16 recentLogsForMutex sync.RWMutex 17 recentLogsForArgsForCall []struct { 18 arg1 string 19 } 20 recentLogsForReturns struct { 21 result1 []logs.Loggable 22 result2 error 23 } 24 recentLogsForReturnsOnCall map[int]struct { 25 result1 []logs.Loggable 26 result2 error 27 } 28 TailLogsForStub func(string, func(), chan<- logs.Loggable, chan<- error) 29 tailLogsForMutex sync.RWMutex 30 tailLogsForArgsForCall []struct { 31 arg1 string 32 arg2 func() 33 arg3 chan<- logs.Loggable 34 arg4 chan<- error 35 } 36 invocations map[string][][]interface{} 37 invocationsMutex sync.RWMutex 38 } 39 40 func (fake *FakeRepository) Close() { 41 fake.closeMutex.Lock() 42 fake.closeArgsForCall = append(fake.closeArgsForCall, struct { 43 }{}) 44 fake.recordInvocation("Close", []interface{}{}) 45 fake.closeMutex.Unlock() 46 if fake.CloseStub != nil { 47 fake.CloseStub() 48 } 49 } 50 51 func (fake *FakeRepository) CloseCallCount() int { 52 fake.closeMutex.RLock() 53 defer fake.closeMutex.RUnlock() 54 return len(fake.closeArgsForCall) 55 } 56 57 func (fake *FakeRepository) CloseCalls(stub func()) { 58 fake.closeMutex.Lock() 59 defer fake.closeMutex.Unlock() 60 fake.CloseStub = stub 61 } 62 63 func (fake *FakeRepository) RecentLogsFor(arg1 string) ([]logs.Loggable, error) { 64 fake.recentLogsForMutex.Lock() 65 ret, specificReturn := fake.recentLogsForReturnsOnCall[len(fake.recentLogsForArgsForCall)] 66 fake.recentLogsForArgsForCall = append(fake.recentLogsForArgsForCall, struct { 67 arg1 string 68 }{arg1}) 69 fake.recordInvocation("RecentLogsFor", []interface{}{arg1}) 70 fake.recentLogsForMutex.Unlock() 71 if fake.RecentLogsForStub != nil { 72 return fake.RecentLogsForStub(arg1) 73 } 74 if specificReturn { 75 return ret.result1, ret.result2 76 } 77 fakeReturns := fake.recentLogsForReturns 78 return fakeReturns.result1, fakeReturns.result2 79 } 80 81 func (fake *FakeRepository) RecentLogsForCallCount() int { 82 fake.recentLogsForMutex.RLock() 83 defer fake.recentLogsForMutex.RUnlock() 84 return len(fake.recentLogsForArgsForCall) 85 } 86 87 func (fake *FakeRepository) RecentLogsForCalls(stub func(string) ([]logs.Loggable, error)) { 88 fake.recentLogsForMutex.Lock() 89 defer fake.recentLogsForMutex.Unlock() 90 fake.RecentLogsForStub = stub 91 } 92 93 func (fake *FakeRepository) RecentLogsForArgsForCall(i int) string { 94 fake.recentLogsForMutex.RLock() 95 defer fake.recentLogsForMutex.RUnlock() 96 argsForCall := fake.recentLogsForArgsForCall[i] 97 return argsForCall.arg1 98 } 99 100 func (fake *FakeRepository) RecentLogsForReturns(result1 []logs.Loggable, result2 error) { 101 fake.recentLogsForMutex.Lock() 102 defer fake.recentLogsForMutex.Unlock() 103 fake.RecentLogsForStub = nil 104 fake.recentLogsForReturns = struct { 105 result1 []logs.Loggable 106 result2 error 107 }{result1, result2} 108 } 109 110 func (fake *FakeRepository) RecentLogsForReturnsOnCall(i int, result1 []logs.Loggable, result2 error) { 111 fake.recentLogsForMutex.Lock() 112 defer fake.recentLogsForMutex.Unlock() 113 fake.RecentLogsForStub = nil 114 if fake.recentLogsForReturnsOnCall == nil { 115 fake.recentLogsForReturnsOnCall = make(map[int]struct { 116 result1 []logs.Loggable 117 result2 error 118 }) 119 } 120 fake.recentLogsForReturnsOnCall[i] = struct { 121 result1 []logs.Loggable 122 result2 error 123 }{result1, result2} 124 } 125 126 func (fake *FakeRepository) TailLogsFor(arg1 string, arg2 func(), arg3 chan<- logs.Loggable, arg4 chan<- error) { 127 fake.tailLogsForMutex.Lock() 128 fake.tailLogsForArgsForCall = append(fake.tailLogsForArgsForCall, struct { 129 arg1 string 130 arg2 func() 131 arg3 chan<- logs.Loggable 132 arg4 chan<- error 133 }{arg1, arg2, arg3, arg4}) 134 fake.recordInvocation("TailLogsFor", []interface{}{arg1, arg2, arg3, arg4}) 135 fake.tailLogsForMutex.Unlock() 136 if fake.TailLogsForStub != nil { 137 fake.TailLogsForStub(arg1, arg2, arg3, arg4) 138 } 139 } 140 141 func (fake *FakeRepository) TailLogsForCallCount() int { 142 fake.tailLogsForMutex.RLock() 143 defer fake.tailLogsForMutex.RUnlock() 144 return len(fake.tailLogsForArgsForCall) 145 } 146 147 func (fake *FakeRepository) TailLogsForCalls(stub func(string, func(), chan<- logs.Loggable, chan<- error)) { 148 fake.tailLogsForMutex.Lock() 149 defer fake.tailLogsForMutex.Unlock() 150 fake.TailLogsForStub = stub 151 } 152 153 func (fake *FakeRepository) TailLogsForArgsForCall(i int) (string, func(), chan<- logs.Loggable, chan<- error) { 154 fake.tailLogsForMutex.RLock() 155 defer fake.tailLogsForMutex.RUnlock() 156 argsForCall := fake.tailLogsForArgsForCall[i] 157 return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3, argsForCall.arg4 158 } 159 160 func (fake *FakeRepository) Invocations() map[string][][]interface{} { 161 fake.invocationsMutex.RLock() 162 defer fake.invocationsMutex.RUnlock() 163 fake.closeMutex.RLock() 164 defer fake.closeMutex.RUnlock() 165 fake.recentLogsForMutex.RLock() 166 defer fake.recentLogsForMutex.RUnlock() 167 fake.tailLogsForMutex.RLock() 168 defer fake.tailLogsForMutex.RUnlock() 169 copiedInvocations := map[string][][]interface{}{} 170 for key, value := range fake.invocations { 171 copiedInvocations[key] = value 172 } 173 return copiedInvocations 174 } 175 176 func (fake *FakeRepository) recordInvocation(key string, args []interface{}) { 177 fake.invocationsMutex.Lock() 178 defer fake.invocationsMutex.Unlock() 179 if fake.invocations == nil { 180 fake.invocations = map[string][][]interface{}{} 181 } 182 if fake.invocations[key] == nil { 183 fake.invocations[key] = [][]interface{}{} 184 } 185 fake.invocations[key] = append(fake.invocations[key], args) 186 } 187 188 var _ logs.Repository = new(FakeRepository)