Enhancing STC and scenarios.
Change-Id: I57a4d25b7fb726a1242073055474ff5c7c3c1087
diff --git a/utils/stc/src/main/java/org/onlab/stc/Step.java b/utils/stc/src/main/java/org/onlab/stc/Step.java
index 834e0ec..3d8ea98 100644
--- a/utils/stc/src/main/java/org/onlab/stc/Step.java
+++ b/utils/stc/src/main/java/org/onlab/stc/Step.java
@@ -29,22 +29,28 @@
protected final String name;
protected final String command;
+ protected final String env;
+ protected final String cwd;
protected final Group group;
/**
* Creates a new test step.
*
- * @param name step name
- * @param command step command to execute
- * @param group optional group to which this step belongs
+ * @param name step name
+ * @param command step command to execute
+ * @param env path to file to be sourced into the environment
+ * @param cwd path to current working directory for the step
+ * @param group optional group to which this step belongs
*/
- public Step(String name, String command, Group group) {
+ public Step(String name, String command, String env, String cwd, Group group) {
this.name = checkNotNull(name, "Name cannot be null");
this.group = group;
- // Set the command; if one is not given default to the enclosing group
- this.command = command != null ? command :
- group != null && group.command != null ? group.command : null;
+ // Set the command, environment and cwd
+ // If one is not given use the value from the enclosing group
+ this.command = command != null ? command : group != null && group.command != null ? group.command : null;
+ this.env = env != null ? env : group != null && group.env != null ? group.env : null;
+ this.cwd = cwd != null ? cwd : group != null && group.cwd != null ? group.cwd : null;
}
/**
@@ -66,6 +72,24 @@
}
/**
+ * Returns the step environment script path.
+ *
+ * @return env script path
+ */
+ public String env() {
+ return env;
+ }
+
+ /**
+ * Returns the step current working directory path.
+ *
+ * @return current working dir path
+ */
+ public String cwd() {
+ return cwd;
+ }
+
+ /**
* Returns the enclosing group; null if none.
*
* @return enclosing group or null
@@ -97,6 +121,8 @@
return MoreObjects.toStringHelper(this)
.add("name", name)
.add("command", command)
+ .add("env", env)
+ .add("cwd", cwd)
.add("group", group)
.toString();
}