2 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
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
9 package org.opendaylight.controller.topology.web;
11 import static org.junit.Assert.assertEquals;
12 import static org.junit.Assert.assertNotNull;
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;
20 public class TopologyTest {
23 public void testCreateNodeBean() {
24 Topology topology = new Topology();
25 Node node = NodeCreator.createOFNode(new Long(3));
26 String description = "foo";
28 NodeBean bean = topology.createNodeBean(description, node);
31 assertEquals(bean.id, node.toString());
32 assertEquals(bean.name, "foo");
34 bean = topology.createNodeBean(null, node);
37 assertEquals(bean.id, node.toString());
38 assertEquals(bean.name, bean.id);
40 bean = topology.createNodeBean(" ", node);
43 assertEquals(bean.id, node.toString());
44 assertEquals(bean.name, bean.id);