SimpleIrdEntryListener implements AutoCloseable, DataTreeChangeListener<IrdConfigurationEntry> { public void register(DataBroker dataBroker, InstanceIdentifier<IrdConfigurationEntry> iid) { this.dataBroker = dataBroker; irdConfigEntryIid = iid; listenerReg = dataBroker.registerDataTreeChangeListener(new DataTreeIdentifier<>( LogicalDatastoreType.CONFIGURATION, irdConfigEntryIid), this); LOG.info("SimpleIrdEntryListener registered"); } SimpleIrdEntryListener(InstanceIdentifier<Resource> instance, Uuid entryContext); void register(DataBroker dataBroker, InstanceIdentifier<IrdConfigurationEntry> iid); @Override synchronized void onDataTreeChanged(Collection<DataTreeModification<IrdConfigurationEntry>> changes); @Override synchronized void close();  }
@Test public void register() throws Exception { InstanceIdentifier<IrdConfigurationEntry> iiceIID = InstanceIdentifier.builder(IrdInstanceConfiguration.class , new IrdInstanceConfigurationKey(new ResourceId(DEFAULT_IRD_CONFIGURATION_KEY))) .child(IrdConfigurationEntry.class).build(); simpleIrdEntryListener.register(m_dataBroker, iiceIID); verify(m_dataBroker,times(2)).registerDataTreeChangeListener(new DataTreeIdentifier<>( LogicalDatastoreType.CONFIGURATION, iiceIID), this.simpleIrdEntryListener); }