github.com/loggregator/cli@v6.33.1-0.20180224010324-82334f081791+incompatible/cf/api/spacequotas/spacequotasfakes/fake_space_quota_repository.go (about) 1 // This file was generated by counterfeiter 2 package spacequotasfakes 3 4 import ( 5 "sync" 6 7 "code.cloudfoundry.org/cli/cf/api/spacequotas" 8 "code.cloudfoundry.org/cli/cf/models" 9 ) 10 11 type FakeSpaceQuotaRepository struct { 12 FindByNameStub func(name string) (quota models.SpaceQuota, apiErr error) 13 findByNameMutex sync.RWMutex 14 findByNameArgsForCall []struct { 15 name string 16 } 17 findByNameReturns struct { 18 result1 models.SpaceQuota 19 result2 error 20 } 21 FindByOrgStub func(guid string) (quota []models.SpaceQuota, apiErr error) 22 findByOrgMutex sync.RWMutex 23 findByOrgArgsForCall []struct { 24 guid string 25 } 26 findByOrgReturns struct { 27 result1 []models.SpaceQuota 28 result2 error 29 } 30 FindByGUIDStub func(guid string) (quota models.SpaceQuota, apiErr error) 31 findByGUIDMutex sync.RWMutex 32 findByGUIDArgsForCall []struct { 33 guid string 34 } 35 findByGUIDReturns struct { 36 result1 models.SpaceQuota 37 result2 error 38 } 39 FindByNameAndOrgGUIDStub func(spaceQuotaName string, orgGUID string) (quota models.SpaceQuota, apiErr error) 40 findByNameAndOrgGUIDMutex sync.RWMutex 41 findByNameAndOrgGUIDArgsForCall []struct { 42 spaceQuotaName string 43 orgGUID string 44 } 45 findByNameAndOrgGUIDReturns struct { 46 result1 models.SpaceQuota 47 result2 error 48 } 49 AssociateSpaceWithQuotaStub func(spaceGUID string, quotaGUID string) error 50 associateSpaceWithQuotaMutex sync.RWMutex 51 associateSpaceWithQuotaArgsForCall []struct { 52 spaceGUID string 53 quotaGUID string 54 } 55 associateSpaceWithQuotaReturns struct { 56 result1 error 57 } 58 UnassignQuotaFromSpaceStub func(spaceGUID string, quotaGUID string) error 59 unassignQuotaFromSpaceMutex sync.RWMutex 60 unassignQuotaFromSpaceArgsForCall []struct { 61 spaceGUID string 62 quotaGUID string 63 } 64 unassignQuotaFromSpaceReturns struct { 65 result1 error 66 } 67 CreateStub func(quota models.SpaceQuota) error 68 createMutex sync.RWMutex 69 createArgsForCall []struct { 70 quota models.SpaceQuota 71 } 72 createReturns struct { 73 result1 error 74 } 75 UpdateStub func(quota models.SpaceQuota) error 76 updateMutex sync.RWMutex 77 updateArgsForCall []struct { 78 quota models.SpaceQuota 79 } 80 updateReturns struct { 81 result1 error 82 } 83 DeleteStub func(quotaGUID string) error 84 deleteMutex sync.RWMutex 85 deleteArgsForCall []struct { 86 quotaGUID string 87 } 88 deleteReturns struct { 89 result1 error 90 } 91 invocations map[string][][]interface{} 92 invocationsMutex sync.RWMutex 93 } 94 95 func (fake *FakeSpaceQuotaRepository) FindByName(name string) (quota models.SpaceQuota, apiErr error) { 96 fake.findByNameMutex.Lock() 97 fake.findByNameArgsForCall = append(fake.findByNameArgsForCall, struct { 98 name string 99 }{name}) 100 fake.recordInvocation("FindByName", []interface{}{name}) 101 fake.findByNameMutex.Unlock() 102 if fake.FindByNameStub != nil { 103 return fake.FindByNameStub(name) 104 } else { 105 return fake.findByNameReturns.result1, fake.findByNameReturns.result2 106 } 107 } 108 109 func (fake *FakeSpaceQuotaRepository) FindByNameCallCount() int { 110 fake.findByNameMutex.RLock() 111 defer fake.findByNameMutex.RUnlock() 112 return len(fake.findByNameArgsForCall) 113 } 114 115 func (fake *FakeSpaceQuotaRepository) FindByNameArgsForCall(i int) string { 116 fake.findByNameMutex.RLock() 117 defer fake.findByNameMutex.RUnlock() 118 return fake.findByNameArgsForCall[i].name 119 } 120 121 func (fake *FakeSpaceQuotaRepository) FindByNameReturns(result1 models.SpaceQuota, result2 error) { 122 fake.FindByNameStub = nil 123 fake.findByNameReturns = struct { 124 result1 models.SpaceQuota 125 result2 error 126 }{result1, result2} 127 } 128 129 func (fake *FakeSpaceQuotaRepository) FindByOrg(guid string) (quota []models.SpaceQuota, apiErr error) { 130 fake.findByOrgMutex.Lock() 131 fake.findByOrgArgsForCall = append(fake.findByOrgArgsForCall, struct { 132 guid string 133 }{guid}) 134 fake.recordInvocation("FindByOrg", []interface{}{guid}) 135 fake.findByOrgMutex.Unlock() 136 if fake.FindByOrgStub != nil { 137 return fake.FindByOrgStub(guid) 138 } else { 139 return fake.findByOrgReturns.result1, fake.findByOrgReturns.result2 140 } 141 } 142 143 func (fake *FakeSpaceQuotaRepository) FindByOrgCallCount() int { 144 fake.findByOrgMutex.RLock() 145 defer fake.findByOrgMutex.RUnlock() 146 return len(fake.findByOrgArgsForCall) 147 } 148 149 func (fake *FakeSpaceQuotaRepository) FindByOrgArgsForCall(i int) string { 150 fake.findByOrgMutex.RLock() 151 defer fake.findByOrgMutex.RUnlock() 152 return fake.findByOrgArgsForCall[i].guid 153 } 154 155 func (fake *FakeSpaceQuotaRepository) FindByOrgReturns(result1 []models.SpaceQuota, result2 error) { 156 fake.FindByOrgStub = nil 157 fake.findByOrgReturns = struct { 158 result1 []models.SpaceQuota 159 result2 error 160 }{result1, result2} 161 } 162 163 func (fake *FakeSpaceQuotaRepository) FindByGUID(guid string) (quota models.SpaceQuota, apiErr error) { 164 fake.findByGUIDMutex.Lock() 165 fake.findByGUIDArgsForCall = append(fake.findByGUIDArgsForCall, struct { 166 guid string 167 }{guid}) 168 fake.recordInvocation("FindByGUID", []interface{}{guid}) 169 fake.findByGUIDMutex.Unlock() 170 if fake.FindByGUIDStub != nil { 171 return fake.FindByGUIDStub(guid) 172 } else { 173 return fake.findByGUIDReturns.result1, fake.findByGUIDReturns.result2 174 } 175 } 176 177 func (fake *FakeSpaceQuotaRepository) FindByGUIDCallCount() int { 178 fake.findByGUIDMutex.RLock() 179 defer fake.findByGUIDMutex.RUnlock() 180 return len(fake.findByGUIDArgsForCall) 181 } 182 183 func (fake *FakeSpaceQuotaRepository) FindByGUIDArgsForCall(i int) string { 184 fake.findByGUIDMutex.RLock() 185 defer fake.findByGUIDMutex.RUnlock() 186 return fake.findByGUIDArgsForCall[i].guid 187 } 188 189 func (fake *FakeSpaceQuotaRepository) FindByGUIDReturns(result1 models.SpaceQuota, result2 error) { 190 fake.FindByGUIDStub = nil 191 fake.findByGUIDReturns = struct { 192 result1 models.SpaceQuota 193 result2 error 194 }{result1, result2} 195 } 196 197 func (fake *FakeSpaceQuotaRepository) FindByNameAndOrgGUID(spaceQuotaName string, orgGUID string) (quota models.SpaceQuota, apiErr error) { 198 fake.findByNameAndOrgGUIDMutex.Lock() 199 fake.findByNameAndOrgGUIDArgsForCall = append(fake.findByNameAndOrgGUIDArgsForCall, struct { 200 spaceQuotaName string 201 orgGUID string 202 }{spaceQuotaName, orgGUID}) 203 fake.recordInvocation("FindByNameAndOrgGUID", []interface{}{spaceQuotaName, orgGUID}) 204 fake.findByNameAndOrgGUIDMutex.Unlock() 205 if fake.FindByNameAndOrgGUIDStub != nil { 206 return fake.FindByNameAndOrgGUIDStub(spaceQuotaName, orgGUID) 207 } else { 208 return fake.findByNameAndOrgGUIDReturns.result1, fake.findByNameAndOrgGUIDReturns.result2 209 } 210 } 211 212 func (fake *FakeSpaceQuotaRepository) FindByNameAndOrgGUIDCallCount() int { 213 fake.findByNameAndOrgGUIDMutex.RLock() 214 defer fake.findByNameAndOrgGUIDMutex.RUnlock() 215 return len(fake.findByNameAndOrgGUIDArgsForCall) 216 } 217 218 func (fake *FakeSpaceQuotaRepository) FindByNameAndOrgGUIDArgsForCall(i int) (string, string) { 219 fake.findByNameAndOrgGUIDMutex.RLock() 220 defer fake.findByNameAndOrgGUIDMutex.RUnlock() 221 return fake.findByNameAndOrgGUIDArgsForCall[i].spaceQuotaName, fake.findByNameAndOrgGUIDArgsForCall[i].orgGUID 222 } 223 224 func (fake *FakeSpaceQuotaRepository) FindByNameAndOrgGUIDReturns(result1 models.SpaceQuota, result2 error) { 225 fake.FindByNameAndOrgGUIDStub = nil 226 fake.findByNameAndOrgGUIDReturns = struct { 227 result1 models.SpaceQuota 228 result2 error 229 }{result1, result2} 230 } 231 232 func (fake *FakeSpaceQuotaRepository) AssociateSpaceWithQuota(spaceGUID string, quotaGUID string) error { 233 fake.associateSpaceWithQuotaMutex.Lock() 234 fake.associateSpaceWithQuotaArgsForCall = append(fake.associateSpaceWithQuotaArgsForCall, struct { 235 spaceGUID string 236 quotaGUID string 237 }{spaceGUID, quotaGUID}) 238 fake.recordInvocation("AssociateSpaceWithQuota", []interface{}{spaceGUID, quotaGUID}) 239 fake.associateSpaceWithQuotaMutex.Unlock() 240 if fake.AssociateSpaceWithQuotaStub != nil { 241 return fake.AssociateSpaceWithQuotaStub(spaceGUID, quotaGUID) 242 } else { 243 return fake.associateSpaceWithQuotaReturns.result1 244 } 245 } 246 247 func (fake *FakeSpaceQuotaRepository) AssociateSpaceWithQuotaCallCount() int { 248 fake.associateSpaceWithQuotaMutex.RLock() 249 defer fake.associateSpaceWithQuotaMutex.RUnlock() 250 return len(fake.associateSpaceWithQuotaArgsForCall) 251 } 252 253 func (fake *FakeSpaceQuotaRepository) AssociateSpaceWithQuotaArgsForCall(i int) (string, string) { 254 fake.associateSpaceWithQuotaMutex.RLock() 255 defer fake.associateSpaceWithQuotaMutex.RUnlock() 256 return fake.associateSpaceWithQuotaArgsForCall[i].spaceGUID, fake.associateSpaceWithQuotaArgsForCall[i].quotaGUID 257 } 258 259 func (fake *FakeSpaceQuotaRepository) AssociateSpaceWithQuotaReturns(result1 error) { 260 fake.AssociateSpaceWithQuotaStub = nil 261 fake.associateSpaceWithQuotaReturns = struct { 262 result1 error 263 }{result1} 264 } 265 266 func (fake *FakeSpaceQuotaRepository) UnassignQuotaFromSpace(spaceGUID string, quotaGUID string) error { 267 fake.unassignQuotaFromSpaceMutex.Lock() 268 fake.unassignQuotaFromSpaceArgsForCall = append(fake.unassignQuotaFromSpaceArgsForCall, struct { 269 spaceGUID string 270 quotaGUID string 271 }{spaceGUID, quotaGUID}) 272 fake.recordInvocation("UnassignQuotaFromSpace", []interface{}{spaceGUID, quotaGUID}) 273 fake.unassignQuotaFromSpaceMutex.Unlock() 274 if fake.UnassignQuotaFromSpaceStub != nil { 275 return fake.UnassignQuotaFromSpaceStub(spaceGUID, quotaGUID) 276 } else { 277 return fake.unassignQuotaFromSpaceReturns.result1 278 } 279 } 280 281 func (fake *FakeSpaceQuotaRepository) UnassignQuotaFromSpaceCallCount() int { 282 fake.unassignQuotaFromSpaceMutex.RLock() 283 defer fake.unassignQuotaFromSpaceMutex.RUnlock() 284 return len(fake.unassignQuotaFromSpaceArgsForCall) 285 } 286 287 func (fake *FakeSpaceQuotaRepository) UnassignQuotaFromSpaceArgsForCall(i int) (string, string) { 288 fake.unassignQuotaFromSpaceMutex.RLock() 289 defer fake.unassignQuotaFromSpaceMutex.RUnlock() 290 return fake.unassignQuotaFromSpaceArgsForCall[i].spaceGUID, fake.unassignQuotaFromSpaceArgsForCall[i].quotaGUID 291 } 292 293 func (fake *FakeSpaceQuotaRepository) UnassignQuotaFromSpaceReturns(result1 error) { 294 fake.UnassignQuotaFromSpaceStub = nil 295 fake.unassignQuotaFromSpaceReturns = struct { 296 result1 error 297 }{result1} 298 } 299 300 func (fake *FakeSpaceQuotaRepository) Create(quota models.SpaceQuota) error { 301 fake.createMutex.Lock() 302 fake.createArgsForCall = append(fake.createArgsForCall, struct { 303 quota models.SpaceQuota 304 }{quota}) 305 fake.recordInvocation("Create", []interface{}{quota}) 306 fake.createMutex.Unlock() 307 if fake.CreateStub != nil { 308 return fake.CreateStub(quota) 309 } else { 310 return fake.createReturns.result1 311 } 312 } 313 314 func (fake *FakeSpaceQuotaRepository) CreateCallCount() int { 315 fake.createMutex.RLock() 316 defer fake.createMutex.RUnlock() 317 return len(fake.createArgsForCall) 318 } 319 320 func (fake *FakeSpaceQuotaRepository) CreateArgsForCall(i int) models.SpaceQuota { 321 fake.createMutex.RLock() 322 defer fake.createMutex.RUnlock() 323 return fake.createArgsForCall[i].quota 324 } 325 326 func (fake *FakeSpaceQuotaRepository) CreateReturns(result1 error) { 327 fake.CreateStub = nil 328 fake.createReturns = struct { 329 result1 error 330 }{result1} 331 } 332 333 func (fake *FakeSpaceQuotaRepository) Update(quota models.SpaceQuota) error { 334 fake.updateMutex.Lock() 335 fake.updateArgsForCall = append(fake.updateArgsForCall, struct { 336 quota models.SpaceQuota 337 }{quota}) 338 fake.recordInvocation("Update", []interface{}{quota}) 339 fake.updateMutex.Unlock() 340 if fake.UpdateStub != nil { 341 return fake.UpdateStub(quota) 342 } else { 343 return fake.updateReturns.result1 344 } 345 } 346 347 func (fake *FakeSpaceQuotaRepository) UpdateCallCount() int { 348 fake.updateMutex.RLock() 349 defer fake.updateMutex.RUnlock() 350 return len(fake.updateArgsForCall) 351 } 352 353 func (fake *FakeSpaceQuotaRepository) UpdateArgsForCall(i int) models.SpaceQuota { 354 fake.updateMutex.RLock() 355 defer fake.updateMutex.RUnlock() 356 return fake.updateArgsForCall[i].quota 357 } 358 359 func (fake *FakeSpaceQuotaRepository) UpdateReturns(result1 error) { 360 fake.UpdateStub = nil 361 fake.updateReturns = struct { 362 result1 error 363 }{result1} 364 } 365 366 func (fake *FakeSpaceQuotaRepository) Delete(quotaGUID string) error { 367 fake.deleteMutex.Lock() 368 fake.deleteArgsForCall = append(fake.deleteArgsForCall, struct { 369 quotaGUID string 370 }{quotaGUID}) 371 fake.recordInvocation("Delete", []interface{}{quotaGUID}) 372 fake.deleteMutex.Unlock() 373 if fake.DeleteStub != nil { 374 return fake.DeleteStub(quotaGUID) 375 } else { 376 return fake.deleteReturns.result1 377 } 378 } 379 380 func (fake *FakeSpaceQuotaRepository) DeleteCallCount() int { 381 fake.deleteMutex.RLock() 382 defer fake.deleteMutex.RUnlock() 383 return len(fake.deleteArgsForCall) 384 } 385 386 func (fake *FakeSpaceQuotaRepository) DeleteArgsForCall(i int) string { 387 fake.deleteMutex.RLock() 388 defer fake.deleteMutex.RUnlock() 389 return fake.deleteArgsForCall[i].quotaGUID 390 } 391 392 func (fake *FakeSpaceQuotaRepository) DeleteReturns(result1 error) { 393 fake.DeleteStub = nil 394 fake.deleteReturns = struct { 395 result1 error 396 }{result1} 397 } 398 399 func (fake *FakeSpaceQuotaRepository) Invocations() map[string][][]interface{} { 400 fake.invocationsMutex.RLock() 401 defer fake.invocationsMutex.RUnlock() 402 fake.findByNameMutex.RLock() 403 defer fake.findByNameMutex.RUnlock() 404 fake.findByOrgMutex.RLock() 405 defer fake.findByOrgMutex.RUnlock() 406 fake.findByGUIDMutex.RLock() 407 defer fake.findByGUIDMutex.RUnlock() 408 fake.findByNameAndOrgGUIDMutex.RLock() 409 defer fake.findByNameAndOrgGUIDMutex.RUnlock() 410 fake.associateSpaceWithQuotaMutex.RLock() 411 defer fake.associateSpaceWithQuotaMutex.RUnlock() 412 fake.unassignQuotaFromSpaceMutex.RLock() 413 defer fake.unassignQuotaFromSpaceMutex.RUnlock() 414 fake.createMutex.RLock() 415 defer fake.createMutex.RUnlock() 416 fake.updateMutex.RLock() 417 defer fake.updateMutex.RUnlock() 418 fake.deleteMutex.RLock() 419 defer fake.deleteMutex.RUnlock() 420 return fake.invocations 421 } 422 423 func (fake *FakeSpaceQuotaRepository) recordInvocation(key string, args []interface{}) { 424 fake.invocationsMutex.Lock() 425 defer fake.invocationsMutex.Unlock() 426 if fake.invocations == nil { 427 fake.invocations = map[string][][]interface{}{} 428 } 429 if fake.invocations[key] == nil { 430 fake.invocations[key] = [][]interface{}{} 431 } 432 fake.invocations[key] = append(fake.invocations[key], args) 433 } 434 435 var _ spacequotas.SpaceQuotaRepository = new(FakeSpaceQuotaRepository)