blob: 2c93b199832dd5fbd2a83da86875d2a79c5b50aa [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 org.apache.commons.configuration.ConfigurationException;
19import org.junit.Test;
20
21import static org.junit.Assert.assertEquals;
22import static org.onlab.stc.Scenario.loadScenario;
23
24/**
25 * Test of the test scenario entity.
26 */
27public class ScenarioTest {
28
29 @Test
30 public void basics() throws ConfigurationException {
31 Scenario scenario = loadScenario(getClass().getResourceAsStream("scenario.xml"));
32 assertEquals("incorrect name", "foo", scenario.name());
33 assertEquals("incorrect description", "Test Scenario", scenario.description());
34 assertEquals("incorrect logDir", "Test Scenario", scenario.description());
35 assertEquals("incorrect definition", "Test Scenario",
36 scenario.definition().getString("[@description]"));
37 }
38
39 @Test(expected = IllegalArgumentException.class)
40 public void badStream() throws ConfigurationException {
41 loadScenario(getClass().getResourceAsStream("no.xml"));
42 }
43
44}