MdsalUtils { public <D extends org.opendaylight.yangtools.yang.binding.DataObject> boolean put( final LogicalDatastoreType logicalDatastoreType, final InstanceIdentifier<D> path, D data) { boolean result = false; final WriteTransaction transaction = databroker.newWriteOnlyTransaction(); transaction.put(logicalDatastoreType, path, data, true); CheckedFuture<Void, TransactionCommitFailedException> future = transaction.submit(); try { future.checkedGet(); result = true; } catch (TransactionCommitFailedException e) { LOG.warn("Failed to put {} ", path, e); } return result; } MdsalUtils(DataBroker dataBroker); boolean delete(
            final LogicalDatastoreType store, final InstanceIdentifier<D> path); boolean merge(
            final LogicalDatastoreType logicalDatastoreType, final InstanceIdentifier<D> path, D data); boolean put(
            final LogicalDatastoreType logicalDatastoreType, final InstanceIdentifier<D> path, D data); D read(final LogicalDatastoreType store,
            final InstanceIdentifier<D> path); boolean put(LogicalDatastoreType logicalDatastoreType, InstanceIdentifier<T> iid,
            T dataObject, FlowAction isAdd);  }
@Test public void testPut() throws Exception { final DataObject dataObject = mock(DataObject.class); assertTrue(mdsalUtils.put(LogicalDatastoreType.CONFIGURATION, instanceIdentifier, dataObject)); verify(writeTransaction).put(LogicalDatastoreType.CONFIGURATION, instanceIdentifier, dataObject, true); verify(writeTransaction).submit(); when(checkedFuture.checkedGet()).thenThrow(TransactionCommitFailedException.class); assertFalse(mdsalUtils.put(LogicalDatastoreType.CONFIGURATION, instanceIdentifier, dataObject)); verify(writeTransaction, times(2)).put(LogicalDatastoreType.CONFIGURATION, instanceIdentifier, dataObject, true); verify(writeTransaction, times(2)).submit(); }