SfcOfRendererDataListener extends SfcOfAbstractDataListener { @Override public void onDataChanged(AsyncDataChangeEvent<InstanceIdentifier<?>, DataObject> change) { for (Entry<InstanceIdentifier<?>, DataObject> entry : change.getCreatedData().entrySet()) { if (entry.getValue() instanceof SfcOfRendererConfig) { LOG.info("SfcOfRendererDataListener.onDataChanged create SFC OF Renderer config {}", ((SfcOfRendererConfig) entry.getValue())); processConfig((SfcOfRendererConfig) entry.getValue()); } } for (Entry<InstanceIdentifier<?>, DataObject> entry : change.getUpdatedData().entrySet()) { if (entry.getValue() instanceof SfcOfRendererConfig) { LOG.info("SfcOfRendererDataListener.onDataChanged update SFC OF Renderer config {}", ((SfcOfRendererConfig) entry.getValue())); processConfig((SfcOfRendererConfig) entry.getValue()); } } } SfcOfRendererDataListener(
            DataBroker dataBroker,
            SfcOfFlowProgrammerInterface sfcOfFlowProgrammer,
            SfcSynchronizer sfcSynchronizer); @Override void onDataChanged(AsyncDataChangeEvent<InstanceIdentifier<?>, DataObject> change); TableId verifyMaxTableId(short tableOffset, short maxTable);  }
@Test public void invalidTableOffset() throws InterruptedException { AsyncDataChangeEvent<InstanceIdentifier<?>, DataObject> change = createSfcOfRendererConfig(0, 100); this.sfcOfRendererDataListener.onDataChanged(change); Thread.sleep(SLEEP); verifySettersNotCalled(); change = createSfcOfRendererConfig(1, 100); this.sfcOfRendererDataListener.onDataChanged(change); Thread.sleep(SLEEP); verifySettersNotCalled(); change = createSfcOfRendererConfig(250, 100); this.sfcOfRendererDataListener.onDataChanged(change); Thread.sleep(SLEEP); verifySettersNotCalled(); }
@Test public void invalidTableEgress() throws InterruptedException { AsyncDataChangeEvent<InstanceIdentifier<?>, DataObject> change = null; for(int i = 100; i < 110; ++i) { change = createSfcOfRendererConfig(100, i); this.sfcOfRendererDataListener.onDataChanged(change); Thread.sleep(SLEEP); verifySettersNotCalled(); } }
@Test public void offsetLessThanEgress() throws InterruptedException { int offset = 20; int egress = 80; AsyncDataChangeEvent<InstanceIdentifier<?>, DataObject> change = createSfcOfRendererConfig(offset, egress); this.sfcOfRendererDataListener.onDataChanged(change); Thread.sleep(100); verifySettersCalled(offset, egress); }
@Test public void offsetGreaterThanEgress() throws InterruptedException { int offset = 200; int egress = 10; AsyncDataChangeEvent<InstanceIdentifier<?>, DataObject> change = createSfcOfRendererConfig(offset, egress); this.sfcOfRendererDataListener.onDataChanged(change); Thread.sleep(100); verifySettersCalled(offset, egress); }
@Test public void egressSetZero() throws InterruptedException { int offset = 100; int egress = 0; AsyncDataChangeEvent<InstanceIdentifier<?>, DataObject> change = createSfcOfRendererConfig(offset, egress); this.sfcOfRendererDataListener.onDataChanged(change); Thread.sleep(100); verifySettersCalled(offset, egress); }