Skip to content

Commit

Permalink
MONDRIAN: Test cases for:
Browse files Browse the repository at this point in the history
* Hierachize .Members function
* Include calculated members defined in a query for .AllMembers function
* AddCalculatedMembers(<Set>) function

Outstanding issue: Profit calculated member in schema switches between formatting with a $ sign and not, depending on recompilation

[git-p4: depot-paths = "//open/mondrian/": change = 4278]
  • Loading branch information
Sherman Wood committed Oct 27, 2005
1 parent 8f891aa commit a5c4acb
Show file tree
Hide file tree
Showing 10 changed files with 461 additions and 187 deletions.
340 changes: 304 additions & 36 deletions testsrc/main/mondrian/olap/fun/FunctionTest.java

Large diffs are not rendered by default.

32 changes: 16 additions & 16 deletions testsrc/main/mondrian/test/AccessControlTest.java
Expand Up @@ -142,34 +142,34 @@ public void testGrantHierarchy5() {
// yes: [San Francisco] -- explicitly allowed
// no: [San Diego]
"[Store].[All Stores].[Mexico]" + nl +
"[Store].[All Stores].[USA]" + nl +
"[Store].[All Stores].[Mexico].[DF]" + nl +
"[Store].[All Stores].[Mexico].[Guerrero]" + nl +
"[Store].[All Stores].[Mexico].[Jalisco]" + nl +
"[Store].[All Stores].[Mexico].[Veracruz]" + nl +
"[Store].[All Stores].[Mexico].[Yucatan]" + nl +
"[Store].[All Stores].[Mexico].[Zacatecas]" + nl +
"[Store].[All Stores].[USA].[CA]" + nl +
"[Store].[All Stores].[Mexico].[DF].[Mexico City]" + nl +
"[Store].[All Stores].[Mexico].[DF].[San Andres]" + nl +
"[Store].[All Stores].[Mexico].[Guerrero].[Acapulco]" + nl +
"[Store].[All Stores].[Mexico].[Jalisco].[Guadalajara]" + nl +
"[Store].[All Stores].[Mexico].[Veracruz].[Orizaba]" + nl +
"[Store].[All Stores].[Mexico].[Yucatan].[Merida]" + nl +
"[Store].[All Stores].[Mexico].[Zacatecas].[Camacho]" + nl +
"[Store].[All Stores].[Mexico].[Zacatecas].[Hidalgo]" + nl +
"[Store].[All Stores].[USA].[CA].[Los Angeles]" + nl +
"[Store].[All Stores].[USA].[CA].[San Francisco]" + nl +
"[Store].[All Stores].[Mexico].[DF].[Mexico City].[Store 9]" + nl +
"[Store].[All Stores].[Mexico].[DF].[San Andres]" + nl +
"[Store].[All Stores].[Mexico].[DF].[San Andres].[Store 21]" + nl +
"[Store].[All Stores].[Mexico].[Guerrero]" + nl +
"[Store].[All Stores].[Mexico].[Guerrero].[Acapulco]" + nl +
"[Store].[All Stores].[Mexico].[Guerrero].[Acapulco].[Store 1]" + nl +
"[Store].[All Stores].[Mexico].[Jalisco]" + nl +
"[Store].[All Stores].[Mexico].[Jalisco].[Guadalajara]" + nl +
"[Store].[All Stores].[Mexico].[Jalisco].[Guadalajara].[Store 5]" + nl +
"[Store].[All Stores].[Mexico].[Veracruz]" + nl +
"[Store].[All Stores].[Mexico].[Veracruz].[Orizaba]" + nl +
"[Store].[All Stores].[Mexico].[Veracruz].[Orizaba].[Store 10]" + nl +
"[Store].[All Stores].[Mexico].[Yucatan]" + nl +
"[Store].[All Stores].[Mexico].[Yucatan].[Merida]" + nl +
"[Store].[All Stores].[Mexico].[Yucatan].[Merida].[Store 8]" + nl +
"[Store].[All Stores].[Mexico].[Zacatecas]" + nl +
"[Store].[All Stores].[Mexico].[Zacatecas].[Camacho]" + nl +
"[Store].[All Stores].[Mexico].[Zacatecas].[Camacho].[Store 4]" + nl +
"[Store].[All Stores].[Mexico].[Zacatecas].[Hidalgo]" + nl +
"[Store].[All Stores].[Mexico].[Zacatecas].[Hidalgo].[Store 12]" + nl +
"[Store].[All Stores].[Mexico].[Zacatecas].[Hidalgo].[Store 18]" + nl +
"[Store].[All Stores].[USA]" + nl +
"[Store].[All Stores].[USA].[CA]" + nl +
"[Store].[All Stores].[USA].[CA].[Los Angeles]" + nl +
"[Store].[All Stores].[USA].[CA].[Los Angeles].[Store 7]" + nl +
"[Store].[All Stores].[USA].[CA].[San Francisco]" + nl +
"[Store].[All Stores].[USA].[CA].[San Francisco].[Store 14]");
}
public void testGrantHierarchy6() {
Expand Down
14 changes: 10 additions & 4 deletions testsrc/main/mondrian/test/BasicQueryTest.java
Expand Up @@ -2767,16 +2767,21 @@ public void testMemberWithNullKey() {
String resultString = TestContext.toString(result);
resultString = Pattern.compile("\\.0\\]").matcher(resultString).replaceAll("]");

// Try to detect whether nulls are sorted high, such as Postgres and Oracle.
// There was a test in here to deal with the sorting of nulls by different
// DBMSs. With the work on the members function, with the hierarchized
// result, nulls always sort high now.

/* // Try to detect whether nulls are sorted high, such as Postgres and Oracle.
// In practice, the different JDBC drivers do not report correctly in all
// instances.
RolapConnection conn = (RolapConnection) getConnection();
boolean nullsSortHigh = false;
// RolapConnection conn = (RolapConnection) getConnection();
*/ boolean nullsSortHigh = true;

// This did not seem to work consistently across drivers, so don't use it
// boolean nullsSortedAtEnd = false;

/*
try {
DatabaseMetaData dbMetadata = conn.getDataSource().getConnection().getMetaData();
nullsSortHigh = dbMetadata.nullsAreSortedHigh();
Expand All @@ -2794,7 +2799,8 @@ public void testMemberWithNullKey() {
if (jdbc_url.toLowerCase().indexOf("oracle") >= 0 ) {
nullsSortHigh = true;
}

*/

int row = 0;

final String expected = "Axis #0:" + nl +
Expand Down
70 changes: 35 additions & 35 deletions testsrc/main/mondrian/xmla/XmlaTest.java
Expand Up @@ -1471,26 +1471,26 @@ public void testSelect() {
" <Tuples>",
" <Tuple>",
" <Member Hierarchy=\"Measures\">",
" <UName>[Measures].[Unit Sales]</UName>",
" <Caption>Unit Sales</Caption>",
" <UName>[Measures].[Profit]</UName>",
" <Caption>Profit</Caption>",
" <LName>[Measures].[MeasuresLevel]</LName>",
" <LNum>0</LNum>",
" <DisplayInfo>0</DisplayInfo>",
" </Member>",
" </Tuple>",
" <Tuple>",
" <Member Hierarchy=\"Measures\">",
" <UName>[Measures].[Store Cost]</UName>",
" <Caption>Store Cost</Caption>",
" <UName>[Measures].[Profit Growth]</UName>",
" <Caption>Gewinn-Wachstum</Caption>",
" <LName>[Measures].[MeasuresLevel]</LName>",
" <LNum>0</LNum>",
" <DisplayInfo>0</DisplayInfo>",
" </Member>",
" </Tuple>",
" <Tuple>",
" <Member Hierarchy=\"Measures\">",
" <UName>[Measures].[Store Sales]</UName>",
" <Caption>Store Sales</Caption>",
" <UName>[Measures].[Profit last Period]</UName>",
" <Caption>Profit last Period</Caption>",
" <LName>[Measures].[MeasuresLevel]</LName>",
" <LNum>0</LNum>",
" <DisplayInfo>0</DisplayInfo>",
Expand All @@ -1507,35 +1507,35 @@ public void testSelect() {
" </Tuple>",
" <Tuple>",
" <Member Hierarchy=\"Measures\">",
" <UName>[Measures].[Customer Count]</UName>",
" <Caption>Customer Count</Caption>",
" <UName>[Measures].[Store Cost]</UName>",
" <Caption>Store Cost</Caption>",
" <LName>[Measures].[MeasuresLevel]</LName>",
" <LNum>0</LNum>",
" <DisplayInfo>0</DisplayInfo>",
" </Member>",
" </Tuple>",
" <Tuple>",
" <Member Hierarchy=\"Measures\">",
" <UName>[Measures].[Profit]</UName>",
" <Caption>Profit</Caption>",
" <UName>[Measures].[Store Sales]</UName>",
" <Caption>Store Sales</Caption>",
" <LName>[Measures].[MeasuresLevel]</LName>",
" <LNum>0</LNum>",
" <DisplayInfo>0</DisplayInfo>",
" </Member>",
" </Tuple>",
" <Tuple>",
" <Member Hierarchy=\"Measures\">",
" <UName>[Measures].[Profit last Period]</UName>",
" <Caption>Profit last Period</Caption>",
" <UName>[Measures].[Unit Sales]</UName>",
" <Caption>Unit Sales</Caption>",
" <LName>[Measures].[MeasuresLevel]</LName>",
" <LNum>0</LNum>",
" <DisplayInfo>0</DisplayInfo>",
" </Member>",
" </Tuple>",
" <Tuple>",
" <Member Hierarchy=\"Measures\">",
" <UName>[Measures].[Profit Growth]</UName>",
" <Caption>Gewinn-Wachstum</Caption>",
" <UName>[Measures].[Customer Count]</UName>",
" <Caption>Customer Count</Caption>",
" <LName>[Measures].[MeasuresLevel]</LName>",
" <LNum>0</LNum>",
" <DisplayInfo>0</DisplayInfo>",
Expand All @@ -1546,44 +1546,44 @@ public void testSelect() {
" </Axes>",
" <CellData>",
" <Cell CellOrdinal=\"0\">",
" <Value xsi:type=\"xsd:double\">266773</Value>",
" <FmtValue>266,773</FmtValue>",
" <FormatString>Standard</FormatString>",
" <Value xsi:type=\"xsd:double\">339610.89639999997</Value>",
" <FmtValue>$339,610.90</FmtValue>",
" <FormatString>$#,##0.00</FormatString>",
" </Cell>",
" <Cell CellOrdinal=\"1\">",
" <Value xsi:type=\"xsd:double\">225627.2336</Value>",
" <FmtValue>225,627.23</FmtValue>",
" <FormatString>#,###.00</FormatString>",
" <Value xsi:type=\"xsd:double\">0</Value>",
" <FmtValue>0.0%</FmtValue>",
" <FormatString>0.0%</FormatString>",
" </Cell>",
" <Cell CellOrdinal=\"2\">",
" <Value xsi:type=\"xsd:double\">565238.13</Value>",
" <FmtValue>565,238.13</FmtValue>",
" <FormatString>#,###.00</FormatString>",
" <Value xsi:type=\"xsd:double\">339610.89639999997</Value>",
" <FmtValue>$339,610.90</FmtValue>",
" <FormatString>$#,##0.00</FormatString>",
" </Cell>",
" <Cell CellOrdinal=\"3\">",
" <Value xsi:type=\"xsd:int\">86837</Value>",
" <FmtValue>86,837</FmtValue>",
" <FormatString>#,###</FormatString>",
" </Cell>",
" <Cell CellOrdinal=\"4\">",
" <Value xsi:type=\"xsd:int\">5581</Value>",
" <FmtValue>5,581</FmtValue>",
" <FormatString>#,###</FormatString>",
" <Value xsi:type=\"xsd:double\">225627.2336</Value>",
" <FmtValue>225,627.23</FmtValue>",
" <FormatString>#,###.00</FormatString>",
" </Cell>",
" <Cell CellOrdinal=\"5\">",
" <Value xsi:type=\"xsd:double\">339610.89639999997</Value>",
" <FmtValue>$339,610.90</FmtValue>",
" <FormatString>$#,##0.00</FormatString>",
" <Value xsi:type=\"xsd:double\">565238.13</Value>",
" <FmtValue>565,238.13</FmtValue>",
" <FormatString>#,###.00</FormatString>",
" </Cell>",
" <Cell CellOrdinal=\"6\">",
" <Value xsi:type=\"xsd:double\">339610.89639999997</Value>",
" <FmtValue>$339,610.90</FmtValue>",
" <FormatString>$#,##0.00</FormatString>",
" <Value xsi:type=\"xsd:double\">266773</Value>",
" <FmtValue>266,773</FmtValue>",
" <FormatString>Standard</FormatString>",
" </Cell>",
" <Cell CellOrdinal=\"7\">",
" <Value xsi:type=\"xsd:double\">0</Value>",
" <FmtValue>0.0%</FmtValue>",
" <FormatString>0.0%</FormatString>",
" <Value xsi:type=\"xsd:int\">5581</Value>",
" <FmtValue>5,581</FmtValue>",
" <FormatString>#,###</FormatString>",
" </Cell>",
" </CellData>",
" </root>",
Expand Down
56 changes: 28 additions & 28 deletions testsrc/queryFiles/queryTest_29ce2f3512f79d38_TOPCOUNT.xml
Expand Up @@ -38,7 +38,7 @@
</dimensions>
<tuples>
<tuple>
<member>[Measures].[Unit Sales]</member>
<member>[Measures].[Sales Count]</member>
</tuple>
<tuple>
<member>[Measures].[Store Cost]</member>
Expand All @@ -47,7 +47,7 @@
<member>[Measures].[Store Sales]</member>
</tuple>
<tuple>
<member>[Measures].[Sales Count]</member>
<member>[Measures].[Unit Sales]</member>
</tuple>
<tuple>
<member>[Measures].[Customer Count]</member>
Expand Down Expand Up @@ -102,94 +102,94 @@
</rows>
<data>
<drow>
<cell>41580.0</cell>
<cell>13347.0</cell>
<cell>34823.5566</cell>
<cell>87218.28</cell>
<cell>13347.0</cell>
<cell>41580.0</cell>
<cell>474.0</cell>
</drow>
<drow>
<cell>35257.0</cell>
<cell>11184.0</cell>
<cell>29959.2813</cell>
<cell>74843.96</cell>
<cell>11184.0</cell>
<cell>35257.0</cell>
<cell>278.0</cell>
</drow>
<drow>
<cell>26079.0</cell>
<cell>8264.0</cell>
<cell>21948.944</cell>
<cell>55058.79</cell>
<cell>8264.0</cell>
<cell>26079.0</cell>
<cell>563.0</cell>
</drow>
<drow>
<cell>25663.0</cell>
<cell>8207.0</cell>
<cell>21771.536</cell>
<cell>54545.28</cell>
<cell>8207.0</cell>
<cell>25663.0</cell>
<cell>1147.0</cell>
</drow>
<drow>
<cell>25635.0</cell>
<cell>8095.0</cell>
<cell>21713.5328</cell>
<cell>54431.14</cell>
<cell>8095.0</cell>
<cell>25635.0</cell>
<cell>962.0</cell>
</drow>
<drow>
<cell>25011.0</cell>
<cell>7956.0</cell>
<cell>20956.8025</cell>
<cell>52644.07</cell>
<cell>7956.0</cell>
<cell>25011.0</cell>
<cell>906.0</cell>
</drow>
<drow>
<cell>24576.0</cell>
<cell>7876.0</cell>
<cell>21121.9631</cell>
<cell>52896.3</cell>
<cell>7876.0</cell>
<cell>24576.0</cell>
<cell>179.0</cell>
</drow>
<drow>
<cell>23591.0</cell>
<cell>7397.0</cell>
<cell>19795.491</cell>
<cell>49634.46</cell>
<cell>7397.0</cell>
<cell>23591.0</cell>
<cell>84.0</cell>
</drow>
<drow>
<cell>21333.0</cell>
<cell>6815.0</cell>
<cell>18266.4404</cell>
<cell>45750.24</cell>
<cell>6815.0</cell>
<cell>21333.0</cell>
<cell>1059.0</cell>
</drow>
<drow>
<cell>11491.0</cell>
<cell>3652.0</cell>
<cell>9713.813</cell>
<cell>24329.23</cell>
<cell>3652.0</cell>
<cell>11491.0</cell>
<cell>95.0</cell>
</drow>
<drow>
<cell>2237.0</cell>
<cell>1380.0</cell>
<cell>1896.6174</cell>
<cell>4739.23</cell>
<cell>1380.0</cell>
<cell>2237.0</cell>
<cell>190.0</cell>
</drow>
<drow>
<cell>2203.0</cell>
<cell>1339.0</cell>
<cell>1880.3396</cell>
<cell>4705.97</cell>
<cell>1339.0</cell>
<cell>2203.0</cell>
<cell>96.0</cell>
</drow>
<drow>
<cell>2117.0</cell>
<cell>1325.0</cell>
<cell>1778.9159</cell>
<cell>4441.18</cell>
<cell>1325.0</cell>
<cell>2117.0</cell>
<cell>-452.0</cell>
</drow>
</data>
Expand Down

0 comments on commit a5c4acb

Please sign in to comment.