minor test adjustments

This commit is contained in:
Xavier Léauté 2014-10-31 15:44:09 -07:00
parent 1872b8f979
commit 80c72eb486
1 changed files with 9 additions and 12 deletions

View File

@ -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();
}
}