Commit a606c493 authored by Roque's avatar Roque

Document Module HBTree migration post upgrade constraint

See merge request !16
parents d4398718 332117e4
Pipeline #15129 failed with stage
in 0 seconds
...@@ -76,6 +76,27 @@ class TestSlapOSConfigurator(testOfficeJSAppstoreMixin): ...@@ -76,6 +76,27 @@ class TestSlapOSConfigurator(testOfficeJSAppstoreMixin):
conversion_url = "https://cloudooo.erp5.net/" conversion_url = "https://cloudooo.erp5.net/"
self.assertEqual(preference_tool.getPreferredDocumentConversionServerUrl(), conversion_url) self.assertEqual(preference_tool.getPreferredDocumentConversionServerUrl(), conversion_url)
def testDocumentModuleMigration(self):
"""
check document module folder was migrated to HBTree
"""
document_module = self.portal.document_module
self.assertEqual(document_module.getIdGenerator(), '_generatePerDayId')
self.assertEqual(document_module.isBTree(), False)
self.assertEqual(document_module.isHBTree(), True)
#check existing documents with custom ids were not migrated
existing_doc = self.portal.portal_catalog.getResultValue(
portal_type = 'File',
reference = 'data/application_sample.json')
self.assertEqual(existing_doc.getId(), 'store_officejs_data_application_sample_json')
#check new documents use new id format
doc = document_module.newContent()
self.tic()
date = doc.getCreationDate().Date().replace('/', '')
self.assertTrue(doc.getId().startswith('%s-' % date))
def notestModuleHasIdGeneratorByDay(self): def notestModuleHasIdGeneratorByDay(self):
""" Ensure the Constraint sets appropriate id generator on all modules. """ Ensure the Constraint sets appropriate id generator on all modules.
""" """
...@@ -169,7 +190,6 @@ class TestSlapOSConfigurator(testOfficeJSAppstoreMixin): ...@@ -169,7 +190,6 @@ class TestSlapOSConfigurator(testOfficeJSAppstoreMixin):
'workflow_module', 'workflow_module',
]) ])
def testConfiguredBusinessTemplateList(self): def testConfiguredBusinessTemplateList(self):
""" Make sure Installed business Templates are """ Make sure Installed business Templates are
what it is expected. """ what it is expected. """
......
...@@ -100,24 +100,28 @@ ...@@ -100,24 +100,28 @@
</record> </record>
<record id="4" aka="AAAAAAAAAAQ="> <record id="4" aka="AAAAAAAAAAQ=">
<pickle> <pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/> <global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle> </pickle>
<pickle> <pickle>
<tuple> <dictionary>
<none/> <item>
<list> <key> <string>_log</string> </key>
<dictionary> <value>
<item> <list>
<key> <string>action</string> </key> <dictionary>
<value> <string>validate</string> </value> <item>
</item> <key> <string>action</string> </key>
<item> <value> <string>validate</string> </value>
<key> <string>validation_state</string> </key> </item>
<value> <string>validated</string> </value> <item>
</item> <key> <string>validation_state</string> </key>
</dictionary> <value> <string>validated</string> </value>
</list> </item>
</tuple> </dictionary>
</list>
</value>
</item>
</dictionary>
</pickle> </pickle>
</record> </record>
</ZopeData> </ZopeData>
<property_sheet_list> <property_sheet_list>
<portal_type id="Document Module">
<item>DocumentModuleOfficeJSUpgradeConstraint</item>
</portal_type>
<portal_type id="Preference Tool"> <portal_type id="Preference Tool">
<item>PreferenceToolAppstoreConstraint</item> <item>PreferenceToolAppstoreConstraint</item>
</portal_type> </portal_type>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Property Sheet" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_count</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>_mt_index</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>_tree</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>DocumentModuleOfficeJSUpgradeConstraint</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Property Sheet</string> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="Length" module="BTrees.Length"/>
</pickle>
<pickle> <int>0</int> </pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="OOBTree" module="BTrees.OOBTree"/>
</pickle>
<pickle>
<none/>
</pickle>
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="OOBTree" module="BTrees.OOBTree"/>
</pickle>
<pickle>
<none/>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Script Constraint" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_identity_criterion</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>_range_criterion</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>constraint_type/post_upgrade</string>
</tuple>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>document_module_hbtree_folder_constraint</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Script Constraint</string> </value>
</item>
<item>
<key> <string>script_id</string> </key>
<value> <string>DocumentModule_migrateFolderToHBTree</string> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
portal = context.getPortalObject()
document_module = portal.document_module
if not document_module.isHBTree():
document_module.migrateToHBTree(migration_generate_id_method="Base_generateIdFromCreationDate",
new_generate_id_method="_generatePerDayId",
bundle_count=100)
return []
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>fixit=False</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>DocumentModule_migrateFolderToHBTree</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
Document Module | DocumentModuleOfficeJSUpgradeConstraint
Preference Tool | PreferenceToolAppstoreConstraint Preference Tool | PreferenceToolAppstoreConstraint
Software Product | SoftwareProductAppstoreConstraint Software Product | SoftwareProductAppstoreConstraint
Web Section | WebSectionAppstoreConstraint Web Section | WebSectionAppstoreConstraint
\ No newline at end of file
PreferenceToolAppstoreConstraint PreferenceToolAppstoreConstraint
SoftwareProductAppstoreConstraint SoftwareProductAppstoreConstraint
WebSectionAppstoreConstraint WebSectionAppstoreConstraint
\ No newline at end of file DocumentModuleOfficeJSUpgradeConstraint
\ No newline at end of file
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