blob: 0281c364c1ef900803703cdac439f8809ff64302 [file] [log] [blame]
Thomas Vachuskaf9c84362015-04-15 11:20:45 -07001/*
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 */
16package org.onlab.stc;
17
18import com.google.common.collect.ImmutableSet;
19import com.google.common.collect.Sets;
20
21import java.util.Set;
22
23/**
24 * Represenation of a related group of steps.
25 */
26public class Group extends Step {
27
28 private final Set<Step> children = Sets.newHashSet();
29
30 /**
31 * Creates a new test step.
32 *
33 * @param name group name
Thomas Vachuska4bfccd542015-05-30 00:35:25 -070034 * @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
Thomas Vachuskaf9c84362015-04-15 11:20:45 -070037 * @param group optional group to which this step belongs
38 */
Thomas Vachuska4bfccd542015-05-30 00:35:25 -070039 public Group(String name, String command, String env, String cwd, Group group) {
40 super(name, command, env, cwd, group);
Thomas Vachuskaf9c84362015-04-15 11:20:45 -070041 }
42
43 /**
44 * Returns the set of child steps and groups contained within this group.
45 *
46 * @return set of children
47 */
48 public Set<Step> children() {
49 return ImmutableSet.copyOf(children);
50 }
51
52 /**
53 * Adds the specified step or group as a child of this group.
54 *
55 * @param child child step or group to add
56 */
57 public void addChild(Step child) {
58 children.add(child);
59 }
60}