forked from cloudfoundry/bosh-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fake_session.go
242 lines (218 loc) · 6.83 KB
/
fake_session.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
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
// This file was generated by counterfeiter
package cmdfakes
import (
"sync"
"github.com/cloudfoundry/bosh-cli/cmd"
"github.com/cloudfoundry/bosh-cli/cmd/config"
"github.com/cloudfoundry/bosh-cli/director"
"github.com/cloudfoundry/bosh-cli/uaa"
)
type FakeSession struct {
EnvironmentStub func() string
environmentMutex sync.RWMutex
environmentArgsForCall []struct{}
environmentReturns struct {
result1 string
}
CredentialsStub func() config.Creds
credentialsMutex sync.RWMutex
credentialsArgsForCall []struct{}
credentialsReturns struct {
result1 config.Creds
}
UAAStub func() (uaa.UAA, error)
uAAMutex sync.RWMutex
uAAArgsForCall []struct{}
uAAReturns struct {
result1 uaa.UAA
result2 error
}
DirectorStub func() (director.Director, error)
directorMutex sync.RWMutex
directorArgsForCall []struct{}
directorReturns struct {
result1 director.Director
result2 error
}
AnonymousDirectorStub func() (director.Director, error)
anonymousDirectorMutex sync.RWMutex
anonymousDirectorArgsForCall []struct{}
anonymousDirectorReturns struct {
result1 director.Director
result2 error
}
DeploymentStub func() (director.Deployment, error)
deploymentMutex sync.RWMutex
deploymentArgsForCall []struct{}
deploymentReturns struct {
result1 director.Deployment
result2 error
}
invocations map[string][][]interface{}
invocationsMutex sync.RWMutex
}
func (fake *FakeSession) Environment() string {
fake.environmentMutex.Lock()
fake.environmentArgsForCall = append(fake.environmentArgsForCall, struct{}{})
fake.recordInvocation("Environment", []interface{}{})
fake.environmentMutex.Unlock()
if fake.EnvironmentStub != nil {
return fake.EnvironmentStub()
} else {
return fake.environmentReturns.result1
}
}
func (fake *FakeSession) EnvironmentCallCount() int {
fake.environmentMutex.RLock()
defer fake.environmentMutex.RUnlock()
return len(fake.environmentArgsForCall)
}
func (fake *FakeSession) EnvironmentReturns(result1 string) {
fake.EnvironmentStub = nil
fake.environmentReturns = struct {
result1 string
}{result1}
}
func (fake *FakeSession) Credentials() config.Creds {
fake.credentialsMutex.Lock()
fake.credentialsArgsForCall = append(fake.credentialsArgsForCall, struct{}{})
fake.recordInvocation("Credentials", []interface{}{})
fake.credentialsMutex.Unlock()
if fake.CredentialsStub != nil {
return fake.CredentialsStub()
} else {
return fake.credentialsReturns.result1
}
}
func (fake *FakeSession) CredentialsCallCount() int {
fake.credentialsMutex.RLock()
defer fake.credentialsMutex.RUnlock()
return len(fake.credentialsArgsForCall)
}
func (fake *FakeSession) CredentialsReturns(result1 config.Creds) {
fake.CredentialsStub = nil
fake.credentialsReturns = struct {
result1 config.Creds
}{result1}
}
func (fake *FakeSession) UAA() (uaa.UAA, error) {
fake.uAAMutex.Lock()
fake.uAAArgsForCall = append(fake.uAAArgsForCall, struct{}{})
fake.recordInvocation("UAA", []interface{}{})
fake.uAAMutex.Unlock()
if fake.UAAStub != nil {
return fake.UAAStub()
} else {
return fake.uAAReturns.result1, fake.uAAReturns.result2
}
}
func (fake *FakeSession) UAACallCount() int {
fake.uAAMutex.RLock()
defer fake.uAAMutex.RUnlock()
return len(fake.uAAArgsForCall)
}
func (fake *FakeSession) UAAReturns(result1 uaa.UAA, result2 error) {
fake.UAAStub = nil
fake.uAAReturns = struct {
result1 uaa.UAA
result2 error
}{result1, result2}
}
func (fake *FakeSession) Director() (director.Director, error) {
fake.directorMutex.Lock()
fake.directorArgsForCall = append(fake.directorArgsForCall, struct{}{})
fake.recordInvocation("Director", []interface{}{})
fake.directorMutex.Unlock()
if fake.DirectorStub != nil {
return fake.DirectorStub()
} else {
return fake.directorReturns.result1, fake.directorReturns.result2
}
}
func (fake *FakeSession) DirectorCallCount() int {
fake.directorMutex.RLock()
defer fake.directorMutex.RUnlock()
return len(fake.directorArgsForCall)
}
func (fake *FakeSession) DirectorReturns(result1 director.Director, result2 error) {
fake.DirectorStub = nil
fake.directorReturns = struct {
result1 director.Director
result2 error
}{result1, result2}
}
func (fake *FakeSession) AnonymousDirector() (director.Director, error) {
fake.anonymousDirectorMutex.Lock()
fake.anonymousDirectorArgsForCall = append(fake.anonymousDirectorArgsForCall, struct{}{})
fake.recordInvocation("AnonymousDirector", []interface{}{})
fake.anonymousDirectorMutex.Unlock()
if fake.AnonymousDirectorStub != nil {
return fake.AnonymousDirectorStub()
} else {
return fake.anonymousDirectorReturns.result1, fake.anonymousDirectorReturns.result2
}
}
func (fake *FakeSession) AnonymousDirectorCallCount() int {
fake.anonymousDirectorMutex.RLock()
defer fake.anonymousDirectorMutex.RUnlock()
return len(fake.anonymousDirectorArgsForCall)
}
func (fake *FakeSession) AnonymousDirectorReturns(result1 director.Director, result2 error) {
fake.AnonymousDirectorStub = nil
fake.anonymousDirectorReturns = struct {
result1 director.Director
result2 error
}{result1, result2}
}
func (fake *FakeSession) Deployment() (director.Deployment, error) {
fake.deploymentMutex.Lock()
fake.deploymentArgsForCall = append(fake.deploymentArgsForCall, struct{}{})
fake.recordInvocation("Deployment", []interface{}{})
fake.deploymentMutex.Unlock()
if fake.DeploymentStub != nil {
return fake.DeploymentStub()
} else {
return fake.deploymentReturns.result1, fake.deploymentReturns.result2
}
}
func (fake *FakeSession) DeploymentCallCount() int {
fake.deploymentMutex.RLock()
defer fake.deploymentMutex.RUnlock()
return len(fake.deploymentArgsForCall)
}
func (fake *FakeSession) DeploymentReturns(result1 director.Deployment, result2 error) {
fake.DeploymentStub = nil
fake.deploymentReturns = struct {
result1 director.Deployment
result2 error
}{result1, result2}
}
func (fake *FakeSession) Invocations() map[string][][]interface{} {
fake.invocationsMutex.RLock()
defer fake.invocationsMutex.RUnlock()
fake.environmentMutex.RLock()
defer fake.environmentMutex.RUnlock()
fake.credentialsMutex.RLock()
defer fake.credentialsMutex.RUnlock()
fake.uAAMutex.RLock()
defer fake.uAAMutex.RUnlock()
fake.directorMutex.RLock()
defer fake.directorMutex.RUnlock()
fake.anonymousDirectorMutex.RLock()
defer fake.anonymousDirectorMutex.RUnlock()
fake.deploymentMutex.RLock()
defer fake.deploymentMutex.RUnlock()
return fake.invocations
}
func (fake *FakeSession) 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 _ cmd.Session = new(FakeSession)