github.com/mook-as/cf-cli@v7.0.0-beta.28.0.20200120190804-b91c115fae48+incompatible/cf/api/applicationbits/applicationbitsfakes/fake_application_bits_repository.go (about) 1 // This file was generated by counterfeiter 2 package applicationbitsfakes 3 4 import ( 5 "os" 6 "sync" 7 8 "code.cloudfoundry.org/cli/cf/api/applicationbits" 9 "code.cloudfoundry.org/cli/cf/api/resources" 10 ) 11 12 type FakeApplicationBitsRepository struct { 13 GetApplicationFilesStub func(appFilesRequest []resources.AppFileResource) ([]resources.AppFileResource, error) 14 getApplicationFilesMutex sync.RWMutex 15 getApplicationFilesArgsForCall []struct { 16 appFilesRequest []resources.AppFileResource 17 } 18 getApplicationFilesReturns struct { 19 result1 []resources.AppFileResource 20 result2 error 21 } 22 UploadBitsStub func(appGUID string, zipFile *os.File, presentFiles []resources.AppFileResource) (apiErr error) 23 uploadBitsMutex sync.RWMutex 24 uploadBitsArgsForCall []struct { 25 appGUID string 26 zipFile *os.File 27 presentFiles []resources.AppFileResource 28 } 29 uploadBitsReturns struct { 30 result1 error 31 } 32 } 33 34 func (fake *FakeApplicationBitsRepository) GetApplicationFiles(appFilesRequest []resources.AppFileResource) ([]resources.AppFileResource, error) { 35 var appFilesRequestCopy []resources.AppFileResource 36 if appFilesRequest != nil { 37 appFilesRequestCopy = make([]resources.AppFileResource, len(appFilesRequest)) 38 copy(appFilesRequestCopy, appFilesRequest) 39 } 40 fake.getApplicationFilesMutex.Lock() 41 fake.getApplicationFilesArgsForCall = append(fake.getApplicationFilesArgsForCall, struct { 42 appFilesRequest []resources.AppFileResource 43 }{appFilesRequestCopy}) 44 fake.getApplicationFilesMutex.Unlock() 45 if fake.GetApplicationFilesStub != nil { 46 return fake.GetApplicationFilesStub(appFilesRequest) 47 } else { 48 return fake.getApplicationFilesReturns.result1, fake.getApplicationFilesReturns.result2 49 } 50 } 51 52 func (fake *FakeApplicationBitsRepository) GetApplicationFilesCallCount() int { 53 fake.getApplicationFilesMutex.RLock() 54 defer fake.getApplicationFilesMutex.RUnlock() 55 return len(fake.getApplicationFilesArgsForCall) 56 } 57 58 func (fake *FakeApplicationBitsRepository) GetApplicationFilesArgsForCall(i int) []resources.AppFileResource { 59 fake.getApplicationFilesMutex.RLock() 60 defer fake.getApplicationFilesMutex.RUnlock() 61 return fake.getApplicationFilesArgsForCall[i].appFilesRequest 62 } 63 64 func (fake *FakeApplicationBitsRepository) GetApplicationFilesReturns(result1 []resources.AppFileResource, result2 error) { 65 fake.GetApplicationFilesStub = nil 66 fake.getApplicationFilesReturns = struct { 67 result1 []resources.AppFileResource 68 result2 error 69 }{result1, result2} 70 } 71 72 func (fake *FakeApplicationBitsRepository) UploadBits(appGUID string, zipFile *os.File, presentFiles []resources.AppFileResource) (apiErr error) { 73 var presentFilesCopy []resources.AppFileResource 74 if presentFiles != nil { 75 presentFilesCopy = make([]resources.AppFileResource, len(presentFiles)) 76 copy(presentFilesCopy, presentFiles) 77 } 78 fake.uploadBitsMutex.Lock() 79 fake.uploadBitsArgsForCall = append(fake.uploadBitsArgsForCall, struct { 80 appGUID string 81 zipFile *os.File 82 presentFiles []resources.AppFileResource 83 }{appGUID, zipFile, presentFilesCopy}) 84 fake.uploadBitsMutex.Unlock() 85 if fake.UploadBitsStub != nil { 86 return fake.UploadBitsStub(appGUID, zipFile, presentFiles) 87 } else { 88 return fake.uploadBitsReturns.result1 89 } 90 } 91 92 func (fake *FakeApplicationBitsRepository) UploadBitsCallCount() int { 93 fake.uploadBitsMutex.RLock() 94 defer fake.uploadBitsMutex.RUnlock() 95 return len(fake.uploadBitsArgsForCall) 96 } 97 98 func (fake *FakeApplicationBitsRepository) UploadBitsArgsForCall(i int) (string, *os.File, []resources.AppFileResource) { 99 fake.uploadBitsMutex.RLock() 100 defer fake.uploadBitsMutex.RUnlock() 101 return fake.uploadBitsArgsForCall[i].appGUID, fake.uploadBitsArgsForCall[i].zipFile, fake.uploadBitsArgsForCall[i].presentFiles 102 } 103 104 func (fake *FakeApplicationBitsRepository) UploadBitsReturns(result1 error) { 105 fake.UploadBitsStub = nil 106 fake.uploadBitsReturns = struct { 107 result1 error 108 }{result1} 109 } 110 111 var _ applicationbits.Repository = new(FakeApplicationBitsRepository)