github.com/schwarzm/garden-linux@v0.0.0-20150507151835-33bca2147c47/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(uint32, *exec.Cmd, garden.ProcessIO, *garden.TTYSpec, process_tracker.Signaller) (garden.Process, error) 14 runMutex sync.RWMutex 15 runArgsForCall []struct { 16 arg1 uint32 17 arg2 *exec.Cmd 18 arg3 garden.ProcessIO 19 arg4 *garden.TTYSpec 20 arg5 process_tracker.Signaller 21 } 22 runReturns struct { 23 result1 garden.Process 24 result2 error 25 } 26 AttachStub func(uint32, garden.ProcessIO) (garden.Process, error) 27 attachMutex sync.RWMutex 28 attachArgsForCall []struct { 29 arg1 uint32 30 arg2 garden.ProcessIO 31 } 32 attachReturns struct { 33 result1 garden.Process 34 result2 error 35 } 36 RestoreStub func(processID uint32, signaller process_tracker.Signaller) 37 restoreMutex sync.RWMutex 38 restoreArgsForCall []struct { 39 processID uint32 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(arg1 uint32, arg2 *exec.Cmd, arg3 garden.ProcessIO, arg4 *garden.TTYSpec, arg5 process_tracker.Signaller) (garden.Process, error) { 51 fake.runMutex.Lock() 52 fake.runArgsForCall = append(fake.runArgsForCall, struct { 53 arg1 uint32 54 arg2 *exec.Cmd 55 arg3 garden.ProcessIO 56 arg4 *garden.TTYSpec 57 arg5 process_tracker.Signaller 58 }{arg1, arg2, arg3, arg4, arg5}) 59 fake.runMutex.Unlock() 60 if fake.RunStub != nil { 61 return fake.RunStub(arg1, arg2, arg3, arg4, arg5) 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) (uint32, *exec.Cmd, garden.ProcessIO, *garden.TTYSpec, process_tracker.Signaller) { 74 fake.runMutex.RLock() 75 defer fake.runMutex.RUnlock() 76 return fake.runArgsForCall[i].arg1, fake.runArgsForCall[i].arg2, fake.runArgsForCall[i].arg3, fake.runArgsForCall[i].arg4, fake.runArgsForCall[i].arg5 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(arg1 uint32, arg2 garden.ProcessIO) (garden.Process, error) { 88 fake.attachMutex.Lock() 89 fake.attachArgsForCall = append(fake.attachArgsForCall, struct { 90 arg1 uint32 91 arg2 garden.ProcessIO 92 }{arg1, arg2}) 93 fake.attachMutex.Unlock() 94 if fake.AttachStub != nil { 95 return fake.AttachStub(arg1, arg2) 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) (uint32, garden.ProcessIO) { 108 fake.attachMutex.RLock() 109 defer fake.attachMutex.RUnlock() 110 return fake.attachArgsForCall[i].arg1, fake.attachArgsForCall[i].arg2 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 uint32, signaller process_tracker.Signaller) { 122 fake.restoreMutex.Lock() 123 fake.restoreArgsForCall = append(fake.restoreArgsForCall, struct { 124 processID uint32 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) (uint32, 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)