@Test public void testOnWrite() throws Exception { ArgumentCaptor<VppEndpointConfEvent> argVppEpEvent = ArgumentCaptor.forClass(VppEndpointConfEvent.class); VppEndpoint vppEndpoint = getBaseVppEndpointBuilder().build(); InstanceIdentifier<VppEndpoint> vppEpIid = InstanceIdentifier.builder(Config.class).child(VppEndpoint.class, vppEndpoint.getKey()).build(); WriteTransaction wTx = getDataBroker().newWriteOnlyTransaction(); wTx.put(LogicalDatastoreType.CONFIGURATION, vppEpIid, vppEndpoint); wTx.submit().get(); Mockito.verify(eventBusMock).post(argVppEpEvent.capture()); VppEndpointConfEvent capturedVppEpEvent = argVppEpEvent.getValue(); Assert.assertEquals(vppEpIid, capturedVppEpEvent.getIid()); assertEqualsOptional(null, capturedVppEpEvent.getBefore()); Optional<VppEndpoint> after = capturedVppEpEvent.getAfter(); assertEqualsOptional(vppEndpoint, capturedVppEpEvent.getAfter()); }
@Override protected void onWrite(DataObjectModification<VppEndpoint> rootNode, InstanceIdentifier<VppEndpoint> rootIdentifier) { VppEndpointConfEvent event = new VppEndpointConfEvent(rootIdentifier, rootNode.getDataBefore(), rootNode.getDataAfter()); LOG.debug("Dispatching event on write: {}", event.getClass()); eventBus.post(event); }
VppEndpointListener extends DataTreeChangeHandler<VppEndpoint> { @Override protected void onWrite(DataObjectModification<VppEndpoint> rootNode, InstanceIdentifier<VppEndpoint> rootIdentifier) { VppEndpointConfEvent event = new VppEndpointConfEvent(rootIdentifier, rootNode.getDataBefore(), rootNode.getDataAfter()); LOG.debug("Dispatching event on write: {}", event.getClass()); eventBus.post(event); } }
VppEndpointListener extends DataTreeChangeHandler<VppEndpoint> { @Override protected void onWrite(DataObjectModification<VppEndpoint> rootNode, InstanceIdentifier<VppEndpoint> rootIdentifier) { VppEndpointConfEvent event = new VppEndpointConfEvent(rootIdentifier, rootNode.getDataBefore(), rootNode.getDataAfter()); LOG.debug("Dispatching event on write: {}", event.getClass()); eventBus.post(event); } VppEndpointListener(DataBroker dataProvider, EventBus eventBus); }
VppEndpointListener extends DataTreeChangeHandler<VppEndpoint> { @Override protected void onWrite(DataObjectModification<VppEndpoint> rootNode, InstanceIdentifier<VppEndpoint> rootIdentifier) { VppEndpointConfEvent event = new VppEndpointConfEvent(rootIdentifier, rootNode.getDataBefore(), rootNode.getDataAfter()); LOG.debug("Dispatching event on write: {}", event.getClass()); eventBus.post(event); } VppEndpointListener(DataBroker dataProvider, EventBus eventBus); void flushPendingVppEndpoint(@Nonnull String hostName,@Nonnull String intfName); }
VppEndpointListener extends DataTreeChangeHandler<VppEndpoint> { @Override protected void onWrite(DataObjectModification<VppEndpoint> rootNode, InstanceIdentifier<VppEndpoint> rootIdentifier) { VppEndpointConfEvent event = new VppEndpointConfEvent(rootIdentifier, rootNode.getDataBefore(), rootNode.getDataAfter()); LOG.debug("Dispatching event on write: {}", event.getClass()); eventBus.post(event); } VppEndpointListener(DataBroker dataProvider, EventBus eventBus); void flushPendingVppEndpoint(@Nonnull String hostName,@Nonnull String intfName);  }