Merge dev/fluorine work across to master
[unimgr.git] / legato-api / src / test / java / org / opendaylight / unimgr / mef / legato / global / l2cp / LegatoL2cpEecProfileDataTreeChangeListenerTest.java
similarity index 57%
rename from impl/src/test/java/org/opendaylight/unimgr/impl/UniDataTreeChangeListenerTest.java
rename to legato-api/src/test/java/org/opendaylight/unimgr/mef/legato/global/l2cp/LegatoL2cpEecProfileDataTreeChangeListenerTest.java
index 40bf5716afcad8bce20ce7a15b3a08567951bd03..2ef39b8eb1b7029874a8bf8d314246ffd1f7fe80 100644 (file)
@@ -1,13 +1,12 @@
 /*
- * Copyright (c) 2016 CableLabs and others.  All rights reserved.
+ * Copyright (c) 2018 Xoriant Corporation and others. All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
 
-package org.opendaylight.unimgr.impl;
-
+package org.opendaylight.unimgr.mef.legato.global.l2cp;
 import static org.mockito.Matchers.any;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.times;
@@ -15,7 +14,6 @@ import static org.mockito.Mockito.verify;
 
 import java.util.ArrayList;
 import java.util.Collection;
-
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -24,7 +22,8 @@ import org.opendaylight.controller.md.sal.binding.api.DataObjectModification;
 import org.opendaylight.controller.md.sal.binding.api.DataObjectModification.ModificationType;
 import org.opendaylight.controller.md.sal.binding.api.DataTreeIdentifier;
 import org.opendaylight.controller.md.sal.binding.api.DataTreeModification;
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node;
+import org.opendaylight.unimgr.mef.legato.LegatoL2cpEecController;
+import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.global.rev171215.mef.global.l2cp.eec.profiles.Profile;
 import org.opendaylight.yangtools.yang.binding.Augmentation;
 import org.opendaylight.yangtools.yang.binding.ChildOf;
 import org.opendaylight.yangtools.yang.binding.DataObject;
@@ -34,96 +33,113 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier.PathArgument;
 import org.powermock.modules.junit4.PowerMockRunner;
 
 
+/**
+ * @author Arif.Hussain@Xoriant.Com
+ *
+ */
 @RunWith(PowerMockRunner.class)
-public class UniDataTreeChangeListenerTest {
+public class LegatoL2cpEecProfileDataTreeChangeListenerTest {
 
-    private UniDataTreeChangeListener uniDataTreeChangeListener;
+    private LegatoL2cpEecController legatoL2cpEecController;
 
     @Before
     public void setUp() throws Exception {
-        uniDataTreeChangeListener = mock(UniDataTreeChangeListener.class, Mockito.CALLS_REAL_METHODS);
+        legatoL2cpEecController = mock(LegatoL2cpEecController.class, Mockito.CALLS_REAL_METHODS);
     }
 
     @SuppressWarnings("unchecked")
     @Test
-    public void testUnimgrDataTreeChangeListener() {
-        Collection<DataTreeModification<Node>> collection = new ArrayList<DataTreeModification<Node>>();
-        DataTreeModification<Node> uni = getDataTreeNode(ModificationType.WRITE);
-        collection.add(uni);
-        uni = getDataTreeNode(ModificationType.DELETE);
-        collection.add(uni);
-        uni = getDataTreeNode(ModificationType.SUBTREE_MODIFIED);
-        collection.add(uni);
-        uniDataTreeChangeListener.onDataTreeChanged(collection);
-        verify(uniDataTreeChangeListener, times(1)).add(any(DataTreeModification.class));
-        verify(uniDataTreeChangeListener, times(1)).remove(any(DataTreeModification.class));
-        verify(uniDataTreeChangeListener, times(1)).update(any(DataTreeModification.class));
+    public void testL2cpEecDataTreeChangeListener() {
+        Collection<DataTreeModification<Profile>> collection = new ArrayList<DataTreeModification<Profile>>();
+        DataTreeModification<Profile> profile = getDataTree(ModificationType.WRITE);
+        collection.add(profile);
+        profile = getDataTree(ModificationType.DELETE);
+        collection.add(profile);
+        profile = getDataTree(ModificationType.SUBTREE_MODIFIED);
+        collection.add(profile);
+        legatoL2cpEecController.onDataTreeChanged(collection);
+        verify(legatoL2cpEecController, times(1)).add(any(DataTreeModification.class));
+        verify(legatoL2cpEecController, times(1)).remove(any(DataTreeModification.class));
+        verify(legatoL2cpEecController, times(1)).update(any(DataTreeModification.class));
     }
 
-    private DataTreeModification<Node> getDataTreeNode(final ModificationType modificationType) {
-        final DataObjectModification<Node> uniDataObjModification = new DataObjectModification<Node>() {
+
+    private DataTreeModification<Profile> getDataTree(final ModificationType modificationType) {
+        final DataObjectModification<Profile> proDataObjModification = new DataObjectModification<Profile>() {
             @Override
             public Collection<DataObjectModification<? extends DataObject>> getModifiedChildren() {
                 // TODO Auto-generated method stub
                 return null;
             }
+
             @Override
-            public <C extends Identifiable<K> & ChildOf<? super Node>, K extends Identifier<C>> DataObjectModification<C> getModifiedChildListItem(
+            public <C extends Identifiable<K> & ChildOf<? super Profile>, K extends Identifier<C>> DataObjectModification<C> getModifiedChildListItem(
                     Class<C> arg0, K arg1) {
                 // TODO Auto-generated method stub
                 return null;
             }
+
             @Override
-            public <C extends ChildOf<? super Node>> DataObjectModification<C> getModifiedChildContainer(Class<C> arg0) {
+            public <C extends ChildOf<? super Profile>> DataObjectModification<C> getModifiedChildContainer(Class<C> arg0) {
                 // TODO Auto-generated method stub
                 return null;
             }
+
             @Override
             public DataObjectModification<? extends DataObject> getModifiedChild(PathArgument arg0) {
                 // TODO Auto-generated method stub
                 return null;
             }
+
             @Override
-            public <C extends Augmentation<Node> & DataObject> DataObjectModification<C> getModifiedAugmentation(
+            public <C extends Augmentation<Profile> & DataObject> DataObjectModification<C> getModifiedAugmentation(
                     Class<C> arg0) {
                 // TODO Auto-generated method stub
                 return null;
             }
+
             @Override
             public ModificationType getModificationType() {
                 return modificationType;
             }
+
             @Override
             public PathArgument getIdentifier() {
                 // TODO Auto-generated method stub
                 return null;
             }
+
             @Override
-            public Class<Node> getDataType() {
+            public Class<Profile> getDataType() {
                 // TODO Auto-generated method stub
                 return null;
             }
+
             @Override
-            public Node getDataBefore() {
+            public Profile getDataBefore() {
                 // TODO Auto-generated method stub
                 return null;
             }
+
             @Override
-            public Node getDataAfter() {
+            public Profile getDataAfter() {
                 // TODO Auto-generated method stub
                 return null;
             }
         };
-        DataTreeModification<Node> modifiedUni = new DataTreeModification<Node>() {
+
+        DataTreeModification<Profile> modifiedPro = new DataTreeModification<Profile>() {
             @Override
-            public DataTreeIdentifier<Node> getRootPath() {
+            public DataTreeIdentifier<Profile> getRootPath() {
                 return null;
             }
+
             @Override
-            public DataObjectModification<Node> getRootNode() {
-                return uniDataObjModification;
+            public DataObjectModification<Profile> getRootNode() {
+                return proDataObjModification;
             }
         };
-        return modifiedUni;
+        return modifiedPro;
     }
+
 }