Search in sources :

Example 56 with TestContext

use of mondrian.test.TestContext in project mondrian by pentaho.

the class RolapNativeTopCountTest method testRoleRestrictionWorks_ForRowWithData.

public void testRoleRestrictionWorks_ForRowWithData() throws Exception {
    TestContext ctx = TestContext.instance().create(null, null, null, null, null, ROLE_RESTRICTION_WORKS_WA_ROLE_DEF).withRole(ROLE_RESTRICTION_WORKS_WA_ROLE_NAME);
    ctx.assertQueryReturns(ROLE_RESTRICTION_WORKS_WA_QUERY, ROLE_RESTRICTION_WORKS_WA_RESULT);
}
Also used : TestContext(mondrian.test.TestContext)

Example 57 with TestContext

use of mondrian.test.TestContext in project mondrian by pentaho.

the class RolapNativeTopCountVersusNonNativeTest method testRoleRestrictionWorks_ForRowWithOutData.

public void testRoleRestrictionWorks_ForRowWithOutData() {
    TestContext ctx = TestContext.instance().create(null, null, null, null, null, ROLE_RESTRICTION_WORKS_DF_ROLE_DEF).withRole(ROLE_RESTRICTION_WORKS_DF_ROLE_NAME);
    assertResultsAreEqual("Role restriction works - For DF state", ROLE_RESTRICTION_WORKS_DF_QUERY, ctx);
}
Also used : TestContext(mondrian.test.TestContext)

Example 58 with TestContext

use of mondrian.test.TestContext in project mondrian by pentaho.

the class RolapResultTest method testNonAllPromotionMembers.

public void testNonAllPromotionMembers() {
    TestContext testContext = TestContext.instance().createSubstitutingCube("Sales", "<Dimension name=\"Promotions2\" foreignKey=\"promotion_id\">\n" + "  <Hierarchy hasAll=\"false\" primaryKey=\"promotion_id\">\n" + "    <Table name=\"promotion\"/>\n" + "    <Level name=\"Promotion2 Name\" column=\"promotion_name\" uniqueMembers=\"true\"/>\n" + "  </Hierarchy>\n" + "</Dimension>");
    testContext.assertQueryReturns("select {[Promotion2 Name].[Price Winners], [Promotion2 Name].[Sale Winners]} * {Tail([Time].[Year].Members,3)} ON COLUMNS, " + "NON EMPTY Crossjoin({[Store].CurrentMember.Children},  {[Store Type].[All Store Types].Children}) ON ROWS " + "from [Sales]", "Axis #0:\n" + "{}\n" + "Axis #1:\n" + "{[Promotions2].[Price Winners], [Time].[1997]}\n" + "{[Promotions2].[Price Winners], [Time].[1998]}\n" + "{[Promotions2].[Sale Winners], [Time].[1997]}\n" + "{[Promotions2].[Sale Winners], [Time].[1998]}\n" + "Axis #2:\n" + "{[Store].[USA], [Store Type].[Mid-Size Grocery]}\n" + "{[Store].[USA], [Store Type].[Small Grocery]}\n" + "{[Store].[USA], [Store Type].[Supermarket]}\n" + "Row #0: \n" + "Row #0: \n" + "Row #0: 444\n" + "Row #0: \n" + "Row #1: 23\n" + "Row #1: \n" + "Row #1: \n" + "Row #1: \n" + "Row #2: 1,271\n" + "Row #2: \n" + "Row #2: \n" + "Row #2: \n");
}
Also used : TestContext(mondrian.test.TestContext)

Example 59 with TestContext

use of mondrian.test.TestContext in project mondrian by pentaho.

the class FunctionTest method testDescendantsParentChildLeaves.

public void testDescendantsParentChildLeaves() {
    final TestContext testContext = getTestContext().withCube("HR");
    if (Bug.avoidSlowTestOnLucidDB(testContext.getDialect())) {
        return;
    }
    // leaves, restricted by level
    testContext.assertAxisReturns("Descendants([Employees].[All Employees].[Sheri Nowmer].[Michael Spence], [Employees].[Employee Id], LEAVES)", "[Employees].[Sheri Nowmer].[Michael Spence].[Daniel Wolter].[Michael John Troyer].[Mary Sandidge].[John Brooks]\n" + "[Employees].[Sheri Nowmer].[Michael Spence].[Daniel Wolter].[Michael John Troyer].[Mary Sandidge].[Todd Logan]\n" + "[Employees].[Sheri Nowmer].[Michael Spence].[Daniel Wolter].[Michael John Troyer].[Mary Sandidge].[Joshua Several]\n" + "[Employees].[Sheri Nowmer].[Michael Spence].[Daniel Wolter].[Michael John Troyer].[Mary Sandidge].[James Thomas]\n" + "[Employees].[Sheri Nowmer].[Michael Spence].[Daniel Wolter].[Michael John Troyer].[Mary Sandidge].[Robert Vessa]\n" + "[Employees].[Sheri Nowmer].[Michael Spence].[Daniel Wolter].[Michael John Troyer].[Mary Sandidge].[Bronson Jacobs]\n" + "[Employees].[Sheri Nowmer].[Michael Spence].[Daniel Wolter].[Michael John Troyer].[Mary Sandidge].[Rebecca Barley]\n" + "[Employees].[Sheri Nowmer].[Michael Spence].[Daniel Wolter].[Michael John Troyer].[Mary Sandidge].[Emilio Alvaro]\n" + "[Employees].[Sheri Nowmer].[Michael Spence].[Daniel Wolter].[Michael John Troyer].[Mary Sandidge].[Becky Waters]\n" + "[Employees].[Sheri Nowmer].[Michael Spence].[Daniel Wolter].[Michael John Troyer].[Mary Sandidge].[A. Joyce Jarvis]\n" + "[Employees].[Sheri Nowmer].[Michael Spence].[Daniel Wolter].[Michael John Troyer].[Mary Sandidge].[Ruby Sue Styles]\n" + "[Employees].[Sheri Nowmer].[Michael Spence].[Daniel Wolter].[Michael John Troyer].[Mary Sandidge].[Lisa Roy]\n" + "[Employees].[Sheri Nowmer].[Michael Spence].[Daniel Wolter].[Michael John Troyer].[Mary Sandidge].[Ingrid Burkhardt]\n" + "[Employees].[Sheri Nowmer].[Michael Spence].[Daniel Wolter].[Michael John Troyer].[Mary Sandidge].[Todd Whitney]\n" + "[Employees].[Sheri Nowmer].[Michael Spence].[Daniel Wolter].[Michael John Troyer].[Mary Sandidge].[Barbara Wisnewski]\n" + "[Employees].[Sheri Nowmer].[Michael Spence].[Daniel Wolter].[Michael John Troyer].[Mary Sandidge].[Karren Burkhardt]\n" + "[Employees].[Sheri Nowmer].[Michael Spence].[Daniel Wolter].[Michael John Troyer].[Mary Sandidge].[John Long]\n" + "[Employees].[Sheri Nowmer].[Michael Spence].[Daniel Wolter].[Michael John Troyer].[Mary Sandidge].[Edwin Olenzek]\n" + "[Employees].[Sheri Nowmer].[Michael Spence].[Daniel Wolter].[Michael John Troyer].[Mary Sandidge].[Jessie Valerio]\n" + "[Employees].[Sheri Nowmer].[Michael Spence].[Daniel Wolter].[Michael John Troyer].[Mary Sandidge].[Robert Ahlering]\n" + "[Employees].[Sheri Nowmer].[Michael Spence].[Daniel Wolter].[Michael John Troyer].[Mary Sandidge].[Megan Burke]\n" + "[Employees].[Sheri Nowmer].[Michael Spence].[Daniel Wolter].[Michael John Troyer].[Mary Sandidge].[Karel Bates]\n" + "[Employees].[Sheri Nowmer].[Michael Spence].[Daniel Wolter].[Michael John Troyer].[Monk Skonnard].[James Tran]\n" + "[Employees].[Sheri Nowmer].[Michael Spence].[Daniel Wolter].[Michael John Troyer].[Monk Skonnard].[Shelley Crow]\n" + "[Employees].[Sheri Nowmer].[Michael Spence].[Daniel Wolter].[Michael John Troyer].[Monk Skonnard].[Anne Sims]\n" + "[Employees].[Sheri Nowmer].[Michael Spence].[Daniel Wolter].[Michael John Troyer].[Monk Skonnard].[Clarence Tatman]\n" + "[Employees].[Sheri Nowmer].[Michael Spence].[Daniel Wolter].[Michael John Troyer].[Monk Skonnard].[Jan Nelsen]\n" + "[Employees].[Sheri Nowmer].[Michael Spence].[Daniel Wolter].[Michael John Troyer].[Monk Skonnard].[Jeanie Glenn]\n" + "[Employees].[Sheri Nowmer].[Michael Spence].[Daniel Wolter].[Michael John Troyer].[Monk Skonnard].[Peggy Smith]\n" + "[Employees].[Sheri Nowmer].[Michael Spence].[Daniel Wolter].[Michael John Troyer].[Monk Skonnard].[Tish Duff]\n" + "[Employees].[Sheri Nowmer].[Michael Spence].[Daniel Wolter].[Michael John Troyer].[Monk Skonnard].[Anita Lucero]\n" + "[Employees].[Sheri Nowmer].[Michael Spence].[Daniel Wolter].[Michael John Troyer].[Monk Skonnard].[Stephen Burton]\n" + "[Employees].[Sheri Nowmer].[Michael Spence].[Daniel Wolter].[Michael John Troyer].[Monk Skonnard].[Amy Consentino]\n" + "[Employees].[Sheri Nowmer].[Michael Spence].[Daniel Wolter].[Michael John Troyer].[Monk Skonnard].[Stacie Mcanich]\n" + "[Employees].[Sheri Nowmer].[Michael Spence].[Daniel Wolter].[Michael John Troyer].[Monk Skonnard].[Mary Browning]\n" + "[Employees].[Sheri Nowmer].[Michael Spence].[Daniel Wolter].[Michael John Troyer].[Monk Skonnard].[Alexandra Wellington]\n" + "[Employees].[Sheri Nowmer].[Michael Spence].[Daniel Wolter].[Michael John Troyer].[Monk Skonnard].[Cory Bacugalupi]\n" + "[Employees].[Sheri Nowmer].[Michael Spence].[Daniel Wolter].[Michael John Troyer].[Monk Skonnard].[Stacy Rizzi]\n" + "[Employees].[Sheri Nowmer].[Michael Spence].[Daniel Wolter].[Michael John Troyer].[Monk Skonnard].[Mike White]\n" + "[Employees].[Sheri Nowmer].[Michael Spence].[Daniel Wolter].[Michael John Troyer].[Monk Skonnard].[Marty Simpson]\n" + "[Employees].[Sheri Nowmer].[Michael Spence].[Daniel Wolter].[Michael John Troyer].[Monk Skonnard].[Robert Jones]\n" + "[Employees].[Sheri Nowmer].[Michael Spence].[Daniel Wolter].[Michael John Troyer].[Monk Skonnard].[Raul Casts]\n" + "[Employees].[Sheri Nowmer].[Michael Spence].[Daniel Wolter].[Michael John Troyer].[Monk Skonnard].[Bridget Browqett]\n" + "[Employees].[Sheri Nowmer].[Michael Spence].[Daniel Wolter].[Michael John Troyer].[Monk Skonnard].[Kay Kartz]\n" + "[Employees].[Sheri Nowmer].[Michael Spence].[Daniel Wolter].[Michael John Troyer].[Christopher Beck].[Jeanette Cole]\n" + "[Employees].[Sheri Nowmer].[Michael Spence].[Daniel Wolter].[Michael John Troyer].[Christopher Beck].[Phyllis Huntsman]\n" + "[Employees].[Sheri Nowmer].[Michael Spence].[Daniel Wolter].[Michael John Troyer].[Christopher Beck].[Hannah Arakawa]\n" + "[Employees].[Sheri Nowmer].[Michael Spence].[Daniel Wolter].[Michael John Troyer].[Christopher Beck].[Wathalee Steuber]\n" + "[Employees].[Sheri Nowmer].[Michael Spence].[Daniel Wolter].[Michael John Troyer].[Christopher Beck].[Pamela Cox]\n" + "[Employees].[Sheri Nowmer].[Michael Spence].[Daniel Wolter].[Michael John Troyer].[Christopher Beck].[Helen Lutes]\n" + "[Employees].[Sheri Nowmer].[Michael Spence].[Daniel Wolter].[Michael John Troyer].[Christopher Beck].[Linda Ecoffey]\n" + "[Employees].[Sheri Nowmer].[Michael Spence].[Daniel Wolter].[Michael John Troyer].[Christopher Beck].[Katherine Swint]\n" + "[Employees].[Sheri Nowmer].[Michael Spence].[Daniel Wolter].[Michael John Troyer].[Christopher Beck].[Dianne Slattengren]\n" + "[Employees].[Sheri Nowmer].[Michael Spence].[Daniel Wolter].[Michael John Troyer].[Christopher Beck].[Ronald Heymsfield]\n" + "[Employees].[Sheri Nowmer].[Michael Spence].[Daniel Wolter].[Michael John Troyer].[Christopher Beck].[Steven Whitehead]\n" + "[Employees].[Sheri Nowmer].[Michael Spence].[Daniel Wolter].[Michael John Troyer].[Christopher Beck].[William Sotelo]\n" + "[Employees].[Sheri Nowmer].[Michael Spence].[Daniel Wolter].[Michael John Troyer].[Christopher Beck].[Beth Stanley]\n" + "[Employees].[Sheri Nowmer].[Michael Spence].[Daniel Wolter].[Michael John Troyer].[Christopher Beck].[Jill Markwood]\n" + "[Employees].[Sheri Nowmer].[Michael Spence].[Daniel Wolter].[Michael John Troyer].[Christopher Beck].[Mildred Valentine]\n" + "[Employees].[Sheri Nowmer].[Michael Spence].[Daniel Wolter].[Michael John Troyer].[Christopher Beck].[Suzann Reams]\n" + "[Employees].[Sheri Nowmer].[Michael Spence].[Daniel Wolter].[Michael John Troyer].[Christopher Beck].[Audrey Wold]\n" + "[Employees].[Sheri Nowmer].[Michael Spence].[Daniel Wolter].[Michael John Troyer].[Christopher Beck].[Susan French]\n" + "[Employees].[Sheri Nowmer].[Michael Spence].[Daniel Wolter].[Michael John Troyer].[Christopher Beck].[Trish Pederson]\n" + "[Employees].[Sheri Nowmer].[Michael Spence].[Daniel Wolter].[Michael John Troyer].[Christopher Beck].[Eric Renn]\n" + "[Employees].[Sheri Nowmer].[Michael Spence].[Daniel Wolter].[Michael John Troyer].[Christopher Beck].[Elizabeth Catalano]\n" + "[Employees].[Sheri Nowmer].[Michael Spence].[Daniel Wolter].[Michael John Troyer].[Christopher Beck].[Eric Coleman]\n" + "[Employees].[Sheri Nowmer].[Michael Spence].[Daniel Wolter].[Michael John Troyer].[Catherine Abel]\n" + "[Employees].[Sheri Nowmer].[Michael Spence].[Daniel Wolter].[Michael John Troyer].[Emilo Miller]\n" + "[Employees].[Sheri Nowmer].[Michael Spence].[Daniel Wolter].[Michael John Troyer].[Hazel Walker]\n" + "[Employees].[Sheri Nowmer].[Michael Spence].[Dianne Collins].[Lawrence Hurkett].[Sara Pettengill].[Linda Blasingame]\n" + "[Employees].[Sheri Nowmer].[Michael Spence].[Dianne Collins].[Lawrence Hurkett].[Sara Pettengill].[Jackie Blackwell]\n" + "[Employees].[Sheri Nowmer].[Michael Spence].[Dianne Collins].[Lawrence Hurkett].[Sara Pettengill].[John Ortiz]\n" + "[Employees].[Sheri Nowmer].[Michael Spence].[Dianne Collins].[Lawrence Hurkett].[Sara Pettengill].[Stacey Tearpak]\n" + "[Employees].[Sheri Nowmer].[Michael Spence].[Dianne Collins].[Lawrence Hurkett].[Sara Pettengill].[Fannye Weber]\n" + "[Employees].[Sheri Nowmer].[Michael Spence].[Dianne Collins].[Lawrence Hurkett].[Sara Pettengill].[Diane Kabbes]\n" + "[Employees].[Sheri Nowmer].[Michael Spence].[Dianne Collins].[Lawrence Hurkett].[Sara Pettengill].[Brenda Heaney]\n" + "[Employees].[Sheri Nowmer].[Michael Spence].[Dianne Collins].[Lawrence Hurkett].[Sara Pettengill].[Judith Karavites]\n" + "[Employees].[Sheri Nowmer].[Michael Spence].[Dianne Collins].[Lawrence Hurkett].[Jauna Elson]\n" + "[Employees].[Sheri Nowmer].[Michael Spence].[Dianne Collins].[Lawrence Hurkett].[Nancy Hirota]\n" + "[Employees].[Sheri Nowmer].[Michael Spence].[Dianne Collins].[Lawrence Hurkett].[Marie Moya]\n" + "[Employees].[Sheri Nowmer].[Michael Spence].[Dianne Collins].[Lawrence Hurkett].[Nicky Chesnut]\n" + "[Employees].[Sheri Nowmer].[Michael Spence].[Dianne Collins].[Lawrence Hurkett].[Karen Hall]\n" + "[Employees].[Sheri Nowmer].[Michael Spence].[Dianne Collins].[Lawrence Hurkett].[Greg Narberes]\n" + "[Employees].[Sheri Nowmer].[Michael Spence].[Dianne Collins].[Lawrence Hurkett].[Anna Townsend]\n" + "[Employees].[Sheri Nowmer].[Michael Spence].[Dianne Collins].[Lawrence Hurkett].[Carol Ann Rockne]");
    // leaves, restricted by depth
    testContext.assertAxisReturns("Descendants([Employees], 1, LEAVES)", "");
    testContext.assertAxisReturns("Descendants([Employees], 2, LEAVES)", "[Employees].[Sheri Nowmer].[Roberta Damstra].[Jennifer Cooper]\n" + "[Employees].[Sheri Nowmer].[Roberta Damstra].[Peggy Petty]\n" + "[Employees].[Sheri Nowmer].[Roberta Damstra].[Jessica Olguin]\n" + "[Employees].[Sheri Nowmer].[Roberta Damstra].[Phyllis Burchett]\n" + "[Employees].[Sheri Nowmer].[Rebecca Kanagaki].[Juanita Sharp]\n" + "[Employees].[Sheri Nowmer].[Rebecca Kanagaki].[Sandra Brunner]\n" + "[Employees].[Sheri Nowmer].[Darren Stanz].[Ernest Staton]\n" + "[Employees].[Sheri Nowmer].[Darren Stanz].[Rose Sims]\n" + "[Employees].[Sheri Nowmer].[Darren Stanz].[Lauretta De Carlo]\n" + "[Employees].[Sheri Nowmer].[Darren Stanz].[Mary Williams]\n" + "[Employees].[Sheri Nowmer].[Darren Stanz].[Terri Burke]\n" + "[Employees].[Sheri Nowmer].[Darren Stanz].[Audrey Osborn]\n" + "[Employees].[Sheri Nowmer].[Darren Stanz].[Brian Binai]\n" + "[Employees].[Sheri Nowmer].[Darren Stanz].[Concepcion Lozada]\n" + "[Employees].[Sheri Nowmer].[Donna Arnold].[Howard Bechard]\n" + "[Employees].[Sheri Nowmer].[Donna Arnold].[Doris Carter]");
    testContext.assertAxisReturns("Descendants([Employees], 3, LEAVES)", "[Employees].[Sheri Nowmer].[Roberta Damstra].[Jennifer Cooper]\n" + "[Employees].[Sheri Nowmer].[Roberta Damstra].[Peggy Petty]\n" + "[Employees].[Sheri Nowmer].[Roberta Damstra].[Jessica Olguin]\n" + "[Employees].[Sheri Nowmer].[Roberta Damstra].[Phyllis Burchett]\n" + "[Employees].[Sheri Nowmer].[Rebecca Kanagaki].[Juanita Sharp]\n" + "[Employees].[Sheri Nowmer].[Rebecca Kanagaki].[Sandra Brunner]\n" + "[Employees].[Sheri Nowmer].[Darren Stanz].[Ernest Staton]\n" + "[Employees].[Sheri Nowmer].[Darren Stanz].[Rose Sims]\n" + "[Employees].[Sheri Nowmer].[Darren Stanz].[Lauretta De Carlo]\n" + "[Employees].[Sheri Nowmer].[Darren Stanz].[Mary Williams]\n" + "[Employees].[Sheri Nowmer].[Darren Stanz].[Terri Burke]\n" + "[Employees].[Sheri Nowmer].[Darren Stanz].[Audrey Osborn]\n" + "[Employees].[Sheri Nowmer].[Darren Stanz].[Brian Binai]\n" + "[Employees].[Sheri Nowmer].[Darren Stanz].[Concepcion Lozada]\n" + "[Employees].[Sheri Nowmer].[Donna Arnold].[Howard Bechard]\n" + "[Employees].[Sheri Nowmer].[Donna Arnold].[Doris Carter]");
    // note that depth is RELATIVE to the starting member
    testContext.assertAxisReturns("Descendants([Employees].[Sheri Nowmer].[Roberta Damstra], 1, LEAVES)", "[Employees].[Sheri Nowmer].[Roberta Damstra].[Jennifer Cooper]\n" + "[Employees].[Sheri Nowmer].[Roberta Damstra].[Peggy Petty]\n" + "[Employees].[Sheri Nowmer].[Roberta Damstra].[Jessica Olguin]\n" + "[Employees].[Sheri Nowmer].[Roberta Damstra].[Phyllis Burchett]");
    // Howard Bechard is a leaf member -- appears even at depth 0
    testContext.assertAxisReturns("Descendants([Employees].[All Employees].[Sheri Nowmer].[Donna Arnold].[Howard Bechard], 0, LEAVES)", "[Employees].[Sheri Nowmer].[Donna Arnold].[Howard Bechard]");
    testContext.assertAxisReturns("Descendants([Employees].[All Employees].[Sheri Nowmer].[Donna Arnold].[Howard Bechard], 1, LEAVES)", "[Employees].[Sheri Nowmer].[Donna Arnold].[Howard Bechard]");
    testContext.assertExprReturns("Count(Descendants([Employees], 2, LEAVES))", "16");
    testContext.assertExprReturns("Count(Descendants([Employees], 3, LEAVES))", "16");
    testContext.assertExprReturns("Count(Descendants([Employees], 4, LEAVES))", "63");
    testContext.assertExprReturns("Count(Descendants([Employees], 999, LEAVES))", "1,044");
    // times because we had a non-deterministic bug here.
    for (int i = 0; i < 100; ++i) {
        testContext.assertExprReturns("Count(Descendants([Employees], -1, LEAVES))", "1,044");
    }
}
Also used : TestContext(mondrian.test.TestContext)

Example 60 with TestContext

use of mondrian.test.TestContext in project mondrian by pentaho.

the class FunctionTest method testHierarchizeOrdinal.

/**
 * Tests that the Hierarchize function works correctly when applied to
 * a level whose ordering is determined by an 'ordinal' property.
 * TODO: fix this test (bug 1220787)
 *
 * WG: Note that this is disabled right now due to its impact on other
 * tests later on within the test suite, specifically XMLA tests that
 * return a list of cubes.  We could run this test after XMLA, or clear
 * out the cache to solve this.
 */
public void testHierarchizeOrdinal() {
    TestContext context = getTestContext().withCube("[Sales_Hierarchize]");
    final Connection connection = context.getConnection();
    connection.getSchema().createCube("<Cube name=\"Sales_Hierarchize\">\n" + "  <Table name=\"sales_fact_1997\"/>\n" + "  <Dimension name=\"Time_Alphabetical\" type=\"TimeDimension\" foreignKey=\"time_id\">\n" + "    <Hierarchy hasAll=\"false\" primaryKey=\"time_id\">\n" + "      <Table name=\"time_by_day\"/>\n" + "      <Level name=\"Year\" column=\"the_year\" type=\"Numeric\" uniqueMembers=\"true\"\n" + "          levelType=\"TimeYears\"/>\n" + "      <Level name=\"Quarter\" column=\"quarter\" uniqueMembers=\"false\"\n" + "          levelType=\"TimeQuarters\"/>\n" + "      <Level name=\"Month\" column=\"month_of_year\" uniqueMembers=\"false\" type=\"Numeric\"\n" + "          ordinalColumn=\"the_month\"\n" + "          levelType=\"TimeMonths\"/>\n" + "    </Hierarchy>\n" + "  </Dimension>\n" + "\n" + "  <Dimension name=\"Month_Alphabetical\" type=\"TimeDimension\" foreignKey=\"time_id\">\n" + "    <Hierarchy hasAll=\"false\" primaryKey=\"time_id\">\n" + "      <Table name=\"time_by_day\"/>\n" + "      <Level name=\"Month\" column=\"month_of_year\" uniqueMembers=\"false\" type=\"Numeric\"\n" + "          ordinalColumn=\"the_month\"\n" + "          levelType=\"TimeMonths\"/>\n" + "    </Hierarchy>\n" + "  </Dimension>\n" + "\n" + "  <Measure name=\"Unit Sales\" column=\"unit_sales\" aggregator=\"sum\"\n" + "      formatString=\"Standard\"/>\n" + "</Cube>");
    // The [Time_Alphabetical] is ordered alphabetically by month
    context.assertAxisReturns("Hierarchize([Time_Alphabetical].members)", "[Time_Alphabetical].[1997]\n" + "[Time_Alphabetical].[1997].[Q1]\n" + "[Time_Alphabetical].[1997].[Q1].[2]\n" + "[Time_Alphabetical].[1997].[Q1].[1]\n" + "[Time_Alphabetical].[1997].[Q1].[3]\n" + "[Time_Alphabetical].[1997].[Q2]\n" + "[Time_Alphabetical].[1997].[Q2].[4]\n" + "[Time_Alphabetical].[1997].[Q2].[6]\n" + "[Time_Alphabetical].[1997].[Q2].[5]\n" + "[Time_Alphabetical].[1997].[Q3]\n" + "[Time_Alphabetical].[1997].[Q3].[8]\n" + "[Time_Alphabetical].[1997].[Q3].[7]\n" + "[Time_Alphabetical].[1997].[Q3].[9]\n" + "[Time_Alphabetical].[1997].[Q4]\n" + "[Time_Alphabetical].[1997].[Q4].[12]\n" + "[Time_Alphabetical].[1997].[Q4].[11]\n" + "[Time_Alphabetical].[1997].[Q4].[10]\n" + "[Time_Alphabetical].[1998]\n" + "[Time_Alphabetical].[1998].[Q1]\n" + "[Time_Alphabetical].[1998].[Q1].[2]\n" + "[Time_Alphabetical].[1998].[Q1].[1]\n" + "[Time_Alphabetical].[1998].[Q1].[3]\n" + "[Time_Alphabetical].[1998].[Q2]\n" + "[Time_Alphabetical].[1998].[Q2].[4]\n" + "[Time_Alphabetical].[1998].[Q2].[6]\n" + "[Time_Alphabetical].[1998].[Q2].[5]\n" + "[Time_Alphabetical].[1998].[Q3]\n" + "[Time_Alphabetical].[1998].[Q3].[8]\n" + "[Time_Alphabetical].[1998].[Q3].[7]\n" + "[Time_Alphabetical].[1998].[Q3].[9]\n" + "[Time_Alphabetical].[1998].[Q4]\n" + "[Time_Alphabetical].[1998].[Q4].[12]\n" + "[Time_Alphabetical].[1998].[Q4].[11]\n" + "[Time_Alphabetical].[1998].[Q4].[10]");
    // The [Month_Alphabetical] is a single-level hierarchy ordered
    // alphabetically by month.
    context.assertAxisReturns("Hierarchize([Month_Alphabetical].members)", "[Month_Alphabetical].[4]\n" + "[Month_Alphabetical].[8]\n" + "[Month_Alphabetical].[12]\n" + "[Month_Alphabetical].[2]\n" + "[Month_Alphabetical].[1]\n" + "[Month_Alphabetical].[7]\n" + "[Month_Alphabetical].[6]\n" + "[Month_Alphabetical].[3]\n" + "[Month_Alphabetical].[5]\n" + "[Month_Alphabetical].[11]\n" + "[Month_Alphabetical].[10]\n" + "[Month_Alphabetical].[9]");
    // clear the cache so that future tests don't fail that expect a
    // specific set of cubes
    TestContext.instance().flushSchemaCache();
}
Also used : TestContext(mondrian.test.TestContext)

Aggregations

TestContext (mondrian.test.TestContext)167 SqlPattern (mondrian.test.SqlPattern)37 Result (mondrian.olap.Result)4 Member (mondrian.olap.Member)3 AggStar (mondrian.rolap.aggmatcher.AggStar)3 MemberExpr (mondrian.mdx.MemberExpr)2 Connection (mondrian.olap.Connection)2 Query (mondrian.olap.Query)2 QueryAxis (mondrian.olap.QueryAxis)2 TestMember (mondrian.olap.fun.TestMember)2 Execution (mondrian.server.Execution)2 Dialect (mondrian.spi.Dialect)2 SoftReference (java.lang.ref.SoftReference)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Properties (java.util.Properties)1 mondrian.olap (mondrian.olap)1 Axis (mondrian.olap.Axis)1 MondrianException (mondrian.olap.MondrianException)1 Position (mondrian.olap.Position)1