Commit 54f41a72 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

modify test according to recent changes.

* use Quantity Accept Solver for accepting quantity decision.
* use Resource Accept Solver for accepting resource decision.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@31306 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 34b3f861
...@@ -105,32 +105,45 @@ class TestERP5SimulationMixin(TestPackingListMixin): ...@@ -105,32 +105,45 @@ class TestERP5SimulationMixin(TestPackingListMixin):
new_order_rule.validate() new_order_rule.validate()
class TestERP5Simulation(TestERP5SimulationMixin, TestPackingList): class TestERP5Simulation(TestERP5SimulationMixin, TestPackingList):
def stepAcceptDecisionQuantity(self,sequence=None, sequence_list=None, **kw): def _addSolverProcess(self, divergence, solver_portal_type):
"""
Solve quantity divergence by using solver tool.
"""
packing_list = sequence.get('packing_list')
quantity_divergence = [x for x in packing_list.getDivergenceList() \
if x.getProperty('tested_property') == 'quantity'][0]
solver_tool = self.portal.portal_solvers solver_tool = self.portal.portal_solvers
# create a solver process # create a solver process
solver_process = solver_tool.newContent(portal_type='Solver Process') solver_process = solver_tool.newContent(portal_type='Solver Process')
# create a target solver # create a target solver
solver = solver_process.newContent( solver = solver_process.newContent(
portal_type='Accept Solver', portal_type=solver_portal_type,
delivery=quantity_divergence.getProperty('object_relative_url') delivery=divergence.getProperty('object_relative_url')
) )
# create a solver decision # create a solver decision
solver_decision = solver_process.newContent( solver_decision = solver_process.newContent(
portal_type='Solver Decision', portal_type='Solver Decision',
causality=quantity_divergence.getProperty('tester_relative_url'), causality=divergence.getProperty('tester_relative_url'),
delivery=quantity_divergence.getProperty('object_relative_url'), delivery=divergence.getProperty('object_relative_url'),
solver_value=solver, solver_value=solver,
) )
# Solver Decision should be indexed to find the related Solver return solver_process
# Decision document from a Target Solver document.
transaction.commit() def stepAcceptDecisionQuantity(self,sequence=None, sequence_list=None, **kw):
self.tic() """
Solve quantity divergence by using solver tool.
"""
packing_list = sequence.get('packing_list')
quantity_divergence = [x for x in packing_list.getDivergenceList() \
if x.getProperty('tested_property') == 'quantity'][0]
solver_process = self._addSolverProcess(quantity_divergence,
'Quantity Accept Solver')
# then call solve() on solver process
solver_process.solve()
def stepAcceptDecisionResource(self,sequence=None, sequence_list=None, **kw):
"""
Solve quantity divergence by using solver tool.
"""
packing_list = sequence.get('packing_list')
resource_divergence = [x for x in packing_list.getDivergenceList() \
if x.getProperty('tested_property') == 'resource'][0]
solver_process = self._addSolverProcess(resource_divergence,
'Resource Accept Solver')
# then call solve() on solver process # then call solve() on solver process
solver_process.solve() solver_process.solve()
......
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