* Test case for bug <a href="http://jira.pentaho.com/browse/MONDRIAN-322">
* MONDRIAN-322, "cube.getStar() throws NullPointerException"</a>.
* Happens when you aggregate distinct-count measures in a virtual cube.
*/
public void testBugMondrian322() {
final TestContext testContext = TestContext.instance().create(
null,
null,
"<VirtualCube name=\"Warehouse and Sales2\" defaultMeasure=\"Store Sales\">\n"
+ " <VirtualCubeDimension cubeName=\"Sales\" name=\"Customers\"/>\n"
+ " <VirtualCubeDimension name=\"Time\"/>\n"
+ " <VirtualCubeDimension cubeName=\"Warehouse\" name=\"Warehouse\"/>\n"
+ " <VirtualCubeMeasure cubeName=\"Sales\" name=\"[Measures].[Customer Count]\"/>\n"
+ " <VirtualCubeMeasure cubeName=\"Sales\" name=\"[Measures].[Store Sales]\"/>\n"
+ "</VirtualCube>",
null,
null,
null);
/*
* This test case does not actually reject the dimension constraint from
* an unrelated base cube. The reason is that the constraint contains an
* AllLevel member. Even though semantically constraining Cells using an
* non-existent dimension perhaps does not make sense; however, in the
* case where the constraint contains AllLevel member, the constraint
* can be considered "always true".
*
* See the next test case for a constraint that does not contain
* AllLevel member and hence cannot be satisfied. The cell should be
* empty.
*/
testContext.assertQueryReturns(
"with member [Warehouse].[x] as 'Aggregate([Warehouse].members)'\n"
+ "member [Measures].[foo] AS '([Warehouse].[x],[Measures].[Customer Count])'\n"
+ "select {[Measures].[foo]} on 0 from [Warehouse And Sales2]",
"Axis #0:\n"
+ "{}\n"