Package mondrian.test

Examples of mondrian.test.TestContext$HighCardDynamicSchemaProcessor


            + "Row #1: 16,598.87\n"
            + "Row #1: 15,649.64\n");
    }

    public void testContextAtAllWorksWithConstraint() {
        TestContext ctx = TestContext.instance().create(
            null,
            "<Cube name=\"onlyGender\"> \n"
            + "  <Table name=\"sales_fact_1997\"/> \n"
            + "<Dimension name=\"Gender\" foreignKey=\"customer_id\">\n"
            + "    <Hierarchy hasAll=\"true\" allMemberName=\"All Gender\" primaryKey=\"customer_id\">\n"
            + "      <Table name=\"customer\"/>\n"
            + "      <Level name=\"Gender\" column=\"gender\" uniqueMembers=\"true\"/>\n"
            + "    </Hierarchy>\n"
            + "  </Dimension>"
            + "  <Measure name=\"Unit Sales\" column=\"unit_sales\" aggregator=\"sum\"/> \n"
            + "</Cube> \n",
            null,
            null,
            null,
            null);

        String mdx =
            " select "
            + " NON EMPTY {[Measures].[Unit Sales]} ON COLUMNS, "
            + " NON EMPTY {[Gender].[Gender].Members} ON ROWS "
            + " from [onlyGender] ";
        ctx.assertQueryReturns(
            mdx,
            "Axis #0:\n"
            + "{}\n"
            + "Axis #1:\n"
            + "{[Measures].[Unit Sales]}\n"
View Full Code Here


     * default measure is calculated, it would have already been removed from
     * the list by removeCalculatedMembers, and thus the assumption was wrong.
     */
    public void testCalculatedDefaultMeasureOnVirtualCubeNoThrowException() {
        propSaver.set(MondrianProperties.instance().EnableNativeNonEmpty, true);
        final TestContext context =
            TestContext.instance().withSchema(
                "<Schema name=\"FoodMart\">"
                + "  <Dimension name=\"Store\">"
                + "    <Hierarchy hasAll=\"true\" primaryKey=\"store_id\">"
                + "      <Table name=\"store\" />"
                + "      <Level name=\"Store Country\" column=\"store_country\" uniqueMembers=\"true\" />"
                + "      <Level name=\"Store State\" column=\"store_state\" uniqueMembers=\"true\" />"
                + "      <Level name=\"Store City\" column=\"store_city\" uniqueMembers=\"false\" />"
                + "      <Level name=\"Store Name\" column=\"store_name\" uniqueMembers=\"true\">"
                + "        <Property name=\"Store Type\" column=\"store_type\" />"
                + "        <Property name=\"Store Manager\" column=\"store_manager\" />"
                + "        <Property name=\"Store Sqft\" column=\"store_sqft\" type=\"Numeric\" />"
                + "        <Property name=\"Grocery Sqft\" column=\"grocery_sqft\" type=\"Numeric\" />"
                + "        <Property name=\"Frozen Sqft\" column=\"frozen_sqft\" type=\"Numeric\" />"
                + "        <Property name=\"Meat Sqft\" column=\"meat_sqft\" type=\"Numeric\" />"
                + "        <Property name=\"Has coffee bar\" column=\"coffee_bar\" type=\"Boolean\" />"
                + "        <Property name=\"Street address\" column=\"store_street_address\" type=\"String\" />"
                + "      </Level>"
                + "    </Hierarchy>"
                + "  </Dimension>"
                + "  <Cube name=\"Sales\" defaultMeasure=\"Unit Sales\">"
                + "    <Table name=\"sales_fact_1997\" />"
                + "    <DimensionUsage name=\"Store\" source=\"Store\" foreignKey=\"store_id\" />"
                + "    <Measure name=\"Unit Sales\" column=\"unit_sales\" aggregator=\"sum\" formatString=\"Standard\" />"
                + "    <CalculatedMember name=\"dummyMeasure\" dimension=\"Measures\">"
                + "      <Formula>1</Formula>"
                + "    </CalculatedMember>"
                + "  </Cube>"
                + "  <VirtualCube defaultMeasure=\"dummyMeasure\" name=\"virtual\">"
                + "    <VirtualCubeDimension name=\"Store\" />"
                + "    <VirtualCubeMeasure cubeName=\"Sales\" name=\"[Measures].[Unit Sales]\" />"
                + "    <VirtualCubeMeasure name=\"[Measures].[dummyMeasure]\" cubeName=\"Sales\" />"
                + "  </VirtualCube>"
                + "</Schema>");
        context.assertQueryReturns(
            "select "
            + " [Measures].[Unit Sales] on COLUMNS, "
            + " NON EMPTY {[Store].[Store State].Members} ON ROWS "
            + " from [virtual] ",
            "Axis #0:\n"
View Full Code Here

                + "group by `product_class`.`product_family` "
                + "order by ISNULL(`product_class`.`product_family`) ASC,"
                + " `product_class`.`product_family` ASC",
                null)
        };
        final TestContext context = getTestContext().withFreshConnection();
        try {
            assertQuerySql(
                context,
                "select [Product].[Product Family].Members on 0\n"
                + "from [Sales]",
                patterns);

            // note that returns an extra member,
            // [Product].[Drink].[Baking Goods]
            context.assertQueryReturns(
                "select [Product].[Drink].Children on 0\n"
                + "from [Sales]",
                "Axis #0:\n"
                + "{}\n"
                + "Axis #1:\n"
                + "{[Product].[Drink].[Alcoholic Beverages]}\n"
                + "{[Product].[Drink].[Baking Goods]}\n"
                + "{[Product].[Drink].[Beverages]}\n"
                + "{[Product].[Drink].[Dairy]}\n"
                + "Row #0: 6,838\n"
                + "Row #0: \n"
                + "Row #0: 13,573\n"
                + "Row #0: 4,186\n");

            // [Product].[Drink].[Baking Goods] has one child, but no fact data
            context.assertQueryReturns(
                "select [Product].[Drink].[Baking Goods].Children on 0\n"
                + "from [Sales]",
                "Axis #0:\n"
                + "{}\n"
                + "Axis #1:\n"
                + "{[Product].[Drink].[Baking Goods].[Dry Goods]}\n"
                + "Row #0: \n");

            // NON EMPTY filters out that child
            context.assertQueryReturns(
                "select non empty [Product].[Drink].[Baking Goods].Children on 0\n"
                + "from [Sales]",
                "Axis #0:\n"
                + "{}\n"
                + "Axis #1:\n");

            // [Product].[Drink].[Baking Goods].[Dry Goods] has one child, but
            // no fact data
            context.assertQueryReturns(
                "select [Product].[Drink].[Baking Goods].[Dry Goods].Children on 0\n"
                + "from [Sales]",
                "Axis #0:\n"
                + "{}\n"
                + "Axis #1:\n"
                + "{[Product].[Drink].[Baking Goods].[Dry Goods].[Coffee]}\n"
                + "Row #0: \n");

            // NON EMPTY filters out that child
            context.assertQueryReturns(
                "select non empty [Product].[Drink].[Baking Goods].[Dry Goods].Children on 0\n"
                + "from [Sales]",
                "Axis #0:\n"
                + "{}\n"
                + "Axis #1:\n");

            // [Coffee] has no children
            context.assertQueryReturns(
                "select [Product].[Drink].[Baking Goods].[Dry Goods].[Coffee].Children on 0\n"
                + "from [Sales]",
                "Axis #0:\n"
                + "{}\n"
                + "Axis #1:\n");

            context.assertQueryReturns(
                "select [Measures].[Unit Sales] on 0,\n"
                + " [Product].[Product Family].Members on 1\n"
                + "from [Sales]",
                "Axis #0:\n"
                + "{}\n"
                + "Axis #1:\n"
                + "{[Measures].[Unit Sales]}\n"
                + "Axis #2:\n"
                + "{[Product].[Drink]}\n"
                + "{[Product].[Food]}\n"
                + "{[Product].[Non-Consumable]}\n"
                + "Row #0: 24,597\n"
                + "Row #1: 191,940\n"
                + "Row #2: 50,236\n");
        } finally {
            context.close();
        }
    }
View Full Code Here

         */
        propSaver.set(
            MondrianProperties.instance().ExpandNonNative,
            false);

        TestContext testContext =
            TestContext.instance().create(
                null,
                cubeDef,
                null,
                null,
                null,
                null);

        testContext.assertQueryReturns(query, result);
    }
View Full Code Here

                Dialect.DatabaseProduct.DERBY, necjSqlDerby, necjSqlDerby),
            new SqlPattern(
                Dialect.DatabaseProduct.MYSQL, necjSqlMySql, necjSqlMySql)
        };

        TestContext testContext =
            TestContext.instance().create(
                dimension,
                cube,
                null,
                null,
View Full Code Here

                Dialect.DatabaseProduct.DERBY, necjSqlDerby, necjSqlDerby),
            new SqlPattern(
                Dialect.DatabaseProduct.MYSQL, necjSqlMySql, necjSqlMySql)
        };

        TestContext testContext =
            TestContext.instance().create(
                dimension,
                cube,
                null,
                null,
View Full Code Here

        propSaver.set(MondrianProperties.instance().EnableNativeFilter, true);
        propSaver.set(MondrianProperties.instance().ExpandNonNative, false);

        // Get a fresh connection; Otherwise the mondrian property setting
        // is not refreshed for this parameter.
        final TestContext context = getTestContext().withFreshConnection();
        try {
            context.assertQueryReturns(
                "select Filter([Store].[Store Name].members, "
                + "              Not ([Measures].[Store Sqft] - [Measures].[Grocery Sqft] < 10000)) on rows, "
                + "{[Measures].[Store Sqft], [Measures].[Grocery Sqft]} on columns "
                + "from [Store]", "Axis #0:\n"
                + "{}\n"
                + "Axis #1:\n"
                + "{[Measures].[Store Sqft]}\n"
                + "{[Measures].[Grocery Sqft]}\n"
                + "Axis #2:\n"
                + "{[Store].[Mexico].[DF].[Mexico City].[Store 9]}\n"
                + "{[Store].[Mexico].[Yucatan].[Merida].[Store 8]}\n"
                + "{[Store].[USA].[WA].[Bremerton].[Store 3]}\n"
                + "{[Store].[USA].[WA].[Tacoma].[Store 17]}\n"
                + "Row #0: 36,509\n"
                + "Row #0: 22,450\n"
                + "Row #1: 30,797\n"
                + "Row #1: 20,141\n"
                + "Row #2: 39,696\n"
                + "Row #2: 24,390\n"
                + "Row #3: 33,858\n"
                + "Row #3: 22,123\n");
        } finally {
            context.close();
        }
    }
View Full Code Here

            new SqlPattern(
                Dialect.DatabaseProduct.MYSQL,
                goodMysqlSQL,
                null)
        };
        final TestContext testContext =
            TestContext.instance().createSubstitutingCube(
                "Store",
                "<Dimension name='Store Type'>\n"
                + "    <Hierarchy name='Store Types Hierarchy' allMemberName='All Store Types Member Name' hasAll='true'>\n"
                + "      <Level name='Store Type' column='store_type' uniqueMembers='true'/>\n"
                + "    </Hierarchy>\n"
                + "  </Dimension>\n"
                + "  <Dimension name='Store'>\n"
                + "    <Hierarchy hasAll='true' primaryKey='store_id'>\n"
                + "      <Table name='store'/>\n"
                + "      <Level name='Store Country' column='store_country' uniqueMembers='true'/>\n"
                + "      <Level name='Store State' column='store_state' uniqueMembers='true'/>\n"
                + "      <Level name='Store City' column='store_city' uniqueMembers='false'/>\n"
                + "      <Level name='Store Name' column='store_id' type='Numeric' nameColumn='store_name' uniqueMembers='false'/>\n"
                + "    </Hierarchy>\n"
                + "  </Dimension>\n");
        assertQuerySqlOrNot(testContext, mdx, badPatterns, true, true, true);
        assertQuerySqlOrNot(testContext, mdx, goodPatterns, false, true, true);
        testContext.assertQueryReturns(
            mdx,
            "Axis #0:\n"
            + "{}\n"
            + "Axis #1:\n"
            + "{[Measures].[*FORMATTED_MEASURE_0]}\n"
 
View Full Code Here

     * field was referenced as the column expression, causing sql errors.
     */
    public void testMultiValueInWithNullVals() {
        // MONDRIAN-1458 - Native exclusion predicate doesn't use agg table
        // when checking for nulls
        TestContext context = getTestContext();
        if (!propSaver.properties.EnableNativeCrossJoin.get()
            || !propSaver.properties.ReadAggregates.get()
            || !propSaver.properties.UseAggregates.get())
        {
            return;
        }

        String sql;
        if (!context.getDialect().supportsMultiValueInExpr()) {
            sql = "select `agg_g_ms_pcat_sales_fact_1997`.`product_family` "
                + "as `c0`,"
                + " `agg_g_ms_pcat_sales_fact_1997`.`product_department` as "
                + "`c1`,"
                + " `agg_g_ms_pcat_sales_fact_1997`.`gender` as `c2` "
View Full Code Here

                Dialect.DatabaseProduct.LUCIDDB,
                loadSqlLucidDB,
                loadSqlLucidDB)
        };

        TestContext testContext =
            TestContext.instance().create(
                null,
                cube,
                null,
                null,
View Full Code Here

TOP

Related Classes of mondrian.test.TestContext$HighCardDynamicSchemaProcessor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.