Class ReflectiveSchemaTest


  • public class ReflectiveSchemaTest
    extends java.lang.Object
    Unit tests for ReflectiveSchema.
    • Field Detail

      • LINQ4J_AS_ENUMERABLE_METHOD

        public static final java.lang.reflect.Method LINQ4J_AS_ENUMERABLE_METHOD
      • CATCHALL

        private static final org.apache.calcite.adapter.java.ReflectiveSchema CATCHALL
    • Constructor Detail

      • ReflectiveSchemaTest

        public ReflectiveSchemaTest()
    • Method Detail

      • testQueryProvider

        public void testQueryProvider()
                               throws java.lang.Exception
        Test that uses a JDBC connection as a linq4j QueryProvider.
        Throws:
        java.lang.Exception - on error
      • testQueryProviderSingleColumn

        public void testQueryProviderSingleColumn()
                                           throws java.lang.Exception
        Throws:
        java.lang.Exception
      • testOperator

        public void testOperator()
                          throws java.sql.SQLException,
                                 java.lang.ClassNotFoundException
        Tests a relation that is accessed via method syntax. The function returns a Queryable.
        Throws:
        java.sql.SQLException
        java.lang.ClassNotFoundException
      • testView

        public void testView()
                      throws java.sql.SQLException,
                             java.lang.ClassNotFoundException
        Tests a view.
        Throws:
        java.sql.SQLException
        java.lang.ClassNotFoundException
      • testViewPath

        public void testViewPath()
                          throws java.sql.SQLException,
                                 java.lang.ClassNotFoundException
        Tests a view with a path.
        Throws:
        java.sql.SQLException
        java.lang.ClassNotFoundException
      • count

        private int count​(java.sql.ResultSet resultSet)
                   throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • testDateColumn

        public void testDateColumn()
                            throws java.lang.Exception
        Tests column based on java.sql.Date field.
        Throws:
        java.lang.Exception
      • testNoPublicFields

        public void testNoPublicFields()
                                throws java.lang.Exception
        Tests querying an object that has no public fields.
        Throws:
        java.lang.Exception
      • testColumnTypes

        public void testColumnTypes()
                             throws java.lang.Exception
        Tests columns based on types such as java.sql.Date and java.util.Date.
        Throws:
        java.lang.Exception
        See Also:
        ReflectiveSchemaTest.CatchallSchema.everyTypes
      • testAggregateFunctions

        public void testAggregateFunctions()
                                    throws java.lang.Exception
        Tests columns based on types such as java.sql.Date and java.util.Date.
        Throws:
        java.lang.Exception
        See Also:
        ReflectiveSchemaTest.CatchallSchema.everyTypes
      • get

        private java.lang.Object get​(java.sql.ResultSet input)
                              throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • testClassNames

        public void testClassNames()
                            throws java.lang.Exception
        Throws:
        java.lang.Exception
      • check

        private void check​(java.sql.ResultSetMetaData metaData,
                           java.lang.String columnName,
                           java.lang.Class expectedType)
                    throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • testJavaBoolean

        public void testJavaBoolean()
                             throws java.lang.Exception
        Throws:
        java.lang.Exception
      • testDivideWraperPrimitive

        public void testDivideWraperPrimitive()
                                       throws java.lang.Exception
        Throws:
        java.lang.Exception
      • testDivideWraperWrapper

        public void testDivideWraperWrapper()
                                     throws java.lang.Exception
        Throws:
        java.lang.Exception
      • testDivideWraperWrapperMultipleTimes

        public void testDivideWraperWrapperMultipleTimes()
                                                  throws java.lang.Exception
        Throws:
        java.lang.Exception
      • testOp

        public void testOp()
                    throws java.lang.Exception
        Throws:
        java.lang.Exception
      • testCastFromString

        public void testCastFromString()
      • isNumeric

        private static boolean isNumeric​(java.lang.Class type)
      • testTableFieldHasBadType

        public void testTableFieldHasBadType()
                                      throws java.lang.Exception
        Tests that if a field of a relation has an unrecognized type (in this case a BitSet) then it is treated as an object.
        Throws:
        java.lang.Exception
        See Also:
        ReflectiveSchemaTest.CatchallSchema.badTypes
      • testPrefix

        public void testPrefix()
                        throws java.lang.Exception
        Test case for a bug where a Java string 'Abc' compared to a char 'Ab' would be truncated to the char precision and falsely match.
        Throws:
        java.lang.Exception
      • testTableMacroIsView

        public void testTableMacroIsView()
                                  throws java.lang.Exception
        If a method returns a ViewTable.ViewTableMacro, then it should be expanded.
        Throws:
        java.lang.Exception
      • testTableMacro

        public void testTableMacro()
                            throws java.lang.Exception
        Finds a table-macro using reflection.
        Throws:
        java.lang.Exception
      • testArrayOfBoxedPrimitives

        public void testArrayOfBoxedPrimitives()
        Table with single field as Integer[]
      • testArrayOfPrimitives

        public void testArrayOfPrimitives()
        Table with single field as int[]
      • testCustomBoxedScalar

        public void testCustomBoxedScalar()
      • testCustomBoxedSalarCalc

        public void testCustomBoxedSalarCalc()
      • testUnknownInOr

        public void testUnknownInOr()
        CALCITE-2611 unknown on one side of an or may lead to uncompilable code