github.com/loggregator/cli@v6.33.1-0.20180224010324-82334f081791+incompatible/cf/appfiles/appfilesfakes/fake_app_files.go (about) 1 // This file was generated by counterfeiter 2 package appfilesfakes 3 4 import ( 5 "sync" 6 7 "code.cloudfoundry.org/cli/cf/appfiles" 8 "code.cloudfoundry.org/cli/cf/models" 9 ) 10 11 type FakeAppFiles struct { 12 AppFilesInDirStub func(dir string) (appFiles []models.AppFileFields, err error) 13 appFilesInDirMutex sync.RWMutex 14 appFilesInDirArgsForCall []struct { 15 dir string 16 } 17 appFilesInDirReturns struct { 18 result1 []models.AppFileFields 19 result2 error 20 } 21 CopyFilesStub func(appFiles []models.AppFileFields, fromDir, toDir string) (err error) 22 copyFilesMutex sync.RWMutex 23 copyFilesArgsForCall []struct { 24 appFiles []models.AppFileFields 25 fromDir string 26 toDir string 27 } 28 copyFilesReturns struct { 29 result1 error 30 } 31 CountFilesStub func(directory string) int64 32 countFilesMutex sync.RWMutex 33 countFilesArgsForCall []struct { 34 directory string 35 } 36 countFilesReturns struct { 37 result1 int64 38 } 39 WalkAppFilesStub func(dir string, onEachFile func(string, string) error) (err error) 40 walkAppFilesMutex sync.RWMutex 41 walkAppFilesArgsForCall []struct { 42 dir string 43 onEachFile func(string, string) error 44 } 45 walkAppFilesReturns struct { 46 result1 error 47 } 48 invocations map[string][][]interface{} 49 invocationsMutex sync.RWMutex 50 } 51 52 func (fake *FakeAppFiles) AppFilesInDir(dir string) (appFiles []models.AppFileFields, err error) { 53 fake.appFilesInDirMutex.Lock() 54 fake.appFilesInDirArgsForCall = append(fake.appFilesInDirArgsForCall, struct { 55 dir string 56 }{dir}) 57 fake.recordInvocation("AppFilesInDir", []interface{}{dir}) 58 fake.appFilesInDirMutex.Unlock() 59 if fake.AppFilesInDirStub != nil { 60 return fake.AppFilesInDirStub(dir) 61 } else { 62 return fake.appFilesInDirReturns.result1, fake.appFilesInDirReturns.result2 63 } 64 } 65 66 func (fake *FakeAppFiles) AppFilesInDirCallCount() int { 67 fake.appFilesInDirMutex.RLock() 68 defer fake.appFilesInDirMutex.RUnlock() 69 return len(fake.appFilesInDirArgsForCall) 70 } 71 72 func (fake *FakeAppFiles) AppFilesInDirArgsForCall(i int) string { 73 fake.appFilesInDirMutex.RLock() 74 defer fake.appFilesInDirMutex.RUnlock() 75 return fake.appFilesInDirArgsForCall[i].dir 76 } 77 78 func (fake *FakeAppFiles) AppFilesInDirReturns(result1 []models.AppFileFields, result2 error) { 79 fake.AppFilesInDirStub = nil 80 fake.appFilesInDirReturns = struct { 81 result1 []models.AppFileFields 82 result2 error 83 }{result1, result2} 84 } 85 86 func (fake *FakeAppFiles) CopyFiles(appFiles []models.AppFileFields, fromDir string, toDir string) (err error) { 87 var appFilesCopy []models.AppFileFields 88 if appFiles != nil { 89 appFilesCopy = make([]models.AppFileFields, len(appFiles)) 90 copy(appFilesCopy, appFiles) 91 } 92 fake.copyFilesMutex.Lock() 93 fake.copyFilesArgsForCall = append(fake.copyFilesArgsForCall, struct { 94 appFiles []models.AppFileFields 95 fromDir string 96 toDir string 97 }{appFilesCopy, fromDir, toDir}) 98 fake.recordInvocation("CopyFiles", []interface{}{appFilesCopy, fromDir, toDir}) 99 fake.copyFilesMutex.Unlock() 100 if fake.CopyFilesStub != nil { 101 return fake.CopyFilesStub(appFiles, fromDir, toDir) 102 } else { 103 return fake.copyFilesReturns.result1 104 } 105 } 106 107 func (fake *FakeAppFiles) CopyFilesCallCount() int { 108 fake.copyFilesMutex.RLock() 109 defer fake.copyFilesMutex.RUnlock() 110 return len(fake.copyFilesArgsForCall) 111 } 112 113 func (fake *FakeAppFiles) CopyFilesArgsForCall(i int) ([]models.AppFileFields, string, string) { 114 fake.copyFilesMutex.RLock() 115 defer fake.copyFilesMutex.RUnlock() 116 return fake.copyFilesArgsForCall[i].appFiles, fake.copyFilesArgsForCall[i].fromDir, fake.copyFilesArgsForCall[i].toDir 117 } 118 119 func (fake *FakeAppFiles) CopyFilesReturns(result1 error) { 120 fake.CopyFilesStub = nil 121 fake.copyFilesReturns = struct { 122 result1 error 123 }{result1} 124 } 125 126 func (fake *FakeAppFiles) CountFiles(directory string) int64 { 127 fake.countFilesMutex.Lock() 128 fake.countFilesArgsForCall = append(fake.countFilesArgsForCall, struct { 129 directory string 130 }{directory}) 131 fake.recordInvocation("CountFiles", []interface{}{directory}) 132 fake.countFilesMutex.Unlock() 133 if fake.CountFilesStub != nil { 134 return fake.CountFilesStub(directory) 135 } else { 136 return fake.countFilesReturns.result1 137 } 138 } 139 140 func (fake *FakeAppFiles) CountFilesCallCount() int { 141 fake.countFilesMutex.RLock() 142 defer fake.countFilesMutex.RUnlock() 143 return len(fake.countFilesArgsForCall) 144 } 145 146 func (fake *FakeAppFiles) CountFilesArgsForCall(i int) string { 147 fake.countFilesMutex.RLock() 148 defer fake.countFilesMutex.RUnlock() 149 return fake.countFilesArgsForCall[i].directory 150 } 151 152 func (fake *FakeAppFiles) CountFilesReturns(result1 int64) { 153 fake.CountFilesStub = nil 154 fake.countFilesReturns = struct { 155 result1 int64 156 }{result1} 157 } 158 159 func (fake *FakeAppFiles) WalkAppFiles(dir string, onEachFile func(string, string) error) (err error) { 160 fake.walkAppFilesMutex.Lock() 161 fake.walkAppFilesArgsForCall = append(fake.walkAppFilesArgsForCall, struct { 162 dir string 163 onEachFile func(string, string) error 164 }{dir, onEachFile}) 165 fake.recordInvocation("WalkAppFiles", []interface{}{dir, onEachFile}) 166 fake.walkAppFilesMutex.Unlock() 167 if fake.WalkAppFilesStub != nil { 168 return fake.WalkAppFilesStub(dir, onEachFile) 169 } else { 170 return fake.walkAppFilesReturns.result1 171 } 172 } 173 174 func (fake *FakeAppFiles) WalkAppFilesCallCount() int { 175 fake.walkAppFilesMutex.RLock() 176 defer fake.walkAppFilesMutex.RUnlock() 177 return len(fake.walkAppFilesArgsForCall) 178 } 179 180 func (fake *FakeAppFiles) WalkAppFilesArgsForCall(i int) (string, func(string, string) error) { 181 fake.walkAppFilesMutex.RLock() 182 defer fake.walkAppFilesMutex.RUnlock() 183 return fake.walkAppFilesArgsForCall[i].dir, fake.walkAppFilesArgsForCall[i].onEachFile 184 } 185 186 func (fake *FakeAppFiles) WalkAppFilesReturns(result1 error) { 187 fake.WalkAppFilesStub = nil 188 fake.walkAppFilesReturns = struct { 189 result1 error 190 }{result1} 191 } 192 193 func (fake *FakeAppFiles) Invocations() map[string][][]interface{} { 194 fake.invocationsMutex.RLock() 195 defer fake.invocationsMutex.RUnlock() 196 fake.appFilesInDirMutex.RLock() 197 defer fake.appFilesInDirMutex.RUnlock() 198 fake.copyFilesMutex.RLock() 199 defer fake.copyFilesMutex.RUnlock() 200 fake.countFilesMutex.RLock() 201 defer fake.countFilesMutex.RUnlock() 202 fake.walkAppFilesMutex.RLock() 203 defer fake.walkAppFilesMutex.RUnlock() 204 return fake.invocations 205 } 206 207 func (fake *FakeAppFiles) recordInvocation(key string, args []interface{}) { 208 fake.invocationsMutex.Lock() 209 defer fake.invocationsMutex.Unlock() 210 if fake.invocations == nil { 211 fake.invocations = map[string][][]interface{}{} 212 } 213 if fake.invocations[key] == nil { 214 fake.invocations[key] = [][]interface{}{} 215 } 216 fake.invocations[key] = append(fake.invocations[key], args) 217 } 218 219 var _ appfiles.AppFiles = new(FakeAppFiles)