OpenDaylight Controller functional modules.
[controller.git] / opendaylight / containermanager / implementation / src / test / java / org / opendaylight / controller / containermanager / internal / ContainerImplTest.java
diff --git a/opendaylight/containermanager/implementation/src/test/java/org/opendaylight/controller/containermanager/internal/ContainerImplTest.java b/opendaylight/containermanager/implementation/src/test/java/org/opendaylight/controller/containermanager/internal/ContainerImplTest.java
new file mode 100644 (file)
index 0000000..4bdd679
--- /dev/null
@@ -0,0 +1,60 @@
+\r
+/*\r
+ * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.\r
+ *\r
+ * This program and the accompanying materials are made available under the\r
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
+ * and is available at http://www.eclipse.org/legal/epl-v10.html\r
+ */\r
+\r
+package org.opendaylight.controller.containermanager.internal;\r
+\r
+import static org.junit.Assert.*;\r
+\r
+import java.util.Hashtable;\r
+\r
+import org.apache.felix.dm.impl.ComponentImpl;\r
+import org.junit.Test;\r
+import org.opendaylight.controller.sal.core.Node;\r
+import org.opendaylight.controller.sal.utils.NodeCreator;\r
+\r
+public class ContainerImplTest {\r
+\r
+       @Test\r
+       public void test() {\r
+               \r
+               ContainerImpl container1 = new ContainerImpl();\r
+                               \r
+               //Create Component for init\r
+               ComponentImpl component1 = new ComponentImpl(null, null, null);\r
+               component1.setInterface("serviceTestName", null);\r
+\r
+               //container1 does not have name yet\r
+               container1.init(component1);\r
+               assertNull(container1.getName());\r
+               \r
+               //Sets container1 name to TestName\r
+               Hashtable<String, String> properties = new Hashtable<String, String>();\r
+               properties.put("dummyKey", "dummyValue");\r
+               properties.put("containerName", "TestName");\r
+               component1.setInterface("serviceTestName", properties);\r
+\r
+               container1.init(component1);\r
+               assertEquals("TestName", container1.getName());\r
+               \r
+               //getContainerFlows always returns null for now\r
+               assertNull(container1.getContainerFlows());\r
+               \r
+               //getTag always returns 0 for now\r
+               Node n = NodeCreator.createOFNode(1L);\r
+               assertEquals(0, container1.getTag(n));\r
+               \r
+               //getNodeConnectors always returns null for now\r
+               assertNull(container1.getNodeConnectors());\r
+               \r
+               //getNodes always returns null for now\r
+               assertNull(container1.getNodes());\r
+               \r
+       }\r
+\r
+}\r