Package mondrian.test

Class FoodMartTestCase

    • Field Detail

      • propSaver

        protected final PropertySaver propSaver
        Access properties via this object and their values will be reset on tearDown().
    • Constructor Detail

      • FoodMartTestCase

        public FoodMartTestCase​(String name)
      • FoodMartTestCase

        public FoodMartTestCase()
    • Method Detail

      • getTestContext

        public TestContext getTestContext()
        Returns the test context. Override this method if you wish to use a different source for your FoodMart connection.
      • getConnection

        protected Connection getConnection()
      • assertSize

        protected void assertSize​(String queryString,
                                  int columnCount,
                                  int rowCount)
        Runs a query, and asserts that the result has a given number of columns and rows.
      • assertQueryThrows

        public void assertQueryThrows​(String queryString,
                                      String pattern)
        Runs a query, and asserts that it throws an exception which contains the given pattern.
      • execute

        public Result execute​(Connection connection,
                              String queryString)
        Executes a query in a given connection.
      • executeSingletonAxis

        public Member executeSingletonAxis​(String expression)
        Executes a set expression which is expected to return 0 or 1 members. It is an error if the expression returns tuples (as opposed to members), or if it returns two or more members.
        Parameters:
        expression - Expression
        Returns:
        Null if axis returns the empty set, member if axis returns one member. Throws otherwise.
      • assertQueryReturns

        public void assertQueryReturns​(String query,
                                       String desiredResult)
        Runs a query and checks that the result is a given string.
      • executeQuery

        public Result executeQuery​(String queryString)
        Runs a query.
      • assertAxisThrows

        public void assertAxisThrows​(String expression,
                                     String pattern)
        Runs a query with a given expression on an axis, and asserts that it throws an error which matches a particular pattern. The expression is evaulated against the Sales cube.
      • assertAxisReturns

        public void assertAxisReturns​(String expression,
                                      String expected)
        Runs a query on the "Sales" cube with a given expression on an axis, and asserts that it returns the expected string.
      • executeExpr

        public String executeExpr​(String expression)
        Executes an expression against the Sales cube in the FoodMart database to form a single cell result set, then returns that cell's formatted value.
      • assertBooleanExprReturns

        public void assertBooleanExprReturns​(String expression,
                                             boolean expected)
        Executes an expression which yields a boolean result, and asserts that the result is the expected one.
      • assertExprThrows

        public void assertExprThrows​(String expression,
                                     String pattern)
        Runs an expression, and asserts that it gives an error which contains a particular pattern. The error might occur during parsing, or might be contained within the cell value.
      • assertExprReturns

        public void assertExprReturns​(String expression,
                                      String expected)
        Runs an expression and asserts that it returns a given result.
      • assertQueriesReturnSimilarResults

        protected void assertQueriesReturnSimilarResults​(String query1,
                                                         String query2,
                                                         TestContext testContext)
        Executes query1 and query2 and Compares the obtained measure values.
      • isGroupingSetsSupported

        protected boolean isGroupingSetsSupported()
      • isDefaultNullMemberRepresentation

        protected boolean isDefaultNullMemberRepresentation()
      • productMembersPotScrubbersPotsAndPans

        protected TupleList productMembersPotScrubbersPotsAndPans​(SchemaReader salesCubeSchemaReader)
      • genderMembersIncludingAll

        protected TupleList genderMembersIncludingAll​(boolean includeAllMember,
                                                      SchemaReader salesCubeSchemaReader,
                                                      Cube salesCube)
      • allMember

        protected Member allMember​(String dimensionName,
                                   Cube salesCube)
      • warehouseMembersCanadaMexicoUsa

        protected List<Member> warehouseMembersCanadaMexicoUsa​(SchemaReader reader)
      • storeMembersUsaAndCanada

        protected TupleList storeMembersUsaAndCanada​(boolean includeAllMember,
                                                     SchemaReader salesCubeSchemaReader,
                                                     Cube salesCube)
      • verifySameNativeAndNot

        public void verifySameNativeAndNot​(String query,
                                           String message,
                                           TestContext context)
        Checks whether query produces the same results with the native.* props enabled as it does with the props disabled
        Parameters:
        query - query to run
        message - Message to output on test failure
        context - test context to use