本文整理汇总了Java中mondrian.olap.Result类的典型用法代码示例。如果您正苦于以下问题:Java Result类的具体用法?Java Result怎么用?Java Result使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Result类属于mondrian.olap包,在下文中一共展示了Result类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testBugMondrian902
import mondrian.olap.Result; //导入依赖的package包/类
/**
* Test case for bug <a href="http://jira.pentaho.com/browse/MONDRIAN-902">
* MONDRIAN-902, "mondrian populating the same members on both axes"</a>.
*/
public void testBugMondrian902() {
Result result = executeQuery(
"SELECT\n"
+ "NON EMPTY CrossJoin(\n"
+ " [Education Level].[Education Level].Members,\n"
+ " CrossJoin(\n"
+ " [Product].[Product Family].Members,\n"
+ " [Store].[Store State].Members)) ON COLUMNS,\n"
+ "NON EMPTY CrossJoin(\n"
+ " [Promotions].[Promotion Name].Members,\n"
+ " [Marital Status].[Marital Status].Members) ON ROWS\n"
+ "FROM [Warehouse and Sales]");
assertEquals(
"[[Education Level].[Bachelors Degree], [Product].[Drink], [Store].[USA].[CA]]",
result.getAxes()[0].getPositions().get(0).toString());
assertEquals(45, result.getAxes()[0].getPositions().size());
// With bug MONDRIAN-902, this gave the same result as for axis #0:
assertEquals(
"[[Promotions].[Bag Stuffers], [Marital Status].[M]]",
result.getAxes()[1].getPositions().get(0).toString());
assertEquals(96, result.getAxes()[1].getPositions().size());
}
示例2: _testNullDefaultMeasure
import mondrian.olap.Result; //导入依赖的package包/类
/**
* This ought to give the same result as the above testD2() method.
* In this case, the FT2Extra cube has a default measure with no
* data (null) for all members. This default measure is used
* in the evaluation even though there is an implicit use of the
* measure [Measures].[Value].
*
* @throws Exception
*/
public void _testNullDefaultMeasure() throws Exception {
if (!isApplicable()) {
return;
}
String mdx =
"select "
+ " NON EMPTY filter({[D1].[a],[D1].[b],[D1].[c]}, "
+ " [Measures].[Value] > 0) "
+ " ON COLUMNS, "
+ " {[D2].[x],[D2].[y],[D2].[z]} "
+ " ON ROWS "
+ "from FT2Extra";
//getCubeTestContext().assertQueryReturns(mdx, RESULTS);
Result result = getTestContext().executeQuery(mdx);
String resultString = TestContext.toString(result);
assertTrue(resultString.equals(RESULTS));
}
示例3: run
import mondrian.olap.Result; //导入依赖的package包/类
protected Result run() {
getConnection().getCacheControl(null).flushSchemaCache();
IntegerProperty monLimit =
MondrianProperties.instance().ResultLimit;
int oldLimit = monLimit.get();
try {
monLimit.set(this.resultLimit);
Result result = executeQuery(query, con);
// Check the number of positions on the last axis, which is
// the ROWS axis in a 2 axis query.
int numAxes = result.getAxes().length;
Axis a = result.getAxes()[numAxes - 1];
final int positionCount = a.getPositions().size();
assertEquals(rowCount, positionCount);
return result;
} finally {
monLimit.set(oldLimit);
}
}
示例4: testImplicitMember
import mondrian.olap.Result; //导入依赖的package包/类
public void testImplicitMember() throws Exception {
// explicit use of [Product].[Class1]
String mdx =
" select NON EMPTY Crossjoin("
+ " Hierarchize(Union({[Product].[Class1]}, "
+ "[Product].[Class1].Children)), "
+ " {[Measures].[Requested Value], "
+ " [Measures].[Shipped Value]}"
+ ") ON COLUMNS,"
+ " NON EMPTY Hierarchize(Union({[Geography].[All Regions]},"
+ "[Geography].[All Regions].Children)) ON ROWS"
+ " from [ImplicitMember]";
Result result1 = getTestContext().executeQuery(mdx);
String resultString1 = TestContext.toString(result1);
Result result2 = getTestContext().executeQuery(mdx);
String resultString2 = TestContext.toString(result2);
assertEquals(resultString1, resultString2);
}
示例5: testStoreCount
import mondrian.olap.Result; //导入依赖的package包/类
public void testStoreCount() throws Exception {
if (!isApplicable()) {
return;
}
MondrianProperties props = MondrianProperties.instance();
// get value without aggregates
propSaver.set(props.UseAggregates, false);
String mdx =
"select {[Measures].[Store Count]} on columns from Cheques";
Result result = getTestContext().executeQuery(mdx);
Object v = result.getCell(new int[]{0}).getValue();
propSaver.set(props.UseAggregates, true);
Result result1 = getTestContext().executeQuery(mdx);
Object v1 = result1.getCell(new int[]{0}).getValue();
assertTrue(v.equals(v1));
}
示例6: testSalesCount
import mondrian.olap.Result; //导入依赖的package包/类
public void testSalesCount() throws Exception {
if (!isApplicable()) {
return;
}
MondrianProperties props = MondrianProperties.instance();
// get value without aggregates
propSaver.set(props.UseAggregates, false);
String mdx =
"select {[Measures].[Sales Count]} on columns from Cheques";
Result result = getTestContext().executeQuery(mdx);
Object v = result.getCell(new int[]{0}).getValue();
propSaver.set(props.UseAggregates, true);
Result result1 = getTestContext().executeQuery(mdx);
Object v1 = result1.getCell(new int[]{0}).getValue();
assertTrue(v.equals(v1));
}
示例7: testTotalAmount
import mondrian.olap.Result; //导入依赖的package包/类
public void testTotalAmount() throws Exception {
if (!isApplicable()) {
return;
}
MondrianProperties props = MondrianProperties.instance();
// get value without aggregates
propSaver.set(props.UseAggregates, false);
String mdx =
"select {[Measures].[Total Amount]} on columns from Cheques";
Result result = getTestContext().executeQuery(mdx);
Object v = result.getCell(new int[]{0}).getValue();
propSaver.set(props.UseAggregates, false);
Result result1 = getTestContext().executeQuery(mdx);
Object v1 = result1.getCell(new int[]{0}).getValue();
assertTrue(v.equals(v1));
}
示例8: testBug1541077
import mondrian.olap.Result; //导入依赖的package包/类
public void testBug1541077() throws Exception {
if (!isApplicable()) {
return;
}
MondrianProperties props = MondrianProperties.instance();
// get value without aggregates
propSaver.set(props.UseAggregates, false);
String mdx = "select {[Measures].[Avg Amount]} on columns from Cheques";
Result result = getTestContext().executeQuery(mdx);
Object v = result.getCell(new int[]{0}).getFormattedValue();
// get value with aggregates
propSaver.set(props.UseAggregates, true);
Result result1 = getTestContext().executeQuery(mdx);
Object v1 = result1.getCell(new int[]{0}).getFormattedValue();
assertTrue(v.equals(v1));
}
示例9: testScenarioPropertyBug1496
import mondrian.olap.Result; //导入依赖的package包/类
public void testScenarioPropertyBug1496() {
// looking up the $scenario property for a non ScenarioCalc member
// causes class cast exception
// http://jira.pentaho.com/browse/MONDRIAN-1496
Result result = TestContext.instance().executeQuery(
"select {[Gender].[Gender].members} on columns from Sales");
// non calc member, should return null
Object o = result.getAxes()[0].getPositions().get(0).get(0)
.getPropertyValue("$scenario");
assertEquals(null, o);
result = TestContext.instance().executeQuery(
"with member gender.cal as '1' "
+ "select {[Gender].cal} on 0 from Sales");
// calc member, should return null
o = result.getAxes()[0].getPositions().get(0).get(0)
.getPropertyValue("$scenario");
assertEquals(null, o);
}
示例10: testNonEmptyUnionQuery
import mondrian.olap.Result; //导入依赖的package包/类
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());
}
示例11: testCalcMemberWithNonEmptyCrossJoin
import mondrian.olap.Result; //导入依赖的package包/类
/**
* Make sure that the Crossjoin in [Measures].[CustomerCount]
* is not evaluated in NON EMPTY context.
*/
public void testCalcMemberWithNonEmptyCrossJoin() {
TestContext.instance().flushSchemaCache();
Result result = executeQuery(
"with member [Measures].[CustomerCount] as \n"
+ "'Count(CrossJoin({[Product].[All Products]}, [Customers].[Name].Members))'\n"
+ "select \n"
+ "NON EMPTY{[Measures].[CustomerCount]} ON columns,\n"
+ "NON EMPTY{[Product].[All Products]} ON rows\n"
+ "from [Sales]\n"
+ "where ([Store].[All Stores].[USA].[CA].[San Francisco].[Store 14], [Time].[1997].[Q1].[1])");
Cell c = result.getCell(new int[] {0, 0});
// we expect 10281 customers, although there are only 20 non-empty ones
// @see #testLevelMembers
assertEquals("10,281", c.getFormattedValue());
}
示例12: _testNullDefaultMeasure
import mondrian.olap.Result; //导入依赖的package包/类
/**
* This ought to give the same result as the above testD2() method.
* In this case, the FT2Extra cube has a default measure with no
* data (null) for all members. This default measure is used
* in the evaluation even though there is an implicit use of the
* measure [Measures].[Value].
*
* @throws Exception
*/
public void _testNullDefaultMeasure() throws Exception {
if (!isApplicable()) {
return;
}
String mdx =
"select "
+ " NON EMPTY filter({[D1].[a],[D1].[b],[D1].[c]}, "
+ " [Measures].[Value] > 0) "
+ " ON COLUMNS, "
+ " {[D2].[x],[D2].[y],[D2].[z]} "
+ " ON ROWS "
+ "from FT2Extra";
//getCubeTestContext().assertQueryReturns(mdx, RESULTS);
Result result = getCubeTestContext().executeQuery(mdx);
String resultString = TestContext.toString(result);
assertTrue(resultString.equals(RESULTS));
}
示例13: testImplicitMember
import mondrian.olap.Result; //导入依赖的package包/类
public void testImplicitMember() throws Exception {
// explicit use of [Product].[Class1]
String mdx =
" select NON EMPTY Crossjoin("
+ " Hierarchize(Union({[Product].[Class1]}, "
+ "[Product].[Class1].Children)), "
+ " {[Measures].[Requested Value], "
+ " [Measures].[Shipped Value]}"
+ ") ON COLUMNS,"
+ " NON EMPTY Hierarchize(Union({[Geography].[All Regions]},"
+ "[Geography].[All Regions].Children)) ON ROWS"
+ " from [ImplicitMember]";
Result result1 = getCubeTestContext().executeQuery(mdx);
String resultString1 = TestContext.toString(result1);
Result result2 = getCubeTestContext().executeQuery(mdx);
String resultString2 = TestContext.toString(result2);
assertEquals(resultString1, resultString2);
}
示例14: testCrossJoin
import mondrian.olap.Result; //导入依赖的package包/类
public void testCrossJoin() throws Exception {
// explicit use of [Product].[Class1]
String mdx =
"select {[Measures].[Requested Value]} ON COLUMNS,"+
" NON EMPTY Crossjoin("+
" {[Geography].[All Regions].Children},"+
" {[Product].[All Products].Children}"+
") ON ROWS"+
" from [Checkin_7634]";
// Execute query but do not used the CrossJoin nonEmptyList optimization
MondrianProperties.instance().CrossJoinOptimizerSize.set(
Integer.MAX_VALUE);
Result result1 = getCubeTestContext().executeQuery(mdx);
String resultString1 = TestContext.toString(result1);
// Execute query using the new version of the CrossJoin
// nonEmptyList optimization
MondrianProperties.instance().CrossJoinOptimizerSize.set(0);
Result result2 = getCubeTestContext().executeQuery(mdx);
String resultString2 = TestContext.toString(result2);
// This succeeds.
assertEquals(resultString1, resultString2);
}
示例15: testStoreCount
import mondrian.olap.Result; //导入依赖的package包/类
public void testStoreCount() throws Exception {
if (!isApplicable()) {
return;
}
MondrianProperties props = MondrianProperties.instance();
// get value without aggregates
props.UseAggregates.setString("false");
String mdx =
"select {[Measures].[Store Count]} on columns from Cheques";
Result result = getCubeTestContext().executeQuery(mdx);
Object v = result.getCell(new int[]{0}).getValue();
props.UseAggregates.setString("true");
Result result1 = getCubeTestContext().executeQuery(mdx);
Object v1 = result1.getCell(new int[]{0}).getValue();
assertTrue(v.equals(v1));
}