use of mondrian.test.TestContext in project mondrian by pentaho.
the class FunctionTest method testComplexSlicer_X_CalcBase_Base.
public void testComplexSlicer_X_CalcBase_Base() {
TestContext context = getTestContext().createSubstitutingCube("Sales", null, "<CalculatedMember " + "name='H1 1997' " + "formula='Aggregate([Time].[1997].[Q1]:[Time].[1997].[Q2])' " + "dimension='Time' />");
String query = "SELECT " + "{[Measures].[Customer Count]} ON 0 " + "FROM [Sales] " + "WHERE CROSSJOIN ({[Time].[H1 1997],[Time].[1998].[Q1]} , [Education Level].[Partial College])";
String expectedResult = "Axis #0:\n" + "{[Time].[H1 1997], [Education Level].[Partial College]}\n" + "{[Time].[1998].[Q1], [Education Level].[Partial College]}\n" + "Axis #1:\n" + "{[Measures].[Customer Count]}\n" + "Row #0: 394\n";
context.assertQueryReturns(query, expectedResult);
}
use of mondrian.test.TestContext in project mondrian by pentaho.
the class FunctionTest method testComplexSlicerWith_Calc_Calc.
public void testComplexSlicerWith_Calc_Calc() {
TestContext context = getTestContext();
String query = "with " + "member [Time].[H1 1997] as 'Aggregate([Time].[1997].[Q1] : [Time].[1997].[Q2])', $member_scope = \"CUBE\", MEMBER_ORDINAL = 6 " + "member [Education Level].[Partial] as 'Aggregate([Education Level].[Partial College]:[Education Level].[Partial High School])', $member_scope = \"CUBE\", MEMBER_ORDINAL = 7 " + "SELECT " + "{[Measures].[Customer Count]} ON 0 " + "FROM [Sales] " + "WHERE ([Time].[H1 1997],[Education Level].[Partial])";
String expectedResult = "Axis #0:\n" + "{[Time].[H1 1997], [Education Level].[Partial]}\n" + "Axis #1:\n" + "{[Measures].[Customer Count]}\n" + "Row #0: 1,671\n";
context.assertQueryReturns(query, expectedResult);
}
use of mondrian.test.TestContext in project mondrian by pentaho.
the class FunctionTest method testOrderMemberMultiKeysMemberValueExp2.
public void testOrderMemberMultiKeysMemberValueExp2() {
propSaver.set(MondrianProperties.instance().CompareSiblingsByOrderKey, true);
// Use a fresh connection to make sure bad member ordinals haven't
// been assigned by previous tests.
final TestContext context = getTestContext().withFreshConnection();
try {
context.assertQueryReturns("select \n" + " Order(" + " {[Customers].[USA].[WA].[Issaquah].[Abe Tramel]," + " [Customers].[All Customers].[USA].[CA].[Woodland Hills].[Abel Young]," + " [Customers].[All Customers].[USA].[CA].[Santa Monica].[Adeline Chun]}," + " [Customers].currentMember.Parent.Parent.OrderKey, BASC, [Customers].currentMember.OrderKey, BDESC) \n" + "on 0 from [Sales]", "Axis #0:\n" + "{}\n" + "Axis #1:\n" + "{[Customers].[USA].[CA].[Santa Monica].[Adeline Chun]}\n" + "{[Customers].[USA].[CA].[Woodland Hills].[Abel Young]}\n" + "{[Customers].[USA].[WA].[Issaquah].[Abe Tramel]}\n" + "Row #0: 33\n" + "Row #0: 75\n" + "Row #0: 33\n");
} finally {
context.close();
}
}
use of mondrian.test.TestContext in project mondrian by pentaho.
the class FunctionTest method testParentPC.
public void testParentPC() {
final TestContext testContext = getTestContext().withCube("HR");
testContext.assertAxisReturns("[Employees].Parent", "");
testContext.assertAxisReturns("[Employees].[Sheri Nowmer].Parent", "[Employees].[All Employees]");
testContext.assertAxisReturns("[Employees].[Sheri Nowmer].[Derrick Whelply].Parent", "[Employees].[Sheri Nowmer]");
testContext.assertAxisReturns("[Employees].Members.Item(3)", "[Employees].[Sheri Nowmer].[Derrick Whelply].[Beverly Baker]");
testContext.assertAxisReturns("[Employees].Members.Item(3).Parent", "[Employees].[Sheri Nowmer].[Derrick Whelply]");
testContext.assertAxisReturns("[Employees].AllMembers.Item(3).Parent", "[Employees].[Sheri Nowmer].[Derrick Whelply]");
// Ascendants(<Member>) applied to parent-child hierarchy accessed via
// <Level>.Members
testContext.assertAxisReturns("Ascendants([Employees].Members.Item(73))", "[Employees].[Sheri Nowmer].[Derrick Whelply].[Beverly Baker].[Jacqueline Wyllie].[Ralph Mccoy].[Bertha Jameson].[James Bailey]\n" + "[Employees].[Sheri Nowmer].[Derrick Whelply].[Beverly Baker].[Jacqueline Wyllie].[Ralph Mccoy].[Bertha Jameson]\n" + "[Employees].[Sheri Nowmer].[Derrick Whelply].[Beverly Baker].[Jacqueline Wyllie].[Ralph Mccoy]\n" + "[Employees].[Sheri Nowmer].[Derrick Whelply].[Beverly Baker].[Jacqueline Wyllie]\n" + "[Employees].[Sheri Nowmer].[Derrick Whelply].[Beverly Baker]\n" + "[Employees].[Sheri Nowmer].[Derrick Whelply]\n" + "[Employees].[Sheri Nowmer]\n" + "[Employees].[All Employees]");
}
use of mondrian.test.TestContext in project mondrian by pentaho.
the class FunctionTest method testOrderTupleSingleKeysNew1.
public void testOrderTupleSingleKeysNew1() {
propSaver.set(MondrianProperties.instance().CompareSiblingsByOrderKey, true);
// Use a fresh connection to make sure bad member ordinals haven't
// been assigned by previous tests.
final TestContext context = getTestContext().withFreshConnection();
try {
context.assertQueryReturns("with \n" + " set [NECJ] as \n" + " 'NonEmptyCrossJoin( \n" + " {[Customers].[USA].[WA].[Issaquah].[Abe Tramel]," + " [Customers].[All Customers].[USA].[CA].[Woodland Hills].[Abel Young]," + " [Customers].[All Customers].[USA].[CA].[Santa Monica].[Adeline Chun]}," + " {[Store].[USA].[WA].[Seattle],\n" + " [Store].[USA].[CA],\n" + " [Store].[USA].[OR]})'\n" + "select \n" + " Order([NECJ], [Store].currentMember.OrderKey, DESC) \n" + "on 0 from [Sales]", "Axis #0:\n" + "{}\n" + "Axis #1:\n" + "{[Customers].[USA].[WA].[Issaquah].[Abe Tramel], [Store].[USA].[WA].[Seattle]}\n" + "{[Customers].[USA].[CA].[Woodland Hills].[Abel Young], [Store].[USA].[CA]}\n" + "{[Customers].[USA].[CA].[Santa Monica].[Adeline Chun], [Store].[USA].[CA]}\n" + "Row #0: 33\n" + "Row #0: 75\n" + "Row #0: 33\n");
} finally {
context.close();
}
}
Aggregations