Class BatchTestCase

    • Constructor Detail

      • BatchTestCase

        public BatchTestCase​(String name)
      • BatchTestCase

        public BatchTestCase()
    • Method Detail

      • assertRequestSql

        protected void assertRequestSql​(CellRequest[] requests,
                                        SqlPattern[] patterns)
        Checks that a given sequence of cell requests results in a particular SQL statement being generated.

        Always clears the cache before running the requests.

        Runs the requests once for each SQL pattern in the current dialect. If there are multiple patterns, runs the MDX query multiple times, and expects to see each SQL statement appear. If there are no patterns in this dialect, the test trivially succeeds.

        Parameters:
        requests - Sequence of cell requests
        patterns - Set of patterns
      • assertRequestSql

        protected void assertRequestSql​(CellRequest[] requests,
                                        SqlPattern[] patterns,
                                        boolean negative)
        Checks that a given sequence of cell requests results in a particular SQL statement being generated.

        Always clears the cache before running the requests.

        Runs the requests once for each SQL pattern in the current dialect. If there are multiple patterns, runs the MDX query multiple times, and expects to see each SQL statement appear. If there are no patterns in this dialect, the test trivially succeeds.

        Parameters:
        requests - Sequence of cell requests
        patterns - Set of patterns
        negative - Set to false in order to 'expect' a query or true to 'forbid' a query.
      • assertQuerySql

        protected void assertQuerySql​(String mdxQuery,
                                      SqlPattern[] patterns)
        Checks that a given MDX query results in a particular SQL statement being generated.
        Parameters:
        mdxQuery - MDX query
        patterns - Set of patterns for expected SQL statements
      • assertQuerySql

        protected void assertQuerySql​(TestContext testContext,
                                      String mdxQuery,
                                      SqlPattern[] patterns)
        Checks that a given MDX query results in a particular SQL statement being generated.
        Parameters:
        testContext - non-default test context if required
        mdxQuery - MDX query
        patterns - Set of patterns for expected SQL statements
      • assertNoQuerySql

        protected void assertNoQuerySql​(String mdxQuery,
                                        SqlPattern[] patterns)
        Checks that a given MDX query does not result in a particular SQL statement being generated.
        Parameters:
        mdxQuery - MDX query
        patterns - Set of patterns for expected SQL statements
      • assertQuerySql

        protected void assertQuerySql​(String mdxQuery,
                                      SqlPattern[] patterns,
                                      boolean clearCache)
        Checks that a given MDX query results in a particular SQL statement being generated.
        Parameters:
        mdxQuery - MDX query
        patterns - Set of patterns, one for each dialect.
        clearCache - whether to clear cache before running the query
      • assertQuerySqlOrNot

        protected void assertQuerySqlOrNot​(TestContext testContext,
                                           String mdxQuery,
                                           SqlPattern[] patterns,
                                           boolean negative,
                                           boolean bypassSchemaCache,
                                           boolean clearCache)
        During MDX query parse and execution, checks that the query results (or does not result) in a particular SQL statement being generated.

        Parses and executes the MDX query once for each SQL pattern in the current dialect. If there are multiple patterns, runs the MDX query multiple times, and expects to see each SQL statement appear. If there are no patterns in this dialect, the test trivially succeeds.

        Parameters:
        testContext - non-default test context if required
        mdxQuery - MDX query
        patterns - Set of patterns
        negative - false to assert if SQL is generated; true to assert if SQL is NOT generated
        bypassSchemaCache - whether to grab a new connection and bypass the schema cache before parsing the MDX query
        clearCache - whether to clear cache before executing the MDX query
      • getFoodMartConnection

        protected Connection getFoodMartConnection()
      • checkNotNative

        protected void checkNotNative​(int rowCount,
                                      String mdx)
        Make sure the mdx runs correctly and not in native mode.
        Parameters:
        rowCount - number of rows returned
        mdx - query
      • checkNotNative

        protected void checkNotNative​(int rowCount,
                                      String mdx,
                                      String expectedResult)
        Makes sure the MDX runs correctly and not in native mode.
        Parameters:
        rowCount - Number of rows returned
        mdx - Query
        expectedResult - Expected result string
      • checkNative

        protected void checkNative​(int resultLimit,
                                   int rowCount,
                                   String mdx)
        Runs a query twice, with native crossjoin optimization enabled and disabled. If both results are equal, its considered correct.
        Parameters:
        resultLimit - Maximum result size of all the MDX operations in this query. This might be hard to estimate as it is usually larger than the rowCount of the final result. Setting it to 0 will cause this limit to be ignored.
        rowCount - Number of rows returned
        mdx - Query
      • checkNative

        protected void checkNative​(int resultLimit,
                                   int rowCount,
                                   String mdx,
                                   String expectedResult,
                                   boolean freshConnection)
        Runs a query twice, with native crossjoin optimization enabled and disabled. If both results are equal,and both aggree with the expected result, it is considered correct.

        Optionally the query can be run with fresh connection. This is useful if the test case sets its certain mondrian properties, e.g. native properties like: mondrian.native.filter.enable

        Parameters:
        resultLimit - Maximum result size of all the MDX operations in this query. This might be hard to estimate as it is usually larger than the rowCount of the final result. Setting it to 0 will cause this limit to be ignored.
        rowCount - Number of rows returned. (That is, the number of positions on the last axis of the query.)
        mdx - Query
        expectedResult - Expected result string
        freshConnection - Whether fresh connection is required
      • checkNotNative

        public static void checkNotNative​(String mdx,
                                          Result expectedResult)
      • checkNative

        public static void checkNative​(String mdx,
                                       Result expectedResult)
      • assertNotNative

        public void assertNotNative​(String mdx)
        Convenience method for debugging; please do not delete.
      • assertNative

        public void assertNative​(String mdx)
        Convenience method for debugging; please do not delete.