test suite cleanups

git-svn-id: https://svn.jboss.org/repos/hibernate/core/trunk@15178 1b8cb986-b30d-0410-93ca-fae66ebed9b2
This commit is contained in:
Steve Ebersole 2008-09-10 17:53:46 +00:00
parent a6ca833e2e
commit f293784243
4 changed files with 15 additions and 11 deletions

View File

@ -279,7 +279,7 @@ public class DynamicFilterTest extends FunctionalTestCase {
session.enableFilter( "effectiveDate" ).setParameter( "asOfDate", new Date() ); session.enableFilter( "effectiveDate" ).setParameter( "asOfDate", new Date() );
Product prod = ( Product ) session.createCriteria( Product.class ) Product prod = ( Product ) session.createCriteria( Product.class )
.setResultTransformer( new DistinctRootEntityResultTransformer() ) .setResultTransformer( DistinctRootEntityResultTransformer.INSTANCE )
.add( Restrictions.eq( "id", testData.prod1Id ) ) .add( Restrictions.eq( "id", testData.prod1Id ) )
.uniqueResult(); .uniqueResult();

View File

@ -1716,7 +1716,7 @@ public class ASTParserLoadingTest extends FunctionalTestCase {
session = openSession(); session = openSession();
results = session.createQuery( "select a from Animal a, Animal b order by a.id" ) results = session.createQuery( "select a from Animal a, Animal b order by a.id" )
.setResultTransformer(new DistinctRootEntityResultTransformer()) .setResultTransformer( DistinctRootEntityResultTransformer.INSTANCE )
.list(); .list();
assertEquals( "Incorrect result size", 2, results.size()); assertEquals( "Incorrect result size", 2, results.size());
assertTrue( "Incorrect return type", results.get(0) instanceof Animal ); assertTrue( "Incorrect return type", results.get(0) instanceof Animal );

View File

@ -66,15 +66,15 @@ public class SequenceStyleConfigUnitTest extends UnitTestCase {
Properties props = new Properties(); Properties props = new Properties();
props.setProperty( SequenceStyleGenerator.INCREMENT_PARAM, "10" ); props.setProperty( SequenceStyleGenerator.INCREMENT_PARAM, "10" );
// for dialects which do not support pooled sequences, we default to hilo // for dialects which do not support pooled sequences, we default to pooled+table
Dialect dialect = new SequenceDialect(); Dialect dialect = new SequenceDialect();
SequenceStyleGenerator generator = new SequenceStyleGenerator(); SequenceStyleGenerator generator = new SequenceStyleGenerator();
generator.configure( Hibernate.LONG, props, dialect ); generator.configure( Hibernate.LONG, props, dialect );
assertClassAssignability( SequenceStructure.class, generator.getDatabaseStructure().getClass() ); assertClassAssignability( TableStructure.class, generator.getDatabaseStructure().getClass() );
assertClassAssignability( OptimizerFactory.HiLoOptimizer.class, generator.getOptimizer().getClass() ); assertClassAssignability( OptimizerFactory.PooledOptimizer.class, generator.getOptimizer().getClass() );
assertEquals( SequenceStyleGenerator.DEF_SEQUENCE_NAME, generator.getDatabaseStructure().getName() ); assertEquals( SequenceStyleGenerator.DEF_SEQUENCE_NAME, generator.getDatabaseStructure().getName() );
// for dialects which do support pooled sequences, we default to pooled // for dialects which do support pooled sequences, we default to pooled+sequence
dialect = new PooledSequenceDialect(); dialect = new PooledSequenceDialect();
generator = new SequenceStyleGenerator(); generator = new SequenceStyleGenerator();
generator.configure( Hibernate.LONG, props, dialect ); generator.configure( Hibernate.LONG, props, dialect );
@ -118,7 +118,7 @@ public class SequenceStyleConfigUnitTest extends UnitTestCase {
*/ */
public void testExplicitOptimizerWithExplicitIncrementSize() { public void testExplicitOptimizerWithExplicitIncrementSize() {
// with sequence ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // with sequence ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Dialect dialect = new SequenceDialect(); final Dialect dialect = new SequenceDialect();
// optimizer=none w/ increment > 1 => should honor optimizer // optimizer=none w/ increment > 1 => should honor optimizer
Properties props = new Properties(); Properties props = new Properties();
@ -134,7 +134,8 @@ public class SequenceStyleConfigUnitTest extends UnitTestCase {
// optimizer=hilo w/ increment > 1 => hilo // optimizer=hilo w/ increment > 1 => hilo
props = new Properties(); props = new Properties();
props.setProperty( SequenceStyleGenerator.OPT_PARAM, OptimizerFactory.HILO ); props.setProperty( SequenceStyleGenerator.OPT_PARAM, OptimizerFactory.HILO );
props.setProperty( SequenceStyleGenerator.INCREMENT_PARAM, "20" );generator = new SequenceStyleGenerator(); props.setProperty( SequenceStyleGenerator.INCREMENT_PARAM, "20" );
generator = new SequenceStyleGenerator();
generator.configure( Hibernate.LONG, props, dialect ); generator.configure( Hibernate.LONG, props, dialect );
assertClassAssignability( SequenceStructure.class, generator.getDatabaseStructure().getClass() ); assertClassAssignability( SequenceStructure.class, generator.getDatabaseStructure().getClass() );
assertClassAssignability( OptimizerFactory.HiLoOptimizer.class, generator.getOptimizer().getClass() ); assertClassAssignability( OptimizerFactory.HiLoOptimizer.class, generator.getOptimizer().getClass() );
@ -147,8 +148,10 @@ public class SequenceStyleConfigUnitTest extends UnitTestCase {
props.setProperty( SequenceStyleGenerator.INCREMENT_PARAM, "20" ); props.setProperty( SequenceStyleGenerator.INCREMENT_PARAM, "20" );
generator = new SequenceStyleGenerator(); generator = new SequenceStyleGenerator();
generator.configure( Hibernate.LONG, props, dialect ); generator.configure( Hibernate.LONG, props, dialect );
assertClassAssignability( SequenceStructure.class, generator.getDatabaseStructure().getClass() ); // because the dialect reports to not support pooled seqyences, the expectation is that we will
assertClassAssignability( OptimizerFactory.HiLoOptimizer.class, generator.getOptimizer().getClass() ); // use a table for the backing structure...
assertClassAssignability( TableStructure.class, generator.getDatabaseStructure().getClass() );
assertClassAssignability( OptimizerFactory.PooledOptimizer.class, generator.getOptimizer().getClass() );
assertEquals( 20, generator.getOptimizer().getIncrementSize() ); assertEquals( 20, generator.getOptimizer().getIncrementSize() );
assertEquals( 20, generator.getDatabaseStructure().getIncrementSize() ); assertEquals( 20, generator.getDatabaseStructure().getIncrementSize() );

View File

@ -7,3 +7,4 @@ log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
log4j.rootLogger=info, stdout log4j.rootLogger=info, stdout
log4j.logger.org.hibernate.test=info log4j.logger.org.hibernate.test=info
log4j.logger.org.hibernate.tool.hbm2ddl=debug