github.com/loggregator/cli@v6.33.1-0.20180224010324-82334f081791+incompatible/cf/api/appevents/appeventsfakes/fake_repository.go (about) 1 // This file was generated by counterfeiter 2 package appeventsfakes 3 4 import ( 5 "sync" 6 7 "code.cloudfoundry.org/cli/cf/api/appevents" 8 "code.cloudfoundry.org/cli/cf/models" 9 ) 10 11 type FakeRepository struct { 12 RecentEventsStub func(appGUID string, limit int64) ([]models.EventFields, error) 13 recentEventsMutex sync.RWMutex 14 recentEventsArgsForCall []struct { 15 appGUID string 16 limit int64 17 } 18 recentEventsReturns struct { 19 result1 []models.EventFields 20 result2 error 21 } 22 invocations map[string][][]interface{} 23 invocationsMutex sync.RWMutex 24 } 25 26 func (fake *FakeRepository) RecentEvents(appGUID string, limit int64) ([]models.EventFields, error) { 27 fake.recentEventsMutex.Lock() 28 fake.recentEventsArgsForCall = append(fake.recentEventsArgsForCall, struct { 29 appGUID string 30 limit int64 31 }{appGUID, limit}) 32 fake.recordInvocation("RecentEvents", []interface{}{appGUID, limit}) 33 fake.recentEventsMutex.Unlock() 34 if fake.RecentEventsStub != nil { 35 return fake.RecentEventsStub(appGUID, limit) 36 } else { 37 return fake.recentEventsReturns.result1, fake.recentEventsReturns.result2 38 } 39 } 40 41 func (fake *FakeRepository) RecentEventsCallCount() int { 42 fake.recentEventsMutex.RLock() 43 defer fake.recentEventsMutex.RUnlock() 44 return len(fake.recentEventsArgsForCall) 45 } 46 47 func (fake *FakeRepository) RecentEventsArgsForCall(i int) (string, int64) { 48 fake.recentEventsMutex.RLock() 49 defer fake.recentEventsMutex.RUnlock() 50 return fake.recentEventsArgsForCall[i].appGUID, fake.recentEventsArgsForCall[i].limit 51 } 52 53 func (fake *FakeRepository) RecentEventsReturns(result1 []models.EventFields, result2 error) { 54 fake.RecentEventsStub = nil 55 fake.recentEventsReturns = struct { 56 result1 []models.EventFields 57 result2 error 58 }{result1, result2} 59 } 60 61 func (fake *FakeRepository) Invocations() map[string][][]interface{} { 62 fake.invocationsMutex.RLock() 63 defer fake.invocationsMutex.RUnlock() 64 fake.recentEventsMutex.RLock() 65 defer fake.recentEventsMutex.RUnlock() 66 return fake.invocations 67 } 68 69 func (fake *FakeRepository) recordInvocation(key string, args []interface{}) { 70 fake.invocationsMutex.Lock() 71 defer fake.invocationsMutex.Unlock() 72 if fake.invocations == nil { 73 fake.invocations = map[string][][]interface{}{} 74 } 75 if fake.invocations[key] == nil { 76 fake.invocations[key] = [][]interface{}{} 77 } 78 fake.invocations[key] = append(fake.invocations[key], args) 79 } 80 81 var _ appevents.Repository = new(FakeRepository)