| 1 23 24 package com.rift.coad.daemon.hsqldb; 26 27 import java.util.Hashtable ; 29 import javax.naming.Context ; 30 import javax.naming.InitialContext ; 31 import javax.rmi.PortableRemoteObject ; 32 import java.sql.DriverManager ; 33 import java.sql.Connection ; 34 35 import junit.framework.*; 37 38 43 public class TestHsqlDBEngineImpl extends TestCase { 44 45 48 public class DBRunner extends Thread { 49 private HsqlDBEngineImpl instance = null; 51 52 55 public DBRunner(HsqlDBEngineImpl instance) { 56 this.instance = instance; 57 } 58 59 60 63 public void run() { 64 instance.process(); 65 } 66 } 67 68 public TestHsqlDBEngineImpl(String testName) { 69 super(testName); 70 } 71 72 protected void setUp() throws Exception { 73 } 74 75 protected void tearDown() throws Exception { 76 } 77 78 81 public void testHSQLDBEngine() throws Exception { 82 HsqlDBEngineImpl instance = new HsqlDBEngineImpl(); 83 DBRunner runner = new DBRunner(instance); 84 runner.start(); 85 86 System.out.println("Name : " + instance.getDatabaseName(0,true)); 87 System.out.println("Path : " + instance.getDatabasePath(0,true)); 88 89 Class.forName("org.hsqldb.jdbcDriver"); 90 91 Connection connection = DriverManager.getConnection( 92 "jdbc:hsqldb:hsql://localhost/coadunation","sa",""); 93 connection.close(); 94 instance.terminate(); 95 96 try { 97 connection = DriverManager.getConnection( 98 "jdbc:hsqldb:hsql://localhost/coadunation","sa",""); 99 fail("Could still make a connection to the database"); 100 } catch (java.sql.SQLException ex) { 101 } 103 } 104 105 } 106 | Popular Tags |