Skip to content

Commit 9a8d95c

Browse files
committed
HBX-3169: Update the use of H2 in the Maven integration tests to 2.4.240
- Handle the 'hbm2ddl' integration test Signed-off-by: Koen Aers <[email protected]>
1 parent 5c93f27 commit 9a8d95c

File tree

5 files changed

+19
-28
lines changed

5 files changed

+19
-28
lines changed

test/maven/src/it/hbm2ddl/pom.xml

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,14 @@
2323
<artifactId>hbm2ddl</artifactId>
2424
<version>0.0.1-SNAPSHOT</version>
2525

26-
<properties>
27-
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
28-
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
29-
30-
<java.version>1.8</java.version>
31-
<h2.version>1.4.195</h2.version>
32-
</properties>
26+
<dependencies>
27+
<dependency>
28+
<!-- DB Driver of your choice -->
29+
<groupId>com.h2database</groupId>
30+
<artifactId>h2</artifactId>
31+
<version>@h2.version@</version>
32+
</dependency>
33+
</dependencies>
3334

3435
<build>
3536
<plugins>
@@ -52,14 +53,6 @@
5253
<configuration>
5354
<revengFile>${project.basedir}/src/main/resources/hibernate.reveng.xml</revengFile>
5455
</configuration>
55-
<dependencies>
56-
<dependency>
57-
<!-- DB Driver of your choice -->
58-
<groupId>com.h2database</groupId>
59-
<artifactId>h2</artifactId>
60-
<version>${h2.version}</version>
61-
</dependency>
62-
</dependencies>
6356
</plugin>
6457
</plugins>
6558
</build>

test/maven/src/it/hbm2ddl/verify.groovy renamed to test/maven/src/it/hbm2ddl/postbuild.bsh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515
* See the License for the specific language governing permissions and
1616
* limitations under the License.
1717
*/
18-
import java.io.*;
19-
2018
File schema = new File(basedir, "target/generated-resources/schema.ddl");
2119
if (!schema.isFile()) {
2220
throw new FileNotFoundException("Could not find generated schema file: " + schema);

test/maven/src/it/hbm2dao/verify.groovy renamed to test/maven/src/it/hbm2ddl/prebuild.bsh

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,12 @@
1515
* See the License for the specific language governing permissions and
1616
* limitations under the License.
1717
*/
18-
import java.io.*;
18+
import java.sql.DriverManager;
19+
import java.sql.Connection;
1920

20-
File dao = new File(basedir, "target/generated-sources/PersonHome.java");
21-
if (!dao.isFile()) {
22-
throw new FileNotFoundException("Could not find generated JPA DAO: " + dao);
23-
}
21+
String JDBC_CONNECTION = "jdbc:h2:" + basedir + "/test";
22+
String CREATE_PERSON_TABLE = "create table PERSON (ID int not null, NAME varchar(20), primary key (ID))";
23+
24+
Connection connection = DriverManager.getConnection(JDBC_CONNECTION);
25+
connection.createStatement().execute(CREATE_PERSON_TABLE);
26+
connection.close();

test/maven/src/it/hbm2ddl/src/main/resources/hibernate.properties

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,7 @@
1515
# See the License for the specific language governing permissions and #
1616
# limitations under the License. #
1717
############################################################################
18-
hibernate.dialect=org.hibernate.dialect.H2Dialect
1918
hibernate.connection.driver_class=org.h2.Driver
20-
hibernate.connection.url=jdbc:h2:./test;DB_CLOSE_ON_EXIT=FALSE
21-
hibernate.connection.username=sa
22-
hibernate.connection.password=
23-
hibernate.connection.pool_size=1
24-
hibernate.show_sql=true
19+
hibernate.connection.url=jdbc:h2:./test
20+
hibernate.default_catalog=TEST
21+
hibernate.default_schema=PUBLIC
-28 KB
Binary file not shown.

0 commit comments

Comments
 (0)