[Erp5-report] r28464 - in /erp5/trunk/products/CMFActivity: Activity/ tests/

nobody at svn.erp5.org nobody at svn.erp5.org
Wed Aug 19 15:46:29 CEST 2009


Author: jerome
Date: Wed Aug 19 15:46:27 2009
New Revision: 28464

URL: http://svn.erp5.org?rev=28464&view=rev
Log:
- fix duplicate variable name
- tests that no message are lost if we record more then MAX_MESSAGE_LIST_SIZE
  in one transaction.

Modified:
    erp5/trunk/products/CMFActivity/Activity/SQLQueue.py
    erp5/trunk/products/CMFActivity/tests/testCMFActivity.py

Modified: erp5/trunk/products/CMFActivity/Activity/SQLQueue.py
URL: http://svn.erp5.org/erp5/trunk/products/CMFActivity/Activity/SQLQueue.py?rev=28464&r1=28463&r2=28464&view=diff
==============================================================================
--- erp5/trunk/products/CMFActivity/Activity/SQLQueue.py [utf8] (original)
+++ erp5/trunk/products/CMFActivity/Activity/SQLQueue.py [utf8] Wed Aug 19 15:46:27 2009
@@ -88,13 +88,13 @@
       date_list = [m.activity_kw.get('at_date', None) for m in registered_message_list]
       tag_list = [m.activity_kw.get('tag', '') for m in registered_message_list]
       serialization_tag_list = [m.activity_kw.get('serialization_tag', '') for m in registered_message_list]
-      message_list = [self.dumpMessage(m) for m in registered_message_list]
+      dumped_message_list = [self.dumpMessage(m) for m in registered_message_list]
       activity_tool.SQLQueue_writeMessageList(uid_list=uid_list,
                                               path_list=path_list,
                                               active_process_uid_list=active_process_uid_list,
                                               method_id_list=method_id_list,
                                               priority_list=priority_list,
-                                              message_list=message_list,
+                                              message_list=dumped_message_list,
                                               date_list=date_list,
                                               tag_list=tag_list,
                                               processing_node_list=None,

Modified: erp5/trunk/products/CMFActivity/tests/testCMFActivity.py
URL: http://svn.erp5.org/erp5/trunk/products/CMFActivity/tests/testCMFActivity.py?rev=28464&r1=28463&r2=28464&view=diff
==============================================================================
--- erp5/trunk/products/CMFActivity/tests/testCMFActivity.py [utf8] (original)
+++ erp5/trunk/products/CMFActivity/tests/testCMFActivity.py [utf8] Wed Aug 19 15:46:27 2009
@@ -3306,6 +3306,58 @@
       DB.query = DB.original_query
       del DB.original_query
 
+  def test_MAX_MESSAGE_LIST_SIZE_SQLQueue(self):
+    from Products.CMFActivity.Activity import SQLQueue
+    old_MAX_MESSAGE_LIST_SIZE = SQLQueue.MAX_MESSAGE_LIST_SIZE
+    SQLQueue.MAX_MESSAGE_LIST_SIZE = 3
+
+    try:
+      global call_count
+      call_count = 0
+      def dummy_counter(self):
+        global call_count
+        call_count += 1
+
+      Organisation.dummy_counter = dummy_counter
+      o = self.portal.organisation_module.newContent(portal_type='Organisation',)
+
+      for i in range(10):
+        o.activate(activity='SQLQueue').dummy_counter()
+        
+      self.flushAllActivities()
+      self.assertEquals(call_count, 10)
+    finally:
+      SQLQueue.MAX_MESSAGE_LIST_SIZE = old_MAX_MESSAGE_LIST_SIZE
+      del Organisation.dummy_counter
+
+  def test_MAX_MESSAGE_LIST_SIZE_SQLDict(self):
+    from Products.CMFActivity.Activity import SQLDict
+    old_MAX_MESSAGE_LIST_SIZE = SQLDict.MAX_MESSAGE_LIST_SIZE
+    SQLDict.MAX_MESSAGE_LIST_SIZE = 3
+
+    try:
+      global call_count
+      call_count = 0
+      def dummy_counter(self):
+        global call_count
+        call_count += 1
+
+      o = self.portal.organisation_module.newContent(portal_type='Organisation',)
+
+      for i in range(10):
+        method_name = 'dummy_counter_%s' % i
+        setattr(Organisation, method_name, dummy_counter)
+        getattr(o.activate(activity='SQLDict'), method_name)()
+        
+      self.flushAllActivities()
+      self.assertEquals(call_count, 10)
+    finally:
+      SQLDict.MAX_MESSAGE_LIST_SIZE = old_MAX_MESSAGE_LIST_SIZE
+      for i in range(10):
+        method_name = 'dummy_counter_%s' % i
+        delattr(Organisation, method_name)
+
+
 def test_suite():
   suite = unittest.TestSuite()
   suite.addTest(unittest.makeSuite(TestCMFActivity))




More information about the Erp5-report mailing list