1 package org.hibernate.test.annotations; 3 4 import junit.framework.TestCase; 5 import org.hibernate.HibernateException; 6 import org.hibernate.SessionFactory; 7 import org.hibernate.cfg.AnnotationConfiguration; 8 import org.hibernate.cfg.Environment; 9 10 import java.util.Properties ; 11 12 15 public class SecuredBindingTest extends TestCase { 16 17 public SecuredBindingTest(String x) { 18 super(x); 19 } 20 21 public void testConfigurationMethods() throws Exception { 22 AnnotationConfiguration ac = new AnnotationConfiguration(); 23 Properties p = new Properties (); 24 p.put(Environment.DIALECT, "org.hibernate.dialect.HSQLDialect"); 25 p.put("hibernate.connection.driver_class", "org.hsqldb.jdbcDrive"); 26 p.put("hibernate.connection.url", "jdbc:hsqldb:."); 27 p.put("hibernate.connection.username", "sa"); 28 p.put("hibernate.connection.password", ""); 29 p.put("hibernate.show_sql", "true"); 30 ac.setProperties(p); 31 ac.addAnnotatedClass(Plane.class); 32 SessionFactory sf; 33 try { 34 sf = ac.buildSessionFactory(); 35 fail("Driver property overriding should work"); 36 sf.close(); 37 } catch (HibernateException he) { 38 } 40 41 } 42 } 43 44 | Popular Tags |