Search in sources :

Example 1 with ParseException

use of org.apache.asterix.lang.aql.parser.ParseException in project asterixdb by apache.

the class AQLTestCase method testAQL.

@Test
public void testAQL() throws UnsupportedEncodingException, FileNotFoundException, ParseException, AsterixException, AlgebricksException {
    Reader reader = new BufferedReader(new InputStreamReader(new FileInputStream(queryFile), "UTF-8"));
    IParser parser = aqlParserFactory.createParser(reader);
    GlobalConfig.ASTERIX_LOGGER.info(queryFile.toString());
    try {
        parser.parse();
    } catch (Exception e) {
        GlobalConfig.ASTERIX_LOGGER.warning("Failed while testing file " + reader);
        StringWriter sw = new StringWriter();
        PrintWriter writer = new PrintWriter(sw);
        e.printStackTrace(writer);
        GlobalConfig.ASTERIX_LOGGER.warning(sw.toString());
        throw new ParseException("Parsing " + queryFile.toString());
    }
}
Also used : InputStreamReader(java.io.InputStreamReader) StringWriter(java.io.StringWriter) BufferedReader(java.io.BufferedReader) Reader(java.io.Reader) InputStreamReader(java.io.InputStreamReader) BufferedReader(java.io.BufferedReader) ParseException(org.apache.asterix.lang.aql.parser.ParseException) FileInputStream(java.io.FileInputStream) AlgebricksException(org.apache.hyracks.algebricks.common.exceptions.AlgebricksException) AsterixException(org.apache.asterix.common.exceptions.AsterixException) FileNotFoundException(java.io.FileNotFoundException) ParseException(org.apache.asterix.lang.aql.parser.ParseException) UnsupportedEncodingException(java.io.UnsupportedEncodingException) IParser(org.apache.asterix.lang.common.base.IParser) PrintWriter(java.io.PrintWriter) Test(org.junit.Test)

Aggregations

BufferedReader (java.io.BufferedReader)1 FileInputStream (java.io.FileInputStream)1 FileNotFoundException (java.io.FileNotFoundException)1 InputStreamReader (java.io.InputStreamReader)1 PrintWriter (java.io.PrintWriter)1 Reader (java.io.Reader)1 StringWriter (java.io.StringWriter)1 UnsupportedEncodingException (java.io.UnsupportedEncodingException)1 AsterixException (org.apache.asterix.common.exceptions.AsterixException)1 ParseException (org.apache.asterix.lang.aql.parser.ParseException)1 IParser (org.apache.asterix.lang.common.base.IParser)1 AlgebricksException (org.apache.hyracks.algebricks.common.exceptions.AlgebricksException)1 Test (org.junit.Test)1