1 58 59 60 61 62 63 package org.hsqldb.test; 64 65 import java.sql.Connection ; 66 import java.sql.DriverManager ; 67 68 import org.hsqldb.Server; 69 70 import junit.framework.TestCase; 71 72 79 public abstract class TestBugBase extends TestCase { 80 81 String serverProps = "database.0=mem:test"; 84 String url = "jdbc:hsqldb:hsql://localhost"; 85 String user = "sa"; 86 String password = ""; 87 Server server; 88 89 public TestBugBase(String name) { 90 super(name); 91 } 92 93 protected void setUp() { 94 95 server = new Server(); 96 97 server.putPropertiesFromString(serverProps); 98 server.setLogWriter(null); 99 server.setErrWriter(null); 100 server.start(); 101 102 try { 103 Class.forName("org.hsqldb.jdbcDriver"); 104 } catch (Exception e) { 105 e.printStackTrace(); 106 System.out.println(this + ".setUp() error: " + e.getMessage()); 107 } 108 } 109 110 protected void tearDown() { 111 112 server.stop(); 113 114 server = null; 115 } 116 117 Connection newConnection() throws Exception { 118 return DriverManager.getConnection(url, user, password); 119 } 120 121 public abstract void test() throws Exception ; 122 } 123 | Popular Tags |