github.com/loggregator/cli@v6.33.1-0.20180224010324-82334f081791+incompatible/cf/api/spaces/spacesfakes/fake_space_repository.go (about) 1 // This file was generated by counterfeiter 2 package spacesfakes 3 4 import ( 5 "sync" 6 7 "code.cloudfoundry.org/cli/cf/api/spaces" 8 "code.cloudfoundry.org/cli/cf/models" 9 ) 10 11 type FakeSpaceRepository struct { 12 ListSpacesStub func(func(models.Space) bool) error 13 listSpacesMutex sync.RWMutex 14 listSpacesArgsForCall []struct { 15 arg1 func(models.Space) bool 16 } 17 listSpacesReturns struct { 18 result1 error 19 } 20 ListSpacesFromOrgStub func(orgGUID string, spaceFunc func(models.Space) bool) error 21 listSpacesFromOrgMutex sync.RWMutex 22 listSpacesFromOrgArgsForCall []struct { 23 orgGUID string 24 spaceFunc func(models.Space) bool 25 } 26 listSpacesFromOrgReturns struct { 27 result1 error 28 } 29 FindByNameStub func(name string) (space models.Space, apiErr error) 30 findByNameMutex sync.RWMutex 31 findByNameArgsForCall []struct { 32 name string 33 } 34 findByNameReturns struct { 35 result1 models.Space 36 result2 error 37 } 38 FindByNameInOrgStub func(name, orgGUID string) (space models.Space, apiErr error) 39 findByNameInOrgMutex sync.RWMutex 40 findByNameInOrgArgsForCall []struct { 41 name string 42 orgGUID string 43 } 44 findByNameInOrgReturns struct { 45 result1 models.Space 46 result2 error 47 } 48 CreateStub func(name string, orgGUID string, spaceQuotaGUID string) (space models.Space, apiErr error) 49 createMutex sync.RWMutex 50 createArgsForCall []struct { 51 name string 52 orgGUID string 53 spaceQuotaGUID string 54 } 55 createReturns struct { 56 result1 models.Space 57 result2 error 58 } 59 RenameStub func(spaceGUID, newName string) (apiErr error) 60 renameMutex sync.RWMutex 61 renameArgsForCall []struct { 62 spaceGUID string 63 newName string 64 } 65 renameReturns struct { 66 result1 error 67 } 68 SetAllowSSHStub func(spaceGUID string, allow bool) (apiErr error) 69 setAllowSSHMutex sync.RWMutex 70 setAllowSSHArgsForCall []struct { 71 spaceGUID string 72 allow bool 73 } 74 setAllowSSHReturns struct { 75 result1 error 76 } 77 DeleteStub func(spaceGUID string) (apiErr error) 78 deleteMutex sync.RWMutex 79 deleteArgsForCall []struct { 80 spaceGUID string 81 } 82 deleteReturns struct { 83 result1 error 84 } 85 invocations map[string][][]interface{} 86 invocationsMutex sync.RWMutex 87 } 88 89 func (fake *FakeSpaceRepository) ListSpaces(arg1 func(models.Space) bool) error { 90 fake.listSpacesMutex.Lock() 91 fake.listSpacesArgsForCall = append(fake.listSpacesArgsForCall, struct { 92 arg1 func(models.Space) bool 93 }{arg1}) 94 fake.recordInvocation("ListSpaces", []interface{}{arg1}) 95 fake.listSpacesMutex.Unlock() 96 if fake.ListSpacesStub != nil { 97 return fake.ListSpacesStub(arg1) 98 } else { 99 return fake.listSpacesReturns.result1 100 } 101 } 102 103 func (fake *FakeSpaceRepository) ListSpacesCallCount() int { 104 fake.listSpacesMutex.RLock() 105 defer fake.listSpacesMutex.RUnlock() 106 return len(fake.listSpacesArgsForCall) 107 } 108 109 func (fake *FakeSpaceRepository) ListSpacesArgsForCall(i int) func(models.Space) bool { 110 fake.listSpacesMutex.RLock() 111 defer fake.listSpacesMutex.RUnlock() 112 return fake.listSpacesArgsForCall[i].arg1 113 } 114 115 func (fake *FakeSpaceRepository) ListSpacesReturns(result1 error) { 116 fake.ListSpacesStub = nil 117 fake.listSpacesReturns = struct { 118 result1 error 119 }{result1} 120 } 121 122 func (fake *FakeSpaceRepository) ListSpacesFromOrg(orgGUID string, spaceFunc func(models.Space) bool) error { 123 fake.listSpacesFromOrgMutex.Lock() 124 fake.listSpacesFromOrgArgsForCall = append(fake.listSpacesFromOrgArgsForCall, struct { 125 orgGUID string 126 spaceFunc func(models.Space) bool 127 }{orgGUID, spaceFunc}) 128 fake.recordInvocation("ListSpacesFromOrg", []interface{}{orgGUID, spaceFunc}) 129 fake.listSpacesFromOrgMutex.Unlock() 130 if fake.ListSpacesFromOrgStub != nil { 131 return fake.ListSpacesFromOrgStub(orgGUID, spaceFunc) 132 } else { 133 return fake.listSpacesFromOrgReturns.result1 134 } 135 } 136 137 func (fake *FakeSpaceRepository) ListSpacesFromOrgCallCount() int { 138 fake.listSpacesFromOrgMutex.RLock() 139 defer fake.listSpacesFromOrgMutex.RUnlock() 140 return len(fake.listSpacesFromOrgArgsForCall) 141 } 142 143 func (fake *FakeSpaceRepository) ListSpacesFromOrgArgsForCall(i int) (string, func(models.Space) bool) { 144 fake.listSpacesFromOrgMutex.RLock() 145 defer fake.listSpacesFromOrgMutex.RUnlock() 146 return fake.listSpacesFromOrgArgsForCall[i].orgGUID, fake.listSpacesFromOrgArgsForCall[i].spaceFunc 147 } 148 149 func (fake *FakeSpaceRepository) ListSpacesFromOrgReturns(result1 error) { 150 fake.ListSpacesFromOrgStub = nil 151 fake.listSpacesFromOrgReturns = struct { 152 result1 error 153 }{result1} 154 } 155 156 func (fake *FakeSpaceRepository) FindByName(name string) (space models.Space, apiErr error) { 157 fake.findByNameMutex.Lock() 158 fake.findByNameArgsForCall = append(fake.findByNameArgsForCall, struct { 159 name string 160 }{name}) 161 fake.recordInvocation("FindByName", []interface{}{name}) 162 fake.findByNameMutex.Unlock() 163 if fake.FindByNameStub != nil { 164 return fake.FindByNameStub(name) 165 } else { 166 return fake.findByNameReturns.result1, fake.findByNameReturns.result2 167 } 168 } 169 170 func (fake *FakeSpaceRepository) FindByNameCallCount() int { 171 fake.findByNameMutex.RLock() 172 defer fake.findByNameMutex.RUnlock() 173 return len(fake.findByNameArgsForCall) 174 } 175 176 func (fake *FakeSpaceRepository) FindByNameArgsForCall(i int) string { 177 fake.findByNameMutex.RLock() 178 defer fake.findByNameMutex.RUnlock() 179 return fake.findByNameArgsForCall[i].name 180 } 181 182 func (fake *FakeSpaceRepository) FindByNameReturns(result1 models.Space, result2 error) { 183 fake.FindByNameStub = nil 184 fake.findByNameReturns = struct { 185 result1 models.Space 186 result2 error 187 }{result1, result2} 188 } 189 190 func (fake *FakeSpaceRepository) FindByNameInOrg(name string, orgGUID string) (space models.Space, apiErr error) { 191 fake.findByNameInOrgMutex.Lock() 192 fake.findByNameInOrgArgsForCall = append(fake.findByNameInOrgArgsForCall, struct { 193 name string 194 orgGUID string 195 }{name, orgGUID}) 196 fake.recordInvocation("FindByNameInOrg", []interface{}{name, orgGUID}) 197 fake.findByNameInOrgMutex.Unlock() 198 if fake.FindByNameInOrgStub != nil { 199 return fake.FindByNameInOrgStub(name, orgGUID) 200 } else { 201 return fake.findByNameInOrgReturns.result1, fake.findByNameInOrgReturns.result2 202 } 203 } 204 205 func (fake *FakeSpaceRepository) FindByNameInOrgCallCount() int { 206 fake.findByNameInOrgMutex.RLock() 207 defer fake.findByNameInOrgMutex.RUnlock() 208 return len(fake.findByNameInOrgArgsForCall) 209 } 210 211 func (fake *FakeSpaceRepository) FindByNameInOrgArgsForCall(i int) (string, string) { 212 fake.findByNameInOrgMutex.RLock() 213 defer fake.findByNameInOrgMutex.RUnlock() 214 return fake.findByNameInOrgArgsForCall[i].name, fake.findByNameInOrgArgsForCall[i].orgGUID 215 } 216 217 func (fake *FakeSpaceRepository) FindByNameInOrgReturns(result1 models.Space, result2 error) { 218 fake.FindByNameInOrgStub = nil 219 fake.findByNameInOrgReturns = struct { 220 result1 models.Space 221 result2 error 222 }{result1, result2} 223 } 224 225 func (fake *FakeSpaceRepository) Create(name string, orgGUID string, spaceQuotaGUID string) (space models.Space, apiErr error) { 226 fake.createMutex.Lock() 227 fake.createArgsForCall = append(fake.createArgsForCall, struct { 228 name string 229 orgGUID string 230 spaceQuotaGUID string 231 }{name, orgGUID, spaceQuotaGUID}) 232 fake.recordInvocation("Create", []interface{}{name, orgGUID, spaceQuotaGUID}) 233 fake.createMutex.Unlock() 234 if fake.CreateStub != nil { 235 return fake.CreateStub(name, orgGUID, spaceQuotaGUID) 236 } else { 237 return fake.createReturns.result1, fake.createReturns.result2 238 } 239 } 240 241 func (fake *FakeSpaceRepository) CreateCallCount() int { 242 fake.createMutex.RLock() 243 defer fake.createMutex.RUnlock() 244 return len(fake.createArgsForCall) 245 } 246 247 func (fake *FakeSpaceRepository) CreateArgsForCall(i int) (string, string, string) { 248 fake.createMutex.RLock() 249 defer fake.createMutex.RUnlock() 250 return fake.createArgsForCall[i].name, fake.createArgsForCall[i].orgGUID, fake.createArgsForCall[i].spaceQuotaGUID 251 } 252 253 func (fake *FakeSpaceRepository) CreateReturns(result1 models.Space, result2 error) { 254 fake.CreateStub = nil 255 fake.createReturns = struct { 256 result1 models.Space 257 result2 error 258 }{result1, result2} 259 } 260 261 func (fake *FakeSpaceRepository) Rename(spaceGUID string, newName string) (apiErr error) { 262 fake.renameMutex.Lock() 263 fake.renameArgsForCall = append(fake.renameArgsForCall, struct { 264 spaceGUID string 265 newName string 266 }{spaceGUID, newName}) 267 fake.recordInvocation("Rename", []interface{}{spaceGUID, newName}) 268 fake.renameMutex.Unlock() 269 if fake.RenameStub != nil { 270 return fake.RenameStub(spaceGUID, newName) 271 } else { 272 return fake.renameReturns.result1 273 } 274 } 275 276 func (fake *FakeSpaceRepository) RenameCallCount() int { 277 fake.renameMutex.RLock() 278 defer fake.renameMutex.RUnlock() 279 return len(fake.renameArgsForCall) 280 } 281 282 func (fake *FakeSpaceRepository) RenameArgsForCall(i int) (string, string) { 283 fake.renameMutex.RLock() 284 defer fake.renameMutex.RUnlock() 285 return fake.renameArgsForCall[i].spaceGUID, fake.renameArgsForCall[i].newName 286 } 287 288 func (fake *FakeSpaceRepository) RenameReturns(result1 error) { 289 fake.RenameStub = nil 290 fake.renameReturns = struct { 291 result1 error 292 }{result1} 293 } 294 295 func (fake *FakeSpaceRepository) SetAllowSSH(spaceGUID string, allow bool) (apiErr error) { 296 fake.setAllowSSHMutex.Lock() 297 fake.setAllowSSHArgsForCall = append(fake.setAllowSSHArgsForCall, struct { 298 spaceGUID string 299 allow bool 300 }{spaceGUID, allow}) 301 fake.recordInvocation("SetAllowSSH", []interface{}{spaceGUID, allow}) 302 fake.setAllowSSHMutex.Unlock() 303 if fake.SetAllowSSHStub != nil { 304 return fake.SetAllowSSHStub(spaceGUID, allow) 305 } else { 306 return fake.setAllowSSHReturns.result1 307 } 308 } 309 310 func (fake *FakeSpaceRepository) SetAllowSSHCallCount() int { 311 fake.setAllowSSHMutex.RLock() 312 defer fake.setAllowSSHMutex.RUnlock() 313 return len(fake.setAllowSSHArgsForCall) 314 } 315 316 func (fake *FakeSpaceRepository) SetAllowSSHArgsForCall(i int) (string, bool) { 317 fake.setAllowSSHMutex.RLock() 318 defer fake.setAllowSSHMutex.RUnlock() 319 return fake.setAllowSSHArgsForCall[i].spaceGUID, fake.setAllowSSHArgsForCall[i].allow 320 } 321 322 func (fake *FakeSpaceRepository) SetAllowSSHReturns(result1 error) { 323 fake.SetAllowSSHStub = nil 324 fake.setAllowSSHReturns = struct { 325 result1 error 326 }{result1} 327 } 328 329 func (fake *FakeSpaceRepository) Delete(spaceGUID string) (apiErr error) { 330 fake.deleteMutex.Lock() 331 fake.deleteArgsForCall = append(fake.deleteArgsForCall, struct { 332 spaceGUID string 333 }{spaceGUID}) 334 fake.recordInvocation("Delete", []interface{}{spaceGUID}) 335 fake.deleteMutex.Unlock() 336 if fake.DeleteStub != nil { 337 return fake.DeleteStub(spaceGUID) 338 } else { 339 return fake.deleteReturns.result1 340 } 341 } 342 343 func (fake *FakeSpaceRepository) DeleteCallCount() int { 344 fake.deleteMutex.RLock() 345 defer fake.deleteMutex.RUnlock() 346 return len(fake.deleteArgsForCall) 347 } 348 349 func (fake *FakeSpaceRepository) DeleteArgsForCall(i int) string { 350 fake.deleteMutex.RLock() 351 defer fake.deleteMutex.RUnlock() 352 return fake.deleteArgsForCall[i].spaceGUID 353 } 354 355 func (fake *FakeSpaceRepository) DeleteReturns(result1 error) { 356 fake.DeleteStub = nil 357 fake.deleteReturns = struct { 358 result1 error 359 }{result1} 360 } 361 362 func (fake *FakeSpaceRepository) Invocations() map[string][][]interface{} { 363 fake.invocationsMutex.RLock() 364 defer fake.invocationsMutex.RUnlock() 365 fake.listSpacesMutex.RLock() 366 defer fake.listSpacesMutex.RUnlock() 367 fake.listSpacesFromOrgMutex.RLock() 368 defer fake.listSpacesFromOrgMutex.RUnlock() 369 fake.findByNameMutex.RLock() 370 defer fake.findByNameMutex.RUnlock() 371 fake.findByNameInOrgMutex.RLock() 372 defer fake.findByNameInOrgMutex.RUnlock() 373 fake.createMutex.RLock() 374 defer fake.createMutex.RUnlock() 375 fake.renameMutex.RLock() 376 defer fake.renameMutex.RUnlock() 377 fake.setAllowSSHMutex.RLock() 378 defer fake.setAllowSSHMutex.RUnlock() 379 fake.deleteMutex.RLock() 380 defer fake.deleteMutex.RUnlock() 381 return fake.invocations 382 } 383 384 func (fake *FakeSpaceRepository) recordInvocation(key string, args []interface{}) { 385 fake.invocationsMutex.Lock() 386 defer fake.invocationsMutex.Unlock() 387 if fake.invocations == nil { 388 fake.invocations = map[string][][]interface{}{} 389 } 390 if fake.invocations[key] == nil { 391 fake.invocations[key] = [][]interface{}{} 392 } 393 fake.invocations[key] = append(fake.invocations[key], args) 394 } 395 396 var _ spaces.SpaceRepository = new(FakeSpaceRepository)