Search in sources :

Example 6 with CustomizedFunctionTable

use of mondrian.olap.fun.CustomizedFunctionTable in project mondrian by pentaho.

the class CustomizedParserTest method testMultipleMultiplication.

public void testMultipleMultiplication() {
    Set<String> functionNameSet = new HashSet<String>();
    functionNameSet.add("*");
    CustomizedFunctionTable cftab = getCustomizedFunctionTable(functionNameSet);
    try {
        Query q = getParsedQueryForExpr(cftab, "([Measures].[Store Cost] * [Measures].[Unit Sales] * [Measures].[Store Sales])");
        q.resolve(q.createValidator(cftab, true));
    } catch (Throwable e) {
        fail(e.getMessage());
    }
}
Also used : CustomizedFunctionTable(mondrian.olap.fun.CustomizedFunctionTable) HashSet(java.util.HashSet)

Example 7 with CustomizedFunctionTable

use of mondrian.olap.fun.CustomizedFunctionTable in project mondrian by pentaho.

the class CustomizedParserTest method testLiterals.

public void testLiterals() {
    Set<String> functionNameSet = new HashSet<String>();
    functionNameSet.add("+");
    CustomizedFunctionTable cftab = getCustomizedFunctionTable(functionNameSet);
    try {
        Query q = getParsedQueryForExpr(cftab, "([Measures].[Store Cost] + 10)");
        q.resolve(q.createValidator(cftab, true));
    } catch (Throwable e) {
        fail(e.getMessage());
    }
}
Also used : CustomizedFunctionTable(mondrian.olap.fun.CustomizedFunctionTable) HashSet(java.util.HashSet)

Example 8 with CustomizedFunctionTable

use of mondrian.olap.fun.CustomizedFunctionTable in project mondrian by pentaho.

the class CustomizedParserTest method testMeasureSlicerFail.

public void testMeasureSlicerFail() {
    Set<String> functionNameSet = new HashSet<String>();
    functionNameSet.add("+");
    functionNameSet.add("-");
    functionNameSet.add("*");
    functionNameSet.add("/");
    CustomizedFunctionTable cftab = getCustomizedFunctionTable(functionNameSet);
    try {
        Query q = getParsedQueryForExpr(cftab, "([Measures].[Store Cost], [Gender].[F])");
        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>)'");
    }
}
Also used : CustomizedFunctionTable(mondrian.olap.fun.CustomizedFunctionTable) HashSet(java.util.HashSet)

Example 9 with CustomizedFunctionTable

use of mondrian.olap.fun.CustomizedFunctionTable in project mondrian by pentaho.

the class CustomizedParserTest method testAddition.

public void testAddition() {
    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());
    }
}
Also used : CustomizedFunctionTable(mondrian.olap.fun.CustomizedFunctionTable) HashSet(java.util.HashSet)

Example 10 with CustomizedFunctionTable

use of mondrian.olap.fun.CustomizedFunctionTable in project mondrian by pentaho.

the class CustomizedParserTest method testMixingAttributesFail.

public void testMixingAttributesFail() {
    Set<String> functionNameSet = new HashSet<String>();
    functionNameSet.add("+");
    CustomizedFunctionTable cftab = getCustomizedFunctionTable(functionNameSet);
    try {
        Query q = getParsedQueryForExpr(cftab, "([Measures].[Store Cost] + [Store].[Store Country])");
        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> + <Level>'");
    }
}
Also used : CustomizedFunctionTable(mondrian.olap.fun.CustomizedFunctionTable) HashSet(java.util.HashSet)

Aggregations

HashSet (java.util.HashSet)14 CustomizedFunctionTable (mondrian.olap.fun.CustomizedFunctionTable)14 ParenthesesFunDef (mondrian.olap.fun.ParenthesesFunDef)1