LEFT | RIGHT |
(no file at all) | |
1 // Copyright 2012, 2013 Canonical Ltd. | 1 // Copyright 2012, 2013 Canonical Ltd. |
2 // Licensed under the AGPLv3, see LICENCE file for details. | 2 // Licensed under the AGPLv3, see LICENCE file for details. |
3 | 3 |
4 package state_test | 4 package state_test |
5 | 5 |
6 import ( | 6 import ( |
7 stdtesting "testing" | 7 stdtesting "testing" |
8 | 8 |
9 "github.com/juju/errors" | 9 "github.com/juju/errors" |
10 "labix.org/v2/mgo" | 10 "labix.org/v2/mgo" |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 return state.AddCustomCharm(c, s.State, name, "", "", series, -1) | 87 return state.AddCustomCharm(c, s.State, name, "", "", series, -1) |
88 } | 88 } |
89 | 89 |
90 // AddConfigCharm clones a testing charm, replaces its config with | 90 // AddConfigCharm clones a testing charm, replaces its config with |
91 // the given YAML string and adds it to the state, using the given | 91 // the given YAML string and adds it to the state, using the given |
92 // revision. | 92 // revision. |
93 func (s *ConnSuite) AddConfigCharm(c *gc.C, name, configYaml string, revision in
t) *state.Charm { | 93 func (s *ConnSuite) AddConfigCharm(c *gc.C, name, configYaml string, revision in
t) *state.Charm { |
94 return state.AddCustomCharm(c, s.State, name, "config.yaml", configYaml,
"quantal", revision) | 94 return state.AddCustomCharm(c, s.State, name, "config.yaml", configYaml,
"quantal", revision) |
95 } | 95 } |
96 | 96 |
| 97 // AddActionsCharm clones a testing charm, replaces its actions schema with |
| 98 // the given YAML, and adds it to the state, using the given revision. |
| 99 func (s *ConnSuite) AddActionsCharm(c *gc.C, name, actionsYaml string, revision
int) *state.Charm { |
| 100 return state.AddCustomCharm(c, s.State, name, "actions.yaml", actionsYam
l, "quantal", revision) |
| 101 } |
| 102 |
97 // AddMetaCharm clones a testing charm, replaces its metadata with the | 103 // AddMetaCharm clones a testing charm, replaces its metadata with the |
98 // given YAML string and adds it to the state, using the given revision. | 104 // given YAML string and adds it to the state, using the given revision. |
99 func (s *ConnSuite) AddMetaCharm(c *gc.C, name, metaYaml string, revsion int) *s
tate.Charm { | 105 func (s *ConnSuite) AddMetaCharm(c *gc.C, name, metaYaml string, revsion int) *s
tate.Charm { |
100 return state.AddCustomCharm(c, s.State, name, "metadata.yaml", metaYaml,
"quantal", revsion) | 106 return state.AddCustomCharm(c, s.State, name, "metadata.yaml", metaYaml,
"quantal", revsion) |
101 } | 107 } |
102 | 108 |
103 type mockPolicy struct { | 109 type mockPolicy struct { |
104 getPrechecker func(*config.Config) (state.Prechecker, error) | 110 getPrechecker func(*config.Config) (state.Prechecker, error) |
105 getConfigValidator func(string) (state.ConfigValidator, error) | 111 getConfigValidator func(string) (state.ConfigValidator, error) |
106 getEnvironCapability func(*config.Config) (state.EnvironCapability, e
rror) | 112 getEnvironCapability func(*config.Config) (state.EnvironCapability, e
rror) |
(...skipping 28 matching lines...) Expand all Loading... |
135 } | 141 } |
136 return nil, errors.NewNotImplemented(nil, "ConstraintsValidator") | 142 return nil, errors.NewNotImplemented(nil, "ConstraintsValidator") |
137 } | 143 } |
138 | 144 |
139 func (p *mockPolicy) InstanceDistributor(cfg *config.Config) (state.InstanceDist
ributor, error) { | 145 func (p *mockPolicy) InstanceDistributor(cfg *config.Config) (state.InstanceDist
ributor, error) { |
140 if p.getInstanceDistributor != nil { | 146 if p.getInstanceDistributor != nil { |
141 return p.getInstanceDistributor(cfg) | 147 return p.getInstanceDistributor(cfg) |
142 } | 148 } |
143 return nil, errors.NewNotImplemented(nil, "InstanceDistributor") | 149 return nil, errors.NewNotImplemented(nil, "InstanceDistributor") |
144 } | 150 } |
LEFT | RIGHT |