HHH-9990 - Fix test failure

This commit is contained in:
Andrea Boriero 2015-08-05 13:36:44 +01:00
parent 4da260b3be
commit a45261ed4c
1 changed files with 38 additions and 40 deletions

View File

@ -26,6 +26,7 @@ package org.hibernate.test.cfg;
import org.hibernate.SessionFactory; import org.hibernate.SessionFactory;
import org.hibernate.cfg.AvailableSettings; import org.hibernate.cfg.AvailableSettings;
import org.hibernate.cfg.Configuration; import org.hibernate.cfg.Configuration;
import org.hibernate.dialect.H2Dialect;
import org.hibernate.dialect.Oracle10gDialect; import org.hibernate.dialect.Oracle10gDialect;
import org.hibernate.dialect.Oracle12cDialect; import org.hibernate.dialect.Oracle12cDialect;
import org.hibernate.dialect.Oracle8iDialect; import org.hibernate.dialect.Oracle8iDialect;
@ -33,6 +34,8 @@ import org.hibernate.dialect.Oracle9Dialect;
import org.hibernate.dialect.Oracle9iDialect; import org.hibernate.dialect.Oracle9iDialect;
import org.hibernate.dialect.OracleDialect; import org.hibernate.dialect.OracleDialect;
import org.junit.After;
import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.hibernate.testing.junit4.BaseUnitTestCase; import org.hibernate.testing.junit4.BaseUnitTestCase;
@ -44,78 +47,73 @@ import static org.junit.Assert.assertThat;
* @author Andrea Boriero * @author Andrea Boriero
*/ */
public class BatchVersionedDataConfigTest extends BaseUnitTestCase { public class BatchVersionedDataConfigTest extends BaseUnitTestCase {
public static final String CFG_XML = "org/hibernate/test/cfg/cache/hibernate.cfg.xml";
private SessionFactory sessionFactory;
private Configuration cfg;
@Before
public void setUp() {
cfg = new Configuration();
}
@After
public void tearDown() {
if ( sessionFactory != null ) {
sessionFactory.close();
}
}
@Test @Test
public void testBatchVersionedData() { public void testBatchVersionedDataForDialectNotSettingBatchVersionedDataProperty() {
Configuration cfg = new Configuration().configure( CFG_XML ); cfg.setProperty( AvailableSettings.DIALECT, H2Dialect.class.getName() );
SessionFactory sessionFactory = cfg.buildSessionFactory(); sessionFactory = cfg.buildSessionFactory();
assertThat( sessionFactory.getSessionFactoryOptions().isJdbcBatchVersionedData(), is( true ) ); assertThat( sessionFactory.getSessionFactoryOptions().isJdbcBatchVersionedData(), is( true ) );
} }
@Test @Test
public void testBatchVersionedDataForOracle10gDialect() { public void testBatchVersionedDataForOracle10gDialect() {
Configuration cfg = new Configuration().configure( CFG_XML ) cfg.setProperty( AvailableSettings.DIALECT, Oracle10gDialect.class.getName() );
.setProperty( sessionFactory = cfg.buildSessionFactory();
AvailableSettings.DIALECT,
Oracle10gDialect.class.getName()
);
SessionFactory sessionFactory = cfg.buildSessionFactory();
assertThat( sessionFactory.getSessionFactoryOptions().isJdbcBatchVersionedData(), is( false ) ); assertThat( sessionFactory.getSessionFactoryOptions().isJdbcBatchVersionedData(), is( false ) );
} }
@Test @Test
public void testBatchVersionedDataForOracle8iDialect() { public void testBatchVersionedDataForOracle8iDialect() {
Configuration cfg = new Configuration().configure( CFG_XML ) cfg.setProperty( AvailableSettings.DIALECT, Oracle8iDialect.class.getName() );
.setProperty( sessionFactory = cfg.buildSessionFactory();
AvailableSettings.DIALECT,
Oracle8iDialect.class.getName()
);
SessionFactory sessionFactory = cfg.buildSessionFactory();
assertThat( sessionFactory.getSessionFactoryOptions().isJdbcBatchVersionedData(), is( false ) ); assertThat( sessionFactory.getSessionFactoryOptions().isJdbcBatchVersionedData(), is( false ) );
} }
@Test @Test
public void testBatchVersionedDataForOracle9iDialect() { public void testBatchVersionedDataForOracle9iDialect() {
Configuration cfg = new Configuration().configure( CFG_XML ) cfg.setProperty( AvailableSettings.DIALECT, Oracle9iDialect.class.getName() );
.setProperty( sessionFactory = cfg.buildSessionFactory();
AvailableSettings.DIALECT,
Oracle9iDialect.class.getName()
);
SessionFactory sessionFactory = cfg.buildSessionFactory();
assertThat( sessionFactory.getSessionFactoryOptions().isJdbcBatchVersionedData(), is( false ) ); assertThat( sessionFactory.getSessionFactoryOptions().isJdbcBatchVersionedData(), is( false ) );
} }
@Test @Test
public void testBatchVersionedDataForOracle9Dialect() { public void testBatchVersionedDataForOracle9Dialect() {
Configuration cfg = new Configuration().configure( CFG_XML ) cfg.setProperty( AvailableSettings.DIALECT, Oracle9Dialect.class.getName() );
.setProperty( sessionFactory = cfg.buildSessionFactory();
AvailableSettings.DIALECT,
Oracle9Dialect.class.getName()
);
SessionFactory sessionFactory = cfg.buildSessionFactory();
assertThat( sessionFactory.getSessionFactoryOptions().isJdbcBatchVersionedData(), is( false ) ); assertThat( sessionFactory.getSessionFactoryOptions().isJdbcBatchVersionedData(), is( false ) );
} }
@Test @Test
public void testBatchVersionedDataForOracleDialect() { public void testBatchVersionedDataForOracleDialect() {
Configuration cfg = new Configuration().configure( CFG_XML ) cfg.setProperty( AvailableSettings.DIALECT, OracleDialect.class.getName() );
.setProperty( sessionFactory = cfg.buildSessionFactory();
AvailableSettings.DIALECT,
OracleDialect.class.getName()
);
SessionFactory sessionFactory = cfg.buildSessionFactory();
assertThat( sessionFactory.getSessionFactoryOptions().isJdbcBatchVersionedData(), is( false ) ); assertThat( sessionFactory.getSessionFactoryOptions().isJdbcBatchVersionedData(), is( false ) );
} }
@Test @Test
public void testBatchVersionedDataForOracle12cDialect() { public void testBatchVersionedDataForOracle12cDialect() {
Configuration cfg = new Configuration().configure( CFG_XML ) cfg.setProperty( AvailableSettings.DIALECT, Oracle12cDialect.class.getName() );
.setProperty( sessionFactory = cfg.buildSessionFactory();
AvailableSettings.DIALECT,
Oracle12cDialect.class.getName()
);
SessionFactory sessionFactory = cfg.buildSessionFactory();
assertThat( sessionFactory.getSessionFactoryOptions().isJdbcBatchVersionedData(), is( true ) ); assertThat( sessionFactory.getSessionFactoryOptions().isJdbcBatchVersionedData(), is( true ) );
} }
} }