github.com/mook-as/cf-cli@v7.0.0-beta.28.0.20200120190804-b91c115fae48+incompatible/cf/api/apifakes/fake_service_plan_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 FakeServicePlanRepository struct { 12 ListPlansFromManyServicesStub func([]string) ([]models.ServicePlanFields, error) 13 listPlansFromManyServicesMutex sync.RWMutex 14 listPlansFromManyServicesArgsForCall []struct { 15 arg1 []string 16 } 17 listPlansFromManyServicesReturns struct { 18 result1 []models.ServicePlanFields 19 result2 error 20 } 21 listPlansFromManyServicesReturnsOnCall map[int]struct { 22 result1 []models.ServicePlanFields 23 result2 error 24 } 25 SearchStub func(map[string]string) ([]models.ServicePlanFields, error) 26 searchMutex sync.RWMutex 27 searchArgsForCall []struct { 28 arg1 map[string]string 29 } 30 searchReturns struct { 31 result1 []models.ServicePlanFields 32 result2 error 33 } 34 searchReturnsOnCall map[int]struct { 35 result1 []models.ServicePlanFields 36 result2 error 37 } 38 UpdateStub func(models.ServicePlanFields, string, bool) error 39 updateMutex sync.RWMutex 40 updateArgsForCall []struct { 41 arg1 models.ServicePlanFields 42 arg2 string 43 arg3 bool 44 } 45 updateReturns struct { 46 result1 error 47 } 48 updateReturnsOnCall map[int]struct { 49 result1 error 50 } 51 invocations map[string][][]interface{} 52 invocationsMutex sync.RWMutex 53 } 54 55 func (fake *FakeServicePlanRepository) ListPlansFromManyServices(arg1 []string) ([]models.ServicePlanFields, error) { 56 var arg1Copy []string 57 if arg1 != nil { 58 arg1Copy = make([]string, len(arg1)) 59 copy(arg1Copy, arg1) 60 } 61 fake.listPlansFromManyServicesMutex.Lock() 62 ret, specificReturn := fake.listPlansFromManyServicesReturnsOnCall[len(fake.listPlansFromManyServicesArgsForCall)] 63 fake.listPlansFromManyServicesArgsForCall = append(fake.listPlansFromManyServicesArgsForCall, struct { 64 arg1 []string 65 }{arg1Copy}) 66 fake.recordInvocation("ListPlansFromManyServices", []interface{}{arg1Copy}) 67 fake.listPlansFromManyServicesMutex.Unlock() 68 if fake.ListPlansFromManyServicesStub != nil { 69 return fake.ListPlansFromManyServicesStub(arg1) 70 } 71 if specificReturn { 72 return ret.result1, ret.result2 73 } 74 fakeReturns := fake.listPlansFromManyServicesReturns 75 return fakeReturns.result1, fakeReturns.result2 76 } 77 78 func (fake *FakeServicePlanRepository) ListPlansFromManyServicesCallCount() int { 79 fake.listPlansFromManyServicesMutex.RLock() 80 defer fake.listPlansFromManyServicesMutex.RUnlock() 81 return len(fake.listPlansFromManyServicesArgsForCall) 82 } 83 84 func (fake *FakeServicePlanRepository) ListPlansFromManyServicesCalls(stub func([]string) ([]models.ServicePlanFields, error)) { 85 fake.listPlansFromManyServicesMutex.Lock() 86 defer fake.listPlansFromManyServicesMutex.Unlock() 87 fake.ListPlansFromManyServicesStub = stub 88 } 89 90 func (fake *FakeServicePlanRepository) ListPlansFromManyServicesArgsForCall(i int) []string { 91 fake.listPlansFromManyServicesMutex.RLock() 92 defer fake.listPlansFromManyServicesMutex.RUnlock() 93 argsForCall := fake.listPlansFromManyServicesArgsForCall[i] 94 return argsForCall.arg1 95 } 96 97 func (fake *FakeServicePlanRepository) ListPlansFromManyServicesReturns(result1 []models.ServicePlanFields, result2 error) { 98 fake.listPlansFromManyServicesMutex.Lock() 99 defer fake.listPlansFromManyServicesMutex.Unlock() 100 fake.ListPlansFromManyServicesStub = nil 101 fake.listPlansFromManyServicesReturns = struct { 102 result1 []models.ServicePlanFields 103 result2 error 104 }{result1, result2} 105 } 106 107 func (fake *FakeServicePlanRepository) ListPlansFromManyServicesReturnsOnCall(i int, result1 []models.ServicePlanFields, result2 error) { 108 fake.listPlansFromManyServicesMutex.Lock() 109 defer fake.listPlansFromManyServicesMutex.Unlock() 110 fake.ListPlansFromManyServicesStub = nil 111 if fake.listPlansFromManyServicesReturnsOnCall == nil { 112 fake.listPlansFromManyServicesReturnsOnCall = make(map[int]struct { 113 result1 []models.ServicePlanFields 114 result2 error 115 }) 116 } 117 fake.listPlansFromManyServicesReturnsOnCall[i] = struct { 118 result1 []models.ServicePlanFields 119 result2 error 120 }{result1, result2} 121 } 122 123 func (fake *FakeServicePlanRepository) Search(arg1 map[string]string) ([]models.ServicePlanFields, error) { 124 fake.searchMutex.Lock() 125 ret, specificReturn := fake.searchReturnsOnCall[len(fake.searchArgsForCall)] 126 fake.searchArgsForCall = append(fake.searchArgsForCall, struct { 127 arg1 map[string]string 128 }{arg1}) 129 fake.recordInvocation("Search", []interface{}{arg1}) 130 fake.searchMutex.Unlock() 131 if fake.SearchStub != nil { 132 return fake.SearchStub(arg1) 133 } 134 if specificReturn { 135 return ret.result1, ret.result2 136 } 137 fakeReturns := fake.searchReturns 138 return fakeReturns.result1, fakeReturns.result2 139 } 140 141 func (fake *FakeServicePlanRepository) SearchCallCount() int { 142 fake.searchMutex.RLock() 143 defer fake.searchMutex.RUnlock() 144 return len(fake.searchArgsForCall) 145 } 146 147 func (fake *FakeServicePlanRepository) SearchCalls(stub func(map[string]string) ([]models.ServicePlanFields, error)) { 148 fake.searchMutex.Lock() 149 defer fake.searchMutex.Unlock() 150 fake.SearchStub = stub 151 } 152 153 func (fake *FakeServicePlanRepository) SearchArgsForCall(i int) map[string]string { 154 fake.searchMutex.RLock() 155 defer fake.searchMutex.RUnlock() 156 argsForCall := fake.searchArgsForCall[i] 157 return argsForCall.arg1 158 } 159 160 func (fake *FakeServicePlanRepository) SearchReturns(result1 []models.ServicePlanFields, result2 error) { 161 fake.searchMutex.Lock() 162 defer fake.searchMutex.Unlock() 163 fake.SearchStub = nil 164 fake.searchReturns = struct { 165 result1 []models.ServicePlanFields 166 result2 error 167 }{result1, result2} 168 } 169 170 func (fake *FakeServicePlanRepository) SearchReturnsOnCall(i int, result1 []models.ServicePlanFields, result2 error) { 171 fake.searchMutex.Lock() 172 defer fake.searchMutex.Unlock() 173 fake.SearchStub = nil 174 if fake.searchReturnsOnCall == nil { 175 fake.searchReturnsOnCall = make(map[int]struct { 176 result1 []models.ServicePlanFields 177 result2 error 178 }) 179 } 180 fake.searchReturnsOnCall[i] = struct { 181 result1 []models.ServicePlanFields 182 result2 error 183 }{result1, result2} 184 } 185 186 func (fake *FakeServicePlanRepository) Update(arg1 models.ServicePlanFields, arg2 string, arg3 bool) error { 187 fake.updateMutex.Lock() 188 ret, specificReturn := fake.updateReturnsOnCall[len(fake.updateArgsForCall)] 189 fake.updateArgsForCall = append(fake.updateArgsForCall, struct { 190 arg1 models.ServicePlanFields 191 arg2 string 192 arg3 bool 193 }{arg1, arg2, arg3}) 194 fake.recordInvocation("Update", []interface{}{arg1, arg2, arg3}) 195 fake.updateMutex.Unlock() 196 if fake.UpdateStub != nil { 197 return fake.UpdateStub(arg1, arg2, arg3) 198 } 199 if specificReturn { 200 return ret.result1 201 } 202 fakeReturns := fake.updateReturns 203 return fakeReturns.result1 204 } 205 206 func (fake *FakeServicePlanRepository) UpdateCallCount() int { 207 fake.updateMutex.RLock() 208 defer fake.updateMutex.RUnlock() 209 return len(fake.updateArgsForCall) 210 } 211 212 func (fake *FakeServicePlanRepository) UpdateCalls(stub func(models.ServicePlanFields, string, bool) error) { 213 fake.updateMutex.Lock() 214 defer fake.updateMutex.Unlock() 215 fake.UpdateStub = stub 216 } 217 218 func (fake *FakeServicePlanRepository) UpdateArgsForCall(i int) (models.ServicePlanFields, string, bool) { 219 fake.updateMutex.RLock() 220 defer fake.updateMutex.RUnlock() 221 argsForCall := fake.updateArgsForCall[i] 222 return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3 223 } 224 225 func (fake *FakeServicePlanRepository) UpdateReturns(result1 error) { 226 fake.updateMutex.Lock() 227 defer fake.updateMutex.Unlock() 228 fake.UpdateStub = nil 229 fake.updateReturns = struct { 230 result1 error 231 }{result1} 232 } 233 234 func (fake *FakeServicePlanRepository) UpdateReturnsOnCall(i int, result1 error) { 235 fake.updateMutex.Lock() 236 defer fake.updateMutex.Unlock() 237 fake.UpdateStub = nil 238 if fake.updateReturnsOnCall == nil { 239 fake.updateReturnsOnCall = make(map[int]struct { 240 result1 error 241 }) 242 } 243 fake.updateReturnsOnCall[i] = struct { 244 result1 error 245 }{result1} 246 } 247 248 func (fake *FakeServicePlanRepository) Invocations() map[string][][]interface{} { 249 fake.invocationsMutex.RLock() 250 defer fake.invocationsMutex.RUnlock() 251 fake.listPlansFromManyServicesMutex.RLock() 252 defer fake.listPlansFromManyServicesMutex.RUnlock() 253 fake.searchMutex.RLock() 254 defer fake.searchMutex.RUnlock() 255 fake.updateMutex.RLock() 256 defer fake.updateMutex.RUnlock() 257 copiedInvocations := map[string][][]interface{}{} 258 for key, value := range fake.invocations { 259 copiedInvocations[key] = value 260 } 261 return copiedInvocations 262 } 263 264 func (fake *FakeServicePlanRepository) recordInvocation(key string, args []interface{}) { 265 fake.invocationsMutex.Lock() 266 defer fake.invocationsMutex.Unlock() 267 if fake.invocations == nil { 268 fake.invocations = map[string][][]interface{}{} 269 } 270 if fake.invocations[key] == nil { 271 fake.invocations[key] = [][]interface{}{} 272 } 273 fake.invocations[key] = append(fake.invocations[key], args) 274 } 275 276 var _ api.ServicePlanRepository = new(FakeServicePlanRepository)