1// Code generated by counterfeiter. DO NOT EDIT.
2package dbfakes
3
4import (
5	"sync"
6
7	"github.com/concourse/concourse/atc/db"
8)
9
10type FakeResourceFactory struct {
11	AllResourcesStub        func() ([]db.Resource, error)
12	allResourcesMutex       sync.RWMutex
13	allResourcesArgsForCall []struct {
14	}
15	allResourcesReturns struct {
16		result1 []db.Resource
17		result2 error
18	}
19	allResourcesReturnsOnCall map[int]struct {
20		result1 []db.Resource
21		result2 error
22	}
23	ResourceStub        func(int) (db.Resource, bool, error)
24	resourceMutex       sync.RWMutex
25	resourceArgsForCall []struct {
26		arg1 int
27	}
28	resourceReturns struct {
29		result1 db.Resource
30		result2 bool
31		result3 error
32	}
33	resourceReturnsOnCall map[int]struct {
34		result1 db.Resource
35		result2 bool
36		result3 error
37	}
38	VisibleResourcesStub        func([]string) ([]db.Resource, error)
39	visibleResourcesMutex       sync.RWMutex
40	visibleResourcesArgsForCall []struct {
41		arg1 []string
42	}
43	visibleResourcesReturns struct {
44		result1 []db.Resource
45		result2 error
46	}
47	visibleResourcesReturnsOnCall map[int]struct {
48		result1 []db.Resource
49		result2 error
50	}
51	invocations      map[string][][]interface{}
52	invocationsMutex sync.RWMutex
53}
54
55func (fake *FakeResourceFactory) AllResources() ([]db.Resource, error) {
56	fake.allResourcesMutex.Lock()
57	ret, specificReturn := fake.allResourcesReturnsOnCall[len(fake.allResourcesArgsForCall)]
58	fake.allResourcesArgsForCall = append(fake.allResourcesArgsForCall, struct {
59	}{})
60	fake.recordInvocation("AllResources", []interface{}{})
61	fake.allResourcesMutex.Unlock()
62	if fake.AllResourcesStub != nil {
63		return fake.AllResourcesStub()
64	}
65	if specificReturn {
66		return ret.result1, ret.result2
67	}
68	fakeReturns := fake.allResourcesReturns
69	return fakeReturns.result1, fakeReturns.result2
70}
71
72func (fake *FakeResourceFactory) AllResourcesCallCount() int {
73	fake.allResourcesMutex.RLock()
74	defer fake.allResourcesMutex.RUnlock()
75	return len(fake.allResourcesArgsForCall)
76}
77
78func (fake *FakeResourceFactory) AllResourcesCalls(stub func() ([]db.Resource, error)) {
79	fake.allResourcesMutex.Lock()
80	defer fake.allResourcesMutex.Unlock()
81	fake.AllResourcesStub = stub
82}
83
84func (fake *FakeResourceFactory) AllResourcesReturns(result1 []db.Resource, result2 error) {
85	fake.allResourcesMutex.Lock()
86	defer fake.allResourcesMutex.Unlock()
87	fake.AllResourcesStub = nil
88	fake.allResourcesReturns = struct {
89		result1 []db.Resource
90		result2 error
91	}{result1, result2}
92}
93
94func (fake *FakeResourceFactory) AllResourcesReturnsOnCall(i int, result1 []db.Resource, result2 error) {
95	fake.allResourcesMutex.Lock()
96	defer fake.allResourcesMutex.Unlock()
97	fake.AllResourcesStub = nil
98	if fake.allResourcesReturnsOnCall == nil {
99		fake.allResourcesReturnsOnCall = make(map[int]struct {
100			result1 []db.Resource
101			result2 error
102		})
103	}
104	fake.allResourcesReturnsOnCall[i] = struct {
105		result1 []db.Resource
106		result2 error
107	}{result1, result2}
108}
109
110func (fake *FakeResourceFactory) Resource(arg1 int) (db.Resource, bool, error) {
111	fake.resourceMutex.Lock()
112	ret, specificReturn := fake.resourceReturnsOnCall[len(fake.resourceArgsForCall)]
113	fake.resourceArgsForCall = append(fake.resourceArgsForCall, struct {
114		arg1 int
115	}{arg1})
116	fake.recordInvocation("Resource", []interface{}{arg1})
117	fake.resourceMutex.Unlock()
118	if fake.ResourceStub != nil {
119		return fake.ResourceStub(arg1)
120	}
121	if specificReturn {
122		return ret.result1, ret.result2, ret.result3
123	}
124	fakeReturns := fake.resourceReturns
125	return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3
126}
127
128func (fake *FakeResourceFactory) ResourceCallCount() int {
129	fake.resourceMutex.RLock()
130	defer fake.resourceMutex.RUnlock()
131	return len(fake.resourceArgsForCall)
132}
133
134func (fake *FakeResourceFactory) ResourceCalls(stub func(int) (db.Resource, bool, error)) {
135	fake.resourceMutex.Lock()
136	defer fake.resourceMutex.Unlock()
137	fake.ResourceStub = stub
138}
139
140func (fake *FakeResourceFactory) ResourceArgsForCall(i int) int {
141	fake.resourceMutex.RLock()
142	defer fake.resourceMutex.RUnlock()
143	argsForCall := fake.resourceArgsForCall[i]
144	return argsForCall.arg1
145}
146
147func (fake *FakeResourceFactory) ResourceReturns(result1 db.Resource, result2 bool, result3 error) {
148	fake.resourceMutex.Lock()
149	defer fake.resourceMutex.Unlock()
150	fake.ResourceStub = nil
151	fake.resourceReturns = struct {
152		result1 db.Resource
153		result2 bool
154		result3 error
155	}{result1, result2, result3}
156}
157
158func (fake *FakeResourceFactory) ResourceReturnsOnCall(i int, result1 db.Resource, result2 bool, result3 error) {
159	fake.resourceMutex.Lock()
160	defer fake.resourceMutex.Unlock()
161	fake.ResourceStub = nil
162	if fake.resourceReturnsOnCall == nil {
163		fake.resourceReturnsOnCall = make(map[int]struct {
164			result1 db.Resource
165			result2 bool
166			result3 error
167		})
168	}
169	fake.resourceReturnsOnCall[i] = struct {
170		result1 db.Resource
171		result2 bool
172		result3 error
173	}{result1, result2, result3}
174}
175
176func (fake *FakeResourceFactory) VisibleResources(arg1 []string) ([]db.Resource, error) {
177	var arg1Copy []string
178	if arg1 != nil {
179		arg1Copy = make([]string, len(arg1))
180		copy(arg1Copy, arg1)
181	}
182	fake.visibleResourcesMutex.Lock()
183	ret, specificReturn := fake.visibleResourcesReturnsOnCall[len(fake.visibleResourcesArgsForCall)]
184	fake.visibleResourcesArgsForCall = append(fake.visibleResourcesArgsForCall, struct {
185		arg1 []string
186	}{arg1Copy})
187	fake.recordInvocation("VisibleResources", []interface{}{arg1Copy})
188	fake.visibleResourcesMutex.Unlock()
189	if fake.VisibleResourcesStub != nil {
190		return fake.VisibleResourcesStub(arg1)
191	}
192	if specificReturn {
193		return ret.result1, ret.result2
194	}
195	fakeReturns := fake.visibleResourcesReturns
196	return fakeReturns.result1, fakeReturns.result2
197}
198
199func (fake *FakeResourceFactory) VisibleResourcesCallCount() int {
200	fake.visibleResourcesMutex.RLock()
201	defer fake.visibleResourcesMutex.RUnlock()
202	return len(fake.visibleResourcesArgsForCall)
203}
204
205func (fake *FakeResourceFactory) VisibleResourcesCalls(stub func([]string) ([]db.Resource, error)) {
206	fake.visibleResourcesMutex.Lock()
207	defer fake.visibleResourcesMutex.Unlock()
208	fake.VisibleResourcesStub = stub
209}
210
211func (fake *FakeResourceFactory) VisibleResourcesArgsForCall(i int) []string {
212	fake.visibleResourcesMutex.RLock()
213	defer fake.visibleResourcesMutex.RUnlock()
214	argsForCall := fake.visibleResourcesArgsForCall[i]
215	return argsForCall.arg1
216}
217
218func (fake *FakeResourceFactory) VisibleResourcesReturns(result1 []db.Resource, result2 error) {
219	fake.visibleResourcesMutex.Lock()
220	defer fake.visibleResourcesMutex.Unlock()
221	fake.VisibleResourcesStub = nil
222	fake.visibleResourcesReturns = struct {
223		result1 []db.Resource
224		result2 error
225	}{result1, result2}
226}
227
228func (fake *FakeResourceFactory) VisibleResourcesReturnsOnCall(i int, result1 []db.Resource, result2 error) {
229	fake.visibleResourcesMutex.Lock()
230	defer fake.visibleResourcesMutex.Unlock()
231	fake.VisibleResourcesStub = nil
232	if fake.visibleResourcesReturnsOnCall == nil {
233		fake.visibleResourcesReturnsOnCall = make(map[int]struct {
234			result1 []db.Resource
235			result2 error
236		})
237	}
238	fake.visibleResourcesReturnsOnCall[i] = struct {
239		result1 []db.Resource
240		result2 error
241	}{result1, result2}
242}
243
244func (fake *FakeResourceFactory) Invocations() map[string][][]interface{} {
245	fake.invocationsMutex.RLock()
246	defer fake.invocationsMutex.RUnlock()
247	fake.allResourcesMutex.RLock()
248	defer fake.allResourcesMutex.RUnlock()
249	fake.resourceMutex.RLock()
250	defer fake.resourceMutex.RUnlock()
251	fake.visibleResourcesMutex.RLock()
252	defer fake.visibleResourcesMutex.RUnlock()
253	copiedInvocations := map[string][][]interface{}{}
254	for key, value := range fake.invocations {
255		copiedInvocations[key] = value
256	}
257	return copiedInvocations
258}
259
260func (fake *FakeResourceFactory) recordInvocation(key string, args []interface{}) {
261	fake.invocationsMutex.Lock()
262	defer fake.invocationsMutex.Unlock()
263	if fake.invocations == nil {
264		fake.invocations = map[string][][]interface{}{}
265	}
266	if fake.invocations[key] == nil {
267		fake.invocations[key] = [][]interface{}{}
268	}
269	fake.invocations[key] = append(fake.invocations[key], args)
270}
271
272var _ db.ResourceFactory = new(FakeResourceFactory)
273