github.com/loggregator/cli@v6.33.1-0.20180224010324-82334f081791+incompatible/cf/api/apifakes/fake_service_binding_repository.go (about) 1 // This file was generated by counterfeiter 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(instanceGUID string, appGUID string, paramsMap map[string]interface{}) error 13 createMutex sync.RWMutex 14 createArgsForCall []struct { 15 instanceGUID string 16 appGUID string 17 paramsMap map[string]interface{} 18 } 19 createReturns struct { 20 result1 error 21 } 22 DeleteStub func(instance models.ServiceInstance, appGUID string) (bool, error) 23 deleteMutex sync.RWMutex 24 deleteArgsForCall []struct { 25 instance models.ServiceInstance 26 appGUID string 27 } 28 deleteReturns struct { 29 result1 bool 30 result2 error 31 } 32 ListAllForServiceStub func(instanceGUID string) ([]models.ServiceBindingFields, error) 33 listAllForServiceMutex sync.RWMutex 34 listAllForServiceArgsForCall []struct { 35 instanceGUID string 36 } 37 listAllForServiceReturns struct { 38 result1 []models.ServiceBindingFields 39 result2 error 40 } 41 invocations map[string][][]interface{} 42 invocationsMutex sync.RWMutex 43 } 44 45 func (fake *FakeServiceBindingRepository) Create(instanceGUID string, appGUID string, paramsMap map[string]interface{}) error { 46 fake.createMutex.Lock() 47 fake.createArgsForCall = append(fake.createArgsForCall, struct { 48 instanceGUID string 49 appGUID string 50 paramsMap map[string]interface{} 51 }{instanceGUID, appGUID, paramsMap}) 52 fake.recordInvocation("Create", []interface{}{instanceGUID, appGUID, paramsMap}) 53 fake.createMutex.Unlock() 54 if fake.CreateStub != nil { 55 return fake.CreateStub(instanceGUID, appGUID, paramsMap) 56 } else { 57 return fake.createReturns.result1 58 } 59 } 60 61 func (fake *FakeServiceBindingRepository) CreateCallCount() int { 62 fake.createMutex.RLock() 63 defer fake.createMutex.RUnlock() 64 return len(fake.createArgsForCall) 65 } 66 67 func (fake *FakeServiceBindingRepository) CreateArgsForCall(i int) (string, string, map[string]interface{}) { 68 fake.createMutex.RLock() 69 defer fake.createMutex.RUnlock() 70 return fake.createArgsForCall[i].instanceGUID, fake.createArgsForCall[i].appGUID, fake.createArgsForCall[i].paramsMap 71 } 72 73 func (fake *FakeServiceBindingRepository) CreateReturns(result1 error) { 74 fake.CreateStub = nil 75 fake.createReturns = struct { 76 result1 error 77 }{result1} 78 } 79 80 func (fake *FakeServiceBindingRepository) Delete(instance models.ServiceInstance, appGUID string) (bool, error) { 81 fake.deleteMutex.Lock() 82 fake.deleteArgsForCall = append(fake.deleteArgsForCall, struct { 83 instance models.ServiceInstance 84 appGUID string 85 }{instance, appGUID}) 86 fake.recordInvocation("Delete", []interface{}{instance, appGUID}) 87 fake.deleteMutex.Unlock() 88 if fake.DeleteStub != nil { 89 return fake.DeleteStub(instance, appGUID) 90 } else { 91 return fake.deleteReturns.result1, fake.deleteReturns.result2 92 } 93 } 94 95 func (fake *FakeServiceBindingRepository) DeleteCallCount() int { 96 fake.deleteMutex.RLock() 97 defer fake.deleteMutex.RUnlock() 98 return len(fake.deleteArgsForCall) 99 } 100 101 func (fake *FakeServiceBindingRepository) DeleteArgsForCall(i int) (models.ServiceInstance, string) { 102 fake.deleteMutex.RLock() 103 defer fake.deleteMutex.RUnlock() 104 return fake.deleteArgsForCall[i].instance, fake.deleteArgsForCall[i].appGUID 105 } 106 107 func (fake *FakeServiceBindingRepository) DeleteReturns(result1 bool, result2 error) { 108 fake.DeleteStub = nil 109 fake.deleteReturns = struct { 110 result1 bool 111 result2 error 112 }{result1, result2} 113 } 114 115 func (fake *FakeServiceBindingRepository) ListAllForService(instanceGUID string) ([]models.ServiceBindingFields, error) { 116 fake.listAllForServiceMutex.Lock() 117 fake.listAllForServiceArgsForCall = append(fake.listAllForServiceArgsForCall, struct { 118 instanceGUID string 119 }{instanceGUID}) 120 fake.recordInvocation("ListAllForService", []interface{}{instanceGUID}) 121 fake.listAllForServiceMutex.Unlock() 122 if fake.ListAllForServiceStub != nil { 123 return fake.ListAllForServiceStub(instanceGUID) 124 } else { 125 return fake.listAllForServiceReturns.result1, fake.listAllForServiceReturns.result2 126 } 127 } 128 129 func (fake *FakeServiceBindingRepository) ListAllForServiceCallCount() int { 130 fake.listAllForServiceMutex.RLock() 131 defer fake.listAllForServiceMutex.RUnlock() 132 return len(fake.listAllForServiceArgsForCall) 133 } 134 135 func (fake *FakeServiceBindingRepository) ListAllForServiceArgsForCall(i int) string { 136 fake.listAllForServiceMutex.RLock() 137 defer fake.listAllForServiceMutex.RUnlock() 138 return fake.listAllForServiceArgsForCall[i].instanceGUID 139 } 140 141 func (fake *FakeServiceBindingRepository) ListAllForServiceReturns(result1 []models.ServiceBindingFields, result2 error) { 142 fake.ListAllForServiceStub = nil 143 fake.listAllForServiceReturns = struct { 144 result1 []models.ServiceBindingFields 145 result2 error 146 }{result1, result2} 147 } 148 149 func (fake *FakeServiceBindingRepository) Invocations() map[string][][]interface{} { 150 fake.invocationsMutex.RLock() 151 defer fake.invocationsMutex.RUnlock() 152 fake.createMutex.RLock() 153 defer fake.createMutex.RUnlock() 154 fake.deleteMutex.RLock() 155 defer fake.deleteMutex.RUnlock() 156 fake.listAllForServiceMutex.RLock() 157 defer fake.listAllForServiceMutex.RUnlock() 158 return fake.invocations 159 } 160 161 func (fake *FakeServiceBindingRepository) recordInvocation(key string, args []interface{}) { 162 fake.invocationsMutex.Lock() 163 defer fake.invocationsMutex.Unlock() 164 if fake.invocations == nil { 165 fake.invocations = map[string][][]interface{}{} 166 } 167 if fake.invocations[key] == nil { 168 fake.invocations[key] = [][]interface{}{} 169 } 170 fake.invocations[key] = append(fake.invocations[key], args) 171 } 172 173 var _ api.ServiceBindingRepository = new(FakeServiceBindingRepository)