Project

General

Profile

« Previous | Next » 

Revision 4080

Added by daigle about 16 years ago

Merge 1.9 changes into Head

View differences:

QuerySpecificationTest.java
33 33
import junit.framework.TestCase;
34 34
import junit.framework.TestSuite;
35 35

  
36
import edu.ucsb.nceas.metacat.MetaCatUtil;
37 36
import edu.ucsb.nceas.metacat.QuerySpecification;
37
import edu.ucsb.nceas.metacat.service.PropertyService;
38
import edu.ucsb.nceas.metacat.util.MetaCatUtil;
38 39
import edu.ucsb.nceas.utilities.Options;
40
import edu.ucsb.nceas.utilities.PropertyNotFoundException;
39 41

  
40 42
/**
41 43
 * @author jones
......
48 50
    private FileReader xml;
49 51
    
50 52
    /** The utilities object for accessing property values */
51
    private MetaCatUtil util;
52 53
    
53 54
    private static String selectionQuery = "SELECT docid,docname,doctype,date_created, date_updated, rev " +
54 55
    		"FROM xml_documents WHERE docid IN (((((SELECT DISTINCT docid FROM xml_nodes " +
......
97 98
  	  {
98 99
  		  Options.initialize(new File("build/tests/metacat.properties"));
99 100
  		  MetaCatUtil.pathsForIndexing 
100
  		         = MetaCatUtil.getOptionList(MetaCatUtil.getOption("indexPaths"));
101
  		         = MetaCatUtil.getOptionList(PropertyService.getProperty("indexPaths"));
101 102
  	  }
102 103
  	  catch(Exception e)
103 104
  	  {
......
124 125
        try {
125 126
            File propertyFile = new File("./lib/metacat.properties");
126 127
            Options options = Options.initialize(propertyFile);
127
            util = new MetaCatUtil();
128 128
            String xmlfile = "./test/query.xml";
129 129
            xml = new FileReader(new File(xmlfile));
130 130
        } catch (FileNotFoundException e) {
......
153 153
        try {
154 154
            System.out.println("---- SQL ------------------");
155 155
            QuerySpecification qspec = new QuerySpecification(xml, 
156
                    MetaCatUtil.getOption("saxparser"), 
157
                    MetaCatUtil.getOption("accNumberSeparator"));
156
                    PropertyService.getProperty("saxparser"), 
157
                    PropertyService.getProperty("accNumberSeparator"));
158 158
            String query = qspec.printSQL(false);
159 159
           assertTrue(selectionQuery.equals(query.trim()));
160 160
        } catch (IOException e) {
161 161
            fail(e.getMessage());
162
        } catch (PropertyNotFoundException pnfe) {
163
            fail(pnfe.getMessage());
162 164
        }
163 165
    }
164 166

  
......
170 172
        try {
171 173
            System.out.println("---- orginal EXT SQL  ------------------\n"+extendedQuery);
172 174
            QuerySpecification qspec = new QuerySpecification(xml, 
173
                    MetaCatUtil.getOption("saxparser"), 
174
                    MetaCatUtil.getOption("accNumberSeparator"));
175
                    PropertyService.getProperty("saxparser"), 
176
                    PropertyService.getProperty("accNumberSeparator"));
175 177
            String query = 
176 178
                    qspec.printExtendedSQL(
177 179
                            "'obfs.45337', 'obfs.45338', 'obfs.45346'", true);
......
179 181
            assertTrue(extendedQuery.equals(query));
180 182
        } catch (IOException e) {
181 183
            fail(e.getMessage());
184
        } catch (PropertyNotFoundException pnfe) {
185
            fail(pnfe.getMessage());
182 186
        }
183 187
    }
184 188

  

Also available in: Unified diff