github.com/loggregator/cli@v6.33.1-0.20180224010324-82334f081791+incompatible/cf/api/apifakes/fake_service_plan_repository.go (about) 1 // This file was generated by counterfeiter 2 package apifakes 3 4 import ( 5 "sync" 6 7 "code.cloudfoundry.org/cli/cf/api" 8 "code.cloudfoundry.org/cli/cf/models" 9 ) 10 11 type FakeServicePlanRepository struct { 12 SearchStub func(searchParameters map[string]string) ([]models.ServicePlanFields, error) 13 searchMutex sync.RWMutex 14 searchArgsForCall []struct { 15 searchParameters map[string]string 16 } 17 searchReturns struct { 18 result1 []models.ServicePlanFields 19 result2 error 20 } 21 UpdateStub func(models.ServicePlanFields, string, bool) error 22 updateMutex sync.RWMutex 23 updateArgsForCall []struct { 24 arg1 models.ServicePlanFields 25 arg2 string 26 arg3 bool 27 } 28 updateReturns struct { 29 result1 error 30 } 31 ListPlansFromManyServicesStub func(serviceGUIDs []string) ([]models.ServicePlanFields, error) 32 listPlansFromManyServicesMutex sync.RWMutex 33 listPlansFromManyServicesArgsForCall []struct { 34 serviceGUIDs []string 35 } 36 listPlansFromManyServicesReturns struct { 37 result1 []models.ServicePlanFields 38 result2 error 39 } 40 invocations map[string][][]interface{} 41 invocationsMutex sync.RWMutex 42 } 43 44 func (fake *FakeServicePlanRepository) Search(searchParameters map[string]string) ([]models.ServicePlanFields, error) { 45 fake.searchMutex.Lock() 46 fake.searchArgsForCall = append(fake.searchArgsForCall, struct { 47 searchParameters map[string]string 48 }{searchParameters}) 49 fake.recordInvocation("Search", []interface{}{searchParameters}) 50 fake.searchMutex.Unlock() 51 if fake.SearchStub != nil { 52 return fake.SearchStub(searchParameters) 53 } else { 54 return fake.searchReturns.result1, fake.searchReturns.result2 55 } 56 } 57 58 func (fake *FakeServicePlanRepository) SearchCallCount() int { 59 fake.searchMutex.RLock() 60 defer fake.searchMutex.RUnlock() 61 return len(fake.searchArgsForCall) 62 } 63 64 func (fake *FakeServicePlanRepository) SearchArgsForCall(i int) map[string]string { 65 fake.searchMutex.RLock() 66 defer fake.searchMutex.RUnlock() 67 return fake.searchArgsForCall[i].searchParameters 68 } 69 70 func (fake *FakeServicePlanRepository) SearchReturns(result1 []models.ServicePlanFields, result2 error) { 71 fake.SearchStub = nil 72 fake.searchReturns = struct { 73 result1 []models.ServicePlanFields 74 result2 error 75 }{result1, result2} 76 } 77 78 func (fake *FakeServicePlanRepository) Update(arg1 models.ServicePlanFields, arg2 string, arg3 bool) error { 79 fake.updateMutex.Lock() 80 fake.updateArgsForCall = append(fake.updateArgsForCall, struct { 81 arg1 models.ServicePlanFields 82 arg2 string 83 arg3 bool 84 }{arg1, arg2, arg3}) 85 fake.recordInvocation("Update", []interface{}{arg1, arg2, arg3}) 86 fake.updateMutex.Unlock() 87 if fake.UpdateStub != nil { 88 return fake.UpdateStub(arg1, arg2, arg3) 89 } else { 90 return fake.updateReturns.result1 91 } 92 } 93 94 func (fake *FakeServicePlanRepository) UpdateCallCount() int { 95 fake.updateMutex.RLock() 96 defer fake.updateMutex.RUnlock() 97 return len(fake.updateArgsForCall) 98 } 99 100 func (fake *FakeServicePlanRepository) UpdateArgsForCall(i int) (models.ServicePlanFields, string, bool) { 101 fake.updateMutex.RLock() 102 defer fake.updateMutex.RUnlock() 103 return fake.updateArgsForCall[i].arg1, fake.updateArgsForCall[i].arg2, fake.updateArgsForCall[i].arg3 104 } 105 106 func (fake *FakeServicePlanRepository) UpdateReturns(result1 error) { 107 fake.UpdateStub = nil 108 fake.updateReturns = struct { 109 result1 error 110 }{result1} 111 } 112 113 func (fake *FakeServicePlanRepository) ListPlansFromManyServices(serviceGUIDs []string) ([]models.ServicePlanFields, error) { 114 var serviceGUIDsCopy []string 115 if serviceGUIDs != nil { 116 serviceGUIDsCopy = make([]string, len(serviceGUIDs)) 117 copy(serviceGUIDsCopy, serviceGUIDs) 118 } 119 fake.listPlansFromManyServicesMutex.Lock() 120 fake.listPlansFromManyServicesArgsForCall = append(fake.listPlansFromManyServicesArgsForCall, struct { 121 serviceGUIDs []string 122 }{serviceGUIDsCopy}) 123 fake.recordInvocation("ListPlansFromManyServices", []interface{}{serviceGUIDsCopy}) 124 fake.listPlansFromManyServicesMutex.Unlock() 125 if fake.ListPlansFromManyServicesStub != nil { 126 return fake.ListPlansFromManyServicesStub(serviceGUIDs) 127 } else { 128 return fake.listPlansFromManyServicesReturns.result1, fake.listPlansFromManyServicesReturns.result2 129 } 130 } 131 132 func (fake *FakeServicePlanRepository) ListPlansFromManyServicesCallCount() int { 133 fake.listPlansFromManyServicesMutex.RLock() 134 defer fake.listPlansFromManyServicesMutex.RUnlock() 135 return len(fake.listPlansFromManyServicesArgsForCall) 136 } 137 138 func (fake *FakeServicePlanRepository) ListPlansFromManyServicesArgsForCall(i int) []string { 139 fake.listPlansFromManyServicesMutex.RLock() 140 defer fake.listPlansFromManyServicesMutex.RUnlock() 141 return fake.listPlansFromManyServicesArgsForCall[i].serviceGUIDs 142 } 143 144 func (fake *FakeServicePlanRepository) ListPlansFromManyServicesReturns(result1 []models.ServicePlanFields, result2 error) { 145 fake.ListPlansFromManyServicesStub = nil 146 fake.listPlansFromManyServicesReturns = struct { 147 result1 []models.ServicePlanFields 148 result2 error 149 }{result1, result2} 150 } 151 152 func (fake *FakeServicePlanRepository) Invocations() map[string][][]interface{} { 153 fake.invocationsMutex.RLock() 154 defer fake.invocationsMutex.RUnlock() 155 fake.searchMutex.RLock() 156 defer fake.searchMutex.RUnlock() 157 fake.updateMutex.RLock() 158 defer fake.updateMutex.RUnlock() 159 fake.listPlansFromManyServicesMutex.RLock() 160 defer fake.listPlansFromManyServicesMutex.RUnlock() 161 return fake.invocations 162 } 163 164 func (fake *FakeServicePlanRepository) recordInvocation(key string, args []interface{}) { 165 fake.invocationsMutex.Lock() 166 defer fake.invocationsMutex.Unlock() 167 if fake.invocations == nil { 168 fake.invocations = map[string][][]interface{}{} 169 } 170 if fake.invocations[key] == nil { 171 fake.invocations[key] = [][]interface{}{} 172 } 173 fake.invocations[key] = append(fake.invocations[key], args) 174 } 175 176 var _ api.ServicePlanRepository = new(FakeServicePlanRepository)