github.com/mook-as/cf-cli@v7.0.0-beta.28.0.20200120190804-b91c115fae48+incompatible/cf/api/apifakes/fake_app_summary_repository.go (about) 1 // Code generated by counterfeiter. DO NOT EDIT. 2 package apifakes 3 4 import ( 5 "sync" 6 7 "code.cloudfoundry.org/cli/cf/api" 8 "code.cloudfoundry.org/cli/cf/models" 9 ) 10 11 type FakeAppSummaryRepository struct { 12 GetSummariesInCurrentSpaceStub func() ([]models.Application, error) 13 getSummariesInCurrentSpaceMutex sync.RWMutex 14 getSummariesInCurrentSpaceArgsForCall []struct { 15 } 16 getSummariesInCurrentSpaceReturns struct { 17 result1 []models.Application 18 result2 error 19 } 20 getSummariesInCurrentSpaceReturnsOnCall map[int]struct { 21 result1 []models.Application 22 result2 error 23 } 24 GetSummaryStub func(string) (models.Application, error) 25 getSummaryMutex sync.RWMutex 26 getSummaryArgsForCall []struct { 27 arg1 string 28 } 29 getSummaryReturns struct { 30 result1 models.Application 31 result2 error 32 } 33 getSummaryReturnsOnCall map[int]struct { 34 result1 models.Application 35 result2 error 36 } 37 invocations map[string][][]interface{} 38 invocationsMutex sync.RWMutex 39 } 40 41 func (fake *FakeAppSummaryRepository) GetSummariesInCurrentSpace() ([]models.Application, error) { 42 fake.getSummariesInCurrentSpaceMutex.Lock() 43 ret, specificReturn := fake.getSummariesInCurrentSpaceReturnsOnCall[len(fake.getSummariesInCurrentSpaceArgsForCall)] 44 fake.getSummariesInCurrentSpaceArgsForCall = append(fake.getSummariesInCurrentSpaceArgsForCall, struct { 45 }{}) 46 fake.recordInvocation("GetSummariesInCurrentSpace", []interface{}{}) 47 fake.getSummariesInCurrentSpaceMutex.Unlock() 48 if fake.GetSummariesInCurrentSpaceStub != nil { 49 return fake.GetSummariesInCurrentSpaceStub() 50 } 51 if specificReturn { 52 return ret.result1, ret.result2 53 } 54 fakeReturns := fake.getSummariesInCurrentSpaceReturns 55 return fakeReturns.result1, fakeReturns.result2 56 } 57 58 func (fake *FakeAppSummaryRepository) GetSummariesInCurrentSpaceCallCount() int { 59 fake.getSummariesInCurrentSpaceMutex.RLock() 60 defer fake.getSummariesInCurrentSpaceMutex.RUnlock() 61 return len(fake.getSummariesInCurrentSpaceArgsForCall) 62 } 63 64 func (fake *FakeAppSummaryRepository) GetSummariesInCurrentSpaceCalls(stub func() ([]models.Application, error)) { 65 fake.getSummariesInCurrentSpaceMutex.Lock() 66 defer fake.getSummariesInCurrentSpaceMutex.Unlock() 67 fake.GetSummariesInCurrentSpaceStub = stub 68 } 69 70 func (fake *FakeAppSummaryRepository) GetSummariesInCurrentSpaceReturns(result1 []models.Application, result2 error) { 71 fake.getSummariesInCurrentSpaceMutex.Lock() 72 defer fake.getSummariesInCurrentSpaceMutex.Unlock() 73 fake.GetSummariesInCurrentSpaceStub = nil 74 fake.getSummariesInCurrentSpaceReturns = struct { 75 result1 []models.Application 76 result2 error 77 }{result1, result2} 78 } 79 80 func (fake *FakeAppSummaryRepository) GetSummariesInCurrentSpaceReturnsOnCall(i int, result1 []models.Application, result2 error) { 81 fake.getSummariesInCurrentSpaceMutex.Lock() 82 defer fake.getSummariesInCurrentSpaceMutex.Unlock() 83 fake.GetSummariesInCurrentSpaceStub = nil 84 if fake.getSummariesInCurrentSpaceReturnsOnCall == nil { 85 fake.getSummariesInCurrentSpaceReturnsOnCall = make(map[int]struct { 86 result1 []models.Application 87 result2 error 88 }) 89 } 90 fake.getSummariesInCurrentSpaceReturnsOnCall[i] = struct { 91 result1 []models.Application 92 result2 error 93 }{result1, result2} 94 } 95 96 func (fake *FakeAppSummaryRepository) GetSummary(arg1 string) (models.Application, error) { 97 fake.getSummaryMutex.Lock() 98 ret, specificReturn := fake.getSummaryReturnsOnCall[len(fake.getSummaryArgsForCall)] 99 fake.getSummaryArgsForCall = append(fake.getSummaryArgsForCall, struct { 100 arg1 string 101 }{arg1}) 102 fake.recordInvocation("GetSummary", []interface{}{arg1}) 103 fake.getSummaryMutex.Unlock() 104 if fake.GetSummaryStub != nil { 105 return fake.GetSummaryStub(arg1) 106 } 107 if specificReturn { 108 return ret.result1, ret.result2 109 } 110 fakeReturns := fake.getSummaryReturns 111 return fakeReturns.result1, fakeReturns.result2 112 } 113 114 func (fake *FakeAppSummaryRepository) GetSummaryCallCount() int { 115 fake.getSummaryMutex.RLock() 116 defer fake.getSummaryMutex.RUnlock() 117 return len(fake.getSummaryArgsForCall) 118 } 119 120 func (fake *FakeAppSummaryRepository) GetSummaryCalls(stub func(string) (models.Application, error)) { 121 fake.getSummaryMutex.Lock() 122 defer fake.getSummaryMutex.Unlock() 123 fake.GetSummaryStub = stub 124 } 125 126 func (fake *FakeAppSummaryRepository) GetSummaryArgsForCall(i int) string { 127 fake.getSummaryMutex.RLock() 128 defer fake.getSummaryMutex.RUnlock() 129 argsForCall := fake.getSummaryArgsForCall[i] 130 return argsForCall.arg1 131 } 132 133 func (fake *FakeAppSummaryRepository) GetSummaryReturns(result1 models.Application, result2 error) { 134 fake.getSummaryMutex.Lock() 135 defer fake.getSummaryMutex.Unlock() 136 fake.GetSummaryStub = nil 137 fake.getSummaryReturns = struct { 138 result1 models.Application 139 result2 error 140 }{result1, result2} 141 } 142 143 func (fake *FakeAppSummaryRepository) GetSummaryReturnsOnCall(i int, result1 models.Application, result2 error) { 144 fake.getSummaryMutex.Lock() 145 defer fake.getSummaryMutex.Unlock() 146 fake.GetSummaryStub = nil 147 if fake.getSummaryReturnsOnCall == nil { 148 fake.getSummaryReturnsOnCall = make(map[int]struct { 149 result1 models.Application 150 result2 error 151 }) 152 } 153 fake.getSummaryReturnsOnCall[i] = struct { 154 result1 models.Application 155 result2 error 156 }{result1, result2} 157 } 158 159 func (fake *FakeAppSummaryRepository) Invocations() map[string][][]interface{} { 160 fake.invocationsMutex.RLock() 161 defer fake.invocationsMutex.RUnlock() 162 fake.getSummariesInCurrentSpaceMutex.RLock() 163 defer fake.getSummariesInCurrentSpaceMutex.RUnlock() 164 fake.getSummaryMutex.RLock() 165 defer fake.getSummaryMutex.RUnlock() 166 copiedInvocations := map[string][][]interface{}{} 167 for key, value := range fake.invocations { 168 copiedInvocations[key] = value 169 } 170 return copiedInvocations 171 } 172 173 func (fake *FakeAppSummaryRepository) recordInvocation(key string, args []interface{}) { 174 fake.invocationsMutex.Lock() 175 defer fake.invocationsMutex.Unlock() 176 if fake.invocations == nil { 177 fake.invocations = map[string][][]interface{}{} 178 } 179 if fake.invocations[key] == nil { 180 fake.invocations[key] = [][]interface{}{} 181 } 182 fake.invocations[key] = append(fake.invocations[key], args) 183 } 184 185 var _ api.AppSummaryRepository = new(FakeAppSummaryRepository)