@Test public void test_ListenersUnregistration() { DataBroker dataBroker = mock(DataBroker.class); ListenerRegistration<EndpointsListener> endpointsListenerRegistration = mock(ListenerRegistration.class); when(dataBroker.registerDataTreeChangeListener(any(), isA(EndpointsListener.class))) .thenReturn(endpointsListenerRegistration); ListenerRegistration<NeLocationProvider> nelistenerregistration = mock(ListenerRegistration.class); when(dataBroker.registerDataTreeChangeListener(any(), isA(NeLocationProvider.class))) .thenReturn(nelistenerregistration); NeLocationProvider provider = new NeLocationProvider(dataBroker); provider.close(); verify(endpointsListenerRegistration).close(); verify(nelistenerregistration).close(); }
@Override public void close() { this.listenerRegistration.close(); this.endpointsListener.close(); }
NeLocationProvider implements ClusteredDataTreeChangeListener<NetworkElements>, AutoCloseable { @Override public void close() { this.listenerRegistration.close(); this.endpointsListener.close(); } }
NeLocationProvider implements ClusteredDataTreeChangeListener<NetworkElements>, AutoCloseable { @Override public void close() { this.listenerRegistration.close(); this.endpointsListener.close(); } NeLocationProvider(DataBroker dataBroker); }
NeLocationProvider implements ClusteredDataTreeChangeListener<NetworkElements>, AutoCloseable { @Override public void close() { this.listenerRegistration.close(); this.endpointsListener.close(); } NeLocationProvider(DataBroker dataBroker); @Override void close(); synchronized void onEndpointsChange(Collection<DataTreeModification<AddressEndpoint>> changes); @Override synchronized void onDataTreeChanged(Collection<DataTreeModification<NetworkElements>> changes); }
NeLocationProvider implements ClusteredDataTreeChangeListener<NetworkElements>, AutoCloseable { @Override public void close() { this.listenerRegistration.close(); this.endpointsListener.close(); } NeLocationProvider(DataBroker dataBroker); @Override void close(); synchronized void onEndpointsChange(Collection<DataTreeModification<AddressEndpoint>> changes); @Override synchronized void onDataTreeChanged(Collection<DataTreeModification<NetworkElements>> changes); static final String NE_LOCATION_PROVIDER_NAME; }