Commit f461be81 authored by Sebastien Robin's avatar Sebastien Robin

corrected bugs when a message is splitted

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@871 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 405ad021
master allow_login_change allow_login_change_wip arnau arnau-TM-FEC-output arnau-TM-isBuildable-with-multiple-BusinessLinks arnau-TM-jabber-client-desktop-notifications arnau-kns arnau-kns-without-property-mapping arnau-merge arnau-poc arnau-real-time-inventory-accounting auto_extend_select_list autoflake backup_erp5_workflow bk_erp5ish_actions_tool bk_sqlcatalog boc-interaction-drop bryton/py3 bt5_config cache callable-jupyter-storage catalog_filter catalog_fulltext catalog_fulltext_old cedric cedriclen cedriclen-eos certificate_authority cherry-pick-243c2f03 cherry-pick-304d7a28 cherry-pick-4a8e045d cleanJSByJSLint clean_up_upgrader cleanup_acquisition_base_category compact_title_no_reference credential_update_action datetimefield deferred_listbox delivery_item_barcode douglas_forum dream_distributor dsn-phase3 eos-dev erp5-component erp5-forum erp5-imt erp5-messenger erp5-preference erp5-release erp5-slapos-upgrade erp5-util-testing erp5-vifib erp5-vifib-cleanup erp5_calendar erp5_catalog erp5_catalog_final erp5_corporate_identity erp5_free_subscription erp5_hal_json_style_fix_restricted_access_with_traverse erp5_payslip_migration erp5_workflow erp5testnode_max_timeout experiment/coding_style_test_suite feat/olapy feat/pdm_content_translation feature/accounting-reports-stats feature/hal-actions-support feature/hal-support-update feature/jio-accounting-reports feature/jio-action-accounting feature/jio-selection-actions feature/json-allows-all-jio-actions feature/renderjs-matrixbox feature/renderjs-ui-no-header feature/rjs-listbox-stats feature/rjs-mass-transition feature/rjs-print-action fix/consistency_check_alarm fix/login_validate_check_consistency fix/multiple_small_fixes_to_zodb_history_tab fix/support-request-app-empty fix_system_processes_ownership for_testrunner_1 for_testrunner_2 for_testrunner_3 gabriel gabriel-fix-rounding-in-accounting-generation gabriel-fix-rounding-in-accounting-generation2 gadget-json-value hotfix/accounting-test-timeout hotfix/callable_tool hotfix/field-keeps-request hotfix/jio-mass-transition hotfix/jio_view hotfix/pdm-test hotfix/rjs-accounting-tests hotfix/rjs-editability hotfix/rjs-form-less-invasive hotfix/rjs-formfields-padding hotfix/rjs-listbox-mutex hotfix/rjs-replace-query-with-uids hotfix/tests-cleanup http_cache_fix improve_default_caching_policy_manager initsite interaction-drop isDeletable item_tracking_graph_editor ivan jerome-bt-reference-doc jerome_graph_editor_renderjs jerome_new_style_solve_divergence jerome_user_preference_time_zone jio jm/form-action-guard joblib-activity js-ui keep_order_in_set_type_category_accessor kns kns-kr lazy_simulation_causality lignan lingnan listbox-generator listbox_url macros_fix mame mame-bt5-cleanup mame-erp5_project-cleanup mame-naming-convention mame-naming-convention-list_method mame-test-stock-indexation mame-work mame2 maste_copy master-erp5-test-result-scalability master-erp5-test-result-scalability-rebase master-test-fix-additionalbt5path master_calendar_wip_patches master_calendar_wip_patches_extend_security master_no_guard_on_workflow_transition master_no_guard_on_workflow_transition_plus_calendar_wip_patchs mic_wind mmariani-inventory monitoring monitoring-graph mrp new-render-presentation no_longer_simulated_state officejs officejs_clean officejs_zip ojs_wip pere portal_callables portal_solver_process_security_configuration presentation rebased_mrp refactor/base_edit refactor/renderjs reindex_calendar_after_change_calendar_exception revert-38554dbe revert-6c89fe9b rewrite_test_21_AcquiredPortalType romain-fulltext scalability-master scalability-master2 scalability-master2-rebase scalability-roque scalability-roque-2 scalability-run-command shop-box sms_more_than_140_characters strict_catalog syncml taskdistribution-xmlrpc-binary test_page testnode_software_link timezones tmp/getInstalledBusinessTemplate_never_installed_bt tristan tristan-merge tristan-performance ttrm upgradeSite view-aggregated-amounts vivekpab_renderjs_interfaces w3validator_removal wenjie wenjie_branch wip wsgi yryr yryr-components-cp yryr-inventory-cache yryr-test yryr-with-components yusei test-ui test-rjsacc test-rjs renderjs-test erp5.util-0.4.58 erp5.util-0.4.57 erp5.util-0.4.56 erp5.util-0.4.55 erp5.util-0.4.54 erp5.util-0.4.53 erp5.util-0.4.52 erp5.util-0.4.49 erp5.util-0.4.46 erp5.util-0.4.44 erp5.util-0.4.43 erp5.util-0.4.41 erp5.util-0.4.40 erp5.util-0.4.37 erp5.util-0.4.1 erp5.util-0.4 erp5.util-0.3 erp5.util-0.2 erp5.util-0.1
No related merge requests found
......@@ -674,7 +674,7 @@ class ERP5Conduit(XMLSyncUtilsMixin):
"""
if type(xml) in (type('a'),type(u'a')):
LOG('Conduit.convertToXml xml',0,repr(xml))
if xml is type(u'a'):
if type(xml) is type(u'a'):
xml = xml.encode('utf-8')
xml = parseString(xml)
LOG('Conduit.convertToXml not failed',0,'ok')
......
......@@ -252,10 +252,14 @@ class Signature(SyncCode):
# and we just get the confirmation
self.setXML(self.getTempXML())
self.setTempXML(None)
self.setPartialXML(None)
self.setSubscriberXupdate(None)
self.setPublisherXupdate(None)
if len(self.getConflictList())>0:
self.resetConflictList()
if status == self.NOT_SYNCHRONIZED:
self.setTempXML(None)
self.setPartialXML(None)
elif status in (self.PUB_CONFLICT_MERGE,self.SENT):
# We have a solution for the conflict, don't need to keep the list
self.resetConflictList()
......@@ -393,9 +397,11 @@ class Signature(SyncCode):
Set the partial string we will have to
deliver in the future
"""
#LOG('Subscriber.setPartialXML before',0,'partial_xml: %s' % str(self.partial_xml))
LOG('Subscriber.setPartialXML before',0,'partial_xml: %s' % str(self.partial_xml))
if type(xml) is type(u'a'):
xml = xml.encode('utf-8')
self.partial_xml = xml
#LOG('Subscriber.setPartialXML after',0,'partial_xml: %s' % str(self.partial_xml))
LOG('Subscriber.setPartialXML after',0,'partial_xml: %s' % str(self.partial_xml))
def getPartialXML(self):
"""
......
......@@ -446,7 +446,10 @@ class XMLSyncUtilsMixin(SyncCode, ActiveObject):
#if subnode3.data.find('<!--')>=0:
# data = subnode3.data
# data = data[data.find('<!--')+4:data.rfind('-->')]
return subnode3.data
xml = subnode3.data
if type(xml) is type(u'a'):
xml = xml.encode('utf-8')
return xml
return None
......@@ -713,7 +716,7 @@ class XMLSyncUtilsMixin(SyncCode, ActiveObject):
LOG('SyncModif',0,'data_subnode: %s' % data_subnode)
#data_subnode = FromXml(data_subnode)
data_subnode = parseString(data_subnode)
data_subnode = data_subnode.childNodes[1] # Because we just created a new xml
data_subnode = data_subnode.childNodes[0] # Because we just created a new xml
# document, with childNodes[0] a DocumentType and childNodes[1] the Element Node
else:
data_subnode = self.getDataSubNode(next_action)
......@@ -787,7 +790,7 @@ class XMLSyncUtilsMixin(SyncCode, ActiveObject):
signature.setStatus(self.PARTIAL)
#LOG('SyncModif',0,'setPartialXML: %s' % str(previous_partial))
previous_partial = signature.getPartialXML() or ''
if previous_partial.find(partial_data)<0:
#if previous_partial.find(partial_data)<0: # XXX bad thing
previous_partial += partial_data
signature.setPartialXML(previous_partial)
#LOG('SyncModif',0,'previous_partial: %s' % str(previous_partial))
......
......@@ -46,6 +46,7 @@ from Testing import ZopeTestCase
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from AccessControl.SecurityManagement import newSecurityManager, noSecurityManager
from Products.ERP5SyncML.Conduit.ERP5Conduit import ERP5Conduit
from Products.ERP5SyncML.SyncCode import SyncCode
from zLOG import LOG
import time
......@@ -408,10 +409,11 @@ class TestERP5SyncML(ERP5TypeTestCase):
for sub in portal_sync.getSubscriptionList():
for m in sub.getSignatureList():
self.assertEquals(m.getTempXML(),None)
self.assertEquals(m.getPartialXML(),None)
for pub in portal_sync.getPublicationList():
for sub in pub.getSubscriberList():
for m in sub.getSignatureList():
self.assertEquals(m.getTempXML(),None)
self.assertEquals(m.getPartialXML(),None)
def checkSynchronizationStateIsConflict(self, quiet=0, run=run_all_test):
portal_sync = self.getSynchronizationTool()
......@@ -1000,6 +1002,41 @@ class TestERP5SyncML(ERP5TypeTestCase):
self.assertEqual(role_1_s,role_1_c)
self.assertEqual(role_2_s,role_2_c)
def testPartialData(self, quiet=0, run=run_all_test):
"""
We will do a first synchronization, then we will do a change, then
we will modify the SyncCode max_line value so it
it will generate many messages
"""
if not run: return
self.testFirstSynchronization(quiet=1,run=1)
if not quiet:
ZopeTestCase._print('\nTest Partial Data ')
LOG('Testing... ',0,'testPartialData')
previous_max_lines = SyncCode.MAX_LINES
SyncCode.MAX_LINES = 10
self.populatePersonServerWithSubObject(quiet=1,run=1)
self.synchronize(self.sub_id1)
self.synchronize(self.sub_id2)
self.checkSynchronizationStateIsSynchronized()
person_client1 = self.getPersonClient1()
person1_c = person_client1._getOb(self.id1)
sub_person1_c = person1_c._getOb(self.id1)
sub_sub_person1 = sub_person1_c._getOb(self.id1)
sub_sub_person2 = sub_person1_c._getOb(self.id2)
# remove ('','portal...','person_server')
len_path = len(sub_sub_person1.getPhysicalPath()) - 3
self.failUnless(len_path==3)
len_path = len(sub_sub_person2.getPhysicalPath()) - 3
self.failUnless(len_path==3)
self.failUnless(sub_sub_person1.getDescription()==self.description1)
self.failUnless(sub_sub_person1.getFirstName()==self.first_name1)
self.failUnless(sub_sub_person1.getLastName()==self.last_name1)
self.failUnless(sub_sub_person2.getDescription()==self.description2)
self.failUnless(sub_sub_person2.getFirstName()==self.first_name2)
self.failUnless(sub_sub_person2.getLastName()==self.last_name2)
SyncCode.MAX_LINES = previous_max_lines
# We may add a test in order to check if the slow_sync mode works fine, ie
# if we do have both object on the client and server side, we must make sure
# that the server first sends is own data
......
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