From 35bd192556ba9318a96f9374a2dfb1557e5a1fb2 Mon Sep 17 00:00:00 2001 From: Lukasz Antoniak Date: Thu, 11 Apr 2013 09:12:23 +0200 Subject: [PATCH] HHH-2403 - Test cleanup --- .../fileimport/MultiLineImportFileTest.java | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/hibernate-core/src/test/java/org/hibernate/test/fileimport/MultiLineImportFileTest.java b/hibernate-core/src/test/java/org/hibernate/test/fileimport/MultiLineImportFileTest.java index 9907a864b0..bac8e4081f 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/fileimport/MultiLineImportFileTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/fileimport/MultiLineImportFileTest.java @@ -24,6 +24,9 @@ package org.hibernate.test.fileimport; import java.math.BigInteger; +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.SQLException; import org.junit.Test; @@ -32,6 +35,8 @@ import org.hibernate.Transaction; import org.hibernate.cfg.Configuration; import org.hibernate.cfg.Environment; import org.hibernate.dialect.H2Dialect; +import org.hibernate.jdbc.Work; +import org.hibernate.testing.AfterClassOnce; import org.hibernate.testing.RequiresDialect; import org.hibernate.testing.TestForIssue; import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase; @@ -83,4 +88,27 @@ public class MultiLineImportFileTest extends BaseCoreFunctionalTestCase { tx.commit(); s.close(); } + + @AfterClassOnce + public void tearDown() { + final Session session = openSession(); + session.getTransaction().begin(); + session.doWork( new Work() { + @Override + public void execute(Connection connection) throws SQLException { + PreparedStatement statement = null; + try { + statement = connection.prepareStatement( "DROP TABLE test_data" ); + statement.execute(); + } + finally { + if ( statement != null ) { + statement.close(); + } + } + } + } ); + session.getTransaction().commit(); + session.close(); + } }