Fix warnings in table-miss-enforcer 73/110473/1
authorRobert Varga <robert.varga@pantheon.tech>
Mon, 4 Mar 2024 16:06:44 +0000 (17:06 +0100)
committerRobert Varga <robert.varga@pantheon.tech>
Mon, 4 Mar 2024 16:06:44 +0000 (17:06 +0100)
We have a few warnings, fix them up.

Change-Id: I65c02c2c27de82066e95e88723e5ec47b0bc80f5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
applications/table-miss-enforcer/src/main/java/org/opendaylight/openflowplugin/applications/tablemissenforcer/LLDPPacketPuntEnforcer.java
applications/table-miss-enforcer/src/test/java/org/opendaylight/openflowplugin/applications/tablemissenforcer/LLDPDataTreeChangeListenerTest.java

index 0ff33f476e8cbdb438324e1e43501b75f514b79a..0c261574bacd98f50dfeb8f1921ebbb27c09d939 100644 (file)
@@ -14,9 +14,9 @@ import javax.annotation.PreDestroy;
 import javax.inject.Inject;
 import javax.inject.Singleton;
 import org.opendaylight.infrautils.utils.concurrent.LoggingFutures;
-import org.opendaylight.mdsal.binding.api.ClusteredDataTreeChangeListener;
 import org.opendaylight.mdsal.binding.api.DataBroker;
 import org.opendaylight.mdsal.binding.api.DataObjectModification.ModificationType;
+import org.opendaylight.mdsal.binding.api.DataTreeChangeListener;
 import org.opendaylight.mdsal.binding.api.DataTreeIdentifier;
 import org.opendaylight.mdsal.binding.api.DataTreeModification;
 import org.opendaylight.mdsal.binding.api.RpcService;
@@ -60,7 +60,7 @@ import org.slf4j.LoggerFactory;
 
 @Singleton
 @Component(service = { })
-public final class LLDPPacketPuntEnforcer implements AutoCloseable, ClusteredDataTreeChangeListener<FlowCapableNode> {
+public final class LLDPPacketPuntEnforcer implements AutoCloseable, DataTreeChangeListener<FlowCapableNode> {
     private static final Logger LOG = LoggerFactory.getLogger(LLDPPacketPuntEnforcer.class);
     private static final Uint8 TABLE_ID = Uint8.ZERO;
     private static final String LLDP_PUNT_WHOLE_PACKET_FLOW = "LLDP_PUNT_WHOLE_PACKET_FLOW";
@@ -77,8 +77,8 @@ public final class LLDPPacketPuntEnforcer implements AutoCloseable, ClusteredDat
             @Reference final RpcService rpcService) {
         this.deviceOwnershipService = requireNonNull(deviceOwnershipService);
         addFlow = rpcService.getRpc(AddFlow.class);
-        listenerRegistration = dataBroker.registerDataTreeChangeListener(
-            DataTreeIdentifier.create(LogicalDatastoreType.OPERATIONAL,
+        listenerRegistration = dataBroker.registerTreeChangeListener(
+            DataTreeIdentifier.of(LogicalDatastoreType.OPERATIONAL,
                 InstanceIdentifier.create(Nodes.class).child(Node.class).augmentation(FlowCapableNode.class)),
             this);
     }
index 57372e07e776d1765d30683f0fe43bcef7103be3..ad16fa6e109a7f7ba852ee4f26972c137a68532a 100644 (file)
@@ -13,7 +13,6 @@ import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.mockito.ArgumentMatchers.any;
 import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
 
@@ -72,6 +71,8 @@ public class LLDPDataTreeChangeListenerTest {
     @Mock
     private DataTreeModification<FlowCapableNode> dataTreeModification;
     @Mock
+    private DataObjectModification<FlowCapableNode> dataObjectModification;
+    @Mock
     private DeviceOwnershipService deviceOwnershipService;
     @Captor
     private ArgumentCaptor<AddFlowInput> addFlowInputCaptor;
@@ -80,14 +81,14 @@ public class LLDPDataTreeChangeListenerTest {
 
     @Before
     public void setUp() {
-        doReturn(reg).when(dataBroker).registerDataTreeChangeListener(any(), any());
+        doReturn(reg).when(dataBroker).registerTreeChangeListener(any(), any());
         doReturn(RpcResultBuilder.success().buildFuture()).when(addFlow).invoke(any());
         doReturn(addFlow).when(rpcService).getRpc(any());
         lldpPacketPuntEnforcer = new LLDPPacketPuntEnforcer(dataBroker, deviceOwnershipService, rpcService);
-        final DataTreeIdentifier<FlowCapableNode> identifier = DataTreeIdentifier.create(
+        final DataTreeIdentifier<FlowCapableNode> identifier = DataTreeIdentifier.of(
                 LogicalDatastoreType.OPERATIONAL, NODE_IID.augmentation(FlowCapableNode.class));
         when(dataTreeModification.getRootPath()).thenReturn(identifier);
-        when(dataTreeModification.getRootNode()).thenReturn(mock(DataObjectModification.class));
+        when(dataTreeModification.getRootNode()).thenReturn(dataObjectModification);
         when(dataTreeModification.getRootNode().modificationType()).thenReturn(ModificationType.WRITE);
         when(deviceOwnershipService.isEntityOwned(any())).thenReturn(true);
     }