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