Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

youcat ingest table completed #176

Merged
merged 16 commits into from
Oct 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -92,34 +92,21 @@
*
* @author pdowler
*/
public class TableCreatorTest {
public class TableCreatorTest extends TestUtil {
private static final Logger log = Logger.getLogger(TableCreatorTest.class);

static {
Log4jInit.setLevel("ca.nrc.cadc.tap.db", Level.INFO);
//Log4jInit.setLevel("ca.nrc.cadc.profiler", Level.INFO);
Log4jInit.setLevel("ca.nrc.cadc.tap", Level.INFO);
}

private DataSource dataSource;
private final String TEST_SCHEMA = "tap_schema";

public TableCreatorTest() {
// create a datasource and register with JNDI
try {
DBConfig conf = new DBConfig();
ConnectionConfig cc = conf.getConnectionConfig("TAP_SCHEMA_TEST", "cadctest");
dataSource = DBUtil.getDataSource(cc);
log.info("configured data source: " + cc.getServer() + "," + cc.getDatabase() + "," + cc.getDriver() + "," + cc.getURL());
} catch (Exception ex) {
log.error("setup failed", ex);
throw new IllegalStateException("failed to create DataSource", ex);
}
super();
}

@Test
public void testCreateTable() {
try {
String testTable = TEST_SCHEMA + ".testCreateTable";
String testTable = testSchemaName + ".testCreateTable";
// cleanup
TableCreator tc = new TableCreator(dataSource);
try {
Expand All @@ -128,7 +115,7 @@ public void testCreateTable() {
log.debug("cleanup-before-test failed");
}

TableDesc orig = new TableDesc(TEST_SCHEMA, testTable);
TableDesc orig = new TableDesc(testSchemaName, testTable);
orig.tableType = TableDesc.TableType.TABLE;
orig.getColumnDescs().add(new ColumnDesc(testTable, "c0", TapDataType.STRING));
orig.getColumnDescs().add(new ColumnDesc(testTable, "c1", TapDataType.SHORT));
Expand Down Expand Up @@ -161,7 +148,7 @@ public void testCreateTable() {
@Test
public void testCreateIndex() {
try {
String testTable = TEST_SCHEMA + ".testCreateIndex";
String testTable = testSchemaName + ".testCreateIndex";
// cleanup
TableCreator tc = new TableCreator(dataSource);
try {
Expand All @@ -170,7 +157,7 @@ public void testCreateIndex() {
log.debug("cleanup-before-test failed");
}

TableDesc orig = new TableDesc(TEST_SCHEMA, testTable);
TableDesc orig = new TableDesc(testSchemaName, testTable);
orig.tableType = TableDesc.TableType.TABLE;
ColumnDesc col = new ColumnDesc(testTable, "c0", TapDataType.STRING);
orig.getColumnDescs().add(col);
Expand Down Expand Up @@ -199,7 +186,7 @@ public void testCreateIndex() {
@Test
public void testCreateUniqueIndex() {
try {
String testTable = TEST_SCHEMA + ".testCreateUniqueIndex";
String testTable = testSchemaName + ".testCreateUniqueIndex";
// cleanup
TableCreator tc = new TableCreator(dataSource);
try {
Expand All @@ -208,7 +195,7 @@ public void testCreateUniqueIndex() {
log.debug("cleanup-before-test failed");
}

TableDesc orig = new TableDesc(TEST_SCHEMA, testTable);
TableDesc orig = new TableDesc(testSchemaName, testTable);
orig.tableType = TableDesc.TableType.TABLE;
ColumnDesc col = new ColumnDesc(testTable, "c0", TapDataType.STRING);
orig.getColumnDescs().add(col);
Expand Down Expand Up @@ -248,8 +235,8 @@ public void testCreateUniqueIndex() {
@Test
public void testInvalidTableName() {
try {
String testTable = TEST_SCHEMA + ".testInvalidTableName;drop table tap_schema.tables";
TableDesc orig = new TableDesc(TEST_SCHEMA, testTable);
String testTable = testSchemaName + ".testInvalidTableName;drop table tap_schema.tables";
TableDesc orig = new TableDesc(testSchemaName, testTable);
orig.tableType = TableDesc.TableType.TABLE;
orig.getColumnDescs().add(new ColumnDesc(testTable, "c0", TapDataType.STRING));

Expand All @@ -267,8 +254,8 @@ public void testInvalidTableName() {
@Test
public void testInvalidColumnName() {
try {
String testTable = TEST_SCHEMA + ".testInvalidColumnName;drop table tap_schema.tables";
TableDesc orig = new TableDesc(TEST_SCHEMA, testTable);
String testTable = testSchemaName + ".testInvalidColumnName;drop table tap_schema.tables";
TableDesc orig = new TableDesc(testSchemaName, testTable);
orig.tableType = TableDesc.TableType.TABLE;
orig.getColumnDescs().add(new ColumnDesc(testTable, "c0", TapDataType.STRING));

Expand Down
Loading
Loading