[hibernate-commits] Hibernate SVN: r11353 - in trunk/Hibernate3/test/org/hibernate: test/rowid and 1 other directories.
hibernate-commits at lists.jboss.org
hibernate-commits at lists.jboss.org
Wed Mar 28 12:03:40 EDT 2007
Author: steve.ebersole at jboss.com
Date: 2007-03-28 12:03:40 -0400 (Wed, 28 Mar 2007)
New Revision: 11353
Modified:
trunk/Hibernate3/test/org/hibernate/junit/functional/ExecutionEnvironment.java
trunk/Hibernate3/test/org/hibernate/junit/functional/FunctionalTestCase.java
trunk/Hibernate3/test/org/hibernate/test/rowid/RowIdTest.java
trunk/Hibernate3/test/org/hibernate/test/tool/TestSchemaTools.java
Log:
testsuite fixes
Modified: trunk/Hibernate3/test/org/hibernate/junit/functional/ExecutionEnvironment.java
===================================================================
--- trunk/Hibernate3/test/org/hibernate/junit/functional/ExecutionEnvironment.java 2007-03-28 16:03:29 UTC (rev 11352)
+++ trunk/Hibernate3/test/org/hibernate/junit/functional/ExecutionEnvironment.java 2007-03-28 16:03:40 UTC (rev 11353)
@@ -9,6 +9,7 @@
import org.hibernate.cfg.Environment;
import org.hibernate.cfg.Mappings;
import org.hibernate.SessionFactory;
+import org.hibernate.engine.SessionFactoryImplementor;
import org.hibernate.mapping.PersistentClass;
import org.hibernate.mapping.Property;
import org.hibernate.mapping.SimpleValue;
@@ -84,7 +85,7 @@
this.configuration = configuration;
this.sessionFactory = sessionFactory;
- settings.afterSessionFactoryBuilt();
+ settings.afterSessionFactoryBuilt( ( SessionFactoryImplementor ) sessionFactory );
}
private void applyMappings(Configuration configuration) {
@@ -125,11 +126,6 @@
}
}
- protected void afterSessionFactoryBuilt() {
- // for subclasses to override in order to perform extra "stuff" only
- // when SF (re)built...
- }
-
public void rebuild() {
if ( !allowRebuild ) {
return;
@@ -139,7 +135,7 @@
sessionFactory = null;
}
sessionFactory = configuration.buildSessionFactory();
- afterSessionFactoryBuilt();
+ settings.afterSessionFactoryBuilt( ( SessionFactoryImplementor ) sessionFactory );
}
public void complete() {
@@ -158,7 +154,7 @@
public void configure(Configuration cfg);
public boolean overrideCacheStrategy();
public String getCacheConcurrencyStrategy();
- public void afterSessionFactoryBuilt();
+ public void afterSessionFactoryBuilt(SessionFactoryImplementor sfi);
public void afterConfigurationBuilt(Mappings mappings, Dialect dialect);
public boolean appliesTo(Dialect dialect);
}
Modified: trunk/Hibernate3/test/org/hibernate/junit/functional/FunctionalTestCase.java
===================================================================
--- trunk/Hibernate3/test/org/hibernate/junit/functional/FunctionalTestCase.java 2007-03-28 16:03:29 UTC (rev 11352)
+++ trunk/Hibernate3/test/org/hibernate/junit/functional/FunctionalTestCase.java 2007-03-28 16:03:40 UTC (rev 11353)
@@ -213,7 +213,7 @@
return "nonstrict-read-write";
}
- public void afterSessionFactoryBuilt() {
+ public void afterSessionFactoryBuilt(SessionFactoryImplementor sfi) {
}
public void afterConfigurationBuilt(Mappings mappings, Dialect dialect) {
Modified: trunk/Hibernate3/test/org/hibernate/test/rowid/RowIdTest.java
===================================================================
--- trunk/Hibernate3/test/org/hibernate/test/rowid/RowIdTest.java 2007-03-28 16:03:29 UTC (rev 11352)
+++ trunk/Hibernate3/test/org/hibernate/test/rowid/RowIdTest.java 2007-03-28 16:03:40 UTC (rev 11353)
@@ -9,6 +9,7 @@
import org.hibernate.Session;
import org.hibernate.Transaction;
+import org.hibernate.engine.SessionFactoryImplementor;
import org.hibernate.dialect.Oracle9Dialect;
import org.hibernate.dialect.Dialect;
import org.hibernate.junit.functional.FunctionalTestClassTestSuite;
@@ -43,23 +44,33 @@
return false;
}
- public void afterSessionFactoryBuilt() {
- super.afterSessionFactoryBuilt();
+ public void afterSessionFactoryBuilt(SessionFactoryImplementor sfi) {
+ super.afterSessionFactoryBuilt( sfi );
+ Session session = null;
try {
- Session s = openSession();
- Statement st = s.connection().createStatement();
+ session = sfi.openSession();
+ Statement st = session.connection().createStatement();
try {
st.execute( "drop table Point");
}
- catch( Throwable t ) {
+ catch( Throwable ignore ) {
// ignore
}
st.execute("create table Point (\"x\" number(19,2) not null, \"y\" number(19,2) not null, description varchar2(255) )");
- s.close();
}
catch ( SQLException e ) {
throw new RuntimeException( "Unable to build actual schema : " + e.getMessage() );
}
+ finally {
+ if ( session != null ) {
+ try {
+ session.close();
+ }
+ catch( Throwable ignore ) {
+ // ignore
+ }
+ }
+ }
}
public void testRowId() {
Modified: trunk/Hibernate3/test/org/hibernate/test/tool/TestSchemaTools.java
===================================================================
--- trunk/Hibernate3/test/org/hibernate/test/tool/TestSchemaTools.java 2007-03-28 16:03:29 UTC (rev 11352)
+++ trunk/Hibernate3/test/org/hibernate/test/tool/TestSchemaTools.java 2007-03-28 16:03:40 UTC (rev 11353)
@@ -8,6 +8,7 @@
import org.hibernate.HibernateException;
import org.hibernate.Session;
+import org.hibernate.engine.SessionFactoryImplementor;
import org.hibernate.dialect.Dialect;
import org.hibernate.dialect.HSQLDialect;
import org.hibernate.junit.functional.DatabaseSpecificFunctionalTestCase;
@@ -41,22 +42,29 @@
return false;
}
-
- public void afterSessionFactoryBuilt() {
- super.afterSessionFactoryBuilt();
+ public void afterSessionFactoryBuilt(SessionFactoryImplementor sfi) {
+ super.afterSessionFactoryBuilt( sfi );
+ Session session = null;
try {
- Session session = openSession();
- Connection conn = session.connection();
- Statement stat = conn.createStatement();
+ session = sfi.openSession();
+ Statement stat = session.connection().createStatement();
stat.execute("CREATE SCHEMA sb AUTHORIZATION DBA ");
stat.execute(" CREATE SCHEMA sa AUTHORIZATION DBA ");
stat.execute(" CREATE TABLE \"SA\".\"Team\" (test INTEGER) ");
stat.close();
- conn.close();
}
catch ( SQLException e ) {
throw new RuntimeException( "could not prepare additional schemas" );
}
+ finally {
+ if ( session != null ) {
+ try {
+ session.close();
+ }
+ catch( Throwable ignore ) {
+ }
+ }
+ }
}
protected void prepareTest() throws Exception {
More information about the hibernate-commits
mailing list