Skip to content

Commit c4e3042

Browse files
authored
Merge pull request #77 from PgBulkInsert/hstore-test
install hstore extension as part of test
2 parents 595e57f + c15f3bc commit c4e3042

1 file changed

Lines changed: 11 additions & 4 deletions

File tree

PgBulkInsert/pgbulkinsert-core/src/test/java/de/bytefish/pgbulkinsert/test/pgsql/handlers/HstoreExtensionTest.java

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
import de.bytefish.pgbulkinsert.test.utils.TransactionalTestBase;
88
import de.bytefish.pgbulkinsert.util.PostgreSqlUtils;
99
import org.junit.Assert;
10-
import org.junit.Ignore;
1110
import org.junit.Test;
1211

1312
import java.sql.ResultSet;
@@ -35,11 +34,12 @@ public void setCol_hstore(Map<String, String> col_hstore) {
3534

3635
@Override
3736
protected void onSetUpInTransaction() throws Exception {
37+
installExtension();
3838
createTable();
3939
}
4040

4141
@Override
42-
protected void onSetUpBeforeTransaction() throws Exception {
42+
protected void onSetUpBeforeTransaction() {
4343

4444
}
4545

@@ -52,6 +52,14 @@ public HStoreEntityMapping() {
5252
}
5353
}
5454

55+
private boolean installExtension() throws SQLException {
56+
String sqlStatement = "CREATE EXTENSION IF NOT EXISTS hstore;";
57+
58+
Statement statement = connection.createStatement();
59+
60+
return statement.execute(sqlStatement);
61+
}
62+
5563
private boolean createTable() throws SQLException {
5664
String sqlStatement = String.format("CREATE TABLE %s.hstore_table(\n", schema) +
5765
" col_hstore hstore \n" +
@@ -63,7 +71,6 @@ private boolean createTable() throws SQLException {
6371
}
6472

6573
@Test
66-
@Ignore("This Test Requires the hstore extension to be enabled.")
6774
@SuppressWarnings("unchecked")
6875
public void saveAll_Hstore_Test() throws SQLException {
6976

@@ -93,7 +100,7 @@ public void saveAll_Hstore_Test() throws SQLException {
93100
Map<String, String> v = (Map<String,String>) rs.getObject("col_hstore");
94101

95102
Assert.assertEquals(1, v.size());
96-
Assert.assertEquals(true, v.containsKey("Philipp"));
103+
Assert.assertTrue(v.containsKey("Philipp"));
97104
Assert.assertEquals("Cool Cool Cool!", v.get("Philipp"));
98105
}
99106
}

0 commit comments

Comments
 (0)