Rename Command to Action

Some Python class and packages need to be renamed
for a better compliance with the shared terminology
which provides a better understanding of Watcher
objects and components by every contributor.

This patchset is there to change Command to Action

Partially implements: blueprint glossary-related-refactoring

Change-Id: Id38e133fc8b789319c7db5712d3820ecca1bd51d
This commit is contained in:
Jean-Emile DARTOIS
2015-12-04 18:44:32 +01:00
parent 98f05a52a8
commit c5c16ac055
7 changed files with 43 additions and 25 deletions

View File

@@ -18,7 +18,7 @@
#
import mock
from watcher.applier.execution.executor import CommandExecutor
from watcher.applier.execution.executor import ActionPlanExecutor
from watcher import objects
from watcher.common import utils
@@ -32,7 +32,7 @@ class TestCommandExecutor(DbTestCase):
def setUp(self):
super(TestCommandExecutor, self).setUp()
self.applier = mock.MagicMock()
self.executor = CommandExecutor(self.applier, self.context)
self.executor = ActionPlanExecutor(self.applier, self.context)
def test_execute(self):
actions = mock.MagicMock()

View File

@@ -17,7 +17,7 @@
# limitations under the License.
#
import mock
from watcher.applier.mapper.default import DefaultCommandMapper
from watcher.applier.mapper.default import DefaultActionMapper
from watcher.decision_engine.planner.default import Primitives
from watcher.tests import base
@@ -25,33 +25,34 @@ from watcher.tests import base
class TestCommandMapper(base.TestCase):
def setUp(self):
super(TestCommandMapper, self).setUp()
self.mapper = DefaultCommandMapper()
self.mapper = DefaultActionMapper()
def test_build_command_cold(self):
action = mock.MagicMock()
action.action_type = Primitives.COLD_MIGRATE.value
cmd = self.mapper.build_primitive_command(action)
cmd = self.mapper.build_primitive_from_action(action)
self.assertIsNotNone(cmd)
def test_build_command_live(self):
action = mock.MagicMock()
action.action_type = Primitives.LIVE_MIGRATE.value
cmd = self.mapper.build_primitive_command(action)
cmd = self.mapper.build_primitive_from_action(action)
self.assertIsNotNone(cmd)
def test_build_command_h_s(self):
action = mock.MagicMock()
action.action_type = Primitives.HYPERVISOR_STATE.value
cmd = self.mapper.build_primitive_command(action)
cmd = self.mapper.build_primitive_from_action(action)
self.assertIsNotNone(cmd)
def test_build_command_p_s(self):
action = mock.MagicMock()
action.action_type = Primitives.POWER_STATE.value
cmd = self.mapper.build_primitive_command(action)
cmd = self.mapper.build_primitive_from_action(action)
self.assertIsNotNone(cmd)
def test_build_command_exception_attribute(self):
action = mock.MagicMock
self.assertRaises(AttributeError, self.mapper.build_primitive_command,
self.assertRaises(AttributeError,
self.mapper.build_primitive_from_action,
action)