From 80c72eb4864916b54dd8be7ed239934755874796 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Xavier=20L=C3=A9aut=C3=A9?= Date: Fri, 31 Oct 2014 15:44:09 -0700 Subject: [PATCH] minor test adjustments --- .../metadata/SQLMetadataConnectorTest.java | 21 ++++++++----------- 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/server/src/test/java/io/druid/metadata/SQLMetadataConnectorTest.java b/server/src/test/java/io/druid/metadata/SQLMetadataConnectorTest.java index 54096a6330c..5fb44db5e37 100644 --- a/server/src/test/java/io/druid/metadata/SQLMetadataConnectorTest.java +++ b/server/src/test/java/io/druid/metadata/SQLMetadataConnectorTest.java @@ -22,7 +22,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.google.common.base.Suppliers; import com.google.common.base.Throwables; import io.druid.jackson.DefaultObjectMapper; -import junit.framework.Assert; +import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.skife.jdbi.v2.Batch; @@ -52,8 +52,10 @@ public class SQLMetadataConnectorTest MetadataStorageConnectorConfig.class ); - connector = new DerbyConnector(Suppliers.ofInstance(config), - Suppliers.ofInstance(tablesConfig)); + connector = new DerbyConnector( + Suppliers.ofInstance(config), + Suppliers.ofInstance(tablesConfig) + ); dbi = connector.getDBI(); } @@ -80,7 +82,10 @@ public class SQLMetadataConnectorTest public Void withHandle(Handle handle) throws Exception { for(String table : tables) { - Assert.assertTrue(String.format("table $s was not created!", table), tableExists(handle, table)); + Assert.assertTrue( + String.format("table $s was not created!", table), + connector.tableExists(handle, table) + ); } return null; @@ -166,12 +171,4 @@ public class SQLMetadataConnectorTest throw Throwables.propagate(e); } } - - private boolean tableExists(Handle handle, String tableName) - { - return !handle.createQuery("select * from SYS.SYSTABLES where tablename = :tableName") - .bind("tableName", tableName.toUpperCase()) - .list() - .isEmpty(); - } }