[hibernate-commits] Hibernate SVN: r10433 - branches/Branch_3_2/Hibernate3/test/org/hibernate/test/dynamicentity/interceptor

hibernate-commits at lists.jboss.org hibernate-commits at lists.jboss.org
Fri Sep 1 17:49:17 EDT 2006


Author: steve.ebersole at jboss.com
Date: 2006-09-01 17:49:16 -0400 (Fri, 01 Sep 2006)
New Revision: 10433

Modified:
   branches/Branch_3_2/Hibernate3/test/org/hibernate/test/dynamicentity/interceptor/InterceptorDynamicEntityTest.java
Log:
test data cleanup

Modified: branches/Branch_3_2/Hibernate3/test/org/hibernate/test/dynamicentity/interceptor/InterceptorDynamicEntityTest.java
===================================================================
--- branches/Branch_3_2/Hibernate3/test/org/hibernate/test/dynamicentity/interceptor/InterceptorDynamicEntityTest.java	2006-09-01 21:48:54 UTC (rev 10432)
+++ branches/Branch_3_2/Hibernate3/test/org/hibernate/test/dynamicentity/interceptor/InterceptorDynamicEntityTest.java	2006-09-01 21:49:16 UTC (rev 10433)
@@ -6,6 +6,7 @@
 import org.hibernate.test.dynamicentity.ProxyHelper;
 import org.hibernate.Session;
 import org.hibernate.Hibernate;
+import org.hibernate.cfg.Configuration;
 import junit.framework.TestSuite;
 
 /**
@@ -22,7 +23,7 @@
  *
  * @see ProxyInterceptor
  *
- * @author <a href="mailto:steve at hibernate.org">Steve Ebersole </a>
+ * @author Steve Ebersole
  */
 public class InterceptorDynamicEntityTest extends TestCase {
 	public InterceptorDynamicEntityTest(String x) {
@@ -37,9 +38,13 @@
 		return new TestSuite( InterceptorDynamicEntityTest.class );
 	}
 
+	protected void configure(Configuration cfg) {
+		cfg.setInterceptor( new ProxyInterceptor() );
+	}
+
 	public void testIt() {
 		// Test saving these dyna-proxies
-		Session session = openSession( new ProxyInterceptor() );
+		Session session = openSession();
 		session.beginTransaction();
 		Company company = ProxyHelper.newCompanyProxy();
 		company.setName( "acme" );
@@ -55,7 +60,7 @@
 		assertNotNull( "customer id not assigned", customer.getId() );
 
 		// Test loading these dyna-proxies, along with flush processing
-		session = openSession( new ProxyInterceptor() );
+		session = openSession();
 		session.beginTransaction();
 		customer = ( Customer ) session.load( Customer.class, customer.getId() );
 		assertFalse( "should-be-proxy was initialized", Hibernate.isInitialized( customer ) );
@@ -73,7 +78,7 @@
 
 		// Test detached entity re-attachment with these dyna-proxies
 		customer.setName( "Steve" );
-		session = openSession( new ProxyInterceptor() );
+		session = openSession();
 		session.beginTransaction();
 		session.update( customer );
 		session.flush();
@@ -83,7 +88,7 @@
 		session.close();
 
 		// Test querying
-		session = openSession( new ProxyInterceptor() );
+		session = openSession();
 		session.beginTransaction();
 		int count = session.createQuery( "from Customer" ).list().size();
 		assertEquals( "querying dynamic entity", 1, count );
@@ -92,5 +97,14 @@
 		assertEquals( "querying dynamic entity", 1, count );
 		session.getTransaction().commit();
 		session.close();
+
+		// test deleteing
+		session = openSession();
+		session.beginTransaction();
+		session.delete( company );
+		session.delete( customer );
+		session.getTransaction().commit();
+		session.close();
 	}
+
 }




More information about the hibernate-commits mailing list