Search in sources :

Example 11 with Position

use of mondrian.olap.Position in project mondrian by pentaho.

the class BasicQueryTest method testAllLevelName.

public void testAllLevelName() {
    TestContext testContext = TestContext.instance().createSubstitutingCube("Sales", "<Dimension name=\"Gender4\" foreignKey=\"customer_id\">\n" + "  <Hierarchy hasAll=\"true\" allMemberName=\"All Gender\"\n" + " allLevelName=\"GenderLevel\" primaryKey=\"customer_id\">\n" + "  <Table name=\"customer\"/>\n" + "    <Level name=\"Gender\" column=\"gender\" uniqueMembers=\"true\"/>\n" + "  </Hierarchy>\n" + "</Dimension>");
    String mdx = "select {[Gender4].[All Gender]} on columns from Sales";
    Result result = testContext.executeQuery(mdx);
    Axis axis0 = result.getAxes()[0];
    Position pos0 = axis0.getPositions().get(0);
    Member allGender = pos0.get(0);
    String caption = allGender.getLevel().getName();
    Assert.assertEquals(caption, "GenderLevel");
}
Also used : Position(mondrian.olap.Position) Axis(mondrian.olap.Axis)

Aggregations

Position (mondrian.olap.Position)11 Axis (mondrian.olap.Axis)8 Member (mondrian.olap.Member)5 Cell (mondrian.olap.Cell)3 BigDecimal (java.math.BigDecimal)2 Date (java.util.Date)2 DBCacheEntry (org.pentaho.di.core.DBCacheEntry)2 KettleDatabaseException (org.pentaho.di.core.exception.KettleDatabaseException)2 RowMeta (org.pentaho.di.core.row.RowMeta)2 ValueMetaInterface (org.pentaho.di.core.row.ValueMetaInterface)2 ValueMetaBoolean (org.pentaho.di.core.row.value.ValueMetaBoolean)2 ValueMetaDate (org.pentaho.di.core.row.value.ValueMetaDate)2 ValueMetaInteger (org.pentaho.di.core.row.value.ValueMetaInteger)2 ValueMetaString (org.pentaho.di.core.row.value.ValueMetaString)2 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 TupleList (mondrian.calc.TupleList)1 Hierarchy (mondrian.olap.Hierarchy)1 Result (mondrian.olap.Result)1 TestMember (mondrian.olap.fun.TestMember)1