source: exist/trunk/python/ndgutilstests/testconstants.py @ 4783

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/exist/trunk/python/ndgutilstests/testconstants.py
Revision 4783, 8.7 KB checked in by cbyrom, 11 years ago (diff)

Extend test suites to test new feed and DIF creation functionality.

Line 
1"""
2Constants to use in the various test cases
3
4NERC Data Grid Project
5"""
6__author__ = "C Byrom - Tessella"
7__date__ = "03/09/08"
8__copyright__ = "(C) 2008 STFC & NERC"
9__license__ = \
10"""This software may be distributed under the terms of the Q Public
11License, version 1.0 or later."""
12__contact__ = "b.n.lawrence@rl.ac.uk"
13__revision__ = '$Id: $'
14
15from ndgUtils.eXistConnector import eXistConnector as ec
16from ndgUtils.models.vocabtermdata import VocabTermData as VTD
17import os
18
19BASE_DIR = 'ndgutilstests'
20
21curDir = os.getcwd()
22prefix = ''
23if not curDir.endswith(BASE_DIR):
24    prefix = '..' + os.sep
25   
26TEST_DATA_DIR = prefix + 'testdata' + os.sep
27DBCONFIG_FILE = TEST_DATA_DIR + 'exist.config'
28TEST_GRANULITE = TEST_DATA_DIR + 'example.granulite'
29
30NDG_CONFIG_FILE = TEST_DATA_DIR + 'ndgDiscovery.config'
31DIF_FILE = TEST_DATA_DIR + 'dataent_NDSC_DIF.xml'
32
33GRANULITE_TITLE = 'this is a new test granulite'
34GRANULITE_TIME_AXIS = 'time0'
35GRANULITE_CDML_DATASETID = 'test_hadgem1_dataset'
36GRANULITE_PROVIDER_ID = 'badc.nerc.ac.uk'
37GRANULITE_DATASETID = 'calum_data_set'
38GRANULITE_LOGO = 'http:/blah/blah/a_logo_icon.png'
39GRANULITE_AUTHOR_NAME = 'calum byrom'
40GRANULITE_AUTHOR_URI = 'www.cb.org'
41GRANULITE_AUTHOR_ROLE = 'Data migrator'
42GRANULITE_T1 = '1996-4-19'
43GRANULITE_T2 = '1998-9-22'
44
45VALID_REPOSITORY = "chinook.badc.rl.ac.uk"
46VALID_PROVIDER_ID = 'badc.nerc.ac.uk'
47VALID_MOLES_DOC_ID = 'dataent_hadisst'
48VALID_NDGA_DOC_ID = 'COAPEC_500YrRun_wholerun_annual_atmos'
49VALID_NUMSIM_DOC_ID = 'HadGEM1_CodeBase'
50VALID_ATOM_DOC_ID = 'dataent_11679938403412067'
51
52VALID_DISCOVERY_PROVIDER_ID = "csl.gov.uk"
53VALID_DISCOVERY_DOC_ID = "csl.gov.uk__1"       
54
55validParams = ['OZONE MIXING RATIO (PPB ) | http://vocab.ndg.nerc.ac.uk/blah | OZONE', \
56               'ERROR FLAG (OZONE MIXING RATIO ) | http://vocab.ndg.nerc.ac.uk/blah | ERROR', \
57               'HYDROGEN PEROXIDE PPBV | http://vocab.ndg.nerc.ac.uk/blah | HYDROGEN',
58               'CADMIUM >1.21 M DIAMETER (PMOL M-3) INSTRUMENTAL DETECTION LIMIT 0.132 NM']
59
60messyParams = ['OZONE MIXING RATIO &  (PPB     ) | http://vocab.ndg.nerc.ac.uk/blah | ozone', \
61               'ERROR FLAG (OZONE MIXING > RATIO  ) | http://vocab.ndg.nerc.ac.uk/blah | error', \
62               'Hydrogen Peroxide < ppbv | http://vocab.ndg.nerc.ac.uk/blah | hydrogen &']
63
64summaryText = 'this is a summary of the granulite'
65
66csmlFile = '/db/moles_support/csml/csml_famous_control_month.xml'
67
68logo = '/blah/blah/a_logo_icon.png'
69
70title = 'this is a test granulite'
71
72datasetID = 'famous_control_month_test_file'
73
74id = 'tag:localhost:5000,2008-09-17:/view/badc.nerc.ac.uk__ATOM__' + datasetID
75
76atomName = 'http://localhost:5000/view/badc.nerc.ac.uk__ATOM__' + datasetID
77
78name = datasetID + '.atom'
79
80VTD = VTD()
81T1 = '2792-12-16'
82T2 = '2992-11-16'
83minX = '-90.0'
84minY = '-90.0'
85maxX = '360.0'
86maxY = '5505.29980469'
87ABBREVIATION = 'BLAH'
88VALID_EMAIL = 'dt@bob.org'
89INVALID_EMAIL = 'dt.bob.org'
90INVALID_FILE = 'blah.txt'
91
92xmlString = '<entry xmlns="http://www.w3.org/2005/Atom" xmlns:georss="http://www.georss.org/georss/10" xmlns:gml="http://www.opengis.net/gml" ' + \
93    'xmlns:moles="http://ndg.nerc.ac.uk/schema/moles2beta">' + \
94    '<id>' + id + '</id>' + \
95    '<title>' + title + '</title>' + \
96        '<link href="' + atomName + '" rel="self"/>' + \
97        '<link href="http://badc.nerc.ac.uk/a-real-wms-endpoint" rel="http://vocab.ndg.nerc.ac.uk/term/P201/1/GCMDU026" title="WMS"/>' + \
98        '<link href="http://badc.nerc.ac.uk/alternate" rel="http://vocab.ndg.nerc.ac.uk/term/C110/6/GD" title="alternate page"/>' + \
99        '<link href="' + logo + '" title="' + VTD.TERM_DATA[VTD.LOGO_TERM].title + '" rel="http://vocab.ndg.nerc.ac.uk/term/C110/6/GD/Logo"/>' + \
100        '<author><name>Tiddeman, David</name><email>' + VALID_EMAIL + '</email></author>' + \
101        '<contributor><name>Brian Bandy</name><email>bb@bb.org</email></contributor>' + \
102        '<moles:entity type="granule"><moles:molesISO><moles:responsibleParties>' + \
103            '<moles:responsibleParty><name>calum byrom</name><uri>www.cb.org</uri><role>Metadata maintainer</role></moles:responsibleParty>' + \
104            '<moles:responsibleParty><name>dom lowe</name><uri>www.badc.rl.ac.uk</uri><role>Metadata maintainer</role></moles:responsibleParty>' + \
105            '</moles:responsibleParties><moles:datasetLanguage>English</moles:datasetLanguage>' + \
106            '<moles:datasetLanguage>English</moles:datasetLanguage>' + \
107            '<moles:metadataLanguage>English</moles:metadataLanguage>' + \
108            '<moles:abbreviation>' + ABBREVIATION + '</moles:abbreviation>' + \
109            '<moles:providerID>badc.nerc.ac.uk</moles:providerID>' + \
110            '<moles:metadataLanguage>English</moles:metadataLanguage>' + \
111            '</moles:molesISO>' + \
112        '</moles:entity>' + \
113        '<category term="OZONE" scheme="http://vocab.ndg.nerc.ac.uk/term/C110/6/GD" label="OZONE MIXING RATIO (PPB )"/>' + \
114        '<category term="ERROR" scheme="http://vocab.ndg.nerc.ac.uk/term/C110/6/GD" label="ERROR FLAG (OZONE MIXING RATIO )"/>' + \
115        '<category term="HYDROGEN" scheme="http://vocab.ndg.nerc.ac.uk/term/C110/6/GD" label="HYDROGEN PEROXIDE PPBV"/>' + \
116        '<category term="ATOM_TYPE" scheme="GRAN - NOT YET SET UP/None/GRANULE" label="GRANULE"></category>' + \
117        '<summary>' + summaryText + '</summary>' + \
118        '<content src="' + csmlFile + '" type="application/xml"/>' + \
119        '<published>2008-06-17T10:15:19</published>' + \
120        '<moles:temporalRange>' + T1 + '/' + T2 + '</moles:temporalRange>' + \
121        '<georss:where><gml:Envelope><gml:lowerCorner>' + minX + ' ' + minY + '</gml:lowerCorner><gml:upperCorner>' + maxX + ' ' + maxY + '</gml:upperCorner></gml:Envelope></georss:where>' + \
122    '</entry>'
123
124invalidEmailXmlString = xmlString.replace(VALID_EMAIL, INVALID_EMAIL)
125
126INVALID_TITLE = '\xa2'
127invalidXmlString = '<entry xmlns="http://www.w3.org/2005/Atom" xmlns:georss="http://www.georss.org/georss/10" xmlns:gml="http://www.opengis.net/gml" ' + \
128    'xmlns:moles="http://ndg.nerc.ac.uk/schema/moles2beta">' + \
129    '<id>' + id + '</id>' + \
130        '<link href="' + atomName + '" rel="self"/>' + \
131        '<link href="http://badc.nerc.ac.uk/a-real-wms-endpoint" rel="http://vocab.ndg.nerc.ac.uk/term/P201/1/GCMDU026" title="WMS"/>' + \
132        '<link href="http://badc.nerc.ac.uk/alternate" rel="alternate" title="alternate page"/>' + \
133        '<link href="' + logo + '" title="' + VTD.TERM_DATA[VTD.LOGO_TERM].title + '" rel="' + VTD.LOGO_TERM + '"/>' + \
134        '<contributor><name>Brian Bandy</name><uri>www.cb.org</uri></contributor>' + \
135        '<moles:entity type="granule"><moles:molesISO><moles:responsibleParties>' + \
136            '<moles:responsibleParty><name>calum byrom</name><uri>www.cb.org</uri><role>Metadata maintainer</role></moles:responsibleParty>' + \
137            '<moles:responsibleParty><name>dom lowe</name><uri>www.badc.rl.ac.uk</uri><role>Metadata maintainer</role></moles:responsibleParty>' + \
138            '</moles:responsibleParties><moles:datasetLanguage>English</moles:datasetLanguage>' + \
139            '<moles:providerID>badc.nerc.ac.uk</moles:providerID>' + \
140            '<moles:metadataLanguage>English</moles:metadataLanguage>' + \
141            '</moles:molesISO>' + \
142        '</moles:entity>' + \
143        '<category term="OZONE" scheme="http://vocab.ndg.nerc.ac.uk/blah" label="OZONE MIXING RATIO (PPB )"/>' + \
144        '<category term="ERROR" scheme="http://vocab.ndg.nerc.ac.uk/blah" label="ERROR FLAG (OZONE MIXING RATIO )"/>' + \
145        '<category term="HYDROGEN" scheme="http://vocab.ndg.nerc.ac.uk/blah" label="HYDROGEN PEROXIDE PPBV"/>' + \
146        '<category term="ATOM_TYPE" scheme="GRAN - NOT YET SET UP/None/GRANULE" label="GRANULE"></category>' + \
147        '<summary>' + summaryText + '</summary>' + \
148        '<content src="' + csmlFile + '" type="application/xml"/>' + \
149        '<published>2008-06-17T10:15:19</published>' + \
150        '<moles:temporalRange>' + T1 + '/' + T2 + '</moles:temporalRange>' + \
151        '<georss:where><gml:Envelope><gml:lowerCorner>' + minX + ' ' + maxX + '</gml:lowerCorner><gml:upperCorner>' + minY + ' ' + maxY + '</gml:upperCorner></gml:Envelope></georss:where>' + \
152    '</entry>'
153
154   
155validAuthor = 'Tiddeman, David'
156validAuthors = [validAuthor + ' | www.cb.org', \
157                    'Brian Bandy | www.cb.org']
158   
159validGranuleAuthors = ['calum byrom | www.cb.org | Metadata maintainer', \
160                    'dom lowe | www.badc.rl.ac.uk | Metadata maintainer']
161
162validLinks = ['http://badc.nerc.ac.uk/a-real-wms-endpoint | WMS | http://vocab.ndg.nerc.ac.uk/term/P201/1/GCMDU026',\
163              'http://badc.nerc.ac.uk/alternate | alternate page | alternate',
164              '/blah/blah/a_logo_icon.png | logo | LOGO - NOT YET SET UP',
165              '/db/moles_support/granuleAtom/famous_control_month_granule.moles']
166
Note: See TracBrowser for help on using the repository browser.