Changeset 8489
- Timestamp:
- 07/08/12 16:24:30 (9 years ago)
- Location:
- mauRepo/MolesManager/trunk
- Files:
-
- 1 deleted
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
mauRepo/MolesManager/trunk/cedaMoles/MolesManager/moles3epb.py
r8486 r8489 54 54 class Moles3EPBFactory(EPB): 55 55 56 def __init__(self, db Manager):57 self._db Manager = dbManager56 def __init__(self, db_manager): 57 self._db_manager = db_manager 58 58 self._initCEDA_Customization() 59 59 … … 61 61 def _initCEDA_Customization(self): 62 62 self._associateCEDA_GUID() 63 associateMOParty_indexes(self._db Manager.metadata)63 associateMOParty_indexes(self._db_manager.metadata) 64 64 self._initSearchIndexes() 65 65 66 66 def _associateCEDA_GUID(self): 67 guid_table = Table('ceda_guid', self._db Manager.metadata, \67 guid_table = Table('ceda_guid', self._db_manager.metadata, \ 68 68 Column('id', String, primary_key=True), \ 69 69 Column('ceda_observationcollection', Integer, ForeignKey('ceda_observationcollection.id')), … … 71 71 Column('ceda_project', Integer, ForeignKey('ceda_project.id'))) 72 72 mapper(CedaGUID, guid_table) 73 self._db Manager.metadata.create_all()73 self._db_manager.metadata.create_all() 74 74 75 75 def _initSearchIndexes(self): … … 77 77 # We don't want sqlalchemy to know about this column so we add it externally. 78 78 try: 79 self._db Manager.engine.execute("alter table md_identifier add column code_search_vector tsvector")79 self._db_manager.engine.execute("alter table md_identifier add column code_search_vector tsvector") 80 80 81 81 # This indexes the tsvector column 82 82 83 self._db Manager.engine.execute("create index md_identifier_code_search_index on md_identifier using gin(code_search_vector)")83 self._db_manager.engine.execute("create index md_identifier_code_search_index on md_identifier using gin(code_search_vector)") 84 84 85 85 # This sets up the trigger that keeps the tsvector column up to date. 86 self._db Manager.engine.execute("create trigger md_identifier_code_search_update before update or insert on md_identifier \86 self._db_manager.engine.execute("create trigger md_identifier_code_search_update before update or insert on md_identifier \ 87 87 for each row execute procedure tsvector_update_trigger('code_search_vector', 'pg_catalog.english', code)") 88 except Exception as e:88 except Exception: 89 89 pass 90 90 91 91 def _getSession(self): 92 if self._db Manager is not None:93 return self._db Manager.createDbSession()92 if self._db_manager is not None: 93 return self._db_manager.createDbSession() 94 94 return None 95 95 … … 151 151 """ 152 152 EPB.refresh(instance, self._session) 153 154 153 155 154 def deleteInstance(self, instance): -
mauRepo/MolesManager/trunk/cedaMoles/__init__.py
r8483 r8489 1 __version__ = '0.2.0 _SNAPSHOT'1 __version__ = '0.2.0' -
mauRepo/MolesManager/trunk/cedaMoles/libs/migration/processor/commons.py
r8486 r8489 789 789 md_identifier = MD_Identifier() 790 790 if code == None: 791 raise NoNullableElement()791 raise Exception('NoNullableElement') 792 792 md_identifier.code = code 793 793 if authority: -
mauRepo/MolesManager/trunk/cedaMoles/libs/migration/processor/deployment.py
r8486 r8489 37 37 hasMOSameHash, getAtomDocumentHashByMO, extractTitle,\ 38 38 createCEDA_Result,\ 39 createEX_GeographicBoundingBox, extractGeographicExtentInMigrationDocument, findDownloadLinksInMigrationDocument,\ 39 createEX_GeographicBoundingBox, extractGeographicExtentInMigrationDocument, \ 40 findDownloadLinksInMigrationDocument,\ 40 41 extractContent, createCI_Citation, createCI_Date, createDate,\ 41 42 createTM_Position, createTM_Instant, extractMolesCreationDate,\ … … 43 44 DO_UKSSDC, createMO_Organization,\ 44 45 createCI_Contact, createCI_Address, createCI_OnlineResource,\ 45 createCI_Telephone, extractMolesTemporalRange, isoDateStringToTimeDate,\46 createTM_Period,findAccessLinksInMigrationDocument,\46 createCI_Telephone, extractMolesTemporalRange,\ 47 findAccessLinksInMigrationDocument,\ 47 48 findLinksInDeployment, createMD_LegalConstraints,\ 48 49 createDQ_Element, createDQ_ConformanceResult, findUpdatedDate,\ … … 51 52 findLinksInMigrationDocument, findSubTypeInDPT, extractMolesPublishedDate,\ 52 53 createMD_Keywords, hasMOBeenProcessed, createMO_Individual,\ 53 fromDateStringToPhenomenonTime, fromPhenomenonTimeToString,\54 fromDateStringToPhenomenonTime, \ 54 55 comparePhenomenonTimes, compareGeographicBoundingBoxes 55 56 from cedaMoles.libs.epb import EPB 56 57 from cedaMoles.libs.migration.processor.deployment_data import DeploymentDataProcessor 57 from cedaMoles.libs.migration.exception.exceptions import NoDataLineage, \58 from cedaMoles.libs.migration.exception.exceptions import NoDataLineage, \ 58 59 NoAssociatedAuthor, NoAssociatedDeployments,\ 59 60 NoGeographicalExtensionException … … 62 63 import logging 63 64 from datetime import date 64 from ea_model.iso_19115_2006_metadata_corrigendum.citation_and_responsible_party_information.ci_onlinefunctioncode import CI_OnLineFunctionCode 65 from ea_model.iso_19115_2006_metadata_corrigendum.citation_and_responsible_party_information.ci_datetypecode import CI_DateTypeCode 66 from ea_model.iso_19115_2006_metadata_corrigendum.constraint_information.md_restrictioncode import MD_RestrictionCode 65 from ea_model.iso_19115_2006_metadata_corrigendum.\ 66 citation_and_responsible_party_information.ci_onlinefunctioncode \ 67 import CI_OnLineFunctionCode 68 from ea_model.iso_19115_2006_metadata_corrigendum.\ 69 citation_and_responsible_party_information.ci_datetypecode \ 70 import CI_DateTypeCode 71 from ea_model.iso_19115_2006_metadata_corrigendum.\ 72 constraint_information.md_restrictioncode import MD_RestrictionCode 67 73 from copy import deepcopy 68 74 import datetime 69 75 from cedaMoles.MolesManager.ceda_guid import CedaGUID 70 from ea_model.iso_19115_2006_metadata_corrigendum.citation_and_responsible_party_information.ci_rolecode import CI_RoleCode 71 from ea_model.iso_19115_2006_metadata_corrigendum.maintenance_information.md_maintenancefrequencycode import MD_MaintenanceFrequencyCode 72 from ea_model.moles3_4.utilities.ceda_rolevalue import CEDA_RoleValue 73 from ea_model.moles3_4.observation.mo_observationpublicationstatevalue import MO_ObservationPublicationStateValue 76 from ea_model.iso_19115_2006_metadata_corrigendum.\ 77 citation_and_responsible_party_information.ci_rolecode import CI_RoleCode 78 from ea_model.iso_19115_2006_metadata_corrigendum.\ 79 maintenance_information.md_maintenancefrequencycode \ 80 import MD_MaintenanceFrequencyCode 74 81 from cedaMoles.MolesManager.codelist import MM_RoleValue,\ 75 82 MM_ObservationPublicationStateValue, getCLValue 76 from ea_model.ceda_metadatamodel.ceda_observation.ceda_observation import CEDA_Observation 77 from ea_model.ceda_metadatamodel.ceda_result.ceda_curationvalue import CEDA_CurationValue 78 from ea_model.ceda_metadatamodel.ceda_utilities.ceda_reviewstatusvalue import CEDA_ReviewStatusValue 79 from ea_model.ceda_metadatamodel.ceda_utilities.ceda_reviewfrequencyvalue import CEDA_ReviewFrequencyValue 83 from ea_model.ceda_metadatamodel.ceda_observation.ceda_observation \ 84 import CEDA_Observation 85 from ea_model.ceda_metadatamodel.ceda_result.ceda_curationvalue \ 86 import CEDA_CurationValue 87 from ea_model.ceda_metadatamodel.ceda_utilities.ceda_reviewstatusvalue \ 88 import CEDA_ReviewStatusValue 89 from ea_model.ceda_metadatamodel.ceda_utilities.ceda_reviewfrequencyvalue \ 90 import CEDA_ReviewFrequencyValue 80 91 81 92 MET_GEO_FEATURE = 'Meteorological geographical features' … … 91 102 log.addHandler(StreamHandler()) 92 103 log.setLevel(logging.INFO) 93 def __init__(self, data EntityMigration, deploymentMigration, epbRepo):104 def __init__(self, data_entity_migration, deployment_migration, epbRepo): 94 105 ''' 95 106 Initializes the class … … 98 109 @param epbRepo: an instance of EPBRepo 99 110 ''' 100 self._data EntityMigration = dataEntityMigration101 self._deployment Migration = deploymentMigration111 self._data_entity_migration = data_entity_migration 112 self._deployment_migration = deployment_migration 102 113 self.epbRepo = epbRepo 103 self._dataEntityHasSameHash = hasMOSameHash(self._data EntityMigration)104 self._deploymentHasSameHash = hasMOSameHash(self._deployment Migration)105 self._deploymentHasBeenProcessed = hasMOBeenProcessed(self._deployment Migration)114 self._dataEntityHasSameHash = hasMOSameHash(self._data_entity_migration) 115 self._deploymentHasSameHash = hasMOSameHash(self._deployment_migration) 116 self._deploymentHasBeenProcessed = hasMOBeenProcessed(self._deployment_migration) 106 117 self._report = [] 107 118 … … 128 139 try: 129 140 if tmp_auth['author'] == 'unknown': 130 doc_authors = findAuthorsInResource(self._data EntityMigration)141 doc_authors = findAuthorsInResource(self._data_entity_migration) 131 142 tmp_auth = authors[doc_authors['authors']] 132 143 … … 143 154 for item in tmp_auth['co_author_type']: 144 155 if (tmp_auth['co_author'][tmp_auth['co_author_type'].index(item)] == 'unknown'): 145 doc_authors = findAuthorsInResource(self._data EntityMigration)156 doc_authors = findAuthorsInResource(self._data_entity_migration) 146 157 tmp_auth = authors[doc_authors['contributors']] 147 158 break … … 163 174 164 175 def updateObservation(self): 165 return EPB.searchOrCreate(CEDA_Observation, self._deployment Migration.ceda_observation_id)176 return EPB.searchOrCreate(CEDA_Observation, self._deployment_migration.ceda_observation_id) 166 177 167 178 def assignDOI(self, observation, doi): … … 201 212 return 202 213 203 provider_id = extractMolesProviderID(self._deployment Migration)214 provider_id = extractMolesProviderID(self._deployment_migration) 204 215 i_keywords = [] 205 216 if provider_id == DO_BADC: … … 218 229 return 219 230 220 data_lineage = findMolesLineage(self._data EntityMigration)231 data_lineage = findMolesLineage(self._data_entity_migration) 221 232 if data_lineage is None: 222 raise NoDataLineage(self._data EntityMigration)233 raise NoDataLineage(self._data_entity_migration) 223 234 224 235 if data_lineage != observation.dataLineage: … … 230 241 231 242 i_sources = [] 232 download = findDownloadLinksInMigrationDocument(self._deployment Migration)243 download = findDownloadLinksInMigrationDocument(self._deployment_migration) 233 244 content = None 234 245 if len(download) == 0: 235 download = findDownloadLinksInMigrationDocument(self._data EntityMigration)236 content = extractContent(self._data EntityMigration)246 download = findDownloadLinksInMigrationDocument(self._data_entity_migration) 247 content = extractContent(self._data_entity_migration) 237 248 else: 238 content = extractContent(self._deployment Migration)249 content = extractContent(self._deployment_migration) 239 250 for dwn in download: 240 251 int_description = None … … 249 260 description = int_description, applicationProfile = int_applicationProfile)) 250 261 251 dataentity_id = '%s__ATOM__%s' % (self._data EntityMigration.doc_owner, self._dataEntityMigration.doc_name)262 dataentity_id = '%s__ATOM__%s' % (self._data_entity_migration.doc_owner, self._data_entity_migration.doc_name) 252 263 dataentity_id = dataentity_id.replace('.atom', '') 253 264 infodb_de = self.epbRepo.infodbEPB.getCedaInfoApp_dataentityByDE_ID(dataentity_id) … … 279 290 return 280 291 281 provider_id = extractMolesProviderID(self._deployment Migration)292 provider_id = extractMolesProviderID(self._deployment_migration) 282 293 party = None 283 294 if provider_id == DO_BADC: … … 322 333 return 323 334 324 doc_quality = extractQuality(self._data EntityMigration)325 doc_date = findUpdatedDate(self._data EntityMigration)335 doc_quality = extractQuality(self._data_entity_migration) 336 doc_date = findUpdatedDate(self._data_entity_migration) 326 337 ci_dates = [] 327 338 if doc_date: … … 345 356 return 346 357 347 description = extractSummary(self._deployment Migration)358 description = extractSummary(self._deployment_migration) 348 359 if description is None: 349 description = extractSummary(self._data EntityMigration)360 description = extractSummary(self._data_entity_migration) 350 361 351 362 if description: … … 356 367 return 357 368 358 doc_title = extractTitle(self._deployment Migration)369 doc_title = extractTitle(self._deployment_migration) 359 370 if doc_title is None: 360 doc_title = extractTitle(self._data EntityMigration)371 doc_title = extractTitle(self._data_entity_migration) 361 372 362 373 if doc_title.startswith('deployment_') or doc_title.startswith('Deployment_'): 363 links = findLinksInMigrationDocument(self._deployment Migration)374 links = findLinksInMigrationDocument(self._deployment_migration) 364 375 dptList = links['DPT'] 365 376 if links.has_key('DPT'): … … 371 382 doc_title += ' and ' + dptList[-1] 372 383 373 links = findLinksInDeployment(self._deployment Migration)384 links = findLinksInDeployment(self._deployment_migration) 374 385 if links.has_key('OBS'): 375 386 obsList = [] 376 387 for obs in links['OBS']: 377 observationStation = self.epbRepo.migrationEPB.getDeploymentDataMigrationByName(self._deployment Migration, obs + '.atom')388 observationStation = self.epbRepo.migrationEPB.getDeploymentDataMigrationByName(self._deployment_migration, obs + '.atom') 378 389 obsList.append((extractTitle(observationStation), findSubTypeInDPT(observationStation))) 379 390 … … 391 402 if links.has_key('ACTIVITY'): 392 403 for link in links['ACTIVITY']: 393 activity = self.epbRepo.migrationEPB.getDeploymentDataMigrationByName(self._deployment Migration, link + '.atom')404 activity = self.epbRepo.migrationEPB.getDeploymentDataMigrationByName(self._deployment_migration, link + '.atom') 394 405 395 406 projSubType = findSubTypeInDPT(activity) … … 414 425 return 415 426 416 ge = extractGeographicExtentInMigrationDocument(self._deployment Migration)427 ge = extractGeographicExtentInMigrationDocument(self._deployment_migration) 417 428 if ge is None: 418 ge = extractGeographicExtentInMigrationDocument(self._data EntityMigration)429 ge = extractGeographicExtentInMigrationDocument(self._data_entity_migration) 419 430 420 431 if ge is None: 421 self._report.append(NoGeographicalExtensionException(self._deployment Migration))422 self._report.append(NoGeographicalExtensionException(self._data EntityMigration))432 self._report.append(NoGeographicalExtensionException(self._deployment_migration)) 433 self._report.append(NoGeographicalExtensionException(self._data_entity_migration)) 423 434 424 435 geographicExtent = createEX_GeographicBoundingBox(ge['east'], ge['north'], ge['west'], ge['south']) … … 434 445 return 435 446 436 creation_date = extractMolesPublishedDate(self._deployment Migration)447 creation_date = extractMolesPublishedDate(self._deployment_migration) 437 448 if creation_date is None: 438 creation_date = extractMolesCreationDate(self._deployment Migration)449 creation_date = extractMolesCreationDate(self._deployment_migration) 439 450 py_datetime = isoDateTimeStringToTimeDate(creation_date) 440 451 date_time = createDateTime(py_datetime) … … 450 461 return 451 462 452 doc_phenomenon_time = extractMolesTemporalRange(self._deployment Migration)463 doc_phenomenon_time = extractMolesTemporalRange(self._deployment_migration) 453 464 pt = fromDateStringToPhenomenonTime(doc_phenomenon_time) 454 465 … … 461 472 return 462 473 463 access_link = findAccessLinksInMigrationDocument(self._deployment Migration)464 dwn_link = findDownloadLinksInMigrationDocument(self._deployment Migration)474 access_link = findAccessLinksInMigrationDocument(self._deployment_migration) 475 dwn_link = findDownloadLinksInMigrationDocument(self._deployment_migration) 465 476 if len(access_link) == 0: 466 access_link = findAccessLinksInMigrationDocument(self._data EntityMigration)477 access_link = findAccessLinksInMigrationDocument(self._data_entity_migration) 467 478 468 479 i_accessConstraints = [] … … 472 483 if len(access_link) == 0: 473 484 if len(dwn_link) == 0: 474 dwn_link = findDownloadLinksInMigrationDocument(self._data EntityMigration)485 dwn_link = findDownloadLinksInMigrationDocument(self._data_entity_migration) 475 486 if dwn_link and len(dwn_link) == 1: 476 487 i_use_limitation.append("These data are open access and available through %s." % (dwn_link[0]['href']) ) … … 488 499 489 500 ''' 490 contentDict = extractContent(self._deployment Migration)501 contentDict = extractContent(self._deployment_migration) 491 502 if not contentDict.has_key('access-restricted'): 492 contentDict = extractContent(self._data EntityMigration)503 contentDict = extractContent(self._data_entity_migration) 493 504 ''' 494 505 … … 497 508 return 498 509 499 i_code = 'http://badc.nerc.ac.uk/view/%s__ATOM__%s' % (self._deployment Migration.doc_owner, self._deploymentMigration.doc_name)510 i_code = 'http://badc.nerc.ac.uk/view/%s__ATOM__%s' % (self._deployment_migration.doc_owner, self._deployment_migration.doc_name) 500 511 i_code = i_code.replace('.atom', '') 501 #i_code = buildExistDocPath(self._deployment Migration.doc_status, DT_DEPLOYMENTS, self._deploymentMigration.doc_owner, self._deploymentMigration.doc_name)512 #i_code = buildExistDocPath(self._deployment_migration.doc_status, DT_DEPLOYMENTS, self._deployment_migration.doc_owner, self._deployment_migration.doc_name) 502 513 i_authority = createCI_Citation('moles2url') 503 514 identifier = createMD_Identifier(code = i_code, authority = i_authority) … … 529 540 return 530 541 531 updateFrequency = extractUpdateFrequency(self._data EntityMigration)542 updateFrequency = extractUpdateFrequency(self._data_entity_migration) 532 543 if updateFrequency: 533 544 resultAccumulation = MD_MaintenanceFrequencyCode.from_string(updateFrequency) … … 545 556 return 546 557 547 whereAreAuthors = self._deployment Migration548 doc_authors = findAuthorsInResource(self._deployment Migration)558 whereAreAuthors = self._deployment_migration 559 doc_authors = findAuthorsInResource(self._deployment_migration) 549 560 if doc_authors['authors'] in [DO_BADC, DO_NEODC]: 550 doc_authors = findAuthorsInResource(self._data EntityMigration)551 whereAreAuthors = self._data EntityMigration561 doc_authors = findAuthorsInResource(self._data_entity_migration) 562 whereAreAuthors = self._data_entity_migration 552 563 553 564 ind_names = [] … … 618 629 619 630 #Is a first time process? 620 if not hasMOBeenProcessed(self._deployment Migration):631 if not hasMOBeenProcessed(self._deployment_migration): 621 632 ceda_observation.publicationState = getCLValue(MM_ObservationPublicationStateValue.cl_working) 622 docHash = getAtomDocumentHashByMO(self._data EntityMigration)633 docHash = getAtomDocumentHashByMO(self._data_entity_migration) 623 634 self.epbRepo.moles3EPB.persistInstance(ceda_observation) 624 self.epbRepo.migrationEPB.updateMigrationObject(self._deployment Migration, \635 self.epbRepo.migrationEPB.updateMigrationObject(self._deployment_migration, \ 625 636 {'ceda_observation_id': ceda_observation.id, 626 637 'doc_hash': docHash}) … … 629 640 if self.epbRepo.moles3EPB.retrieveGUIDFromInstance(ceda_observation) is None: 630 641 ceda_guid = CedaGUID() 631 ceda_guid.id = calculateHash(self._deployment Migration.depl_id)642 ceda_guid.id = calculateHash(self._deployment_migration.depl_id) 632 643 ceda_guid.ceda_observation = ceda_observation.id 633 644 self.epbRepo.moles3EPB.persistInstance(ceda_guid) … … 635 646 636 647 if not self._deploymentHasBeenProcessed: 637 deploymentDataProcessor = DeploymentDataProcessor(self._deployment Migration, self.epbRepo)648 deploymentDataProcessor = DeploymentDataProcessor(self._deployment_migration, self.epbRepo) 638 649 procedure = deploymentDataProcessor.createProcess() 639 650 project = deploymentDataProcessor.createProject() … … 650 661 ceda_observation = None 651 662 #Moles3 object exists... 652 if self._deployment Migration.ceda_observation_id:653 ceda_observation = self.epbRepo.moles3EPB.search(CEDA_Observation, self._deployment Migration.ceda_observation_id)663 if self._deployment_migration.ceda_observation_id: 664 ceda_observation = self.epbRepo.moles3EPB.search(CEDA_Observation, self._deployment_migration.ceda_observation_id) 654 665 else: 655 666 #... does not exist so create it -
mauRepo/MolesManager/trunk/cedaMoles/tests/migration/moles3epbtests.py
r8488 r8489 4 4 @author: mnagni 5 5 ''' 6 import unittest7 6 import logging, datetime 8 from logging import StreamHandler9 from sqlalchemy.exc import IntegrityError10 7 from cedaMoles.libs.migration.processor.commons import createCI_Date, createDateTime,\ 11 8 createDate, createTM_Position, createTM_Instant … … 16 13 from test_utils import createObservationCollection,\ 17 14 createProject 18 from cedaMoles.tests.testconfig import EVENTS_DB19 15 from ea_model.ceda_metadatamodel.ceda_observationcollection.ceda_observationcollection import CEDA_ObservationCollection 20 16 from cedaMoles.tests.cedamolestest import CedaMolesTest … … 24 20 25 21 class Moles3EPBTest(CedaMolesTest): 22 23 log = logging.getLogger('Moles3EPBTest') 26 24 27 25 def runTest(self): … … 38 36 observationCollection = createObservationCollection() 39 37 40 self.logging.info('Stores an empty new CEDA_ObservationCollection')38 Moles3EPBTest.log.info('Stores an empty new CEDA_ObservationCollection') 41 39 self.epbRepo.moles3EPB.persistInstance(observationCollection) 42 40 43 self.logging.info('Tries to retrieve it')41 Moles3EPBTest.log.info('Tries to retrieve it') 44 42 self.assertTrue(hasattr(observationCollection, 'id'), "Cannot create ObservationCollection") 45 43 res = self.epbRepo.moles3EPB.search(CEDA_ObservationCollection, observationCollection.id) 46 44 self.assertNotEqual(res, None, "Cannot retrieve the stored instance") 47 45 48 self.logging.info('Deletes it')46 Moles3EPBTest.log.info('Deletes it') 49 47 self.epbRepo.moles3EPB.delete(observationCollection) 50 48 … … 52 50 observation = CEDA_Observation() 53 51 54 self.logging.info('Tries to stores an empty new %s' % (observation.__class__.__name__))52 Moles3EPBTest.log.info('Tries to stores an empty new %s' % (observation.__class__.__name__)) 55 53 self.epbRepo.moles3EPB.persistInstance(observation) 56 54 #self.assertRaises(IntegrityError, session.commit) 57 self.logging.info('Catches that Ceda_Observation.dataLineage is missing')58 59 self.logging.info('Adds the dataLineage and tries to store it again')55 Moles3EPBTest.log.info('Catches that Ceda_Observation.dataLineage is missing') 56 57 Moles3EPBTest.log.info('Adds the dataLineage and tries to store it again') 60 58 observation.dataLineage = "aNewDataLineage" 61 59 self.epbRepo.moles3EPB.persistInstance(observation) 62 60 63 self.logging.info('Tries to retrieve it')61 Moles3EPBTest.log.info('Tries to retrieve it') 64 62 self.assertTrue(hasattr(observation, 'id'), 'Cannot create %s' % (observation.__class__.__name__)) 65 63 res = self.epbRepo.moles3EPB.search(CEDA_Observation, observation.id) 66 64 self.assertNotEqual(res, None, "Cannot retrieve the stored instance") 67 65 68 self.logging.info('Deletes it')66 Moles3EPBTest.log.info('Deletes it') 69 67 self.epbRepo.moles3EPB.delete(observation) 70 68 … … 72 70 observationCollection = createObservationCollection() 73 71 74 self.logging.info('Stores an empty new CEDA_ObservationCollection')72 Moles3EPBTest.log.info('Stores an empty new CEDA_ObservationCollection') 75 73 self.epbRepo.moles3EPB.persistInstance(observationCollection) 76 74 77 self.logging.info('Tries to retrieve it')75 Moles3EPBTest.log.info('Tries to retrieve it') 78 76 self.assertTrue(hasattr(observationCollection, 'id'), "Cannot create ObservationCollection") 79 77 res = self.epbRepo.moles3EPB.search(CEDA_ObservationCollection, observationCollection.id) 80 78 self.assertNotEqual(res, None, "Cannot retrieve the stored instance") 81 79 82 self.logging.info('Adds two CEDA_Observations')80 Moles3EPBTest.log.info('Adds two CEDA_Observations') 83 81 firstObservation = self._createObservation() 84 82 observationCollection.member.append(firstObservation) … … 88 86 self.assertTrue(self.epbRepo.moles3EPB.observationCollectionHasObservation(observationCollection.id, firstObservation.id), "The collection should contains the given observation") 89 87 90 self.logging.info('Deletes it')88 Moles3EPBTest.log.info('Deletes it') 91 89 self.epbRepo.moles3EPB.delete(observationCollection) 92 90 … … 94 92 observation = self._createObservation() 95 93 96 self.logging.info('Tries to stores a new %s' % (observation.__class__.__name__))94 Moles3EPBTest.log.info('Tries to stores a new %s' % (observation.__class__.__name__)) 97 95 self.epbRepo.moles3EPB.persistInstance(observation) 98 96 99 self.logging.info('Tries to retrieve it')97 Moles3EPBTest.log.info('Tries to retrieve it') 100 98 self.assertTrue(hasattr(observation, 'id'), 'Cannot create %s' % (observation.__class__.__name__)) 101 99 res = self.epbRepo.moles3EPB.search(CEDA_Observation, observation.id) 102 100 self.assertNotEqual(res, None, "Cannot retrieve the stored instance") 103 101 104 self.logging.info('Deletes it')102 Moles3EPBTest.log.info('Deletes it') 105 103 self.epbRepo.moles3EPB.delete(observation) 106 104 … … 111 109 ci_date = createCI_Date(CI_DateTypeCode.cl_creation, dt) 112 110 113 self.logging.info('Stores an empty new CEDA_ObservationCollection')111 Moles3EPBTest.log.info('Stores an empty new CEDA_ObservationCollection') 114 112 self.epbRepo.moles3EPB.persistInstance(ci_date) 115 113 116 self.logging.info('Tries to retrieve it')114 Moles3EPBTest.log.info('Tries to retrieve it') 117 115 self.assertTrue(hasattr(ci_date, 'id'), "Cannot create CI_Date") 118 116 res = self.epbRepo.moles3EPB.search(CI_Date, ci_date.id) 119 117 self.assertNotEqual(res, None, "Cannot retrieve the stored instance") 120 118 121 self.logging.info('Deletes it')119 Moles3EPBTest.log.info('Deletes it') 122 120 self.epbRepo.moles3EPB.delete(ci_date) 123 121 … … 125 123 tm_position = self._createTM_Position() 126 124 127 self.logging.info('Stores an empty new TM_Position')125 Moles3EPBTest.log.info('Stores an empty new TM_Position') 128 126 self.epbRepo.moles3EPB.persistInstance(tm_position) 129 127 130 self.logging.info('Tries to retrieve it')128 Moles3EPBTest.log.info('Tries to retrieve it') 131 129 self.assertTrue(hasattr(tm_position, 'id'), "Cannot create TM_Position") 132 130 res = self.epbRepo.moles3EPB.search(TM_Position, tm_position.id) 133 131 self.assertNotEqual(res, None, "Cannot retrieve the stored instance") 134 132 135 self.logging.info('Deletes it')133 Moles3EPBTest.log.info('Deletes it') 136 134 self.epbRepo.moles3EPB.delete(tm_position) 137 135 … … 140 138 tm_instant = self._createTM_Instant() 141 139 142 self.logging.info('Stores an empty new TM_Instant')140 Moles3EPBTest.log.info('Stores an empty new TM_Instant') 143 141 self.epbRepo.moles3EPB.persistInstance(tm_instant) 144 142 145 self.logging.info('Tries to retrieve it')143 Moles3EPBTest.log.info('Tries to retrieve it') 146 144 self.assertTrue(hasattr(tm_instant, 'id'), "Cannot create TM_Instant") 147 145 res = self.epbRepo.moles3EPB.search(TM_Instant, tm_instant.id) 148 146 self.assertNotEqual(res, None, "Cannot retrieve the stored instance") 149 147 150 self.logging.info('Deletes it')148 Moles3EPBTest.log.info('Deletes it') 151 149 self.epbRepo.moles3EPB.delete(tm_instant) 152 150 … … 154 152 project = createProject() 155 153 156 self.logging.info('Stores an empty new CEDA_Project')154 Moles3EPBTest.log.info('Stores an empty new CEDA_Project') 157 155 self.epbRepo.moles3EPB.persistInstance(project) 158 156 159 self.logging.info('Tries to retrieve it')157 Moles3EPBTest.log.info('Tries to retrieve it') 160 158 self.assertTrue(hasattr(project, 'id'), "Cannot create TM_Instant") 161 159 res = self.epbRepo.moles3EPB.search(CEDA_Project, project.id) … … 163 161 self.assertTrue(item.abstract == 'test_abstract', "Cannot retrieve the abstract from stored project") 164 162 165 self.logging.info('Deletes it')163 Moles3EPBTest.log.info('Deletes it') 166 164 self.epbRepo.moles3EPB.delete(project) 167 165 … … 169 167 def checkCI_Responsibility(self): 170 168 responsibility = createCI_Responsibility() 171 self.logging.info('Stores an empty new CEDA_Project')169 Moles3EPBTest.log.info('Stores an empty new CEDA_Project') 172 170 self.epbRepo.moles3EPB.persistInstance(responsibility) 173 171 self.epbRepo.moles3EPB.expunge(responsibility) -
mauRepo/MolesManager/trunk/setup.py
r8488 r8489 8 8 VERSION = re.compile(r".*__version__ = '(.*?)'", 9 9 re.S).match(v_file.read()).group(1) 10 if VERSION.endswith('SNAPSHOT'): 11 VERSION = VERSION + '_' +str(int(time.time())) 10 11 if os.environ.has_key('SVN_REVISION'): 12 VERSION = VERSION + '_' + os.environ['SVN_REVISION'] 13 12 14 setup( 13 15 name='cedaMoles',
Note: See TracChangeset
for help on using the changeset viewer.