Skip to content

Commit

Permalink
update CI to java 11
Browse files Browse the repository at this point in the history
  • Loading branch information
pdowler committed Aug 23, 2024
1 parent 1dd22b2 commit 9827087
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 5 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up JDK 1.8
uses: actions/setup-java@v1
- uses: actions/checkout@v3
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: 1.8

distribution: 'temurin'
java-version: 11

- name: build and test caom2-tap
run: cd caom2-tap && ../gradlew clean build javadoc install
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,23 @@

package org.opencadc.argus;

import ca.nrc.cadc.conformance.uws2.JobResultWrapper;
import ca.nrc.cadc.dali.tables.votable.VOTableDocument;
import ca.nrc.cadc.dali.tables.votable.VOTableInfo;
import ca.nrc.cadc.dali.tables.votable.VOTableReader;
import ca.nrc.cadc.dali.tables.votable.VOTableResource;
import ca.nrc.cadc.tap.integration.TapSyncQueryTest;
import ca.nrc.cadc.util.FileUtil;
import ca.nrc.cadc.util.Log4jInit;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.net.URI;
import java.util.HashMap;
import java.util.Map;
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
import org.junit.Assert;
import org.junit.Test;

/**
*
Expand All @@ -100,4 +110,56 @@ public CaomTapSyncQueryTest() {
super.setPropertiesDir(testDir, "SyncResultTest");
}
}

@Test
public void testUploadBinary() {
try {
Log4jInit.setLevel("org.opencadc.argus", Level.DEBUG);

File binFile = FileUtil.getFileFromResource("binary-vot.xml", CaomTapSyncQueryTest.class);

String tableName = "mytab";
Map<String, Object> params = new HashMap<String, Object>();
params.put("upload1", binFile);
params.put("UPLOAD", tableName + ",param:upload1");
params.put("LANG", "ADQL");
params.put("QUERY", "select * from tap_upload." + tableName);

JobResultWrapper result = createAndExecuteSyncParamJobPOST("testUploadFile", params);

Assert.assertNull(result.throwable);
Assert.assertEquals(200, result.responseCode);

Assert.assertNotNull(result.syncOutput);
ByteArrayInputStream istream = new ByteArrayInputStream(result.syncOutput);
VOTableReader vrdr = new VOTableReader();
VOTableDocument vot = vrdr.read(istream);

String queryStatus = getQueryStatus(vot);
Assert.assertNotNull("QUERY_STATUS", queryStatus);
Assert.assertEquals("OK", queryStatus);

// TODO: verify round-trip of testFile1 -> vot?
} catch (Exception unexpected) {
log.error("unexpected exception", unexpected);
Assert.fail("unexpected exception: " + unexpected);
}
}

static String getQueryStatus(VOTableDocument vot) {
VOTableResource vr = vot.getResourceByType("results");
Assert.assertNotNull(vr);
log.debug("found resource: " + vr.getName() + " " + vr.getType());
String ret = null;
// find the last QUERY_STATUS and return that because there can be a trailing
// status when result processing fails
for (VOTableInfo vi : vr.getInfos()) {
if ("QUERY_STATUS".equals(vi.getName())) {
ret = vi.getValue();
log.warn("found status: " + ret);
}
}
log.warn("return status: " + ret);
return ret;
}
}

0 comments on commit 9827087

Please sign in to comment.