source: mauRepo/MolesManager/trunk/src/libs/migration/tests/migrationprocess.py @ 8336

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/mauRepo/MolesManager/trunk/src/libs/migration/tests/migrationprocess.py@8336
Revision 8336, 3.0 KB checked in by mnagni, 7 years ago (diff)

Fixed some gui bugs

Line 
1'''
2Created on 7 Mar 2012
3
4@author: mnagni
5'''
6from unittest import TestCase
7from libs.commons_db import DbManager
8from libs.migration.MigrationEPB import MigrationEPBFactory
9from libs.migration.processor.loadResources import LoadResources
10from libs.migration.db.classes import MigrationObject
11from libs.migration.processor.commons import DO_BADC, DS_pUBLISHED, DS_PUBLISHED
12from MolesManager.moles3epb import Moles3EPBFactory
13from libs.migration.processor.migrationProcess import MigrationProcess
14from testconfig import MIGRATION_DB_CONNECTION,\
15    MIGRATION_DB_SCRIPT, MOLES3_DB_SCRIPT, MOLES3_DB_CONNECTION, INFO_DB_CONNECTION
16from libs.migration.InfodbEPB import InfodbEPBFactory
17from MolesManager.settings import EVENTS_DB
18from libs.migration.client import EPBRepo
19
20class LoadResourceTest(TestCase):
21    '''
22    classdocs
23    '''
24   
25    def setUp(self):
26        migrationDB = DbManager(MIGRATION_DB_CONNECTION, MIGRATION_DB_SCRIPT, sql_echo=True)
27        #migrationDB = DbManager(MIGRATION_DB_CONNECTION, MIGRATION_DB_SCRIPT)
28        #MigrationEPB.overrrideDBManager(migrationDB)     
29
30        molesDB = DbManager(MOLES3_DB_CONNECTION, MOLES3_DB_SCRIPT, sql_echo=True, session_event_manager=EVENTS_DB)
31        #molesDB = DbManager(MOLES3_DB_CONNECTION, MOLES3_DB_SCRIPT, session_event_manager=EVENTS_DB)         
32       
33       
34        #infoDB = DbManager(INFO_DB_CONNECTION, sql_echo=True)
35        infoDB = DbManager(INFO_DB_CONNECTION)       
36        infoFactory = InfodbEPBFactory(infoDB)
37       
38        moles3Factory = Moles3EPBFactory(molesDB)
39        migrationFactory = MigrationEPBFactory(migrationDB)
40       
41        EPBRepo.moles3EPB = moles3Factory.createMoles3EPB() 
42        EPBRepo.migrationEPB = migrationFactory.createMigrationEPB()
43        EPBRepo.infodbEPB = infoFactory.createEPB()
44       
45        '''
46        lr = LoadResources()
47        ex = lr.process()
48        for e in ex:
49            print e
50        '''
51
52    def testMigrationProcess(self):       
53        mp = MigrationProcess()
54
55        dataEntity = MigrationObject()
56        dataEntity.doc_owner = DO_BADC
57               
58        #dataEntity.doc_status = DS_pUBLISHED
59        #dataEntity.doc_name = 'dataent_csip.atom'
60       
61        #Has a DOI
62        #dataEntity.doc_status = DS_PUBLISHED
63        #dataEntity.doc_name = 'DE_095e8da2-cf02-11e0-8b7a-00e081470265.atom'
64       
65        #Has 3 DOI
66        dataEntity.doc_status = DS_pUBLISHED
67        dataEntity.doc_name = 'dataent_chobs.atom'       
68               
69       
70        ex = mp.process(dataEntity)
71        #ex = []
72        #ex = mp.process()
73        for e in ex:
74            print e
75        #self._dropAllTables()
76
77    """       
78    def _dropAllTables(self):
79        session = Moles3EPB.getNewMolesSession()
80        f = open('dropAllTables.sql', 'r')
81        for line in f.readlines():
82            stripped = line.strip()
83            if len(stripped) > 0:
84                Moles3EPB.executeNative(line.strip(), session)
85        session.commit()
86        session.close()       
87    """   
88       
89       
Note: See TracBrowser for help on using the repository browser.