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.topology.web.Topology.NodeBean;
19 public class TopologyTest {
22 public void testCreateNodeBean() {
23 Topology topology = new Topology();
24 Node node = NodeCreator.createOFNode(new Long(3));
25 String description = "foo";
27 NodeBean bean = topology.createNodeBean(description, node);
30 assertEquals(bean.id, node.toString());
31 assertEquals(bean.name, "foo");
33 bean = topology.createNodeBean(null, node);
36 assertEquals(bean.id, node.toString());
37 assertEquals(bean.name, bean.id);
39 bean = topology.createNodeBean(" ", node);
42 assertEquals(bean.id, node.toString());
43 assertEquals(bean.name, bean.id);