github.com/cloudfoundry-attic/garden-linux@v0.333.2-candidate/process_tracker/fake_process_tracker/fake_process_tracker.go (about) 1 // This file was generated by counterfeiter 2 package fake_process_tracker 3 4 import ( 5 "os/exec" 6 "sync" 7 8 "github.com/cloudfoundry-incubator/garden" 9 "github.com/cloudfoundry-incubator/garden-linux/process_tracker" 10 ) 11 12 type FakeProcessTracker struct { 13 RunStub func(processID string, cmd *exec.Cmd, io garden.ProcessIO, tty *garden.TTYSpec, signaller process_tracker.Signaller) (garden.Process, error) 14 runMutex sync.RWMutex 15 runArgsForCall []struct { 16 processID string 17 cmd *exec.Cmd 18 io garden.ProcessIO 19 tty *garden.TTYSpec 20 signaller process_tracker.Signaller 21 } 22 runReturns struct { 23 result1 garden.Process 24 result2 error 25 } 26 AttachStub func(processID string, io garden.ProcessIO) (garden.Process, error) 27 attachMutex sync.RWMutex 28 attachArgsForCall []struct { 29 processID string 30 io garden.ProcessIO 31 } 32 attachReturns struct { 33 result1 garden.Process 34 result2 error 35 } 36 RestoreStub func(processID string, signaller process_tracker.Signaller) 37 restoreMutex sync.RWMutex 38 restoreArgsForCall []struct { 39 processID string 40 signaller process_tracker.Signaller 41 } 42 ActiveProcessesStub func() []garden.Process 43 activeProcessesMutex sync.RWMutex 44 activeProcessesArgsForCall []struct{} 45 activeProcessesReturns struct { 46 result1 []garden.Process 47 } 48 } 49 50 func (fake *FakeProcessTracker) Run(processID string, cmd *exec.Cmd, io garden.ProcessIO, tty *garden.TTYSpec, signaller process_tracker.Signaller) (garden.Process, error) { 51 fake.runMutex.Lock() 52 fake.runArgsForCall = append(fake.runArgsForCall, struct { 53 processID string 54 cmd *exec.Cmd 55 io garden.ProcessIO 56 tty *garden.TTYSpec 57 signaller process_tracker.Signaller 58 }{processID, cmd, io, tty, signaller}) 59 fake.runMutex.Unlock() 60 if fake.RunStub != nil { 61 return fake.RunStub(processID, cmd, io, tty, signaller) 62 } else { 63 return fake.runReturns.result1, fake.runReturns.result2 64 } 65 } 66 67 func (fake *FakeProcessTracker) RunCallCount() int { 68 fake.runMutex.RLock() 69 defer fake.runMutex.RUnlock() 70 return len(fake.runArgsForCall) 71 } 72 73 func (fake *FakeProcessTracker) RunArgsForCall(i int) (string, *exec.Cmd, garden.ProcessIO, *garden.TTYSpec, process_tracker.Signaller) { 74 fake.runMutex.RLock() 75 defer fake.runMutex.RUnlock() 76 return fake.runArgsForCall[i].processID, fake.runArgsForCall[i].cmd, fake.runArgsForCall[i].io, fake.runArgsForCall[i].tty, fake.runArgsForCall[i].signaller 77 } 78 79 func (fake *FakeProcessTracker) RunReturns(result1 garden.Process, result2 error) { 80 fake.RunStub = nil 81 fake.runReturns = struct { 82 result1 garden.Process 83 result2 error 84 }{result1, result2} 85 } 86 87 func (fake *FakeProcessTracker) Attach(processID string, io garden.ProcessIO) (garden.Process, error) { 88 fake.attachMutex.Lock() 89 fake.attachArgsForCall = append(fake.attachArgsForCall, struct { 90 processID string 91 io garden.ProcessIO 92 }{processID, io}) 93 fake.attachMutex.Unlock() 94 if fake.AttachStub != nil { 95 return fake.AttachStub(processID, io) 96 } else { 97 return fake.attachReturns.result1, fake.attachReturns.result2 98 } 99 } 100 101 func (fake *FakeProcessTracker) AttachCallCount() int { 102 fake.attachMutex.RLock() 103 defer fake.attachMutex.RUnlock() 104 return len(fake.attachArgsForCall) 105 } 106 107 func (fake *FakeProcessTracker) AttachArgsForCall(i int) (string, garden.ProcessIO) { 108 fake.attachMutex.RLock() 109 defer fake.attachMutex.RUnlock() 110 return fake.attachArgsForCall[i].processID, fake.attachArgsForCall[i].io 111 } 112 113 func (fake *FakeProcessTracker) AttachReturns(result1 garden.Process, result2 error) { 114 fake.AttachStub = nil 115 fake.attachReturns = struct { 116 result1 garden.Process 117 result2 error 118 }{result1, result2} 119 } 120 121 func (fake *FakeProcessTracker) Restore(processID string, signaller process_tracker.Signaller) { 122 fake.restoreMutex.Lock() 123 fake.restoreArgsForCall = append(fake.restoreArgsForCall, struct { 124 processID string 125 signaller process_tracker.Signaller 126 }{processID, signaller}) 127 fake.restoreMutex.Unlock() 128 if fake.RestoreStub != nil { 129 fake.RestoreStub(processID, signaller) 130 } 131 } 132 133 func (fake *FakeProcessTracker) RestoreCallCount() int { 134 fake.restoreMutex.RLock() 135 defer fake.restoreMutex.RUnlock() 136 return len(fake.restoreArgsForCall) 137 } 138 139 func (fake *FakeProcessTracker) RestoreArgsForCall(i int) (string, process_tracker.Signaller) { 140 fake.restoreMutex.RLock() 141 defer fake.restoreMutex.RUnlock() 142 return fake.restoreArgsForCall[i].processID, fake.restoreArgsForCall[i].signaller 143 } 144 145 func (fake *FakeProcessTracker) ActiveProcesses() []garden.Process { 146 fake.activeProcessesMutex.Lock() 147 fake.activeProcessesArgsForCall = append(fake.activeProcessesArgsForCall, struct{}{}) 148 fake.activeProcessesMutex.Unlock() 149 if fake.ActiveProcessesStub != nil { 150 return fake.ActiveProcessesStub() 151 } else { 152 return fake.activeProcessesReturns.result1 153 } 154 } 155 156 func (fake *FakeProcessTracker) ActiveProcessesCallCount() int { 157 fake.activeProcessesMutex.RLock() 158 defer fake.activeProcessesMutex.RUnlock() 159 return len(fake.activeProcessesArgsForCall) 160 } 161 162 func (fake *FakeProcessTracker) ActiveProcessesReturns(result1 []garden.Process) { 163 fake.ActiveProcessesStub = nil 164 fake.activeProcessesReturns = struct { 165 result1 []garden.Process 166 }{result1} 167 } 168 169 var _ process_tracker.ProcessTracker = new(FakeProcessTracker)