Skip to content

Commit d905246

Browse files
committed
HHH-9990 - Add tests
1 parent 7ccbd46 commit d905246

File tree

2 files changed

+182
-0
lines changed

2 files changed

+182
-0
lines changed
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
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.dialect;
25+
26+
import org.hibernate.cfg.Environment;
27+
28+
import org.junit.Test;
29+
30+
import org.hibernate.testing.TestForIssue;
31+
32+
import static org.junit.Assert.assertEquals;
33+
34+
/**
35+
* @author Andrea Boriero
36+
*/
37+
38+
public class OracleDialectsTest {
39+
40+
@Test
41+
@TestForIssue( jiraKey = "HHH-9990")
42+
public void testDefaultBatchVersionDataProperty(){
43+
Oracle8iDialect oracle8iDialect = new Oracle8iDialect();
44+
assertEquals( "false", oracle8iDialect.getDefaultProperties().getProperty( Environment.BATCH_VERSIONED_DATA ) );
45+
46+
OracleDialect oracleDialect = new OracleDialect();
47+
assertEquals( "false", oracleDialect.getDefaultProperties().getProperty( Environment.BATCH_VERSIONED_DATA ) );
48+
49+
Oracle10gDialect oracle10gDialect = new Oracle10gDialect();
50+
assertEquals( "false", oracle10gDialect.getDefaultProperties().getProperty( Environment.BATCH_VERSIONED_DATA ) );
51+
52+
Oracle9iDialect oracle9iDialect = new Oracle9iDialect();
53+
assertEquals( "false", oracle9iDialect.getDefaultProperties().getProperty( Environment.BATCH_VERSIONED_DATA ) );
54+
55+
Oracle9Dialect oracle9Dialect = new Oracle9Dialect();
56+
assertEquals( "false", oracle9Dialect.getDefaultProperties().getProperty( Environment.BATCH_VERSIONED_DATA ) );
57+
58+
Oracle12cDialect oracle12cDialect = new Oracle12cDialect();
59+
assertEquals( "true", oracle12cDialect.getDefaultProperties().getProperty( Environment.BATCH_VERSIONED_DATA ) );
60+
}
61+
}
Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
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

Comments
 (0)