KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > hibernate > test > annotations > SecuredBindingTest


1 //$Id: SecuredBindingTest.java,v 1.1 2005/05/12 13:33:52 epbernard Exp $
2
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 JavaDoc;
11
12 /**
13  * @author Emmanuel Bernard
14  */

15 public class SecuredBindingTest extends TestCase {
16
17     public SecuredBindingTest(String JavaDoc x) {
18         super(x);
19     }
20
21     public void testConfigurationMethods() throws Exception JavaDoc {
22         AnnotationConfiguration ac = new AnnotationConfiguration();
23         Properties JavaDoc p = new Properties JavaDoc();
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             //success
39
}
40
41     }
42 }
43
44
Popular Tags