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
This commit is contained in:
Steve Ebersole 2009-10-29 20:44:57 +00:00
parent fb9bdb7f38
commit e759809c35
6 changed files with 43 additions and 8 deletions

View File

@ -19,7 +19,7 @@
<param name="initial_value">1</param>
<param name="increment_size">1</param>
<param name="optimizer">none</param>
<param name="force_tbl_use">true</param>
<param name="force_table_use">true</param>
</generator>
</id>
<property name="name" type="string"/>

View File

@ -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];

View File

@ -18,7 +18,7 @@
<param name="initial_value">1</param>
<param name="increment_size">10</param>
<param name="optimizer">hilo</param>
<param name="force_tbl_use">true</param>
<param name="force_table_use">true</param>
</generator>
</id>
<property name="name" type="string"/>

View File

@ -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();

View File

@ -18,7 +18,7 @@
<param name="initial_value">1</param>
<param name="increment_size">10</param>
<param name="optimizer">pooled</param>
<param name="force_tbl_use">true</param>
<param name="force_table_use">true</param>
</generator>
</id>
<property name="name" type="string"/>

View File

@ -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();