Commit 29773792 authored by Rafael Monnerat's avatar Rafael Monnerat

Allow use --conversion_server_hostname and --conversion_server_port for set...

Allow use --conversion_server_hostname and --conversion_server_port for set oood server and port number. 

  - By default localhost and 8008 is used. 
  - It just overwrite default values at default_site_preference (where localhost and 8008) is set. 
  - Tests that has new preferences (like testDms) the followed method can be used to get the values passed by arguments.
   from Products.ERP5Type.tests.ERP5TypeTestCase import _getConversionServerDict




git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@33599 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 315b7514
...@@ -244,6 +244,16 @@ def _getConnectionStringDict(): ...@@ -244,6 +244,16 @@ def _getConnectionStringDict():
erp5_sql_transactionless_connection_string erp5_sql_transactionless_connection_string
return connection_string_dict return connection_string_dict
def _getConversionServerDict():
""" Returns a dict with hostname and port for Conversion Server (Oood)
"""
conversion_server_hostname = os.environ.get('conversion_server_hostname',
'localhost')
conversion_server_port = os.environ.get('conversion_server_port',
'8008')
return dict(hostname=conversion_server_hostname,
port=int(conversion_server_port))
def profile_if_environ(environment_var_name): def profile_if_environ(environment_var_name):
if int(os.environ.get(environment_var_name, 0)): if int(os.environ.get(environment_var_name, 0)):
...@@ -518,6 +528,7 @@ class ERP5TypeTestCase(backportUnittest.TestCase, PortalTestCase): ...@@ -518,6 +528,7 @@ class ERP5TypeTestCase(backportUnittest.TestCase, PortalTestCase):
global current_app global current_app
current_app = self.app current_app = self.app
self._updateConnectionStrings() self._updateConnectionStrings()
self._updateConversionServerConfiguration()
def afterSetUp(self): def afterSetUp(self):
'''Called after setUp() has completed. This is '''Called after setUp() has completed. This is
...@@ -551,6 +562,14 @@ class ERP5TypeTestCase(backportUnittest.TestCase, PortalTestCase): ...@@ -551,6 +562,14 @@ class ERP5TypeTestCase(backportUnittest.TestCase, PortalTestCase):
connection_name = connection_string_name.replace('_string', '') connection_name = connection_string_name.replace('_string', '')
getattr(portal, connection_name).edit('', connection_string) getattr(portal, connection_name).edit('', connection_string)
def _updateConversionServerConfiguration(self):
"""Update conversion server (Oood) at default site preferences.
"""
conversion_dict = _getConversionServerDict()
preference = self.portal.portal_preferences.default_site_preference
preference.setPreferredOoodocServerAddress(conversion_dict['hostname'])
preference.setPreferredOoodocServerPortNumber(conversion_dict['port'])
def _recreateCatalog(self, quiet=0): def _recreateCatalog(self, quiet=0):
"""Clear activities and catalog and recatalog everything. """Clear activities and catalog and recatalog everything.
Test runner can set `erp5_tests_recreate_catalog` environnement variable, Test runner can set `erp5_tests_recreate_catalog` environnement variable,
......
...@@ -79,6 +79,17 @@ Options: ...@@ -79,6 +79,17 @@ Options:
for performance reasons. Provide list of documents for performance reasons. Provide list of documents
(delimited with comas) for which we want to force (delimited with comas) for which we want to force
indexing. This can only be for now 'portal_types' indexing. This can only be for now 'portal_types'
--conversion_server_hostname=STRING
Hostname used to connect to conversion server (Oood),
this value will stored at default preference. By default
localhost is used.
--conversion_server_port=STRING
Port number used to connect to conversion server
(Oood), the value will be stored at default preference.
By default 8008 is used.
""" """
def getUnitTestFile(): def getUnitTestFile():
...@@ -490,6 +501,8 @@ def main(): ...@@ -490,6 +501,8 @@ def main():
"bt5_path=", "bt5_path=",
"recreate_catalog=", "erp5_sql_connection_string=", "recreate_catalog=", "erp5_sql_connection_string=",
"cmf_activity_sql_connection_string=", "cmf_activity_sql_connection_string=",
"conversion_server_port=",
"conversion_server_hostname=",
"erp5_catalog_storage=", "erp5_catalog_storage=",
"save", "save",
"load", "load",
...@@ -557,6 +570,10 @@ def main(): ...@@ -557,6 +570,10 @@ def main():
os.environ["update_business_templates"] = "1" os.environ["update_business_templates"] = "1"
elif opt == "--update_business_templates": elif opt == "--update_business_templates":
os.environ["update_business_templates"] = "1" os.environ["update_business_templates"] = "1"
elif opt == "--conversion_server_hostname":
os.environ["conversion_server_hostname"] = arg
elif opt == "--conversion_server_port":
os.environ["conversion_server_port"] = arg
test_list = args test_list = args
if not test_list: if not test_list:
......
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