From 56b40c65af37e70bc7581122557144e911031f38 Mon Sep 17 00:00:00 2001
From: Kazuhiko Shiozaki <kazuhiko@nexedi.com>
Date: Tue, 15 Dec 2009 13:42:05 +0000
Subject: [PATCH] override stepSplitAndDeferPackingList to use the new
 simulation API.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@31312 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5/tests/testERP5Simulation.py | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)

diff --git a/product/ERP5/tests/testERP5Simulation.py b/product/ERP5/tests/testERP5Simulation.py
index cdc46d5ac9..4e5603f8e5 100644
--- a/product/ERP5/tests/testERP5Simulation.py
+++ b/product/ERP5/tests/testERP5Simulation.py
@@ -105,15 +105,15 @@ class TestERP5SimulationMixin(TestPackingListMixin):
       new_order_rule.validate()
 
 class TestERP5Simulation(TestERP5SimulationMixin, TestPackingList):
-  def _addSolverProcess(self, divergence, solver_portal_type):
+  def _addSolverProcess(self, divergence, solver_portal_type, **kw):
     solver_tool = self.portal.portal_solvers
     # create a solver process
     solver_process = solver_tool.newContent(portal_type='Solver Process')
     # create a target solver
     solver = solver_process.newContent(
       portal_type=solver_portal_type,
-      delivery=divergence.getProperty('object_relative_url')
-      )
+      delivery=divergence.getProperty('object_relative_url'),
+      **kw)
     # create a solver decision
     solver_decision = solver_process.newContent(
       portal_type='Solver Decision',
@@ -147,6 +147,20 @@ class TestERP5Simulation(TestERP5SimulationMixin, TestPackingList):
     # then call solve() on solver process
     solver_process.solve()
 
+  def stepSplitAndDeferPackingList(self, sequence=None, sequence_list=None, **kw):
+    """
+      Do the split and defer action
+    """
+    packing_list = sequence.get('packing_list')
+    quantity_divergence = [x for x in packing_list.getDivergenceList() \
+                           if x.getProperty('tested_property') == 'quantity'][0]
+    kw = {'delivery_solver':'FIFO',
+          'start_date':self.datetime + 15,
+          'stop_date':self.datetime + 25}
+    solver_process = self._addSolverProcess(quantity_divergence,
+                                            'Quantity Split Solver', **kw)
+    solver_process.solve()
+
 def test_suite():
   suite = unittest.TestSuite()
   suite.addTest(unittest.makeSuite(TestERP5Simulation))
-- 
2.30.9