[88] | 1 | package com.framsticks.running; |
---|
| 2 | |
---|
| 3 | |
---|
| 4 | // import java.util.Arrays; |
---|
[107] | 5 | // import java.util.Arrays; |
---|
| 6 | // import java.util.LinkedList; |
---|
| 7 | // import java.util.List; |
---|
[88] | 8 | |
---|
| 9 | import org.testng.annotations.Test; |
---|
| 10 | |
---|
[107] | 11 | // import com.framsticks.params.EventListener; |
---|
| 12 | // import com.framsticks.structure.messages.ValueChange; |
---|
| 13 | // import com.framsticks.util.dispatching.Monitor; |
---|
| 14 | |
---|
| 15 | // import static org.fest.assertions.Assertions.*; |
---|
[88] | 16 | import com.framsticks.test.TestConfiguration; |
---|
| 17 | |
---|
| 18 | @Test |
---|
| 19 | public class ExternalProcessTest extends TestConfiguration { |
---|
| 20 | |
---|
[90] | 21 | @Test(timeOut = 1000) |
---|
[88] | 22 | public void runBash() throws InterruptedException { |
---|
[107] | 23 | // TODO: needs improvement in directory configuration of the ExternalProcess |
---|
| 24 | // final ExternalProcess process = new ExternalProcess(); |
---|
| 25 | // process.setCommand("bash"); |
---|
[88] | 26 | |
---|
[107] | 27 | // final List<String> input = Arrays.asList("test", "another line"); |
---|
| 28 | // final List<String> output = new LinkedList<>(); |
---|
[88] | 29 | |
---|
[107] | 30 | // process.addOutputListener(new EventListener<ValueChange>() { |
---|
| 31 | // @Override |
---|
| 32 | // public void action(ValueChange change) { |
---|
| 33 | // output.add(change.value.toString()); |
---|
| 34 | // } |
---|
| 35 | // }); |
---|
| 36 | // Monitor monitor = new Monitor(process); |
---|
| 37 | // monitor.use(); |
---|
[88] | 38 | |
---|
[107] | 39 | // for (String l : input) { |
---|
| 40 | // process.getInput().println("echo " + l); |
---|
| 41 | // } |
---|
[88] | 42 | |
---|
[107] | 43 | // process.getInput().close(); |
---|
[88] | 44 | |
---|
[107] | 45 | // monitor.waitFor(); |
---|
| 46 | // monitor.drop(); |
---|
| 47 | // monitor.join(); |
---|
[88] | 48 | |
---|
[107] | 49 | // assertThat(output).isEqualTo(input); |
---|
[88] | 50 | } |
---|
| 51 | |
---|
| 52 | } |
---|