@Test public void testOnSubtreeModified() { when(rootNode.getModificationType()).thenReturn(DataObjectModification.ModificationType.SUBTREE_MODIFIED); listener.onDataTreeChanged(changes); listener.onDataTreeChanged(changes); verify(listener, times(2)).onSubtreeModified(rootNode, rootIdentifier); }
@Override protected void onSubtreeModified(DataObjectModification<SflowClientSettings> rootNode, InstanceIdentifier<SflowClientSettings> rootIdentifier) { SflowClientSettings sflowClientSettings = Preconditions.checkNotNull(rootNode.getDataAfter()); if (classifierListener != null && ofStatisticsManager != null) { try { classifierListener.close(); ofStatisticsManager.close(); } catch (Exception e) { LOG.error( "Error during closing OFStatisticsManager and ResolvedPolicyClassifierListener. " + "Statistics do not have to be correct because of illegal state.", e); } } ofStatisticsManager = new OFStatisticsManager(executor, statisticsManager); ofStatisticsManager.setSflowCollectorUri(sflowClientSettings.getGbpOfoverlaySflowCollectorUri()); ofStatisticsManager.setDelay(sflowClientSettings.getGbpOfoverlaySflowRetrieveInterval()); classifierListener = new ResolvedPolicyClassifierListener(dataProvider, ofStatisticsManager); }
SflowClientSettingsListener extends DataTreeChangeHandler<SflowClientSettings> { @Override protected void onSubtreeModified(DataObjectModification<SflowClientSettings> rootNode, InstanceIdentifier<SflowClientSettings> rootIdentifier) { SflowClientSettings sflowClientSettings = Preconditions.checkNotNull(rootNode.getDataAfter()); if (classifierListener != null && ofStatisticsManager != null) { try { classifierListener.close(); ofStatisticsManager.close(); } catch (Exception e) { LOG.error( "Error during closing OFStatisticsManager and ResolvedPolicyClassifierListener. " + "Statistics do not have to be correct because of illegal state.", e); } } ofStatisticsManager = new OFStatisticsManager(executor, statisticsManager); ofStatisticsManager.setSflowCollectorUri(sflowClientSettings.getGbpOfoverlaySflowCollectorUri()); ofStatisticsManager.setDelay(sflowClientSettings.getGbpOfoverlaySflowRetrieveInterval()); classifierListener = new ResolvedPolicyClassifierListener(dataProvider, ofStatisticsManager); } }
SflowClientSettingsListener extends DataTreeChangeHandler<SflowClientSettings> { @Override protected void onSubtreeModified(DataObjectModification<SflowClientSettings> rootNode, InstanceIdentifier<SflowClientSettings> rootIdentifier) { SflowClientSettings sflowClientSettings = Preconditions.checkNotNull(rootNode.getDataAfter()); if (classifierListener != null && ofStatisticsManager != null) { try { classifierListener.close(); ofStatisticsManager.close(); } catch (Exception e) { LOG.error( "Error during closing OFStatisticsManager and ResolvedPolicyClassifierListener. " + "Statistics do not have to be correct because of illegal state.", e); } } ofStatisticsManager = new OFStatisticsManager(executor, statisticsManager); ofStatisticsManager.setSflowCollectorUri(sflowClientSettings.getGbpOfoverlaySflowCollectorUri()); ofStatisticsManager.setDelay(sflowClientSettings.getGbpOfoverlaySflowRetrieveInterval()); classifierListener = new ResolvedPolicyClassifierListener(dataProvider, ofStatisticsManager); } SflowClientSettingsListener(DataBroker dataprovider, ScheduledExecutorService executor, StatisticsManager statisticsManager); }
SflowClientSettingsListener extends DataTreeChangeHandler<SflowClientSettings> { @Override protected void onSubtreeModified(DataObjectModification<SflowClientSettings> rootNode, InstanceIdentifier<SflowClientSettings> rootIdentifier) { SflowClientSettings sflowClientSettings = Preconditions.checkNotNull(rootNode.getDataAfter()); if (classifierListener != null && ofStatisticsManager != null) { try { classifierListener.close(); ofStatisticsManager.close(); } catch (Exception e) { LOG.error( "Error during closing OFStatisticsManager and ResolvedPolicyClassifierListener. " + "Statistics do not have to be correct because of illegal state.", e); } } ofStatisticsManager = new OFStatisticsManager(executor, statisticsManager); ofStatisticsManager.setSflowCollectorUri(sflowClientSettings.getGbpOfoverlaySflowCollectorUri()); ofStatisticsManager.setDelay(sflowClientSettings.getGbpOfoverlaySflowRetrieveInterval()); classifierListener = new ResolvedPolicyClassifierListener(dataProvider, ofStatisticsManager); } SflowClientSettingsListener(DataBroker dataprovider, ScheduledExecutorService executor, StatisticsManager statisticsManager);  }
SflowClientSettingsListener extends DataTreeChangeHandler<SflowClientSettings> { @Override protected void onSubtreeModified(DataObjectModification<SflowClientSettings> rootNode, InstanceIdentifier<SflowClientSettings> rootIdentifier) { SflowClientSettings sflowClientSettings = Preconditions.checkNotNull(rootNode.getDataAfter()); if (classifierListener != null && ofStatisticsManager != null) { try { classifierListener.close(); ofStatisticsManager.close(); } catch (Exception e) { LOG.error( "Error during closing OFStatisticsManager and ResolvedPolicyClassifierListener. " + "Statistics do not have to be correct because of illegal state.", e); } } ofStatisticsManager = new OFStatisticsManager(executor, statisticsManager); ofStatisticsManager.setSflowCollectorUri(sflowClientSettings.getGbpOfoverlaySflowCollectorUri()); ofStatisticsManager.setDelay(sflowClientSettings.getGbpOfoverlaySflowRetrieveInterval()); classifierListener = new ResolvedPolicyClassifierListener(dataProvider, ofStatisticsManager); } SflowClientSettingsListener(DataBroker dataprovider, ScheduledExecutorService executor, StatisticsManager statisticsManager);   }