Thomas Vachuska

Enhancing STC and scenarios.

Change-Id: I57a4d25b7fb726a1242073055474ff5c7c3c1087
...@@ -8,8 +8,10 @@ ...@@ -8,8 +8,10 @@
8 8
9 type=${1:-bundle} 9 type=${1:-bundle}
10 10
11 +[ $type = app ] && archetype=bundle || archetype=$type
12 +
11 if [ "$1" = "-?" -o "$1" = "-h" -o "$1" = "--help" ]; then 13 if [ "$1" = "-?" -o "$1" = "-h" -o "$1" = "--help" ]; then
12 - echo "usage: $(basename $0) {bundle|ui|cli|api} groupId artifactId version package mvn-options" 14 + echo "usage: $(basename $0) {app|bundle|ui|cli|api} groupId artifactId version package mvn-options"
13 echo " All arguments are optional" 15 echo " All arguments are optional"
14 exit 1 16 exit 1
15 fi 17 fi
...@@ -17,10 +19,16 @@ fi ...@@ -17,10 +19,16 @@ fi
17 otherOptions="" 19 otherOptions=""
18 [ -n "$1" ] && shift 20 [ -n "$1" ] && shift
19 [ -n "$1" ] && otherOptions="$otherOptions -DgroupId=$1" && shift 21 [ -n "$1" ] && otherOptions="$otherOptions -DgroupId=$1" && shift
20 -[ -n "$1" ] && otherOptions="$otherOptions -DartifactId=$1" && shift 22 +[ -n "$1" ] && otherOptions="$otherOptions -DartifactId=$1" && dir=$1 && shift
21 [ -n "$1" ] && otherOptions="$otherOptions -Dversion=$1" && shift 23 [ -n "$1" ] && otherOptions="$otherOptions -Dversion=$1" && shift
22 [ -n "$1" ] && otherOptions="$otherOptions -Dpackage=$1" && shift 24 [ -n "$1" ] && otherOptions="$otherOptions -Dpackage=$1" && shift
23 25
24 mvn archetype:generate -DarchetypeGroupId=org.onosproject \ 26 mvn archetype:generate -DarchetypeGroupId=org.onosproject \
25 - -DarchetypeArtifactId=onos-$type-archetype -DarchetypeVersion=$ONOS_POM_VERSION \
26 - $otherOptions "$@"
...\ No newline at end of file ...\ No newline at end of file
27 + -DarchetypeArtifactId=onos-$archetype-archetype \
28 + -DarchetypeVersion=$ONOS_POM_VERSION $otherOptions "$@"
29 +
30 +# Patch the pom.xml file to make this an app.
31 +if [ $type = app -a -d $dir ]; then
32 + egrep -v " (<!--|-->)" $dir/pom.xml > $dir/pom.app.xml
33 + mv $dir/pom.app.xml $dir/pom.xml
34 +fi
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -108,7 +108,7 @@ ...@@ -108,7 +108,7 @@
108 <plugin> 108 <plugin>
109 <groupId>org.onosproject</groupId> 109 <groupId>org.onosproject</groupId>
110 <artifactId>onos-maven-plugin</artifactId> 110 <artifactId>onos-maven-plugin</artifactId>
111 - <version>1.4-SNAPSHOT</version> 111 + <version>1.4</version>
112 <executions> 112 <executions>
113 <execution> 113 <execution>
114 <id>cfg</id> 114 <id>cfg</id>
......
1 -# tab completion settings for onos-group.
2 -
3 -# options available to onos-group
4 -GOPTS='install kill patch-vm push-keys uninstall'
5 1
2 +# Tab completion settings for onos-group.
6 function _ogroup-opts () { 3 function _ogroup-opts () {
7 local cur=${COMP_WORDS[COMP_CWORD]} 4 local cur=${COMP_WORDS[COMP_CWORD]}
8 -
9 if [ $COMP_CWORD -eq 1 ]; then 5 if [ $COMP_CWORD -eq 1 ]; then
10 - COMPREPLY=( $( compgen -W "$GOPTS help" -- $cur ) ) 6 + COMPREPLY=( $( compgen -W "install kill patch-vm push-keys uninstall help" -- $cur ) )
11 fi 7 fi
12 } 8 }
13 9
14 complete -F _ogroup-opts onos-group 10 complete -F _ogroup-opts onos-group
11 +
12 +
13 +# Tab completion settings for stc
14 +function _stc-opts () {
15 + local cur=${COMP_WORDS[COMP_CWORD]}
16 + if [ $COMP_CWORD -eq 1 ]; then
17 + COMPREPLY=( $( compgen -W "$(cd $ONOS_ROOT/tools/test/scenarios && ls -1 | sed 's/.xml//g')" -- $cur ) )
18 + fi
19 +}
20 +
21 +complete -F _stc-opts stc
22 +
23 +
24 +# Tab completion settings for cell
25 +function _cell-opts () {
26 + local cur=${COMP_WORDS[COMP_CWORD]}
27 + if [ $COMP_CWORD -eq 1 ]; then
28 + COMPREPLY=( $( compgen -W "$(cd $ONOS_ROOT/tools/test/cells && ls -1)" -- $cur ) )
29 + fi
30 +}
31 +
32 +complete -F _cell-opts cell
33 +
34 +
35 +# Tab completion settings for onos-create-app.
36 +function _ocapp-opts () {
37 + local cur=${COMP_WORDS[COMP_CWORD]}
38 + if [ $COMP_CWORD -eq 1 ]; then
39 + COMPREPLY=( $( compgen -W "bundle ui cli" -- $cur ) )
40 + fi
41 +}
42 +
43 +complete -F _ocapp-opts onos-create-app
......
...@@ -6,4 +6,4 @@ ...@@ -6,4 +6,4 @@
6 [ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1 6 [ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1
7 . $ONOS_ROOT/tools/build/envDefaults 7 . $ONOS_ROOT/tools/build/envDefaults
8 8
9 -test -f $ONOS_TAR 9 +ls -l $ONOS_TAR && cksum $ONOS_TAR
......
...@@ -8,4 +8,10 @@ trap "rm -f $aux 2>/dev/null" EXIT ...@@ -8,4 +8,10 @@ trap "rm -f $aux 2>/dev/null" EXIT
8 8
9 onos ${1:-$OCI} scr:list > $aux 9 onos ${1:-$OCI} scr:list > $aux
10 cat $aux 10 cat $aux
11 -grep -q UNSATISFIED $aux && exit 1 || exit 0 11 +grep -q UNSATISFIED $aux && exit 1
12 +
13 +if [ -n "$2" ]; then
14 + echo "Searching for ACTIVE $2"
15 + egrep "ACTIVE.*$2" $aux || exit 1
16 +fi
17 +exit 0
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -3,11 +3,14 @@ ...@@ -3,11 +3,14 @@
3 # System Test Coordinator 3 # System Test Coordinator
4 #------------------------------------------------------------------------------- 4 #-------------------------------------------------------------------------------
5 5
6 -STC_ROOT=${STC_ROOT:-$(dirname $0)/..}
7 -cd $STC_ROOT
8 VER=1.2.0-SNAPSHOT 6 VER=1.2.0-SNAPSHOT
7 +JAR=~/.m2/repository/org/onosproject/onlab-stc/$VER/onlab-stc-$VER.jar
8 +SCENARIOS=$ONOS_ROOT/tools/test/scenarios
9 9
10 -PATH=$PWD/bin:$PATH 10 +scenario=${1:-smoke}
11 11
12 -java -jar ~/.m2/repository/org/onosproject/onlab-stc/$VER/onlab-stc-$VER.jar \ 12 +[ ! -f $scenario ] && scenario=$SCENARIOS/$scenario
13 - "${@:-$ONOS_ROOT/tools/test/scenarios/smoke.xml}" 13 +[ ! -f $scenario ] && scenario=$scenario.xml
14 +[ ! -f $scenario ] && echo "Scenario $scenario file not found" && exit 1
15 +
16 +java -jar $JAR $scenario
......
...@@ -2,4 +2,22 @@ ...@@ -2,4 +2,22 @@
2 #------------------------------------------------------------------------------- 2 #-------------------------------------------------------------------------------
3 # System Test Coordinator process launcher 3 # System Test Coordinator process launcher
4 #------------------------------------------------------------------------------- 4 #-------------------------------------------------------------------------------
5 +
6 +env=$1 && shift
7 +cwd=$1 && shift
8 +
9 +if [ $env != "-" -a $env != "~" ]; then
10 + [ ! -f $env ] && echo "$env file not found" && exit 1
11 + source $env
12 +fi
13 +
14 +if [ $cwd != "-" ]; then
15 + [ ! -d $cwd ] && echo "$cwd directory not found" && exit 1
16 + cd $cwd
17 +fi
18 +
5 "$@" 2>&1 19 "$@" 2>&1
20 +status=$?
21 +
22 +[ $env != "~" ] && exit $status
23 +exit 0
......
1 +<!--
2 + ~ Copyright 2015 Open Networking Laboratory
3 + ~
4 + ~ Licensed under the Apache License, Version 2.0 (the "License");
5 + ~ you may not use this file except in compliance with the License.
6 + ~ You may obtain a copy of the License at
7 + ~
8 + ~ http://www.apache.org/licenses/LICENSE-2.0
9 + ~
10 + ~ Unless required by applicable law or agreed to in writing, software
11 + ~ distributed under the License is distributed on an "AS IS" BASIS,
12 + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 + ~ See the License for the specific language governing permissions and
14 + ~ limitations under the License.
15 + -->
16 +<scenario name="archetypes-test" description="ONOS archetypes test">
17 + <group name="Archetypes" cwd="${WORKSPACE}/tmp/test-app">
18 + <step name="Clean-Up" cwd="${WORKSPACE}/tmp" env="~"
19 + exec="rm -r test-app"/>
20 +
21 + <step name="Create-App" cwd="${WORKSPACE}/tmp" requires="Clean-Up"
22 + exec="onos-create-app app org.test.app test-app 1.2.3 org.test.app -DinteractiveMode=false"/>
23 + <step name="Build-App" requires="Create-App" exec="mvn clean install"/>
24 + <step name="Install-App" requires="Build-App"
25 + exec="onos-app ${OCI} install! target/test-app-1.2.3.oar"/>
26 + <step name="Verify-App" requires="Install-App"
27 + exec="onos-check-components ${OCI} org.test.app.AppComponent"/>
28 +
29 + <step name="Create-App-CLI-Overlay" requires="Install-App"
30 + exec="onos-create-app cli org.test.app test-app 1.2.3 org.test.app -DinteractiveMode=false"/>
31 + <step name="Build-App-With-CLI" requires="Create-App-CLI-Overlay"
32 + exec="mvn clean install"/>
33 + <step name="Reinstall-App-With-CLI" requires="Build-App-With-CLI,-Verify-App"
34 + exec="onos-app ${OCI} reinstall! target/test-app-1.2.3.oar"/>
35 + <step name="Verify-CLI" requires="Reinstall-App-With-CLI"
36 + exec="onos ${OCI} sample"/>
37 +
38 + <step name="Create-App-UI-Overlay" requires="Reinstall-App-With-CLI"
39 + exec="onos-create-app ui org.test.app test-app 1.2.3 org.test.app -DinteractiveMode=false"/>
40 + <step name="Build-App-With-UI" requires="Create-App-UI-Overlay"
41 + exec="mvn clean install"/>
42 + <step name="Reinstall-App-With-UI" requires="Build-App-With-UI,-Verify-CLI"
43 + exec="onos-app ${OCI} reinstall! target/test-app-1.2.3.oar"/>
44 + </group>
45 +</scenario>
...@@ -2,4 +2,18 @@ ...@@ -2,4 +2,18 @@
2 #------------------------------------------------------------------------------- 2 #-------------------------------------------------------------------------------
3 # System Test Coordinator process launcher 3 # System Test Coordinator process launcher
4 #------------------------------------------------------------------------------- 4 #-------------------------------------------------------------------------------
5 +
6 +env=$1 && shift
7 +cwd=$1 && shift
8 +
9 +if [ $env != "-" ]; then
10 + [ ! -f $env ] && echo "$env file not found" && exit 1
11 + source $env
12 +fi
13 +
14 +if [ $cwd != "-" ]; then
15 + [ ! -d $cwd ] && echo "$cwd directory not found" && exit 1
16 + cd $cwd
17 +fi
18 +
5 "$@" 2>&1 19 "$@" 2>&1
......
...@@ -50,6 +50,8 @@ public class Compiler { ...@@ -50,6 +50,8 @@ public class Compiler {
50 private static final String LOG_DIR = "[@logDir]"; 50 private static final String LOG_DIR = "[@logDir]";
51 private static final String NAME = "[@name]"; 51 private static final String NAME = "[@name]";
52 private static final String COMMAND = "[@exec]"; 52 private static final String COMMAND = "[@exec]";
53 + private static final String ENV = "[@env]";
54 + private static final String CWD = "[@cwd]";
53 private static final String REQUIRES = "[@requires]"; 55 private static final String REQUIRES = "[@requires]";
54 private static final String IF = "[@if]"; 56 private static final String IF = "[@if]";
55 private static final String UNLESS = "[@unless]"; 57 private static final String UNLESS = "[@unless]";
...@@ -200,11 +202,12 @@ public class Compiler { ...@@ -200,11 +202,12 @@ public class Compiler {
200 private void processStep(HierarchicalConfiguration cfg, 202 private void processStep(HierarchicalConfiguration cfg,
201 String namespace, Group parentGroup) { 203 String namespace, Group parentGroup) {
202 String name = expand(prefix(cfg.getString(NAME), namespace)); 204 String name = expand(prefix(cfg.getString(NAME), namespace));
203 - String defaultValue = parentGroup != null ? parentGroup.command() : null; 205 + String command = expand(cfg.getString(COMMAND, parentGroup != null ? parentGroup.command() : null));
204 - String command = expand(cfg.getString(COMMAND, defaultValue)); 206 + String env = expand(cfg.getString(ENV, parentGroup != null ? parentGroup.env() : null));
207 + String cwd = expand(cfg.getString(CWD, parentGroup != null ? parentGroup.cwd() : null));
205 208
206 - print("step name=%s command=%s", name, command); 209 + print("step name=%s command=%s env=%s cwd=%s", name, command, env, cwd);
207 - Step step = new Step(name, command, parentGroup); 210 + Step step = new Step(name, command, env, cwd, parentGroup);
208 registerStep(step, cfg, namespace, parentGroup); 211 registerStep(step, cfg, namespace, parentGroup);
209 } 212 }
210 213
...@@ -218,11 +221,12 @@ public class Compiler { ...@@ -218,11 +221,12 @@ public class Compiler {
218 private void processGroup(HierarchicalConfiguration cfg, 221 private void processGroup(HierarchicalConfiguration cfg,
219 String namespace, Group parentGroup) { 222 String namespace, Group parentGroup) {
220 String name = expand(prefix(cfg.getString(NAME), namespace)); 223 String name = expand(prefix(cfg.getString(NAME), namespace));
221 - String defaultValue = parentGroup != null ? parentGroup.command() : null; 224 + String command = expand(cfg.getString(COMMAND, parentGroup != null ? parentGroup.command() : null));
222 - String command = expand(cfg.getString(COMMAND, defaultValue)); 225 + String env = expand(cfg.getString(ENV, parentGroup != null ? parentGroup.env() : null));
226 + String cwd = expand(cfg.getString(CWD, parentGroup != null ? parentGroup.cwd() : null));
223 227
224 - print("group name=%s command=%s", name, command); 228 + print("group name=%s command=%s env=%s cwd=%s", name, command, env, cwd);
225 - Group group = new Group(name, command, parentGroup); 229 + Group group = new Group(name, command, env, cwd, parentGroup);
226 if (registerStep(group, cfg, namespace, parentGroup)) { 230 if (registerStep(group, cfg, namespace, parentGroup)) {
227 compile(cfg, namespace, group); 231 compile(cfg, namespace, group);
228 } 232 }
......
...@@ -31,11 +31,13 @@ public class Group extends Step { ...@@ -31,11 +31,13 @@ public class Group extends Step {
31 * Creates a new test step. 31 * Creates a new test step.
32 * 32 *
33 * @param name group name 33 * @param name group name
34 - * @param command group default command 34 + * @param command default command
35 + * @param env default path to file to be sourced into the environment
36 + * @param cwd default path to current working directory for the step
35 * @param group optional group to which this step belongs 37 * @param group optional group to which this step belongs
36 */ 38 */
37 - public Group(String name, String command, Group group) { 39 + public Group(String name, String command, String env, String cwd, Group group) {
38 - super(name, command, group); 40 + super(name, command, env, cwd, group);
39 } 41 }
40 42
41 /** 43 /**
......
...@@ -29,6 +29,8 @@ public class Step implements Vertex { ...@@ -29,6 +29,8 @@ public class Step implements Vertex {
29 29
30 protected final String name; 30 protected final String name;
31 protected final String command; 31 protected final String command;
32 + protected final String env;
33 + protected final String cwd;
32 protected final Group group; 34 protected final Group group;
33 35
34 /** 36 /**
...@@ -36,15 +38,19 @@ public class Step implements Vertex { ...@@ -36,15 +38,19 @@ public class Step implements Vertex {
36 * 38 *
37 * @param name step name 39 * @param name step name
38 * @param command step command to execute 40 * @param command step command to execute
41 + * @param env path to file to be sourced into the environment
42 + * @param cwd path to current working directory for the step
39 * @param group optional group to which this step belongs 43 * @param group optional group to which this step belongs
40 */ 44 */
41 - public Step(String name, String command, Group group) { 45 + public Step(String name, String command, String env, String cwd, Group group) {
42 this.name = checkNotNull(name, "Name cannot be null"); 46 this.name = checkNotNull(name, "Name cannot be null");
43 this.group = group; 47 this.group = group;
44 48
45 - // Set the command; if one is not given default to the enclosing group 49 + // Set the command, environment and cwd
46 - this.command = command != null ? command : 50 + // If one is not given use the value from the enclosing group
47 - group != null && group.command != null ? group.command : null; 51 + this.command = command != null ? command : group != null && group.command != null ? group.command : null;
52 + this.env = env != null ? env : group != null && group.env != null ? group.env : null;
53 + this.cwd = cwd != null ? cwd : group != null && group.cwd != null ? group.cwd : null;
48 } 54 }
49 55
50 /** 56 /**
...@@ -66,6 +72,24 @@ public class Step implements Vertex { ...@@ -66,6 +72,24 @@ public class Step implements Vertex {
66 } 72 }
67 73
68 /** 74 /**
75 + * Returns the step environment script path.
76 + *
77 + * @return env script path
78 + */
79 + public String env() {
80 + return env;
81 + }
82 +
83 + /**
84 + * Returns the step current working directory path.
85 + *
86 + * @return current working dir path
87 + */
88 + public String cwd() {
89 + return cwd;
90 + }
91 +
92 + /**
69 * Returns the enclosing group; null if none. 93 * Returns the enclosing group; null if none.
70 * 94 *
71 * @return enclosing group or null 95 * @return enclosing group or null
...@@ -97,6 +121,8 @@ public class Step implements Vertex { ...@@ -97,6 +121,8 @@ public class Step implements Vertex {
97 return MoreObjects.toStringHelper(this) 121 return MoreObjects.toStringHelper(this)
98 .add("name", name) 122 .add("name", name)
99 .add("command", command) 123 .add("command", command)
124 + .add("env", env)
125 + .add("cwd", cwd)
100 .add("group", group) 126 .add("group", group)
101 .toString(); 127 .toString();
102 } 128 }
......
...@@ -22,6 +22,7 @@ import java.io.InputStream; ...@@ -22,6 +22,7 @@ import java.io.InputStream;
22 import java.io.InputStreamReader; 22 import java.io.InputStreamReader;
23 import java.io.PrintWriter; 23 import java.io.PrintWriter;
24 24
25 +import static java.lang.String.format;
25 import static org.onlab.stc.Coordinator.print; 26 import static org.onlab.stc.Coordinator.print;
26 27
27 /** 28 /**
...@@ -71,8 +72,8 @@ class StepProcessor implements Runnable { ...@@ -71,8 +72,8 @@ class StepProcessor implements Runnable {
71 * @return exit code 72 * @return exit code
72 */ 73 */
73 private int execute() { 74 private int execute() {
74 - try (PrintWriter pw = new PrintWriter(logFile(step))) { 75 + try (PrintWriter pw = new PrintWriter(logFile())) {
75 - process = Runtime.getRuntime().exec(launcher + step.command()); 76 + process = Runtime.getRuntime().exec(command());
76 processOutput(pw); 77 processOutput(pw);
77 78
78 // Wait for the process to complete and get its exit code. 79 // Wait for the process to complete and get its exit code.
...@@ -90,6 +91,18 @@ class StepProcessor implements Runnable { ...@@ -90,6 +91,18 @@ class StepProcessor implements Runnable {
90 } 91 }
91 92
92 /** 93 /**
94 + * Returns ready-to-run command for the step.
95 + *
96 + * @return command to execute
97 + */
98 + private String command() {
99 + return format("%s %s %s %s", launcher,
100 + step.env() != null ? step.env() : "-",
101 + step.cwd() != null ? step.cwd() : "-",
102 + step.command());
103 + }
104 +
105 + /**
93 * Captures output of the step process. 106 * Captures output of the step process.
94 * 107 *
95 * @param pw print writer to send output to 108 * @param pw print writer to send output to
...@@ -108,12 +121,11 @@ class StepProcessor implements Runnable { ...@@ -108,12 +121,11 @@ class StepProcessor implements Runnable {
108 } 121 }
109 122
110 /** 123 /**
111 - * Returns the log file for the specified step. 124 + * Returns the log file for the step output.
112 * 125 *
113 - * @param step test step
114 * @return log file 126 * @return log file
115 */ 127 */
116 - private File logFile(Step step) { 128 + private File logFile() {
117 return new File(logDir, step.name() + ".log"); 129 return new File(logDir, step.name() + ".log");
118 } 130 }
119 131
......
...@@ -32,8 +32,8 @@ public class DependencyTest extends StepTest { ...@@ -32,8 +32,8 @@ public class DependencyTest extends StepTest {
32 @Before 32 @Before
33 public void setUp() throws ConfigurationException { 33 public void setUp() throws ConfigurationException {
34 super.setUp(); 34 super.setUp();
35 - step1 = new Step("step1", CMD, null); 35 + step1 = new Step("step1", CMD, null, null, null);
36 - step2 = new Step("step2", CMD, null); 36 + step2 = new Step("step2", CMD, null, null, null);
37 } 37 }
38 38
39 @Test 39 @Test
......
...@@ -28,21 +28,23 @@ public class GroupTest extends StepTest { ...@@ -28,21 +28,23 @@ public class GroupTest extends StepTest {
28 28
29 @Test 29 @Test
30 public void basics() { 30 public void basics() {
31 - Group group = new Group(NAME, CMD, parent); 31 + Group group = new Group(NAME, CMD, ENV, CWD, parent);
32 assertEquals("incorrect name", NAME, group.name()); 32 assertEquals("incorrect name", NAME, group.name());
33 assertEquals("incorrect command", CMD, group.command()); 33 assertEquals("incorrect command", CMD, group.command());
34 + assertEquals("incorrect env", ENV, group.env());
35 + assertEquals("incorrect cwd", CWD, group.cwd());
34 assertSame("incorrect group", parent, group.group()); 36 assertSame("incorrect group", parent, group.group());
35 37
36 - Step step = new Step("step", null, group); 38 + Step step = new Step("step", null, null, null, group);
37 group.addChild(step); 39 group.addChild(step);
38 assertSame("incorrect child", step, group.children().iterator().next()); 40 assertSame("incorrect child", step, group.children().iterator().next());
39 } 41 }
40 42
41 @Test 43 @Test
42 public void equality() { 44 public void equality() {
43 - Group g1 = new Group(NAME, CMD, parent); 45 + Group g1 = new Group(NAME, CMD, null, null, parent);
44 - Group g2 = new Group(NAME, CMD, null); 46 + Group g2 = new Group(NAME, CMD, ENV, CWD, null);
45 - Group g3 = new Group("foo", null, parent); 47 + Group g3 = new Group("foo", null, null, null, parent);
46 new EqualsTester() 48 new EqualsTester()
47 .addEqualityGroup(g1, g2) 49 .addEqualityGroup(g1, g2)
48 .addEqualityGroup(g3) 50 .addEqualityGroup(g3)
......
...@@ -36,7 +36,7 @@ public class StepProcessorTest { ...@@ -36,7 +36,7 @@ public class StepProcessorTest {
36 36
37 @BeforeClass 37 @BeforeClass
38 public static void setUpClass() { 38 public static void setUpClass() {
39 - StepProcessor.launcher = ""; 39 + StepProcessor.launcher = "echo";
40 DIR.mkdirs(); 40 DIR.mkdirs();
41 } 41 }
42 42
...@@ -47,7 +47,7 @@ public class StepProcessorTest { ...@@ -47,7 +47,7 @@ public class StepProcessorTest {
47 47
48 @Test 48 @Test
49 public void executed() { 49 public void executed() {
50 - Step step = new Step("foo", "ls /tmp", null); 50 + Step step = new Step("foo", "ls /tmp", null, null, null);
51 StepProcessor processor = new StepProcessor(step, false, DIR, delegate); 51 StepProcessor processor = new StepProcessor(step, false, DIR, delegate);
52 processor.run(); 52 processor.run();
53 assertTrue("should be started", delegate.started); 53 assertTrue("should be started", delegate.started);
...@@ -59,7 +59,7 @@ public class StepProcessorTest { ...@@ -59,7 +59,7 @@ public class StepProcessorTest {
59 59
60 @Test 60 @Test
61 public void skipped() { 61 public void skipped() {
62 - Step step = new Step("foo", "ls /tmp", null); 62 + Step step = new Step("foo", "ls /tmp", null, null, null);
63 StepProcessor processor = new StepProcessor(step, true, DIR, delegate); 63 StepProcessor processor = new StepProcessor(step, true, DIR, delegate);
64 processor.run(); 64 processor.run();
65 assertTrue("should be started", delegate.started); 65 assertTrue("should be started", delegate.started);
......
...@@ -30,26 +30,30 @@ public class StepTest { ...@@ -30,26 +30,30 @@ public class StepTest {
30 30
31 protected static final String NAME = "step"; 31 protected static final String NAME = "step";
32 protected static final String CMD = "command"; 32 protected static final String CMD = "command";
33 + protected static final String ENV = "environment";
34 + protected static final String CWD = "directory";
33 protected Group parent; 35 protected Group parent;
34 36
35 @Before 37 @Before
36 public void setUp() throws ConfigurationException { 38 public void setUp() throws ConfigurationException {
37 - parent = new Group("parent", null, null); 39 + parent = new Group("parent", null, null, null, null);
38 } 40 }
39 41
40 @Test 42 @Test
41 public void basics() { 43 public void basics() {
42 - Step step = new Step(NAME, CMD, parent); 44 + Step step = new Step(NAME, CMD, ENV, CWD, parent);
43 assertEquals("incorrect name", NAME, step.name()); 45 assertEquals("incorrect name", NAME, step.name());
44 assertEquals("incorrect command", CMD, step.command()); 46 assertEquals("incorrect command", CMD, step.command());
47 + assertEquals("incorrect env", ENV, step.env());
48 + assertEquals("incorrect cwd", CWD, step.cwd());
45 assertSame("incorrect group", parent, step.group()); 49 assertSame("incorrect group", parent, step.group());
46 } 50 }
47 51
48 @Test 52 @Test
49 public void equality() { 53 public void equality() {
50 - Step s1 = new Step(NAME, CMD, parent); 54 + Step s1 = new Step(NAME, CMD, null, null, parent);
51 - Step s2 = new Step(NAME, CMD, null); 55 + Step s2 = new Step(NAME, CMD, ENV, CWD, null);
52 - Step s3 = new Step("foo", null, parent); 56 + Step s3 = new Step("foo", null, null, null, parent);
53 new EqualsTester() 57 new EqualsTester()
54 .addEqualityGroup(s1, s2) 58 .addEqualityGroup(s1, s2)
55 .addEqualityGroup(s3) 59 .addEqualityGroup(s3)
......