Fix handleDeletions 63/77463/1
authorClaudio D. Gasparini <claudio.gasparini@pantheon.tech>
Fri, 2 Nov 2018 16:50:05 +0000 (17:50 +0100)
committerClaudio D. Gasparini <claudio.gasparini@pantheon.tech>
Fri, 2 Nov 2018 17:11:30 +0000 (18:11 +0100)
JIRA: BGPCEP-840
Change-Id: Icef3407608e526f95621ae786524b70c0358d3d1
Signed-off-by: Claudio D. Gasparini <claudio.gasparini@pantheon.tech>
bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/config/BgpDeployerImpl.java
bgp/rib-impl/src/test/java/org/opendaylight/protocol/bgp/rib/impl/config/BgpDeployerImplTest.java

index da4c1a6bb71870d5965e359ca26b0ee34f34dbb8..76c3e97a47d4972e4e9a55bce07a91b6f2b7be81 100644 (file)
@@ -169,11 +169,11 @@ public final class BgpDeployerImpl implements ClusteredDataTreeChangeListener<Bg
         final List<DataObjectModification<? extends DataObject>> peerMod = deletedConfig.stream()
                 .filter(mod -> !mod.getDataType().equals(Global.class))
                 .collect(Collectors.toList());
-        if (!peerMod.isEmpty()) {
-            handleGlobalChange(peerMod, rootIdentifier);
-        }
         if (!globalMod.isEmpty()) {
-            handlePeersChange(globalMod, rootIdentifier);
+            handleGlobalChange(globalMod, rootIdentifier);
+        }
+        if (!peerMod.isEmpty()) {
+            handlePeersChange(peerMod, rootIdentifier);
         }
     }
 
index f655855e97567e24426b260e24b5bb10336fb903..10a751963f77c50b8fd945431fb0e7f17bf80971 100644 (file)
@@ -161,8 +161,8 @@ public class BgpDeployerImplTest extends DefaultRibPoliciesMockTest {
         verify(this.blueprintContainer).getComponentInstance(eq("ribImpl"));
         verify(this.bundleContext, times(2))
                 .registerService(eq(InstanceType.RIB.getServices()), any(), any(Dictionary.class));
-        verify(this.dataTreeRegistration, times(1)).close();
-        verify(this.registration, times(1)).unregister();
+        verify(this.dataTreeRegistration, times(2)).close();
+        verify(this.registration, times(2)).unregister();
 
         deployer.close();
     }
@@ -196,7 +196,7 @@ public class BgpDeployerImplTest extends DefaultRibPoliciesMockTest {
         //Delete existing Peer
         verify(this.bundleContext, times(2))
                 .registerService(eq(InstanceType.PEER.getServices()), any(BgpPeer.class), any(Dictionary.class));
-        verify(this.registration, times(3)).unregister();
+        verify(this.registration, times(2)).unregister();
 
         deployer.close();
     }