SimpleIrdListener implements AutoCloseable, DataTreeChangeListener<IrdInstanceConfiguration> { protected void updateIrd(IrdInstanceConfiguration original, IrdInstanceConfiguration updated, WriteTransaction wx) { ResourceId rid = updated.getInstanceId(); LOG.info("Updating Ird: " + "\n\tResource ID: " + rid.getValue()); SimpleIrdEntryListener listener = mListeners.get(rid); if (listener != null) { if (original.getEntryContext().equals(updated.getEntryContext())) { return ; } LOG.error("Changing entry context is forbidden! Removing the Ird instance."); removeIrd(original, wx); return; } createIrd(updated, wx); } SimpleIrdListener(Uuid context); void register(DataBroker dataBroker, InstanceIdentifier<IrdInstanceConfiguration> iid); @Override synchronized void onDataTreeChanged(Collection<DataTreeModification<IrdInstanceConfiguration>> changes); @Override synchronized void close();  }
@Test public void updateIrd() throws Exception { IrdInstanceConfigurationBuilder originalIICB = new IrdInstanceConfigurationBuilder() .setInstanceId(new ResourceId(ORIGINAL_INSTANCE_ID)); IrdInstanceConfigurationBuilder updatedIICB = new IrdInstanceConfigurationBuilder() .setInstanceId(new ResourceId(UPDATED_INSTANCE_ID)); simpleIrdListener.updateIrd(originalIICB.build(), updatedIICB.build(), wx); }