1// Code generated by counterfeiter. DO NOT EDIT.
2package dbfakes
3
4import (
5	"sync"
6
7	"github.com/concourse/concourse/atc"
8	"github.com/concourse/concourse/atc/db"
9)
10
11type FakeUsedResourceCache struct {
12	BaseResourceTypeStub        func() *db.UsedBaseResourceType
13	baseResourceTypeMutex       sync.RWMutex
14	baseResourceTypeArgsForCall []struct {
15	}
16	baseResourceTypeReturns struct {
17		result1 *db.UsedBaseResourceType
18	}
19	baseResourceTypeReturnsOnCall map[int]struct {
20		result1 *db.UsedBaseResourceType
21	}
22	DestroyStub        func(db.Tx) (bool, error)
23	destroyMutex       sync.RWMutex
24	destroyArgsForCall []struct {
25		arg1 db.Tx
26	}
27	destroyReturns struct {
28		result1 bool
29		result2 error
30	}
31	destroyReturnsOnCall map[int]struct {
32		result1 bool
33		result2 error
34	}
35	IDStub        func() int
36	iDMutex       sync.RWMutex
37	iDArgsForCall []struct {
38	}
39	iDReturns struct {
40		result1 int
41	}
42	iDReturnsOnCall map[int]struct {
43		result1 int
44	}
45	ResourceConfigStub        func() db.ResourceConfig
46	resourceConfigMutex       sync.RWMutex
47	resourceConfigArgsForCall []struct {
48	}
49	resourceConfigReturns struct {
50		result1 db.ResourceConfig
51	}
52	resourceConfigReturnsOnCall map[int]struct {
53		result1 db.ResourceConfig
54	}
55	VersionStub        func() atc.Version
56	versionMutex       sync.RWMutex
57	versionArgsForCall []struct {
58	}
59	versionReturns struct {
60		result1 atc.Version
61	}
62	versionReturnsOnCall map[int]struct {
63		result1 atc.Version
64	}
65	invocations      map[string][][]interface{}
66	invocationsMutex sync.RWMutex
67}
68
69func (fake *FakeUsedResourceCache) BaseResourceType() *db.UsedBaseResourceType {
70	fake.baseResourceTypeMutex.Lock()
71	ret, specificReturn := fake.baseResourceTypeReturnsOnCall[len(fake.baseResourceTypeArgsForCall)]
72	fake.baseResourceTypeArgsForCall = append(fake.baseResourceTypeArgsForCall, struct {
73	}{})
74	fake.recordInvocation("BaseResourceType", []interface{}{})
75	fake.baseResourceTypeMutex.Unlock()
76	if fake.BaseResourceTypeStub != nil {
77		return fake.BaseResourceTypeStub()
78	}
79	if specificReturn {
80		return ret.result1
81	}
82	fakeReturns := fake.baseResourceTypeReturns
83	return fakeReturns.result1
84}
85
86func (fake *FakeUsedResourceCache) BaseResourceTypeCallCount() int {
87	fake.baseResourceTypeMutex.RLock()
88	defer fake.baseResourceTypeMutex.RUnlock()
89	return len(fake.baseResourceTypeArgsForCall)
90}
91
92func (fake *FakeUsedResourceCache) BaseResourceTypeCalls(stub func() *db.UsedBaseResourceType) {
93	fake.baseResourceTypeMutex.Lock()
94	defer fake.baseResourceTypeMutex.Unlock()
95	fake.BaseResourceTypeStub = stub
96}
97
98func (fake *FakeUsedResourceCache) BaseResourceTypeReturns(result1 *db.UsedBaseResourceType) {
99	fake.baseResourceTypeMutex.Lock()
100	defer fake.baseResourceTypeMutex.Unlock()
101	fake.BaseResourceTypeStub = nil
102	fake.baseResourceTypeReturns = struct {
103		result1 *db.UsedBaseResourceType
104	}{result1}
105}
106
107func (fake *FakeUsedResourceCache) BaseResourceTypeReturnsOnCall(i int, result1 *db.UsedBaseResourceType) {
108	fake.baseResourceTypeMutex.Lock()
109	defer fake.baseResourceTypeMutex.Unlock()
110	fake.BaseResourceTypeStub = nil
111	if fake.baseResourceTypeReturnsOnCall == nil {
112		fake.baseResourceTypeReturnsOnCall = make(map[int]struct {
113			result1 *db.UsedBaseResourceType
114		})
115	}
116	fake.baseResourceTypeReturnsOnCall[i] = struct {
117		result1 *db.UsedBaseResourceType
118	}{result1}
119}
120
121func (fake *FakeUsedResourceCache) Destroy(arg1 db.Tx) (bool, error) {
122	fake.destroyMutex.Lock()
123	ret, specificReturn := fake.destroyReturnsOnCall[len(fake.destroyArgsForCall)]
124	fake.destroyArgsForCall = append(fake.destroyArgsForCall, struct {
125		arg1 db.Tx
126	}{arg1})
127	fake.recordInvocation("Destroy", []interface{}{arg1})
128	fake.destroyMutex.Unlock()
129	if fake.DestroyStub != nil {
130		return fake.DestroyStub(arg1)
131	}
132	if specificReturn {
133		return ret.result1, ret.result2
134	}
135	fakeReturns := fake.destroyReturns
136	return fakeReturns.result1, fakeReturns.result2
137}
138
139func (fake *FakeUsedResourceCache) DestroyCallCount() int {
140	fake.destroyMutex.RLock()
141	defer fake.destroyMutex.RUnlock()
142	return len(fake.destroyArgsForCall)
143}
144
145func (fake *FakeUsedResourceCache) DestroyCalls(stub func(db.Tx) (bool, error)) {
146	fake.destroyMutex.Lock()
147	defer fake.destroyMutex.Unlock()
148	fake.DestroyStub = stub
149}
150
151func (fake *FakeUsedResourceCache) DestroyArgsForCall(i int) db.Tx {
152	fake.destroyMutex.RLock()
153	defer fake.destroyMutex.RUnlock()
154	argsForCall := fake.destroyArgsForCall[i]
155	return argsForCall.arg1
156}
157
158func (fake *FakeUsedResourceCache) DestroyReturns(result1 bool, result2 error) {
159	fake.destroyMutex.Lock()
160	defer fake.destroyMutex.Unlock()
161	fake.DestroyStub = nil
162	fake.destroyReturns = struct {
163		result1 bool
164		result2 error
165	}{result1, result2}
166}
167
168func (fake *FakeUsedResourceCache) DestroyReturnsOnCall(i int, result1 bool, result2 error) {
169	fake.destroyMutex.Lock()
170	defer fake.destroyMutex.Unlock()
171	fake.DestroyStub = nil
172	if fake.destroyReturnsOnCall == nil {
173		fake.destroyReturnsOnCall = make(map[int]struct {
174			result1 bool
175			result2 error
176		})
177	}
178	fake.destroyReturnsOnCall[i] = struct {
179		result1 bool
180		result2 error
181	}{result1, result2}
182}
183
184func (fake *FakeUsedResourceCache) ID() int {
185	fake.iDMutex.Lock()
186	ret, specificReturn := fake.iDReturnsOnCall[len(fake.iDArgsForCall)]
187	fake.iDArgsForCall = append(fake.iDArgsForCall, struct {
188	}{})
189	fake.recordInvocation("ID", []interface{}{})
190	fake.iDMutex.Unlock()
191	if fake.IDStub != nil {
192		return fake.IDStub()
193	}
194	if specificReturn {
195		return ret.result1
196	}
197	fakeReturns := fake.iDReturns
198	return fakeReturns.result1
199}
200
201func (fake *FakeUsedResourceCache) IDCallCount() int {
202	fake.iDMutex.RLock()
203	defer fake.iDMutex.RUnlock()
204	return len(fake.iDArgsForCall)
205}
206
207func (fake *FakeUsedResourceCache) IDCalls(stub func() int) {
208	fake.iDMutex.Lock()
209	defer fake.iDMutex.Unlock()
210	fake.IDStub = stub
211}
212
213func (fake *FakeUsedResourceCache) IDReturns(result1 int) {
214	fake.iDMutex.Lock()
215	defer fake.iDMutex.Unlock()
216	fake.IDStub = nil
217	fake.iDReturns = struct {
218		result1 int
219	}{result1}
220}
221
222func (fake *FakeUsedResourceCache) IDReturnsOnCall(i int, result1 int) {
223	fake.iDMutex.Lock()
224	defer fake.iDMutex.Unlock()
225	fake.IDStub = nil
226	if fake.iDReturnsOnCall == nil {
227		fake.iDReturnsOnCall = make(map[int]struct {
228			result1 int
229		})
230	}
231	fake.iDReturnsOnCall[i] = struct {
232		result1 int
233	}{result1}
234}
235
236func (fake *FakeUsedResourceCache) ResourceConfig() db.ResourceConfig {
237	fake.resourceConfigMutex.Lock()
238	ret, specificReturn := fake.resourceConfigReturnsOnCall[len(fake.resourceConfigArgsForCall)]
239	fake.resourceConfigArgsForCall = append(fake.resourceConfigArgsForCall, struct {
240	}{})
241	fake.recordInvocation("ResourceConfig", []interface{}{})
242	fake.resourceConfigMutex.Unlock()
243	if fake.ResourceConfigStub != nil {
244		return fake.ResourceConfigStub()
245	}
246	if specificReturn {
247		return ret.result1
248	}
249	fakeReturns := fake.resourceConfigReturns
250	return fakeReturns.result1
251}
252
253func (fake *FakeUsedResourceCache) ResourceConfigCallCount() int {
254	fake.resourceConfigMutex.RLock()
255	defer fake.resourceConfigMutex.RUnlock()
256	return len(fake.resourceConfigArgsForCall)
257}
258
259func (fake *FakeUsedResourceCache) ResourceConfigCalls(stub func() db.ResourceConfig) {
260	fake.resourceConfigMutex.Lock()
261	defer fake.resourceConfigMutex.Unlock()
262	fake.ResourceConfigStub = stub
263}
264
265func (fake *FakeUsedResourceCache) ResourceConfigReturns(result1 db.ResourceConfig) {
266	fake.resourceConfigMutex.Lock()
267	defer fake.resourceConfigMutex.Unlock()
268	fake.ResourceConfigStub = nil
269	fake.resourceConfigReturns = struct {
270		result1 db.ResourceConfig
271	}{result1}
272}
273
274func (fake *FakeUsedResourceCache) ResourceConfigReturnsOnCall(i int, result1 db.ResourceConfig) {
275	fake.resourceConfigMutex.Lock()
276	defer fake.resourceConfigMutex.Unlock()
277	fake.ResourceConfigStub = nil
278	if fake.resourceConfigReturnsOnCall == nil {
279		fake.resourceConfigReturnsOnCall = make(map[int]struct {
280			result1 db.ResourceConfig
281		})
282	}
283	fake.resourceConfigReturnsOnCall[i] = struct {
284		result1 db.ResourceConfig
285	}{result1}
286}
287
288func (fake *FakeUsedResourceCache) Version() atc.Version {
289	fake.versionMutex.Lock()
290	ret, specificReturn := fake.versionReturnsOnCall[len(fake.versionArgsForCall)]
291	fake.versionArgsForCall = append(fake.versionArgsForCall, struct {
292	}{})
293	fake.recordInvocation("Version", []interface{}{})
294	fake.versionMutex.Unlock()
295	if fake.VersionStub != nil {
296		return fake.VersionStub()
297	}
298	if specificReturn {
299		return ret.result1
300	}
301	fakeReturns := fake.versionReturns
302	return fakeReturns.result1
303}
304
305func (fake *FakeUsedResourceCache) VersionCallCount() int {
306	fake.versionMutex.RLock()
307	defer fake.versionMutex.RUnlock()
308	return len(fake.versionArgsForCall)
309}
310
311func (fake *FakeUsedResourceCache) VersionCalls(stub func() atc.Version) {
312	fake.versionMutex.Lock()
313	defer fake.versionMutex.Unlock()
314	fake.VersionStub = stub
315}
316
317func (fake *FakeUsedResourceCache) VersionReturns(result1 atc.Version) {
318	fake.versionMutex.Lock()
319	defer fake.versionMutex.Unlock()
320	fake.VersionStub = nil
321	fake.versionReturns = struct {
322		result1 atc.Version
323	}{result1}
324}
325
326func (fake *FakeUsedResourceCache) VersionReturnsOnCall(i int, result1 atc.Version) {
327	fake.versionMutex.Lock()
328	defer fake.versionMutex.Unlock()
329	fake.VersionStub = nil
330	if fake.versionReturnsOnCall == nil {
331		fake.versionReturnsOnCall = make(map[int]struct {
332			result1 atc.Version
333		})
334	}
335	fake.versionReturnsOnCall[i] = struct {
336		result1 atc.Version
337	}{result1}
338}
339
340func (fake *FakeUsedResourceCache) Invocations() map[string][][]interface{} {
341	fake.invocationsMutex.RLock()
342	defer fake.invocationsMutex.RUnlock()
343	fake.baseResourceTypeMutex.RLock()
344	defer fake.baseResourceTypeMutex.RUnlock()
345	fake.destroyMutex.RLock()
346	defer fake.destroyMutex.RUnlock()
347	fake.iDMutex.RLock()
348	defer fake.iDMutex.RUnlock()
349	fake.resourceConfigMutex.RLock()
350	defer fake.resourceConfigMutex.RUnlock()
351	fake.versionMutex.RLock()
352	defer fake.versionMutex.RUnlock()
353	copiedInvocations := map[string][][]interface{}{}
354	for key, value := range fake.invocations {
355		copiedInvocations[key] = value
356	}
357	return copiedInvocations
358}
359
360func (fake *FakeUsedResourceCache) recordInvocation(key string, args []interface{}) {
361	fake.invocationsMutex.Lock()
362	defer fake.invocationsMutex.Unlock()
363	if fake.invocations == nil {
364		fake.invocations = map[string][][]interface{}{}
365	}
366	if fake.invocations[key] == nil {
367		fake.invocations[key] = [][]interface{}{}
368	}
369	fake.invocations[key] = append(fake.invocations[key], args)
370}
371
372var _ db.UsedResourceCache = new(FakeUsedResourceCache)
373