Package org.h2.tools

Examples of org.h2.tools.Console.shutdown()


            // start including browser
            lastUrl = "-";
            System.setProperty(SysProperties.H2_BROWSER, "call:" + TestTools.class.getName() + ".openBrowser");
            c.runTool("-web", "-webPort", "9002", "-tool", "-browser", "-tcp", "-tcpPort", "9003", "-pg", "-pgPort", "9004");
            assertContains(lastUrl, ":9002");
            c.shutdown();

            // check if starting the browser works
            c.runTool("-web", "-webPort", "9002", "-tool");
            lastUrl = "-";
            c.actionPerformed(new ActionEvent(this, 0, "console"));
View Full Code Here


            c.actionPerformed(new ActionEvent(this, 0, "status"));
            c.actionPerformed(new ActionEvent(this, 0, "exit"));

            // check if the service was stopped
            c.runTool("-webPort", "9002");
            c.shutdown();

            // trying to use the same port for two services should fail,
            // but also stop the first service
            createClassProxy(c.getClass());
            assertThrows(ErrorCode.EXCEPTION_OPENING_PORT_2, c).
View Full Code Here

            // but also stop the first service
            createClassProxy(c.getClass());
            assertThrows(ErrorCode.EXCEPTION_OPENING_PORT_2, c).
                    runTool("-web", "-webPort", "9002", "-tcp", "-tcpPort", "9002");
            c.runTool("-web", "-webPort", "9002");
            c.shutdown();

        } finally {
            if (old != null) {
                System.setProperty(SysProperties.H2_BROWSER, old);
            } else {
View Full Code Here

        conn = DriverManager.getConnection("jdbc:h2:tcp://localhost:9006/mem:", "sa", "sa");
        conn.close();

        result = runServer(0, new String[]{"-tcpShutdown", "tcp://localhost:9006", "-tcpPassword", "abc", "-tcpShutdownForce"});
        assertTrue(result.indexOf("Shutting down") >= 0);
        stop.shutdown();
        assertThrows(ErrorCode.CONNECTION_BROKEN_1, this).
                getConnection("jdbc:h2:tcp://localhost:9006/mem:", "sa", "sa");
    }

    private String runServer(int exitCode, String... args) {
View Full Code Here

                    ",-user," + getUser() + ",-password," + getPassword());
            IOUtils.delete(getBaseDir() + "/web.h2.sql");
            assertTrue(IOUtils.exists(getBaseDir() + "/web.h2.db"));
            deleteDb("web");
        } finally {
            server.shutdown();
        }
    }

    private void testTransfer() throws Exception {
        Server server = new Server();
View Full Code Here

            client.upload(url + "/transfer/testUpload.txt", "testUpload.txt", new ByteArrayInputStream("Hallo Welt".getBytes()));
            byte[] d = IOUtils.readBytesAndClose(new FileInputStream("transfer/testUpload.txt"), -1);
            assertEquals("Hallo Welt", new String(d));
            new File("transfer/testUpload.txt").delete();
        } finally {
            server.shutdown();
            IOUtils.deleteRecursive("transfer", true);
        }
    }

    private void testServer() throws Exception {
View Full Code Here

            } catch (IOException e) {
                // expected
                Thread.sleep(1000);
            }
        } finally {
            server.shutdown();
        }
        // it should be stopped now
        server = Server.createTcpServer("-tcpPort", "9101");
        server.start();
        server.stop();
View Full Code Here

            result = client.get(url, "logout.do");
            result = client.get(url, "settingRemove.do?name=_test_");

            client.get(url, "admin.do");
        } finally {
            server.shutdown();
        }
    }

    private void testStartWebServerWithConnection() throws Exception {
        String old = System.getProperty(SysProperties.H2_BROWSER);
View Full Code Here

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

        final Server h2TestDb = (Server) context.getAttribute(H2_TESTDB);
        if (h2TestDb != null) {
            h2TestDb.shutdown();
        }
    }
}
View Full Code Here

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

        final Server h2TestDb = (Server) context.getAttribute(H2_TESTDB);
        if (h2TestDb != null) {
            h2TestDb.shutdown();
        }
    }
}
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.