[hibernate-commits] Hibernate SVN: r15220 - in core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/instrument: cases and 1 other directory.

hibernate-commits at lists.jboss.org hibernate-commits at lists.jboss.org
Fri Sep 26 14:37:26 EDT 2008


Author: jcosta at redhat.com
Date: 2008-09-26 14:37:26 -0400 (Fri, 26 Sep 2008)
New Revision: 15220

Modified:
   core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/instrument/buildtime/InstrumentTest.java
   core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/instrument/cases/Executable.java
   core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/instrument/cases/TestLazyPropertyCustomTypeExecutable.java
Log:
HHH-3498 - Fixed in branch 3_2_4_SP1_CP

Modified: core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/instrument/buildtime/InstrumentTest.java
===================================================================
--- core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/instrument/buildtime/InstrumentTest.java	2008-09-25 22:10:46 UTC (rev 15219)
+++ core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/instrument/buildtime/InstrumentTest.java	2008-09-26 18:37:26 UTC (rev 15220)
@@ -30,7 +30,7 @@
 		return new TestSuite( InstrumentTest.class );
 	}
 
-	public void testDirtyCheck() {
+	public void testDirtyCheck() throws Exception {
 		execute( new TestDirtyCheckExecutable() );
 	}
 
@@ -42,27 +42,27 @@
 		execute( new TestLazyExecutable() );
 	}
 
-	public void testLazyManyToOne() {
+	public void testLazyManyToOne() throws Exception {
 		execute( new TestLazyManyToOneExecutable() );
 	}
 
-	public void testSetFieldInterceptor() {
+	public void testSetFieldInterceptor() throws Exception {
 		execute( new TestInjectFieldInterceptorExecutable() );
 	}
 
-	public void testPropertyInitialized() {
+	public void testPropertyInitialized() throws Exception {
 		execute( new TestIsPropertyInitializedExecutable() );
 	}
 
-	public void testManyToOneProxy() {
+	public void testManyToOneProxy() throws Exception {
 		execute( new TestManyToOneProxyExecutable() );
 	}
 
-	public void testLazyPropertyCustomTypeExecutable() {
+	public void testLazyPropertyCustomTypeExecutable() throws Exception {
 		execute( new TestLazyPropertyCustomTypeExecutable() );
 	}
 
-	private void execute(Executable executable) {
+	private void execute(Executable executable) throws Exception {
 		executable.prepare();
 		try {
 			executable.execute();

Modified: core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/instrument/cases/Executable.java
===================================================================
--- core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/instrument/cases/Executable.java	2008-09-25 22:10:46 UTC (rev 15219)
+++ core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/instrument/cases/Executable.java	2008-09-26 18:37:26 UTC (rev 15220)
@@ -5,6 +5,6 @@
  */
 public interface Executable {
 	public void prepare();
-	public void execute();
+	public void execute() throws Exception;
 	public void complete();
 }

Modified: core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/instrument/cases/TestLazyPropertyCustomTypeExecutable.java
===================================================================
--- core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/instrument/cases/TestLazyPropertyCustomTypeExecutable.java	2008-09-25 22:10:46 UTC (rev 15219)
+++ core/branches/Branch_3_2_4_SP1_CP/test/org/hibernate/test/instrument/cases/TestLazyPropertyCustomTypeExecutable.java	2008-09-26 18:37:26 UTC (rev 15220)
@@ -19,39 +19,63 @@
 		return new String[] { "org/hibernate/test/instrument/domain/Problematic.hbm.xml" };
 	}
 
-	public void execute() {
+	public void execute() throws Exception {
 		Session s = getFactory().openSession();
-		s.beginTransaction();
 		Problematic p = new Problematic();
-		p.setName( "whatever" );
-		p.setBytes( new byte[] { 1, 0, 1, 1, 0 } );
-		s.save( p );
-		s.getTransaction().commit();
-		s.close();
+		try {
+			s.beginTransaction();
+			p.setName( "whatever" );
+			p.setBytes( new byte[] { 1, 0, 1, 1, 0 } );
+			s.save( p );
+			s.getTransaction().commit();
+		} catch (Exception e) {
+			s.getTransaction().rollback();
+			throw e;
+		} finally {
+			s.close();
+		}
 
 		// this access should be ok because p1 is not a lazy proxy 
 		s = getFactory().openSession();
-		s.beginTransaction();
-		Problematic p1 = (Problematic) s.get( Problematic.class, p.getId() );
-		Assert.assertTrue( FieldInterceptionHelper.isInstrumented( p1 ) );
-		p1.getRepresentation();
-		s.getTransaction().commit();
-		s.close();
+		try {
+			s.beginTransaction();
+			Problematic p1 = (Problematic) s.get( Problematic.class, p.getId() );
+			Assert.assertTrue( FieldInterceptionHelper.isInstrumented( p1 ) );
+			p1.getRepresentation();
+			s.getTransaction().commit();
+		} catch (Exception e) {
+			s.getTransaction().rollback();
+			throw e;
+		} finally {
+			s.close();
+		}
 		
 		s = getFactory().openSession();
-		s.beginTransaction();
-		p1 = (Problematic) s.createQuery( "from Problematic" ).setReadOnly(true ).list().get( 0 );
-		p1.getRepresentation();
-		s.getTransaction().commit();
-		s.close();
+		try {
+			s.beginTransaction();
+			Problematic p1 = (Problematic) s.createQuery( "from Problematic" ).setReadOnly(true ).list().get( 0 );
+			p1.getRepresentation();
+			s.getTransaction().commit();
+		} catch (Exception e) {
+			s.getTransaction().rollback();
+			throw e;
+		} finally {
+			s.close();
+		}
 		
 		s = getFactory().openSession();
-		s.beginTransaction();
-		p1 = (Problematic) s.load( Problematic.class, p.getId() );
-		Assert.assertFalse( FieldInterceptionHelper.isInstrumented( p1 ) );
-		p1.setRepresentation( p.getRepresentation() );
-		s.getTransaction().commit();
-		s.close();
+		try {
+			s.beginTransaction();
+			Problematic p1 = (Problematic) s.load( Problematic.class, p.getId() );
+			Assert.assertFalse( FieldInterceptionHelper.isInstrumented( p1 ) );
+			p1.setRepresentation( p.getRepresentation() );
+			s.getTransaction().commit();
+		} catch (Exception e) {
+			s.getTransaction().rollback();
+			throw e;
+		} finally {
+			s.close();
+		}
 	}
 
 	protected void cleanup() {




More information about the hibernate-commits mailing list