From e759809c35175508408d258f086c78516b717d20 Mon Sep 17 00:00:00 2001 From: Steve Ebersole Date: Thu, 29 Oct 2009 20:44:57 +0000 Subject: [PATCH] HHH-4532 - Unit Tests in test/idgen/enhanced/forcedtable need update git-svn-id: https://svn.jboss.org/repos/hibernate/core/trunk@17880 1b8cb986-b30d-0410-93ca-fae66ebed9b2 --- .../test/idgen/enhanced/forcedtable/Basic.hbm.xml | 2 +- .../forcedtable/BasicForcedTableSequenceTest.java | 15 ++++++++++++++- .../test/idgen/enhanced/forcedtable/HiLo.hbm.xml | 2 +- .../forcedtable/HiLoForcedTableSequenceTest.java | 15 +++++++++++++-- .../idgen/enhanced/forcedtable/Pooled.hbm.xml | 2 +- .../PooledForcedTableSequenceTest.java | 15 +++++++++++++-- 6 files changed, 43 insertions(+), 8 deletions(-) diff --git a/testsuite/src/test/java/org/hibernate/test/idgen/enhanced/forcedtable/Basic.hbm.xml b/testsuite/src/test/java/org/hibernate/test/idgen/enhanced/forcedtable/Basic.hbm.xml index ada60064a5..f42e3c77ed 100644 --- a/testsuite/src/test/java/org/hibernate/test/idgen/enhanced/forcedtable/Basic.hbm.xml +++ b/testsuite/src/test/java/org/hibernate/test/idgen/enhanced/forcedtable/Basic.hbm.xml @@ -19,7 +19,7 @@ 1 1 none - true + true diff --git a/testsuite/src/test/java/org/hibernate/test/idgen/enhanced/forcedtable/BasicForcedTableSequenceTest.java b/testsuite/src/test/java/org/hibernate/test/idgen/enhanced/forcedtable/BasicForcedTableSequenceTest.java index 5e8c37d69f..f7b045ff33 100644 --- a/testsuite/src/test/java/org/hibernate/test/idgen/enhanced/forcedtable/BasicForcedTableSequenceTest.java +++ b/testsuite/src/test/java/org/hibernate/test/idgen/enhanced/forcedtable/BasicForcedTableSequenceTest.java @@ -6,6 +6,8 @@ import org.hibernate.junit.functional.DatabaseSpecificFunctionalTestCase; import org.hibernate.junit.functional.FunctionalTestClassTestSuite; import org.hibernate.persister.entity.EntityPersister; import org.hibernate.id.enhanced.SequenceStyleGenerator; +import org.hibernate.id.enhanced.TableStructure; +import org.hibernate.id.enhanced.OptimizerFactory; import org.hibernate.Session; /** @@ -28,8 +30,19 @@ public class BasicForcedTableSequenceTest extends DatabaseSpecificFunctionalTest public void testNormalBoundary() { EntityPersister persister = sfi().getEntityPersister( Entity.class.getName() ); - assertClassAssignability( SequenceStyleGenerator.class, persister.getIdentifierGenerator().getClass() ); + assertTrue( + "sequence style generator was not used", + SequenceStyleGenerator.class.isInstance( persister.getIdentifierGenerator() ) + ); SequenceStyleGenerator generator = ( SequenceStyleGenerator ) persister.getIdentifierGenerator(); + assertTrue( + "table structure was not used", + TableStructure.class.isInstance( generator.getDatabaseStructure() ) + ); + assertTrue( + "no-op optimizer was not used", + OptimizerFactory.NoopOptimizer.class.isInstance( generator.getOptimizer() ) + ); int count = 5; Entity[] entities = new Entity[count]; diff --git a/testsuite/src/test/java/org/hibernate/test/idgen/enhanced/forcedtable/HiLo.hbm.xml b/testsuite/src/test/java/org/hibernate/test/idgen/enhanced/forcedtable/HiLo.hbm.xml index 04976e328d..167ee482e4 100644 --- a/testsuite/src/test/java/org/hibernate/test/idgen/enhanced/forcedtable/HiLo.hbm.xml +++ b/testsuite/src/test/java/org/hibernate/test/idgen/enhanced/forcedtable/HiLo.hbm.xml @@ -18,7 +18,7 @@ 1 10 hilo - true + true diff --git a/testsuite/src/test/java/org/hibernate/test/idgen/enhanced/forcedtable/HiLoForcedTableSequenceTest.java b/testsuite/src/test/java/org/hibernate/test/idgen/enhanced/forcedtable/HiLoForcedTableSequenceTest.java index 6ccffd9465..abb1c39074 100644 --- a/testsuite/src/test/java/org/hibernate/test/idgen/enhanced/forcedtable/HiLoForcedTableSequenceTest.java +++ b/testsuite/src/test/java/org/hibernate/test/idgen/enhanced/forcedtable/HiLoForcedTableSequenceTest.java @@ -7,6 +7,7 @@ import org.hibernate.junit.functional.FunctionalTestClassTestSuite; import org.hibernate.persister.entity.EntityPersister; import org.hibernate.id.enhanced.OptimizerFactory; import org.hibernate.id.enhanced.SequenceStyleGenerator; +import org.hibernate.id.enhanced.TableStructure; import org.hibernate.Session; /** @@ -29,9 +30,19 @@ public class HiLoForcedTableSequenceTest extends DatabaseSpecificFunctionalTestC public void testNormalBoundary() { EntityPersister persister = sfi().getEntityPersister( Entity.class.getName() ); - assertClassAssignability( SequenceStyleGenerator.class, persister.getIdentifierGenerator().getClass() ); + assertTrue( + "sequence style generator was not used", + SequenceStyleGenerator.class.isInstance( persister.getIdentifierGenerator() ) + ); SequenceStyleGenerator generator = ( SequenceStyleGenerator ) persister.getIdentifierGenerator(); - assertClassAssignability( OptimizerFactory.HiLoOptimizer.class, generator.getOptimizer().getClass() ); + assertTrue( + "table structure was not used", + TableStructure.class.isInstance( generator.getDatabaseStructure() ) + ); + assertTrue( + "hilo optimizer was not used", + OptimizerFactory.HiLoOptimizer.class.isInstance( generator.getOptimizer() ) + ); OptimizerFactory.HiLoOptimizer optimizer = ( OptimizerFactory.HiLoOptimizer ) generator.getOptimizer(); int increment = optimizer.getIncrementSize(); diff --git a/testsuite/src/test/java/org/hibernate/test/idgen/enhanced/forcedtable/Pooled.hbm.xml b/testsuite/src/test/java/org/hibernate/test/idgen/enhanced/forcedtable/Pooled.hbm.xml index bbcd54997c..b1b5fecdd6 100644 --- a/testsuite/src/test/java/org/hibernate/test/idgen/enhanced/forcedtable/Pooled.hbm.xml +++ b/testsuite/src/test/java/org/hibernate/test/idgen/enhanced/forcedtable/Pooled.hbm.xml @@ -18,7 +18,7 @@ 1 10 pooled - true + true diff --git a/testsuite/src/test/java/org/hibernate/test/idgen/enhanced/forcedtable/PooledForcedTableSequenceTest.java b/testsuite/src/test/java/org/hibernate/test/idgen/enhanced/forcedtable/PooledForcedTableSequenceTest.java index 25d74488ab..162a6f0abe 100644 --- a/testsuite/src/test/java/org/hibernate/test/idgen/enhanced/forcedtable/PooledForcedTableSequenceTest.java +++ b/testsuite/src/test/java/org/hibernate/test/idgen/enhanced/forcedtable/PooledForcedTableSequenceTest.java @@ -7,6 +7,7 @@ import org.hibernate.junit.functional.FunctionalTestClassTestSuite; import org.hibernate.persister.entity.EntityPersister; import org.hibernate.id.enhanced.OptimizerFactory; import org.hibernate.id.enhanced.SequenceStyleGenerator; +import org.hibernate.id.enhanced.TableStructure; import org.hibernate.Session; /** @@ -29,9 +30,19 @@ public class PooledForcedTableSequenceTest extends DatabaseSpecificFunctionalTes public void testNormalBoundary() { EntityPersister persister = sfi().getEntityPersister( Entity.class.getName() ); - assertClassAssignability( SequenceStyleGenerator.class, persister.getIdentifierGenerator().getClass() ); + assertTrue( + "sequence style generator was not used", + SequenceStyleGenerator.class.isInstance( persister.getIdentifierGenerator() ) + ); SequenceStyleGenerator generator = ( SequenceStyleGenerator ) persister.getIdentifierGenerator(); - assertClassAssignability( OptimizerFactory.PooledOptimizer.class, generator.getOptimizer().getClass() ); + assertTrue( + "table structure was not used", + TableStructure.class.isInstance( generator.getDatabaseStructure() ) + ); + assertTrue( + "pooled optimizer was not used", + OptimizerFactory.PooledOptimizer.class.isInstance( generator.getOptimizer() ) + ); OptimizerFactory.PooledOptimizer optimizer = ( OptimizerFactory.PooledOptimizer ) generator.getOptimizer(); int increment = optimizer.getIncrementSize();