use of mondrian.olap.fun.CustomizedFunctionTable in project mondrian by pentaho.
the class CustomizedParserTest method testMultiplicationFail.
public void testMultiplicationFail() {
Set<String> functionNameSet = new HashSet<String>();
functionNameSet.add("+");
CustomizedFunctionTable cftab = getCustomizedFunctionTable(functionNameSet);
try {
Query q = getParsedQueryForExpr(cftab, "([Measures].[Store Cost] * [Measures].[Unit Sales])");
q.resolve(q.createValidator(cftab, true));
// Shouldn't reach here
fail("Expected error did not occur.");
} catch (Throwable e) {
checkErrorMsg(e, "Mondrian Error:No function matches signature '<Member> * <Member>'");
}
}
use of mondrian.olap.fun.CustomizedFunctionTable in project mondrian by pentaho.
the class CustomizedParserTest method testMissingObject.
private void testMissingObject(boolean strictValidation) {
Set<String> functionNameSet = new HashSet<String>();
functionNameSet.add("+");
CustomizedFunctionTable cftab = getCustomizedFunctionTable(functionNameSet);
MondrianProperties properties = MondrianProperties.instance();
propSaver.set(properties.IgnoreInvalidMembers, true);
propSaver.set(properties.IgnoreInvalidMembersDuringQuery, true);
try {
Query q = getParsedQueryForExpr(cftab, "'[Measures].[Store Cost] + [Measures].[Unit Salese]'", strictValidation);
q.resolve(q.createValidator(cftab, true));
// Shouldn't reach here if strictValidation
fail("Expected error does not occur when strictValidation is set:" + strictValidation);
} catch (Throwable e) {
if (strictValidation) {
checkErrorMsg(e, "Mondrian Error:MDX object '[Measures].[Unit Salese]' not found in cube 'Sales'");
} else {
checkErrorMsg(e, "Expected error does not occur when strictValidation is set:" + strictValidation);
}
}
}
use of mondrian.olap.fun.CustomizedFunctionTable in project mondrian by pentaho.
the class CustomizedParserTest method testCrossJoinFail.
public void testCrossJoinFail() {
Set<String> functionNameSet = new HashSet<String>();
functionNameSet.add("+");
functionNameSet.add("-");
functionNameSet.add("*");
functionNameSet.add("/");
CustomizedFunctionTable cftab = getCustomizedFunctionTable(functionNameSet);
try {
Query q = getParsedQueryForExpr(cftab, "CrossJoin([Measures].[Store Cost], [Measures].[Unit Sales])");
q.resolve(q.createValidator(cftab, true));
// Shouldn't reach here
fail("Expected error did not occur.");
} catch (Throwable e) {
checkErrorMsg(e, "Mondrian Error:Tuple contains more than one member of hierarchy '[Measures]'.");
}
}
use of mondrian.olap.fun.CustomizedFunctionTable in project mondrian by pentaho.
the class CustomizedParserTest method testSingleMultiplication.
public void testSingleMultiplication() {
Set<String> functionNameSet = new HashSet<String>();
functionNameSet.add("*");
CustomizedFunctionTable cftab = getCustomizedFunctionTable(functionNameSet);
try {
Query q = getParsedQueryForExpr(cftab, "[Measures].[Store Cost] * [Measures].[Unit Sales]");
q.resolve(q.createValidator(cftab, true));
} catch (Throwable e) {
fail(e.getMessage());
}
}
use of mondrian.olap.fun.CustomizedFunctionTable in project mondrian by pentaho.
the class CustomizedParserTest method testMissingObjectFail.
public void testMissingObjectFail() {
Set<String> functionNameSet = new HashSet<String>();
functionNameSet.add("+");
CustomizedFunctionTable cftab = getCustomizedFunctionTable(functionNameSet);
try {
Query q = getParsedQueryForExpr(cftab, "'[Measures].[Store Cost] + [Measures].[Unit Salese]'");
q.resolve(q.createValidator(cftab, true));
// Shouldn't reach here
fail("Expected error did not occur.");
} catch (Throwable e) {
checkErrorMsg(e, "Mondrian Error:MDX object '[Measures].[Unit Salese]' not found in cube 'Sales'");
}
}
Aggregations