Package org.hsqldb

Examples of org.hsqldb.Server$ServerThread


        super(name);
    }

    protected void setUp() {

        server = new Server();

        server.putPropertiesFromString(serverProps);
        server.setLogWriter(null);
        server.setErrWriter(null);
        server.start();
View Full Code Here


    } catch (RuntimeException re) {
      LOG.info("Server is already started.");
      return;
    }

    server = new Server();
    server.setDatabasePath(0, "file:" + fileLocation);
    server.setDatabaseName(0, "sqoop");
    server.putPropertiesFromString("hsqldb.write_delay=false");
    server.setPort(port);
    server.setSilent(true);
View Full Code Here

    if (null == server) {
      LOG.info("Starting new hsqldb server; database=" + DATABASE_NAME);
      String tmpDir = System.getProperty("test.build.data", "/tmp/");
      String dbLocation = tmpDir + "/sqoop/testdb.file";
      if (inMemoryDB) {dbLocation = IN_MEM; }
      server = new Server();

      server.setDatabaseName(0, DATABASE_NAME);
      server.putPropertiesFromString("database.0=" + dbLocation
          + ";no_system_exit=true");
      server.start();
View Full Code Here

  private boolean startHsqldb = true;

  private void startHsqldbServer() {
    log.info("Starting HSQLDB server");
    server = new Server();
    server.setDatabasePath(0,
        System.getProperty("test.build.data", "/tmp") + "/goratest");
    server.setDatabaseName(0, "goratest");
    server.setDaemon(true);
    server.setPort(Integer.parseInt(HSQLDB_PORT));
View Full Code Here

    OUT_DIR = System.getProperty("test.build.data", "/tmp") + "/dddbifout";
  }

  private void startHsqldbServer() {
    if (null == server) {
      server = new Server();
      server.setDatabasePath(0,
          System.getProperty("test.build.data", "/tmp") + "/" + DB_NAME);
      server.setDatabaseName(0, DB_NAME);
      server.start();
    }
View Full Code Here

  private static final String DRIVER_CLASS = "org.hsqldb.jdbcDriver";
 
  private Server server;
 
  private void startHsqldbServer() {
    server = new Server();
    server.setDatabasePath(0,
        System.getProperty("test.build.data",".") + "/URLAccess");
    server.setDatabaseName(0, "URLAccess");
    server.start();
  }
View Full Code Here

   */
  public void testMultiProcess() throws Exception {
    // create and start a hsql server, a stand-alone (memory backed) db
    // (important: a stand-alone server should be used because simple
    //  file based access i.e. jdbc:hsqldb:file is NOT process-safe.)
    Server server = new Server();
    server.setDaemon(true);
    server.setSilent(true); // disables LOTS of trace
    final String className = getClass().getName();
    String dbName = "test";
    server.setDatabasePath(0, "mem:"+dbName);
    server.setDatabaseName(0, dbName);
    server.start();
   
    //create the store so that the tests can start right away
    StorageUtils.createWebStore(conf, String.class, WebPage.class);
   
    // create a fixed thread pool
    int numThreads = 4;
    ExecutorService pool = Executors.newFixedThreadPool(numThreads);
   
    // spawn multiple processes, each thread spawns own process
    Collection<Callable<Integer>> tasks = new ArrayList<Callable<Integer>>();
    for (int i = 0; i < numThreads; i++) {
      tasks.add(new Callable<Integer>() {
        @Override
        public Integer call() {
          try {
            String separator = System.getProperty("file.separator");
            String classpath = System.getProperty("java.class.path");
            String pathSeparator = System.getProperty("path.separator");
            // connect local sql service
            classpath = "./src/testprocess" + pathSeparator + classpath;
            String path = System.getProperty("java.home") + separator + "bin"
                + separator + "java";
            ProcessBuilder processBuilder = new ProcessBuilder(path, "-cp",
                classpath, className);
            processBuilder.redirectErrorStream(true);
            Process process = processBuilder.start();
            InputStream in = process.getInputStream();
            int exit = process.waitFor();
            //print the output of the process
            System.out.println("===Process stream for " + Thread.currentThread()
                + "\n" + IOUtils.toString(in) + "===End of process stream.");
            in.close();
            // process should exit with zero code
            return exit;
          } catch (Exception e) {
            e.printStackTrace();
            // this will fail the test
            return 1;
          }
        }
      });
    }

    // submit them at once
    List<Future<Integer>> results = pool.invokeAll(tasks);

    // check results
    for (Future<Integer> result : results) {
      assertEquals(0, (int) result.get());
    }
   
    //stop db
    server.stop();
  }
View Full Code Here

            } catch (NameNotFoundException e) {
                //Ignore
            }

            // create the server
            server = new Server();
            // add the silent property
            properties.setProperty(sc_key_silent, "true");
            // set the log and error writers
            server.setLogWriter(new HsqlPrintWriter(false));
            server.setErrWriter(new HsqlPrintWriter(true));
View Full Code Here

        .setProperty("mapred.map.max.attempts", "1");
    pigServer.getPigContext().getProperties()
        .setProperty("mapred.reduce.max.attempts", "1");
    System.out.println("Pig server initialized successfully");
    // Initialise DBServer
    dbServer = new Server();
    dbServer.setDatabaseName(0, "batchtest");
    // dbServer.setDatabasePath(0, "mem:test;sql.enforce_strict_size=true");
    dbServer.setDatabasePath(0,
        "file:/tmp/batchtest;sql.enforce_strict_size=true");
    dbServer.setLogWriter(null);
View Full Code Here

            } catch (NameNotFoundException e) {
                //Ignore
            }

            // create the server
            server = new Server();
            // add the silent property
            properties.setProperty(sc_key_silent, "true");
            // set the log and error writers
            server.setLogWriter(new HsqlPrintWriter(false));
            server.setErrWriter(new HsqlPrintWriter(true));
View Full Code Here

TOP

Related Classes of org.hsqldb.Server$ServerThread

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.