Author: jcosta(a)redhat.com
Date: 2008-09-26 14:56:55 -0400 (Fri, 26 Sep 2008)
New Revision: 15223
Modified:
core/branches/Branch_3_3/testsuite/src/test/java/org/hibernate/test/instrument/buildtime/InstrumentTest.java
core/branches/Branch_3_3/testsuite/src/test/java/org/hibernate/test/instrument/cases/Executable.java
core/branches/Branch_3_3/testsuite/src/test/java/org/hibernate/test/instrument/cases/TestLazyPropertyCustomTypeExecutable.java
Log:
HHH-3498 - Fixed in Branch_3_3
Modified:
core/branches/Branch_3_3/testsuite/src/test/java/org/hibernate/test/instrument/buildtime/InstrumentTest.java
===================================================================
---
core/branches/Branch_3_3/testsuite/src/test/java/org/hibernate/test/instrument/buildtime/InstrumentTest.java 2008-09-26
18:56:23 UTC (rev 15222)
+++
core/branches/Branch_3_3/testsuite/src/test/java/org/hibernate/test/instrument/buildtime/InstrumentTest.java 2008-09-26
18:56:55 UTC (rev 15223)
@@ -31,7 +31,7 @@
return new TestSuite( InstrumentTest.class );
}
- public void testDirtyCheck() {
+ public void testDirtyCheck() throws Exception {
execute( new TestDirtyCheckExecutable() );
}
@@ -43,31 +43,31 @@
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() );
}
- public void testSharedPKOneToOne() {
+ public void testSharedPKOneToOne() throws Exception {
execute( new TestSharedPKOneToOneExecutable() );
}
- private void execute(Executable executable) {
+ private void execute(Executable executable) throws Exception {
executable.prepare();
try {
executable.execute();
Modified:
core/branches/Branch_3_3/testsuite/src/test/java/org/hibernate/test/instrument/cases/Executable.java
===================================================================
---
core/branches/Branch_3_3/testsuite/src/test/java/org/hibernate/test/instrument/cases/Executable.java 2008-09-26
18:56:23 UTC (rev 15222)
+++
core/branches/Branch_3_3/testsuite/src/test/java/org/hibernate/test/instrument/cases/Executable.java 2008-09-26
18:56:55 UTC (rev 15223)
@@ -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_3/testsuite/src/test/java/org/hibernate/test/instrument/cases/TestLazyPropertyCustomTypeExecutable.java
===================================================================
---
core/branches/Branch_3_3/testsuite/src/test/java/org/hibernate/test/instrument/cases/TestLazyPropertyCustomTypeExecutable.java 2008-09-26
18:56:23 UTC (rev 15222)
+++
core/branches/Branch_3_3/testsuite/src/test/java/org/hibernate/test/instrument/cases/TestLazyPropertyCustomTypeExecutable.java 2008-09-26
18:56:55 UTC (rev 15223)
@@ -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() {
Show replies by date