use of org.testcontainers.containers.Container in project alluxio by Alluxio.
the class TableIntegrationTest method execBeeline.
/**
* Runs a sequence of commands via beeline, within the HMS container.
*
* @param commands the list of commands
*/
private static void execBeeline(List<String> commands) throws Exception {
File file = sFolder.newFile();
PrintWriter writer = new PrintWriter(file.getAbsolutePath());
for (String line : commands) {
writer.println(line);
}
writer.close();
sHms.copyFileToContainer(MountableFile.forHostPath(file.getAbsolutePath()), "/opt/" + file.getName());
Container.ExecResult result = sHms.execInContainer("/opt/hive/bin/beeline", "-u", "jdbc:hive2://", "-f", "/opt/" + file.getName());
if (result.getExitCode() != 0) {
throw new IOException("beeline commands failed. stderr: " + result.getStderr());
}
}
Aggregations