3 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
\r
5 * This program and the accompanying materials are made available under the
\r
6 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
\r
7 * and is available at http://www.eclipse.org/legal/epl-v10.html
\r
10 package org.opendaylight.controller.containermanager.internal;
\r
12 import static org.junit.Assert.*;
\r
14 import java.util.Hashtable;
\r
16 import org.apache.felix.dm.impl.ComponentImpl;
\r
17 import org.junit.Test;
\r
18 import org.opendaylight.controller.sal.core.Node;
\r
19 import org.opendaylight.controller.sal.utils.NodeCreator;
\r
21 public class ContainerImplTest {
\r
24 public void test() {
\r
26 ContainerImpl container1 = new ContainerImpl();
\r
28 //Create Component for init
\r
29 ComponentImpl component1 = new ComponentImpl(null, null, null);
\r
30 component1.setInterface("serviceTestName", null);
\r
32 //container1 does not have name yet
\r
33 container1.init(component1);
\r
34 assertNull(container1.getName());
\r
36 //Sets container1 name to TestName
\r
37 Hashtable<String, String> properties = new Hashtable<String, String>();
\r
38 properties.put("dummyKey", "dummyValue");
\r
39 properties.put("containerName", "TestName");
\r
40 component1.setInterface("serviceTestName", properties);
\r
42 container1.init(component1);
\r
43 assertEquals("TestName", container1.getName());
\r
45 //getContainerFlows always returns null for now
\r
46 assertNull(container1.getContainerFlows());
\r
48 //getTag always returns 0 for now
\r
49 Node n = NodeCreator.createOFNode(1L);
\r
50 assertEquals(0, container1.getTag(n));
\r
52 //getNodeConnectors always returns null for now
\r
53 assertNull(container1.getNodeConnectors());
\r
55 //getNodes always returns null for now
\r
56 assertNull(container1.getNodes());
\r