コード例 #1
0
  static void testScripts(String directory) {

    TestUtil.deleteDatabase("test1");

    try {
      Class.forName("org.hsqldb.jdbc.JDBCDriver");

      String url = "jdbc:hsqldb:test1;sql.enforce_strict_size=true";
      String user = "******";
      String password = "";
      Connection cConnection = null;
      String[] filelist;
      String absolute = new File(directory).getAbsolutePath();

      filelist = new File(absolute).list();

      ArraySort.sort((Object[]) filelist, 0, filelist.length, new StringComparator());

      for (int i = 0; i < filelist.length; i++) {
        String fname = filelist[i];

        if (fname.startsWith("TestSelf") && fname.endsWith(".txt")) {
          print("Openning DB");

          cConnection = DriverManager.getConnection(url, user, password);

          testScript(cConnection, absolute + File.separator + fname);
          cConnection.close();
        }
      }
    } catch (Exception e) {
      e.printStackTrace();
      print("TestUtil init error: " + e.getMessage());
    }
  }
コード例 #2
0
  protected void setUp() throws Exception {

    super.setUp();

    user = "******";
    password = "";
    stmnt = null;
    connection = null;

    TestUtil.deleteDatabase("/hsql/test/testpersistent");

    try {
      Class.forName("org.hsqldb.jdbc.JDBCDriver");

      connection = DriverManager.getConnection(url, user, password);
      stmnt = connection.createStatement();
    } catch (Exception e) {
      e.printStackTrace();
      System.out.println("TestSqlPersistence.setUp() error: " + e.getMessage());
    }
  }