|
| 1 | +/* |
| 2 | + * Hibernate, Relational Persistence for Idiomatic Java |
| 3 | + * |
| 4 | + * Copyright (c) {DATE}, Red Hat Inc. or third-party contributors as |
| 5 | + * indicated by the @author tags or express copyright attribution |
| 6 | + * statements applied by the authors. All third-party contributions are |
| 7 | + * distributed under license by Red Hat Inc. |
| 8 | + * |
| 9 | + * This copyrighted material is made available to anyone wishing to use, modify, |
| 10 | + * copy, or redistribute it subject to the terms and conditions of the GNU |
| 11 | + * Lesser General Public License, as published by the Free Software Foundation. |
| 12 | + * |
| 13 | + * This program is distributed in the hope that it will be useful, |
| 14 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY |
| 15 | + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License |
| 16 | + * for more details. |
| 17 | + * |
| 18 | + * You should have received a copy of the GNU Lesser General Public License |
| 19 | + * along with this distribution; if not, write to: |
| 20 | + * Free Software Foundation, Inc. |
| 21 | + * 51 Franklin Street, Fifth Floor |
| 22 | + * Boston, MA 02110-1301 USA |
| 23 | + */ |
| 24 | +package org.hibernate.test.cfg; |
| 25 | + |
| 26 | +import org.hibernate.SessionFactory; |
| 27 | +import org.hibernate.cfg.AvailableSettings; |
| 28 | +import org.hibernate.cfg.Configuration; |
| 29 | +import org.hibernate.dialect.Oracle10gDialect; |
| 30 | +import org.hibernate.dialect.Oracle12cDialect; |
| 31 | +import org.hibernate.dialect.Oracle8iDialect; |
| 32 | +import org.hibernate.dialect.Oracle9Dialect; |
| 33 | +import org.hibernate.dialect.Oracle9iDialect; |
| 34 | +import org.hibernate.dialect.OracleDialect; |
| 35 | + |
| 36 | +import org.junit.Test; |
| 37 | + |
| 38 | +import org.hibernate.testing.junit4.BaseUnitTestCase; |
| 39 | + |
| 40 | +import static org.hamcrest.core.Is.is; |
| 41 | +import static org.junit.Assert.assertThat; |
| 42 | + |
| 43 | +/** |
| 44 | + * @author Andrea Boriero |
| 45 | + */ |
| 46 | +public class BatchVersionedDataConfigTest extends BaseUnitTestCase { |
| 47 | + public static final String CFG_XML = "org/hibernate/test/cfg/cache/hibernate.cfg.xml"; |
| 48 | + |
| 49 | + @Test |
| 50 | + public void testBatchVersionedData() { |
| 51 | + Configuration cfg = new Configuration().configure( CFG_XML ); |
| 52 | + SessionFactory sessionFactory = cfg.buildSessionFactory(); |
| 53 | + assertThat( sessionFactory.getSessionFactoryOptions().isJdbcBatchVersionedData(), is( true ) ); |
| 54 | + } |
| 55 | + |
| 56 | + @Test |
| 57 | + public void testBatchVersionedDataForOracle10gDialect() { |
| 58 | + Configuration cfg = new Configuration().configure( CFG_XML ) |
| 59 | + .setProperty( |
| 60 | + AvailableSettings.DIALECT, |
| 61 | + Oracle10gDialect.class.getName() |
| 62 | + ); |
| 63 | + SessionFactory sessionFactory = cfg.buildSessionFactory(); |
| 64 | + assertThat( sessionFactory.getSessionFactoryOptions().isJdbcBatchVersionedData(), is( false ) ); |
| 65 | + } |
| 66 | + |
| 67 | + @Test |
| 68 | + public void testBatchVersionedDataForOracle8iDialect() { |
| 69 | + Configuration cfg = new Configuration().configure( CFG_XML ) |
| 70 | + .setProperty( |
| 71 | + AvailableSettings.DIALECT, |
| 72 | + Oracle8iDialect.class.getName() |
| 73 | + ); |
| 74 | + SessionFactory sessionFactory = cfg.buildSessionFactory(); |
| 75 | + assertThat( sessionFactory.getSessionFactoryOptions().isJdbcBatchVersionedData(), is( false ) ); |
| 76 | + } |
| 77 | + |
| 78 | + @Test |
| 79 | + public void testBatchVersionedDataForOracle9iDialect() { |
| 80 | + Configuration cfg = new Configuration().configure( CFG_XML ) |
| 81 | + .setProperty( |
| 82 | + AvailableSettings.DIALECT, |
| 83 | + Oracle9iDialect.class.getName() |
| 84 | + ); |
| 85 | + SessionFactory sessionFactory = cfg.buildSessionFactory(); |
| 86 | + assertThat( sessionFactory.getSessionFactoryOptions().isJdbcBatchVersionedData(), is( false ) ); |
| 87 | + } |
| 88 | + |
| 89 | + @Test |
| 90 | + public void testBatchVersionedDataForOracle9Dialect() { |
| 91 | + Configuration cfg = new Configuration().configure( CFG_XML ) |
| 92 | + .setProperty( |
| 93 | + AvailableSettings.DIALECT, |
| 94 | + Oracle9Dialect.class.getName() |
| 95 | + ); |
| 96 | + SessionFactory sessionFactory = cfg.buildSessionFactory(); |
| 97 | + assertThat( sessionFactory.getSessionFactoryOptions().isJdbcBatchVersionedData(), is( false ) ); |
| 98 | + } |
| 99 | + |
| 100 | + @Test |
| 101 | + public void testBatchVersionedDataForOracleDialect() { |
| 102 | + Configuration cfg = new Configuration().configure( CFG_XML ) |
| 103 | + .setProperty( |
| 104 | + AvailableSettings.DIALECT, |
| 105 | + OracleDialect.class.getName() |
| 106 | + ); |
| 107 | + SessionFactory sessionFactory = cfg.buildSessionFactory(); |
| 108 | + assertThat( sessionFactory.getSessionFactoryOptions().isJdbcBatchVersionedData(), is( false ) ); |
| 109 | + } |
| 110 | + |
| 111 | + @Test |
| 112 | + public void testBatchVersionedDataForOracle12cDialect() { |
| 113 | + Configuration cfg = new Configuration().configure( CFG_XML ) |
| 114 | + .setProperty( |
| 115 | + AvailableSettings.DIALECT, |
| 116 | + Oracle12cDialect.class.getName() |
| 117 | + ); |
| 118 | + SessionFactory sessionFactory = cfg.buildSessionFactory(); |
| 119 | + assertThat( sessionFactory.getSessionFactoryOptions().isJdbcBatchVersionedData(), is( true ) ); |
| 120 | + } |
| 121 | +} |
0 commit comments