Package mondrian.olap

Examples of mondrian.olap.Cell


            + "      return n <= 1 ? 1 : n * factorial_xx(n - 1);\n"
            + "    }\n"
            + "  ]]>\n"
            + "  </Script>\n"
            + "</UserDefinedFunction>\n");
        final Cell cell = tc.executeExprRaw("Factorial(4 + 2)");
        getTestContext().assertMatchesVerbose(
            Pattern.compile(
                "(?s).*ReferenceError: \"factorial_xx\" is not defined..*"),
            cell.getValue().toString());
    }
View Full Code Here


            Result result = executeQuery(
                "with member [Measures].[Foo] as '"
                + expression
                + "' select {[Measures].[Foo]} on columns from "
                + cubeName);
            Cell cell = result.getCell(new int[]{0});
            if (cell.isError()) {
                throwable = (Throwable) cell.getValue();
            }
        } catch (Throwable e) {
            throwable = e;
        }
        checkThrowable(throwable, pattern);
View Full Code Here

    /**
     * Executes an expression and asserts that it returns a given result.
     */
    public void assertExprReturns(String expression, String expected) {
        final Cell cell = executeExprRaw(expression);
        if (expected == null) {
            expected = ""; // null values are formatted as empty string
        }
        assertEqualsVerbose(expected, cell.getFormattedValue());
    }
View Full Code Here

            final String paramName = (String) paramValues[i++];
            final Object value = paramValues[i++];
            query.setParameter(paramName, value);
        }
        final Result result = connection.execute(query);
        final Cell cell = result.getCell(new int[]{0});

        if (expected == null) {
            expected = ""; // null values are formatted as empty string
        }
        assertEqualsVerbose(expected, cell.getFormattedValue());
    }
View Full Code Here

            getTestContext().executeQuery(
                "select [Gender].Members on 0,\n"
                + "[Time].[Weekly].[1997].[6].Children on 1\n"
                + "from [Sales]\n"
                + "where [Marital Status].[S]");
        final Cell cell = result.getCell(new int[]{0, 0});
        final Map<String, Hierarchy> hierarchyMap =
            new HashMap<String, Hierarchy>();
        for (Dimension dimension : result.getQuery().getCube().getDimensions())
        {
            for (Hierarchy hierarchy : dimension.getHierarchies()) {
                hierarchyMap.put(hierarchy.getUniqueName(), hierarchy);
            }
        }
        assertEquals(
            "[Measures].[Unit Sales]",
            cell.getContextMember(hierarchyMap.get("[Measures]"))
                .getUniqueName());
        assertEquals(
            "[Time].[1997]",
            cell.getContextMember(hierarchyMap.get("[Time]"))
                .getUniqueName());
        assertEquals(
            "[Time].[Weekly].[1997].[6].[1]",
            cell.getContextMember(hierarchyMap.get("[Time].[Weekly]"))
                .getUniqueName());
        assertEquals(
            "[Gender].[All Gender]",
            cell.getContextMember(hierarchyMap.get("[Gender]"))
                .getUniqueName());
        assertEquals(
            "[Marital Status].[S]",
            cell.getContextMember(hierarchyMap.get("[Marital Status]"))
                .getUniqueName());
    }
View Full Code Here

    public void testCellValue() {
        Result result = executeQuery(
            "select {[Measures].[Unit Sales],[Measures].[Store Sales]} on columns,\n"
            + " {[Gender].[M]} on rows\n"
            + "from Sales");
        Cell cell = result.getCell(new int[]{0, 0});
        Object value = cell.getValue();
        assertTrue(value instanceof Number);
        assertEquals(135215, ((Number) value).intValue());
        cell = result.getCell(new int[]{1, 0});
        value = cell.getValue();
        assertTrue(value instanceof Number);
        // Plato give 285011.12, Oracle gives 285011, MySQL gives 285964 (bug!)
        assertEquals(285011, ((Number) value).intValue());
    }
View Full Code Here

            + "Row #6: 15,134\n"
            + "Row #7: 24\n"
            + "Row #8: \n");

        Result result = executeQuery(q2);
        final Cell cell = result.getCell(new int[] {0, 0});
        String sql = cell.getDrillThroughSQL(false);
        // the following replacement is for databases in ANSI mode
        //  using '"' to quote identifiers
        sql = sql.replace('"', '`');

        String tableQualifier = "as ";
View Full Code Here

TOP

Related Classes of mondrian.olap.Cell

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.