github.com/loggregator/cli@v6.33.1-0.20180224010324-82334f081791+incompatible/cf/api/apifakes/fake_buildpack_bits_repository.go (about) 1 // This file was generated by counterfeiter 2 package apifakes 3 4 import ( 5 "os" 6 "sync" 7 8 "code.cloudfoundry.org/cli/cf/api" 9 "code.cloudfoundry.org/cli/cf/models" 10 ) 11 12 type FakeBuildpackBitsRepository struct { 13 UploadBuildpackStub func(buildpack models.Buildpack, buildpackFile *os.File, zipFileName string) error 14 uploadBuildpackMutex sync.RWMutex 15 uploadBuildpackArgsForCall []struct { 16 buildpack models.Buildpack 17 buildpackFile *os.File 18 zipFileName string 19 } 20 uploadBuildpackReturns struct { 21 result1 error 22 } 23 CreateBuildpackZipFileStub func(buildpackPath string) (*os.File, string, error) 24 createBuildpackZipFileMutex sync.RWMutex 25 createBuildpackZipFileArgsForCall []struct { 26 buildpackPath string 27 } 28 createBuildpackZipFileReturns struct { 29 result1 *os.File 30 result2 string 31 result3 error 32 } 33 invocations map[string][][]interface{} 34 invocationsMutex sync.RWMutex 35 } 36 37 func (fake *FakeBuildpackBitsRepository) UploadBuildpack(buildpack models.Buildpack, buildpackFile *os.File, zipFileName string) error { 38 fake.uploadBuildpackMutex.Lock() 39 fake.uploadBuildpackArgsForCall = append(fake.uploadBuildpackArgsForCall, struct { 40 buildpack models.Buildpack 41 buildpackFile *os.File 42 zipFileName string 43 }{buildpack, buildpackFile, zipFileName}) 44 fake.recordInvocation("UploadBuildpack", []interface{}{buildpack, buildpackFile, zipFileName}) 45 fake.uploadBuildpackMutex.Unlock() 46 if fake.UploadBuildpackStub != nil { 47 return fake.UploadBuildpackStub(buildpack, buildpackFile, zipFileName) 48 } else { 49 return fake.uploadBuildpackReturns.result1 50 } 51 } 52 53 func (fake *FakeBuildpackBitsRepository) UploadBuildpackCallCount() int { 54 fake.uploadBuildpackMutex.RLock() 55 defer fake.uploadBuildpackMutex.RUnlock() 56 return len(fake.uploadBuildpackArgsForCall) 57 } 58 59 func (fake *FakeBuildpackBitsRepository) UploadBuildpackArgsForCall(i int) (models.Buildpack, *os.File, string) { 60 fake.uploadBuildpackMutex.RLock() 61 defer fake.uploadBuildpackMutex.RUnlock() 62 return fake.uploadBuildpackArgsForCall[i].buildpack, fake.uploadBuildpackArgsForCall[i].buildpackFile, fake.uploadBuildpackArgsForCall[i].zipFileName 63 } 64 65 func (fake *FakeBuildpackBitsRepository) UploadBuildpackReturns(result1 error) { 66 fake.UploadBuildpackStub = nil 67 fake.uploadBuildpackReturns = struct { 68 result1 error 69 }{result1} 70 } 71 72 func (fake *FakeBuildpackBitsRepository) CreateBuildpackZipFile(buildpackPath string) (*os.File, string, error) { 73 fake.createBuildpackZipFileMutex.Lock() 74 fake.createBuildpackZipFileArgsForCall = append(fake.createBuildpackZipFileArgsForCall, struct { 75 buildpackPath string 76 }{buildpackPath}) 77 fake.recordInvocation("CreateBuildpackZipFile", []interface{}{buildpackPath}) 78 fake.createBuildpackZipFileMutex.Unlock() 79 if fake.CreateBuildpackZipFileStub != nil { 80 return fake.CreateBuildpackZipFileStub(buildpackPath) 81 } else { 82 return fake.createBuildpackZipFileReturns.result1, fake.createBuildpackZipFileReturns.result2, fake.createBuildpackZipFileReturns.result3 83 } 84 } 85 86 func (fake *FakeBuildpackBitsRepository) CreateBuildpackZipFileCallCount() int { 87 fake.createBuildpackZipFileMutex.RLock() 88 defer fake.createBuildpackZipFileMutex.RUnlock() 89 return len(fake.createBuildpackZipFileArgsForCall) 90 } 91 92 func (fake *FakeBuildpackBitsRepository) CreateBuildpackZipFileArgsForCall(i int) string { 93 fake.createBuildpackZipFileMutex.RLock() 94 defer fake.createBuildpackZipFileMutex.RUnlock() 95 return fake.createBuildpackZipFileArgsForCall[i].buildpackPath 96 } 97 98 func (fake *FakeBuildpackBitsRepository) CreateBuildpackZipFileReturns(result1 *os.File, result2 string, result3 error) { 99 fake.CreateBuildpackZipFileStub = nil 100 fake.createBuildpackZipFileReturns = struct { 101 result1 *os.File 102 result2 string 103 result3 error 104 }{result1, result2, result3} 105 } 106 107 func (fake *FakeBuildpackBitsRepository) Invocations() map[string][][]interface{} { 108 fake.invocationsMutex.RLock() 109 defer fake.invocationsMutex.RUnlock() 110 fake.uploadBuildpackMutex.RLock() 111 defer fake.uploadBuildpackMutex.RUnlock() 112 fake.createBuildpackZipFileMutex.RLock() 113 defer fake.createBuildpackZipFileMutex.RUnlock() 114 return fake.invocations 115 } 116 117 func (fake *FakeBuildpackBitsRepository) recordInvocation(key string, args []interface{}) { 118 fake.invocationsMutex.Lock() 119 defer fake.invocationsMutex.Unlock() 120 if fake.invocations == nil { 121 fake.invocations = map[string][][]interface{}{} 122 } 123 if fake.invocations[key] == nil { 124 fake.invocations[key] = [][]interface{}{} 125 } 126 fake.invocations[key] = append(fake.invocations[key], args) 127 } 128 129 var _ api.BuildpackBitsRepository = new(FakeBuildpackBitsRepository)