Skip to content

Commit

Permalink
CADC-13452 various fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jburke-cadc committed Sep 12, 2024
1 parent 40959f3 commit aa2a916
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ private void createTable(TapSchemaDAO ts, String schemaName, String tableName) t
throw new ResourceAlreadyExistsException("table " + tableName + " already exists");
}
// flag table as created using the API to allow table deletion in the DeleteAction
td.apiCreated = true;
inputTable.apiCreated = true;

Profiler prof = new Profiler(PutAction.class);
DatabaseTransactionManager tm = new DatabaseTransactionManager(ds);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ protected void indexTable(Map<String, List<String>> params) {
String tableName = getSingleValue("table", params);
String columnName = getSingleValue("index", params);
boolean unique = "true".equals(getSingleValue("unique", params));
log.debug(String.format("indexing table=%s column=%s unique=%s", tableName, columnName, unique));

if (tableName == null) {
throw new IllegalArgumentException("missing parameter 'table'");
Expand Down
18 changes: 10 additions & 8 deletions youcat/src/intTest/java/org/opencadc/youcat/TableUpdateTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -188,14 +188,17 @@ public void testCreateUniqueIndex() {
}

@Test
public void testIngestTest() {
public void testIngestTable() {
try {
clearSchemaPerms();
TapPermissions tp = new TapPermissions(null, true, null, null);
super.setPerms(schemaOwner, testSchemaName, tp, 200);

// create test table and schema
// cleanup
String testTable = testSchemaName + ".test_ingest_table";
doDelete(schemaOwner, testTable, true);

// create test table and schema
TableDesc td = doCreateTable(schemaOwner, testTable);

// delete the schema from tap_schema
Expand All @@ -206,10 +209,10 @@ public void testIngestTest() {
}

// run the ingest
doIngestTable(schemaOwner, testTable);
doIngestTable(schemaOwner, testTable, ExecutionPhase.COMPLETED);

// cleanup on success
doDelete(schemaOwner, td.getTableName(), false);
doDelete(schemaOwner, testTable, false);
} catch (Exception unexpected) {
log.error("unexpected exception", unexpected);
Assert.fail("unexpected exception: " + unexpected);
Expand Down Expand Up @@ -243,7 +246,7 @@ public void testIngestUnsupportedDataType() {
log.debug("created database table: " + testTable);

try {
doIngestTable(schemaOwner, testTable);
doIngestTable(schemaOwner, testTable, ExecutionPhase.ERROR);
} catch (UnsupportedOperationException expected) {
log.info("expected exception: " + expected);
}
Expand All @@ -256,7 +259,7 @@ public void testIngestUnsupportedDataType() {
}
}

void doIngestTable(Subject subject, String tableName) throws Exception {
void doIngestTable(Subject subject, String tableName, ExecutionPhase expected) throws Exception {
// create job
Map<String,Object> params = new TreeMap<String,Object>();
params.put("op", "ingest");
Expand Down Expand Up @@ -296,8 +299,7 @@ void doIngestTable(Subject subject, String tableName) throws Exception {

JobReader r = new JobReader();
Job end = r.read(new StringReader(xml2));
log.debug(end.getErrorSummary().toString());
// Assert.assertEquals("final job state", ExecutionPhase.COMPLETED, end.getExecutionPhase());
Assert.assertEquals("final job state", expected, end.getExecutionPhase());
}

}

0 comments on commit aa2a916

Please sign in to comment.