Merge dev/fluorine work across to master
[unimgr.git] / legato-api / src / test / java / org / opendaylight / unimgr / mef / legato / global / sls / LegatoSlsProfileDataTreeChangeListenerTest.java
similarity index 57%
rename from impl/src/test/java/org/opendaylight/unimgr/impl/EvcDataTreeChangeListenerTest.java
rename to legato-api/src/test/java/org/opendaylight/unimgr/mef/legato/global/sls/LegatoSlsProfileDataTreeChangeListenerTest.java
index c3bbe9eb9f559dd5c0347621dc6ac85ef6728612..92c46d43b2138520e6778af924895c19a9985151 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.sls;
 import static org.mockito.Matchers.any;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.times;
@@ -24,7 +23,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.Link;
+import org.opendaylight.unimgr.mef.legato.LegatoSlsProfileController;
+import org.opendaylight.yang.gen.v1.urn.mef.yang.mef.global.rev171215.mef.global.sls.profiles.Profile;
 import org.opendaylight.yangtools.yang.binding.Augmentation;
 import org.opendaylight.yangtools.yang.binding.ChildOf;
 import org.opendaylight.yangtools.yang.binding.DataObject;
@@ -33,97 +33,113 @@ import org.opendaylight.yangtools.yang.binding.Identifier;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier.PathArgument;
 import org.powermock.modules.junit4.PowerMockRunner;
 
+/**
+ * @author Arif.Hussain@Xoriant.Com
+ *
+ */
 @RunWith(PowerMockRunner.class)
-public class EvcDataTreeChangeListenerTest {
+public class LegatoSlsProfileDataTreeChangeListenerTest {
 
-    private EvcDataTreeChangeListener evcDataTreeChangeListener;
+    private LegatoSlsProfileController legatoSlsProfileController;
 
     @Before
     public void setUp() throws Exception {
-        evcDataTreeChangeListener = mock(EvcDataTreeChangeListener.class, Mockito.CALLS_REAL_METHODS);
+        legatoSlsProfileController = mock(LegatoSlsProfileController.class, Mockito.CALLS_REAL_METHODS);
     }
 
     @SuppressWarnings("unchecked")
     @Test
-    public void testEvcmgrDataTreeChangeListener() {
-        Collection<DataTreeModification<Link>> collection = new ArrayList<DataTreeModification<Link>>();
-        DataTreeModification<Link> evc = getDataTreeLink(ModificationType.WRITE);
-        collection.add(evc);
-        evc = getDataTreeLink(ModificationType.DELETE);
-        collection.add(evc);
-        evc = getDataTreeLink(ModificationType.SUBTREE_MODIFIED);
-        collection.add(evc);
-        evcDataTreeChangeListener.onDataTreeChanged(collection);
-        verify(evcDataTreeChangeListener, times(1)).add(any(DataTreeModification.class));
-        verify(evcDataTreeChangeListener, times(1)).remove(any(DataTreeModification.class));
-        verify(evcDataTreeChangeListener, 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);
+        legatoSlsProfileController.onDataTreeChanged(collection);
+        verify(legatoSlsProfileController, times(1)).add(any(DataTreeModification.class));
+        verify(legatoSlsProfileController, times(1)).remove(any(DataTreeModification.class));
+        verify(legatoSlsProfileController, times(1)).update(any(DataTreeModification.class));
     }
 
-    private DataTreeModification<Link> getDataTreeLink(final ModificationType modificationType) {
-        final DataObjectModification<Link> evcDataObjModification = new DataObjectModification<Link>() {
+    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 Link>, 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 Link>> 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<Link> & 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<Link> getDataType() {
+            public Class<Profile> getDataType() {
                 // TODO Auto-generated method stub
                 return null;
             }
+
             @Override
-            public Link getDataBefore() {
+            public Profile getDataBefore() {
                 // TODO Auto-generated method stub
                 return null;
             }
+
             @Override
-            public Link getDataAfter() {
+            public Profile getDataAfter() {
                 // TODO Auto-generated method stub
                 return null;
             }
         };
-        DataTreeModification<Link> modifiedEvc = new DataTreeModification<Link>() {
+
+        DataTreeModification<Profile> modifiedPro = new DataTreeModification<Profile>() {
             @Override
-            public DataTreeIdentifier<Link> getRootPath() {
+            public DataTreeIdentifier<Profile> getRootPath() {
                 return null;
             }
+
             @Override
-            public DataObjectModification<Link> getRootNode() {
-                return evcDataObjModification;
+            public DataObjectModification<Profile> getRootNode() {
+                return proDataObjModification;
             }
         };
-        return modifiedEvc;
+
+        return modifiedPro;
     }
 
 }