SimpleIrdEntryListener implements AutoCloseable, DataTreeChangeListener<IrdConfigurationEntry> { protected void cleanupIrdInstance(IrdInstanceConfiguration cfg, ReadWriteTransaction rwx) { IrdInstanceBuilder builder = new IrdInstanceBuilder(); builder.fieldsFrom(cfg); builder.setIrdEntry(new LinkedList<IrdEntry>()); InstanceIdentifier<IrdInstance> iid; iid = SimpleIrdUtils.getInstanceIID(cfg.getInstanceId()); rwx.put(LogicalDatastoreType.OPERATIONAL, iid, builder.build()); ResourcepoolUtils.updateResource(context, resourceId, null, rwx); } 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 cleanupIrdInstance() throws Exception { IrdInstanceConfigurationBuilder iicb = new IrdInstanceConfigurationBuilder(); simpleIrdEntryListener.cleanupIrdInstance(iicb.build(), rwx); }