This repository has been archived by the owner on Mar 13, 2021. It is now read-only.
forked from cloudfoundry/guardian
-
Notifications
You must be signed in to change notification settings - Fork 1
/
fake_depot.go
209 lines (188 loc) · 5.58 KB
/
fake_depot.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
// This file was generated by counterfeiter
package rundmcfakes
import (
"sync"
"code.cloudfoundry.org/guardian/rundmc"
"code.cloudfoundry.org/guardian/rundmc/depot"
"code.cloudfoundry.org/lager"
)
type FakeDepot struct {
CreateStub func(log lager.Logger, handle string, bundle depot.BundleSaver) error
createMutex sync.RWMutex
createArgsForCall []struct {
log lager.Logger
handle string
bundle depot.BundleSaver
}
createReturns struct {
result1 error
}
LookupStub func(log lager.Logger, handle string) (path string, err error)
lookupMutex sync.RWMutex
lookupArgsForCall []struct {
log lager.Logger
handle string
}
lookupReturns struct {
result1 string
result2 error
}
DestroyStub func(log lager.Logger, handle string) error
destroyMutex sync.RWMutex
destroyArgsForCall []struct {
log lager.Logger
handle string
}
destroyReturns struct {
result1 error
}
HandlesStub func() ([]string, error)
handlesMutex sync.RWMutex
handlesArgsForCall []struct{}
handlesReturns struct {
result1 []string
result2 error
}
invocations map[string][][]interface{}
invocationsMutex sync.RWMutex
}
func (fake *FakeDepot) Create(log lager.Logger, handle string, bundle depot.BundleSaver) error {
fake.createMutex.Lock()
fake.createArgsForCall = append(fake.createArgsForCall, struct {
log lager.Logger
handle string
bundle depot.BundleSaver
}{log, handle, bundle})
fake.recordInvocation("Create", []interface{}{log, handle, bundle})
fake.createMutex.Unlock()
if fake.CreateStub != nil {
return fake.CreateStub(log, handle, bundle)
} else {
return fake.createReturns.result1
}
}
func (fake *FakeDepot) CreateCallCount() int {
fake.createMutex.RLock()
defer fake.createMutex.RUnlock()
return len(fake.createArgsForCall)
}
func (fake *FakeDepot) CreateArgsForCall(i int) (lager.Logger, string, depot.BundleSaver) {
fake.createMutex.RLock()
defer fake.createMutex.RUnlock()
return fake.createArgsForCall[i].log, fake.createArgsForCall[i].handle, fake.createArgsForCall[i].bundle
}
func (fake *FakeDepot) CreateReturns(result1 error) {
fake.CreateStub = nil
fake.createReturns = struct {
result1 error
}{result1}
}
func (fake *FakeDepot) Lookup(log lager.Logger, handle string) (path string, err error) {
fake.lookupMutex.Lock()
fake.lookupArgsForCall = append(fake.lookupArgsForCall, struct {
log lager.Logger
handle string
}{log, handle})
fake.recordInvocation("Lookup", []interface{}{log, handle})
fake.lookupMutex.Unlock()
if fake.LookupStub != nil {
return fake.LookupStub(log, handle)
} else {
return fake.lookupReturns.result1, fake.lookupReturns.result2
}
}
func (fake *FakeDepot) LookupCallCount() int {
fake.lookupMutex.RLock()
defer fake.lookupMutex.RUnlock()
return len(fake.lookupArgsForCall)
}
func (fake *FakeDepot) LookupArgsForCall(i int) (lager.Logger, string) {
fake.lookupMutex.RLock()
defer fake.lookupMutex.RUnlock()
return fake.lookupArgsForCall[i].log, fake.lookupArgsForCall[i].handle
}
func (fake *FakeDepot) LookupReturns(result1 string, result2 error) {
fake.LookupStub = nil
fake.lookupReturns = struct {
result1 string
result2 error
}{result1, result2}
}
func (fake *FakeDepot) Destroy(log lager.Logger, handle string) error {
fake.destroyMutex.Lock()
fake.destroyArgsForCall = append(fake.destroyArgsForCall, struct {
log lager.Logger
handle string
}{log, handle})
fake.recordInvocation("Destroy", []interface{}{log, handle})
fake.destroyMutex.Unlock()
if fake.DestroyStub != nil {
return fake.DestroyStub(log, handle)
} else {
return fake.destroyReturns.result1
}
}
func (fake *FakeDepot) DestroyCallCount() int {
fake.destroyMutex.RLock()
defer fake.destroyMutex.RUnlock()
return len(fake.destroyArgsForCall)
}
func (fake *FakeDepot) DestroyArgsForCall(i int) (lager.Logger, string) {
fake.destroyMutex.RLock()
defer fake.destroyMutex.RUnlock()
return fake.destroyArgsForCall[i].log, fake.destroyArgsForCall[i].handle
}
func (fake *FakeDepot) DestroyReturns(result1 error) {
fake.DestroyStub = nil
fake.destroyReturns = struct {
result1 error
}{result1}
}
func (fake *FakeDepot) Handles() ([]string, error) {
fake.handlesMutex.Lock()
fake.handlesArgsForCall = append(fake.handlesArgsForCall, struct{}{})
fake.recordInvocation("Handles", []interface{}{})
fake.handlesMutex.Unlock()
if fake.HandlesStub != nil {
return fake.HandlesStub()
} else {
return fake.handlesReturns.result1, fake.handlesReturns.result2
}
}
func (fake *FakeDepot) HandlesCallCount() int {
fake.handlesMutex.RLock()
defer fake.handlesMutex.RUnlock()
return len(fake.handlesArgsForCall)
}
func (fake *FakeDepot) HandlesReturns(result1 []string, result2 error) {
fake.HandlesStub = nil
fake.handlesReturns = struct {
result1 []string
result2 error
}{result1, result2}
}
func (fake *FakeDepot) Invocations() map[string][][]interface{} {
fake.invocationsMutex.RLock()
defer fake.invocationsMutex.RUnlock()
fake.createMutex.RLock()
defer fake.createMutex.RUnlock()
fake.lookupMutex.RLock()
defer fake.lookupMutex.RUnlock()
fake.destroyMutex.RLock()
defer fake.destroyMutex.RUnlock()
fake.handlesMutex.RLock()
defer fake.handlesMutex.RUnlock()
return fake.invocations
}
func (fake *FakeDepot) recordInvocation(key string, args []interface{}) {
fake.invocationsMutex.Lock()
defer fake.invocationsMutex.Unlock()
if fake.invocations == nil {
fake.invocations = map[string][][]interface{}{}
}
if fake.invocations[key] == nil {
fake.invocations[key] = [][]interface{}{}
}
fake.invocations[key] = append(fake.invocations[key], args)
}
var _ rundmc.Depot = new(FakeDepot)