Commit 355cc80e authored by Rafael Monnerat's avatar Rafael Monnerat

Use Promise magic to configure cloudooo, memcached and kumofs.

parent 061549e4
......@@ -26,7 +26,6 @@
#
##############################################################################
from Products.ERP5Type.tests.ERP5TypeTestCase import _getConversionServerDict
from Products.ERP5Type.tests.Sequence import SequenceList
from Products.ERP5Configurator.tests.ConfiguratorTestMixin import \
TestLiveConfiguratorWorkflowMixin
......@@ -85,7 +84,8 @@ class TestRunMyDocsConfiguratorWorkflowMixin(TestLiveConfiguratorWorkflowMixin):
"""
def getBusinessTemplateList(self):
return ('erp5_core_proxy_field_legacy',
return ('erp5_promise',
'erp5_core_proxy_field_legacy',
'erp5_full_text_myisam_catalog',
'erp5_base',
'erp5_workflow',
......@@ -191,15 +191,6 @@ class TestRunMyDocsConfiguratorWorkflowMixin(TestLiveConfiguratorWorkflowMixin):
person_config_item = person_config_save["3"]
self.assertEquals(person_config_item.getReference(), "french_assignor")
def stepCheckSystemPreferenceAfterInstallation(self, sequence=None, sequence_list=None, **kw):
""" Check System Preference"""
system_preference = self.portal.portal_catalog.getResultValue(portal_type="System Preference")
conversion_dict = _getConversionServerDict()
self.assertEquals(system_preference.getPreferredOoodocServerPortNumber(),
conversion_dict['port'])
self.assertEquals(system_preference.getPreferredOoodocServerAddress(),
conversion_dict['hostname'])
def stepCheckUserPreferenceAfterInstallation(self, sequence=None, sequence_list=None, **kw):
""" Check System Preference"""
portal_catalog = self.portal.portal_catalog
......
8
\ No newline at end of file
9
\ No newline at end of file
......@@ -25,7 +25,6 @@
#
##############################################################################
from Products.ERP5Type.tests.ERP5TypeTestCase import _getConversionServerDict
from Products.ERP5Type.tests.Sequence import SequenceList
from Products.ERP5Configurator.tests.ConfiguratorTestMixin import \
TestLiveConfiguratorWorkflowMixin
......@@ -105,7 +104,8 @@ class TestUNGConfiguratorWorkflowMixin(TestLiveConfiguratorWorkflowMixin):
"""
def getBusinessTemplateList(self):
return ('erp5_core_proxy_field_legacy',
return ('erp5_promise',
'erp5_core_proxy_field_legacy',
'erp5_full_text_myisam_catalog',
'erp5_base',
'erp5_workflow',
......@@ -217,15 +217,6 @@ class TestUNGConfiguratorWorkflowMixin(TestLiveConfiguratorWorkflowMixin):
response_dict = sequence.get("response_dict")
self.assertEquals('show', response_dict['command'])
def stepCheckSystemPreferenceAfterInstallation(self, sequence=None, sequence_list=None, **kw):
""" Check System Preference"""
system_preference = self.portal.portal_catalog.getResultValue(portal_type="System Preference")
conversion_dict = _getConversionServerDict()
self.assertEquals(system_preference.getPreferredOoodocServerPortNumber(),
conversion_dict['port'])
self.assertEquals(system_preference.getPreferredOoodocServerAddress(),
conversion_dict['hostname'])
def stepCheckUserPreferenceAfterInstallation(self, sequence=None, sequence_list=None, **kw):
""" Check System Preference"""
portal_catalog = self.portal.portal_catalog
......
58
\ No newline at end of file
59
\ No newline at end of file
......@@ -30,7 +30,6 @@
import unittest
import os
from Products.ERP5Type.tests.ERP5TypeTestCase import _getConversionServerDict
from Products.ERP5Type.tests.ERP5TypeLiveTestCase import ERP5TypeLiveTestCase
from zLOG import LOG, INFO, ERROR
from Products.CMFCore.utils import getToolByName
......@@ -58,7 +57,8 @@ class TestIngestion(ERP5TypeLiveTestCase):
"""
Return the list of required business templates.
"""
return ('erp5_base',
return ('erp5_promise',
'erp5_base',
'erp5_ingestion',
'erp5_ingestion_mysql_innodb_catalog',
'erp5_web',
......@@ -87,15 +87,11 @@ class TestIngestion(ERP5TypeLiveTestCase):
self.tic()
def setSystemPreference(self):
portal_preferences = getToolByName(self.portal, 'portal_preferences')
default_pref = portal_preferences.default_site_preference
conversion_dict = _getConversionServerDict()
default_pref.setPreferredOoodocServerAddress(conversion_dict['hostname'])
default_pref.setPreferredOoodocServerPortNumber(conversion_dict['port'])
default_pref.setPreferredDocumentFileNameRegularExpression(FILE_NAME_REGULAR_EXPRESSION)
self.portal.portal_alarms.promise_conversion_server.solve()
self.tic()
default_pref = self.portal.portal_preferences.getActiveSystemPreference()
default_pref.setPreferredDocumentFilenameRegularExpression(FILENAME_REGULAR_EXPRESSION)
default_pref.setPreferredDocumentReferenceRegularExpression(REFERENCE_REGULAR_EXPRESSION)
if default_pref.getPreferenceState() != 'global':
default_pref.enable()
def contributeFileWithUrl(self, script_id, filename=None):
"""compute url and call portal_contributions.newContentFromUrl
......
145
\ No newline at end of file
145
......@@ -28,7 +28,6 @@
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from Products.ERP5Type.tests.utils import FileUpload
from Products.ERP5Type.tests.ERP5TypeTestCase import _getConversionServerDict
from DateTime import DateTime
import os.path
import Products.ERP5.tests
......@@ -45,7 +44,8 @@ class TestUNG(ERP5TypeTestCase):
return "UNG Tests"
def getBusinessTemplateList(self):
return ('erp5_ingestion_mysql_innodb_catalog',
return ('erp5_promise',
'erp5_ingestion_mysql_innodb_catalog',
'erp5_full_text_myisam_catalog',
'erp5_base',
'erp5_jquery',
......@@ -523,11 +523,7 @@ class TestUNG(ERP5TypeTestCase):
portal_preferences = portal.portal_preferences
web_page_module = portal.web_page_module
portal_contributions = portal.portal_contributions
system_preference = portal_preferences.newContent(portal_type='System Preference')
conversion_dict = _getConversionServerDict()
system_preference.setPreferredOoodocServerAddress(conversion_dict["hostname"])
system_preference.setPreferredOoodocServerPortNumber(conversion_dict["port"])
system_preference.enable()
self.portal.portal_alarms.promise_conversion_server.solve()
self.tic()
document_path, filename = self.getDocumentPath()
file = FileUpload(document_path, filename)
......
410
\ No newline at end of file
411
\ No newline at end of file
......@@ -33,8 +33,7 @@ import os
from Testing import ZopeTestCase
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase,\
_getConversionServerDict
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from AccessControl.SecurityManagement import newSecurityManager
from AccessControl import getSecurityManager
from Products.ERP5Type.tests.Sequence import SequenceList
......@@ -79,7 +78,7 @@ class TestBase(ERP5TypeTestCase, ZopeTestCase.Functional):
def getBusinessTemplateList(self):
"""
"""
return ('erp5_base',)
return ('erp5_promise', 'erp5_base',)
def login(self):
uf = self.getPortal().acl_users
......@@ -94,7 +93,8 @@ class TestBase(ERP5TypeTestCase, ZopeTestCase.Functional):
portal_catalog = self.getCatalogTool()
#portal_catalog.manage_catalogClear()
self.createCategories()
self.setDefaultSitePreference()
self.portal.portal_alarms.promise_conversion_server.solve()
self.tic()
#Overwrite immediateReindexObject() with a crashing method
def crashingMethod(self):
......@@ -120,15 +120,6 @@ class TestBase(ERP5TypeTestCase, ZopeTestCase.Functional):
o = self.category_tool.group.newContent(portal_type='Category',
id=category_id)
def setDefaultSitePreference(self):
default_pref = self.portal.portal_preferences.default_site_preference
conversion_dict = _getConversionServerDict()
default_pref.setPreferredOoodocServerAddress(conversion_dict['hostname'])
default_pref.setPreferredOoodocServerPortNumber(conversion_dict['port'])
if self.portal.portal_workflow.isTransitionPossible(default_pref, 'enable'):
default_pref.enable()
return default_pref
def stepRemoveWorkflowsRelated(self, sequence=None, sequence_list=None,
**kw):
"""
......
......@@ -31,8 +31,7 @@ import os
from Products.CMFCore.WorkflowCore import WorkflowException
from Products.ERP5Type.tests.utils import FileUpload
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase,\
_getConversionServerDict
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from Products.ERP5OOo.tests.testIngestion import FILENAME_REGULAR_EXPRESSION
from Products.ERP5OOo.tests.testIngestion import REFERENCE_REGULAR_EXPRESSION
from Products.ERP5Type.tests.backportUnittest import expectedFailure
......@@ -81,7 +80,8 @@ class TestCRM(BaseTestCRM):
return "CRM"
def getBusinessTemplateList(self):
return ('erp5_full_text_myisam_catalog',
return ('erp5_promise',
'erp5_full_text_myisam_catalog',
'erp5_core_proxy_field_legacy',
'erp5_base',
'erp5_ingestion',
......@@ -436,7 +436,8 @@ class TestCRMMailIngestion(BaseTestCRM):
def getBusinessTemplateList(self):
# Mail Ingestion must work with CRM alone.
return ('erp5_core_proxy_field_legacy',
return ('erp5_promise',
'erp5_core_proxy_field_legacy',
'erp5_full_text_myisam_catalog',
'erp5_base',
'erp5_ingestion',
......@@ -802,7 +803,8 @@ class TestCRMMailSend(BaseTestCRM):
def getBusinessTemplateList(self):
# In this test, We will attach some document portal types in event.
# So we add DMS and Web.
return ('erp5_base',
return ('erp5_promise',
'erp5_base',
'erp5_ingestion',
'erp5_ingestion_mysql_innodb_catalog',
'erp5_crm',
......@@ -835,14 +837,12 @@ class TestCRMMailSend(BaseTestCRM):
default_email_text='me@erp5.org')
# set preference
default_pref = self.portal.portal_preferences.default_site_preference
conversion_dict = _getConversionServerDict()
default_pref.setPreferredOoodocServerAddress(conversion_dict['hostname'])
default_pref.setPreferredOoodocServerPortNumber(conversion_dict['port'])
self.portal.portal_alarms.promise_conversion_server.solve()
self.tic()
default_pref = self.portal.portal_preferences.getActiveSystemPreference()
default_pref.setPreferredDocumentFilenameRegularExpression(FILENAME_REGULAR_EXPRESSION)
default_pref.setPreferredDocumentReferenceRegularExpression(REFERENCE_REGULAR_EXPRESSION)
if default_pref.getPreferenceState() == 'disabled':
default_pref.enable()
# make sure customers are available to catalog
self.tic()
......
......@@ -30,10 +30,6 @@
import unittest
import transaction
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase,\
_getConversionServerDict
class TestERP5WebWithCRM(ERP5TypeTestCase):
"""Test for erp5_web and erp5_crm features
"""
......@@ -45,7 +41,8 @@ class TestERP5WebWithCRM(ERP5TypeTestCase):
"""
Return the list of required business templates.
"""
return ('erp5_base',
return ('erp5_promise',
'erp5_base',
'erp5_ingestion',
'erp5_ingestion_mysql_innodb_catalog',
'erp5_crm',
......@@ -55,25 +52,10 @@ class TestERP5WebWithCRM(ERP5TypeTestCase):
def afterSetUp(self):
self.login()
self.setSystemPreference()
self.portal.portal_alarms.promise_conversion_server.solve()
user = self.createUser('robby')
self.createUserAssignment(user, {})
def setSystemPreference(self):
portal_type = 'System Preference'
preference_list = self.portal.portal_preferences.contentValues(
portal_type=portal_type)
if not preference_list:
preference = self.portal.portal_preferences.newContent(
portal_type=portal_type)
else:
preference = preference_list[0]
conversion_dict = _getConversionServerDict()
preference.setPreferredOoodocServerAddress(conversion_dict['hostname'])
preference.setPreferredOoodocServerPortNumber(conversion_dict['port'])
if self.portal.portal_workflow.isTransitionPossible(preference, 'enable'):
preference.enable()
def clearModule(self, module):
module.manage_delObjects(list(module.objectIds()))
self.tic()
......
......@@ -35,8 +35,7 @@ from lxml import etree
from AccessControl import Unauthorized
from AccessControl.SecurityManagement import newSecurityManager
from Testing import ZopeTestCase
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase,\
_getConversionServerDict
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from Products.ERP5Type.tests.utils import FileUpload, createZODBPythonScript
from Products.ERP5.Document.Document import ConversionError
......@@ -96,7 +95,8 @@ class TestERP5WebWithDms(ERP5TypeTestCase, ZopeTestCase.Functional):
"""
Return the list of required business templates.
"""
return ('erp5_core_proxy_field_legacy',
return ('erp5_promise',
'erp5_core_proxy_field_legacy',
'erp5_base',
'erp5_jquery',
'erp5_knowledge_pad',
......@@ -109,20 +109,11 @@ class TestERP5WebWithDms(ERP5TypeTestCase, ZopeTestCase.Functional):
def afterSetUp(self):
self.login()
portal = self.getPortal()
self.setDefaultSitePreference()
self.portal.portal_alarms.promise_conversion_server.solve()
self.web_page_module = self.portal.web_page_module
self.web_site_module = self.portal.web_site_module
self.portal_id = self.portal.getId()
def setDefaultSitePreference(self):
default_pref = self.portal.portal_preferences.default_site_preference
conversion_dict = _getConversionServerDict()
default_pref.setPreferredOoodocServerAddress(conversion_dict['hostname'])
default_pref.setPreferredOoodocServerPortNumber(conversion_dict['port'])
if self.portal.portal_workflow.isTransitionPossible(default_pref, 'enable'):
default_pref.enable()
return default_pref
def clearModule(self, module):
module.manage_delObjects(list(module.objectIds()))
self.tic()
......
......@@ -50,6 +50,7 @@ class TestKMMixIn(TestDocumentMixin):
manager_password = ''
website_id = 'km_test'
business_template_list = ['erp5_core_proxy_field_legacy',
'erp5_promise',
'erp5_full_text_myisam_catalog','erp5_base',
'erp5_jquery', 'erp5_jquery_ui', 'erp5_knowledge_pad',
'erp5_ingestion_mysql_innodb_catalog', 'erp5_ingestion',
......
......@@ -28,8 +28,7 @@
##############################################################################
import unittest
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase,\
_getConversionServerDict
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
import urlnorm # This library is imported to detect lack of
# urlnorm availibility in python environment
......@@ -44,7 +43,6 @@ class TestWebCrawler(ERP5TypeTestCase):
"""
_path_to_delete_list = []
system_pref_id = 'my_preference'
def getTitle(self):
"""
......@@ -56,7 +54,8 @@ class TestWebCrawler(ERP5TypeTestCase):
"""
Return the list of required business templates.
"""
return ('erp5_core_proxy_field_legacy',
return ('erp5_promise',
'erp5_core_proxy_field_legacy',
'erp5_base',
'erp5_ingestion',
'erp5_ingestion_mysql_innodb_catalog',
......@@ -89,23 +88,11 @@ class TestWebCrawler(ERP5TypeTestCase):
self.tic()
def setSystemPreference(self):
portal_preferences = self.portal.portal_preferences
system_preference = portal_preferences._getOb(self.system_pref_id, None)
if system_preference is None:
system_preference = portal_preferences.newContent(id=self.system_pref_id,
portal_type='System Preference')
conversion_dict = _getConversionServerDict()
system_preference.\
setPreferredOoodocServerAddress(conversion_dict['hostname'])
system_preference.\
setPreferredOoodocServerPortNumber(conversion_dict['port'])
system_preference.setPreferredDocumentFilenameRegularExpression(
FILENAME_REGULAR_EXPRESSION)
system_preference.setPreferredDocumentReferenceRegularExpression(
REFERENCE_REGULAR_EXPRESSION)
if system_preference.getPreferenceState() != 'global':
system_preference.enable()
self.portal.portal_alarms.promise_conversion_server.solve()
self.tic()
default_pref = self.portal.portal_preferences.getActiveSystemPreference()
default_pref.setPreferredDocumentFilenameRegularExpression(FILENAME_REGULAR_EXPRESSION)
default_pref.setPreferredDocumentReferenceRegularExpression(REFERENCE_REGULAR_EXPRESSION)
def bootstrapWebSite(self):
"""Create 1 Website
......@@ -278,7 +265,7 @@ class TestWebCrawler(ERP5TypeTestCase):
self.assertFalse(len(new_web_crawler))
# set another namespace on preference
preference = self.portal.portal_preferences[self.system_pref_id]
preference = self.portal.portal_preferences.getActiveSystemPreference()
preference.setPreferredIngestionNamespace('NEW')
self.tic()
new_web_crawler.crawlContent()
......
......@@ -30,9 +30,9 @@
from DateTime import DateTime
from AccessControl import Unauthorized
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase, \
_getConversionServerDict
from Products.ERP5Type.tests.SecurityTestCase import SecurityTestCase
from Products.ERP5Type.tests.ERP5TypeTestCase import _getConversionServerDict
from AccessControl.SecurityManagement import newSecurityManager
class TestLiveConfiguratorWorkflowMixin(SecurityTestCase):
......@@ -85,7 +85,8 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase):
'erp5_ooo_import')
def getBusinessTemplateList(self):
return ('erp5_core_proxy_field_legacy',
return ('erp5_promise',
'erp5_core_proxy_field_legacy',
'erp5_full_text_myisam_catalog',
'erp5_base',
'erp5_workflow',
......@@ -119,24 +120,9 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase):
# it is required by SecurityTestCase
self.workflow_tool = self.portal.portal_workflow
self.setDefaultSitePreference()
self.setSystemPreference()
self.portal.portal_alarms.promise_conversion_server.solve()
self.portal.portal_activities.unsubscribe()
def setSystemPreference(self):
portal_type = 'System Preference'
preference_list = self.portal.portal_preferences.contentValues(
portal_type=portal_type)
if not preference_list:
preference = self.portal.portal_preferences.newContent(
portal_type=portal_type)
else:
preference = preference_list[0]
conversion_dict = _getConversionServerDict()
preference.setPreferredOoodocServerAddress(conversion_dict['hostname'])
preference.setPreferredOoodocServerPortNumber(conversion_dict['port'])
if self.portal.portal_workflow.isTransitionPossible(preference, 'enable'):
preference.enable()
def setDefaultSitePreference(self):
default_pref = self.portal.portal_preferences.default_site_preference
if self.portal.portal_workflow.isTransitionPossible(default_pref, 'enable'):
......@@ -159,6 +145,14 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase):
(step_title, server_response))
### STEPS
def stepCheckSystemPreferenceAfterInstallation(self, sequence=None, sequence_list=None, **kw):
""" Check System Preference"""
system_preference = self.portal.portal_preferences.getActiveSystemPreference()
conversion_dict = _getConversionServerDict()
self.assertEquals(system_preference.getPreferredOoodocServerPortNumber(),
conversion_dict['port'])
self.assertEquals(system_preference.getPreferredOoodocServerAddress(),
conversion_dict['hostname'])
def stepCleanUpRequest(self, sequence=None, sequence_list=None, **kw):
""" Restore clean up the request """
......
......@@ -43,6 +43,7 @@ class TestConfiguratorItem(TestLiveConfiguratorWorkflowMixin):
def getBusinessTemplateList(self):
return ('erp5_core_proxy_field_legacy',
'erp5_promise',
'erp5_full_text_myisam_catalog',
'erp5_base',
'erp5_workflow',
......
......@@ -38,6 +38,7 @@ class TestConfiguratorTool(TestLiveConfiguratorWorkflowMixin):
def getBusinessTemplateList(self):
return ('erp5_core_proxy_field_legacy',
'erp5_promise',
'erp5_full_text_myisam_catalog',
'erp5_base',
'erp5_workflow',
......
......@@ -31,7 +31,6 @@
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from Products.ERP5Type.tests.ERP5TypeTestCase import _getConversionServerDict
from AccessControl.SecurityManagement import newSecurityManager
from StringIO import StringIO
......@@ -39,7 +38,7 @@ class TestFormPrintoutMixin(ERP5TypeTestCase):
run_all_test = 1
def getBusinessTemplateList(self):
return ('erp5_base', 'erp5_ui_test', 'erp5_odt_style')
return ('erp5_promise', 'erp5_base', 'erp5_ui_test', 'erp5_odt_style')
def login(self):
uf = self.getPortal().acl_users
......@@ -48,13 +47,7 @@ class TestFormPrintoutMixin(ERP5TypeTestCase):
newSecurityManager(None, user)
def setSystemPreference(self):
default_pref = self.portal.portal_preferences.default_site_preference
conversion_dict = _getConversionServerDict()
default_pref.setPreferredOoodocServerAddress(conversion_dict['hostname'])
default_pref.setPreferredOoodocServerPortNumber(conversion_dict['port'])
#default_pref.setPreferredConversionCacheFactory('document_cache_factory')
if default_pref.getPreferenceState() != 'global':
default_pref.enable()
self.portal.portal_alarms.promise_conversion_server.solve()
def _validate(self, odf_file_data):
error_list = self.validator.validate(odf_file_data)
......
......@@ -53,7 +53,6 @@ from cgi import FieldStorage
import ZPublisher.HTTPRequest
from Testing import ZopeTestCase
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from Products.ERP5Type.tests.ERP5TypeTestCase import _getConversionServerDict
from Products.ERP5Type.tests.utils import FileUpload
from Products.ERP5Type.tests.utils import DummyLocalizer
from Products.ERP5OOo.OOoUtils import OOoBuilder
......@@ -93,6 +92,7 @@ def makeFileUpload(name, as_name=None):
class TestDocumentMixin(ERP5TypeTestCase):
business_template_list = ['erp5_core_proxy_field_legacy',
'erp5_promise',
'erp5_jquery',
'erp5_full_text_myisam_catalog',
'erp5_base',
......@@ -112,41 +112,17 @@ class TestDocumentMixin(ERP5TypeTestCase):
def afterSetUp(self):
TestDocumentMixin.login(self)
self.setDefaultSitePreference()
self.setSystemPreference()
self.tic()
self.login()
def setDefaultSitePreference(self):
default_pref = self.portal.portal_preferences.default_site_preference
conversion_dict = _getConversionServerDict()
default_pref.setPreferredOoodocServerAddress(conversion_dict['hostname'])
default_pref.setPreferredOoodocServerPortNumber(conversion_dict['port'])
def setSystemPreference(self):
self.portal.portal_alarms.promise_conversion_server.solve()
self.tic()
default_pref = self.portal.portal_preferences.getActiveSystemPreference()
default_pref.setPreferredDocumentFilenameRegularExpression(FILENAME_REGULAR_EXPRESSION)
default_pref.setPreferredDocumentReferenceRegularExpression(REFERENCE_REGULAR_EXPRESSION)
if self.portal.portal_workflow.isTransitionPossible(default_pref, 'enable'):
default_pref.enable()
return default_pref
def setSystemPreference(self):
portal_type = 'System Preference'
preference_list = self.portal.portal_preferences.contentValues(
portal_type=portal_type)
if not preference_list:
# create a Cache Factory for tests
cache_factory = self.portal.portal_caches.newContent(portal_type = 'Cache Factory')
cache_factory.cache_duration = 36000
cache_plugin = cache_factory.newContent(portal_type='Ram Cache')
cache_plugin.cache_expire_check_interval = 54000
preference = self.portal.portal_preferences.newContent(title="Default System Preference",
# use local RAM based cache as some tests need it
preferred_conversion_cache_factory = cache_factory.getId(),
portal_type=portal_type)
else:
preference = preference_list[0]
if self.portal.portal_workflow.isTransitionPossible(preference, 'enable'):
preference.enable()
return preference
default_pref.edit(preferred_conversion_cache_factory='erp5_content_long')
def getDocumentModule(self):
return getattr(self.getPortal(),'document_module')
......
......@@ -42,21 +42,18 @@ class TestDocumentWithFlare(TestDocument):
return "DMS with Flare"
def setSystemPreference(self):
system_preference = TestDocument.setSystemPreference(self)
TestDocument.setSystemPreference(self)
system_preference =self.portal.portal_preferences.getActiveSystemPreference()
system_preference.setPreferredConversionCacheFactory('dms_cache_factory')
memcached = _getPersistentMemcachedServerDict()
# create a Cache Factory for tests
cache_factory = self.portal.portal_caches.newContent(portal_type = 'Cache Factory')
cache_factory.cache_duration = 15768000
cache_plugin = cache_factory.newContent(portal_type='Distributed Ram Cache')
system_preference.setPreferredConversionCacheFactory(cache_factory.getId())
persistent_memcached_plugin = self.portal.portal_memcached.persistent_memcached_plugin
persistent_memcached_plugin.setUrlString('%s:%s' %(memcached['hostname'], memcached['port']))
cache_plugin.setSpecialiseValue(persistent_memcached_plugin)
self.portal.portal_caches.dms_cache_factory.persistent_cache_plugin.setSpecialiseValue(persistent_memcached_plugin)
def test_suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestDocumentWithFlare))
return suite
# vim: syntax=python shiftwidth=2
......@@ -85,7 +85,7 @@ class TestIngestion(ERP5TypeTestCase):
"""
Return the list of required business templates.
"""
return ('erp5_core_proxy_field_legacy', 'erp5_base',
return ('erp5_core_proxy_field_legacy', 'erp5_promise', 'erp5_base',
'erp5_ingestion', 'erp5_ingestion_mysql_innodb_catalog',
'erp5_web', 'erp5_crm', 'erp5_dms')
......@@ -141,14 +141,11 @@ class TestIngestion(ERP5TypeTestCase):
self.commit()
def setSystemPreference(self):
default_pref = self.portal.portal_preferences.default_site_preference
conversion_dict = _getConversionServerDict()
default_pref.setPreferredOoodocServerAddress(conversion_dict['hostname'])
default_pref.setPreferredOoodocServerPortNumber(conversion_dict['port'])
self.portal.portal_alarms.promise_conversion_server.solve()
self.tic()
default_pref = self.portal.portal_preferences.getActiveSystemPreference()
default_pref.setPreferredDocumentFilenameRegularExpression(FILENAME_REGULAR_EXPRESSION)
default_pref.setPreferredDocumentReferenceRegularExpression(REFERENCE_REGULAR_EXPRESSION)
if default_pref.getPreferenceState() != 'global':
default_pref.enable()
def setSimulatedNotificationScript(self, sequence=None, sequence_list=None, **kw):
"""
......
......@@ -32,8 +32,8 @@ import os
from AccessControl.SecurityManagement import newSecurityManager
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from Products.ERP5Type.tests.ERP5TypeTestCase import _getConversionServerDict
from Products.ERP5Type.tests.utils import FileUpload
from Products.ERP5Type.tests.ERP5TypeTestCase import install_product_quiet
from Products.ERP5Type.tests.Sequence import SequenceList
from Products.ERP5OOo.OOoUtils import OOoParser
from Products.ERP5Form.PreferenceTool import Priority
......@@ -55,13 +55,10 @@ class TestOOoImportMixin(ERP5TypeTestCase):
Initialize the ERP5 site.
"""
self.login()
self.pref = self.portal.portal_preferences.newContent(
portal_type='System Preference')
conversion_dict = _getConversionServerDict()
self.pref.setPreferredOoodocServerAddress(conversion_dict['hostname'])
self.pref.setPreferredOoodocServerPortNumber(conversion_dict['port'])
self.portal.portal_alarms.promise_conversion_server.solve()
self.tic()
self.pref = self.portal.portal_preferences.getActiveSystemPreference()
self.pref.setPriority(Priority.SITE)
self.pref.enable()
# create browser_id_manager
if not "browser_id_manager" in self.portal.objectIds():
......@@ -124,7 +121,7 @@ class TestOOoImport(TestOOoImportMixin):
"""
Return the list of required business templates.
"""
return ('erp5_base', 'erp5_ooo_import')
return ('erp5_promise', 'erp5_base', 'erp5_ooo_import')
##################################
## Basic steps
......@@ -888,7 +885,7 @@ class TestOOoImportWeb(TestOOoImportMixin):
"""
Return the list of required business templates.
"""
return ('erp5_base', 'erp5_web', 'erp5_ooo_import')
return ('erp5_promise', 'erp5_base', 'erp5_web', 'erp5_ooo_import')
def test_CategoryTool_importCategoryFileExpirationSupport(self):
"""Import category file with expiration request, and do it again to be
......
......@@ -28,8 +28,7 @@
##############################################################################
import unittest
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase, \
_getConversionServerDict
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from Products.ERP5Form.Selection import Selection
from Testing import ZopeTestCase
from Products.ERP5OOo.tests.utils import Validator
......@@ -46,14 +45,14 @@ class TestOOoStyle(ERP5TypeTestCase, ZopeTestCase.Functional):
content_type = None
def getBusinessTemplateList(self):
return ('erp5_core_proxy_field_legacy',
return ('erp5_core_proxy_field_legacy', 'erp5_promise',
'erp5_base', 'erp5_ods_style', 'erp5_odt_style',)
def afterSetUp(self):
if not self.skin:
raise NotImplementedError('Subclasses must define skin')
self.setDefaultSitePreference()
self.portal.portal_alarms.promise_conversion_server.solve()
gender = self.portal.portal_categories.gender
if 'male' not in gender.objectIds():
......@@ -85,15 +84,6 @@ class TestOOoStyle(ERP5TypeTestCase, ZopeTestCase.Functional):
self.portal.portal_selections.setSelectionFor(
'person_module_selection', Selection())
def setDefaultSitePreference(self):
default_pref = self.portal.portal_preferences.default_site_preference
conversion_dict = _getConversionServerDict()
default_pref.setPreferredOoodocServerAddress(conversion_dict['hostname'])
default_pref.setPreferredOoodocServerPortNumber(conversion_dict['port'])
if self.portal.portal_workflow.isTransitionPossible(default_pref, 'enable'):
default_pref.enable()
return default_pref
def publish(self, *args, **kw):
kw['handle_errors'] = not debug
return super(TestOOoStyle, self).publish(*args, **kw)
......
......@@ -31,8 +31,7 @@ import os
import unittest
from Testing import ZopeTestCase
from Products.ERP5Type.tests.runUnitTest import tests_home
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase,\
_getConversionServerDict
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from AccessControl.SecurityManagement import newSecurityManager
from Products.ERP5SyncML.Conduit.ERP5DocumentConduit import ERP5DocumentConduit
from zLOG import LOG
......@@ -118,7 +117,8 @@ class TestERP5DocumentSyncMLMixin(TestERP5SyncMLMixin):
"""
Return the list of business templates.
"""
return ('erp5_base',
return ('erp5_promise',
'erp5_base',
'erp5_syncml',
'erp5_ingestion',
'erp5_ingestion_mysql_innodb_catalog',
......@@ -146,14 +146,11 @@ class TestERP5DocumentSyncMLMixin(TestERP5SyncMLMixin):
self.clearPublicationsAndSubscriptions()
def setSystemPreferences(self):
default_pref = self.portal.portal_preferences.default_site_preference
conversion_dict = _getConversionServerDict()
default_pref.setPreferredOoodocServerAddress(conversion_dict['hostname'])
default_pref.setPreferredOoodocServerPortNumber(conversion_dict['port'])
default_pref.setPreferredDocumentFileNameRegularExpression(FILENAME_REGULAR_EXPRESSION)
self.portal.portal_alarms.promise_conversion_server.solve()
self.tic()
default_pref = self.portal.portal_preferences.getActiveSystemPreference()
default_pref.setPreferredDocumentFilenameRegularExpression(FILENAME_REGULAR_EXPRESSION)
default_pref.setPreferredDocumentReferenceRegularExpression(REFERENCE_REGULAR_EXPRESSION)
if default_pref.getPreferenceState() == 'disabled':
default_pref.enable()
def addSubscriptions(self):
portal_id = self.getPortalId()
......
......@@ -347,6 +347,7 @@ class ERP5TypeFunctionalTestCase(ERP5TypeTestCase):
self.portal, self.run_only, self.use_phanthom)
def setSystemPreference(self):
# Use erp5_promise instead.
conversion_dict = _getConversionServerDict()
self.portal.Zuite_setPreference(
working_copy_list=bt5_dir_list,
......
......@@ -857,11 +857,10 @@ class ERP5TypeCommandLineTestCase(ERP5TypeTestCaseMixin):
"""
return ()
def loadPromise(self):
def _loadPromise(self):
""" Create promise configuration file and load it into configuration
"""
promise_path = os.path.join(instancehome, "promise.cfg")
ZopeTestCase._print('Adding Promise at %s...\n' % promise_path)
_createTestPromiseConfigurationFile(promise_path)
config.product_config["/%s" % self.getPortalName()] = \
{"promise_path": promise_path}
......@@ -1034,8 +1033,8 @@ class ERP5TypeCommandLineTestCase(ERP5TypeTestCaseMixin):
self._setUpDummyMailHost()
self.serverhost, self.serverport = self.startZServer(verbose=True)
self._registerNode(distributing=1, processing=1)
self.loadPromise()
self._loadPromise()
self._updateConnectionStrings()
self._recreateCatalog()
self._installBusinessTemplateList(business_template_list,
......
......@@ -32,7 +32,6 @@ import unittest
from Testing import ZopeTestCase
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from Products.ERP5Type.tests.ERP5TypeTestCase import _getPersistentMemcachedServerDict
from Products.ERP5Type.CachePlugins.DummyCache import DummyCache
from AccessControl.SecurityManagement import newSecurityManager
from Products.ERP5Type.Cache import CachingMethod, DEFAULT_CACHE_SCOPE
......@@ -62,13 +61,16 @@ class TestCacheTool(ERP5TypeTestCase):
"""
Return the list of business templates.
"""
return ('erp5_base',)
return ('erp5_promise', 'erp5_base',)
def afterSetUp(self):
self.login()
self.checkCacheTool()
self.checkPortalTypes()
self.createPersistentMemcachedPlugin()
# Configure Memcache and persistent cache (kumofs)
self.portal.portal_alarms.promise_memcached_server.solve()
self.portal.portal_alarms.promise_kumofs_server.solve()
self.tic()
self.createCacheFactories()
self.createCachedMethod()
self.commit()
......@@ -95,20 +97,6 @@ class TestCacheTool(ERP5TypeTestCase):
portal_type = getattr(portal_types, typeinfo_name, None)
self.assertNotEqual(None, portal_type)
def createPersistentMemcachedPlugin(self):
portal_memcached = self.portal.portal_memcached
# setup persistent memcached
memcached_plugin_id = 'flare'
if getattr(portal_memcached, memcached_plugin_id, None) is None:
connection_dict = _getPersistentMemcachedServerDict()
url_string = '%(hostname)s:%(port)s' % connection_dict
portal_memcached.newContent(portal_type='Memcached Plugin',
id=memcached_plugin_id,
url_string=url_string,
server_max_key_length=0,
server_max_value_length=0,
priority=1)
def createCacheFactories(self):
portal = self.getPortal()
portal_caches = portal.portal_caches
......@@ -149,8 +137,8 @@ class TestCacheTool(ERP5TypeTestCase):
container=portal_caches,
cache_duration=self.cache_duration)
dram_cache_plugin = dram_cache_factory.newContent(
portal_type="Distributed Ram Cache",
specialise='portal_memcached/flare')
portal_type="Distributed Ram Cache",
specialise='portal_memcached/persistent_memcached_plugin')
dram_cache_plugin.setIntIndex(0)
if getattr(portal_caches, 'erp5_user_factory', None) is None:
......
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