github.com/loggregator/cli@v6.33.1-0.20180224010324-82334f081791+incompatible/cf/api/applications/applicationsfakes/fake_repository.go (about) 1 // This file was generated by counterfeiter 2 package applicationsfakes 3 4 import ( 5 "sync" 6 7 "code.cloudfoundry.org/cli/cf/api/applications" 8 "code.cloudfoundry.org/cli/cf/models" 9 ) 10 11 type FakeRepository struct { 12 CreateStub func(params models.AppParams) (createdApp models.Application, apiErr error) 13 createMutex sync.RWMutex 14 createArgsForCall []struct { 15 params models.AppParams 16 } 17 createReturns struct { 18 result1 models.Application 19 result2 error 20 } 21 GetAppStub func(appGUID string) (models.Application, error) 22 getAppMutex sync.RWMutex 23 getAppArgsForCall []struct { 24 appGUID string 25 } 26 getAppReturns struct { 27 result1 models.Application 28 result2 error 29 } 30 ReadStub func(name string) (app models.Application, apiErr error) 31 readMutex sync.RWMutex 32 readArgsForCall []struct { 33 name string 34 } 35 readReturns struct { 36 result1 models.Application 37 result2 error 38 } 39 ReadFromSpaceStub func(name string, spaceGUID string) (app models.Application, apiErr error) 40 readFromSpaceMutex sync.RWMutex 41 readFromSpaceArgsForCall []struct { 42 name string 43 spaceGUID string 44 } 45 readFromSpaceReturns struct { 46 result1 models.Application 47 result2 error 48 } 49 UpdateStub func(appGUID string, params models.AppParams) (updatedApp models.Application, apiErr error) 50 updateMutex sync.RWMutex 51 updateArgsForCall []struct { 52 appGUID string 53 params models.AppParams 54 } 55 updateReturns struct { 56 result1 models.Application 57 result2 error 58 } 59 DeleteStub func(appGUID string) (apiErr error) 60 deleteMutex sync.RWMutex 61 deleteArgsForCall []struct { 62 appGUID string 63 } 64 deleteReturns struct { 65 result1 error 66 } 67 ReadEnvStub func(guid string) (*models.Environment, error) 68 readEnvMutex sync.RWMutex 69 readEnvArgsForCall []struct { 70 guid string 71 } 72 readEnvReturns struct { 73 result1 *models.Environment 74 result2 error 75 } 76 CreateRestageRequestStub func(guid string) (apiErr error) 77 createRestageRequestMutex sync.RWMutex 78 createRestageRequestArgsForCall []struct { 79 guid string 80 } 81 createRestageRequestReturns struct { 82 result1 error 83 } 84 invocations map[string][][]interface{} 85 invocationsMutex sync.RWMutex 86 } 87 88 func (fake *FakeRepository) Create(params models.AppParams) (createdApp models.Application, apiErr error) { 89 fake.createMutex.Lock() 90 fake.createArgsForCall = append(fake.createArgsForCall, struct { 91 params models.AppParams 92 }{params}) 93 fake.recordInvocation("Create", []interface{}{params}) 94 fake.createMutex.Unlock() 95 if fake.CreateStub != nil { 96 return fake.CreateStub(params) 97 } else { 98 return fake.createReturns.result1, fake.createReturns.result2 99 } 100 } 101 102 func (fake *FakeRepository) CreateCallCount() int { 103 fake.createMutex.RLock() 104 defer fake.createMutex.RUnlock() 105 return len(fake.createArgsForCall) 106 } 107 108 func (fake *FakeRepository) CreateArgsForCall(i int) models.AppParams { 109 fake.createMutex.RLock() 110 defer fake.createMutex.RUnlock() 111 return fake.createArgsForCall[i].params 112 } 113 114 func (fake *FakeRepository) CreateReturns(result1 models.Application, result2 error) { 115 fake.CreateStub = nil 116 fake.createReturns = struct { 117 result1 models.Application 118 result2 error 119 }{result1, result2} 120 } 121 122 func (fake *FakeRepository) GetApp(appGUID string) (models.Application, error) { 123 fake.getAppMutex.Lock() 124 fake.getAppArgsForCall = append(fake.getAppArgsForCall, struct { 125 appGUID string 126 }{appGUID}) 127 fake.recordInvocation("GetApp", []interface{}{appGUID}) 128 fake.getAppMutex.Unlock() 129 if fake.GetAppStub != nil { 130 return fake.GetAppStub(appGUID) 131 } else { 132 return fake.getAppReturns.result1, fake.getAppReturns.result2 133 } 134 } 135 136 func (fake *FakeRepository) GetAppCallCount() int { 137 fake.getAppMutex.RLock() 138 defer fake.getAppMutex.RUnlock() 139 return len(fake.getAppArgsForCall) 140 } 141 142 func (fake *FakeRepository) GetAppArgsForCall(i int) string { 143 fake.getAppMutex.RLock() 144 defer fake.getAppMutex.RUnlock() 145 return fake.getAppArgsForCall[i].appGUID 146 } 147 148 func (fake *FakeRepository) GetAppReturns(result1 models.Application, result2 error) { 149 fake.GetAppStub = nil 150 fake.getAppReturns = struct { 151 result1 models.Application 152 result2 error 153 }{result1, result2} 154 } 155 156 func (fake *FakeRepository) Read(name string) (app models.Application, apiErr error) { 157 fake.readMutex.Lock() 158 fake.readArgsForCall = append(fake.readArgsForCall, struct { 159 name string 160 }{name}) 161 fake.recordInvocation("Read", []interface{}{name}) 162 fake.readMutex.Unlock() 163 if fake.ReadStub != nil { 164 return fake.ReadStub(name) 165 } else { 166 return fake.readReturns.result1, fake.readReturns.result2 167 } 168 } 169 170 func (fake *FakeRepository) ReadCallCount() int { 171 fake.readMutex.RLock() 172 defer fake.readMutex.RUnlock() 173 return len(fake.readArgsForCall) 174 } 175 176 func (fake *FakeRepository) ReadArgsForCall(i int) string { 177 fake.readMutex.RLock() 178 defer fake.readMutex.RUnlock() 179 return fake.readArgsForCall[i].name 180 } 181 182 func (fake *FakeRepository) ReadReturns(result1 models.Application, result2 error) { 183 fake.ReadStub = nil 184 fake.readReturns = struct { 185 result1 models.Application 186 result2 error 187 }{result1, result2} 188 } 189 190 func (fake *FakeRepository) ReadFromSpace(name string, spaceGUID string) (app models.Application, apiErr error) { 191 fake.readFromSpaceMutex.Lock() 192 fake.readFromSpaceArgsForCall = append(fake.readFromSpaceArgsForCall, struct { 193 name string 194 spaceGUID string 195 }{name, spaceGUID}) 196 fake.recordInvocation("ReadFromSpace", []interface{}{name, spaceGUID}) 197 fake.readFromSpaceMutex.Unlock() 198 if fake.ReadFromSpaceStub != nil { 199 return fake.ReadFromSpaceStub(name, spaceGUID) 200 } else { 201 return fake.readFromSpaceReturns.result1, fake.readFromSpaceReturns.result2 202 } 203 } 204 205 func (fake *FakeRepository) ReadFromSpaceCallCount() int { 206 fake.readFromSpaceMutex.RLock() 207 defer fake.readFromSpaceMutex.RUnlock() 208 return len(fake.readFromSpaceArgsForCall) 209 } 210 211 func (fake *FakeRepository) ReadFromSpaceArgsForCall(i int) (string, string) { 212 fake.readFromSpaceMutex.RLock() 213 defer fake.readFromSpaceMutex.RUnlock() 214 return fake.readFromSpaceArgsForCall[i].name, fake.readFromSpaceArgsForCall[i].spaceGUID 215 } 216 217 func (fake *FakeRepository) ReadFromSpaceReturns(result1 models.Application, result2 error) { 218 fake.ReadFromSpaceStub = nil 219 fake.readFromSpaceReturns = struct { 220 result1 models.Application 221 result2 error 222 }{result1, result2} 223 } 224 225 func (fake *FakeRepository) Update(appGUID string, params models.AppParams) (updatedApp models.Application, apiErr error) { 226 fake.updateMutex.Lock() 227 fake.updateArgsForCall = append(fake.updateArgsForCall, struct { 228 appGUID string 229 params models.AppParams 230 }{appGUID, params}) 231 fake.recordInvocation("Update", []interface{}{appGUID, params}) 232 fake.updateMutex.Unlock() 233 if fake.UpdateStub != nil { 234 return fake.UpdateStub(appGUID, params) 235 } else { 236 return fake.updateReturns.result1, fake.updateReturns.result2 237 } 238 } 239 240 func (fake *FakeRepository) UpdateCallCount() int { 241 fake.updateMutex.RLock() 242 defer fake.updateMutex.RUnlock() 243 return len(fake.updateArgsForCall) 244 } 245 246 func (fake *FakeRepository) UpdateArgsForCall(i int) (string, models.AppParams) { 247 fake.updateMutex.RLock() 248 defer fake.updateMutex.RUnlock() 249 return fake.updateArgsForCall[i].appGUID, fake.updateArgsForCall[i].params 250 } 251 252 func (fake *FakeRepository) UpdateReturns(result1 models.Application, result2 error) { 253 fake.UpdateStub = nil 254 fake.updateReturns = struct { 255 result1 models.Application 256 result2 error 257 }{result1, result2} 258 } 259 260 func (fake *FakeRepository) Delete(appGUID string) (apiErr error) { 261 fake.deleteMutex.Lock() 262 fake.deleteArgsForCall = append(fake.deleteArgsForCall, struct { 263 appGUID string 264 }{appGUID}) 265 fake.recordInvocation("Delete", []interface{}{appGUID}) 266 fake.deleteMutex.Unlock() 267 if fake.DeleteStub != nil { 268 return fake.DeleteStub(appGUID) 269 } else { 270 return fake.deleteReturns.result1 271 } 272 } 273 274 func (fake *FakeRepository) DeleteCallCount() int { 275 fake.deleteMutex.RLock() 276 defer fake.deleteMutex.RUnlock() 277 return len(fake.deleteArgsForCall) 278 } 279 280 func (fake *FakeRepository) DeleteArgsForCall(i int) string { 281 fake.deleteMutex.RLock() 282 defer fake.deleteMutex.RUnlock() 283 return fake.deleteArgsForCall[i].appGUID 284 } 285 286 func (fake *FakeRepository) DeleteReturns(result1 error) { 287 fake.DeleteStub = nil 288 fake.deleteReturns = struct { 289 result1 error 290 }{result1} 291 } 292 293 func (fake *FakeRepository) ReadEnv(guid string) (*models.Environment, error) { 294 fake.readEnvMutex.Lock() 295 fake.readEnvArgsForCall = append(fake.readEnvArgsForCall, struct { 296 guid string 297 }{guid}) 298 fake.recordInvocation("ReadEnv", []interface{}{guid}) 299 fake.readEnvMutex.Unlock() 300 if fake.ReadEnvStub != nil { 301 return fake.ReadEnvStub(guid) 302 } else { 303 return fake.readEnvReturns.result1, fake.readEnvReturns.result2 304 } 305 } 306 307 func (fake *FakeRepository) ReadEnvCallCount() int { 308 fake.readEnvMutex.RLock() 309 defer fake.readEnvMutex.RUnlock() 310 return len(fake.readEnvArgsForCall) 311 } 312 313 func (fake *FakeRepository) ReadEnvArgsForCall(i int) string { 314 fake.readEnvMutex.RLock() 315 defer fake.readEnvMutex.RUnlock() 316 return fake.readEnvArgsForCall[i].guid 317 } 318 319 func (fake *FakeRepository) ReadEnvReturns(result1 *models.Environment, result2 error) { 320 fake.ReadEnvStub = nil 321 fake.readEnvReturns = struct { 322 result1 *models.Environment 323 result2 error 324 }{result1, result2} 325 } 326 327 func (fake *FakeRepository) CreateRestageRequest(guid string) (apiErr error) { 328 fake.createRestageRequestMutex.Lock() 329 fake.createRestageRequestArgsForCall = append(fake.createRestageRequestArgsForCall, struct { 330 guid string 331 }{guid}) 332 fake.recordInvocation("CreateRestageRequest", []interface{}{guid}) 333 fake.createRestageRequestMutex.Unlock() 334 if fake.CreateRestageRequestStub != nil { 335 return fake.CreateRestageRequestStub(guid) 336 } else { 337 return fake.createRestageRequestReturns.result1 338 } 339 } 340 341 func (fake *FakeRepository) CreateRestageRequestCallCount() int { 342 fake.createRestageRequestMutex.RLock() 343 defer fake.createRestageRequestMutex.RUnlock() 344 return len(fake.createRestageRequestArgsForCall) 345 } 346 347 func (fake *FakeRepository) CreateRestageRequestArgsForCall(i int) string { 348 fake.createRestageRequestMutex.RLock() 349 defer fake.createRestageRequestMutex.RUnlock() 350 return fake.createRestageRequestArgsForCall[i].guid 351 } 352 353 func (fake *FakeRepository) CreateRestageRequestReturns(result1 error) { 354 fake.CreateRestageRequestStub = nil 355 fake.createRestageRequestReturns = struct { 356 result1 error 357 }{result1} 358 } 359 360 func (fake *FakeRepository) Invocations() map[string][][]interface{} { 361 fake.invocationsMutex.RLock() 362 defer fake.invocationsMutex.RUnlock() 363 fake.createMutex.RLock() 364 defer fake.createMutex.RUnlock() 365 fake.getAppMutex.RLock() 366 defer fake.getAppMutex.RUnlock() 367 fake.readMutex.RLock() 368 defer fake.readMutex.RUnlock() 369 fake.readFromSpaceMutex.RLock() 370 defer fake.readFromSpaceMutex.RUnlock() 371 fake.updateMutex.RLock() 372 defer fake.updateMutex.RUnlock() 373 fake.deleteMutex.RLock() 374 defer fake.deleteMutex.RUnlock() 375 fake.readEnvMutex.RLock() 376 defer fake.readEnvMutex.RUnlock() 377 fake.createRestageRequestMutex.RLock() 378 defer fake.createRestageRequestMutex.RUnlock() 379 return fake.invocations 380 } 381 382 func (fake *FakeRepository) recordInvocation(key string, args []interface{}) { 383 fake.invocationsMutex.Lock() 384 defer fake.invocationsMutex.Unlock() 385 if fake.invocations == nil { 386 fake.invocations = map[string][][]interface{}{} 387 } 388 if fake.invocations[key] == nil { 389 fake.invocations[key] = [][]interface{}{} 390 } 391 fake.invocations[key] = append(fake.invocations[key], args) 392 } 393 394 var _ applications.Repository = new(FakeRepository)