use of mondrian.olap.Result in project mondrian by pentaho.
the class FunctionTest method testBasic5.
public void testBasic5() {
Result result = executeQuery("select{ [Product].[All Products].[Drink].Parent} on columns " + "from Sales");
assertEquals("All Products", result.getAxes()[0].getPositions().get(0).get(0).getName());
}
use of mondrian.olap.Result in project mondrian by pentaho.
the class FunctionTest method testFirstInLevel2.
public void testFirstInLevel2() {
Result result = executeQuery("select {[Gender].[M].NextMember} ON COLUMNS from Sales");
assertEquals(0, result.getAxes()[0].getPositions().size());
}
use of mondrian.olap.Result in project mondrian by pentaho.
the class FunctionTest method testVisualTotalsAll.
/**
* Test case for bug
* <a href="http://jira.pentaho.com/browse/MONDRIAN-615">MONDRIAN-615</a>,
* "VisualTotals doesn't work for the all member".
*/
public void testVisualTotalsAll() {
final String query = "SELECT \n" + " {[Measures].[Unit Sales]} ON 0, \n" + " VisualTotals(\n" + " {[Customers].[All Customers],\n" + " [Customers].[USA],\n" + " [Customers].[USA].[CA],\n" + " [Customers].[USA].[OR]}) ON 1\n" + "FROM [Sales]";
assertQueryReturns(query, "Axis #0:\n" + "{}\n" + "Axis #1:\n" + "{[Measures].[Unit Sales]}\n" + "Axis #2:\n" + "{[Customers].[All Customers]}\n" + "{[Customers].[USA]}\n" + "{[Customers].[USA].[CA]}\n" + "{[Customers].[USA].[OR]}\n" + "Row #0: 142,407\n" + "Row #1: 142,407\n" + "Row #2: 74,748\n" + "Row #3: 67,659\n");
// Check captions
final Result result = getTestContext().executeQuery(query);
final List<Position> positionList = result.getAxes()[1].getPositions();
assertEquals("All Customers", positionList.get(0).get(0).getCaption());
assertEquals("USA", positionList.get(1).get(0).getCaption());
assertEquals("CA", positionList.get(2).get(0).getCaption());
}
use of mondrian.olap.Result in project mondrian by pentaho.
the class CrossJoinTest method testCrossJoinIterCalc_IterationCancellationOnForward.
// The test to verify that cancellation/timeout is checked
// in CrossJoinFunDef$CrossJoinIterCalc$1$1.forward()
public void testCrossJoinIterCalc_IterationCancellationOnForward() {
propSaver.set(propSaver.properties.CheckCancelOrTimeoutInterval, 1);
// Get product members as TupleList
RolapCube salesCube = (RolapCube) cubeByName(getTestContext().getConnection(), SALES_CUBE);
SchemaReader salesCubeSchemaReader = salesCube.getSchemaReader(getTestContext().getConnection().getRole()).withLocus();
TupleList productMembers = productMembersPotScrubbersPotsAndPans(salesCubeSchemaReader);
// Get genders members as TupleList
Result genders = executeQuery(SELECT_GENDER_MEMBERS);
TupleList genderMembers = getGenderMembers(genders);
// Test execution to track cancellation/timeout calls
Execution execution = spy(new Execution(genders.getQuery().getStatement(), 0));
// check no execution of checkCancelOrTimeout has been yet
verify(execution, times(0)).checkCancelOrTimeout();
Integer crossJoinIterCalc = crossJoinIterCalcIterate(productMembers, genderMembers, execution);
// checkCancelOrTimeout should be called once for the left tuple
// from CrossJoinIterCalc$1$1.forward() since phase
// interval is 1
verify(execution, times(productMembers.size())).checkCancelOrTimeout();
assertEquals(productMembers.size() * genderMembers.size(), crossJoinIterCalc.intValue());
}
use of mondrian.olap.Result in project mondrian by pentaho.
the class FunctionTest method testCurrentMemberFromSlicer.
public void testCurrentMemberFromSlicer() {
Result result = executeQuery("with member [Measures].[Foo] as '[Gender].CurrentMember.Name'\n" + "select {[Measures].[Foo]} on columns\n" + "from Sales where ([Gender].[F])");
Assert.assertEquals("F", result.getCell(new int[] { 0 }).getValue());
}
Aggregations