forked from cloudfoundry/bosh-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fake_parser.go
81 lines (71 loc) · 2.38 KB
/
fake_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
// This file was generated by counterfeiter
package manifestfakes
import (
"sync"
"github.com/cloudfoundry/bosh-cli/deployment/manifest"
"github.com/cloudfoundry/bosh-cli/deployment/template"
)
type FakeParser struct {
ParseStub func(interpolatedTemplate template.InterpolatedTemplate, path string) (manifest.Manifest, error)
parseMutex sync.RWMutex
parseArgsForCall []struct {
interpolatedTemplate template.InterpolatedTemplate
path string
}
parseReturns struct {
result1 manifest.Manifest
result2 error
}
invocations map[string][][]interface{}
invocationsMutex sync.RWMutex
}
func (fake *FakeParser) Parse(interpolatedTemplate template.InterpolatedTemplate, path string) (manifest.Manifest, error) {
fake.parseMutex.Lock()
fake.parseArgsForCall = append(fake.parseArgsForCall, struct {
interpolatedTemplate template.InterpolatedTemplate
path string
}{interpolatedTemplate, path})
fake.recordInvocation("Parse", []interface{}{interpolatedTemplate, path})
fake.parseMutex.Unlock()
if fake.ParseStub != nil {
return fake.ParseStub(interpolatedTemplate, path)
} else {
return fake.parseReturns.result1, fake.parseReturns.result2
}
}
func (fake *FakeParser) ParseCallCount() int {
fake.parseMutex.RLock()
defer fake.parseMutex.RUnlock()
return len(fake.parseArgsForCall)
}
func (fake *FakeParser) ParseArgsForCall(i int) (template.InterpolatedTemplate, string) {
fake.parseMutex.RLock()
defer fake.parseMutex.RUnlock()
return fake.parseArgsForCall[i].interpolatedTemplate, fake.parseArgsForCall[i].path
}
func (fake *FakeParser) ParseReturns(result1 manifest.Manifest, result2 error) {
fake.ParseStub = nil
fake.parseReturns = struct {
result1 manifest.Manifest
result2 error
}{result1, result2}
}
func (fake *FakeParser) Invocations() map[string][][]interface{} {
fake.invocationsMutex.RLock()
defer fake.invocationsMutex.RUnlock()
fake.parseMutex.RLock()
defer fake.parseMutex.RUnlock()
return fake.invocations
}
func (fake *FakeParser) 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 _ manifest.Parser = new(FakeParser)