use of mondrian.olap.Axis in project pentaho-platform by pentaho.
the class MDXMetaDataTest method testMetadataForNullPositions.
@Test
public void testMetadataForNullPositions() {
Axis axColumn = mockAxis(null);
Axis axRow = mockAxis(null);
Axis[] axes = new Axis[] { axColumn, axRow };
Result nativeResultSet = mock(Result.class);
when(nativeResultSet.getAxes()).thenReturn(axes);
MDXMetaData metadata = new MDXMetaData(nativeResultSet);
checkEmptyResult(metadata);
}
use of mondrian.olap.Axis in project mondrian by pentaho.
the class ModulosTest method testTwo.
public void testTwo() {
Axis[] axes = new Axis[2];
TupleList positions = newPositionList(23);
axes[0] = new RolapAxis(positions);
positions = newPositionList(13);
axes[1] = new RolapAxis(positions);
Modulos modulosMany = Modulos.Generator.createMany(axes);
Modulos modulos = Modulos.Generator.create(axes);
int ordinal = 23;
int[] posMany = modulosMany.getCellPos(ordinal);
int[] pos = modulos.getCellPos(ordinal);
assertTrue("Pos are not equal", Arrays.equals(posMany, pos));
ordinal = 11;
posMany = modulosMany.getCellPos(ordinal);
pos = modulos.getCellPos(ordinal);
assertTrue("Pos are not equal", Arrays.equals(posMany, pos));
ordinal = 7;
posMany = modulosMany.getCellPos(ordinal);
pos = modulos.getCellPos(ordinal);
assertTrue("Pos are not equal", Arrays.equals(posMany, pos));
pos[0] = 3;
pos[1] = 2;
int oMany = modulosMany.getCellOrdinal(pos);
int o = modulos.getCellOrdinal(pos);
assertTrue("Ordinals are not equal", oMany == o);
pos[0] = 2;
oMany = modulosMany.getCellOrdinal(pos);
o = modulos.getCellOrdinal(pos);
assertTrue("Ordinals are not equal", oMany == o);
pos[0] = 1;
oMany = modulosMany.getCellOrdinal(pos);
o = modulos.getCellOrdinal(pos);
assertTrue("Ordinals are not equal", oMany == o);
}
use of mondrian.olap.Axis in project mondrian by pentaho.
the class ModulosTest method testMany.
public void testMany() {
Axis[] axes = new Axis[3];
TupleList positions = newPositionList(4);
axes[0] = new RolapAxis(positions);
positions = newPositionList(3);
axes[1] = new RolapAxis(positions);
positions = newPositionList(3);
axes[2] = new RolapAxis(positions);
Modulos modulos = Modulos.Generator.createMany(axes);
int ordinal = 23;
int[] pos = modulos.getCellPos(ordinal);
assertTrue("Pos length equals 3", pos.length == 3);
assertTrue("Pos[0] length equals 3", pos[0] == 3);
assertTrue("Pos[1] length equals 2", pos[1] == 2);
assertTrue("Pos[2] length equals 1", pos[2] == 1);
}
use of mondrian.olap.Axis in project mondrian by pentaho.
the class ModulosTest method testOne.
public void testOne() {
Axis[] axes = new Axis[1];
TupleList positions = newPositionList(53);
axes[0] = new RolapAxis(positions);
Modulos modulosMany = Modulos.Generator.createMany(axes);
Modulos modulos = Modulos.Generator.create(axes);
int ordinal = 43;
int[] posMany = modulosMany.getCellPos(ordinal);
int[] pos = modulos.getCellPos(ordinal);
assertTrue("Pos are not equal", Arrays.equals(posMany, pos));
ordinal = 23;
posMany = modulosMany.getCellPos(ordinal);
pos = modulos.getCellPos(ordinal);
assertTrue("Pos are not equal", Arrays.equals(posMany, pos));
ordinal = 7;
posMany = modulosMany.getCellPos(ordinal);
pos = modulos.getCellPos(ordinal);
assertTrue("Pos are not equal", Arrays.equals(posMany, pos));
pos[0] = 23;
int oMany = modulosMany.getCellOrdinal(pos);
int o = modulos.getCellOrdinal(pos);
assertTrue("Ordinals are not equal", oMany == o);
pos[0] = 11;
oMany = modulosMany.getCellOrdinal(pos);
o = modulos.getCellOrdinal(pos);
assertTrue("Ordinals are not equal", oMany == o);
pos[0] = 7;
oMany = modulosMany.getCellOrdinal(pos);
o = modulos.getCellOrdinal(pos);
assertTrue("Ordinals are not equal", oMany == o);
}
use of mondrian.olap.Axis in project mondrian by pentaho.
the class NonEmptyTest method testNonEmptyUnionQuery.
public void testNonEmptyUnionQuery() {
Result result = executeQuery("select {[Measures].[Unit Sales], [Measures].[Store Cost], [Measures].[Store Sales]} on columns,\n" + " NON EMPTY Hierarchize(\n" + " Union(\n" + " Crossjoin(\n" + " Crossjoin([Gender].[All Gender].children,\n" + " [Marital Status].[All Marital Status].children),\n" + " Crossjoin([Customers].[All Customers].children,\n" + " [Product].[All Products].children) ),\n" + " Crossjoin({([Gender].[All Gender].[M], [Marital Status].[All Marital Status].[M])},\n" + " Crossjoin(\n" + " [Customers].[All Customers].[USA].children,\n" + " [Product].[All Products].children) ) )) on rows\n" + "from Sales where ([Time].[1997])");
final Axis rowsAxis = result.getAxes()[1];
Assert.assertEquals(21, rowsAxis.getPositions().size());
}
Aggregations