Commit 342e0862 authored by Yusuke Muraoka's avatar Yusuke Muraoka

forgot some updates for a test

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@27647 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 5e2d14d6
...@@ -203,3 +203,53 @@ class BusinessProcess(Path, XMLObject): ...@@ -203,3 +203,53 @@ class BusinessProcess(Path, XMLObject):
path_list = self.objectValues(portal_type=self.getPortalBusinessPathTypeList()) path_list = self.objectValues(portal_type=self.getPortalBusinessPathTypeList())
return filter(None, [path.getTradePhase() return filter(None, [path.getTradePhase()
for path in path_list]) for path in path_list])
def getRootExplanationPathValue(self):
"""
Returns a root path of this business process
"""
path_list = self.objectValues(portal_type=self.getPortalBusinessPathTypeList())
path_list = filter(lambda x: x.isDeliverable(), path_list)
if len(path_list) > 1:
raise Exception, "this business process has multi root paths"
if len(path_list) == 1:
return path_list[0]
def getHeadPathValueList(self, trade_phase_list=None):
"""
Returns a list of head path(s) of this business process
trade_phase_list -- used to filterring, means that discovering
a list of head path with the trade_phase_list
"""
head_path_list = list()
for state in self.getStateValueList():
if len(state.getSuccessorRelatedValueList()) == 0:
head_path_list += state.getPredecessorRelatedValueList()
if trade_phase_list is not None:
_set = set(trade_phase_list)
_list = list()
# start to discover a head path with the trade_phase_list from head path(s) of whole
for path in head_path_list:
_list += self._getHeadPathValueList(path, _set)
head_path_list = map(lambda t: t[0], filter(lambda t: t != (None, None), _list))
return head_path_list
def _getHeadPathValueList(self, path, trade_phase_set):
# if the path has target trade_phase, it is a head path.
_set = set(path.getTradePhaseList())
if _set & trade_phase_set:
return [(path, _set & trade_phase_set)]
node = path.getSuccessorValue()
if node is None:
return [(None, None)]
_list = list()
for next_path in node.getPredecessorRelatedValueList():
_list += self._getHeadPathValueList(next_path, trade_phase_set)
return _list
...@@ -254,7 +254,7 @@ class TestMRPMixin(TestBPMMixin): ...@@ -254,7 +254,7 @@ class TestMRPMixin(TestBPMMixin):
class TestMRPImplementation(TestMRPMixin, ERP5TypeTestCase): class TestMRPImplementation(TestMRPMixin, ERP5TypeTestCase):
"""the test for implementation""" """the test for implementation"""
def test_TransformationRule_getHeadProductionPathList(self): def test_TransformationRule_getHeadProductionPathList(self):
rule = self.portal.portal_rules.default_transformation_rule rule = self.portal.portal_rules.default_transformation_model_rule
transformation = self.createDefaultTransformation() transformation = self.createDefaultTransformation()
...@@ -303,7 +303,7 @@ class TestMRPImplementation(TestMRPMixin, ERP5TypeTestCase): ...@@ -303,7 +303,7 @@ class TestMRPImplementation(TestMRPMixin, ERP5TypeTestCase):
# test mock # test mock
applied_rule = movement.newContent(potal_type='Applied Rule') applied_rule = movement.newContent(potal_type='Applied Rule')
rule = self.portal.portal_rules.default_transformation_rule rule = self.portal.portal_rules.default_transformation_model_rule
rule.expand(applied_rule) rule.expand(applied_rule)
# assertion # assertion
...@@ -367,7 +367,7 @@ class TestMRPImplementation(TestMRPMixin, ERP5TypeTestCase): ...@@ -367,7 +367,7 @@ class TestMRPImplementation(TestMRPMixin, ERP5TypeTestCase):
# test mock # test mock
applied_rule = movement.newContent(potal_type='Applied Rule') applied_rule = movement.newContent(potal_type='Applied Rule')
rule = self.portal.portal_rules.default_transformation_rule rule = self.portal.portal_rules.default_transformation_model_rule
rule.expand(applied_rule) rule.expand(applied_rule)
# assertion # assertion
...@@ -428,7 +428,7 @@ class TestMRPImplementation(TestMRPMixin, ERP5TypeTestCase): ...@@ -428,7 +428,7 @@ class TestMRPImplementation(TestMRPMixin, ERP5TypeTestCase):
movement._baseSetFrozen(1) movement._baseSetFrozen(1)
# re-expand # re-expand
rule = self.portal.portal_rules.default_transformation_rule rule = self.portal.portal_rules.default_transformation_model_rule
rule.expand(applied_rule) rule.expand(applied_rule)
# assertion # assertion
...@@ -506,7 +506,7 @@ class TestMRPImplementation(TestMRPMixin, ERP5TypeTestCase): ...@@ -506,7 +506,7 @@ class TestMRPImplementation(TestMRPMixin, ERP5TypeTestCase):
# test mock # test mock
applied_rule = movement.newContent(potal_type='Applied Rule') applied_rule = movement.newContent(potal_type='Applied Rule')
rule = self.portal.portal_rules.default_transformation_sourcing_rule rule = self.portal.portal_rules.default_transformation_sourcing_model_rule
rule.expand(applied_rule) rule.expand(applied_rule)
# assertion # assertion
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment