- public void testNoChangeOnReplaceWithSameValue() throws InterruptedException, TimeoutException, ExecutionException {
-
- DataProviderService dataBroker = testContext.getBindingDataBroker();
-
- // We wrote initial state NODE_0_FLOW
- DataModificationTransaction transaction = dataBroker.beginTransaction();
- transaction.putOperationalData(NODE_0_FLOW_PATH, FLOW);
- transaction.commit().get();
-
- // We registered DataChangeListener
- final SettableFuture<DataChangeEvent<InstanceIdentifier<?>, DataObject>> eventFuture = SettableFuture.create();
- dataBroker.registerDataChangeListener(DEEP_WILDCARDED_PATH, new DataChangeListener() {
-
- @Override
- public void onDataChanged(final DataChangeEvent<InstanceIdentifier<?>, DataObject> dataChangeEvent) {
- eventFuture.set(dataChangeEvent);
- }
- });
- assertFalse(eventFuture.isDone());
-
- DataModificationTransaction secondTx = dataBroker.beginTransaction();
- secondTx.putOperationalData(NODE_0_FLOW_PATH, FLOW);
- secondTx.putOperationalData(NODE_1_FLOW_PATH, FLOW);
- secondTx.commit().get();
-
- DataChangeEvent<InstanceIdentifier<?>, DataObject> event = (eventFuture.get(1000, TimeUnit.MILLISECONDS));
- assertNotNull(event);
- // Data change should contains NODE_1 Flow - which was added
- assertTrue(event.getCreatedOperationalData().containsKey(NODE_1_FLOW_PATH));
- // Data change must not containe NODE_0 Flow which was replaced with same value.
- assertFalse(event.getUpdatedOperationalData().containsKey(NODE_0_FLOW_PATH));
- }