From hibernate-commits at lists.jboss.org Fri Sep 1 17:48:55 2006 Content-Type: multipart/mixed; boundary="===============0006056669516029908==" MIME-Version: 1.0 From: hibernate-commits at lists.jboss.org To: hibernate-commits at lists.jboss.org Subject: [hibernate-commits] Hibernate SVN: r10432 - trunk/Hibernate3/test/org/hibernate/test/dynamicentity/interceptor Date: Fri, 01 Sep 2006 17:48:55 -0400 Message-ID: --===============0006056669516029908== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: steve.ebersole(a)jboss.com Date: 2006-09-01 17:48:54 -0400 (Fri, 01 Sep 2006) New Revision: 10432 Modified: trunk/Hibernate3/test/org/hibernate/test/dynamicentity/interceptor/Inter= ceptorDynamicEntityTest.java Log: test data cleanup Modified: trunk/Hibernate3/test/org/hibernate/test/dynamicentity/intercepto= r/InterceptorDynamicEntityTest.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/Hibernate3/test/org/hibernate/test/dynamicentity/interceptor/Inte= rceptorDynamicEntityTest.java 2006-09-01 21:41:03 UTC (rev 10431) +++ trunk/Hibernate3/test/org/hibernate/test/dynamicentity/interceptor/Inte= rceptorDynamicEntityTest.java 2006-09-01 21:48:54 UTC (rev 10432) @@ -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 Steve Ebersole + * @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 =3D openSession( new ProxyInterceptor() ); + Session session =3D openSession(); session.beginTransaction(); Company company =3D 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 =3D openSession( new ProxyInterceptor() ); + session =3D openSession(); session.beginTransaction(); customer =3D ( 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 =3D openSession( new ProxyInterceptor() ); + session =3D openSession(); session.beginTransaction(); session.update( customer ); session.flush(); @@ -83,7 +88,7 @@ session.close(); = // Test querying - session =3D openSession( new ProxyInterceptor() ); + session =3D openSession(); session.beginTransaction(); int count =3D 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 =3D openSession(); + session.beginTransaction(); + session.delete( company ); + session.delete( customer ); + session.getTransaction().commit(); + session.close(); } + } --===============0006056669516029908==--