Checkstyle enforcer
[controller.git] / opendaylight / web / topology / src / test / java / org / opendaylight / controller / topology / web / TopologyTest.java
1 /*
2  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8
9 package org.opendaylight.controller.topology.web;
10
11 import static org.junit.Assert.assertEquals;
12 import static org.junit.Assert.assertNotNull;
13
14 import org.junit.Test;
15 import org.opendaylight.controller.sal.core.Node;
16 import org.opendaylight.controller.sal.utils.NodeCreator;
17 import org.opendaylight.controller.switchmanager.SwitchConfig;
18 import org.opendaylight.controller.topology.web.Topology.NodeBean;
19
20 public class TopologyTest {
21
22         @Test
23         public void testCreateNodeBean() {
24                 Topology topology = new Topology();
25                 Node node = NodeCreator.createOFNode(new Long(3));
26                 String description = "foo";
27
28                 NodeBean bean = topology.createNodeBean(description, node);
29
30                 assertNotNull(bean);
31                 assertEquals(bean.id, node.toString());
32                 assertEquals(bean.name, "foo");
33
34                 bean = topology.createNodeBean(null, node);
35
36                 assertNotNull(bean);
37                 assertEquals(bean.id, node.toString());
38                 assertEquals(bean.name, bean.id);
39
40                 bean = topology.createNodeBean("   ", node);
41
42                 assertNotNull(bean);
43                 assertEquals(bean.id, node.toString());
44                 assertEquals(bean.name, bean.id);
45         }
46
47 }