예제 #1
0
 @Test(groups = CLI, timeOut = TIMEOUT)
 public void shouldRunQuery() throws IOException, InterruptedException {
   launchPrestoCliWithServerArgument();
   presto.waitForPrompt();
   presto.getProcessInput().println("select * from hive.default.nation;");
   assertThat(trimLines(presto.readLinesUntilPrompt())).containsAll(nationTableInteractiveLines);
 }
예제 #2
0
 @AfterTestWithContext
 public void stopPresto() throws InterruptedException {
   if (presto != null) {
     presto.getProcessInput().println(EXIT_COMMAND);
     presto.waitForWithTimeoutAndKill();
   }
 }
예제 #3
0
 @Test(groups = CLI, timeOut = TIMEOUT)
 public void shouldDisplayVersion() throws IOException, InterruptedException {
   launchPrestoCli("--version");
   String version =
       firstNonNull(Presto.class.getPackage().getImplementationVersion(), "(version unknown)");
   assertThat(presto.readRemainingOutputLines()).containsExactly("Presto CLI " + version);
 }
예제 #4
0
  @Test(groups = CLI, timeOut = TIMEOUT)
  public void shouldRunQueryFromFile() throws IOException, InterruptedException {
    File temporayFile = File.createTempFile("test-sql", null);
    temporayFile.deleteOnExit();
    Files.write("select * from hive.default.nation;\n", temporayFile, UTF_8);

    launchPrestoCliWithServerArgument("--file", temporayFile.getAbsolutePath());
    assertThat(trimLines(presto.readRemainingOutputLines())).containsAll(nationTableBatchLines);
  }
예제 #5
0
 @Test(groups = CLI, timeOut = TIMEOUT)
 public void shouldUseCatalogAndSchemaOptions() throws IOException, InterruptedException {
   launchPrestoCliWithServerArgument(
       "--catalog", "hive", "--schema", "default", "--execute", "select * from nation;");
   assertThat(trimLines(presto.readRemainingOutputLines())).containsAll(nationTableBatchLines);
 }
예제 #6
0
 @Test(groups = CLI, timeOut = TIMEOUT)
 public void shouldRunBatchQuery() throws IOException, InterruptedException {
   launchPrestoCliWithServerArgument("--execute", "select * from hive.default.nation;");
   assertThat(trimLines(presto.readRemainingOutputLines())).containsAll(nationTableBatchLines);
 }