Ignore:
Timestamp:
15/01/09 10:24:29 (11 years ago)
Author:
cbyrom
Message:

Create new class (and test suite) to do all the eXist DB setting up - and move this code from the
eXistdbclient to tidy things up.
Allow feed publishing to be done synch/asynch.
Improve loading of non-python resources - adding code to store the various schemata and indexes
required for setting up eXist
Improve parsing of atom URLs to allow browser host to change
Fix moles data in testconstants
Add tests for looking up associated atom data
Add indexing configuration files - to optimise atom processing in eXist + add code in initialiser class to set these up on eXist.
Add all the required schemata required for atom schema validation in eXist + add code in initialiser class to set these up on eXist;
this allows eXist to be ran without need of access beyond the firewall.

Location:
ndgCommon/trunk/ndg/common/unittests
Files:
1 added
6 edited

Legend:

Unmodified
Added
Removed
  • ndgCommon/trunk/ndg/common/unittests/clients/xmldb/eXist/testexistdbclient.py

    r4793 r4810  
    147147        self.assertEquals(None, newClient._eXistDBClient__lookupEXistFile(molesSchema)) 
    148148         
    149     def testSetUpEXistCollections(self): 
    150         try: 
    151             self.utils.dbc._eXistDBClient__setUpEXistAtomCollections() 
    152         except: 
    153             self.fail("Should not have thrown an exception") 
    154          
    155149    def testLoadDBDetailsValid(self): 
    156150        self.utils.dbc._eXistDBClient__loadDBDetails(self.confFile) 
  • ndgCommon/trunk/ndg/common/unittests/clients/xmldb/eXist/testexistdbfeedclient.py

    r4793 r4810  
    88from ndg.common.src.clients.xmldb.eXist.eXistConnector import eXistConnector as ec 
    99from ndg.common.src.clients.xmldb.eXist.existdbfeedclient import eXistDBFeedClient as feedClient, FeedClientError 
    10 from ndg.common.src.lib.ndgXqueries import ndgXqueries 
    1110from ndg.common.src.models.Atom import Atom 
    1211from ndg.common.src.models.vocabtermdata import VocabTermData as VTD 
  • ndgCommon/trunk/ndg/common/unittests/lib/test_xmlhandler2.py

    r4793 r4810  
    11import unittest, ConfigParser 
    22from ndg.common.src.lib.xmlHandler2 import xmlHandler 
    3 from ndg.common.src.lib.ndgXqueries import ndgXqueries 
    43from ndg.common.src.clients.xmldb.eXist.eXistInterface import ndg_eXist 
    54from ndg.common.src.models.ndgObject import ndgObject 
  • ndgCommon/trunk/ndg/common/unittests/models/testatom.py

    r4793 r4810  
    1111import ndg.common.unittests.testconstants as tc 
    1212from ndg.common.src.models import AtomState 
     13from ndg.common.unittests.testutils import testUtils as tu 
     14from ndg.common.src.dal.DocumentRetrieve import DocumentRetrieve 
    1315 
    1416class testatom(unittest.TestCase): 
     
    2931        self.link2.href = 'www.pete.com' 
    3032        self.link2.rel = 'self' 
     33        self.createdAtoms = []    # array to store paths to atoms created - in order to then delete them 
     34        self.utils = tu(tc.DBCONFIG_FILE) 
    3135 
    3236                 
     
    210214        self.assertEqual(AtomState.OLD_STATE, self.atom.state) 
    211215        self.assertFalse(self.atom.isPublished()) 
    212          
     216 
     217    def testLookupAssociatedDEData(self): 
     218        atom = self.utils.createAtomInEXist(tc.invalidXmlString) 
     219        self.createdAtoms.append(atom.getFullPath()) 
     220        dr = DocumentRetrieve(tc.VALID_REPOSITORY, 
     221                              pwfile = tc.DBCONFIG_FILE) 
     222 
     223        atom.lookupAssociatedData(VTD.DE_TERM, dr) 
     224        self.utils.dbc.deleteAtomInExist(atom) 
     225 
     226    def testLookupAssociatedDeploymentData(self): 
     227        atom = self.utils.createAtomInEXist(tc.invalidXmlString) 
     228        self.createdAtoms.append(atom.getFullPath()) 
     229        dr = DocumentRetrieve(tc.VALID_REPOSITORY, 
     230                              pwfile = tc.DBCONFIG_FILE) 
     231 
     232        atom.lookupAssociatedData(VTD.DEPLOYMENT_TERM, dr) 
     233        self.utils.dbc.deleteAtomInExist(atom) 
     234 
     235    def testLookupAssociatedDeploymentDataWithLookupIndirectReferences(self): 
     236        atom = self.utils.createAtomInEXist(tc.invalidXmlString) 
     237        self.createdAtoms.append(atom.getFullPath()) 
     238        dr = DocumentRetrieve(tc.VALID_REPOSITORY, 
     239                              pwfile = tc.DBCONFIG_FILE) 
     240 
     241        atom.lookupAssociatedData(VTD.DEPLOYMENT_TERM, dr, 
     242                                  lookupIndirectReferences=True) 
     243        self.utils.dbc.deleteAtomInExist(atom) 
     244 
     245    def testLookupAssociatedDEDataWithLookupIndirectReferences(self): 
     246        atom = self.utils.createAtomInEXist(tc.invalidXmlString) 
     247        self.createdAtoms.append(atom.getFullPath()) 
     248        dr = DocumentRetrieve(tc.VALID_REPOSITORY, 
     249                              pwfile = tc.DBCONFIG_FILE) 
     250 
     251        atom.lookupAssociatedData(VTD.DE_TERM, dr, 
     252                                  lookupIndirectReferences=True) 
     253        self.utils.dbc.deleteAtomInExist(atom) 
     254 
    213255         
    214256 
  • ndgCommon/trunk/ndg/common/unittests/models/testdif.py

    r4793 r4810  
    1919    def setUp(self): 
    2020        ''' Load example config and DIF files for testing ''' 
    21         from ndgUtils.xmlHandler2 import xmlHandler 
     21        from ndg.common.src.lib.xmlHandler2 import xmlHandler 
    2222        x=xmlHandler(tc.DIF_FILE) 
    2323        self.dif=DIF(x.tree,et=1) 
     
    3737    def testDifficult(self): 
    3838        ''' Grab a test example from the internet and load it ''' 
    39         from ndgUtils import ndgRetrieve, xmlHandler2 
     39        from ndg.common.src.dal import ndgRetrieve 
     40        from ndg.common.src.lib import xmlHandler2 
    4041        #testURI='grid.bodc.nerc.ac.uk__DIF__EDMED1048008' 
    4142        testURI='neodc.nerc.ac.uk__DIF__NEODC_NEXTMAP' 
  • ndgCommon/trunk/ndg/common/unittests/testconstants.py

    r4793 r4810  
    1313__revision__ = '$Id: $' 
    1414 
    15 from ndgUtils.eXistConnector import eXistConnector as ec 
    16 from ndgUtils.models.vocabtermdata import VocabTermData as VTD 
     15from ndg.common.src.clients.xmldb.eXist.eXistConnector import eXistConnector as ec 
     16from ndg.common.src.models.vocabtermdata import VocabTermData as VTD 
    1717import os, datetime 
    1818 
     
    107107 
    108108MOLES_ENTITY_STRING = '<moles:entity type="granule"><moles:molesISO><moles:responsibleParties>' + \ 
    109             '<moles:responsibleParty><name>calum byrom</name><uri>www.cb.org</uri><role>Metadata maintainer</role></moles:responsibleParty>' + \ 
    110             '<moles:responsibleParty><name>dom lowe</name><uri>www.badc.rl.ac.uk</uri><role>Metadata maintainer</role></moles:responsibleParty>' + \ 
     109            '<moles:responsibleParty><moles:name>calum byrom</moles:name><moles:uri>www.cb.org</moles:uri><moles:role>Metadata maintainer</moles:role></moles:responsibleParty>' + \ 
     110            '<moles:responsibleParty><moles:name>dom lowe</moles:name><moles:uri>www.badc.rl.ac.uk</moles:uri><moles:role>Metadata maintainer</moles:role></moles:responsibleParty>' + \ 
    111111            '</moles:responsibleParties><moles:datasetLanguage>English</moles:datasetLanguage>' + \ 
    112112            '<moles:datasetLanguage>English</moles:datasetLanguage>' + \ 
     
    153153        '<contributor><name>Brian Bandy</name><uri>www.cb.org</uri></contributor>' + \ 
    154154        '<moles:entity type="granule"><moles:molesISO><moles:responsibleParties>' + \ 
    155             '<moles:responsibleParty><name>calum byrom</name><uri>www.cb.org</uri><role>Metadata maintainer</role></moles:responsibleParty>' + \ 
    156             '<moles:responsibleParty><name>dom lowe</name><uri>www.badc.rl.ac.uk</uri><role>Metadata maintainer</role></moles:responsibleParty>' + \ 
     155            '<moles:responsibleParty><moles:name>calum byrom</moles:name><moles:uri>www.cb.org</moles:uri><moles:role>Metadata maintainer</moles:role></moles:responsibleParty>' + \ 
     156            '<moles:responsibleParty><moles:name>dom lowe</moles:name><moles:uri>www.badc.rl.ac.uk</moles:uri><moles:role>Metadata maintainer</moles:role></moles:responsibleParty>' + \ 
    157157            '</moles:responsibleParties><moles:datasetLanguage>English</moles:datasetLanguage>' + \ 
    158158            '<moles:providerID>badc.nerc.ac.uk</moles:providerID>' + \ 
Note: See TracChangeset for help on using the changeset viewer.