OpenDaylight Controller functional modules.
[controller.git] / opendaylight / web / topology / src / test / java / org / opendaylight / controller / topology / web / TopologyTest.java
1 package org.opendaylight.controller.topology.web;
2
3 import static org.junit.Assert.assertEquals;
4 import static org.junit.Assert.assertNotNull;
5
6 import org.junit.Test;
7 import org.opendaylight.controller.sal.core.Node;
8 import org.opendaylight.controller.sal.utils.NodeCreator;
9 import org.opendaylight.controller.switchmanager.SwitchConfig;
10 import org.opendaylight.controller.topology.web.Topology.NodeBean;
11                 
12 public class TopologyTest {
13
14         @Test
15         public void testCreateNodeBean() {
16                 Topology topology = new Topology();
17                 Node node = NodeCreator.createOFNode(new Long(3));
18                 SwitchConfig mockSwitchConfig = new SwitchConfig(node.getNodeIDString(), "foo", null, null);
19                 
20                 NodeBean bean = topology.createNodeBean(mockSwitchConfig, node);
21                 
22                 assertNotNull(bean);
23                 assertEquals(bean.id, node.toString());
24                 assertEquals(bean.name, "foo");
25                 
26                 bean = topology.createNodeBean(null, node);
27                 
28                 assertNotNull(bean);
29                 assertEquals(bean.id, node.toString());
30                 assertEquals(bean.name, bean.id);
31         }
32
33 }