github.com/swisscom/cloudfoundry-cli@v7.1.0+incompatible/cf/api/stacks/stacksfakes/fake_stack_repository.go (about) 1 // Code generated by counterfeiter. DO NOT EDIT. 2 package stacksfakes 3 4 import ( 5 "sync" 6 7 "code.cloudfoundry.org/cli/cf/api/stacks" 8 "code.cloudfoundry.org/cli/cf/models" 9 ) 10 11 type FakeStackRepository struct { 12 FindAllStub func() ([]models.Stack, error) 13 findAllMutex sync.RWMutex 14 findAllArgsForCall []struct { 15 } 16 findAllReturns struct { 17 result1 []models.Stack 18 result2 error 19 } 20 findAllReturnsOnCall map[int]struct { 21 result1 []models.Stack 22 result2 error 23 } 24 FindByGUIDStub func(string) (models.Stack, error) 25 findByGUIDMutex sync.RWMutex 26 findByGUIDArgsForCall []struct { 27 arg1 string 28 } 29 findByGUIDReturns struct { 30 result1 models.Stack 31 result2 error 32 } 33 findByGUIDReturnsOnCall map[int]struct { 34 result1 models.Stack 35 result2 error 36 } 37 FindByNameStub func(string) (models.Stack, error) 38 findByNameMutex sync.RWMutex 39 findByNameArgsForCall []struct { 40 arg1 string 41 } 42 findByNameReturns struct { 43 result1 models.Stack 44 result2 error 45 } 46 findByNameReturnsOnCall map[int]struct { 47 result1 models.Stack 48 result2 error 49 } 50 invocations map[string][][]interface{} 51 invocationsMutex sync.RWMutex 52 } 53 54 func (fake *FakeStackRepository) FindAll() ([]models.Stack, error) { 55 fake.findAllMutex.Lock() 56 ret, specificReturn := fake.findAllReturnsOnCall[len(fake.findAllArgsForCall)] 57 fake.findAllArgsForCall = append(fake.findAllArgsForCall, struct { 58 }{}) 59 fake.recordInvocation("FindAll", []interface{}{}) 60 fake.findAllMutex.Unlock() 61 if fake.FindAllStub != nil { 62 return fake.FindAllStub() 63 } 64 if specificReturn { 65 return ret.result1, ret.result2 66 } 67 fakeReturns := fake.findAllReturns 68 return fakeReturns.result1, fakeReturns.result2 69 } 70 71 func (fake *FakeStackRepository) FindAllCallCount() int { 72 fake.findAllMutex.RLock() 73 defer fake.findAllMutex.RUnlock() 74 return len(fake.findAllArgsForCall) 75 } 76 77 func (fake *FakeStackRepository) FindAllCalls(stub func() ([]models.Stack, error)) { 78 fake.findAllMutex.Lock() 79 defer fake.findAllMutex.Unlock() 80 fake.FindAllStub = stub 81 } 82 83 func (fake *FakeStackRepository) FindAllReturns(result1 []models.Stack, result2 error) { 84 fake.findAllMutex.Lock() 85 defer fake.findAllMutex.Unlock() 86 fake.FindAllStub = nil 87 fake.findAllReturns = struct { 88 result1 []models.Stack 89 result2 error 90 }{result1, result2} 91 } 92 93 func (fake *FakeStackRepository) FindAllReturnsOnCall(i int, result1 []models.Stack, result2 error) { 94 fake.findAllMutex.Lock() 95 defer fake.findAllMutex.Unlock() 96 fake.FindAllStub = nil 97 if fake.findAllReturnsOnCall == nil { 98 fake.findAllReturnsOnCall = make(map[int]struct { 99 result1 []models.Stack 100 result2 error 101 }) 102 } 103 fake.findAllReturnsOnCall[i] = struct { 104 result1 []models.Stack 105 result2 error 106 }{result1, result2} 107 } 108 109 func (fake *FakeStackRepository) FindByGUID(arg1 string) (models.Stack, error) { 110 fake.findByGUIDMutex.Lock() 111 ret, specificReturn := fake.findByGUIDReturnsOnCall[len(fake.findByGUIDArgsForCall)] 112 fake.findByGUIDArgsForCall = append(fake.findByGUIDArgsForCall, struct { 113 arg1 string 114 }{arg1}) 115 fake.recordInvocation("FindByGUID", []interface{}{arg1}) 116 fake.findByGUIDMutex.Unlock() 117 if fake.FindByGUIDStub != nil { 118 return fake.FindByGUIDStub(arg1) 119 } 120 if specificReturn { 121 return ret.result1, ret.result2 122 } 123 fakeReturns := fake.findByGUIDReturns 124 return fakeReturns.result1, fakeReturns.result2 125 } 126 127 func (fake *FakeStackRepository) FindByGUIDCallCount() int { 128 fake.findByGUIDMutex.RLock() 129 defer fake.findByGUIDMutex.RUnlock() 130 return len(fake.findByGUIDArgsForCall) 131 } 132 133 func (fake *FakeStackRepository) FindByGUIDCalls(stub func(string) (models.Stack, error)) { 134 fake.findByGUIDMutex.Lock() 135 defer fake.findByGUIDMutex.Unlock() 136 fake.FindByGUIDStub = stub 137 } 138 139 func (fake *FakeStackRepository) FindByGUIDArgsForCall(i int) string { 140 fake.findByGUIDMutex.RLock() 141 defer fake.findByGUIDMutex.RUnlock() 142 argsForCall := fake.findByGUIDArgsForCall[i] 143 return argsForCall.arg1 144 } 145 146 func (fake *FakeStackRepository) FindByGUIDReturns(result1 models.Stack, result2 error) { 147 fake.findByGUIDMutex.Lock() 148 defer fake.findByGUIDMutex.Unlock() 149 fake.FindByGUIDStub = nil 150 fake.findByGUIDReturns = struct { 151 result1 models.Stack 152 result2 error 153 }{result1, result2} 154 } 155 156 func (fake *FakeStackRepository) FindByGUIDReturnsOnCall(i int, result1 models.Stack, result2 error) { 157 fake.findByGUIDMutex.Lock() 158 defer fake.findByGUIDMutex.Unlock() 159 fake.FindByGUIDStub = nil 160 if fake.findByGUIDReturnsOnCall == nil { 161 fake.findByGUIDReturnsOnCall = make(map[int]struct { 162 result1 models.Stack 163 result2 error 164 }) 165 } 166 fake.findByGUIDReturnsOnCall[i] = struct { 167 result1 models.Stack 168 result2 error 169 }{result1, result2} 170 } 171 172 func (fake *FakeStackRepository) FindByName(arg1 string) (models.Stack, error) { 173 fake.findByNameMutex.Lock() 174 ret, specificReturn := fake.findByNameReturnsOnCall[len(fake.findByNameArgsForCall)] 175 fake.findByNameArgsForCall = append(fake.findByNameArgsForCall, struct { 176 arg1 string 177 }{arg1}) 178 fake.recordInvocation("FindByName", []interface{}{arg1}) 179 fake.findByNameMutex.Unlock() 180 if fake.FindByNameStub != nil { 181 return fake.FindByNameStub(arg1) 182 } 183 if specificReturn { 184 return ret.result1, ret.result2 185 } 186 fakeReturns := fake.findByNameReturns 187 return fakeReturns.result1, fakeReturns.result2 188 } 189 190 func (fake *FakeStackRepository) FindByNameCallCount() int { 191 fake.findByNameMutex.RLock() 192 defer fake.findByNameMutex.RUnlock() 193 return len(fake.findByNameArgsForCall) 194 } 195 196 func (fake *FakeStackRepository) FindByNameCalls(stub func(string) (models.Stack, error)) { 197 fake.findByNameMutex.Lock() 198 defer fake.findByNameMutex.Unlock() 199 fake.FindByNameStub = stub 200 } 201 202 func (fake *FakeStackRepository) FindByNameArgsForCall(i int) string { 203 fake.findByNameMutex.RLock() 204 defer fake.findByNameMutex.RUnlock() 205 argsForCall := fake.findByNameArgsForCall[i] 206 return argsForCall.arg1 207 } 208 209 func (fake *FakeStackRepository) FindByNameReturns(result1 models.Stack, result2 error) { 210 fake.findByNameMutex.Lock() 211 defer fake.findByNameMutex.Unlock() 212 fake.FindByNameStub = nil 213 fake.findByNameReturns = struct { 214 result1 models.Stack 215 result2 error 216 }{result1, result2} 217 } 218 219 func (fake *FakeStackRepository) FindByNameReturnsOnCall(i int, result1 models.Stack, result2 error) { 220 fake.findByNameMutex.Lock() 221 defer fake.findByNameMutex.Unlock() 222 fake.FindByNameStub = nil 223 if fake.findByNameReturnsOnCall == nil { 224 fake.findByNameReturnsOnCall = make(map[int]struct { 225 result1 models.Stack 226 result2 error 227 }) 228 } 229 fake.findByNameReturnsOnCall[i] = struct { 230 result1 models.Stack 231 result2 error 232 }{result1, result2} 233 } 234 235 func (fake *FakeStackRepository) Invocations() map[string][][]interface{} { 236 fake.invocationsMutex.RLock() 237 defer fake.invocationsMutex.RUnlock() 238 fake.findAllMutex.RLock() 239 defer fake.findAllMutex.RUnlock() 240 fake.findByGUIDMutex.RLock() 241 defer fake.findByGUIDMutex.RUnlock() 242 fake.findByNameMutex.RLock() 243 defer fake.findByNameMutex.RUnlock() 244 copiedInvocations := map[string][][]interface{}{} 245 for key, value := range fake.invocations { 246 copiedInvocations[key] = value 247 } 248 return copiedInvocations 249 } 250 251 func (fake *FakeStackRepository) recordInvocation(key string, args []interface{}) { 252 fake.invocationsMutex.Lock() 253 defer fake.invocationsMutex.Unlock() 254 if fake.invocations == nil { 255 fake.invocations = map[string][][]interface{}{} 256 } 257 if fake.invocations[key] == nil { 258 fake.invocations[key] = [][]interface{}{} 259 } 260 fake.invocations[key] = append(fake.invocations[key], args) 261 } 262 263 var _ stacks.StackRepository = new(FakeStackRepository)