Package mondrian.test

Class DialectTest


  • public class DialectTest
    extends TestCase
    Unit test which checks that Dialect accurately represents the capabilities of the underlying database.

    The existing mondrian tests, when run on various databases and drivers, make sure that Dialect never over-states the capabilities of a particular database. But sometimes they under-state a database's capabilities: for example, MySQL version 3 did not allow subqueries in the FROM clause, but version 4 does. This test helps ensure that mondrian is using the full capabilities of each database.

    NOTE: If you see failures in this test, let the mondrian developers know! You may be running a version of a database which no one has tried before, and which has more capabilities than we expect. If you tell us about them, we can change mondrian to use those features.

    Since:
    May 18, 2007
    Author:
    jhyde
    • Constructor Detail

      • DialectTest

        public DialectTest​(java.lang.String name)
        Creates a DialectTest.
        Parameters:
        name - Test case name
    • Method Detail

      • getDataSource

        protected javax.sql.DataSource getDataSource()
      • tearDown

        protected void tearDown()
                         throws java.lang.Exception
        Throws:
        java.lang.Exception
      • getDialect

        protected Dialect getDialect()
      • getConnection

        protected java.sql.Connection getConnection()
      • testDialectVsDatabaseProduct

        public void testDialectVsDatabaseProduct()
                                          throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • testAllowsCompoundCountDistinct

        public void testAllowsCompoundCountDistinct()
      • testAllowsCountDistinct

        public void testAllowsCountDistinct()
      • testAllowsMultipleCountDistinct

        public void testAllowsMultipleCountDistinct()
      • testAllowsDdl

        public void testAllowsDdl()
      • testAllowsFromQuery

        public void testAllowsFromQuery()
      • testRequiresFromQueryAlias

        public void testRequiresFromQueryAlias()
      • testRequiresOrderByAlias

        public void testRequiresOrderByAlias()
      • testAllowsOrderByAlias

        public void testAllowsOrderByAlias()
      • testRequiresUnionOrderByOrdinal

        public void testRequiresUnionOrderByOrdinal()
      • testRequiresUnionOrderByExprToBeInSelectClause

        public void testRequiresUnionOrderByExprToBeInSelectClause()
      • testSupportsGroupByExpressions

        public void testSupportsGroupByExpressions()
      • testSupportsMultiValueInExpr

        public void testSupportsMultiValueInExpr()
      • testDateLiteralString

        public void testDateLiteralString()
      • testBigInt

        public void testBigInt()
      • testResultSetConcurrency

        public void testResultSetConcurrency()
      • testGenerateInline

        public void testGenerateInline()
                                throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • testForceNullCollation

        public void testForceNullCollation()
                                    throws java.sql.SQLException
        Tests that the dialect can generate a valid query to sort ascending and descending, with NULL values appearing last in both cases.
        Throws:
        java.sql.SQLException
      • assertQuerySucceeds

        protected void assertQuerySucceeds​(java.lang.String sql)
        Asserts that a query succeeds and produces at least one row.
        Parameters:
        sql - SQL query in current dialect
      • assertQueryFails

        protected void assertQueryFails​(java.lang.String sql,
                                        java.lang.String[] patterns)
        Asserts that a query fails.
        Parameters:
        sql - SQL query
        patterns - Array of expected patterns, generally one for each SQL dialect for which the test is expected to fail
      • testAllowsSelectNotInGroupBy

        public void testAllowsSelectNotInGroupBy()
                                          throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • testHavingRequiresAlias

        public void testHavingRequiresAlias()
                                     throws java.lang.Exception
        Throws:
        java.lang.Exception
      • testAllowsRegularExpressionInWhereClause

        public void testAllowsRegularExpressionInWhereClause()
                                                      throws java.lang.Exception
        Throws:
        java.lang.Exception
      • testComplexRegularExpression

        public void testComplexRegularExpression()
                                          throws java.lang.Exception
        This is a test for http://jira.pentaho.com/browse/MONDRIAN-1057 Some dialects are not removing the \Q and \E markers if they are in the middle of the regexp.
        Throws:
        java.lang.Exception
      • testRegularExpressionSqlInjection

        public void testRegularExpressionSqlInjection()
                                               throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • testOracleTypeMapQuirks

        public void testOracleTypeMapQuirks()
                                     throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • testPostgresGreenplumTypeMapQuirks

        public void testPostgresGreenplumTypeMapQuirks()
                                                throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • testNetezzaTypeMapQuirks

        public void testNetezzaTypeMapQuirks()
                                      throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • testMonetDBTypeMapQuirks

        public void testMonetDBTypeMapQuirks()
                                      throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • testJdbcDialectTypeMap

        public void testJdbcDialectTypeMap()
                                    throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • testMonetBooleanColumn

        public void testMonetBooleanColumn()
                                    throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • testHiveTimestampQuoteLiteral

        public void testHiveTimestampQuoteLiteral()
                                           throws java.sql.SQLException
        Throws:
        java.sql.SQLException