source: java/main/src/test/java/com/framsticks/running/ExternalProcessTest.java @ 105

Last change on this file since 105 was 105, checked in by psniegowski, 11 years ago

HIGHLIGHTS:

  • import refactorization: move Tree, Path, etc.

from core to structure package

  • initial serialization implementation
  • improve PrimeExperiment? test
  • many organizational changes and convenience improvements

CHANGELOG:
Make registry in AbstractTree? final.

Move most classes from core to structure package.

Minor changes.

Switch names of Future and FutureHandler?.

Rename ExceptionResultHandler? to ExceptionHandler?.

Rename ExceptionHandler? to ExceptionDispatcherHandler?.

Fix bug in ParamCandidate? cache.

Add missing synchronization to the BufferedDispatcher?.

Develop @Serialized support.

Rework serialization further.

Add serialization/deserialization interface to ValueParam?.

Move getStorageType and isNumeric from Param down to params hierarchy.

Minor changes.

Improve param type induction.

Add TestSerializedClass? for testing new serialization.

Add info files gor GenePool? and Population.

Add standard.expt exemplary netfile.

Add type name field to PropertiesObject?.

Use PropertiesObject? for PropertiesAccess? instead of ordinary map.

Hide getFramsClass is several more places.

More unification accross FramsClass?, Access and Path.

Add ParamCollection?.

Simplify interface for getting params from FramsClass?, Access
or Path.

Make Access.call() interface variadic.

Add arguments(args) convenience wrapper around new Object[] {args}.

Upgrade to apache.commons.lang version 3.1

Minor improvement with Response constructors.

Develop proper result printing in ClientAtServer?.

Add experimentNetsave to PrimeExperiment?.

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