Open Kilda Java Documentation
BasicTopoTests.java
Go to the documentation of this file.
1 /* Copyright 2017 Telstra Open Source
2  *
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 package org.openkilda.topo;
17 
18 import static org.junit.Assert.assertTrue;
19 import static org.junit.Assert.fail;
20 
21 import java.io.IOException;
22 import java.net.URL;
23 
24 import org.junit.Test;
25 
26 import com.google.common.base.Charsets;
27 import com.google.common.io.Resources;
28 
35 public class BasicTopoTests {
36 
37  // /**
38  // * @throws java.lang.Exception
39  // */
40  // @BeforeClass
41  // public static void setUpBeforeClass() throws Exception {
42  // }
43  //
44  // /**
45  // * @throws java.lang.Exception
46  // */
47  // @AfterClass
48  // public static void tearDownAfterClass() throws Exception {
49  // }
50  //
51  // /**
52  // * @throws java.lang.Exception
53  // */
54  // @Before
55  // public void setUp() throws Exception {
56  // }
57  //
58  // /**
59  // * @throws java.lang.Exception
60  // */
61  // @After
62  // public void tearDown() throws Exception {
63  // }
64  //
65 
70  @Test
71  public void testBasicMatch() {
72  URL url = Resources.getResource("topologies/topo.fullmesh.2.yml");
73  String doc = "";
74  try {
75  doc = Resources.toString(url, Charsets.UTF_8);
76  ITopology t1 = new Topology();
77  IController ctrl = new MockController(t1);
78  ITopology t2 = ctrl.getTopology();
79  assertTrue(t1.equivalent(t2));
80  } catch (IOException e) {
81  fail("Unexpected Exception:" + e.getMessage());
82  }
83  }
84 
85 }
boolean equivalent(ITopology other)