blob: 1d86c678de019397393d904d1670e4e88d7874e8 [file] [log] [blame]
Thomas Vachuskaf9c84362015-04-15 11:20:45 -07001/*
Brian O'Connor5ab426f2016-04-09 01:19:45 -07002 * Copyright 2015-present Open Networking Laboratory
Thomas Vachuskaf9c84362015-04-15 11:20:45 -07003 *
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
Thomas Vachuska664f29e2015-12-08 12:58:16 -080038 * @param delay seconds to delay before executing
Thomas Vachuskaf9c84362015-04-15 11:20:45 -070039 */
Thomas Vachuska664f29e2015-12-08 12:58:16 -080040 public Group(String name, String command, String env, String cwd, Group group, int delay) {
41 super(name, command, env, cwd, group, delay);
Thomas Vachuskaf9c84362015-04-15 11:20:45 -070042 }
43
44 /**
45 * Returns the set of child steps and groups contained within this group.
46 *
47 * @return set of children
48 */
49 public Set<Step> children() {
50 return ImmutableSet.copyOf(children);
51 }
52
53 /**
54 * Adds the specified step or group as a child of this group.
55 *
56 * @param child child step or group to add
57 */
58 public void addChild(Step child) {
59 children.add(child);
60 }
61}