github.com/pf-qiu/concourse/v6@v6.7.3-0.20201207032516-1f455d73275f/atc/policy/policyfakes/fake_checker.go (about) 1 // Code generated by counterfeiter. DO NOT EDIT. 2 package policyfakes 3 4 import ( 5 "sync" 6 7 "github.com/pf-qiu/concourse/v6/atc/policy" 8 ) 9 10 type FakeChecker struct { 11 CheckStub func(policy.PolicyCheckInput) (policy.PolicyCheckOutput, error) 12 checkMutex sync.RWMutex 13 checkArgsForCall []struct { 14 arg1 policy.PolicyCheckInput 15 } 16 checkReturns struct { 17 result1 policy.PolicyCheckOutput 18 result2 error 19 } 20 checkReturnsOnCall map[int]struct { 21 result1 policy.PolicyCheckOutput 22 result2 error 23 } 24 ShouldCheckActionStub func(string) bool 25 shouldCheckActionMutex sync.RWMutex 26 shouldCheckActionArgsForCall []struct { 27 arg1 string 28 } 29 shouldCheckActionReturns struct { 30 result1 bool 31 } 32 shouldCheckActionReturnsOnCall map[int]struct { 33 result1 bool 34 } 35 ShouldCheckHttpMethodStub func(string) bool 36 shouldCheckHttpMethodMutex sync.RWMutex 37 shouldCheckHttpMethodArgsForCall []struct { 38 arg1 string 39 } 40 shouldCheckHttpMethodReturns struct { 41 result1 bool 42 } 43 shouldCheckHttpMethodReturnsOnCall map[int]struct { 44 result1 bool 45 } 46 ShouldSkipActionStub func(string) bool 47 shouldSkipActionMutex sync.RWMutex 48 shouldSkipActionArgsForCall []struct { 49 arg1 string 50 } 51 shouldSkipActionReturns struct { 52 result1 bool 53 } 54 shouldSkipActionReturnsOnCall map[int]struct { 55 result1 bool 56 } 57 invocations map[string][][]interface{} 58 invocationsMutex sync.RWMutex 59 } 60 61 func (fake *FakeChecker) Check(arg1 policy.PolicyCheckInput) (policy.PolicyCheckOutput, error) { 62 fake.checkMutex.Lock() 63 ret, specificReturn := fake.checkReturnsOnCall[len(fake.checkArgsForCall)] 64 fake.checkArgsForCall = append(fake.checkArgsForCall, struct { 65 arg1 policy.PolicyCheckInput 66 }{arg1}) 67 fake.recordInvocation("Check", []interface{}{arg1}) 68 fake.checkMutex.Unlock() 69 if fake.CheckStub != nil { 70 return fake.CheckStub(arg1) 71 } 72 if specificReturn { 73 return ret.result1, ret.result2 74 } 75 fakeReturns := fake.checkReturns 76 return fakeReturns.result1, fakeReturns.result2 77 } 78 79 func (fake *FakeChecker) CheckCallCount() int { 80 fake.checkMutex.RLock() 81 defer fake.checkMutex.RUnlock() 82 return len(fake.checkArgsForCall) 83 } 84 85 func (fake *FakeChecker) CheckCalls(stub func(policy.PolicyCheckInput) (policy.PolicyCheckOutput, error)) { 86 fake.checkMutex.Lock() 87 defer fake.checkMutex.Unlock() 88 fake.CheckStub = stub 89 } 90 91 func (fake *FakeChecker) CheckArgsForCall(i int) policy.PolicyCheckInput { 92 fake.checkMutex.RLock() 93 defer fake.checkMutex.RUnlock() 94 argsForCall := fake.checkArgsForCall[i] 95 return argsForCall.arg1 96 } 97 98 func (fake *FakeChecker) CheckReturns(result1 policy.PolicyCheckOutput, result2 error) { 99 fake.checkMutex.Lock() 100 defer fake.checkMutex.Unlock() 101 fake.CheckStub = nil 102 fake.checkReturns = struct { 103 result1 policy.PolicyCheckOutput 104 result2 error 105 }{result1, result2} 106 } 107 108 func (fake *FakeChecker) CheckReturnsOnCall(i int, result1 policy.PolicyCheckOutput, result2 error) { 109 fake.checkMutex.Lock() 110 defer fake.checkMutex.Unlock() 111 fake.CheckStub = nil 112 if fake.checkReturnsOnCall == nil { 113 fake.checkReturnsOnCall = make(map[int]struct { 114 result1 policy.PolicyCheckOutput 115 result2 error 116 }) 117 } 118 fake.checkReturnsOnCall[i] = struct { 119 result1 policy.PolicyCheckOutput 120 result2 error 121 }{result1, result2} 122 } 123 124 func (fake *FakeChecker) ShouldCheckAction(arg1 string) bool { 125 fake.shouldCheckActionMutex.Lock() 126 ret, specificReturn := fake.shouldCheckActionReturnsOnCall[len(fake.shouldCheckActionArgsForCall)] 127 fake.shouldCheckActionArgsForCall = append(fake.shouldCheckActionArgsForCall, struct { 128 arg1 string 129 }{arg1}) 130 fake.recordInvocation("ShouldCheckAction", []interface{}{arg1}) 131 fake.shouldCheckActionMutex.Unlock() 132 if fake.ShouldCheckActionStub != nil { 133 return fake.ShouldCheckActionStub(arg1) 134 } 135 if specificReturn { 136 return ret.result1 137 } 138 fakeReturns := fake.shouldCheckActionReturns 139 return fakeReturns.result1 140 } 141 142 func (fake *FakeChecker) ShouldCheckActionCallCount() int { 143 fake.shouldCheckActionMutex.RLock() 144 defer fake.shouldCheckActionMutex.RUnlock() 145 return len(fake.shouldCheckActionArgsForCall) 146 } 147 148 func (fake *FakeChecker) ShouldCheckActionCalls(stub func(string) bool) { 149 fake.shouldCheckActionMutex.Lock() 150 defer fake.shouldCheckActionMutex.Unlock() 151 fake.ShouldCheckActionStub = stub 152 } 153 154 func (fake *FakeChecker) ShouldCheckActionArgsForCall(i int) string { 155 fake.shouldCheckActionMutex.RLock() 156 defer fake.shouldCheckActionMutex.RUnlock() 157 argsForCall := fake.shouldCheckActionArgsForCall[i] 158 return argsForCall.arg1 159 } 160 161 func (fake *FakeChecker) ShouldCheckActionReturns(result1 bool) { 162 fake.shouldCheckActionMutex.Lock() 163 defer fake.shouldCheckActionMutex.Unlock() 164 fake.ShouldCheckActionStub = nil 165 fake.shouldCheckActionReturns = struct { 166 result1 bool 167 }{result1} 168 } 169 170 func (fake *FakeChecker) ShouldCheckActionReturnsOnCall(i int, result1 bool) { 171 fake.shouldCheckActionMutex.Lock() 172 defer fake.shouldCheckActionMutex.Unlock() 173 fake.ShouldCheckActionStub = nil 174 if fake.shouldCheckActionReturnsOnCall == nil { 175 fake.shouldCheckActionReturnsOnCall = make(map[int]struct { 176 result1 bool 177 }) 178 } 179 fake.shouldCheckActionReturnsOnCall[i] = struct { 180 result1 bool 181 }{result1} 182 } 183 184 func (fake *FakeChecker) ShouldCheckHttpMethod(arg1 string) bool { 185 fake.shouldCheckHttpMethodMutex.Lock() 186 ret, specificReturn := fake.shouldCheckHttpMethodReturnsOnCall[len(fake.shouldCheckHttpMethodArgsForCall)] 187 fake.shouldCheckHttpMethodArgsForCall = append(fake.shouldCheckHttpMethodArgsForCall, struct { 188 arg1 string 189 }{arg1}) 190 fake.recordInvocation("ShouldCheckHttpMethod", []interface{}{arg1}) 191 fake.shouldCheckHttpMethodMutex.Unlock() 192 if fake.ShouldCheckHttpMethodStub != nil { 193 return fake.ShouldCheckHttpMethodStub(arg1) 194 } 195 if specificReturn { 196 return ret.result1 197 } 198 fakeReturns := fake.shouldCheckHttpMethodReturns 199 return fakeReturns.result1 200 } 201 202 func (fake *FakeChecker) ShouldCheckHttpMethodCallCount() int { 203 fake.shouldCheckHttpMethodMutex.RLock() 204 defer fake.shouldCheckHttpMethodMutex.RUnlock() 205 return len(fake.shouldCheckHttpMethodArgsForCall) 206 } 207 208 func (fake *FakeChecker) ShouldCheckHttpMethodCalls(stub func(string) bool) { 209 fake.shouldCheckHttpMethodMutex.Lock() 210 defer fake.shouldCheckHttpMethodMutex.Unlock() 211 fake.ShouldCheckHttpMethodStub = stub 212 } 213 214 func (fake *FakeChecker) ShouldCheckHttpMethodArgsForCall(i int) string { 215 fake.shouldCheckHttpMethodMutex.RLock() 216 defer fake.shouldCheckHttpMethodMutex.RUnlock() 217 argsForCall := fake.shouldCheckHttpMethodArgsForCall[i] 218 return argsForCall.arg1 219 } 220 221 func (fake *FakeChecker) ShouldCheckHttpMethodReturns(result1 bool) { 222 fake.shouldCheckHttpMethodMutex.Lock() 223 defer fake.shouldCheckHttpMethodMutex.Unlock() 224 fake.ShouldCheckHttpMethodStub = nil 225 fake.shouldCheckHttpMethodReturns = struct { 226 result1 bool 227 }{result1} 228 } 229 230 func (fake *FakeChecker) ShouldCheckHttpMethodReturnsOnCall(i int, result1 bool) { 231 fake.shouldCheckHttpMethodMutex.Lock() 232 defer fake.shouldCheckHttpMethodMutex.Unlock() 233 fake.ShouldCheckHttpMethodStub = nil 234 if fake.shouldCheckHttpMethodReturnsOnCall == nil { 235 fake.shouldCheckHttpMethodReturnsOnCall = make(map[int]struct { 236 result1 bool 237 }) 238 } 239 fake.shouldCheckHttpMethodReturnsOnCall[i] = struct { 240 result1 bool 241 }{result1} 242 } 243 244 func (fake *FakeChecker) ShouldSkipAction(arg1 string) bool { 245 fake.shouldSkipActionMutex.Lock() 246 ret, specificReturn := fake.shouldSkipActionReturnsOnCall[len(fake.shouldSkipActionArgsForCall)] 247 fake.shouldSkipActionArgsForCall = append(fake.shouldSkipActionArgsForCall, struct { 248 arg1 string 249 }{arg1}) 250 fake.recordInvocation("ShouldSkipAction", []interface{}{arg1}) 251 fake.shouldSkipActionMutex.Unlock() 252 if fake.ShouldSkipActionStub != nil { 253 return fake.ShouldSkipActionStub(arg1) 254 } 255 if specificReturn { 256 return ret.result1 257 } 258 fakeReturns := fake.shouldSkipActionReturns 259 return fakeReturns.result1 260 } 261 262 func (fake *FakeChecker) ShouldSkipActionCallCount() int { 263 fake.shouldSkipActionMutex.RLock() 264 defer fake.shouldSkipActionMutex.RUnlock() 265 return len(fake.shouldSkipActionArgsForCall) 266 } 267 268 func (fake *FakeChecker) ShouldSkipActionCalls(stub func(string) bool) { 269 fake.shouldSkipActionMutex.Lock() 270 defer fake.shouldSkipActionMutex.Unlock() 271 fake.ShouldSkipActionStub = stub 272 } 273 274 func (fake *FakeChecker) ShouldSkipActionArgsForCall(i int) string { 275 fake.shouldSkipActionMutex.RLock() 276 defer fake.shouldSkipActionMutex.RUnlock() 277 argsForCall := fake.shouldSkipActionArgsForCall[i] 278 return argsForCall.arg1 279 } 280 281 func (fake *FakeChecker) ShouldSkipActionReturns(result1 bool) { 282 fake.shouldSkipActionMutex.Lock() 283 defer fake.shouldSkipActionMutex.Unlock() 284 fake.ShouldSkipActionStub = nil 285 fake.shouldSkipActionReturns = struct { 286 result1 bool 287 }{result1} 288 } 289 290 func (fake *FakeChecker) ShouldSkipActionReturnsOnCall(i int, result1 bool) { 291 fake.shouldSkipActionMutex.Lock() 292 defer fake.shouldSkipActionMutex.Unlock() 293 fake.ShouldSkipActionStub = nil 294 if fake.shouldSkipActionReturnsOnCall == nil { 295 fake.shouldSkipActionReturnsOnCall = make(map[int]struct { 296 result1 bool 297 }) 298 } 299 fake.shouldSkipActionReturnsOnCall[i] = struct { 300 result1 bool 301 }{result1} 302 } 303 304 func (fake *FakeChecker) Invocations() map[string][][]interface{} { 305 fake.invocationsMutex.RLock() 306 defer fake.invocationsMutex.RUnlock() 307 fake.checkMutex.RLock() 308 defer fake.checkMutex.RUnlock() 309 fake.shouldCheckActionMutex.RLock() 310 defer fake.shouldCheckActionMutex.RUnlock() 311 fake.shouldCheckHttpMethodMutex.RLock() 312 defer fake.shouldCheckHttpMethodMutex.RUnlock() 313 fake.shouldSkipActionMutex.RLock() 314 defer fake.shouldSkipActionMutex.RUnlock() 315 copiedInvocations := map[string][][]interface{}{} 316 for key, value := range fake.invocations { 317 copiedInvocations[key] = value 318 } 319 return copiedInvocations 320 } 321 322 func (fake *FakeChecker) recordInvocation(key string, args []interface{}) { 323 fake.invocationsMutex.Lock() 324 defer fake.invocationsMutex.Unlock() 325 if fake.invocations == nil { 326 fake.invocations = map[string][][]interface{}{} 327 } 328 if fake.invocations[key] == nil { 329 fake.invocations[key] = [][]interface{}{} 330 } 331 fake.invocations[key] = append(fake.invocations[key], args) 332 } 333 334 var _ policy.Checker = new(FakeChecker)