summaryrefslogtreecommitdiffstats
path: root/framework/src/onos/utils/stc/src/test/java/org/onlab/stc
diff options
context:
space:
mode:
Diffstat (limited to 'framework/src/onos/utils/stc/src/test/java/org/onlab/stc')
-rw-r--r--framework/src/onos/utils/stc/src/test/java/org/onlab/stc/CompilerTest.java86
-rw-r--r--framework/src/onos/utils/stc/src/test/java/org/onlab/stc/CoordinatorTest.java83
-rw-r--r--framework/src/onos/utils/stc/src/test/java/org/onlab/stc/DependencyTest.java68
-rw-r--r--framework/src/onos/utils/stc/src/test/java/org/onlab/stc/GroupTest.java54
-rw-r--r--framework/src/onos/utils/stc/src/test/java/org/onlab/stc/MonitorLayoutTest.java146
-rw-r--r--framework/src/onos/utils/stc/src/test/java/org/onlab/stc/ScenarioTest.java44
-rw-r--r--framework/src/onos/utils/stc/src/test/java/org/onlab/stc/StepProcessorTest.java84
-rw-r--r--framework/src/onos/utils/stc/src/test/java/org/onlab/stc/StepTest.java62
8 files changed, 0 insertions, 627 deletions
diff --git a/framework/src/onos/utils/stc/src/test/java/org/onlab/stc/CompilerTest.java b/framework/src/onos/utils/stc/src/test/java/org/onlab/stc/CompilerTest.java
deleted file mode 100644
index 59b55307..00000000
--- a/framework/src/onos/utils/stc/src/test/java/org/onlab/stc/CompilerTest.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onlab.stc;
-
-import com.google.common.io.Files;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-
-import static com.google.common.io.ByteStreams.toByteArray;
-import static com.google.common.io.Files.write;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertSame;
-import static org.onlab.stc.Scenario.loadScenario;
-
-/**
- * Test of the test scenario compiler.
- */
-public class CompilerTest {
-
- static final File TEST_DIR = Files.createTempDir();
-
- @BeforeClass
- public static void setUpClass() throws IOException {
- stageTestResource("scenario.xml");
- stageTestResource("simple-scenario.xml");
- stageTestResource("one-scenario.xml");
- stageTestResource("two-scenario.xml");
-
- System.setProperty("prop.foo", "Foobar");
- System.setProperty("prop.bar", "Barfoo");
- System.setProperty("TOC1", "1.2.3.1");
- System.setProperty("TOC2", "1.2.3.2");
- System.setProperty("TOC3", "1.2.3.3");
- System.setProperty("test.dir", TEST_DIR.getAbsolutePath());
- }
-
- static FileInputStream getStream(String name) throws FileNotFoundException {
- return new FileInputStream(new File(TEST_DIR, name));
- }
-
- static void stageTestResource(String name) throws IOException {
- byte[] bytes = toByteArray(CompilerTest.class.getResourceAsStream(name));
- write(bytes, new File(TEST_DIR, name));
- }
-
- @Test
- public void basics() throws Exception {
- Scenario scenario = loadScenario(getStream("scenario.xml"));
- Compiler compiler = new Compiler(scenario);
- compiler.compile();
- ProcessFlow flow = compiler.processFlow();
-
- assertSame("incorrect scenario", scenario, compiler.scenario());
- assertEquals("incorrect step count", 33, flow.getVertexes().size());
- assertEquals("incorrect dependency count", 26, flow.getEdges().size());
- assertEquals("incorrect logDir",
- new File(TEST_DIR.getAbsolutePath(), "foo"), compiler.logDir());
-
- Step step = compiler.getStep("there");
- assertEquals("incorrect edge count", 2, flow.getEdgesFrom(step).size());
- assertEquals("incorrect edge count", 0, flow.getEdgesTo(step).size());
-
- Step group = compiler.getStep("three");
- assertEquals("incorrect edge count", 2, flow.getEdgesFrom(group).size());
- assertEquals("incorrect edge count", 0, flow.getEdgesTo(group).size());
- }
-
-} \ No newline at end of file
diff --git a/framework/src/onos/utils/stc/src/test/java/org/onlab/stc/CoordinatorTest.java b/framework/src/onos/utils/stc/src/test/java/org/onlab/stc/CoordinatorTest.java
deleted file mode 100644
index c6f057ec..00000000
--- a/framework/src/onos/utils/stc/src/test/java/org/onlab/stc/CoordinatorTest.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onlab.stc;
-
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.onlab.util.Tools;
-
-import java.io.IOException;
-
-import static org.onlab.stc.CompilerTest.getStream;
-import static org.onlab.stc.Coordinator.print;
-import static org.onlab.stc.Scenario.loadScenario;
-
-/**
- * Test of the test coordinator.
- */
-public class CoordinatorTest {
-
- private Coordinator coordinator;
- private StepProcessListener listener = new Listener();
-
- @BeforeClass
- public static void setUpClass() throws IOException {
- CompilerTest.setUpClass();
- Tools.removeDirectory(StepProcessorTest.DIR);
-
- StepProcessor.launcher = "true ";
- }
-
- @Test
- public void simple() throws IOException, InterruptedException {
- executeTest("simple-scenario.xml");
- }
-
- @Test
- public void complex() throws IOException, InterruptedException {
- executeTest("scenario.xml");
- }
-
- private void executeTest(String name) throws IOException, InterruptedException {
- Scenario scenario = loadScenario(getStream(name));
- Compiler compiler = new Compiler(scenario);
- compiler.compile();
- Tools.removeDirectory(compiler.logDir());
- coordinator = new Coordinator(scenario, compiler.processFlow(), compiler.logDir());
- coordinator.addListener(listener);
- coordinator.reset();
- coordinator.start();
- coordinator.waitFor();
- coordinator.removeListener(listener);
- }
-
- private class Listener implements StepProcessListener {
- @Override
- public void onStart(Step step, String command) {
- print("> %s: started; %s", step.name(), command);
- }
-
- @Override
- public void onCompletion(Step step, Coordinator.Status status) {
- print("< %s: %s", step.name(), status == Coordinator.Status.SUCCEEDED ? "completed" : "failed");
- }
-
- @Override
- public void onOutput(Step step, String line) {
- print(" %s: %s", step.name(), line);
- }
- }
-} \ No newline at end of file
diff --git a/framework/src/onos/utils/stc/src/test/java/org/onlab/stc/DependencyTest.java b/framework/src/onos/utils/stc/src/test/java/org/onlab/stc/DependencyTest.java
deleted file mode 100644
index 4438303c..00000000
--- a/framework/src/onos/utils/stc/src/test/java/org/onlab/stc/DependencyTest.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onlab.stc;
-
-import com.google.common.testing.EqualsTester;
-import org.apache.commons.configuration.ConfigurationException;
-import org.junit.Before;
-import org.junit.Test;
-
-import static org.junit.Assert.*;
-
-/**
- * Test of the test step dependency.
- */
-public class DependencyTest extends StepTest {
-
- protected Step step1, step2;
-
- @Before
- public void setUp() throws ConfigurationException {
- super.setUp();
- step1 = new Step("step1", CMD, null, null, null);
- step2 = new Step("step2", CMD, null, null, null);
- }
-
- @Test
- public void hard() {
- Dependency hard = new Dependency(step1, step2, false);
- assertSame("incorrect src", step1, hard.src());
- assertSame("incorrect dst", step2, hard.dst());
- assertFalse("incorrect isSoft", hard.isSoft());
- }
-
- @Test
- public void soft() {
- Dependency soft = new Dependency(step2, step1, true);
- assertSame("incorrect src", step2, soft.src());
- assertSame("incorrect dst", step1, soft.dst());
- assertTrue("incorrect isSoft", soft.isSoft());
- }
-
- @Test
- public void equality() {
- Dependency d1 = new Dependency(step1, step2, false);
- Dependency d2 = new Dependency(step1, step2, false);
- Dependency d3 = new Dependency(step1, step2, true);
- Dependency d4 = new Dependency(step2, step1, true);
- new EqualsTester()
- .addEqualityGroup(d1, d2)
- .addEqualityGroup(d3)
- .addEqualityGroup(d4)
- .testEquals();
- }
-
-} \ No newline at end of file
diff --git a/framework/src/onos/utils/stc/src/test/java/org/onlab/stc/GroupTest.java b/framework/src/onos/utils/stc/src/test/java/org/onlab/stc/GroupTest.java
deleted file mode 100644
index 9b612c85..00000000
--- a/framework/src/onos/utils/stc/src/test/java/org/onlab/stc/GroupTest.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onlab.stc;
-
-import com.google.common.testing.EqualsTester;
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertSame;
-
-/**
- * Test of the test scenario entity.
- */
-public class GroupTest extends StepTest {
-
- @Test
- public void basics() {
- Group group = new Group(NAME, CMD, ENV, CWD, parent);
- assertEquals("incorrect name", NAME, group.name());
- assertEquals("incorrect command", CMD, group.command());
- assertEquals("incorrect env", ENV, group.env());
- assertEquals("incorrect cwd", CWD, group.cwd());
- assertSame("incorrect group", parent, group.group());
-
- Step step = new Step("step", null, null, null, group);
- group.addChild(step);
- assertSame("incorrect child", step, group.children().iterator().next());
- }
-
- @Test
- public void equality() {
- Group g1 = new Group(NAME, CMD, null, null, parent);
- Group g2 = new Group(NAME, CMD, ENV, CWD, null);
- Group g3 = new Group("foo", null, null, null, parent);
- new EqualsTester()
- .addEqualityGroup(g1, g2)
- .addEqualityGroup(g3)
- .testEquals();
- }
-
-} \ No newline at end of file
diff --git a/framework/src/onos/utils/stc/src/test/java/org/onlab/stc/MonitorLayoutTest.java b/framework/src/onos/utils/stc/src/test/java/org/onlab/stc/MonitorLayoutTest.java
deleted file mode 100644
index 4b7f5614..00000000
--- a/framework/src/onos/utils/stc/src/test/java/org/onlab/stc/MonitorLayoutTest.java
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onlab.stc;
-
-import org.junit.Test;
-import org.onlab.stc.MonitorLayout.Box;
-
-import java.io.IOException;
-
-import static org.junit.Assert.assertEquals;
-import static org.onlab.stc.CompilerTest.getStream;
-import static org.onlab.stc.CompilerTest.stageTestResource;
-import static org.onlab.stc.MonitorLayout.SLOT_WIDTH;
-import static org.onlab.stc.Scenario.loadScenario;
-
-/**
- * Tests of the monitor layout functionality.
- */
-public class MonitorLayoutTest {
-
- private MonitorLayout layout;
-
- private Compiler getCompiler(String name) throws IOException {
- stageTestResource(name);
- Scenario scenario = loadScenario(getStream(name));
- Compiler compiler = new Compiler(scenario);
- compiler.compile();
- return compiler;
- }
-
- @Test
- public void basic() throws IOException {
- layout = new MonitorLayout(getCompiler("layout-basic.xml"));
- validate(layout, null, 0, 1, 5, 2);
- validate(layout, "a", 1, 1, 1, 1, 1, -SLOT_WIDTH / 2);
- validate(layout, "b", 2, 2, 1, 1, 0, 0);
- validate(layout, "f", 3, 3, 1);
-
- validate(layout, "g", 1, 1, 4, 1, 1, SLOT_WIDTH / 2);
- validate(layout, "c", 2, 1, 1);
- validate(layout, "d", 3, 2, 1);
- validate(layout, "e", 4, 3, 1);
- }
-
- @Test
- public void basicNest() throws IOException {
- layout = new MonitorLayout(getCompiler("layout-basic-nest.xml"));
- validate(layout, null, 0, 1, 6, 2);
- validate(layout, "a", 1, 1, 1, 1, 1, -SLOT_WIDTH / 2);
- validate(layout, "b", 2, 2, 1);
- validate(layout, "f", 3, 3, 1);
-
- validate(layout, "g", 1, 1, 5, 1);
- validate(layout, "c", 2, 1, 1);
-
- validate(layout, "gg", 3, 2, 3, 1);
- validate(layout, "d", 4, 1, 1);
- validate(layout, "e", 5, 2, 1);
- }
-
- @Test
- public void staggeredDependencies() throws IOException {
- layout = new MonitorLayout(getCompiler("layout-staggered-dependencies.xml"));
- validate(layout, null, 0, 1, 7, 4);
- validate(layout, "a", 1, 1, 1, 1, 1, -SLOT_WIDTH - SLOT_WIDTH / 2);
- validate(layout, "aa", 1, 1, 1, 1, 1, -SLOT_WIDTH / 2);
- validate(layout, "b", 2, 2, 1);
- validate(layout, "f", 3, 3, 1);
-
- validate(layout, "g", 1, 1, 5, 2, 1, +SLOT_WIDTH / 2);
- validate(layout, "c", 2, 1, 1);
-
- validate(layout, "gg", 3, 2, 3, 2);
- validate(layout, "d", 4, 1, 1);
- validate(layout, "dd", 4, 1, 1);
- validate(layout, "e", 5, 2, 1);
-
- validate(layout, "i", 6, 6, 1);
- }
-
- @Test
- public void deepNext() throws IOException {
- layout = new MonitorLayout(getCompiler("layout-deep-nest.xml"));
- validate(layout, null, 0, 1, 7, 6);
- validate(layout, "a", 1, 1, 1);
- validate(layout, "aa", 1, 1, 1);
- validate(layout, "b", 2, 2, 1);
- validate(layout, "f", 3, 3, 1);
-
- validate(layout, "g", 1, 1, 5, 2);
- validate(layout, "c", 2, 1, 1);
-
- validate(layout, "gg", 3, 2, 3, 2);
- validate(layout, "d", 4, 1, 1);
- validate(layout, "dd", 4, 1, 1);
- validate(layout, "e", 5, 2, 1);
-
- validate(layout, "i", 6, 6, 1);
-
- validate(layout, "g1", 1, 1, 6, 2);
- validate(layout, "g2", 2, 1, 5, 2);
- validate(layout, "g3", 3, 1, 4, 2);
- validate(layout, "u", 4, 1, 1);
- validate(layout, "v", 4, 1, 1);
- validate(layout, "w", 5, 2, 1);
- validate(layout, "z", 6, 3, 1);
- }
-
-
- private void validate(MonitorLayout layout, String name,
- int absoluteTier, int tier, int depth, int breadth) {
- Box b = layout.get(name);
- assertEquals("incorrect absolute tier", absoluteTier, b.absoluteTier());
- assertEquals("incorrect tier", tier, b.tier());
- assertEquals("incorrect depth", depth, b.depth());
- assertEquals("incorrect breadth", breadth, b.breadth());
- }
-
- private void validate(MonitorLayout layout, String name,
- int absoluteTier, int tier, int depth, int breadth,
- int top, int center) {
- validate(layout, name, absoluteTier, tier, depth, breadth);
- Box b = layout.get(name);
- assertEquals("incorrect top", top, b.top());
- assertEquals("incorrect center", center, b.center());
- }
-
- private void validate(MonitorLayout layout, String name,
- int absoluteTier, int tier, int depth) {
- validate(layout, name, absoluteTier, tier, depth, 1);
- }
-
-} \ No newline at end of file
diff --git a/framework/src/onos/utils/stc/src/test/java/org/onlab/stc/ScenarioTest.java b/framework/src/onos/utils/stc/src/test/java/org/onlab/stc/ScenarioTest.java
deleted file mode 100644
index 2aa51747..00000000
--- a/framework/src/onos/utils/stc/src/test/java/org/onlab/stc/ScenarioTest.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onlab.stc;
-
-import org.apache.commons.configuration.ConfigurationException;
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-import static org.onlab.stc.Scenario.loadScenario;
-
-/**
- * Test of the test scenario entity.
- */
-public class ScenarioTest {
-
- @Test
- public void basics() throws ConfigurationException {
- Scenario scenario = loadScenario(getClass().getResourceAsStream("scenario.xml"));
- assertEquals("incorrect name", "foo", scenario.name());
- assertEquals("incorrect description", "Test Scenario", scenario.description());
- assertEquals("incorrect logDir", "Test Scenario", scenario.description());
- assertEquals("incorrect definition", "Test Scenario",
- scenario.definition().getString("[@description]"));
- }
-
- @Test(expected = IllegalArgumentException.class)
- public void badStream() throws ConfigurationException {
- loadScenario(getClass().getResourceAsStream("no.xml"));
- }
-
-} \ No newline at end of file
diff --git a/framework/src/onos/utils/stc/src/test/java/org/onlab/stc/StepProcessorTest.java b/framework/src/onos/utils/stc/src/test/java/org/onlab/stc/StepProcessorTest.java
deleted file mode 100644
index 74d50241..00000000
--- a/framework/src/onos/utils/stc/src/test/java/org/onlab/stc/StepProcessorTest.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onlab.stc;
-
-import com.google.common.io.Files;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.onlab.util.Tools;
-
-import java.io.File;
-import java.io.IOException;
-
-import static com.google.common.base.Preconditions.checkState;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.onlab.stc.Coordinator.Status.SUCCEEDED;
-
-/**
- * Test of the step processor.
- */
-public class StepProcessorTest {
-
- static final File DIR = Files.createTempDir();
- private final Listener delegate = new Listener();
-
- @BeforeClass
- public static void setUpClass() {
- StepProcessor.launcher = "echo";
- checkState(DIR.exists() || DIR.mkdirs(), "Unable to create directory");
- }
-
- @AfterClass
- public static void tearDownClass() throws IOException {
- Tools.removeDirectory(DIR.getPath());
- }
-
- @Test
- public void basics() {
- Step step = new Step("foo", "ls " + DIR.getAbsolutePath(), null, null, null);
- StepProcessor processor = new StepProcessor(step, DIR, delegate, step.command());
- processor.run();
- assertTrue("should be started", delegate.started);
- assertTrue("should be stopped", delegate.stopped);
- assertEquals("incorrect status", SUCCEEDED, delegate.status);
- assertTrue("should have output", delegate.output);
- }
-
- private class Listener implements StepProcessListener {
-
- private Coordinator.Status status;
- private boolean started, stopped, output;
-
- @Override
- public void onStart(Step step, String command) {
- started = true;
- }
-
- @Override
- public void onCompletion(Step step, Coordinator.Status status) {
- stopped = true;
- this.status = status;
- }
-
- @Override
- public void onOutput(Step step, String line) {
- output = true;
- }
- }
-
-} \ No newline at end of file
diff --git a/framework/src/onos/utils/stc/src/test/java/org/onlab/stc/StepTest.java b/framework/src/onos/utils/stc/src/test/java/org/onlab/stc/StepTest.java
deleted file mode 100644
index 71083624..00000000
--- a/framework/src/onos/utils/stc/src/test/java/org/onlab/stc/StepTest.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onlab.stc;
-
-import com.google.common.testing.EqualsTester;
-import org.apache.commons.configuration.ConfigurationException;
-import org.junit.Before;
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertSame;
-
-/**
- * Test of the test step entity.
- */
-public class StepTest {
-
- protected static final String NAME = "step";
- protected static final String CMD = "command";
- protected static final String ENV = "environment";
- protected static final String CWD = "directory";
- protected Group parent;
-
- @Before
- public void setUp() throws ConfigurationException {
- parent = new Group("parent", null, null, null, null);
- }
-
- @Test
- public void basics() {
- Step step = new Step(NAME, CMD, ENV, CWD, parent);
- assertEquals("incorrect name", NAME, step.name());
- assertEquals("incorrect command", CMD, step.command());
- assertEquals("incorrect env", ENV, step.env());
- assertEquals("incorrect cwd", CWD, step.cwd());
- assertSame("incorrect group", parent, step.group());
- }
-
- @Test
- public void equality() {
- Step s1 = new Step(NAME, CMD, null, null, parent);
- Step s2 = new Step(NAME, CMD, ENV, CWD, null);
- Step s3 = new Step("foo", null, null, null, parent);
- new EqualsTester()
- .addEqualityGroup(s1, s2)
- .addEqualityGroup(s3)
- .testEquals();
- }
-} \ No newline at end of file