Java Code Examples for org.zeroturnaround.exec.ProcessResult#outputUTF8()

The following examples show how to use org.zeroturnaround.exec.ProcessResult#outputUTF8() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ProcessExecutorMainTest.java    From zt-exec with Apache License 2.0 5 votes vote down vote up
@Test
public void testJavaVersionOutputTwice() throws Exception {
  ProcessExecutor executor = new ProcessExecutor().command("java", "-version").readOutput(true);
  ProcessResult result = executor.execute();
  String str = result.outputUTF8();
  Assert.assertFalse(StringUtils.isEmpty(str));
  Assert.assertEquals(str, executor.execute().outputUTF8());
}
 
Example 2
Source File: ProcessExecutorMainTest.java    From zt-exec with Apache License 2.0 5 votes vote down vote up
@Test
public void testJavaVersionLogInfoAndOutput() throws Exception {
  // Just expect no errors - don't check the log file itself
  ProcessResult result = new ProcessExecutor().command("java", "-version").redirectOutput(Slf4jStream.of("testJavaVersionLogInfoAndOutput").asInfo()).readOutput(true).execute();
  String str = result.outputUTF8();
  Assert.assertFalse(StringUtils.isEmpty(str));
}
 
Example 3
Source File: ProcessExecutorMainTest.java    From zt-exec with Apache License 2.0 5 votes vote down vote up
@Test
public void testJavaVersionLogInfoAndOutputFuture() throws Exception {
  // Just expect no errors - don't check the log file itself
  ProcessResult result = new ProcessExecutor().command("java", "-version").redirectOutput(Slf4jStream.of("testJavaVersionLogInfoAndOutputFuture").asInfo()).readOutput(true).start().getFuture().get();
  String str = result.outputUTF8();
  Assert.assertFalse(StringUtils.isEmpty(str));
}
 
Example 4
Source File: ProcessExecutorMainTest.java    From zt-exec with Apache License 2.0 4 votes vote down vote up
@Test
public void testJavaVersionOutput() throws Exception {
  ProcessResult result = new ProcessExecutor().command("java", "-version").readOutput(true).execute();
  String str = result.outputUTF8();
  Assert.assertFalse(StringUtils.isEmpty(str));
}
 
Example 5
Source File: ProcessExecutorMainTest.java    From zt-exec with Apache License 2.0 4 votes vote down vote up
@Test
public void testJavaVersionOutputFuture() throws Exception {
  ProcessResult result = new ProcessExecutor().command("java", "-version").readOutput(true).start().getFuture().get();
  String str = result.outputUTF8();
  Assert.assertFalse(StringUtils.isEmpty(str));
}