1 26 27 29 package de.nava.informa.utils; 30 31 import java.io.InputStream ; 32 import java.util.Properties ; 33 34 import net.sf.hibernate.Session; 35 36 import org.apache.commons.logging.Log; 37 import org.apache.commons.logging.LogFactory; 38 39 import de.nava.informa.impl.hibernate.SessionHandler; 40 41 47 public class InformaHibernateTestCase extends InformaTestCase { 48 49 private static Log logger = LogFactory.getLog(InformaHibernateTestCase.class); 50 51 56 public static final String PROP_FILENAME = "/hibernate-unittest.properties"; 57 58 protected static SessionHandler sessionHandler; 59 protected Session session; 60 61 public InformaHibernateTestCase(String testcase_name, String method_name) { 62 super(testcase_name, method_name); 63 } 64 65 public void setUp() throws Exception { 66 super.setUp(); 67 if (sessionHandler == null) { 68 Properties props = new Properties (); 70 InputStream in = this.getClass().getResourceAsStream(PROP_FILENAME); 71 if (in != null) 72 props.load(in); 73 else 74 logger.warn("No test properties file (" + PROP_FILENAME + 75 ") found in CLASSPATH."); 76 sessionHandler = SessionHandler.getInstance(props); 78 } 79 session = sessionHandler.getSession(); 80 } 81 82 public void tearDown() throws Exception { 83 session.close(); 84 super.tearDown(); 85 } 86 87 } 88 | Popular Tags |