Package org.h2.tools

Examples of org.h2.tools.RunScript.runTool()


    }

    private void testWebApp() throws Exception {
        Server server = new Server();
        server.setOut(new PrintStream(new ByteArrayOutputStream()));
        server.runTool("-web", "-webPort", "8182", "-properties", "null", "-tcp", "-tcpPort", "9101");
        try {
            String url = "http://localhost:8182";
            WebClient client;
            String result;
            client = new WebClient();
View Full Code Here


    public void contextInitialized(final ServletContextEvent sce) {
        final ServletContext context = sce.getServletContext();

        try {
            final Server h2TestDb = new Server();
            h2TestDb.runTool("-tcp", "-tcpDaemon", "-web", "-webDaemon",
                    "-webPort", sce.getServletContext().getInitParameter("testdb.webport"));

            context.setAttribute(H2_TESTDB, h2TestDb);
        } catch (SQLException e) {
            LOG.error("Could not start H2 test db", e);
View Full Code Here

        final ServletContext context = sce.getServletContext();

        final File workDir = (File) sce.getServletContext().getAttribute("javax.servlet.context.tempdir");
        try {
            final Server h2TestDb = new Server();
            h2TestDb.runTool("-baseDir", workDir.getAbsolutePath(), "-tcp", "-tcpDaemon", "-web", "-webDaemon",
                    "-webPort", sce.getServletContext().getInitParameter("testdb.webport"));

            context.setAttribute(H2_TESTDB, h2TestDb);
        } catch (SQLException e) {
            LOG.error("Could not start H2 test db", e);
View Full Code Here

        ServletContext context = sce.getServletContext();

        File workDir = (File) sce.getServletContext().getAttribute("javax.servlet.context.tempdir");
        try {
            Server h2TestDb = new Server();
            h2TestDb.runTool("-baseDir", workDir.getAbsolutePath(), "-tcp", "-tcpDaemon", "-web", "-webDaemon",
                    "-webPort", sce.getServletContext().getInitParameter("testdb.webport"));

            context.setAttribute(H2_TESTDB, h2TestDb);
        } catch (SQLException e) {
            LOG.error("Could not start H2 test db", e);
View Full Code Here

    public void contextInitialized(final ServletContextEvent sce) {
        final ServletContext context = sce.getServletContext();

        try {
            final Server h2TestDb = new Server();
            h2TestDb.runTool("-tcp", "-tcpDaemon", "-web", "-webDaemon",
                    "-webPort", sce.getServletContext().getInitParameter("testdb.webport"));

            context.setAttribute(H2_TESTDB, h2TestDb);
        } catch (SQLException e) {
            LOG.error("Could not start H2 test db", e);
View Full Code Here

    public void test() throws Exception {
        Shell shell = new Shell();
        ByteArrayOutputStream buff = new ByteArrayOutputStream();
        shell.setOut(new PrintStream(buff));
        shell.runTool("-url", "jdbc:h2:mem:", "-driver", "org.h2.Driver",
                "-user", "sa", "-password", "sa", "-properties", "null", "-sql", "select 'Hello ' || 'World' as hi");
        String s = new String(buff.toByteArray());
        assertContains(s, "HI");
        assertContains(s, "Hello World");
        assertContains(s, "(1 row, ");
View Full Code Here

        assertContains(s, "(1 row, ");

        shell = new Shell();
        buff = new ByteArrayOutputStream();
        shell.setOut(new PrintStream(buff));
        shell.runTool("-help");
        s = new String(buff.toByteArray());
        assertContains(s, "Interactive command line tool to access a database using JDBC.");

        test(true);
        test(false);
View Full Code Here

                    Shell shell = new Shell();
                    shell.setIn(toolIn);
                    shell.setOut(toolOut);
                    shell.setErr(toolOut);
                    if (commandLineArgs) {
                        shell.runTool("-url", "jdbc:h2:mem:",
                                "-user", "sa", "-password", "sa");
                    } else {
                        shell.runTool();
                    }
                } finally {
View Full Code Here

                    shell.setErr(toolOut);
                    if (commandLineArgs) {
                        shell.runTool("-url", "jdbc:h2:mem:",
                                "-user", "sa", "-password", "sa");
                    } else {
                        shell.runTool();
                    }
                } finally {
                    toolOut.close();
                }
            }
View Full Code Here

            }
            ByteArrayOutputStream outBuff = new ByteArrayOutputStream();
            PrintStream out = new PrintStream(outBuff, false, "UTF-8");
            tool.setOut(out);
            try {
                tool.runTool(argList);
                out.flush();
                String o = new String(outBuff.toByteArray(), "UTF-8");
                String result = PageParser.escapeHtml(o);
                session.put("toolResult", result);
            } catch (Exception e) {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.