Package mondrian.olap

Examples of mondrian.olap.Connection


        TestContext testContext =
            TestContext.instance().withSchema(SCHEMA_4_HEADER + SCHEMA_4_BODY);
        Util.PropertyList connectInfo =
            testContext.getConnectionProperties();
        try {
            Connection conn = DriverManager.getConnection(connectInfo, null);
            conn.close();
            Assert.fail("No exception thrown for version 4 schema.");
        } catch (MondrianException e) {
            assertTrue(e.getMessage().contains("Schema version"));
        }
    }
View Full Code Here


            TestContext.instance().withSchema(
                SCHEMA_4_NVHEADER + SCHEMA_4_BODY);
        Util.PropertyList connectInfo =
            testContext.getConnectionProperties();
        try {
            Connection conn = DriverManager.getConnection(connectInfo, null);
            conn.close();
            Assert.fail("No exception thrown for version 4 schema.");
        } catch (MondrianException e) {
            assertTrue(e.getMessage().contains("Schema version"));
        }
    }
View Full Code Here

            // the false impression that the validation performance bug has
            // returned.
            return;
        }
        final long start = System.currentTimeMillis();
        Connection connection = getTestContext().getConnection();
        final String queryString =
            "select {[Measures].[Unit Sales],\n"
            + " [Measures].[Store Cost],\n"
            + " [Measures].[Store Sales]} ON columns,\n"
            + "Hierarchize(Union(Union(Union(Union(Union(Union(Union(Union(Union(Union(Union(Union(Union(Union(Union(Union(Union(Union(Union(Union\n"
            + "({([Gender].[All Gender],\n"
            + " [Marital Status].[All Marital Status],\n"
            + " [Customers].[All Customers],\n"
            + " [Product].[All Products])},\n"
            + " Crossjoin ([Gender].[All Gender].Children,\n"
            + " {([Marital Status].[All Marital Status],\n"
            + " [Customers].[All Customers],\n"
            + " [Product].[All Products])})),\n"
            + " Crossjoin(Crossjoin({[Gender].[All Gender].[F]},\n"
            + " [Marital Status].[All Marital Status].Children),\n"
            + " {([Customers].[All Customers],\n"
            + " [Product].[All Products])})),\n"
            + " Crossjoin(Crossjoin({([Gender].[All Gender].[F],\n"
            + " [Marital Status].[All Marital Status].[M])},\n"
            + " [Customers].[All Customers].Children),\n"
            + " {[Product].[All Products]})),\n"
            + " Crossjoin(Crossjoin({([Gender].[All Gender].[F],\n"
            + " [Marital Status].[All Marital Status].[M])},\n"
            + " [Customers].[All Customers].[USA].Children),\n"
            + " {[Product].[All Products]})),\n"
            + " Crossjoin ({([Gender].[All Gender].[F], [Marital Status].[All Marital Status].[M], [Customers].[All Customers].[USA].[CA])},\n"
            + "   [Product].[All Products].Children)),\n"
            + " Crossjoin({([Gender].[All Gender].[F], [Marital Status].[All Marital Status].[M], [Customers].[All Customers].[USA].[OR])},\n"
            + "   [Product].[All Products].Children)),\n"
            + " Crossjoin({([Gender].[All Gender].[F], [Marital Status].[All Marital Status].[M], [Customers].[All Customers].[USA].[WA])},\n"
            + "   [Product].[All Products].Children)),\n"
            + " Crossjoin ({([Gender].[All Gender].[F], [Marital Status].[All Marital Status].[M], [Customers].[All Customers].[USA])},\n"
            + "   [Product].[All Products].Children)),\n"
            + " Crossjoin(\n"
            + "   Crossjoin({([Gender].[All Gender].[F], [Marital Status].[All Marital Status].[S])}, [Customers].[All Customers].Children),\n"
            + "   {[Product].[All Products]})),\n"
            + " Crossjoin(Crossjoin({([Gender].[All Gender].[F],\n"
            + " [Marital Status].[All Marital Status].[S])},\n"
            + " [Customers].[All Customers].[USA].Children),\n"
            + " {[Product].[All Products]})),\n"
            + " Crossjoin ({([Gender].[All Gender].[F],\n"
            + " [Marital Status].[All Marital Status].[S],\n"
            + " [Customers].[All Customers].[USA].[CA])},\n"
            + " [Product].[All Products].Children)),\n"
            + " Crossjoin({([Gender].[All Gender].[F],\n"
            + " [Marital Status].[All Marital Status].[S],\n"
            + " [Customers].[All Customers].[USA].[OR])},\n"
            + " [Product].[All Products].Children)),\n"
            + " Crossjoin({([Gender].[All Gender].[F],\n"
            + " [Marital Status].[All Marital Status].[S],\n"
            + " [Customers].[All Customers].[USA].[WA])},\n"
            + " [Product].[All Products].Children)),\n"
            + " Crossjoin ({([Gender].[All Gender].[F],\n"
            + " [Marital Status].[All Marital Status].[S],\n"
            + " [Customers].[All Customers].[USA])},\n"
            + " [Product].[All Products].Children)),\n"
            + " Crossjoin(Crossjoin({([Gender].[All Gender].[F],\n"
            + " [Marital Status].[All Marital Status])},\n"
            + " [Customers].[All Customers].Children),\n"
            + " {[Product].[All Products]})),\n"
            + " Crossjoin(Crossjoin({([Gender].[All Gender].[F],\n"
            + " [Marital Status].[All Marital Status])},\n"
            + " [Customers].[All Customers].[USA].Children),\n"
            + " {[Product].[All Products]})),\n"
            + " Crossjoin ({([Gender].[All Gender].[F],\n"
            + " [Marital Status].[All Marital Status],\n"
            + " [Customers].[All Customers].[USA].[CA])},\n"
            + " [Product].[All Products].Children)),\n"
            + " Crossjoin({([Gender].[All Gender].[F],\n"
            + " [Marital Status].[All Marital Status],\n"
            + " [Customers].[All Customers].[USA].[OR])},\n"
            + " [Product].[All Products].Children)),\n"
            + " Crossjoin({([Gender].[All Gender].[F],\n"
            + " [Marital Status].[All Marital Status],\n"
            + " [Customers].[All Customers].[USA].[WA])},\n"
            + " [Product].[All Products].Children)),\n"
            + " Crossjoin ({([Gender].[All Gender].[F],\n"
            + " [Marital Status].[All Marital Status],\n"
            + " [Customers].[All Customers].[USA])},\n"
            + " [Product].[All Products].Children))) ON rows  from [Sales]  where [Time].[1997]";
        Query query = connection.parseQuery(queryString);
        // If this call took longer than 10 seconds, the performance bug has
        // probably resurfaced again.
        final long afterParseMillis = System.currentTimeMillis();
        final long afterParseNonDbMillis =
            afterParseMillis - Util.dbTimeMillis();
        final long parseMillis = afterParseMillis - start;
        assertTrue(
            "performance problem: parse took " + parseMillis + " milliseconds",
            parseMillis <= 10000);

        Result result = connection.execute(query);
        assertEquals(59, result.getAxes()[1].getPositions().size());

        // If this call took longer than 10 seconds,
        // or 2 seconds exclusing db access,
        // the performance bug has
View Full Code Here

        // Avoid this test if memory is scarce.
        if (Bug.avoidMemoryOverflow(TestContext.instance().getDialect())) {
            return;
        }

        final Connection connection =
            TestContext.instance().getConnection();
        String queryString =
            "select {[Measures].[Unit Sales]} on columns,\n"
            + "{[Customers].members} on rows\n"
            + "from Sales";
        Query query = connection.parseQuery(queryString);
        Result result = connection.execute(query);
        assertEquals(10407, result.getAxes()[1].getPositions().size());
    }
View Full Code Here

        Result result = connection.execute(query);
        assertEquals(10407, result.getAxes()[1].getPositions().size());
    }

    public void testUnparse() {
        Connection connection = getConnection();
        Query query = connection.parseQuery(
            "with member [Measures].[Rendite] as \n"
            + " '(([Measures].[Store Sales] - [Measures].[Store Cost])) / [Measures].[Store Cost]',\n"
            + " format_string = iif(([Measures].[Store Sales] - [Measures].[Store Cost]) / [Measures].[Store Cost] * 100 > \n"
            + "     Parameter (\"UpperLimit\", NUMERIC, 151, \"Obere Grenze\"), \n"
            + "   \"|#.00%|arrow='up'\",\n"
View Full Code Here

            + "from [Sales]\n",
            s);
    }

    public void testUnparse2() {
        Connection connection = getConnection();
        Query query = connection.parseQuery(
            "with member [Measures].[Foo] as '1', "
            + "format_string='##0.00', "
            + "funny=IIf(1=1,\"x\"\"y\",\"foo\") "
            + "select {[Measures].[Foo]} on columns from Sales");
        final String s = query.toString();
View Full Code Here

            null,
            "<UserDefinedFunction name=\"SleepUdf\" className=\""
            + SleepUdf.class.getName()
            + "\"/>",
            null);
        Connection connection = tc.getConnection();

        final Query query = connection.parseQuery(queryString);
        final Throwable[] throwables = {null};
        if (waitMillis == 0) {
            // cancel immediately
            try {
                query.getStatement().cancel();
            } catch (Exception e) {
                throwables[0] = e;
            }
        } else {
            // Schedule timer to cancel after waitMillis
            Timer timer = new Timer(true);
            TimerTask task = new TimerTask()
            {
                public void run()
                {
                    Thread thread = Thread.currentThread();
                    thread.setName("CancelThread");
                    try {
                        query.getStatement().cancel();
                    } catch (Exception e) {
                        throwables[0] = e;
                    }
                }
            };
            timer.schedule(task, waitMillis);
        }
        if (throwables[0] != null) {
            Assert.fail(
                "Cancel request failed:  "
                + throwables[0]);
        }
        Throwable throwable = null;
        try {
            connection.execute(query);
        } catch (Throwable ex) {
            throwable = ex;
        }
        if (throwables[0] != null) {
            Assert.fail(
View Full Code Here

        propSaver.set(props.IterationLimit, 11);

        Throwable throwable = null;
        try {
            Connection connection = getConnection();
            Query query = connection.parseQuery(queryString);
            query.setResultStyle(ResultStyle.LIST);
            connection.execute(query);
        } catch (Throwable ex) {
            throwable = ex;
        }

        TestContext.checkThrowable(
View Full Code Here

                        throw new RuntimeException();
                    }
            });

        // We are testing the old Query API.
        final Connection connection =
            context.getConnection();
        final Query q1 =
            connection.parseQuery(mdx);
        final Query q2 =
            connection.parseQuery(mdx);

        // Some flags to test.
        final AtomicBoolean fail =
            new AtomicBoolean(false);
        final AtomicBoolean success =
            new AtomicBoolean(false);

        final Runnable r1 =
            new Runnable() {
                public void run() {
                    try {
                        connection.execute(q1);
                    } catch (Throwable t) {
                        fail.set(true);
                    }
                }
            };
        final Runnable r2 =
            new Runnable() {
                public void run() {
                    try {
                        connection.execute(q2);
                        success.set(true);
                    } catch (Throwable t) {
                        t.printStackTrace();
                    }
                }
View Full Code Here

TOP

Related Classes of mondrian.olap.Connection

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.