@Test public void onDataChangedTestRemovedPaths() { doReturn(DataObjectModification.ModificationType.DELETE).when(mockModification).getModificationType(); doReturn(entryValue).when(mockModification).getDataBefore(); listener.onDataTreeChanged(changeEvent); verify(switchManager).updateSwitchConfig(childNodeId, null); }
@Override public void onDataTreeChanged(Collection<DataTreeModification<OfOverlayNodeConfig>> changes) { for (DataTreeModification<OfOverlayNodeConfig> change: changes) { DataObjectModification<OfOverlayNodeConfig> rootNode = change.getRootNode(); NodeId nodeId = change.getRootPath().getRootIdentifier().firstKeyOf(Node.class, NodeKey.class).getId(); switch (rootNode.getModificationType()) { case SUBTREE_MODIFIED: case WRITE: OfOverlayNodeConfig nodeConfig = rootNode.getDataAfter(); LOG.trace("OfOverlayNodeConfig updated. NodeId: {} OfOverlayNodeConfig: {}", nodeId.getValue(), nodeConfig); switchManager.updateSwitchConfig(nodeId, nodeConfig); break; case DELETE: LOG.trace("OfOverlayNodeConfig removed. NodeId: {}", nodeId.getValue()); switchManager.updateSwitchConfig(nodeId, null); break; default: break; } } }
OfOverlayNodeListener implements DataTreeChangeListener<OfOverlayNodeConfig>, AutoCloseable { @Override public void onDataTreeChanged(Collection<DataTreeModification<OfOverlayNodeConfig>> changes) { for (DataTreeModification<OfOverlayNodeConfig> change: changes) { DataObjectModification<OfOverlayNodeConfig> rootNode = change.getRootNode(); NodeId nodeId = change.getRootPath().getRootIdentifier().firstKeyOf(Node.class, NodeKey.class).getId(); switch (rootNode.getModificationType()) { case SUBTREE_MODIFIED: case WRITE: OfOverlayNodeConfig nodeConfig = rootNode.getDataAfter(); LOG.trace("OfOverlayNodeConfig updated. NodeId: {} OfOverlayNodeConfig: {}", nodeId.getValue(), nodeConfig); switchManager.updateSwitchConfig(nodeId, nodeConfig); break; case DELETE: LOG.trace("OfOverlayNodeConfig removed. NodeId: {}", nodeId.getValue()); switchManager.updateSwitchConfig(nodeId, null); break; default: break; } } } }
OfOverlayNodeListener implements DataTreeChangeListener<OfOverlayNodeConfig>, AutoCloseable { @Override public void onDataTreeChanged(Collection<DataTreeModification<OfOverlayNodeConfig>> changes) { for (DataTreeModification<OfOverlayNodeConfig> change: changes) { DataObjectModification<OfOverlayNodeConfig> rootNode = change.getRootNode(); NodeId nodeId = change.getRootPath().getRootIdentifier().firstKeyOf(Node.class, NodeKey.class).getId(); switch (rootNode.getModificationType()) { case SUBTREE_MODIFIED: case WRITE: OfOverlayNodeConfig nodeConfig = rootNode.getDataAfter(); LOG.trace("OfOverlayNodeConfig updated. NodeId: {} OfOverlayNodeConfig: {}", nodeId.getValue(), nodeConfig); switchManager.updateSwitchConfig(nodeId, nodeConfig); break; case DELETE: LOG.trace("OfOverlayNodeConfig removed. NodeId: {}", nodeId.getValue()); switchManager.updateSwitchConfig(nodeId, null); break; default: break; } } } OfOverlayNodeListener(DataBroker dataProvider, SwitchManager switchManager); }
OfOverlayNodeListener implements DataTreeChangeListener<OfOverlayNodeConfig>, AutoCloseable { @Override public void onDataTreeChanged(Collection<DataTreeModification<OfOverlayNodeConfig>> changes) { for (DataTreeModification<OfOverlayNodeConfig> change: changes) { DataObjectModification<OfOverlayNodeConfig> rootNode = change.getRootNode(); NodeId nodeId = change.getRootPath().getRootIdentifier().firstKeyOf(Node.class, NodeKey.class).getId(); switch (rootNode.getModificationType()) { case SUBTREE_MODIFIED: case WRITE: OfOverlayNodeConfig nodeConfig = rootNode.getDataAfter(); LOG.trace("OfOverlayNodeConfig updated. NodeId: {} OfOverlayNodeConfig: {}", nodeId.getValue(), nodeConfig); switchManager.updateSwitchConfig(nodeId, nodeConfig); break; case DELETE: LOG.trace("OfOverlayNodeConfig removed. NodeId: {}", nodeId.getValue()); switchManager.updateSwitchConfig(nodeId, null); break; default: break; } } } OfOverlayNodeListener(DataBroker dataProvider, SwitchManager switchManager); @Override void onDataTreeChanged(Collection<DataTreeModification<OfOverlayNodeConfig>> changes); @Override void close(); }
OfOverlayNodeListener implements DataTreeChangeListener<OfOverlayNodeConfig>, AutoCloseable { @Override public void onDataTreeChanged(Collection<DataTreeModification<OfOverlayNodeConfig>> changes) { for (DataTreeModification<OfOverlayNodeConfig> change: changes) { DataObjectModification<OfOverlayNodeConfig> rootNode = change.getRootNode(); NodeId nodeId = change.getRootPath().getRootIdentifier().firstKeyOf(Node.class, NodeKey.class).getId(); switch (rootNode.getModificationType()) { case SUBTREE_MODIFIED: case WRITE: OfOverlayNodeConfig nodeConfig = rootNode.getDataAfter(); LOG.trace("OfOverlayNodeConfig updated. NodeId: {} OfOverlayNodeConfig: {}", nodeId.getValue(), nodeConfig); switchManager.updateSwitchConfig(nodeId, nodeConfig); break; case DELETE: LOG.trace("OfOverlayNodeConfig removed. NodeId: {}", nodeId.getValue()); switchManager.updateSwitchConfig(nodeId, null); break; default: break; } } } OfOverlayNodeListener(DataBroker dataProvider, SwitchManager switchManager); @Override void onDataTreeChanged(Collection<DataTreeModification<OfOverlayNodeConfig>> changes); @Override void close();  }