github.com/dcarley/cf-cli@v6.24.1-0.20170220111324-4225ff346898+incompatible/cf/ssh/terminal/terminalfakes/fake_terminal_helper.go (about) 1 // This file was generated by counterfeiter 2 package terminalfakes 3 4 import ( 5 "io" 6 "sync" 7 8 "code.cloudfoundry.org/cli/cf/ssh/terminal" 9 "github.com/docker/docker/pkg/term" 10 ) 11 12 type FakeTerminalHelper struct { 13 StdStreamsStub func() (stdin io.ReadCloser, stdout io.Writer, stderr io.Writer) 14 stdStreamsMutex sync.RWMutex 15 stdStreamsArgsForCall []struct{} 16 stdStreamsReturns struct { 17 result1 io.ReadCloser 18 result2 io.Writer 19 result3 io.Writer 20 } 21 GetFdInfoStub func(in interface{}) (fd uintptr, isTerminal bool) 22 getFdInfoMutex sync.RWMutex 23 getFdInfoArgsForCall []struct { 24 in interface{} 25 } 26 getFdInfoReturns struct { 27 result1 uintptr 28 result2 bool 29 } 30 SetRawTerminalStub func(fd uintptr) (*term.State, error) 31 setRawTerminalMutex sync.RWMutex 32 setRawTerminalArgsForCall []struct { 33 fd uintptr 34 } 35 setRawTerminalReturns struct { 36 result1 *term.State 37 result2 error 38 } 39 RestoreTerminalStub func(fd uintptr, state *term.State) error 40 restoreTerminalMutex sync.RWMutex 41 restoreTerminalArgsForCall []struct { 42 fd uintptr 43 state *term.State 44 } 45 restoreTerminalReturns struct { 46 result1 error 47 } 48 IsTerminalStub func(fd uintptr) bool 49 isTerminalMutex sync.RWMutex 50 isTerminalArgsForCall []struct { 51 fd uintptr 52 } 53 isTerminalReturns struct { 54 result1 bool 55 } 56 GetWinsizeStub func(fd uintptr) (*term.Winsize, error) 57 getWinsizeMutex sync.RWMutex 58 getWinsizeArgsForCall []struct { 59 fd uintptr 60 } 61 getWinsizeReturns struct { 62 result1 *term.Winsize 63 result2 error 64 } 65 invocations map[string][][]interface{} 66 invocationsMutex sync.RWMutex 67 } 68 69 func (fake *FakeTerminalHelper) StdStreams() (stdin io.ReadCloser, stdout io.Writer, stderr io.Writer) { 70 fake.stdStreamsMutex.Lock() 71 fake.stdStreamsArgsForCall = append(fake.stdStreamsArgsForCall, struct{}{}) 72 fake.recordInvocation("StdStreams", []interface{}{}) 73 fake.stdStreamsMutex.Unlock() 74 if fake.StdStreamsStub != nil { 75 return fake.StdStreamsStub() 76 } else { 77 return fake.stdStreamsReturns.result1, fake.stdStreamsReturns.result2, fake.stdStreamsReturns.result3 78 } 79 } 80 81 func (fake *FakeTerminalHelper) StdStreamsCallCount() int { 82 fake.stdStreamsMutex.RLock() 83 defer fake.stdStreamsMutex.RUnlock() 84 return len(fake.stdStreamsArgsForCall) 85 } 86 87 func (fake *FakeTerminalHelper) StdStreamsReturns(result1 io.ReadCloser, result2 io.Writer, result3 io.Writer) { 88 fake.StdStreamsStub = nil 89 fake.stdStreamsReturns = struct { 90 result1 io.ReadCloser 91 result2 io.Writer 92 result3 io.Writer 93 }{result1, result2, result3} 94 } 95 96 func (fake *FakeTerminalHelper) GetFdInfo(in interface{}) (fd uintptr, isTerminal bool) { 97 fake.getFdInfoMutex.Lock() 98 fake.getFdInfoArgsForCall = append(fake.getFdInfoArgsForCall, struct { 99 in interface{} 100 }{in}) 101 fake.recordInvocation("GetFdInfo", []interface{}{in}) 102 fake.getFdInfoMutex.Unlock() 103 if fake.GetFdInfoStub != nil { 104 return fake.GetFdInfoStub(in) 105 } else { 106 return fake.getFdInfoReturns.result1, fake.getFdInfoReturns.result2 107 } 108 } 109 110 func (fake *FakeTerminalHelper) GetFdInfoCallCount() int { 111 fake.getFdInfoMutex.RLock() 112 defer fake.getFdInfoMutex.RUnlock() 113 return len(fake.getFdInfoArgsForCall) 114 } 115 116 func (fake *FakeTerminalHelper) GetFdInfoArgsForCall(i int) interface{} { 117 fake.getFdInfoMutex.RLock() 118 defer fake.getFdInfoMutex.RUnlock() 119 return fake.getFdInfoArgsForCall[i].in 120 } 121 122 func (fake *FakeTerminalHelper) GetFdInfoReturns(result1 uintptr, result2 bool) { 123 fake.GetFdInfoStub = nil 124 fake.getFdInfoReturns = struct { 125 result1 uintptr 126 result2 bool 127 }{result1, result2} 128 } 129 130 func (fake *FakeTerminalHelper) SetRawTerminal(fd uintptr) (*term.State, error) { 131 fake.setRawTerminalMutex.Lock() 132 fake.setRawTerminalArgsForCall = append(fake.setRawTerminalArgsForCall, struct { 133 fd uintptr 134 }{fd}) 135 fake.recordInvocation("SetRawTerminal", []interface{}{fd}) 136 fake.setRawTerminalMutex.Unlock() 137 if fake.SetRawTerminalStub != nil { 138 return fake.SetRawTerminalStub(fd) 139 } else { 140 return fake.setRawTerminalReturns.result1, fake.setRawTerminalReturns.result2 141 } 142 } 143 144 func (fake *FakeTerminalHelper) SetRawTerminalCallCount() int { 145 fake.setRawTerminalMutex.RLock() 146 defer fake.setRawTerminalMutex.RUnlock() 147 return len(fake.setRawTerminalArgsForCall) 148 } 149 150 func (fake *FakeTerminalHelper) SetRawTerminalArgsForCall(i int) uintptr { 151 fake.setRawTerminalMutex.RLock() 152 defer fake.setRawTerminalMutex.RUnlock() 153 return fake.setRawTerminalArgsForCall[i].fd 154 } 155 156 func (fake *FakeTerminalHelper) SetRawTerminalReturns(result1 *term.State, result2 error) { 157 fake.SetRawTerminalStub = nil 158 fake.setRawTerminalReturns = struct { 159 result1 *term.State 160 result2 error 161 }{result1, result2} 162 } 163 164 func (fake *FakeTerminalHelper) RestoreTerminal(fd uintptr, state *term.State) error { 165 fake.restoreTerminalMutex.Lock() 166 fake.restoreTerminalArgsForCall = append(fake.restoreTerminalArgsForCall, struct { 167 fd uintptr 168 state *term.State 169 }{fd, state}) 170 fake.recordInvocation("RestoreTerminal", []interface{}{fd, state}) 171 fake.restoreTerminalMutex.Unlock() 172 if fake.RestoreTerminalStub != nil { 173 return fake.RestoreTerminalStub(fd, state) 174 } else { 175 return fake.restoreTerminalReturns.result1 176 } 177 } 178 179 func (fake *FakeTerminalHelper) RestoreTerminalCallCount() int { 180 fake.restoreTerminalMutex.RLock() 181 defer fake.restoreTerminalMutex.RUnlock() 182 return len(fake.restoreTerminalArgsForCall) 183 } 184 185 func (fake *FakeTerminalHelper) RestoreTerminalArgsForCall(i int) (uintptr, *term.State) { 186 fake.restoreTerminalMutex.RLock() 187 defer fake.restoreTerminalMutex.RUnlock() 188 return fake.restoreTerminalArgsForCall[i].fd, fake.restoreTerminalArgsForCall[i].state 189 } 190 191 func (fake *FakeTerminalHelper) RestoreTerminalReturns(result1 error) { 192 fake.RestoreTerminalStub = nil 193 fake.restoreTerminalReturns = struct { 194 result1 error 195 }{result1} 196 } 197 198 func (fake *FakeTerminalHelper) IsTerminal(fd uintptr) bool { 199 fake.isTerminalMutex.Lock() 200 fake.isTerminalArgsForCall = append(fake.isTerminalArgsForCall, struct { 201 fd uintptr 202 }{fd}) 203 fake.recordInvocation("IsTerminal", []interface{}{fd}) 204 fake.isTerminalMutex.Unlock() 205 if fake.IsTerminalStub != nil { 206 return fake.IsTerminalStub(fd) 207 } else { 208 return fake.isTerminalReturns.result1 209 } 210 } 211 212 func (fake *FakeTerminalHelper) IsTerminalCallCount() int { 213 fake.isTerminalMutex.RLock() 214 defer fake.isTerminalMutex.RUnlock() 215 return len(fake.isTerminalArgsForCall) 216 } 217 218 func (fake *FakeTerminalHelper) IsTerminalArgsForCall(i int) uintptr { 219 fake.isTerminalMutex.RLock() 220 defer fake.isTerminalMutex.RUnlock() 221 return fake.isTerminalArgsForCall[i].fd 222 } 223 224 func (fake *FakeTerminalHelper) IsTerminalReturns(result1 bool) { 225 fake.IsTerminalStub = nil 226 fake.isTerminalReturns = struct { 227 result1 bool 228 }{result1} 229 } 230 231 func (fake *FakeTerminalHelper) GetWinsize(fd uintptr) (*term.Winsize, error) { 232 fake.getWinsizeMutex.Lock() 233 fake.getWinsizeArgsForCall = append(fake.getWinsizeArgsForCall, struct { 234 fd uintptr 235 }{fd}) 236 fake.recordInvocation("GetWinsize", []interface{}{fd}) 237 fake.getWinsizeMutex.Unlock() 238 if fake.GetWinsizeStub != nil { 239 return fake.GetWinsizeStub(fd) 240 } else { 241 return fake.getWinsizeReturns.result1, fake.getWinsizeReturns.result2 242 } 243 } 244 245 func (fake *FakeTerminalHelper) GetWinsizeCallCount() int { 246 fake.getWinsizeMutex.RLock() 247 defer fake.getWinsizeMutex.RUnlock() 248 return len(fake.getWinsizeArgsForCall) 249 } 250 251 func (fake *FakeTerminalHelper) GetWinsizeArgsForCall(i int) uintptr { 252 fake.getWinsizeMutex.RLock() 253 defer fake.getWinsizeMutex.RUnlock() 254 return fake.getWinsizeArgsForCall[i].fd 255 } 256 257 func (fake *FakeTerminalHelper) GetWinsizeReturns(result1 *term.Winsize, result2 error) { 258 fake.GetWinsizeStub = nil 259 fake.getWinsizeReturns = struct { 260 result1 *term.Winsize 261 result2 error 262 }{result1, result2} 263 } 264 265 func (fake *FakeTerminalHelper) Invocations() map[string][][]interface{} { 266 fake.invocationsMutex.RLock() 267 defer fake.invocationsMutex.RUnlock() 268 fake.stdStreamsMutex.RLock() 269 defer fake.stdStreamsMutex.RUnlock() 270 fake.getFdInfoMutex.RLock() 271 defer fake.getFdInfoMutex.RUnlock() 272 fake.setRawTerminalMutex.RLock() 273 defer fake.setRawTerminalMutex.RUnlock() 274 fake.restoreTerminalMutex.RLock() 275 defer fake.restoreTerminalMutex.RUnlock() 276 fake.isTerminalMutex.RLock() 277 defer fake.isTerminalMutex.RUnlock() 278 fake.getWinsizeMutex.RLock() 279 defer fake.getWinsizeMutex.RUnlock() 280 return fake.invocations 281 } 282 283 func (fake *FakeTerminalHelper) recordInvocation(key string, args []interface{}) { 284 fake.invocationsMutex.Lock() 285 defer fake.invocationsMutex.Unlock() 286 if fake.invocations == nil { 287 fake.invocations = map[string][][]interface{}{} 288 } 289 if fake.invocations[key] == nil { 290 fake.invocations[key] = [][]interface{}{} 291 } 292 fake.invocations[key] = append(fake.invocations[key], args) 293 } 294 295 var _ terminal.TerminalHelper = new(FakeTerminalHelper)