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 org.apache.felix.dm.impl.ComponentImpl;
\r
13 import org.junit.Test;
\r
14 import org.opendaylight.controller.sal.core.Node;
\r
15 import org.opendaylight.controller.sal.utils.NodeCreator;
\r
17 import java.util.Hashtable;
\r
19 import static junit.framework.Assert.assertNull;
\r
20 import static org.junit.Assert.assertEquals;
\r
22 public class ContainerImplTest {
\r
25 public void test() {
\r
27 ContainerImpl container1 = new ContainerImpl();
\r
29 //Create Component for init
\r
30 ComponentImpl component1 = new ComponentImpl(null, null, null);
\r
31 component1.setInterface("serviceTestName", null);
\r
33 //container1 does not have name yet
\r
34 container1.init(component1);
\r
35 assertNull(container1.getName());
\r
37 //Sets container1 name to TestName
\r
38 Hashtable<String, String> properties = new Hashtable<String, String>();
\r
39 properties.put("dummyKey", "dummyValue");
\r
40 properties.put("containerName", "TestName");
\r
41 component1.setInterface("serviceTestName", properties);
\r
43 container1.init(component1);
\r
44 assertEquals("TestName", container1.getName());
\r
46 //getContainerFlows always returns null for now
\r
47 assertNull(container1.getContainerFlows());
\r
49 //getTag always returns 0 for now
\r
50 Node n = NodeCreator.createOFNode(1L);
\r
51 assertEquals(0, container1.getTag(n));
\r
53 //getNodeConnectors always returns null for now
\r
54 assertNull(container1.getNodeConnectors());
\r
56 //getNodes always returns null for now
\r
57 assertNull(container1.getNodes());
\r