github.com/loggregator/cli@v6.33.1-0.20180224010324-82334f081791+incompatible/cf/api/logs/logsfakes/fake_noaa_consumer.go (about) 1 // This file was generated by counterfeiter 2 package logsfakes 3 4 import ( 5 "sync" 6 7 "code.cloudfoundry.org/cli/cf/api/logs" 8 "github.com/cloudfoundry/noaa/consumer" 9 "github.com/cloudfoundry/sonde-go/events" 10 ) 11 12 type FakeNoaaConsumer struct { 13 TailingLogsStub func(string, string) (<-chan *events.LogMessage, <-chan error) 14 tailingLogsMutex sync.RWMutex 15 tailingLogsArgsForCall []struct { 16 arg1 string 17 arg2 string 18 } 19 tailingLogsReturns struct { 20 result1 <-chan *events.LogMessage 21 result2 <-chan error 22 } 23 RecentLogsStub func(appGUID string, authToken string) ([]*events.LogMessage, error) 24 recentLogsMutex sync.RWMutex 25 recentLogsArgsForCall []struct { 26 appGUID string 27 authToken string 28 } 29 recentLogsReturns struct { 30 result1 []*events.LogMessage 31 result2 error 32 } 33 CloseStub func() error 34 closeMutex sync.RWMutex 35 closeArgsForCall []struct{} 36 closeReturns struct { 37 result1 error 38 } 39 SetOnConnectCallbackStub func(cb func()) 40 setOnConnectCallbackMutex sync.RWMutex 41 setOnConnectCallbackArgsForCall []struct { 42 cb func() 43 } 44 RefreshTokenFromStub func(tr consumer.TokenRefresher) 45 refreshTokenFromMutex sync.RWMutex 46 refreshTokenFromArgsForCall []struct { 47 tr consumer.TokenRefresher 48 } 49 invocations map[string][][]interface{} 50 invocationsMutex sync.RWMutex 51 } 52 53 func (fake *FakeNoaaConsumer) TailingLogs(arg1 string, arg2 string) (<-chan *events.LogMessage, <-chan error) { 54 fake.tailingLogsMutex.Lock() 55 fake.tailingLogsArgsForCall = append(fake.tailingLogsArgsForCall, struct { 56 arg1 string 57 arg2 string 58 }{arg1, arg2}) 59 fake.recordInvocation("TailingLogs", []interface{}{arg1, arg2}) 60 fake.tailingLogsMutex.Unlock() 61 if fake.TailingLogsStub != nil { 62 return fake.TailingLogsStub(arg1, arg2) 63 } else { 64 return fake.tailingLogsReturns.result1, fake.tailingLogsReturns.result2 65 } 66 } 67 68 func (fake *FakeNoaaConsumer) TailingLogsCallCount() int { 69 fake.tailingLogsMutex.RLock() 70 defer fake.tailingLogsMutex.RUnlock() 71 return len(fake.tailingLogsArgsForCall) 72 } 73 74 func (fake *FakeNoaaConsumer) TailingLogsArgsForCall(i int) (string, string) { 75 fake.tailingLogsMutex.RLock() 76 defer fake.tailingLogsMutex.RUnlock() 77 return fake.tailingLogsArgsForCall[i].arg1, fake.tailingLogsArgsForCall[i].arg2 78 } 79 80 func (fake *FakeNoaaConsumer) TailingLogsReturns(result1 <-chan *events.LogMessage, result2 <-chan error) { 81 fake.TailingLogsStub = nil 82 fake.tailingLogsReturns = struct { 83 result1 <-chan *events.LogMessage 84 result2 <-chan error 85 }{result1, result2} 86 } 87 88 func (fake *FakeNoaaConsumer) RecentLogs(appGUID string, authToken string) ([]*events.LogMessage, error) { 89 fake.recentLogsMutex.Lock() 90 fake.recentLogsArgsForCall = append(fake.recentLogsArgsForCall, struct { 91 appGUID string 92 authToken string 93 }{appGUID, authToken}) 94 fake.recordInvocation("RecentLogs", []interface{}{appGUID, authToken}) 95 fake.recentLogsMutex.Unlock() 96 if fake.RecentLogsStub != nil { 97 return fake.RecentLogsStub(appGUID, authToken) 98 } else { 99 return fake.recentLogsReturns.result1, fake.recentLogsReturns.result2 100 } 101 } 102 103 func (fake *FakeNoaaConsumer) RecentLogsCallCount() int { 104 fake.recentLogsMutex.RLock() 105 defer fake.recentLogsMutex.RUnlock() 106 return len(fake.recentLogsArgsForCall) 107 } 108 109 func (fake *FakeNoaaConsumer) RecentLogsArgsForCall(i int) (string, string) { 110 fake.recentLogsMutex.RLock() 111 defer fake.recentLogsMutex.RUnlock() 112 return fake.recentLogsArgsForCall[i].appGUID, fake.recentLogsArgsForCall[i].authToken 113 } 114 115 func (fake *FakeNoaaConsumer) RecentLogsReturns(result1 []*events.LogMessage, result2 error) { 116 fake.RecentLogsStub = nil 117 fake.recentLogsReturns = struct { 118 result1 []*events.LogMessage 119 result2 error 120 }{result1, result2} 121 } 122 123 func (fake *FakeNoaaConsumer) Close() error { 124 fake.closeMutex.Lock() 125 fake.closeArgsForCall = append(fake.closeArgsForCall, struct{}{}) 126 fake.recordInvocation("Close", []interface{}{}) 127 fake.closeMutex.Unlock() 128 if fake.CloseStub != nil { 129 return fake.CloseStub() 130 } else { 131 return fake.closeReturns.result1 132 } 133 } 134 135 func (fake *FakeNoaaConsumer) CloseCallCount() int { 136 fake.closeMutex.RLock() 137 defer fake.closeMutex.RUnlock() 138 return len(fake.closeArgsForCall) 139 } 140 141 func (fake *FakeNoaaConsumer) CloseReturns(result1 error) { 142 fake.CloseStub = nil 143 fake.closeReturns = struct { 144 result1 error 145 }{result1} 146 } 147 148 func (fake *FakeNoaaConsumer) SetOnConnectCallback(cb func()) { 149 fake.setOnConnectCallbackMutex.Lock() 150 fake.setOnConnectCallbackArgsForCall = append(fake.setOnConnectCallbackArgsForCall, struct { 151 cb func() 152 }{cb}) 153 fake.recordInvocation("SetOnConnectCallback", []interface{}{cb}) 154 fake.setOnConnectCallbackMutex.Unlock() 155 if fake.SetOnConnectCallbackStub != nil { 156 fake.SetOnConnectCallbackStub(cb) 157 } 158 } 159 160 func (fake *FakeNoaaConsumer) SetOnConnectCallbackCallCount() int { 161 fake.setOnConnectCallbackMutex.RLock() 162 defer fake.setOnConnectCallbackMutex.RUnlock() 163 return len(fake.setOnConnectCallbackArgsForCall) 164 } 165 166 func (fake *FakeNoaaConsumer) SetOnConnectCallbackArgsForCall(i int) func() { 167 fake.setOnConnectCallbackMutex.RLock() 168 defer fake.setOnConnectCallbackMutex.RUnlock() 169 return fake.setOnConnectCallbackArgsForCall[i].cb 170 } 171 172 func (fake *FakeNoaaConsumer) RefreshTokenFrom(tr consumer.TokenRefresher) { 173 fake.refreshTokenFromMutex.Lock() 174 fake.refreshTokenFromArgsForCall = append(fake.refreshTokenFromArgsForCall, struct { 175 tr consumer.TokenRefresher 176 }{tr}) 177 fake.recordInvocation("RefreshTokenFrom", []interface{}{tr}) 178 fake.refreshTokenFromMutex.Unlock() 179 if fake.RefreshTokenFromStub != nil { 180 fake.RefreshTokenFromStub(tr) 181 } 182 } 183 184 func (fake *FakeNoaaConsumer) RefreshTokenFromCallCount() int { 185 fake.refreshTokenFromMutex.RLock() 186 defer fake.refreshTokenFromMutex.RUnlock() 187 return len(fake.refreshTokenFromArgsForCall) 188 } 189 190 func (fake *FakeNoaaConsumer) RefreshTokenFromArgsForCall(i int) consumer.TokenRefresher { 191 fake.refreshTokenFromMutex.RLock() 192 defer fake.refreshTokenFromMutex.RUnlock() 193 return fake.refreshTokenFromArgsForCall[i].tr 194 } 195 196 func (fake *FakeNoaaConsumer) Invocations() map[string][][]interface{} { 197 fake.invocationsMutex.RLock() 198 defer fake.invocationsMutex.RUnlock() 199 fake.tailingLogsMutex.RLock() 200 defer fake.tailingLogsMutex.RUnlock() 201 fake.recentLogsMutex.RLock() 202 defer fake.recentLogsMutex.RUnlock() 203 fake.closeMutex.RLock() 204 defer fake.closeMutex.RUnlock() 205 fake.setOnConnectCallbackMutex.RLock() 206 defer fake.setOnConnectCallbackMutex.RUnlock() 207 fake.refreshTokenFromMutex.RLock() 208 defer fake.refreshTokenFromMutex.RUnlock() 209 return fake.invocations 210 } 211 212 func (fake *FakeNoaaConsumer) recordInvocation(key string, args []interface{}) { 213 fake.invocationsMutex.Lock() 214 defer fake.invocationsMutex.Unlock() 215 if fake.invocations == nil { 216 fake.invocations = map[string][][]interface{}{} 217 } 218 if fake.invocations[key] == nil { 219 fake.invocations[key] = [][]interface{}{} 220 } 221 fake.invocations[key] = append(fake.invocations[key], args) 222 } 223 224 var _ logs.NoaaConsumer = new(FakeNoaaConsumer)