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.
    • 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
      • testJsonSalesDepts

        public void testJsonSalesDepts()
                                throws java.sql.SQLException
        Reads the DEPTS table from the JSON schema.
        Throws:
        java.sql.SQLException
      • testJsonSalesEmps

        public void testJsonSalesEmps()
                               throws java.sql.SQLException
        Reads the EMPS table from the JSON schema.
        Throws:
        java.sql.SQLException
      • testJsonSalesEmpty

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

        public void testJsonJoinOnString()
        Test returns the result of two json file joins.
      • testJsonWithCsvJoin

        public void testJsonWithCsvJoin()
        The folder contains both JSON files and CSV files joins.