github.com/loggregator/cli@v6.33.1-0.20180224010324-82334f081791+incompatible/cf/api/appfiles/appfilesfakes/fake_repository.go (about) 1 // This file was generated by counterfeiter 2 package appfilesfakes 3 4 import ( 5 "sync" 6 7 "code.cloudfoundry.org/cli/cf/api/appfiles" 8 ) 9 10 type FakeRepository struct { 11 ListFilesStub func(appGUID string, instance int, path string) (files string, apiErr error) 12 listFilesMutex sync.RWMutex 13 listFilesArgsForCall []struct { 14 appGUID string 15 instance int 16 path string 17 } 18 listFilesReturns struct { 19 result1 string 20 result2 error 21 } 22 invocations map[string][][]interface{} 23 invocationsMutex sync.RWMutex 24 } 25 26 func (fake *FakeRepository) ListFiles(appGUID string, instance int, path string) (files string, apiErr error) { 27 fake.listFilesMutex.Lock() 28 fake.listFilesArgsForCall = append(fake.listFilesArgsForCall, struct { 29 appGUID string 30 instance int 31 path string 32 }{appGUID, instance, path}) 33 fake.recordInvocation("ListFiles", []interface{}{appGUID, instance, path}) 34 fake.listFilesMutex.Unlock() 35 if fake.ListFilesStub != nil { 36 return fake.ListFilesStub(appGUID, instance, path) 37 } else { 38 return fake.listFilesReturns.result1, fake.listFilesReturns.result2 39 } 40 } 41 42 func (fake *FakeRepository) ListFilesCallCount() int { 43 fake.listFilesMutex.RLock() 44 defer fake.listFilesMutex.RUnlock() 45 return len(fake.listFilesArgsForCall) 46 } 47 48 func (fake *FakeRepository) ListFilesArgsForCall(i int) (string, int, string) { 49 fake.listFilesMutex.RLock() 50 defer fake.listFilesMutex.RUnlock() 51 return fake.listFilesArgsForCall[i].appGUID, fake.listFilesArgsForCall[i].instance, fake.listFilesArgsForCall[i].path 52 } 53 54 func (fake *FakeRepository) ListFilesReturns(result1 string, result2 error) { 55 fake.ListFilesStub = nil 56 fake.listFilesReturns = struct { 57 result1 string 58 result2 error 59 }{result1, result2} 60 } 61 62 func (fake *FakeRepository) Invocations() map[string][][]interface{} { 63 fake.invocationsMutex.RLock() 64 defer fake.invocationsMutex.RUnlock() 65 fake.listFilesMutex.RLock() 66 defer fake.listFilesMutex.RUnlock() 67 return fake.invocations 68 } 69 70 func (fake *FakeRepository) recordInvocation(key string, args []interface{}) { 71 fake.invocationsMutex.Lock() 72 defer fake.invocationsMutex.Unlock() 73 if fake.invocations == nil { 74 fake.invocations = map[string][][]interface{}{} 75 } 76 if fake.invocations[key] == nil { 77 fake.invocations[key] = [][]interface{}{} 78 } 79 fake.invocations[key] = append(fake.invocations[key], args) 80 } 81 82 var _ appfiles.Repository = new(FakeRepository)