/
plan.go
99 lines (87 loc) · 2.17 KB
/
plan.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
package fakes
import (
"github.com/cloudfoundry/bosh-bootloader/commands"
"github.com/cloudfoundry/bosh-bootloader/storage"
)
type Plan struct {
CheckFastFailsCall struct {
CallCount int
Receives struct {
SubcommandFlags []string
State storage.State
}
Returns struct {
Error error
}
}
ParseArgsCall struct {
CallCount int
Receives struct {
Args []string
State storage.State
}
Returns struct {
Config commands.PlanConfig
Error error
}
}
ExecuteCall struct {
CallCount int
Receives struct {
Args []string
State storage.State
}
Returns struct {
Error error
}
}
InitializePlanCall struct {
CallCount int
Receives struct {
Plan commands.PlanConfig
State storage.State
}
Returns struct {
State storage.State
Error error
}
}
IsInitializedCall struct {
CallCount int
Receives struct {
State storage.State
}
Returns struct {
IsInitialized bool
}
}
}
func (p *Plan) CheckFastFails(subcommandFlags []string, state storage.State) error {
p.CheckFastFailsCall.CallCount++
p.CheckFastFailsCall.Receives.SubcommandFlags = subcommandFlags
p.CheckFastFailsCall.Receives.State = state
return p.CheckFastFailsCall.Returns.Error
}
func (p *Plan) ParseArgs(args []string, state storage.State) (commands.PlanConfig, error) {
p.ParseArgsCall.CallCount++
p.ParseArgsCall.Receives.Args = args
p.ParseArgsCall.Receives.State = state
return p.ParseArgsCall.Returns.Config, p.ParseArgsCall.Returns.Error
}
func (p *Plan) Execute(args []string, state storage.State) error {
p.ExecuteCall.CallCount++
p.ExecuteCall.Receives.Args = args
p.ExecuteCall.Receives.State = state
return p.ExecuteCall.Returns.Error
}
func (p *Plan) InitializePlan(plan commands.PlanConfig, state storage.State) (storage.State, error) {
p.InitializePlanCall.CallCount++
p.InitializePlanCall.Receives.Plan = plan
p.InitializePlanCall.Receives.State = state
return p.InitializePlanCall.Returns.State, p.InitializePlanCall.Returns.Error
}
func (p *Plan) IsInitialized(state storage.State) bool {
p.IsInitializedCall.CallCount++
p.IsInitializedCall.Receives.State = state
return p.IsInitializedCall.Returns.IsInitialized
}