Class SqlTest


  • public class SqlTest
    extends java.lang.Object
    System test of the Calcite file adapter, which can also read and parse HTML tables over HTTP.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      private class  SqlTest.Fluent
      Fluent API to perform test actions.
    • Constructor Summary

      Constructors 
      Constructor Description
      SqlTest()  
    • Constructor Detail

      • SqlTest

        public SqlTest()
    • Method Detail

      • sql

        private SqlTest.Fluent sql​(java.lang.String model,
                                   java.lang.String sql)
      • expect

        private static java.util.function.Function<java.sql.ResultSet,​java.lang.Void> expect​(java.lang.String... expectedLines)
      • expectUnordered

        private static java.util.function.Function<java.sql.ResultSet,​java.lang.Void> expectUnordered​(java.lang.String... expected)
        Returns a function that checks the contents of a result set against an expected string.
      • collect

        private static void collect​(java.util.List<java.lang.String> result,
                                    java.sql.ResultSet resultSet)
                             throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • checkSql

        private void checkSql​(java.lang.String sql,
                              java.lang.String model,
                              java.util.function.Function<java.sql.ResultSet,​java.lang.Void> fn)
                       throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • toString

        private static java.lang.String toString​(java.sql.ResultSet resultSet)
                                          throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • close

        private void close​(java.sql.Connection connection,
                           java.sql.Statement statement)
      • testFileSelect

        public void testFileSelect()
                            throws java.sql.SQLException
        Reads from a local file and checks the result.
        Throws:
        java.sql.SQLException
      • testNoThSelect

        public void testNoThSelect()
                            throws java.sql.SQLException
        Reads from a local file without table headers <TH> and checks the result.
        Throws:
        java.sql.SQLException
      • testFindBiggerNoTh

        public void testFindBiggerNoTh()
                                throws java.sql.SQLException
        Reads from a local file - finds larger table even without <TH> elements.
        Throws:
        java.sql.SQLException
      • testUrlSelect

        public void testUrlSelect()
                           throws java.sql.SQLException
        Reads from a URL and checks the result.
        Throws:
        java.sql.SQLException
      • testSalesEmps

        public void testSalesEmps()
                           throws java.sql.SQLException
        Reads the EMPS table.
        Throws:
        java.sql.SQLException
      • testSalesDepts

        public void testSalesDepts()
                            throws java.sql.SQLException
        Reads the DEPTS table.
        Throws:
        java.sql.SQLException
      • testCsvSalesDepts

        public void testCsvSalesDepts()
                               throws java.sql.SQLException
        Reads the DEPTS table from the CSV schema.
        Throws:
        java.sql.SQLException
      • testCsvSalesEmps

        public void testCsvSalesEmps()
                              throws java.sql.SQLException
        Reads the EMPS table from the CSV schema.
        Throws:
        java.sql.SQLException
      • testCsvSalesHeaderOnly

        public void testCsvSalesHeaderOnly()
                                    throws java.sql.SQLException
        Reads the HEADER_ONLY table from the CSV schema. The CSV file has one line - the column headers - but no rows of data.
        Throws:
        java.sql.SQLException
      • testCsvSalesEmpty

        public void testCsvSalesEmpty()
                               throws java.sql.SQLException
        Reads the EMPTY table from the CSV schema. The CSV file has no lines, therefore the table has a system-generated column called "EmptyFileHasNoColumns".
        Throws:
        java.sql.SQLException