diff options
author | gjoranv <gv@yahoo-inc.com> | 2017-03-02 00:15:38 +0100 |
---|---|---|
committer | gjoranv <gv@yahoo-inc.com> | 2017-03-02 00:29:09 +0100 |
commit | f238d6793d32e139b1c3f17857da6ea492ed2c70 (patch) | |
tree | 10b971bdecfa4265f90edcc44fc3b0a134a307ab /vespajlib/src/test/java/com/yahoo | |
parent | d37abf742d3fa48ad564ab72689c91a1a1c81209 (diff) |
Add a configurable process executor based on commons-exec.
Diffstat (limited to 'vespajlib/src/test/java/com/yahoo')
-rw-r--r-- | vespajlib/src/test/java/com/yahoo/system/execution/ProcessExecutorTest.java | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/vespajlib/src/test/java/com/yahoo/system/execution/ProcessExecutorTest.java b/vespajlib/src/test/java/com/yahoo/system/execution/ProcessExecutorTest.java new file mode 100644 index 00000000000..b12d66853fe --- /dev/null +++ b/vespajlib/src/test/java/com/yahoo/system/execution/ProcessExecutorTest.java @@ -0,0 +1,25 @@ +// Copyright 2017 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.system.execution; + +import org.junit.Test; + +import java.util.Optional; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +/** + * @author gjoranv + */ +public class ProcessExecutorTest { + + @Test + public void echo_can_be_executed() throws Exception { + final String message = "Hello from executor!"; + ProcessExecutor executor = new ProcessExecutor.Builder(10).build(); + Optional<ProcessResult> result = executor.execute("echo " + message); + assertTrue(result.isPresent()); + assertEquals(message, result.get().stdOut.trim()); + assertEquals("", result.get().stdErr); + } +} |