github.com/loggregator/cli@v6.33.1-0.20180224010324-82334f081791+incompatible/cf/api/apifakes/fake_service_broker_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 FakeServiceBrokerRepository struct { 12 ListServiceBrokersStub func(callback func(models.ServiceBroker) bool) error 13 listServiceBrokersMutex sync.RWMutex 14 listServiceBrokersArgsForCall []struct { 15 callback func(models.ServiceBroker) bool 16 } 17 listServiceBrokersReturns struct { 18 result1 error 19 } 20 FindByNameStub func(name string) (serviceBroker models.ServiceBroker, apiErr error) 21 findByNameMutex sync.RWMutex 22 findByNameArgsForCall []struct { 23 name string 24 } 25 findByNameReturns struct { 26 result1 models.ServiceBroker 27 result2 error 28 } 29 FindByGUIDStub func(guid string) (serviceBroker models.ServiceBroker, apiErr error) 30 findByGUIDMutex sync.RWMutex 31 findByGUIDArgsForCall []struct { 32 guid string 33 } 34 findByGUIDReturns struct { 35 result1 models.ServiceBroker 36 result2 error 37 } 38 CreateStub func(name, url, username, password, spaceGUID string) (apiErr error) 39 createMutex sync.RWMutex 40 createArgsForCall []struct { 41 name string 42 url string 43 username string 44 password string 45 spaceGUID string 46 } 47 createReturns struct { 48 result1 error 49 } 50 UpdateStub func(serviceBroker models.ServiceBroker) (apiErr error) 51 updateMutex sync.RWMutex 52 updateArgsForCall []struct { 53 serviceBroker models.ServiceBroker 54 } 55 updateReturns struct { 56 result1 error 57 } 58 RenameStub func(guid, name string) (apiErr error) 59 renameMutex sync.RWMutex 60 renameArgsForCall []struct { 61 guid string 62 name string 63 } 64 renameReturns struct { 65 result1 error 66 } 67 DeleteStub func(guid string) (apiErr error) 68 deleteMutex sync.RWMutex 69 deleteArgsForCall []struct { 70 guid string 71 } 72 deleteReturns struct { 73 result1 error 74 } 75 invocations map[string][][]interface{} 76 invocationsMutex sync.RWMutex 77 } 78 79 func (fake *FakeServiceBrokerRepository) ListServiceBrokers(callback func(models.ServiceBroker) bool) error { 80 fake.listServiceBrokersMutex.Lock() 81 fake.listServiceBrokersArgsForCall = append(fake.listServiceBrokersArgsForCall, struct { 82 callback func(models.ServiceBroker) bool 83 }{callback}) 84 fake.recordInvocation("ListServiceBrokers", []interface{}{callback}) 85 fake.listServiceBrokersMutex.Unlock() 86 if fake.ListServiceBrokersStub != nil { 87 return fake.ListServiceBrokersStub(callback) 88 } else { 89 return fake.listServiceBrokersReturns.result1 90 } 91 } 92 93 func (fake *FakeServiceBrokerRepository) ListServiceBrokersCallCount() int { 94 fake.listServiceBrokersMutex.RLock() 95 defer fake.listServiceBrokersMutex.RUnlock() 96 return len(fake.listServiceBrokersArgsForCall) 97 } 98 99 func (fake *FakeServiceBrokerRepository) ListServiceBrokersArgsForCall(i int) func(models.ServiceBroker) bool { 100 fake.listServiceBrokersMutex.RLock() 101 defer fake.listServiceBrokersMutex.RUnlock() 102 return fake.listServiceBrokersArgsForCall[i].callback 103 } 104 105 func (fake *FakeServiceBrokerRepository) ListServiceBrokersReturns(result1 error) { 106 fake.ListServiceBrokersStub = nil 107 fake.listServiceBrokersReturns = struct { 108 result1 error 109 }{result1} 110 } 111 112 func (fake *FakeServiceBrokerRepository) FindByName(name string) (serviceBroker models.ServiceBroker, apiErr error) { 113 fake.findByNameMutex.Lock() 114 fake.findByNameArgsForCall = append(fake.findByNameArgsForCall, struct { 115 name string 116 }{name}) 117 fake.recordInvocation("FindByName", []interface{}{name}) 118 fake.findByNameMutex.Unlock() 119 if fake.FindByNameStub != nil { 120 return fake.FindByNameStub(name) 121 } else { 122 return fake.findByNameReturns.result1, fake.findByNameReturns.result2 123 } 124 } 125 126 func (fake *FakeServiceBrokerRepository) FindByNameCallCount() int { 127 fake.findByNameMutex.RLock() 128 defer fake.findByNameMutex.RUnlock() 129 return len(fake.findByNameArgsForCall) 130 } 131 132 func (fake *FakeServiceBrokerRepository) FindByNameArgsForCall(i int) string { 133 fake.findByNameMutex.RLock() 134 defer fake.findByNameMutex.RUnlock() 135 return fake.findByNameArgsForCall[i].name 136 } 137 138 func (fake *FakeServiceBrokerRepository) FindByNameReturns(result1 models.ServiceBroker, result2 error) { 139 fake.FindByNameStub = nil 140 fake.findByNameReturns = struct { 141 result1 models.ServiceBroker 142 result2 error 143 }{result1, result2} 144 } 145 146 func (fake *FakeServiceBrokerRepository) FindByGUID(guid string) (serviceBroker models.ServiceBroker, apiErr error) { 147 fake.findByGUIDMutex.Lock() 148 fake.findByGUIDArgsForCall = append(fake.findByGUIDArgsForCall, struct { 149 guid string 150 }{guid}) 151 fake.recordInvocation("FindByGUID", []interface{}{guid}) 152 fake.findByGUIDMutex.Unlock() 153 if fake.FindByGUIDStub != nil { 154 return fake.FindByGUIDStub(guid) 155 } else { 156 return fake.findByGUIDReturns.result1, fake.findByGUIDReturns.result2 157 } 158 } 159 160 func (fake *FakeServiceBrokerRepository) FindByGUIDCallCount() int { 161 fake.findByGUIDMutex.RLock() 162 defer fake.findByGUIDMutex.RUnlock() 163 return len(fake.findByGUIDArgsForCall) 164 } 165 166 func (fake *FakeServiceBrokerRepository) FindByGUIDArgsForCall(i int) string { 167 fake.findByGUIDMutex.RLock() 168 defer fake.findByGUIDMutex.RUnlock() 169 return fake.findByGUIDArgsForCall[i].guid 170 } 171 172 func (fake *FakeServiceBrokerRepository) FindByGUIDReturns(result1 models.ServiceBroker, result2 error) { 173 fake.FindByGUIDStub = nil 174 fake.findByGUIDReturns = struct { 175 result1 models.ServiceBroker 176 result2 error 177 }{result1, result2} 178 } 179 180 func (fake *FakeServiceBrokerRepository) Create(name string, url string, username string, password string, spaceGUID string) (apiErr error) { 181 fake.createMutex.Lock() 182 fake.createArgsForCall = append(fake.createArgsForCall, struct { 183 name string 184 url string 185 username string 186 password string 187 spaceGUID string 188 }{name, url, username, password, spaceGUID}) 189 fake.recordInvocation("Create", []interface{}{name, url, username, password, spaceGUID}) 190 fake.createMutex.Unlock() 191 if fake.CreateStub != nil { 192 return fake.CreateStub(name, url, username, password, spaceGUID) 193 } else { 194 return fake.createReturns.result1 195 } 196 } 197 198 func (fake *FakeServiceBrokerRepository) CreateCallCount() int { 199 fake.createMutex.RLock() 200 defer fake.createMutex.RUnlock() 201 return len(fake.createArgsForCall) 202 } 203 204 func (fake *FakeServiceBrokerRepository) CreateArgsForCall(i int) (string, string, string, string, string) { 205 fake.createMutex.RLock() 206 defer fake.createMutex.RUnlock() 207 return fake.createArgsForCall[i].name, fake.createArgsForCall[i].url, fake.createArgsForCall[i].username, fake.createArgsForCall[i].password, fake.createArgsForCall[i].spaceGUID 208 } 209 210 func (fake *FakeServiceBrokerRepository) CreateReturns(result1 error) { 211 fake.CreateStub = nil 212 fake.createReturns = struct { 213 result1 error 214 }{result1} 215 } 216 217 func (fake *FakeServiceBrokerRepository) Update(serviceBroker models.ServiceBroker) (apiErr error) { 218 fake.updateMutex.Lock() 219 fake.updateArgsForCall = append(fake.updateArgsForCall, struct { 220 serviceBroker models.ServiceBroker 221 }{serviceBroker}) 222 fake.recordInvocation("Update", []interface{}{serviceBroker}) 223 fake.updateMutex.Unlock() 224 if fake.UpdateStub != nil { 225 return fake.UpdateStub(serviceBroker) 226 } else { 227 return fake.updateReturns.result1 228 } 229 } 230 231 func (fake *FakeServiceBrokerRepository) UpdateCallCount() int { 232 fake.updateMutex.RLock() 233 defer fake.updateMutex.RUnlock() 234 return len(fake.updateArgsForCall) 235 } 236 237 func (fake *FakeServiceBrokerRepository) UpdateArgsForCall(i int) models.ServiceBroker { 238 fake.updateMutex.RLock() 239 defer fake.updateMutex.RUnlock() 240 return fake.updateArgsForCall[i].serviceBroker 241 } 242 243 func (fake *FakeServiceBrokerRepository) UpdateReturns(result1 error) { 244 fake.UpdateStub = nil 245 fake.updateReturns = struct { 246 result1 error 247 }{result1} 248 } 249 250 func (fake *FakeServiceBrokerRepository) Rename(guid string, name string) (apiErr error) { 251 fake.renameMutex.Lock() 252 fake.renameArgsForCall = append(fake.renameArgsForCall, struct { 253 guid string 254 name string 255 }{guid, name}) 256 fake.recordInvocation("Rename", []interface{}{guid, name}) 257 fake.renameMutex.Unlock() 258 if fake.RenameStub != nil { 259 return fake.RenameStub(guid, name) 260 } else { 261 return fake.renameReturns.result1 262 } 263 } 264 265 func (fake *FakeServiceBrokerRepository) RenameCallCount() int { 266 fake.renameMutex.RLock() 267 defer fake.renameMutex.RUnlock() 268 return len(fake.renameArgsForCall) 269 } 270 271 func (fake *FakeServiceBrokerRepository) RenameArgsForCall(i int) (string, string) { 272 fake.renameMutex.RLock() 273 defer fake.renameMutex.RUnlock() 274 return fake.renameArgsForCall[i].guid, fake.renameArgsForCall[i].name 275 } 276 277 func (fake *FakeServiceBrokerRepository) RenameReturns(result1 error) { 278 fake.RenameStub = nil 279 fake.renameReturns = struct { 280 result1 error 281 }{result1} 282 } 283 284 func (fake *FakeServiceBrokerRepository) Delete(guid string) (apiErr error) { 285 fake.deleteMutex.Lock() 286 fake.deleteArgsForCall = append(fake.deleteArgsForCall, struct { 287 guid string 288 }{guid}) 289 fake.recordInvocation("Delete", []interface{}{guid}) 290 fake.deleteMutex.Unlock() 291 if fake.DeleteStub != nil { 292 return fake.DeleteStub(guid) 293 } else { 294 return fake.deleteReturns.result1 295 } 296 } 297 298 func (fake *FakeServiceBrokerRepository) DeleteCallCount() int { 299 fake.deleteMutex.RLock() 300 defer fake.deleteMutex.RUnlock() 301 return len(fake.deleteArgsForCall) 302 } 303 304 func (fake *FakeServiceBrokerRepository) DeleteArgsForCall(i int) string { 305 fake.deleteMutex.RLock() 306 defer fake.deleteMutex.RUnlock() 307 return fake.deleteArgsForCall[i].guid 308 } 309 310 func (fake *FakeServiceBrokerRepository) DeleteReturns(result1 error) { 311 fake.DeleteStub = nil 312 fake.deleteReturns = struct { 313 result1 error 314 }{result1} 315 } 316 317 func (fake *FakeServiceBrokerRepository) Invocations() map[string][][]interface{} { 318 fake.invocationsMutex.RLock() 319 defer fake.invocationsMutex.RUnlock() 320 fake.listServiceBrokersMutex.RLock() 321 defer fake.listServiceBrokersMutex.RUnlock() 322 fake.findByNameMutex.RLock() 323 defer fake.findByNameMutex.RUnlock() 324 fake.findByGUIDMutex.RLock() 325 defer fake.findByGUIDMutex.RUnlock() 326 fake.createMutex.RLock() 327 defer fake.createMutex.RUnlock() 328 fake.updateMutex.RLock() 329 defer fake.updateMutex.RUnlock() 330 fake.renameMutex.RLock() 331 defer fake.renameMutex.RUnlock() 332 fake.deleteMutex.RLock() 333 defer fake.deleteMutex.RUnlock() 334 return fake.invocations 335 } 336 337 func (fake *FakeServiceBrokerRepository) recordInvocation(key string, args []interface{}) { 338 fake.invocationsMutex.Lock() 339 defer fake.invocationsMutex.Unlock() 340 if fake.invocations == nil { 341 fake.invocations = map[string][][]interface{}{} 342 } 343 if fake.invocations[key] == nil { 344 fake.invocations[key] = [][]interface{}{} 345 } 346 fake.invocations[key] = append(fake.invocations[key], args) 347 } 348 349 var _ api.ServiceBrokerRepository = new(FakeServiceBrokerRepository)