Java Code Examples for org.hsqldb.Server#setSilent()

The following examples show how to use org.hsqldb.Server#setSilent() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JqmBaseTest.java    From jqm with Apache License 2.0 6 votes vote down vote up
@BeforeClass
public static void testInit() throws Exception
{
    if (db == null)
    {
        JndiContext.createJndiContext();

        // If needed, create an HSQLDB server.
        String dbName = System.getenv("DB");
        if (dbName == null || "hsqldb".equals(dbName))
        {
            s = new Server();
            s.setDatabaseName(0, "testdbengine");
            s.setDatabasePath(0, "mem:testdbengine");
            s.setLogWriter(null);
            s.setSilent(true);
            s.start();
        }

        // In all cases load the datasource. (the helper itself will load the property file if any).
        db = Helpers.getDb();
    }
}
 
Example 2
Source File: HsqldbListener.java    From lemon with Apache License 2.0 6 votes vote down vote up
/**
 * 处理context初始化事件.
 * 
 * @param sce
 *            ServletContextEvent
 */
public void contextInitialized(ServletContextEvent sce) {
    if (!enabled) {
        logger.info("skip hsqldb server");

        return;
    }

    try {
        String databasePath = path + "/" + databaseName;
        url = "jdbc:hsqldb:hsql://localhost:" + port + "/" + databaseName;

        Server server = new Server();
        server.setDatabaseName(0, databaseName);

        server.setDatabasePath(0, databasePath);
        server.setPort(port);
        server.setSilent(true);
        server.start();
        Thread.sleep(WAIT_TIME);
    } catch (InterruptedException ex) {
        logger.error(ex.getMessage(), ex);
    }
}
 
Example 3
Source File: HsqldbServer.java    From lemon with Apache License 2.0 6 votes vote down vote up
@PostConstruct
public void init() {
    if (!enabled) {
        logger.info("skip hsqldb server");

        return;
    }

    try {
        String databasePath = path + "/" + databaseName;
        url = "jdbc:hsqldb:hsql://localhost:" + port + "/" + databaseName;

        Server server = new Server();
        server.setDatabaseName(0, databaseName);

        server.setDatabasePath(0, databasePath);
        server.setPort(port);
        server.setSilent(true);
        server.start();
        Thread.sleep(WAIT_TIME);
    } catch (InterruptedException ex) {
        logger.error(ex.getMessage(), ex);
    }
}
 
Example 4
Source File: AbstractHsqldbMojo.java    From hsqldb-maven-plugin with Apache License 2.0 5 votes vote down vote up
protected void setup() throws MojoExecutionException {
    if (getLog().isDebugEnabled()) {
        getLog().debug("Setting up HSQLDB server with :");
        getLog().debug("\taddress : " + address);
        getLog().debug("\tport : " + (port == 0 ? "default" : port));
        getLog().debug("\tname : " + name);
        getLog().debug("\tpath : " + path);
        getLog().debug("\tconnection URI : " + getConnectionURI());
        getLog().debug("\tdriver : " + driver);
        getLog().debug("\tvalidation query : " + validationQuery);
        getLog().debug("\tskip : " + skip);
    }
    try {
        server = new Server();

        // TODO : user Maven logger
        server.setLogWriter(null);
        server.setSilent(true);
        
        server.setAddress(address);
        if (port > 0) {
            server.setPort(port);
        }
        server.setDatabaseName(0, name);
        server.setDatabasePath(0, path);
    } catch (Exception e) {
        throw new MojoExecutionException(e.getMessage(), e);
    }
}
 
Example 5
Source File: Common.java    From jqm with Apache License 2.0 5 votes vote down vote up
static Server createHsqlServer()
{
    Server s = new Server();
    String dbName = "testdb_" + Math.random();
    s.setDatabaseName(0, dbName);
    s.setDatabasePath(0, "mem:" + dbName);
    s.setLogWriter(null);
    s.setSilent(true);
    return s;
}