github.com/loggregator/cli@v6.33.1-0.20180224010324-82334f081791+incompatible/cf/api/appinstances/appinstancesfakes/fake_app_instances_repository.go (about) 1 // This file was generated by counterfeiter 2 package appinstancesfakes 3 4 import ( 5 "sync" 6 7 "code.cloudfoundry.org/cli/cf/api/appinstances" 8 "code.cloudfoundry.org/cli/cf/models" 9 ) 10 11 type FakeAppInstancesRepository struct { 12 GetInstancesStub func(appGUID string) (instances []models.AppInstanceFields, apiErr error) 13 getInstancesMutex sync.RWMutex 14 getInstancesArgsForCall []struct { 15 appGUID string 16 } 17 getInstancesReturns struct { 18 result1 []models.AppInstanceFields 19 result2 error 20 } 21 DeleteInstanceStub func(appGUID string, instance int) error 22 deleteInstanceMutex sync.RWMutex 23 deleteInstanceArgsForCall []struct { 24 appGUID string 25 instance int 26 } 27 deleteInstanceReturns struct { 28 result1 error 29 } 30 } 31 32 func (fake *FakeAppInstancesRepository) GetInstances(appGUID string) (instances []models.AppInstanceFields, apiErr error) { 33 fake.getInstancesMutex.Lock() 34 fake.getInstancesArgsForCall = append(fake.getInstancesArgsForCall, struct { 35 appGUID string 36 }{appGUID}) 37 fake.getInstancesMutex.Unlock() 38 if fake.GetInstancesStub != nil { 39 return fake.GetInstancesStub(appGUID) 40 } else { 41 return fake.getInstancesReturns.result1, fake.getInstancesReturns.result2 42 } 43 } 44 45 func (fake *FakeAppInstancesRepository) GetInstancesCallCount() int { 46 fake.getInstancesMutex.RLock() 47 defer fake.getInstancesMutex.RUnlock() 48 return len(fake.getInstancesArgsForCall) 49 } 50 51 func (fake *FakeAppInstancesRepository) GetInstancesArgsForCall(i int) string { 52 fake.getInstancesMutex.RLock() 53 defer fake.getInstancesMutex.RUnlock() 54 return fake.getInstancesArgsForCall[i].appGUID 55 } 56 57 func (fake *FakeAppInstancesRepository) GetInstancesReturns(result1 []models.AppInstanceFields, result2 error) { 58 fake.GetInstancesStub = nil 59 fake.getInstancesReturns = struct { 60 result1 []models.AppInstanceFields 61 result2 error 62 }{result1, result2} 63 } 64 65 func (fake *FakeAppInstancesRepository) DeleteInstance(appGUID string, instance int) error { 66 fake.deleteInstanceMutex.Lock() 67 fake.deleteInstanceArgsForCall = append(fake.deleteInstanceArgsForCall, struct { 68 appGUID string 69 instance int 70 }{appGUID, instance}) 71 fake.deleteInstanceMutex.Unlock() 72 if fake.DeleteInstanceStub != nil { 73 return fake.DeleteInstanceStub(appGUID, instance) 74 } else { 75 return fake.deleteInstanceReturns.result1 76 } 77 } 78 79 func (fake *FakeAppInstancesRepository) DeleteInstanceCallCount() int { 80 fake.deleteInstanceMutex.RLock() 81 defer fake.deleteInstanceMutex.RUnlock() 82 return len(fake.deleteInstanceArgsForCall) 83 } 84 85 func (fake *FakeAppInstancesRepository) DeleteInstanceArgsForCall(i int) (string, int) { 86 fake.deleteInstanceMutex.RLock() 87 defer fake.deleteInstanceMutex.RUnlock() 88 return fake.deleteInstanceArgsForCall[i].appGUID, fake.deleteInstanceArgsForCall[i].instance 89 } 90 91 func (fake *FakeAppInstancesRepository) DeleteInstanceReturns(result1 error) { 92 fake.DeleteInstanceStub = nil 93 fake.deleteInstanceReturns = struct { 94 result1 error 95 }{result1} 96 } 97 98 var _ appinstances.Repository = new(FakeAppInstancesRepository)