PathListener implements DataTreeChangeListener<Flow> { protected void onFlowRuleDeleted(InstanceIdentifier<Flow> iid, Flow dataBefore) { LOG.debug("Flow rule is deleted: {}.", iid); updater.deleteFlowRule(iid.firstKeyOf(Node.class).getId().getValue(), dataBefore); return; } PathListener(final PathManagerUpdater updater); @Override void onDataTreeChanged(@Nonnull Collection<DataTreeModification<Flow>> changes);  }
@Test public void testOnFlowRuleDeleted() throws Exception { Collection<DataTreeModification<Flow>> changes = new ArrayList<>(); DataTreeModification<Flow> change0 = mock(DataTreeModification.class); NodeId nodeId0 = new NodeId(new Uri(getRandomId("openflow"))); FlowId flowId0 = new FlowId(new Uri(getRandomId("flow"))); when(change0.getRootPath()).thenReturn(getMockRootPath(new NodeKey(nodeId0), new TableKey(DEFAULT_TABLE_ID), new FlowKey(flowId0))); DataObjectModification<Flow> rootNode0 = getMockRootNode(ModificationType.DELETE, getIpv4OutputFlow(flowId0, getRandomId("openflow")), null); when(change0.getRootNode()).thenReturn(rootNode0); changes.add(change0); pathListener1.onDataTreeChanged(changes); pathListener2.onDataTreeChanged(changes); }