forked from cloudfoundry/cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fake_manifest_parser.go
209 lines (191 loc) · 6.71 KB
/
fake_manifest_parser.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
// Code generated by counterfeiter. DO NOT EDIT.
package v7fakes
import (
"sync"
v7 "code.cloudfoundry.org/cli/command/v7"
"code.cloudfoundry.org/cli/util/manifestparser"
"github.com/cloudfoundry/bosh-cli/director/template"
)
type FakeManifestParser struct {
InterpolateAndParseStub func(string, []string, []template.VarKV) (manifestparser.Manifest, error)
interpolateAndParseMutex sync.RWMutex
interpolateAndParseArgsForCall []struct {
arg1 string
arg2 []string
arg3 []template.VarKV
}
interpolateAndParseReturns struct {
result1 manifestparser.Manifest
result2 error
}
interpolateAndParseReturnsOnCall map[int]struct {
result1 manifestparser.Manifest
result2 error
}
MarshalManifestStub func(manifestparser.Manifest) ([]byte, error)
marshalManifestMutex sync.RWMutex
marshalManifestArgsForCall []struct {
arg1 manifestparser.Manifest
}
marshalManifestReturns struct {
result1 []byte
result2 error
}
marshalManifestReturnsOnCall map[int]struct {
result1 []byte
result2 error
}
invocations map[string][][]interface{}
invocationsMutex sync.RWMutex
}
func (fake *FakeManifestParser) InterpolateAndParse(arg1 string, arg2 []string, arg3 []template.VarKV) (manifestparser.Manifest, error) {
var arg2Copy []string
if arg2 != nil {
arg2Copy = make([]string, len(arg2))
copy(arg2Copy, arg2)
}
var arg3Copy []template.VarKV
if arg3 != nil {
arg3Copy = make([]template.VarKV, len(arg3))
copy(arg3Copy, arg3)
}
fake.interpolateAndParseMutex.Lock()
ret, specificReturn := fake.interpolateAndParseReturnsOnCall[len(fake.interpolateAndParseArgsForCall)]
fake.interpolateAndParseArgsForCall = append(fake.interpolateAndParseArgsForCall, struct {
arg1 string
arg2 []string
arg3 []template.VarKV
}{arg1, arg2Copy, arg3Copy})
fake.recordInvocation("InterpolateAndParse", []interface{}{arg1, arg2Copy, arg3Copy})
fake.interpolateAndParseMutex.Unlock()
if fake.InterpolateAndParseStub != nil {
return fake.InterpolateAndParseStub(arg1, arg2, arg3)
}
if specificReturn {
return ret.result1, ret.result2
}
fakeReturns := fake.interpolateAndParseReturns
return fakeReturns.result1, fakeReturns.result2
}
func (fake *FakeManifestParser) InterpolateAndParseCallCount() int {
fake.interpolateAndParseMutex.RLock()
defer fake.interpolateAndParseMutex.RUnlock()
return len(fake.interpolateAndParseArgsForCall)
}
func (fake *FakeManifestParser) InterpolateAndParseCalls(stub func(string, []string, []template.VarKV) (manifestparser.Manifest, error)) {
fake.interpolateAndParseMutex.Lock()
defer fake.interpolateAndParseMutex.Unlock()
fake.InterpolateAndParseStub = stub
}
func (fake *FakeManifestParser) InterpolateAndParseArgsForCall(i int) (string, []string, []template.VarKV) {
fake.interpolateAndParseMutex.RLock()
defer fake.interpolateAndParseMutex.RUnlock()
argsForCall := fake.interpolateAndParseArgsForCall[i]
return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3
}
func (fake *FakeManifestParser) InterpolateAndParseReturns(result1 manifestparser.Manifest, result2 error) {
fake.interpolateAndParseMutex.Lock()
defer fake.interpolateAndParseMutex.Unlock()
fake.InterpolateAndParseStub = nil
fake.interpolateAndParseReturns = struct {
result1 manifestparser.Manifest
result2 error
}{result1, result2}
}
func (fake *FakeManifestParser) InterpolateAndParseReturnsOnCall(i int, result1 manifestparser.Manifest, result2 error) {
fake.interpolateAndParseMutex.Lock()
defer fake.interpolateAndParseMutex.Unlock()
fake.InterpolateAndParseStub = nil
if fake.interpolateAndParseReturnsOnCall == nil {
fake.interpolateAndParseReturnsOnCall = make(map[int]struct {
result1 manifestparser.Manifest
result2 error
})
}
fake.interpolateAndParseReturnsOnCall[i] = struct {
result1 manifestparser.Manifest
result2 error
}{result1, result2}
}
func (fake *FakeManifestParser) MarshalManifest(arg1 manifestparser.Manifest) ([]byte, error) {
fake.marshalManifestMutex.Lock()
ret, specificReturn := fake.marshalManifestReturnsOnCall[len(fake.marshalManifestArgsForCall)]
fake.marshalManifestArgsForCall = append(fake.marshalManifestArgsForCall, struct {
arg1 manifestparser.Manifest
}{arg1})
fake.recordInvocation("MarshalManifest", []interface{}{arg1})
fake.marshalManifestMutex.Unlock()
if fake.MarshalManifestStub != nil {
return fake.MarshalManifestStub(arg1)
}
if specificReturn {
return ret.result1, ret.result2
}
fakeReturns := fake.marshalManifestReturns
return fakeReturns.result1, fakeReturns.result2
}
func (fake *FakeManifestParser) MarshalManifestCallCount() int {
fake.marshalManifestMutex.RLock()
defer fake.marshalManifestMutex.RUnlock()
return len(fake.marshalManifestArgsForCall)
}
func (fake *FakeManifestParser) MarshalManifestCalls(stub func(manifestparser.Manifest) ([]byte, error)) {
fake.marshalManifestMutex.Lock()
defer fake.marshalManifestMutex.Unlock()
fake.MarshalManifestStub = stub
}
func (fake *FakeManifestParser) MarshalManifestArgsForCall(i int) manifestparser.Manifest {
fake.marshalManifestMutex.RLock()
defer fake.marshalManifestMutex.RUnlock()
argsForCall := fake.marshalManifestArgsForCall[i]
return argsForCall.arg1
}
func (fake *FakeManifestParser) MarshalManifestReturns(result1 []byte, result2 error) {
fake.marshalManifestMutex.Lock()
defer fake.marshalManifestMutex.Unlock()
fake.MarshalManifestStub = nil
fake.marshalManifestReturns = struct {
result1 []byte
result2 error
}{result1, result2}
}
func (fake *FakeManifestParser) MarshalManifestReturnsOnCall(i int, result1 []byte, result2 error) {
fake.marshalManifestMutex.Lock()
defer fake.marshalManifestMutex.Unlock()
fake.MarshalManifestStub = nil
if fake.marshalManifestReturnsOnCall == nil {
fake.marshalManifestReturnsOnCall = make(map[int]struct {
result1 []byte
result2 error
})
}
fake.marshalManifestReturnsOnCall[i] = struct {
result1 []byte
result2 error
}{result1, result2}
}
func (fake *FakeManifestParser) Invocations() map[string][][]interface{} {
fake.invocationsMutex.RLock()
defer fake.invocationsMutex.RUnlock()
fake.interpolateAndParseMutex.RLock()
defer fake.interpolateAndParseMutex.RUnlock()
fake.marshalManifestMutex.RLock()
defer fake.marshalManifestMutex.RUnlock()
copiedInvocations := map[string][][]interface{}{}
for key, value := range fake.invocations {
copiedInvocations[key] = value
}
return copiedInvocations
}
func (fake *FakeManifestParser) 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 _ v7.ManifestParser = new(FakeManifestParser)