From: <hib...@li...> - 2006-03-09 21:39:23
|
Author: ste...@jb... Date: 2006-03-09 16:39:21 -0500 (Thu, 09 Mar 2006) New Revision: 9588 Modified: branches/Branch_3_1/Hibernate3/test/org/hibernate/test/proxy/ProxyTest.java Log: test suite cleanup Modified: branches/Branch_3_1/Hibernate3/test/org/hibernate/test/proxy/ProxyTest.java =================================================================== --- branches/Branch_3_1/Hibernate3/test/org/hibernate/test/proxy/ProxyTest.java 2006-03-09 21:38:26 UTC (rev 9587) +++ branches/Branch_3_1/Hibernate3/test/org/hibernate/test/proxy/ProxyTest.java 2006-03-09 21:39:21 UTC (rev 9588) @@ -225,8 +225,8 @@ Session s = openSession(); Transaction t = s.beginTransaction(); Long lastContainerId = null; - int containerCount = 200; - int nestedDataPointCount = 50; + int containerCount = 10; + int nestedDataPointCount = 5; for ( int c_indx = 0; c_indx < containerCount; c_indx++ ) { Owner owner = new Owner( "Owner #" + c_indx ); Container container = new Container( "Container #" + c_indx ); @@ -234,7 +234,9 @@ for ( int dp_indx = 0; dp_indx < nestedDataPointCount; dp_indx++ ) { DataPoint dp = new DataPoint(); dp.setDescription( "data-point [" + c_indx + ", " + dp_indx + "]" ); - dp.setX( new BigDecimal( c_indx ) ); +// more HSQLDB fun... +// dp.setX( new BigDecimal( c_indx ) ); + dp.setX( new BigDecimal( c_indx + dp_indx ) ); dp.setY( new BigDecimal( dp_indx ) ); container.getDataPoints().add( dp ); } @@ -256,7 +258,7 @@ .list(); Container container = ( Container ) all.get( 0 ); s.delete( container ); - // for a snapshot retrieval of the proxied container + // force a snapshot retrieval of the proxied container SessionImpl sImpl = ( SessionImpl ) s; sImpl.getPersistenceContext().getDatabaseSnapshot( lastContainerId, @@ -265,27 +267,32 @@ assertFalse( Hibernate.isInitialized( proxy ) ); t.commit(); - int iterations = 50; - long cumulativeTime = 0; - long cumulativeSize = 0; - for ( int i = 0; i < iterations; i++ ) { - final long start = System.currentTimeMillis(); - byte[] bytes = SerializationHelper.serialize( s ); - SerializationHelper.deserialize( bytes ); - final long end = System.currentTimeMillis(); - cumulativeTime += ( end - start ); - int size = bytes.length; - cumulativeSize += size; -// System.out.println( "Iteration #" + i + " took " + ( end - start ) + " ms : size = " + size + " bytes" ); - } - System.out.println( "Average time : " + ( cumulativeTime / iterations ) + " ms" ); - System.out.println( "Average size : " + ( cumulativeSize / iterations ) + " bytes" ); +// int iterations = 50; +// long cumulativeTime = 0; +// long cumulativeSize = 0; +// for ( int i = 0; i < iterations; i++ ) { +// final long start = System.currentTimeMillis(); +// byte[] bytes = SerializationHelper.serialize( s ); +// SerializationHelper.deserialize( bytes ); +// final long end = System.currentTimeMillis(); +// cumulativeTime += ( end - start ); +// int size = bytes.length; +// cumulativeSize += size; +//// System.out.println( "Iteration #" + i + " took " + ( end - start ) + " ms : size = " + size + " bytes" ); +// } +// System.out.println( "Average time : " + ( cumulativeTime / iterations ) + " ms" ); +// System.out.println( "Average size : " + ( cumulativeSize / iterations ) + " bytes" ); + byte[] bytes = SerializationHelper.serialize( s ); + SerializationHelper.deserialize( bytes ); + t = s.beginTransaction(); int count = s.createQuery( "delete DataPoint" ).executeUpdate(); assertEquals( "unexpected DP delete count", ( containerCount * nestedDataPointCount ), count ); count = s.createQuery( "delete Container" ).executeUpdate(); assertEquals( "unexpected container delete count", containerCount, count ); + count = s.createQuery( "delete Owner" ).executeUpdate(); + assertEquals( "unexpected owner delete count", containerCount, count ); t.commit(); s.close(); } |