use of mondrian.olap.Result in project mondrian by pentaho.
the class BUG_1541077 method testStoreCount.
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));
}
use of mondrian.olap.Result in project mondrian by pentaho.
the class Checkin_7641 method testImplicitMember.
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);
}
use of mondrian.olap.Result in project mondrian by pentaho.
the class MultipleColsInTupleAggTest method testTotal.
public void testTotal() throws Exception {
if (!isApplicable()) {
return;
}
MondrianProperties props = MondrianProperties.instance();
// get value without aggregates
propSaver.set(props.UseAggregates, false);
propSaver.set(props.ReadAggregates, false);
String mdx = "select {[Measures].[Total]} on columns from [Fact]";
Result result = getTestContext().executeQuery(mdx);
Object v = result.getCell(new int[] { 0 }).getValue();
String mdx2 = "select {[Measures].[Total]} on columns from [Fact] where " + "{[Product].[Cat One].[Prod Cat One].[One]}";
Result aresult = getTestContext().executeQuery(mdx2);
Object av = aresult.getCell(new int[] { 0 }).getValue();
// unless there is a way to flush the cache,
// I'm skeptical about these results
propSaver.set(props.UseAggregates, true);
propSaver.set(props.ReadAggregates, false);
Result result1 = getTestContext().executeQuery(mdx);
Object v1 = result1.getCell(new int[] { 0 }).getValue();
assertTrue(v.equals(v1));
Result aresult2 = getTestContext().executeQuery(mdx2);
Object av1 = aresult2.getCell(new int[] { 0 }).getValue();
assertTrue(av.equals(av1));
}
use of mondrian.olap.Result in project mondrian by pentaho.
the class AggMeasureFactCountTest method verifySameAggAndNot.
private void verifySameAggAndNot(String query, String schema) {
TestContext testContext = getTestContext().withSchema(schema);
Result resultWithAgg = testContext.withFreshConnection().executeQuery(query);
disableAggregates();
Result result = testContext.executeQuery(query);
String resultStr = TestContext.toString(result);
String resultWithAggStr = TestContext.toString(resultWithAgg);
assertEquals("Results with and without agg table should be equal", resultStr, resultWithAggStr);
}
use of mondrian.olap.Result in project mondrian by pentaho.
the class NamedSetTest method testNamedSetMustBeSet.
public void testNamedSetMustBeSet() {
Result result;
String queryString;
String pattern;
// Formula for a named set must not be a member.
queryString = "with set [Foo] as ' [Store].CurrentMember '" + "select {[Foo]} on columns from [Sales]";
pattern = "Set expression '[Foo]' must be a set";
assertQueryThrows(queryString, pattern);
// Formula for a named set must not be a dimension.
queryString = "with set [Foo] as ' [Store] '" + "select {[Foo]} on columns from [Sales]";
assertQueryThrows(queryString, pattern);
// Formula for a named set must not be a level.
queryString = "with set [Foo] as ' [Store].[Store Country] '" + "select {[Foo]} on columns from [Sales]";
assertQueryThrows(queryString, pattern);
// Formula for a named set must not be a cube name.
queryString = "with set [Foo] as ' [Sales] '" + "select {[Foo]} on columns from [Sales]";
assertQueryThrows(queryString, "MDX object '[Sales]' not found in cube 'Sales'");
// Formula for a named set must not be a string.
queryString = "with set [Foo] as ' \"foobar\" '" + "select {[Foo]} on columns from [Sales]";
assertQueryThrows(queryString, pattern);
// Formula for a named set must not be a number.
queryString = "with set [Foo] as ' -1.45 '" + "select {[Foo]} on columns from [Sales]";
assertQueryThrows(queryString, pattern);
// Formula for a named set must not be a tuple.
queryString = "with set [Foo] as ' ([Gender].[M], [Marital Status].[S]) '" + "select {[Foo]} on columns from [Sales]";
assertQueryThrows(queryString, pattern);
// Formula for a named set may be a set of tuples.
queryString = "with set [Foo] as ' CrossJoin([Gender].members, [Marital Status].members) '" + "select {[Foo]} on columns from [Sales]";
result = executeQuery(queryString);
Util.discard(result);
// Formula for a named set may be a set of members.
queryString = "with set [Foo] as ' [Gender].members '" + "select {[Foo]} on columns from [Sales]";
result = executeQuery(queryString);
Util.discard(result);
}
Aggregations