<commit_before>/*
// This software is subject to the terms of the Eclipse Public License v1.0
// Agreement, available at the following URL:
// http://www.eclipse.org/legal/epl-v10.html.
// You must accept the terms of that agreement to use this software.
//
// Copyright (C) 2001-2005 <NAME>
// Copyright (C) 2005-2014 Pentaho and others
// All Rights Reserved.
*/
package mondrian.test;

import mondrian.olap.MondrianProperties;

/**
 * Test case to
 * push unrelatedDimensions to top level when ignoreUnrelatedDimensions property
 * is set to true on a base cube usage.
 *
 * @author ajoglekar
 * @since Dec 03, 2007
 */
public class IgnoreUnrelatedDimensionsTest extends FoodMartTestCase {

    private static final String cubeSales3 =
        "<Cube name=\"Sales 3\">\n"
        + "   <Table name=\"sales_fact_1997\"/>\n"
        + "   <DimensionUsage name=\"Time\" source=\"Time\" foreignKey=\"time_id\"/>\n"
        + "   <Dimension name=\"Education Level\" foreignKey=\"customer_id\">\n"
        + "    <Hierarchy hasAll=\"true\" primaryKey=\"customer_id\">\n"
        + "      <Table name=\"customer\"/>\n"
        + "      <Level name=\"Education Level\" column=\"education\" uniqueMembers=\"true\"/>\n"
        + "    </Hierarchy>\n"
        + "  </Dimension>\n"
        + "   <DimensionUsage name=\"Product\" source=\"Product\" foreignKey=\"product_id\"/>\n"
        + "   <Dimension name=\"Gender\" foreignKey=\"customer_id\">\n"
        + "     <Hierarchy hasAll=\"true\" defaultMember=\"[Gender].[F]\" "
        + "allMemberName=\"All Gender\" primaryKey=\"customer_id\">\n"
        + "       <Table name=\"customer\"/>\n"
        + "       <Level name=\"Gender\" column=\"gender\" uniqueMembers=\"true\"/>\n"
        + "     </Hierarchy>\n"
        + "   </Dimension>\n"
        + "   <Measure name=\"Unit Sales\" column=\"unit_sales\" aggregator=\"sum\"    formatString=\"Standard\">\n"
        + "     <CalculatedMemberProperty name=\"MEMBER_ORDINAL\" value=\"2\"/>\n"
        + "   </Measure>\n"
        + "</Cube>";

    private static final String cubeWarehouseAndSales3 =
        "<VirtualCube name=\"Warehouse and Sales 3\" defaultMeasure=\"Store Invoice\">\n"
        + "  <CubeUsages>\n"
        + "   <CubeUsage cubeName=\"Sales 3\" ignoreUnrelatedDimensions=\"false\"/>\n"
        + "   <CubeUsage cubeName=\"Warehouse\" ignoreUnrelatedDimensions=\"true\"/></CubeUsages>\n"
        + "  <VirtualCubeDimension cubeName=\"Sales 3\" name=\"Gender\"/>\n"
        + "  <VirtualCubeDimension cubeName=\"Sales 3\" name=\"Education Level\"/>\n"
        + "  <VirtualCubeDimension name=\"Product\"/>\n"
        + "  <VirtualCubeDimension name=\"Time\"/>\n"
        + "  <VirtualCubeDimension cubeName=\"Warehouse\" name=\"Warehouse\"/>\n"
        + "  <VirtualCubeMeasure cubeName=\"Sales 3\" name=\"[Measures].[Unit Sales]\"/>\n"
        + "  <VirtualCubeMeasure cubeName=\"Warehouse\" name=\"[Measures].[Store Invoice]\"/>\n"
        + "  <VirtualCubeMeasure cubeName=\"Warehouse\" name=\"[Measures].[Warehouse Sales]\"/>\n"
        + "</VirtualCube>";

    protected void setUp() throws Exception {
        super.setUp();
        propSaver.set(
            MondrianProperties.instance().EnableNonEmptyOnAllAxis, true);
    }

    protected void tearDown() throws Exception {
        propSaver.reset();
        super.tearDown();
    }

    public TestContext getTestContext() {
        return TestContext.instance().create(
            null,
            null,
            "<VirtualCube name=\"Warehouse and Sales2\" defaultMeasure=\"Store Sales\">\n"
            + "  <CubeUsages>"
            + "   <CubeUsage cubeName=\"Sales\" ignoreUnrelatedDimensions=\"true\"/>\n"
            + "   <CubeUsage cubeName=\"Warehouse\" ignoreUnrelatedDimensions=\"true\"/>\n"<commit_msg>[CLEANUP]  Removing a redundant tearDown() call in a test class.<commit_after>/*
// This software is subject to the terms of the Eclipse Public License v1.0
// Agreement, available at the following URL:
// http://www.eclipse.org/legal/epl-v10.html.
// You must accept the terms of that agreement to use this software.
//
// Copyright (C) 2001-2005 <NAME>
// Copyright (C) 2005-2014 Pentaho and others
// All Rights Reserved.
*/
package mondrian.test;

import mondrian.olap.MondrianProperties;

/**
 * Test case to
 * push unrelatedDimensions to top level when ignoreUnrelatedDimensions property
 * is set to true on a base cube usage.
 *
 * @author ajoglekar
 * @since Dec 03, 2007
 */
public class IgnoreUnrelatedDimensionsTest extends FoodMartTestCase {

    private static final String cubeSales3 =
        "<Cube name=\"Sales 3\">\n"
        + "   <Table name=\"sales_fact_1997\"/>\n"
        + "   <DimensionUsage name=\"Time\" source=\"Time\" foreignKey=\"time_id\"/>\n"
        + "   <Dimension name=\"Education Level\" foreignKey=\"customer_id\">\n"
        + "    <Hierarchy hasAll=\"true\" primaryKey=\"customer_id\">\n"
        + "      <Table name=\"customer\"/>\n"
        + "      <Level name=\"Education Level\" column=\"education\" uniqueMembers=\"true\"/>\n"
        + "    </Hierarchy>\n"
        + "  </Dimension>\n"
        + "   <DimensionUsage name=\"Product\" source=\"Product\" foreignKey=\"product_id\"/>\n"
        + "   <Dimension name=\"Gender\" foreignKey=\"customer_id\">\n"
        + "     <Hierarchy hasAll=\"true\" defaultMember=\"[Gender].[F]\" "
        + "allMemberName=\"All Gender\" primaryKey=\"customer_id\">\n"
        + "       <Table name=\"customer\"/>\n"
        + "       <Level name=\"Gender\" column=\"gender\" uniqueMembers=\"true\"/>\n"
        + "     </Hierarchy>\n"
        + "   </Dimension>\n"
        + "   <Measure name=\"Unit Sales\" column=\"unit_sales\" aggregator=\"sum\"    formatString=\"Standard\">\n"
        + "     <CalculatedMemberProperty name=\"MEMBER_ORDINAL\" value=\"2\"/>\n"
        + "   </Measure>\n"
        + "</Cube>";

    private static final String cubeWarehouseAndSales3 =
        "<VirtualCube name=\"Warehouse and Sales 3\" defaultMeasure=\"Store Invoice\">\n"
        + "  <CubeUsages>\n"
        + "   <CubeUsage cubeName=\"Sales 3\" ignoreUnrelatedDimensions=\"false\"/>\n"
        + "   <CubeUsage cubeName=\"Warehouse\" ignoreUnrelatedDimensions=\"true\"/></CubeUsages>\n"
        + "  <VirtualCubeDimension cubeName=\"Sales 3\" name=\"Gender\"/>\n"
        + "  <VirtualCubeDimension cubeName=\"Sales 3\" name=\"Education Level\"/>\n"
        + "  <VirtualCubeDimension name=\"Product\"/>\n"
        + "  <VirtualCubeDimension name=\"Time\"/>\n"
        + "  <VirtualCubeDimension cubeName=\"Warehouse\" name=\"Warehouse\"/>\n"
        + "  <VirtualCubeMeasure cubeName=\"Sales 3\" name=\"[Measures].[Unit Sales]\"/>\n"
        + "  <VirtualCubeMeasure cubeName=\"Warehouse\" name=\"[Measures].[Store Invoice]\"/>\n"
        + "  <VirtualCubeMeasure cubeName=\"Warehouse\" name=\"[Measures].[Warehouse Sales]\"/>\n"
        + "</VirtualCube>";

    protected void setUp() throws Exception {
        super.setUp();
        propSaver.set(
            MondrianProperties.instance().EnableNonEmptyOnAllAxis, true);
    }

    public TestContext getTestContext() {
        return TestContext.instance().create(
            null,
            null,
            "<VirtualCube name=\"Warehouse and Sales2\" defaultMeasure=\"Store Sales\">\n"
            + "  <CubeUsages>"
            + "   <CubeUsage cubeName=\"Sales\" ignoreUnrelatedDimensions=\"true\"/>\n"
            + "   <CubeUsage cubeName=\"Warehouse\" ignoreUnrelatedDimensions=\"true\"/>\n"
{'fraction_non_alphanumeric': 0.17685357427584375, 'fraction_numerical': 0.010629816635663035, 'mean_word_length': 2.574074074074074, 'pattern_counts': {'":': 0, '<': 81, '<?xml version=': 0, '>': 81, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5216020', 'n_tokens_mistral': 2384, 'n_tokens_neox': 2273, 'n_words': 459}