[Modeling-cvs] ProjectModeling/Modeling/tests Postgresql.cfg,NONE,1.1 MySQL.cfg,NONE,1.1 README,1.7,
Status: Abandoned
Brought to you by:
sbigaret
From: <sbi...@us...> - 2003-05-07 11:27:13
|
Update of /cvsroot/modeling/ProjectModeling/Modeling/tests In directory sc8-pr-cvs1:/tmp/cvs-serv22893 Modified Files: README test_EditingContext_Global.py test_EditingContext_Global_Inheritance.py test_EditingContext_ParentChild.py utils.py Added Files: Postgresql.cfg MySQL.cfg Removed Files: test.cfg Log Message: Updated the cfg. files for tests, now that ModelSet module got updateModelWithCFG() [RFE #726839]. File test.cfg is replaced by 2 files: Postgresql.cfg and MySQL.cfg --- NEW FILE: Postgresql.cfg --- # This file is used to initalize the model's connection dictionary and # adaptor's name when the tests are run for Postgresql # Change this to reflect your own configuration [DEFAULT] adaptor: Postgresql host: localhost user: postgres password: [AuthorBooks] [StoreEmployees] --- NEW FILE: MySQL.cfg --- # This file is used to initalize the model's connection dictionary and # adaptor's name when the tests are run for MySQL # Change this to reflect your own configuration [DEFAULT] adaptor: MySQL host: localhost user: root password: [AuthorBooks] [StoreEmployees] Index: README =================================================================== RCS file: /cvsroot/modeling/ProjectModeling/Modeling/tests/README,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** README 20 Feb 2003 15:19:28 -0000 1.7 --- README 7 May 2003 11:27:10 -0000 1.8 *************** *** 12,17 **** # Remaining tests require: # - that a PostgreSQL and/or MySQL database server is running somewhere ! # - you modify the file ./test.cfg to reflect you own PostgreSQL/MySQL ! # installation # - two different (***) databases (may be empty) with names: "AUTHOR_BOOKS" & # "STORE_EMPLOYEES" --- 12,17 ---- # Remaining tests require: # - that a PostgreSQL and/or MySQL database server is running somewhere ! # - you modify either ./Postgresql.cfg or MySQL.cfg to reflect you own ! # PostgreSQL/MySQL installation # - two different (***) databases (may be empty) with names: "AUTHOR_BOOKS" & # "STORE_EMPLOYEES" Index: test_EditingContext_Global.py =================================================================== RCS file: /cvsroot/modeling/ProjectModeling/Modeling/tests/test_EditingContext_Global.py,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** test_EditingContext_Global.py 27 Mar 2003 11:47:57 -0000 1.19 --- test_EditingContext_Global.py 7 May 2003 11:27:10 -0000 1.20 *************** *** 37,41 **** import unittest, sys import utils - from utils import parseConfigFile_and_updateModel if __name__ == "__main__": utils.fixpath() --- 37,40 ---- *************** *** 1017,1021 **** verbose=0 ! databaseAdaptorName='Postgresql' def main(args): --- 1016,1020 ---- verbose=0 ! database_cfg='Postgresql.cfg' def main(args): *************** *** 1024,1028 **** options, args = getopt.getopt(sys.argv[1:], 'vVprd:') #except: usage(me, 1) ! global verbose, databaseAdaptorName profile=0; reinitDB_flag=0 --- 1023,1027 ---- options, args = getopt.getopt(sys.argv[1:], 'vVprd:') #except: usage(me, 1) ! global verbose, database_cfg profile=0; reinitDB_flag=0 *************** *** 1034,1038 **** if k=='-d': if v not in ('Postgresql', 'MySQL'): usage(me, 1) ! databaseAdaptorName=v continue if k=='-r': reinitDB_flag=1; continue --- 1033,1037 ---- if k=='-d': if v not in ('Postgresql', 'MySQL'): usage(me, 1) ! database_cfg='%s.cfg'%v continue if k=='-r': reinitDB_flag=1; continue *************** *** 1041,1048 **** author_books_model=ModelSet.defaultModelSet().modelNamed('AuthorBooks') ! parseConfigFile_and_updateModel(author_books_model, databaseAdaptorName) # MySQL specifics: change TIMESTAMP to DATETIME ! if databaseAdaptorName=='MySQL': author_books_model.entityNamed('Writer').attributeNamed('birthday').setExternalType('DATETIME') --- 1040,1048 ---- author_books_model=ModelSet.defaultModelSet().modelNamed('AuthorBooks') ! # Initialization of model's caracs. ! ModelSet.updateModelWithCFG(author_books_model, database_cfg) # MySQL specifics: change TIMESTAMP to DATETIME ! if database_cfg=='MySQL.cfg': author_books_model.entityNamed('Writer').attributeNamed('birthday').setExternalType('DATETIME') Index: test_EditingContext_Global_Inheritance.py =================================================================== RCS file: /cvsroot/modeling/ProjectModeling/Modeling/tests/test_EditingContext_Global_Inheritance.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** test_EditingContext_Global_Inheritance.py 10 Feb 2003 22:04:19 -0000 1.8 --- test_EditingContext_Global_Inheritance.py 7 May 2003 11:27:10 -0000 1.9 *************** *** 37,41 **** import unittest, sys import utils - from utils import parseConfigFile_and_updateModel if __name__ == "__main__": utils.fixpath() --- 37,40 ---- *************** *** 396,400 **** verbose=0 ! databaseAdaptorName='Postgresql' def main(args): --- 395,399 ---- verbose=0 ! database_cfg='Postgresql.cfg' def main(args): *************** *** 403,407 **** options, args = getopt.getopt(sys.argv[1:], 'vVprd:') #except: usage(me, 1) ! global verbose, databaseAdaptorName profile=0; reinitDB_flag=0 for k, v in options: --- 402,406 ---- options, args = getopt.getopt(sys.argv[1:], 'vVprd:') #except: usage(me, 1) ! global verbose, database_cfg profile=0; reinitDB_flag=0 for k, v in options: *************** *** 412,416 **** if k=='-d': if v not in ('Postgresql', 'MySQL'): usage(me, 1) ! databaseAdaptorName=v continue if k=='-r': reinitDB_flag=1; continue --- 411,415 ---- if k=='-d': if v not in ('Postgresql', 'MySQL'): usage(me, 1) ! database_cfg='%s.cfg'%v continue if k=='-r': reinitDB_flag=1; continue *************** *** 418,422 **** # Initialization of model's caracs. ! parseConfigFile_and_updateModel(ModelSet.defaultModelSet().modelNamed('StoreEmployees'), databaseAdaptorName) if reinitDB_flag: reinitDB(); return --- 417,422 ---- # Initialization of model's caracs. ! model=ModelSet.defaultModelSet().modelNamed('StoreEmployees') ! ModelSet.updateModelWithCFG(model, database_cfg) if reinitDB_flag: reinitDB(); return Index: test_EditingContext_ParentChild.py =================================================================== RCS file: /cvsroot/modeling/ProjectModeling/Modeling/tests/test_EditingContext_ParentChild.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** test_EditingContext_ParentChild.py 14 Mar 2003 11:40:13 -0000 1.6 --- test_EditingContext_ParentChild.py 7 May 2003 11:27:10 -0000 1.7 *************** *** 15,19 **** import unittest, sys import utils - from utils import parseConfigFile_and_updateModel if __name__ == "__main__": utils.fixpath() --- 15,18 ---- *************** *** 509,513 **** verbose=0 ! databaseAdaptorName='Postgresql' def main(args): --- 508,512 ---- verbose=0 ! database_cfg='Postgresql.cfg' def main(args): *************** *** 516,520 **** options, args = getopt.getopt(sys.argv[1:], 'vVprd:') #except: usage(me, 1) ! global verbose, databaseAdaptorName profile=0; reinitDB_flag=0 --- 515,519 ---- options, args = getopt.getopt(sys.argv[1:], 'vVprd:') #except: usage(me, 1) ! global verbose, database_cfg profile=0; reinitDB_flag=0 *************** *** 526,530 **** if k=='-d': if v not in ('Postgresql', 'MySQL'): usage(me, 1) ! databaseAdaptorName=v continue if k=='-r': reinitDB_flag=1; continue --- 525,529 ---- if k=='-d': if v not in ('Postgresql', 'MySQL'): usage(me, 1) ! database_cfg='%s.cfg'%v continue if k=='-r': reinitDB_flag=1; continue *************** *** 533,541 **** author_books_model=ModelSet.defaultModelSet().modelNamed('AuthorBooks') ! parseConfigFile_and_updateModel(author_books_model, databaseAdaptorName) ! parseConfigFile_and_updateModel(ModelSet.defaultModelSet().modelNamed('StoreEmployees'), databaseAdaptorName) # MySQL specifics: change TIMESTAMP to DATETIME ! if databaseAdaptorName=='MySQL': author_books_model.entityNamed('Writer').attributeNamed('birthday').setExternalType('DATETIME') --- 532,542 ---- author_books_model=ModelSet.defaultModelSet().modelNamed('AuthorBooks') ! store_employee_model=ModelSet.defaultModelSet().modelNamed('StoreEmployees') ! # Initialization of model's caracs. ! ModelSet.updateModelWithCFG(author_books_model, database_cfg) ! ModelSet.updateModelWithCFG(store_employee_model, database_cfg) # MySQL specifics: change TIMESTAMP to DATETIME ! if database_cfg=='MySQL.cfg': author_books_model.entityNamed('Writer').attributeNamed('birthday').setExternalType('DATETIME') Index: utils.py =================================================================== RCS file: /cvsroot/modeling/ProjectModeling/Modeling/tests/utils.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** utils.py 10 Jan 2003 10:45:45 -0000 1.6 --- utils.py 7 May 2003 11:27:10 -0000 1.7 *************** *** 67,88 **** % (len(result.errors), len(result.failures))) return newerrs - - - def parseConfigFile_and_updateModel(model, dbAdaptorName): - """ - Parse 'test.cfg' and change the model's connection dictionary according to - the options the configuration file sets. - - This should only be triggered after the model has been loaded, e.g. after - one of the modules in the corresponding package has been loaded. - """ - from ConfigParser import ConfigParser - import os - defaults=model.connectionDictionary() - cp=ConfigParser() - cp.read('test.cfg') - for key in defaults.keys(): - if cp.has_option(dbAdaptorName, key): - defaults[key]=cp.get(dbAdaptorName, key) - model.setConnectionDictionary(defaults) - model.setAdaptorName(dbAdaptorName) --- 67,68 ---- --- test.cfg DELETED --- |