Commit ba25f4b1 authored by Jérome Perrin's avatar Jérome Perrin

- fix duplicate variable name

- tests that no message are lost if we record more then MAX_MESSAGE_LIST_SIZE
  in one transaction.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@28464 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent da4963cc
...@@ -88,13 +88,13 @@ class SQLQueue(RAMQueue, SQLBase): ...@@ -88,13 +88,13 @@ class SQLQueue(RAMQueue, SQLBase):
date_list = [m.activity_kw.get('at_date', None) for m in registered_message_list] 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] 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] 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, activity_tool.SQLQueue_writeMessageList(uid_list=uid_list,
path_list=path_list, path_list=path_list,
active_process_uid_list=active_process_uid_list, active_process_uid_list=active_process_uid_list,
method_id_list=method_id_list, method_id_list=method_id_list,
priority_list=priority_list, priority_list=priority_list,
message_list=message_list, message_list=dumped_message_list,
date_list=date_list, date_list=date_list,
tag_list=tag_list, tag_list=tag_list,
processing_node_list=None, processing_node_list=None,
......
...@@ -3306,6 +3306,58 @@ class TestCMFActivity(ERP5TypeTestCase): ...@@ -3306,6 +3306,58 @@ class TestCMFActivity(ERP5TypeTestCase):
DB.query = DB.original_query DB.query = DB.original_query
del 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(): def test_suite():
suite = unittest.TestSuite() suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestCMFActivity)) suite.addTest(unittest.makeSuite(TestCMFActivity))
......
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