github.com/dcarley/cf-cli@v6.24.1-0.20170220111324-4225ff346898+incompatible/cf/api/quotas/quotasfakes/fake_quota_repository.go (about) 1 // This file was generated by counterfeiter 2 package quotasfakes 3 4 import ( 5 "sync" 6 7 "code.cloudfoundry.org/cli/cf/api/quotas" 8 "code.cloudfoundry.org/cli/cf/models" 9 ) 10 11 type FakeQuotaRepository struct { 12 FindAllStub func() (quotas []models.QuotaFields, apiErr error) 13 findAllMutex sync.RWMutex 14 findAllArgsForCall []struct{} 15 findAllReturns struct { 16 result1 []models.QuotaFields 17 result2 error 18 } 19 FindByNameStub func(name string) (quota models.QuotaFields, apiErr error) 20 findByNameMutex sync.RWMutex 21 findByNameArgsForCall []struct { 22 name string 23 } 24 findByNameReturns struct { 25 result1 models.QuotaFields 26 result2 error 27 } 28 AssignQuotaToOrgStub func(orgGUID, quotaGUID string) error 29 assignQuotaToOrgMutex sync.RWMutex 30 assignQuotaToOrgArgsForCall []struct { 31 orgGUID string 32 quotaGUID string 33 } 34 assignQuotaToOrgReturns struct { 35 result1 error 36 } 37 CreateStub func(quota models.QuotaFields) error 38 createMutex sync.RWMutex 39 createArgsForCall []struct { 40 quota models.QuotaFields 41 } 42 createReturns struct { 43 result1 error 44 } 45 UpdateStub func(quota models.QuotaFields) error 46 updateMutex sync.RWMutex 47 updateArgsForCall []struct { 48 quota models.QuotaFields 49 } 50 updateReturns struct { 51 result1 error 52 } 53 DeleteStub func(quotaGUID string) error 54 deleteMutex sync.RWMutex 55 deleteArgsForCall []struct { 56 quotaGUID string 57 } 58 deleteReturns struct { 59 result1 error 60 } 61 invocations map[string][][]interface{} 62 invocationsMutex sync.RWMutex 63 } 64 65 func (fake *FakeQuotaRepository) FindAll() (quotas []models.QuotaFields, apiErr error) { 66 fake.findAllMutex.Lock() 67 fake.findAllArgsForCall = append(fake.findAllArgsForCall, struct{}{}) 68 fake.recordInvocation("FindAll", []interface{}{}) 69 fake.findAllMutex.Unlock() 70 if fake.FindAllStub != nil { 71 return fake.FindAllStub() 72 } else { 73 return fake.findAllReturns.result1, fake.findAllReturns.result2 74 } 75 } 76 77 func (fake *FakeQuotaRepository) FindAllCallCount() int { 78 fake.findAllMutex.RLock() 79 defer fake.findAllMutex.RUnlock() 80 return len(fake.findAllArgsForCall) 81 } 82 83 func (fake *FakeQuotaRepository) FindAllReturns(result1 []models.QuotaFields, result2 error) { 84 fake.FindAllStub = nil 85 fake.findAllReturns = struct { 86 result1 []models.QuotaFields 87 result2 error 88 }{result1, result2} 89 } 90 91 func (fake *FakeQuotaRepository) FindByName(name string) (quota models.QuotaFields, apiErr error) { 92 fake.findByNameMutex.Lock() 93 fake.findByNameArgsForCall = append(fake.findByNameArgsForCall, struct { 94 name string 95 }{name}) 96 fake.recordInvocation("FindByName", []interface{}{name}) 97 fake.findByNameMutex.Unlock() 98 if fake.FindByNameStub != nil { 99 return fake.FindByNameStub(name) 100 } else { 101 return fake.findByNameReturns.result1, fake.findByNameReturns.result2 102 } 103 } 104 105 func (fake *FakeQuotaRepository) FindByNameCallCount() int { 106 fake.findByNameMutex.RLock() 107 defer fake.findByNameMutex.RUnlock() 108 return len(fake.findByNameArgsForCall) 109 } 110 111 func (fake *FakeQuotaRepository) FindByNameArgsForCall(i int) string { 112 fake.findByNameMutex.RLock() 113 defer fake.findByNameMutex.RUnlock() 114 return fake.findByNameArgsForCall[i].name 115 } 116 117 func (fake *FakeQuotaRepository) FindByNameReturns(result1 models.QuotaFields, result2 error) { 118 fake.FindByNameStub = nil 119 fake.findByNameReturns = struct { 120 result1 models.QuotaFields 121 result2 error 122 }{result1, result2} 123 } 124 125 func (fake *FakeQuotaRepository) AssignQuotaToOrg(orgGUID string, quotaGUID string) error { 126 fake.assignQuotaToOrgMutex.Lock() 127 fake.assignQuotaToOrgArgsForCall = append(fake.assignQuotaToOrgArgsForCall, struct { 128 orgGUID string 129 quotaGUID string 130 }{orgGUID, quotaGUID}) 131 fake.recordInvocation("AssignQuotaToOrg", []interface{}{orgGUID, quotaGUID}) 132 fake.assignQuotaToOrgMutex.Unlock() 133 if fake.AssignQuotaToOrgStub != nil { 134 return fake.AssignQuotaToOrgStub(orgGUID, quotaGUID) 135 } else { 136 return fake.assignQuotaToOrgReturns.result1 137 } 138 } 139 140 func (fake *FakeQuotaRepository) AssignQuotaToOrgCallCount() int { 141 fake.assignQuotaToOrgMutex.RLock() 142 defer fake.assignQuotaToOrgMutex.RUnlock() 143 return len(fake.assignQuotaToOrgArgsForCall) 144 } 145 146 func (fake *FakeQuotaRepository) AssignQuotaToOrgArgsForCall(i int) (string, string) { 147 fake.assignQuotaToOrgMutex.RLock() 148 defer fake.assignQuotaToOrgMutex.RUnlock() 149 return fake.assignQuotaToOrgArgsForCall[i].orgGUID, fake.assignQuotaToOrgArgsForCall[i].quotaGUID 150 } 151 152 func (fake *FakeQuotaRepository) AssignQuotaToOrgReturns(result1 error) { 153 fake.AssignQuotaToOrgStub = nil 154 fake.assignQuotaToOrgReturns = struct { 155 result1 error 156 }{result1} 157 } 158 159 func (fake *FakeQuotaRepository) Create(quota models.QuotaFields) error { 160 fake.createMutex.Lock() 161 fake.createArgsForCall = append(fake.createArgsForCall, struct { 162 quota models.QuotaFields 163 }{quota}) 164 fake.recordInvocation("Create", []interface{}{quota}) 165 fake.createMutex.Unlock() 166 if fake.CreateStub != nil { 167 return fake.CreateStub(quota) 168 } else { 169 return fake.createReturns.result1 170 } 171 } 172 173 func (fake *FakeQuotaRepository) CreateCallCount() int { 174 fake.createMutex.RLock() 175 defer fake.createMutex.RUnlock() 176 return len(fake.createArgsForCall) 177 } 178 179 func (fake *FakeQuotaRepository) CreateArgsForCall(i int) models.QuotaFields { 180 fake.createMutex.RLock() 181 defer fake.createMutex.RUnlock() 182 return fake.createArgsForCall[i].quota 183 } 184 185 func (fake *FakeQuotaRepository) CreateReturns(result1 error) { 186 fake.CreateStub = nil 187 fake.createReturns = struct { 188 result1 error 189 }{result1} 190 } 191 192 func (fake *FakeQuotaRepository) Update(quota models.QuotaFields) error { 193 fake.updateMutex.Lock() 194 fake.updateArgsForCall = append(fake.updateArgsForCall, struct { 195 quota models.QuotaFields 196 }{quota}) 197 fake.recordInvocation("Update", []interface{}{quota}) 198 fake.updateMutex.Unlock() 199 if fake.UpdateStub != nil { 200 return fake.UpdateStub(quota) 201 } else { 202 return fake.updateReturns.result1 203 } 204 } 205 206 func (fake *FakeQuotaRepository) UpdateCallCount() int { 207 fake.updateMutex.RLock() 208 defer fake.updateMutex.RUnlock() 209 return len(fake.updateArgsForCall) 210 } 211 212 func (fake *FakeQuotaRepository) UpdateArgsForCall(i int) models.QuotaFields { 213 fake.updateMutex.RLock() 214 defer fake.updateMutex.RUnlock() 215 return fake.updateArgsForCall[i].quota 216 } 217 218 func (fake *FakeQuotaRepository) UpdateReturns(result1 error) { 219 fake.UpdateStub = nil 220 fake.updateReturns = struct { 221 result1 error 222 }{result1} 223 } 224 225 func (fake *FakeQuotaRepository) Delete(quotaGUID string) error { 226 fake.deleteMutex.Lock() 227 fake.deleteArgsForCall = append(fake.deleteArgsForCall, struct { 228 quotaGUID string 229 }{quotaGUID}) 230 fake.recordInvocation("Delete", []interface{}{quotaGUID}) 231 fake.deleteMutex.Unlock() 232 if fake.DeleteStub != nil { 233 return fake.DeleteStub(quotaGUID) 234 } else { 235 return fake.deleteReturns.result1 236 } 237 } 238 239 func (fake *FakeQuotaRepository) DeleteCallCount() int { 240 fake.deleteMutex.RLock() 241 defer fake.deleteMutex.RUnlock() 242 return len(fake.deleteArgsForCall) 243 } 244 245 func (fake *FakeQuotaRepository) DeleteArgsForCall(i int) string { 246 fake.deleteMutex.RLock() 247 defer fake.deleteMutex.RUnlock() 248 return fake.deleteArgsForCall[i].quotaGUID 249 } 250 251 func (fake *FakeQuotaRepository) DeleteReturns(result1 error) { 252 fake.DeleteStub = nil 253 fake.deleteReturns = struct { 254 result1 error 255 }{result1} 256 } 257 258 func (fake *FakeQuotaRepository) Invocations() map[string][][]interface{} { 259 fake.invocationsMutex.RLock() 260 defer fake.invocationsMutex.RUnlock() 261 fake.findAllMutex.RLock() 262 defer fake.findAllMutex.RUnlock() 263 fake.findByNameMutex.RLock() 264 defer fake.findByNameMutex.RUnlock() 265 fake.assignQuotaToOrgMutex.RLock() 266 defer fake.assignQuotaToOrgMutex.RUnlock() 267 fake.createMutex.RLock() 268 defer fake.createMutex.RUnlock() 269 fake.updateMutex.RLock() 270 defer fake.updateMutex.RUnlock() 271 fake.deleteMutex.RLock() 272 defer fake.deleteMutex.RUnlock() 273 return fake.invocations 274 } 275 276 func (fake *FakeQuotaRepository) recordInvocation(key string, args []interface{}) { 277 fake.invocationsMutex.Lock() 278 defer fake.invocationsMutex.Unlock() 279 if fake.invocations == nil { 280 fake.invocations = map[string][][]interface{}{} 281 } 282 if fake.invocations[key] == nil { 283 fake.invocations[key] = [][]interface{}{} 284 } 285 fake.invocations[key] = append(fake.invocations[key], args) 286 } 287 288 var _ quotas.QuotaRepository = new(FakeQuotaRepository)